« Back to Administration XML Questions

RE: Get Phone with specific Directory Number (Line)

Combination View Flat View Tree View
Threads [ Previous | Next ]
i searching the best way to find the phone device with a specific line number.
with the Unified CM Administration Webinterface i can easy find them with Device - Phone and then as Filter
Find Phone where "Directory Number" begins with "1000" 
But if i want to do this with AXL, i cannot set a "Directory Number" Filter in ListPhoneReqSearchCriteria() 
can somebody give me the correct way get the Phone Device with has a specific Directory Number?
thanks
Jürg

I'm not sure if you can search through Line # within AXL; what I found that you can do is to use an "executeSQLQuery" command and build yourown SQL Query for what you need. In your case, to list all phone name (SEPXXXXXXXX) which its line starts with "1000", you will need to run this query:
SELECT device.name
FROM device
INNER JOIN devicenumplanmap ON devicenumplanmap.fkdevice=device.pkid
INNER JOIN numplan ON devicenumplanmap.fknumplan=numplan.pkid
WHERE numplan.dnorpattern LIKE '1000%'
The whole SOAP XML would be:
<axl:executeSQLQuery xmlns:axl="http://www.cisco.com/AXL/API/8.5" xsi:schemaLocation="http://www.cisco.com/AXL/API/8.5 axlsoap.xsd">
    <sql>SELECT device.name FROM device INNER JOIN devicenumplanmap ON devicenumplanmap.fkdevice=device.pkid INNER JOIN numplan ON devicenumplanmap.fknumplan=numplan.pkid WHERE numplan.dnorpattern LIKE '1000%'</sql>
</axl:executeSQLQuery>

thanks Leandro, works perfect!