cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
694
Views
0
Helpful
2
Replies

How to query the registration status of a SINGLE IP phone?

techToddler
Level 1
Level 1

Hello Friends,

 

So, I am trying to use soapclient with PHP to query the status of a phone. 

I am aware that risport70 can do that, however, it does go pull all the records every time I query. 

Also, I am not seeing a method like <DeviceName> or <Name> to query.

 

Could someone help me with how to query just a single phone with its MAC address?

Below is what I am trying now,

 

 

try
    {
      $devices = $client->SelectCmDevice(array("StateInfo"=>"",
      "CmSelectionCriteria"=>array(
          "Status"=>"Any",
          "SelectBy"=>"Name",
          "SelectItems"=>"",
        )));
      echo "<pre>";
      print_r($devices);
      echo "</pre>";
    }
 
 

I appreciate your help.

 

Regards

Sanjay

2 Replies 2

dstaudt
Cisco Employee
Cisco Employee

Essentially you want to provide an <items> array with a single <Item> with your device name - so the equivalent of this XML:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="http://schemas.cisco.com/ast/soap">
   <soapenv:Header/>
   <soapenv:Body>
      <soap:selectCmDevice>
         <soap:StateInfo/>
         <soap:CmSelectionCriteria>
            <soap:MaxReturnedDevices>1000</soap:MaxReturnedDevices>
            <soap:DeviceClass>Phone</soap:DeviceClass>
            <soap:Model>255</soap:Model>
            <soap:Status>Any</soap:Status>
            <soap:NodeName/>
            <soap:SelectBy>Name</soap:SelectBy>
            <soap:SelectItems>
               <soap:item>
                  <soap:Item>EMDSTAUDT</soap:Item>
               </soap:item>
            </soap:SelectItems>
            <soap:Protocol>Any</soap:Protocol>
            <soap:DownloadStatus>Any</soap:DownloadStatus>
         </soap:CmSelectionCriteria>
      </soap:selectCmDevice>
   </soapenv:Body>
</soapenv:Envelope>

Can't properly test at the moment, but it might look something like this in PHP:

$devices = $client->SelectCmDevice(array("StateInfo"=>"",
    "CmSelectionCriteria"=>array(
        "Status"=>"Any",
        "SelectBy"=>"Name",
        "SelectItems"=>array(
            "item"=>array(
                "Item"=>"EMDSTAUDT"
            ),
        )
    )
);

I put together a few PHP based Serviceability API samples here...hope to collect more going forward: https://github.com/CiscoDevNet/serviceability-php-samples