Using AXL/SOAP updateLine to Assist with CUCM Upgrades

Author
William Bell
Vice President, Solutions and Products

Actually, that wasn’t my answer.  If it were, I am sure my customer would have went somewhere else for help.  Before we dive into my answer, let’s make sure we understand the question.

Let’s say you have 3,000 phones in your CM 4.1 cluster and you are also hosting Unity, UCCX, and various 3rd party applications.  You have been a Cisco voice customer for a while, and your servers are antiques.  You are ready to move to CUCM 7.1.  You are also migrating Unity, UCCX, and everything else.  You look at your upgrade options and you say to yourself: “Self, we are going to do a parrallel upgrade.”  You want to slowly introduce CUCM 7.1 to the environment, you have to buy new servers anyway, so why not stand up two production clusters and slowly migrate users?

Of the myriad of tasks you must contend with, figuring out how to redirect calls from the CM 4.1 to the CUCM 7.1 server for migrated phones is just one.  But, it is an important consideration.  If you had 3000 phones and you migrate 200, you have to make sure that the 2,800 phones on CM 4.1 can dial the 200 phones on CUCM 7.1.  For that matter, you have to make sure the reverse is also possible.

Clearly, you have to deal with ICT configurations and make sure you put in loop avoidance measures (overlapping dial plan and all).  In addition, you have to have a way to “tell” the CM 4.1 system that Elvis has the left the building and to send all calls to the new guy in Network Rack 41.

There are several approaches to this task and I happen to like using AXL/SOAP to accomplish what I need.  I think it is the most efficient way to reassign DNs in this scenario while also keeping most everything else in the phone record intact.  I’ve recently created a script that allows me to read in a list of phone MAC addresses, read in a rules file that identifies DN changes, and goes to town on the 4.x system to get things migrated.

Our objective is to move or hide 2000/Phone_PT  so that the route pattern 2xxx/Phone_PT can route the call to the Intercluster trunk that connect CM 4x to CUCM 7x.  You know, the whole longest match thing comes into play.

The Procedure

First, you’ll need a routine to read in the various text files.  One file should have the IP phone SEPxxxxxxxxxxxx names.  That is all you will need to start with.  Another file could be (but not required) something that helps your application/script identify what should change.  For example, “replace Phones_PT with HideMyPhone_PT”.

For each record, you will essentially do the following:

1. Find out the phone lines that are configured on the device.  I like to use a SQL query for this:

var phonesql = "select d.name,d.description,n.pkid as dnpkid,n.dnorpattern,n.fkroutepartition,dmap.NumPlanIndex "
+ "from device as d inner join devicenumplanmap as dmap on dmap.fkdevice=d.pkid "
+ "inner join numplan as n on n.pkid=dmap.fknumplan "
+ " where d.name = 'SUBSTITUTE' order by dmap.NumPlanIndex";

Note, you’ll swap the string SUBSTITUTE for the SEPxxxxxxxxxxxx ID for the phone.

2. You should wrap this query in a properly formatted SOAP request:

<SOAP-ENV:Envelope..-snip-..>
   <SOAP-ENV:Body>
      <axl:executeSQLQuery..-snip-..>
          <sql>..your sql query..</sql>
      </axl:executeSQLQuery>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

3. You’ll get back an SOAP response which you will need to parse.  I use Microsoft DOM objects:

