Showing results for 
Search instead for 
Did you mean: 

SQL query listing devices with a specific XML config



My customer is running on a CUCM 12.5 deployment with phones and respective Extension mobility profiles logged in on them. We need an SQL query which will list those devices with those profiles who have a specific value in their running XML config. More specifically, we need the show those devices that have a very specific URL behind their Login/Logout button.


Thanks in advance.

6 Replies 6

Alex Stevenson
Cisco Employee
Cisco Employee


Hello @MityoValchev32163,


You should check out the:


DevNet Automation Exchange




Cisco DevNet Code Exchange


Cisco Employee
Cisco Employee

Normally you would retrieve a list of IP Phone services/URLs using the AXL API via getPhone

However, this doesn't really work when you want to query all phones, as you'd have to retrieve each phone one-by-one in a separate request to check.  This is where the executeSqlQuery request can help, as we can (if we are familiar with the CUCM SQL database schema) ask for only the info we need, joining the tables desired.

Per the Data Dictionary the tables of interest would be:

  • telecasterservice - holds the service definitions, e.g. name and URLs
  • telecastersubscribedservice - maps service to devices, also happens to include the service URL
  • device - holds details about each device, i.e. the device name

This is the AXL request/response using an example SQL query:

<soapenv:Envelope xmlns:soapenv="" xmlns:ns="">
      <ns:executeSQLQuery sequence="?">
         <sql>SELECT fkdevice, name FROM telecastersubscribedservice,device
              WHERE serviceurl LIKE '' AND
<soapenv:Envelope xmlns:soapenv="">
      <ns:executeSQLQueryResponse xmlns:ns="">

Note the '%' in the LIKE statement acts as a wildcard.

A number of AXL sample code projects are available on Code Exchange, with the Python project being the most complete.

One note, 'enterprise' service subscriptions (where a service is defined as being present on all devices) will not have entries in can just use the telecasterservice.enterprisesubscription field of services with your URL to assume all devices.

Those queries look nice.


I am looking for a way to update hundreds of phones whose Button Template allows two IP Phone Service URLs.

The phones are currently subscribed to CAD Login and I can use the Bulk Edit to subscribe the phones to the Finesse Login

but do not know how to update the button instances.





After some research we put together the following SQL queries:


run sql select, d.description, tss.servicename, tss.serviceurl from device as d inner join TelecasterSubscribedService as tss on tss.fkdevice=d.pkid where d.tkclass = 254 order by, tss.servicename


The above will list all the UDPs and their corresponding Extension Mobility URL;


run sql update TelecasterSubscribedService as tss set tss.serviceurl = "http://cucm.xxxxxxxxxxxxxx/emapp/EMAppServlet?device=#DEVICENAME#EMCC=#EMCC#" where (fkdevice IN (SELECT ts.fkdevice AS fkdevice FROM telecastersubscribedservice AS ts INNER JOIN device AS d ON d.pkid = ts.fkdevice WHERE = "NAME"))


The above will change the Extension Mobility URL to a desired one. The UDPs can be filtered by different conditions in the last clause;



Example of phone button configured

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: