/// <summary> /// Using the Site and SipPeer created in the createSiteAndSipPeer() /// this method will create a Voice application and associate it with /// the newly created SipPeer (location). /// This is done through the SipPeer by setting the Origination Settings /// </summary> /// <returns></returns> static async Task createVoiceApplication() { var appVoice = await Application.Create(client, new Application { AppName = "BandwidthVoiceApplication", ServiceType = "Voice-V2", CallInitiatedCallbackUrl = "https://yourcallback.com" }); Console.WriteLine($"Created Voice Application with ID: {appVoice.Application.ApplicationId}"); var featureVoice = await SipPeer.SetOriginationSettings(client, site.Id, sipPeer.Id, new SipPeerOriginationSettings { VoiceProtocol = "HTTP", HttpSettings = new HttpSettings { HttpVoiceV2AppId = appVoice.Application.ApplicationId } }); Console.WriteLine("Updated SipPeer/Location with Voice Application") }
public void SetOriginationSettingsTest() { string siteId = "1"; string sipPeerId = "test"; var SipPeerOriginationSettings = new SipPeerOriginationSettings { VoiceProtocol = "HTTP", HttpSettings = new HttpSettings { HttpVoiceV2AppId = "469ebbac-4459-4d98-bc19-a038960e787f" } }; using (var server = new HttpServer(new[] { new RequestHandler { EstimatedMethod = "POST", EstimatedPathAndQuery = $"/v1.0/accounts/{Helper.AccountId}/sites/{siteId}/sippeers/{sipPeerId}/products/origination/settings", ContentToSend = new StringContent(TestXmlStrings.SipPeerOriginationSettingsResponse, Encoding.UTF8, "application/xml") } })) { var client = Helper.CreateClient(); var r = SipPeer.SetOriginationSettings(siteId, sipPeerId, SipPeerOriginationSettings).Result; if (server.Error != null) { throw server.Error; } Assert.IsNotNull(r.SipPeerOriginationSettings); Assert.AreEqual("HTTP", r.SipPeerOriginationSettings.VoiceProtocol); Assert.AreEqual("469ebbac-4459-4d98-bc19-a038960e787f", r.SipPeerOriginationSettings.HttpSettings.HttpVoiceV2AppId); } }