var myxmldom = new ActiveXObject ("Microsoft.XMLDOM");
var chkdom = myxmldom.loadXML(axlResp);
if (!chkdom) ...do some error handling...
var nodelist = myxmldom.getElementsByTagName("row");
if (nodelist.length==0) ...do some error handling...
for(var row=0;row
{ //master row loop
var myrecord = {
devname:"",
dnpkid:"",
olddn:"",
oldpt:"",
newdn:"",
newpt:""};
var mydevnode = nodelist.item(row);
myrecord.devname = mydevnode.selectSingleNode("name").text;
myrecord.dnpkid = mydevnode.selectSingleNode("dnpkid").text;
myrecord.olddn = mydevnode.selectSingleNode("dnorpattern").text;
myrecord.oldpt = resolvename(mydevnode.selectSingleNode("fkroutepartition").text,myptnames);
myrecord.newdn = (mydnrules.length == 0) ? myrecord.olddn : resolveNewDN(myrecord.olddn,mydnrules);
myrecord.newpt = (myptrules.length == 0) ? myrecord.oldpt : resolveNewDN(myrecord.oldpt,myptrules);
dnarr.push(myrecord.devname + "::" + myrecord.dnpkid + "::" + myrecord.olddn + "::" + myrecord.oldpt + "::" + myrecord.newdn + "::" + myrecord.newpt);
}

Of course, my method is different because that’s just how these things work.  The resolvename() and resolveNewDN() functions are functions I wrote to resolve the GUID of the partition [resolvename()] to the “well known” name (i.e. resolve {87fg878ab…} to Phone_PT).  The resolveNewDN() uses my “rules file” to determine what (if anything) I should do this this particular line appearance.

Once you figure out how you want to modify the DN, maybe you have something like this:

  • DN: 2000
  • NewDN: 2000 /*for this app we don’t need to modify the DN*/
  • Old PT: Phone_PT
  • New PT: HideMyPhone_PT
  • NumPlanGUID: {xxxxxxxx…xxxxxx}  /*you’ll need this later*/

You’ll notice the SQL response could have more than one DN (phones have more than 1 button).  So, you’ll need to build your recordset into a variable you can pass around.  I like arrays for this.

4. Now you have the existing phone DN information and you have identified what you want to change it to.  Now, you will need to let the CM cluster know your intentions.  I do this by passing the record set I built in step 3 through a loop.  For each array element (which is one line appearance on the phone) I will first check to see if anything has changed.  I only process the line if there is a change.  When a line is to be processed, I use the AXL updateLine procedure.  The SOAP request for this will look something like the following:

<SOAP-ENV:Envelope..-snip-..>
   <SOAP-ENV:Body>
      <axl:updateLine..-snip-..>
          <uuid>..put the NumPlanGUID here..</uuid>
          <newPattern>..put NewDN here..</newPattern>
          <newRoutePartitionName>..put NewPT here..</newRoutePartitionName>
      </axl:executeSQLQuery>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

You will want to check for any fault messages in the response.  A successful response will have a return child node with the GUID. 

5. Now, there is a defect I have come across on CM 4.1(3) that you may have to contend with.  In my testing (and production use) I have found that even though the updateLine command works and the database is updated, the CM subscribers are still holding onto the old line configuration.  Something is stuck in the cached record for the line.  To “unstick” it I put together a workaround.  I basically use “newLine” SOAP function to put the “old” DN back into the database and then I use removeLine to remove it immediately.

To clarify.  Say that you had this:

  • OldDN: 2000
  • NewDN: 2000
  • OldPT: Phone_PT
  • NewPT: HideMyPhone_PT

In step 4, you use updateLine to change 2000/Phone_PT to 2000/HideMyPhone_PT.  That is our goal, so far, so good.  Now, you may (you can test if you want) find that the CM subscribers behave like 2000/Phone_PT still exists (even though the database shows the correct record).  What I do is re-create 2000/Phone_PT in the database (not associated to any devices BTW).  Then I delete it straight away.  Clunky, but it works.

Other Considerations and Notes

I noticed when I was trying to apply the same script on a CUCM 7x cluster that my updateLine call was failing.  I didn’t receive a fault message.  I just received a message with a return node equal to “true”.  I also noticed that the phone lines were not getting updated.  I looked at the AXL schema file for 7.1 and I didn’t see any changes in the schema that would affect what I am doing.  Then I looked at the raw XML and I noticed that in response to my sql query (executeSQLQuery), CUCM was sending a Num Plan guid that looked like this:

<dnpkid>2cd00e88-03e8-49a0-82f9-d70837b226e0</dnpkid>

I checked this against the CM 4.1 response and I noticed that the response from CUCM 7.x was missing the braces like:

{2cd00e88-03e8-49a0-82f9-d70837b226e0}

This isn’t really that big of a deal except that when I use updateLine to update the line I was passing the PKID without modifying (i.e. adding the braces).  Apparently, not adding the braces means that CUCM 7.1 (at least) will ignore your request.  Easy enough, check to see if the braces exist and if they don’t add them.  Then all is well with the world.

One response to “Using AXL/SOAP updateLine to Assist with CUCM Upgrades

  1. Hello William

    I am using updatePhone request to update the ownerusername of a phone. Resquest and response seems to be ok. However when I check CUCM, the value of the owneruser is the same. Ocassionally if I send the request a couple of times. it chages the CUCM. Any idea how to fix this problem?

    jtisdale
    {DE28C09B-3913-A7BE-FFD3-0AF3E2894B17}

    regards
    sebastian

Leave a Reply

 

Nick Kelly

Cybersecurity Engineer, Cisco

Nick has over 20 years of experience in Security Operations and Security Sales. He is an avid student of cybersecurity and regularly engages with the Infosec community at events like BSides, RVASec, Derbycon and more. The son of an FBI forensics director, Nick holds a B.S. in Criminal Justice and is one of Cisco’s Fire Jumper Elite members. When he’s not working, he writes cyberpunk and punches aliens on his Playstation.

 

Virgilio “BONG” dela Cruz Jr.

CCDP, CCNA V, CCNP, Cisco IPS Express Security for AM/EE
Field Solutions Architect, Tech Data

Virgilio “Bong” has sixteen years of professional experience in IT industry from academe, technical and customer support, pre-sales, post sales, project management, training and enablement. He has worked in Cisco Technical Assistance Center (TAC) as a member of the WAN and LAN Switching team. Bong now works for Tech Data as the Field Solutions Architect with a focus on Cisco Security and holds a few Cisco certifications including Fire Jumper Elite.

 

John Cavanaugh

CCIE #1066, CCDE #20070002, CCAr
Chief Technology Officer, Practice Lead Security Services, NetCraftsmen

John is our CTO and the practice lead for a talented team of consultants focused on designing and delivering scalable and secure infrastructure solutions to customers across multiple industry verticals and technologies. Previously he has held several positions including Executive Director/Chief Architect for Global Network Services at JPMorgan Chase. In that capacity, he led a team managing network architecture and services.  Prior to his role at JPMorgan Chase, John was a Distinguished Engineer at Cisco working across a number of verticals including Higher Education, Finance, Retail, Government, and Health Care.

He is an expert in working with groups to identify business needs, and align technology strategies to enable business strategies, building in agility and scalability to allow for future changes. John is experienced in the architecture and design of highly available, secure, network infrastructure and data centers, and has worked on projects worldwide. He has worked in both the business and regulatory environments for the design and deployment of complex IT infrastructures.