On Fri, Oct 19, 2012 at 9:36 AM, Russell Fox <[email protected]> wrote:
>
>
> I’m trying to get a list of phones (users too) using SOAP, but get no
> records returned even though I use the exact serialnumber that I added the
> record with.
>

Hm, I just double checked on a 4.4 machine using SoapUI and I cannot
get response back either, I am looking into and will come back

>
>
> I’ve tried this against version 4.4 and 4.6 (originally thought it was a
> problem on 4.4). The code adds the record successfully (I’ve checked via the
> web site) but fails to retrieve it back again. I’ve also tried with an empty
> value in search.bySerialNumber and by setting the group and searching on
> that.
>
>
>
> I’d prefer to be doing these calls via REST services, but couldn’t find the
> relevant documentation for Phones and Users for REST.
>

Unfortunately there is no REST API at this moment for this (though it
should be pretty easy to add)

George
class Program
    {        
        static void Main(string[] args)
        {

            NetworkCredential sipXCredential = new 
NetworkCredential(SipXUserName, SipXPassword);
            //Disable problem with invalid certificate on the site  
            // - should probably be removed later on, but keep while figuring 
this out.
            ServicePointManager.ServerCertificateValidationCallback = 
delegate(object s, X509Certificate certificate, X509Chain chain, 
SslPolicyErrors sslPolicyErrors) { return true; };


            PhoneService4_6 phone_service = new PhoneService4_6();
            phone_service.Credentials = sipXCredential;
            
            Phone seed = new Phone() { serialNumber = "000000000001", modelId = 
"acmePhoneStandard" };
            AddPhone addPhone = new AddPhone() { phone = seed };
            try
            {
                Console.WriteLine(string.Format("Adding Phone: {0}", 
addPhone.phone.serialNumber));
                phone_service.addPhone(addPhone);
                Console.WriteLine("Added phone");
            }
            catch (Exception e)
            {
                Console.WriteLine(string.Format("Error: {0}", e.Message));
            }
            Console.WriteLine();

            PhoneSearch search = new PhoneSearch() { bySerialNumber = 
seed.serialNumber};

            try
            {
                Console.WriteLine(string.Format("findPhone: {0}", 
search.bySerialNumber));
                var all = phone_service.findPhone(new FindPhone() { search = 
search }).phones;
                if (all.Count() != 0)
                {
                    foreach (var phone in all)
                    {
                        Console.WriteLine(string.Format("Phone returned: {0}", 
phone.serialNumber));
                    }
                }
                Console.WriteLine(string.Format("findPhone returned {0}", 
all.Count().ToString()));
            }
            catch (Exception e)
            {
                Console.WriteLine(string.Format("Error: {0}", e.Message));
            }

            Console.ReadLine();
        }


        

        

    }
_______________________________________________
sipx-users mailing list
[email protected]
List Archive: http://list.sipfoundry.org/archive/sipx-users/

Reply via email to