Microsoft Graph Communications API Samples

repository·master·Indexed 42 days ago

https://github.com/microsoftgraph/microsoft-graph-comms-samples

Samples and documentation for the Microsoft Graph Communications API, enabling programmatic interaction with Microsoft's communications platform and Microsoft Teams. Includes implementation examples for calling bots, compliance recording policies, online meetings, and voice echo bots using the Microsoft.Graph.Communications.Client.

Tokens
36.7K
Snippets
70
Records
159
Agent score
54%

What's inside Microsoft Graph Communications API

  1. Overview of TeamsBot Sample implementations

    master

    The TeamsBot Sample provides two distinct implementations of the ITeamsBot interface. Both implementations are designed to consume participant audio and video data to visualize engagement.

    Engagement is visualized through two methods:

    1. Gravitating Ball: A ball moves toward the most active speakers.
    2. Scaling Video Frames: Participant video frames are scaled based on activity.

    You can use these implementations in two ways:

    • Live Meetings: Configure the PsiBot Teams bot (../PsiBot/PsiBot.Service/) to use either implementation when deployed.
    • Local Testing/Development: Configure the TeamsBotTester project (../TeamsBotTester/) to use either implementation when running from persisted data.
  2. Overview of Local Media Samples

    master

    Local media samples provide direct access to inbound and outbound media streams. The following samples are available:

    • AudioVideoPlaybackBot: Demonstrates playing movies in multiple resolutions as video output, subscribing to inbound video feeds of dominant speakers, and switching between screen viewing roles via the screen sharing socket.
    • HueBot: Demonstrates reacting to dominant speaker events by changing the hue color of the dominant speaker's video.
    • PolicyRecordingBot: Demonstrates compliance recording. The bot is automatically pulled into calls when a user with a specific organizational compliance recording policy joins.
  3. Overview of VoiceRecorderAndPlaybackBot

    master

    The VoiceRecorderAndPlaybackBot sample demonstrates a workflow where a bot interacts with a user via audio.

    Workflow sequence:

    1. The user calls the bot and the bot answers.
    2. The bot plays an audio prompt indicating it is ready to record.
    3. The bot records the user's speech (maximum duration of 10 seconds).
    4. The bot plays back the recorded message to the user.
    5. The bot hangs up the call.
  4. Overview of the Policy Recording Bot sample

    master

    The Policy Recording Bot sample demonstrates how to build, deploy, and test a bot capable of receiving media streams for recording purposes.

    Important Constraints:

    • Compliance Only: This sample is strictly designed for compliance recording scenarios (e.g., Org Regulated recording). It is not intended for other recording purposes.
    • User Experience Risk: Using this for non-compliance purposes may interfere with the user calling experience. Refer to the Teams recording policy documentation for details.
    • No Actual Recording: The sample provides the mechanism to receive media streams, but it does not implement the actual recording logic. Developers must implement their own recording logic to save the streams.
  5. Overview of SimpleIvrBot

    master

    The SimpleIvrBot sample demonstrates an Interactive Voice Response (IVR) bot using the Microsoft Graph Communications API. The bot performs the following workflow:

    1. Receives an incoming call.
    2. Plays an audio prompt (e.g., 'Press 1 for sales, Press 2 for service, Press 3 for other questions').
    3. Subscribes to DTMF tones (key presses) from the user.
    4. Transfers the call to a specific agent based on the user's selection.
  6. Overview of the Reminder Bot Sample

    master

    The Reminder Bot sample demonstrates a workflow where a bot monitors a user's Outlook calendar and proactively alerts them to upcoming meetings via a call.

    Workflow:

    1. The bot accesses the user's calendar.
    2. The bot detects an appointment scheduled within the next hour.
    3. The bot calls the user (via Teams/Skype) and plays a prompt to alert them of the meeting.
  7. Overview of the IncidentBot Solution Structure

    master

    The IncidentBot is a sample solution designed to demonstrate Microsoft Graph Communications API capabilities. It is structured as a web application that handles incoming call requests from the platform and manages incident scenarios through specialized call handlers and controllers.

    Core Components

    • Bot Logic: Located in the Bot directory, this contains the core orchestration logic, including Bot.cs for management and AuthenticationProvider.cs for handling bot authentication and platform request token validation.
    • Call Handlers: The solution uses specialized handlers to manage different call types:
      • CallHandler.cs: The base class for all call handling.
      • MeetingCallHandler.cs: Specifically for handling bot meeting calls.
      • ResponderCallHandler.cs: Specifically for handling responder calls.
    • Controllers:
      • PlatformCallController.cs: The entry point for receiving Incoming Request messages from the Microsoft Graph platform; it hands messages over to the Bot for processing.
      • IncidentsController.cs: Used to trigger incidents and retrieve incident logs.
    • Infrastructure:
      • CallAffinityHelper.cs: Ensures that an IncomingRequest is kept within the same web instance.
      • appsettings.json: The primary configuration file for the application.
      • Program.cs & Startup.cs: The entry and initialization classes for the web executable.
  8. Overview of the OnlineMeetingSample

    master

    The OnlineMeetingSample is a stateless demonstration of how to use the Microsoft.Graph.Communications.Client within a bot application to interact with Microsoft Teams online meetings. It demonstrates two primary capabilities:

    1. Retrieving an online meeting: Fetching meeting details using a VTCID.
    2. Creating an online meeting: Creating a meeting on behalf of a user using delegated authentication within your tenant.
  9. Overview of the IncidentBot Sample

    master

    The IncidentBot sample demonstrates an automated incident response workflow. When an incident is raised via a web API call, the bot performs the following sequence:

    1. Joins a scheduled meeting associated with the incident.
    2. Calls incident responders.
    3. Plays an audio prompt explaining the incident.
    4. Decodes DTMF (Dual-Tone Multi-Frequency) input from responders.
    5. Connects responders to the meeting if they press "1" on their keypad.
  10. Overview of the Teams Media Bot

    master

    The Teams Media Bot is a .NET Framework (C#) application designed to intercept and process media streams from Microsoft Teams calls. While primarily used for call recording, it serves as a flexible skeleton for various real-time media processing use cases, such as:

    • Real-time assistance: Responding to meeting content or process.
    • Speech-to-Text: Converting voice streams to text for transcription.
    • Call enhancement: Collecting DTMF tones or injecting audio/video content into calls.
    • External service integration: Passing media to services for emotion detection or other analysis.

    Important Compliance Note: It is against the terms of use to record calls without informing all participants. This bot is designed to work with 'Compliance Recording' (Organizational Recording) policies, which allow for the display of required recording banners.

  11. Explore Microsoft Graph Communications API Samples

    master

    The Microsoft Graph Communications API enables programmatic interaction with Microsoft's Communications Platform (the technology powering Microsoft Teams). You can use the samples in this repository to understand the capabilities and implementation patterns of these APIs.

    To begin using the technology, you should:

    1. Review the documentation: Visit the official documentation site to understand the core concepts and the SDK used by the samples.
    2. Browse the samples: Explore the Samples directory for concrete implementation examples.
    3. Check the changelog: View the changelog for updates and version history.