/// <summary> /// This method will create a Bandwidth /// /// Site which on the Bandwidth Console is a Subaccount /// /// SipPeer which on the Bandwidth Console is a location /// </summary> /// <returns></returns> static async Task createSiteAndSipPeer() { site = await Site.Create(client, new Site { Name = "BandwidthApplicationSubAccount", Address = new Address { City = "RALEIGH", HouseNumber = "900", StateCode = "NC", StreetName = "Main Campus Dr", StreetSuffix = "DR", Zip = "27606", AddressType = "Billing" } }); Console.WriteLine($"Created Site/Subaccount with ID: {site.Id}"); sipPeer = await SipPeer.Create(client, new SipPeer { SiteId = site.Id, Name = "BandwidthApplicationLocation", IsDefaultPeer = true }); Console.WriteLine($"Created SipPeer/Location with ID: {sipPeer.Id}"); }
static async Task SipPeerDemo() { var sipPeerHost = ConfigurationManager.AppSettings["sipPeerHost"]; var newSipPeer = await SipPeer.Create(_client, new SipPeer() { IsDefaultPeer = true, ShortMessagingProtocol = "SMPP", SiteId = ConfigurationManager.AppSettings["selectedSiteId"], VoiceHosts = new [] { new HostData { HostName = sipPeerHost } }, SmsHosts = new [] { new HostData { HostName = sipPeerHost } }, TerminationHosts = new TerminationHost[] { new TerminationHost() { HostName = sipPeerHost, Port = 5060 } } }); Console.WriteLine("New SipPeer Created, ID: {0}", newSipPeer.PeerId); }
public void CreateTest() { var item = new SipPeer { Name = "test", SiteId = "1", IsDefaultPeer = true }; var createdItem = new SipPeer { Id = "1", SiteId = "1", Name = "test", IsDefaultPeer = true }; using (var server = new HttpServer(new[] { new RequestHandler { EstimatedMethod = "POST", EstimatedPathAndQuery = string.Format("/v1.0/accounts/{0}/sites/1/sippeers", Helper.AccountId), EstimatedContent = Helper.ToXmlString(item), HeadersToSend = new Dictionary <string, string> { { "Location", string.Format("/v1.0/accounts/{0}/sites/1/sippeers/10", Helper.AccountId) } }, StatusCodeToSend = 201 }, new RequestHandler { EstimatedMethod = "GET", EstimatedPathAndQuery = string.Format("/v1.0/accounts/{0}/sites/1/sippeers/10", Helper.AccountId), ContentToSend = Helper.CreateXmlContent(new SipPeerResponse { SipPeer = createdItem }) } })) { var client = Helper.CreateClient(); var r = SipPeer.Create(client, item).Result; Helper.AssertObjects(createdItem, r); if (server.Error != null) { throw server.Error; } } }