UCCX Scripting – Iterating Different Recordings

When scripting UCCX call center queues, it’s common to put a caller on hold for a defined period of time, then do something with them.  Then, put them on hold again.  This could be to hear a “Thanks for holding.  We’ll get with you shortly” every 2-3 minutes with hold music in between.


For example, here, you will see a basic call loop.  A call gets queued if the resource (call center queue) is not available.  I created a variable called “CallQueueHoldDelay”.  This is set to 90.  Which means, the call is put on hold (hears hold music), waits 90 seconds, then goes off hold.  I play a “Thanks for holding message”, then, goes back to “QueueLoop”, and does it all over again.

But, for the script I’m working on now, I have different prompts I want caller’s to hear.  Maybe different accouncements?  Different sales going on?  Any alerts caller’s should be aware of?  Well, you can play these back to back, but that’s information overload.  We want our callers to be calm and informed.

So, how do we space them out?  Welcome to the math operator called Modulus (or Modulo).  Using the %, you basically get the remainder from the result of division.  For example, If I divide 2 / 3… I get 1 with a remainder of 1, right?  If I divide 10 / 4, I get 2 with a remainder of 2 ( 4X2=8 with 2 remaining). 

In other words, the modulus operator defines how many “options” we can have before going back to the start.  Let’s do some examples:

Even / Odd

This basically toggles between one or the other.  2 different options.  So, let’s say you have 2 announcements.  You want someone to hear announcement one, hold, then hear announcement two.  Looking at my script, you can see I am incrementing “CountQueueLoop” by 1 each time.  So, assuming CountQueueLoop starts at 0, when I go on hold, I SWITCH based on the value of CountQueueLoop % 2 (which is 0%2 which is 0).  That will hit “Iteration 1″ (since the value is 0) and run those commands.  The next time I come back, CountQueueLoop is now 1 (which is 1%2 which is 1).  That will hit Iteration 2.  The 3rd time, CountQueueLoop is 2 (which is 2%2 which is 0).  So, the results are only 0 and 1.

3 options

Below, you can see the same thing, only I use 3 options ( CountQueueLoop % 3).  Because I am dividing by 3, I have up to 2 remainders giving me 3 options.  If I use CountQueueLoop % 5, how many options can I have?  5.  That’s right!  See, you are a natural.

In my case, I am toggling between 2 announcements.  However, I don’t want them back to back, so I’m using 3 iterations so that the third iteration will just be more hold to space them out a bit more.

Good Luck!

Share This Page : Share on TwitterShare on FacebookShare on GooglePlusShare on PinterestShare on Linkedin