Contact Center Express (CCX) Authenticate Users with CRS Script

William Bell
Vice President, Solutions and Products

As with most things, I am sure there are multiple ways to accomplish this task.  This just happens to be the approach I take.  The context for the following example is based on the need to manage prompts remotely.  For every CCX solution NetCraftsmen deploys, we add a “prompt changer” application. 

At a high level, our “prompt changer” application does the following:

  • Accepts the call
  • Authenticates the user
  • Allows the user to manage dynamic/”live” prompts (i.e. instantly active prompts)
  • Allows the user to pre-record prompts by a specific prompt ID (for later upload)
  • Allows the user to open/close a call center

The following example focuses on the second step:  User Authentication.


The example uses the following variables:

  • intRetryCnt:  (integer) Used to control the number of times we ask the caller to authenticate themselves
  • strUserExtension: (string) Used to store the agent extension as provided by the caller
  • usrWhoAmI: (user) Stores the user object retrieved from CUCM
  • blnSupervisor: (boolean) Flagged true if the user object is a CCX supervisor
  • strCCMUserID: (string) User ID for the CUCM user held in usrWhoAmI
  • strUserPIN: (string) User PIN as defined in CUCM (provided by the caller)


Our first task is to initialize the variable intRetryCnt to 0 and then play a prompt to provide basic instructions for authenticating to the system.

Next, we show the simplistic loop control.  We have a label “AUTHENTICATE_LOOP” and then we increment the retry counter, do a quick check, and if the counter is greater than 3 we send the caller to the script termination routine.

Step 1:

First things first.  Since the user is using a telephone to call into the script, it makes sense to make it easier on the caller by asking them for their CCX agent extension.  The agent extension is programmed in CUCM as “ICD Extension” or “IPCCX Extension”.  The “Get Digit String” step basically plays a prompt with instructions and defines digit filters like length and termination string.

If we collect digits successfully, we move to step 2.

Step 2:

We use the “Get User” step to tell the CRS scripting engine to retrieve the user object associated with the agent extension that the user provided.  If the user provided an erroneous agent extension, then the “Unsuccessful” branch is engaged.  Otherwise, we have successfully grabbed the user object and wrote it to the usrWhoAmI variable.  Proceed to step 3.

Step 3:

This step is optional.  I just like to restrict contact center control to designated supervisors.  You could allow it so that anyone can manage the contact center.  I don’t advise it, but you could.  Anyway, all we are doing is checking an attribute tied to the user object stored in usrWhoAmI.  Specifically, we are asking if the user is a CCX supervisor and storing the value in blnSupervisor.

Step 4:

Again, we are extracting an attribute from the user object stored in usrWhoAmI.  In this case, we are grabbing the end user ID.  This is the user ID as configured in CUCM (e.g. bbell).  This is an attribute of type string, so we push it into a string variable: strCUCMUserID.

Step 5:

We check to see if the user object is a supervisor.  If it is then we proceed.  We are now going to prompt the caller to enter their Personal Identification Number (PIN).  This is the PIN as defined in CUCM.  Similar to the procedure in Step 1, we are using “Get Digit String” to store the PIN.  We push this into a string variable: strUserPIN.

Step 6:

OK, all previous steps are needed to reach this point.  We are going to take the user ID stored in strCUCMUserID and the PIN stored in strUserPIN and authenticate the user against CUCM.  If the PIN and User ID match up with what is stored in CUCM, then we are good to go and allow the caller to manage the prompts and/or contact center.

Unsuccessful and Timeout Steps:

Many of the steps we have provided have a branch for handling exceptions (e.g. Unsuccessful or Timeout).  Each of these has a similar structure:

  • Play a prompt to user to clue them in on what they did or didn’t do
  • Send the caller back to AUTHENTICATE_LOOP (which will increment the counter, and see if we should try this again)

That’s it, now you have a method to authenticate users before they destroy your contact center.  Thanks for reading!

5 responses to “Contact Center Express (CCX) Authenticate Users with CRS Script

  1. What would happen if the supervisor, also happened to have Admin rights, because they need to change Application parameters?

  2. The fact that a guru like Anthony Holloway is asking me this question makes me wonder if I missed something big! 😉 I have tested the script using a user that was a supervisor and an admin. I didn’t test for that reason, I was just being lazy and tested using an account I setup for both purposes!

    Prior to having this script, I would set the admin attribute for the user object so that they could edit the script parameter variables. I am actually a proponent for parameter variables (as long as you don’t get carried away). Again, that is because I am lazy and want to leave my customers with a method to control script behavior.

    Does that answer the question? Or did I miss something?



  3. Hello William.
    I know that maybe this is not the right place to post this. But i was wondering if there is any way to lock a phone when the user is not at their desk. I know of third party software like stonelock that do this, but I was wondering whether you know write custom code to do the same thing in a simpler way..

    Best regards…

  4. Davi,

    I am not familiar with Stonelock. I did a quick read on their software offering and I imagine it may use some of the same approaches you see with EM. Meaning, it uses device profiles to do its job. But that is a guess on my part.

    In my experience, Extension Mobility can be used as an effective security measure. Though, it could be cumbersome for folks who want to "lock" their phone when they leave their desk for a short period. Stonelock may be a simple shortcut to the same mechanisms?

    Anyway, I have not looked at coding something like this but the first place I would look is the Phone SDK to see if there is an API function that could be leveraged (just in case). Then I would look at the EM API to see if I could create user shortcut functions (like I suspect Stone has done – but could be wrong).



  5. Bill,

    Great article! I have completed my script and added the necessary steps to authenticate the user and it works great. However, my script is not uploading the prompt to the directory. No real errors that I can see either.

    Any ideas or can you point me in to another blog that maybe spells this part out?


    Nathan Richie

Leave a Reply