예제 #1
0
 public Task UpdateTns(string number, SipPeerTelephoneNumber data)
 {
     if (number == null) throw new ArgumentNullException("number");
     if (SiteId == null) throw new ArgumentNullException("SiteId");
     return Client.MakePutRequest(
         Client.ConcatAccountPath(
             string.Format("{0}/{1}/{2}/{3}/{4}/{5}", Site.SitePath, SiteId, 
             Site.SipPeerPath, Id, TnsPath, number)), data, true);
 }
예제 #2
0
 public Task UpdateTns(string number, SipPeerTelephoneNumber data)
 {
     if (number == null)
     {
         throw new ArgumentNullException("number");
     }
     if (SiteId == null)
     {
         throw new ArgumentNullException("SiteId");
     }
     return(Client.MakePutRequest(
                Client.ConcatAccountPath(
                    string.Format("{0}/{1}/{2}/{3}/{4}/{5}", Site.SitePath, SiteId,
                                  Site.SipPeerPath, Id, TnsPath, number)), data, true));
 }
예제 #3
0
 public void UpdateTnsTest()
 {
     var item = new SipPeerTelephoneNumber
     {
         FullNumber = "Number",
         RewriteUser = "******"
     };
     using (var server = new HttpServer(new RequestHandler
     {
         EstimatedMethod = "PUT",
         EstimatedPathAndQuery = string.Format("/v1.0/accounts/{0}/sites/1/sippeers/10/tns/00", Helper.AccountId),
         EstimatedContent = Helper.ToXmlString(item)
     }))
     {
         var client = Helper.CreateClient();
         var peer = new SipPeer
         {
             Id = "10",
             SiteId = "1"
         };
         peer.SetClient(client);
         peer.UpdateTns("00", item).Wait();
         if (server.Error != null) throw server.Error;
     }
 }
예제 #4
0
 public void GetTnsTest()
 {
     var item = new SipPeerTelephoneNumber
     {
         FullNumber = "Number",
         RewriteUser = "******"
     };
     var response = new SipPeerTelephoneNumberResponse
     {
         SipPeerTelephoneNumber = item
     };
     using (var server = new HttpServer(new RequestHandler
     {
         EstimatedMethod = "GET",
         EstimatedPathAndQuery = string.Format("/v1.0/accounts/{0}/sites/1/sippeers/10/tns/00", Helper.AccountId),
         ContentToSend = Helper.CreateXmlContent(response)
     }))
     {
         var client = Helper.CreateClient();
         var peer = new SipPeer
         {
             Id = "10",
             SiteId = "1"
         };
         peer.SetClient(client);
         var result = peer.GetTns("00").Result;
         if (server.Error != null) throw server.Error;
         Helper.AssertObjects(item, result);
     }
 }