Using XML Files to Control a Contact Center Express (CCX) CRS Script

William Bell
Vice President, Solutions and Products

The best way to dicuss using XML documents with CRS is by providing an example.  One common example that you can find floating around Cisco NetPro and in the example scripts provided by Cisco is a function to support time of day routing.  Specifically, using an XML file containing dates that are official holidays for your organization.  This example is fairly well documented.  You can search for “Contact Center Express Script Repository” on Cisco’s web site to download a zip file containing multiple examples.  Check out HolidayApp and HolidayChecker.

Another example is using XML documents to allow callers to enable ad-hoc prompts.  This is the example we will dissect further.


So, one of the scripts that we like to build into all of our deployments is a prompt recording application.  It allows us and our customers to record multiple prompts which can be uploaded (or written directly) to the CRS server prompt cache.  Sometimes we find that folks would also like to have dynamic prompts which they can record and turn on/off at will.  For example, someone may want to have the ability to play an “outage prompt” for contacts calling a help desk application.  Another example is a marketing message for promotions in a sales contact center.


The mechanism we are using is the Document repository on UCCX.  Specifically, we are creating/managing an XML document using the PromptRecorder script.  This XML document is read by the App1 script to determine whether it should play a dynamic prompt or not.

To keep it simple, lets say we have a custom prompt document (customprompt.xml) that looks like the following:


For our example, we will consider two scripts.  The first script is the one that is used to manage the prompts (PromptRecorder) and the second is the application (App1) that customers/end users call which will play out the dynamic prompt.

The following are excerpts from a functioning script that show the steps needed to complete our task.

Prompt Recorder:

The PromptRecorder script will first handle the contact.  In our script, we play a welcome greeting and then authenticate the user using their CUCM user ID and PIN.  Once authenticated, we can give them a menu of options with one option which allows the caller to record an outage prompt.

The first thing we need to do is read the existing XML document to identify the current status of the outage prompt.  This is done using document variables and various document steps:

docDownTime = Create File Document (strMyXMLDoc)
docXMLParser = Create XML Document (docDownTime)

So, we have to document variables which are declared and are null (initially).  We also have a string variable which has the path for the customprompt.xml file.  Next, we need to use a XSL query to find out what our current value is for the outage prompt:

blnOutageEnabled = Get XML Document Data (docXMLParser, “//outage”)

At this point we now have a boolean variable which will either be true (an outage prompt is already active) or false (the outage prompt is not active).  If the current value is true, we can then inform the user that a prompt is already enabled and allow them to review, re-record, or disable the prompt.  If the current value is false, we can simply ask them to record the prompt.

Let’s assume that the original value was false and the user wants to record a new prompt.  We also can assume that they have recorded the new prompt, reviewed it, and elected to save the prompt.  We need to now reset the boolean variable:


In addition to recording and uploading the prompt in the CRS script so that the prompt file has audio, we also need to edit the customprompt.xml file so that App1 knows it should play the new prompt.  To do this we need to recreate the XML content and write it to the file:

It is a little ugly for sure but we use the Expression Editor to create the string strXMLDump. The reason is that we want/need to use the escape character () (e.g for carriage return and new line).  You will also notice that we take the blnOutageEnabled variable and convert the boolean value to a string value (e.g. “true”).

Now, we use another Document variable to hold the new XML file output:

Set docWriteXML = strXMLDump

All that we need to do now is save the file:

Write Document (docWriteXML to strMyXMLDoc)


So, how do we get App1 to read the XML document and play out (or ignore) the prompt.  This is quite simple, we start off the same way we did with the PromptRecorder application:

docDownTime = Create File Document (strMyXMLDoc)
docXMLParser = Create XML Document (docDownTime)

So, we have to document variables which are declared and are null (initially).  We also have a string variable which has the path for the customprompt.xml file.  Next, we need to use a XSL query to find out what our current value is for the outage prompt:

blnOutageEnabled = Get XML Document Data (docXMLParser, “//outage”)

Now, we have a boolean value based on what was in the XML document.  All that is needed is a simple if…then..else action to determine what we should do:

if (blnOutageEnabled) Then
Play Prompt (–Triggering Contact–,P[MyOutagePrompt.wav])
/*do nothing here*/


This example is a relatively simple one that demonstrates how to pass control information from one script to another.  This methodology can be extended to actually have more complicated XML data that a CRS can query to retrieve and use other data.  For example, one could store messages that are displayed in screen pops to agents or a supervisor can “open” or “close” a call center.  If you wanted to get real fancy, you could have an XML enabled IP phone service URL programmed in CUCM that allows someone to hit a single button to “close” a call center.  Well, maybe that isn’t such a good idea after all.  Too much power for one little finger…

3 responses to “Using XML Files to Control a Contact Center Express (CCX) CRS Script

  1. Hi Bill,

    I am just looking how to go about creating a xml file to open and close a call center. I have a DID number set up for the supervisor to call into but dont have any idea where to go from here. I know it’s simple but not getting it. just want the supervisor to dial the DID and select "1" to open or "2" to close.

  2. Hello Lora,

    You are on the right track in that you would want to leverage a CRS script that is reserved for admin/supervisor management of the contact center. NetCraftsmen builds a admin portal CRS for our customers. This script manages things like prompt recording, message of the day prompts, emergency notification prompts, and opening/closing the call center.

    The basic approach is to have the CRS admin script answer the call, authenticate the user, and then give them an admin menu. This is basic IVR stuff. When the admin identifies they want to close the call center, I typically write the data to an XML file. I do this since I am usually managing multiple variables and it makes it easier to manage these things holistically.

    Just like the example provided in this blog, you can toggle a "true" or "false" value in a XML child node. For instance:


    In the above example, MyApp1 is closed and MyApp2 is open. The CRS associated with these applications should also read this XML file when they accept a call contact. Then you can use a simple "if…then…else" structure to handle the open/close status.

    Script logic may be something like:

    docCCStatus = Create File Document (strMyXMLDoc)
    docXMLParser = Create XML Document (docCCStatus)
    blnMyCCStatus = Get XML Document Data (docXMLParser, "//CallCenterOpen/MyApp1/")

    if (blnMyCCStatus)
    //we are closed
    play prompt
    call stats
    goto handler-for-endcall
    goto normal-script-logic



  3. Hi Bill,

    I’m wondering if you know of a way to copy or bulk update XML into the UCCx document repository. The reason I ask, we are using an external IIS server with a nice GUI for the users to edit holidays, opening times, emergency states into the backend XML files.

    At present we are reading the remote xml using get url command in the script but the issue I have is if UCCx looses connection to the IIS server the script then errors. I would much prefer to read local xml files in my script so I need a way of bulk copying my IIS xml files to the document repository on UCCx 8.5

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.