public void UpdateApplicationSettingTest()
        {
            string siteId    = "1";
            string sipPeerId = "test";

            var ApplicationSettings = new ApplicationsSettings
            {
                HttpMessagingV2AppId = "c3b0f805-06ab-4d36-8bf4-8baff7623398"
            };

            using (var server = new HttpServer(new[]
            {
                new RequestHandler
                {
                    EstimatedMethod = "PUT",
                    EstimatedPathAndQuery = $"/v1.0/accounts/{Helper.AccountId}/sites/{siteId}/sippeers/{sipPeerId}/products/messaging/applicationSettings",
                    ContentToSend = new StringContent(TestXmlStrings.ApplicationSettingsResponse, Encoding.UTF8, "application/xml")
                }
            }))
            {
                var client = Helper.CreateClient();
                SipPeer.UpdateApplicationSettings(siteId, sipPeerId, ApplicationSettings).Wait();
                if (server.Error != null)
                {
                    throw server.Error;
                }
            }
        }
Example #2
0
        /// <summary>
        /// Using the Site and SipPeer created in the createSiteAndSipPeer()
        /// this method will create a Messaging application and associate it with
        /// the newly created SipPeer (location).
        /// It will also add the SMS and MMS features toteh SipPeer (location)
        /// This makes it possible for the SipPeer (location) to be used by a Messaging Application
        /// </summary>
        /// <returns></returns>
        static async Task createMessageApplication()
        {
            var appMsg = await Application.Create(client, new Application
            {
                AppName        = "BandwidthMsgApplication",
                ServiceType    = "Messaging-V2",
                MsgCallbackUrl = "https://yourcallback.com"
            });

            Console.WriteLine($"Created Messaging Application with ID: {appMsg.Application.ApplicationId}");

            var featureSmsMsg = await SipPeer.CreateSMSSettings(client, site.Id, sipPeer.Id, new SipPeerSmsFeature
            {
                SipPeerSmsFeatureSettings = new SipPeerSmsFeatureSettings
                {
                    TollFree  = false,
                    ShortCode = false,
                    Protocol  = "HTTP",
                    Zone1     = true,
                    Zone2     = false,
                    Zone3     = false,
                    Zone4     = false,
                    Zone5     = false,
                },
                HttpSettings = new HttpSettings
                {
                }
            });

            Console.WriteLine("Updated SipPeer/Location with SMS Settings.");

            var featureMmsMsg = await SipPeer.CreateMMSSettings(client, site.Id, sipPeer.Id, new MmsFeature
            {
                MmsSettings = new MmsSettings
                {
                    Protocol = "HTTP"
                },
                Protocols = new Protocols
                {
                    HTTP = new HTTP {
                        HttpSettings = new HttpSettings
                        {
                        }
                    }
                }
            });

            Console.WriteLine("Updated SipPeer/Location with MMS Settings.");

            await SipPeer.UpdateApplicationSettings(client, site.Id, sipPeer.Id, new ApplicationsSettings
            {
                HttpMessagingV2AppId = appMsg.Application.ApplicationId
            });

            Console.WriteLine("Updated SipPeer/Location with Messaging Application");
        }