We recently wrote the following script as part of some tools for client who required a phased migration of users to a new version 11.0 cluster. They were routing pstn calls through the new cluster so could not place extensions of the users into live partitions until the users phones had been cutover to the new platform.
All extensions were placed into a standalone holding partition to facilitate verification of the user and device configuration prior to migration, which created the following requirements on cutover.
1) New Cluster – Requirement to move the migrated users extensions from holding to live.
2) Old Cluster – Requirement to move the migrated users extensions from live to holding.
When migrating hundreds of users changing the partition individually across two clusters would be quite alot of work, so it was imperitive to automate the process.
We use the following query to select all directory numbers which contain “+442078” from the relevant partition
Format of the XML message body
We create a connection, post the message to the API and parse the returned response object.
We then use an xpath query on the result of the parsed post response object to locate the returned rows.
Once we have the data we iterate through and match the xml tag ‘dnorpattern’ before returning its text value and storing this in a value called “newdn”. We then create another variable called “olddn” which is made up of the last four digits of the dnorpattern text value, before calling the functions “cluster11” and “cluster86” and passing the variables in. The “cluster11” and “cluster86” functions do the work of actually changing the value on the respective clusters.