cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2029
Views
0
Helpful
7
Replies

updateUser primary extension field in 10.5

JacobMunson
Level 1
Level 1

I seem to be having a problem where when I run an update user script it is adding what I am sending as the primary extension as the Self-Service User ID instead of the primary extension and the primary extension is left as none in CUCM. Has anyone else run into this issue and found a workaround?

Thank you.

7 Replies 7

stephan.steiner
Spotlight
Spotlight

could you post your updateUser request in full?

Thanks for all the help stephan,

<?xml version="1.0" encoding="UTF-8"?>

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.cisco.com/AXL/API/10.5"><SOAP-ENV:Body><ns1:updateUser><uuid>{B12196C1-5A83-2800-A243-EA37DD1A25CF}</uuid><firstName>Jacob</firstName><middleName></middleName><lastName>Munson</lastName><mailid></mailid><department></department><manager></manager><userLocale/><associatedDevices><device>SEPA11122223333</device></associatedDevices><primaryExtension><pattern>2000</pattern><routePartitionName>All_PhoneDN_PT</routePartitionName></primaryExtension><associatedPc></associatedPc><associatedGroups><userGroup><name>Standard Audit Users</name><userRoles><userRole>Standard Audit Log Administration</userRole></userRoles></userGroup><userGroup><name>Standard CCM End Users</name><userRoles><userRole>Standard CCM End Users</userRole><userRole>Standard CCMUSER Administration</userRole></userRoles></userGroup><userGroup><name>Standard CTI Enabled</name><userRoles><userRole>Standard CTI Enabled</userRole></userRoles></userGroup></associatedGroups><enableCti>true</enableCti><digestCredentials></digestCredentials><phoneProfiles/><defaultProfile></defaultProfile><presenceGroupName uuid="{AD243D17-98B4-4118-8FEB-5FF2E1B781AC}">Standard Presence group</presenceGroupName><subscribeCallingSearchSpaceName></subscribeCallingSearchSpaceName><enableMobility>false</enableMobility><enableMobileVoiceAccess>false</enableMobileVoiceAccess><maxDeskPickupWaitTime>10000</maxDeskPickupWaitTime><remoteDestinationLimit>4</remoteDestinationLimit><passwordCredentials><pwdCredPolicyName>Default Credential Policy</pwdCredPolicyName><pwdCredUserCantChange>false</pwdCredUserCantChange><pwdCredUserMustChange>false</pwdCredUserMustChange><pwdCredDoesNotExpire>false</pwdCredDoesNotExpire><pwdCredTimeChanged>February 26, 2015 17:49:09 EST</pwdCredTimeChanged><pwdCredTimeAdminLockout></pwdCredTimeAdminLockout><pwdCredLockedByAdministrator>false</pwdCredLockedByAdministrator></passwordCredentials><pinCredentials><pinCredPolicyName>Default Credential Policy</pinCredPolicyName><pinCredUserCantChange>false</pinCredUserCantChange><pinCredUserMustChange>false</pinCredUserMustChange><pinCredDoesNotExpire>false</pinCredDoesNotExpire><pinCredTimeChanged>February 26, 2015 17:49:09 EST</pinCredTimeChanged><pinCredTimeAdminLockout></pinCredTimeAdminLockout><pinCredLockedByAdministrator>false</pinCredLockedByAdministrator></pinCredentials><enableEmcc>false</enableEmcc><ctiControlledDeviceProfiles/><patternPrecedence/><numericUserId></numericUserId><customUserFields/><homeCluster>true</homeCluster><imAndPresenceEnable>true</imAndPresenceEnable><serviceProfile></serviceProfile><lineAppearanceAssociationForPresences/><directoryUri></directoryUri><telephoneNumber>2000</telephoneNumber><title></title><mobileNumber></mobileNumber><homeNumber></homeNumber><pagerNumber></pagerNumber><selfService></selfService><userProfile></userProfile><calendarPresence>false</calendarPresence><ldapDirectoryName></ldapDirectoryName><userIdentity></userIdentity><nameDialing></nameDialing><ipccExtension></ipccExtension><convertUserAccount></convertUserAccount></ns1:updateUser></SOAP-ENV:Body></SOAP-ENV:Envelope>

