Cisco Support Community
Showing results for 
Search instead for 
Did you mean: 

Welcome to Cisco Support Community. We would love to have your feedback.

For an introduction to the new site, click here. And see here for current known issues.

New Member

In CCM, Associate User with All Phones

This is 1 of 2 threads I am starting.

1. (this thread) asks for guidance in associating a User with all IP Phones in order for them to obtain authentication before allowing XML to be pushed to them.

2. (in a separate thread) asks for guidance in issuing the push to the IP Phone, regarding getting the base64 User:Password inserted into the HTTP pkt.


Thread 1:

I want to push a CiscoIPPhoneExecute to IP Phones. I am having trouble authenticating. I know that in order to authenticate (UserID,Password) I must add a User (with User ID and Password) to CCM and associate it with all IP Phones. My CCM ver is System version:


Re: In CCM, Associate User with All Phones

How do you want to do that? Manually or do you want to write a software that does it automatically?

To do it automatically you need AXL. First you need to look up which devices your application user is already associated with.. you run the following query (taken directly from productive java code):

private String getDeviceAssociationSqlString(String ctiUser)


StringBuilder sb = new StringBuilder();

sb.append("SELECT FROM device dev INNER JOIN applicationuserdevicemap adm ON adm.fkdevice = dev.pkid AND tkuserassociation = 1 ");

sb.append("INNER JOIN applicationuser a ON a.pkid = adm.fkapplicationuser AND'" + ctiUser + "'");

return sb.toString();


You do an executeSqlQuery with that query and parse the results (the response will look something like



Then you look up all devices, e.g. by sending a query like

SELECT name FROM device WHERE name LIKE 'SEP%'

(the where clause is to only include IP phones..the device table also contains gateways, analog ports, etc. and we don't want that.. not that this query includes third party sip phones which doesn't make too much sense.. but it won't cause any problems either.. I know because we run that code on a system with third party sip phones).

Then you do a delta between the two lists and if the second query yielded more results than the first, you need to associate the application user with that phone. There's no direct way in AXL (there used to be in CCM4 but no longer in CCM5+ because we now use application users.. you could theoretically use end users where you can still use updateUser, however it's not a good idea to mix application and regular users).

So.. you need to update the SQL database directly.. and run executeSqlUpdate via axl. The query to add phone deviceName to application user ctiUser is:

private String getAddDeviceAssociationSqlString(String deviceName)


StringBuilder sb = new StringBuilder();

sb.append("INSERT INTO applicationuserdevicemap (fkapplicationuser, fkdevice, tkuserassociation) VALUES((SELECT pkid from applicationuser WHERE name = '");


sb.append("'), (SELECT pkid FROM device WHERE name = '");


sb.append("'), 1)");

return sb.toString();


This also works on CCM6, and most likely on CCM7 (I haven't had any projects with 7 yet but at first glance I haven't spotted any major changes like in between CCM5 and CCM6 (the extension mobility stuff has completely changed between those releases).

And if you do it manually.. just go to your application user, and have have the device association right there.. press the select more phones button, search for all phones whose name starts with sep, check them all, and submit.

New Member

Re: In CCM, Associate User with All Phones

Thanks, that was very, very helpful.

Re: In CCM, Associate User with All Phones

Then make sure to rate it ;)


New Member

Re: In CCM, Associate User with All Phones

Hi. Can you help me to select all IP Phones from DB CUCM 6?

I have one question:

How I can send queries to CUCM to receive info from DB? I mean what should I use in this case?