Uccx feature ?

Answered Question
Nov 30th, 2009


I have a question regarding uccx feature.
Our customer would like to implement an IVR with the following criteria:

A PSTN phone calls my customer at number 999 which is a CTI_RP for IVR.
The IVR begins and asked the caller to press an "office code" in order to reach an external PSTN phone. So if the caller enters the DTMF "55" for instance, he's redirected to a PSTN number "YYYYYYYY". If he enters the DTMF "44", he's redirected to a PSTN number "XXXXXXXX" and so on and so on...
My question is: Is there a way to set the value "PSTN number" depending of the DTMF entered bay the caller ? For my customer I need 200 different location (external number) ?

Is it possible to have this kind of behaviour ? What's the design ?

Thank you


I have this problem too.
0 votes
Correct Answer by Jonathan Schulenberg about 6 years 10 months ago

Oops, my bad. This should have said:

"/office_root/office[code=" + YOURVARIABLE + "]/redirect"

If YOURVARIABLE is within the quotes, it will be passed as a part of the literal string. You need to concatinate the string, variable, and the rest of the string together.

  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 5 (8 ratings)
david.macias Mon, 11/30/2009 - 07:44

Is there any pattern to the PSTN numbers?  You could have a very big IF statement with 200 different options, or if there's a pattern you could do some math and have a function which constructs the PSTN number then dials it.


Jonathan Schulenberg Mon, 11/30/2009 - 07:54

Sure. The easiest ways would be an XML file in the document repository; or, an ODBC connection to another database server. You can retrieve the value from an XML file using Xpath; or, the database using SQL.

f.giordano Mon, 11/30/2009 - 08:05


Xml file seems the easiest way to test the solution.

Is there any documentation/link explaining how to configure such a xml file ? (or a template)



Jonathan Schulenberg Mon, 11/30/2009 - 09:01

It's documented, sort of, in the CCX Step Editor Reference. You need to create a valid XML file and then parse it with Xpath.

Example XML:

<?xml version="1.0" encoding="ISO-8859-1"?>









In the script you need to get the document from the repository with a Create XML Document step. Once you've done that, you can then use the Get XML Document Data step with Xpath to pull the variable you want.

To continue the example, the XML Path would be "/office_root/office[code = YOURVARIABLE]/redirect" where YOURVARIABLE is the office code supplied by the caller.

You'll need to do some exception handling if a match is not found.

XML Path Language (Xpath)

Cisco Unified Contact Center Express Scripting and Development Series: Volume 2, Editor Step Reference 7.0(1)

f.giordano Mon, 11/30/2009 - 09:18

Ok. thx for your post.

I'll try it tomorrow.

One more question regarding the size of the xml file.

If I set 200 different data in the file, will it work without any issue ?

I don't know the right behaviour, but if the script need to scan over the 200 value in the file each time there's a incoming call, it may impact server performance... right ?

Thanks again

Jonathan Schulenberg Mon, 11/30/2009 - 09:22

That's the purpose of Xpath. The entire is loaded into memory (that's unavoidable); however, the script is only selecting a single value from it. The script is not looping through every possible element looking for a match. Xpath addresses that.

Having said that, you should be concious of the size of this XML file in memory. It will be loaded for every concurrent call in to the JVM. There is no sizing tool for this, you'll just have to keep an eye on it. I would not anticipate this being a problem unless you have cut the server sizing close elsewhere.

f.giordano Tue, 12/01/2009 - 01:56

Hi again,

Thx for your answer.

However I did some test this morning, and I can't make it work. I follow the CRS editor guide and your advice.

I've posted an attachment (it's a very basic script). If you have a little time to have a look, maybe you would be able to help me (I guess it's just the XML Path which is wrong).

Thx again


f.giordano Wed, 12/02/2009 - 02:25

Hi again,

I did more test with the XML Path, and here is the result:

My variable from the 'get digit' step is a String named "dtmf"


"/office_root/office[code= dtmf]/redirect" ==> script error during test


"/office_root/office[code= 'dtmf']/redirect" ==> script error during test

test3:hardcoded a value

"/office_root/office[code= 55]/redirect" ==> Works fine. redirect to the right number

So I guess the syntax [code= dtmf] or [code= 'dtmf'] doesn' t take the value of the variable 'dtmf'.

So is there anything I did wrong ?

Any idea ?



Correct Answer
Jonathan Schulenberg Wed, 12/02/2009 - 06:47

Oops, my bad. This should have said:

"/office_root/office[code=" + YOURVARIABLE + "]/redirect"

If YOURVARIABLE is within the quotes, it will be passed as a part of the literal string. You need to concatinate the string, variable, and the rest of the string together.

etmarcof Sun, 05/23/2010 - 13:27

Hi Jonathan,

Thanks for the excellent Post!

Maybe you can help me with one more thing.

Using these example ("/office_root/office[code=" + YOURVARIABLE + "]/redirect") Suppose that i have in XML code1, code2 , code3  tag and  YOURVARIABLE could be in one of these tags.

So my question is how can i do that?  Can i use an OR operator?

"/office_root/office[code1 & code2 & code3  =" + YOURVARIABLE + "]/redirect"


Best Regards


Jonathan Schulenberg Mon, 05/24/2010 - 04:54

I have not tested this scenario; however, according to the syntax rules that I am aware of, you should be able to use a wildcard as follows:

"/office_root/office[*  ='" + YOURVARIABLE +  "']/redirect"

This translates to "find any redirect element that is a child of the office element with any attribute matching YOURVARIABLE.

A few things to note here:

  • You used the word tag; however, the [] brackets are used to identify attributes of an element. Be sure you know your XML syntax and schema here.
  • This presumes that you would never have the same value on more than one fully-qualified tag. For example if you had an attribute code1 that had a value of "foo" on two separate ./office elements.
  • Remember that String-type attributes must include single quotes. Look carefully at my correct example above, there are single quotes in addition to the double quotes used for concatinating the pieces together.
etmarcof Mon, 05/24/2010 - 15:21

Hi Jonathan,

Thanks for the quick answer. It works but without single quotes  just "/office_root/office[*  = " + YOURVARIABLE +  "]/redirect".

My variable is calling_number that i have defined as a string type. Basically what i'm trying to do is searching these calling  number in xml  costumer element that have 3 atributes GSM PHONE,  PROFESSIONAL PHONE,  OTHER PHONE and with your solution it works.

you said that this  presumes that i will never have two elements costumer (in previous example office) with same atributes values. If these happens it will get the information of first costumer element?

Best Regards


James Hawkins Mon, 05/24/2010 - 14:58

There could possibly be a simpler way to do this.

You could create a UCM partition containing translation patterns that translate the DTMF code to the PSTN number.

The CTI ports used by the UCCX application could access this partition in their CSS - no need for XML or Database.

Set your script to dial the entered DTMF code and it will be translated to the PSTN number

Would make it easy to add new DTMF - PSTN codes but maybe not too great on the CUCM front havng 200 translation patterns.

Just a thought


This Discussion