2015-02-26 18:23:37,331 INFO  [http-bio-443-exec-7] filters.TimingFilter - Request 1424753460516 was processed in 117ms

2015-02-26 18:23:37,335 INFO  [http-bio-443-exec-22] filters.TimingFilter - Received request 1424753460517 from appadmin at IP 172.16.16.245

2015-02-26 18:23:37,336 INFO  [http-bio-443-exec-22] servletRouters.AXLAlpha - Going to axis--->

2015-02-26 18:23:37,336 INFO  [http-bio-443-exec-22] servletRouters.AXLAlpha - AXL REQUEST :

I would recommend that you only send things you actually want to change (I'm slowly diverging from the "get, Change tags, then update the full object" approach because it means a lot more things are done on the backend, plus the additional risk of something unwanted happening). Something at the back of my mind tells me I've had my own battle with the primary extension, but it probably was the ipcc Extension that I couldn't get the work. I have a Long Standing workaround for both (Setting Primary Extension via updateUser wasn't always supported) that look something like this:

You send an axl SQL update command with the following syntax

string query = "insert into endusernumplanmap(fknumplan, fkenduser, tkdnusage) values((select pkid from numplan where dnorpattern = '" + line +               "'),(select pkid from enduser where userid = '" + userId + "'), " + (int)usage + ")";

line is your pattern. If you have the same pattern in multiple partitions, you Need to refine the query to get the entry from numplan whose dnorpattern = your patttern and fkroutepartition = (select pkid from routepartition where name = 'name of your Partition). And usage is either 1 for the Primary Extension, or 2 for the icd Extension.

Likewise, to clear the Primary Extension, you'd remove the entry created with the above entry from the database again.

I think I am going to stay away from editing the database directly if possible. I did find that I can set the primary extension using addUser just not updateUser and for my purposes this is sufficient for now.

Don't be afraid of the database - very often, it can be a lot more efficient to extract the data you require directly from the dabase, and this update is being done on a daily Basis for multiple of my customers and it works just fine.

Something must be wrong with your update command though.. I just checked my unit tests, and changing the Primary Extension on a user is definitely part of the tests and they all passed (minus the things I reported in the Forum). Unfortunately, they rolled back my CUCM so I don't have a config where I can run the unit tests again and post a working updateUser command.

I unfortunately would still consider myself a novice programmer so interacting with the database directly has 2 challenges for me. Making sure that all dependencies are taken care of when making changes, and understanding how to process your query using PHP. It took me some time to figure out and understand how to connect to and send the AXL commands to a CUCM server. That said if you are willing to point me in the right direction I would much appreciate it.

Mamdouh Elgamal
Level 1
Level 1

the toolkit is quite powerful and if you're able to learn some java. it can become quite helpful, if java is too overwhelming, i would recommend starting off with python.

the following is a piece of java code that accomplishes what you are looking for. this method is part of a java tool that executes other tasks

this method updates end user primary extension and associates the end user with the phone. Then makes an axl request to CUCM.

the updateuserreq and other similar statements, are all part of the axltoolkit api. I'm merely manipulating these classes to my needs.

public void updateEnduser(){

        String phoneName = "SEPZZZZZZZZZZZZ";

        String endUserId = "jsmith";

        String phoneExt = "6808000";

        UpdateUserReq userUpdates = new UpdateUserReq();

        UpdateUserReq.PrimaryExtension userPrimExt = new UpdateUserReq.PrimaryExtension();

        UpdateUserReq.AssociatedDevices userDevUpdates = new UpdateUserReq.AssociatedDevices();

        userUpdates.setUserid(endUserId);

        userDevUpdates.getDevice().add(phoneName);

        userPrimExt.setPattern(phoneExt);

        userPrimExt.setRoutePartitionName("Cluster DN");

        userUpdates.setPrimaryExtension(userPrimExt);

        userUpdates.setAssociatedDevices(userDevUpdates);

        try{

            axlPortReq().updateUser(userUpdates);

            //String returnValue = r.getReturn();

            System.out.println("");

            System.out.println("notify message: End user association complete");

        } catch (AXLError e) {

            e.getFaultInfo();

        } catch (SOAPFaultException soapFaultException){

            System.out.println(soapFaultException.getMessage());

        }

    }

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: