Independentsoft
Professional software libraries for developers
Home
Purchase
Support
Company
Contact
Graph .NET
>
Tutorial
> Create call
The following example shows you how to create a peer-to-peer call.
C# example
using System; using System.Collections.Generic; using System.Threading.Tasks; using Independentsoft.Graph; using Independentsoft.Graph.Calls; namespace Sample { class Program { static async Task Main(string[] args) { try { GraphClient client = new GraphClient(); client.ClientId = "63333333-209e-454e-b7bd-55a4d201270f"; client.Tenant = "independentsoft.onmicrosoft.com"; client.ClientSecret = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; CommunicationsIdentitySet identitySet = new CommunicationsIdentitySet(); AcsIdentity identity = new AcsIdentity(); identity.Id = "user-id-456"; identitySet.AcsUser = identity; InvitationParticipantInfo participant = new InvitationParticipantInfo(); participant.Identity = identitySet; Call call = new Call(); call.CallbackUri = "https://bot.contoso.com/callback"; call.RequestedModalities = new List<Modality> { Modality.Audio }; call.MediaConfig = new ServiceHostedMediaConfig(); call.Targets = new List<InvitationParticipantInfo> { participant }; Call newCall = await client.CreateCall(call); Console.WriteLine("Call Id: " + newCall.Id); Console.Read(); } catch (GraphException ex) { Console.WriteLine("Error: " + ex.Code); Console.WriteLine("Message: " + ex.Message); Console.Read(); } } } }
VB example
Imports System.Collections.Generic Imports Independentsoft.Graph Imports Independentsoft.Graph.Calls Namespace Sample Class Module1 Shared Sub Main(ByVal args As String()) Dim task = New Task(AddressOf Run) task.Start() Console.Read() End Sub Shared Async Sub Run() Try Dim client As GraphClient = New GraphClient() client.ClientId = "63333333-209e-454e-b7bd-55a4d201270f" client.Tenant = "independentsoft.onmicrosoft.com" client.ClientSecret = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" Dim identitySet As CommunicationsIdentitySet = New CommunicationsIdentitySet() Dim identity As AcsIdentity = New AcsIdentity() identity.Id = "user-id-456" identitySet.AcsUser = identity Dim participant As InvitationParticipantInfo = New InvitationParticipantInfo() participant.Identity = identitySet Dim call As Call = New Call() call.CallbackUri = "https://bot.contoso.com/callback" call.RequestedModalities = New List(Of Modality) From {Modality.Audio} call.MediaConfig = New ServiceHostedMediaConfig() call.Targets = New List(Of InvitationParticipantInfo) From {participant} Dim newCall As Call = Await client.CreateCall(call) Console.WriteLine("Call Id: " & newCall.Id) Catch ex As GraphException Console.WriteLine("Error: " + ex.Code) Console.WriteLine("Error: " + ex.Message) Console.Read() End Try End Sub End Class End Namespace
Need help? Ask our developers:
Name*
Email*
Message*