Apr 05

UCCX Scripting: Enterprise Variables

Lets go through the process of adding three Enterprise variables to be displayed on CAD for the Agent. I will be creating Variables called Patient Name, Patient Number and New Patient.

Start by opening the UCCX Script. Navigate to Settings -> Expanded Call Variables. A separate window opens. Here we will add the three variables, plus the User Layout that will host the variables.

Click the icon to create a new expanded variable and complete the Name, Type and Description Field. Reference the below image.
Also create the layout expanded variable. Following the process as above, however the name of the variable will be user.layout.
Close the Expanded Variables windows and lets dive into the actual script.

Create three variables of type String. Variable names are:

- sPatientName
- sPatientNumber
- sNewPatient

You can place a default value in the String if you like. I placed the value “Unknown” for both sPatientName and sPatientNumber and assigned the value “Yes” to the sNewPatient variable.

After we have the variables completed, we need to add the “Set Enterprise Call Info” step to the script. This step should be added before the Select Resource Step. Open this step and select the Expanded Call Variables tab. Click Add and complete the details. Follow the below image. Essentially we are adding the expanded variables we created in the first step.

UCCX Expanded Variables

Now jump across to the UCCX Server and log onto the Desktop Administrator web interface. Navigate to the Fields Menu under Services Configuration -> Enterprise Data and click Add New.

The field name must match the expanded variable name created in the UCCX script application. Display name is what is displayed on the CAD Desktop. The field Index is a unique identifier for this field.

Create a field for all three variables, plus the User Layout variable. The user layout variable should be in the format:

- Field Name: user.layout
- Display Name: Layout
- Field Index: Unique Identifier

UCCX Desktop Administrator

Select the Layout List menu under Services Configuration -> Enterprise Data. Click Add New. The Layout Name must match the Value in the Expanded Call Variables under the Enterprise Call Info step. Now simply add (in order) the fields you would like to have displayed for Agents. I have selected ANI, Patient Name, Patient Number and New Patient. Click Save.

UCCX Layout List

So when an Agent answers a call that has passed through the Set Enterprise Call Info Step, they will have required fields displayed.

Dec 09

Email Voice Recordings in UCCX 10.0 Script

This seems to be a growing requirement/need for Contact Centres, so I’ll spend some time discussing how to configure a UCCX Script to record and send voice message via smtp.

Here is my scenario.

Customer does not want to receive Emails if the Voice payload is null or less than 10 seconds. When the caller hangs up or disconnects after leaving the voice message the script should continue to process the email as per normal. If the payload is null or less than 10 seconds, an email is to be sent without an attachment with the Subject stating a Missed Call.

Software in use is Cisco Contact Centre Express 10.0.1

First component is to setup the voice recording step in the UCCX Script. You’ll need to record a prompt to play to the caller asking them to leave a voice message. Please read my other blogs regarding how to record prompts using UCCX 10.0 or Unity Connection 10.5. You will also need to declare a variable of document type.


Prompt = pVoicemail

Document = dVoicemail

Make sure you adjust the duration in the recording step, otherwise the callers may be cut off while recording their voice message.

The next component is to check the payload length of the voice message. This is so we can determine if the voice message has enough content to actually be useful. We need to declare and set a couple of variables of type String.


String = sVoiceMessageLength

String = sContentLength

After declaring the above string variables, we need to configure the following Set steps.

  1. Set sVoiceMessageLength = dVoicemail
  2. Set sContentLength = (sVoiceMessageLength).length()

The variable sContentLength now holds the total payload length in bits.

Now we can run the following IF Step to fork the script.

If (sContentLength > “15000”

1500 bits is approx. 6-7 Seconds of Voice payload. But you can tweak this figure to work out what best suits your environment.

The next component will be discussing is the True path from the IF Step. So this is where the voice payload is greater than 15000 bits. So we will proceed to attach the voicemail to an email. We will proceed to create a couple more variables to allow us to form and send an email from the uccx script.


Contact = EmailContact 

String = sEmailAddress

First step is to Create the Email, this includes the Subject and Body Content for the email. Open the expressions editor for the Create Email Step and enter in your Subject. Example:

“URGENT: Voicemail from ” + sCallingNumber.

Now repeat for the Body of the email. Example:

“URGENT Voicemail” + ‘\r’ + ‘\n’

+ ‘\r’ + ‘\n’ +

“Please phone caller on ” + sCallingNumber + ‘\r’ + ‘\n’

+ ‘\r’ + ‘\n’ +

“Date of Call: ” + D[now]

UCCX Expressions Editor

Next Step is to attach the voice message to the email created above. This is done with the Step called Attach To Email Step. Select EmailContact variable, then add the attachment. In my example I’m using sVoiceMessage as the name of the attachment and the actual file is dVoicemail.

Finally we can configure the Send Email Step. Again select the contact variable EmailContact and then the string variable sEmailAddress for the To: field.

This will effectively fire off an email!

Going back to the above IF Step, and now following the False Path (the voice payload is less than 15000 bits). We want to send an email without the attachment, and state that we have received a Missed Call only.

Seeing that we have already created the Contact (EmailContact) and String (sEmailAddress) variables in previous steps we can skip it here. Firstly Configure the Create Email Step and define the subject and body content. Just like the previous steps, go to the expressions editor and enter your require data. Exmaple:

“URGENT: Missed Call from ” + sCallingNumber

Repeat for the Body Content. Example:

“URGENT Missed Call” + ‘\r’ + ‘\n’

+ ‘\r’ + ‘\n’ +

“Please phone caller on ” + sCallingNumber + ‘\r’ + ‘\n’

+ ‘\r’ + ‘\n’ +

“Date of Call: ” + D[now]

UCCX Expressions Editor

We now go straight to the Send Email Step. Select the contact variable EmailContact and then the string variable sEmailAddress for the To: field.

Email will now be sent.

Now there is one important step I have not mentioned as yet and was seeing how I would integrate into the discussion. It’s the On Exception Step. What this basically allows us to do is action a set of predefined steps if the caller disconnects (hangs up) the call. As it is only natural for humans to immediately disconnect a call after recording a voice message.

We need to define a label and place it after the Voice Recording step. This label will effectively be our starting point for the set a defined steps if the caller disconnects the call. Let call this Lable “EMAIL EXCEPTION”.

Before we even allow the caller to record their voice message we need to trigger the On Exception Step and select “com.cisco.contact.ContactInactiveException”. Also select the above label “EMAIL EXCEPTION”.  When this step is triggered, the script will not allow the script to just end if the caller disconnects. This is great news as we want the system to continue to email us the voice message etc.

It’s important that we also clear the exception once we have completed our predefined steps otherwise the script will be left in an open state. The Clear Exception Step does just this. Select “com.cisco.contact.ContactInactiveException”.

Now we have a script that will continue to email the the voice message even after the caller disconnects the call.

Summary of my example script for your reference.

UCCX Script - Voice Recording