Beispiel #1
0
        public void CreateCall()
        {
            CommunicationIdentityClient communicationIdentityClient = new CommunicationIdentityClient(TestEnvironment.LiveTestDynamicConnectionString);
            var source  = communicationIdentityClient.CreateUser();
            var targets = new List <CommunicationIdentifier>()
            {
                new PhoneNumberIdentifier(TestEnvironment.SourcePhoneNumber)
            };
            var createCallOption = new CreateCallOptions(
                new Uri(TestEnvironment.AppCallbackUrl),
                new List <CallModality> {
                CallModality.Audio
            },
                new List <EventSubscriptionType> {
                EventSubscriptionType.ParticipantsUpdated,
                EventSubscriptionType.DtmfReceived
            });
            CallClient callClient = CreateInstrumentedCallingServerClient();

            Console.WriteLine("Performing CreateCall operation");
            #region Snippet:Azure_Communication_Call_Tests_CreateCall
            CreateCallResponse createCallResponse = callClient.CreateCall(
                //@@ source: new CommunicationUserIdentifier("<source-identifier>"), // Your Azure Communication Resource Guid Id used to make a Call
                //@@ targets: new List<CommunicationIdentifier>() { new PhoneNumberIdentifier("<targets-phone-number>") }, // E.164 formatted recipient phone number
                //@@ options: createCallOption // The options for creating a call.
                /*@@*/ source: source,
                /*@@*/ targets: targets,
                /*@@*/ options: createCallOption
                );
            Console.WriteLine($"Call Leg id: {createCallResponse.CallLegId}");
            #endregion Snippet:Azure_Communication_Call_Tests_CreateCall
        }
Beispiel #2
0
        private void CallButton_Click(object sender, EventArgs e)
        {
            try
            {
                var api = new ConversationsApi();

                CreateCallRequest body = new CreateCallRequest();
                body.PhoneNumber = "+6285221675710";

                CreateCallResponse result = api.PostConversationsCalls(body);
                conversationIdTextBox.Text = result.ToJson();
                conversationIdTextBox.Text = result.Id;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
 public void Init()
 {
     instance = new CreateCallResponse();
 }