cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1698
Views
16
Helpful
9
Replies

Random prompt repeats allready played prompt

Henrik Larsen
Level 4
Level 4

Hi all

Does anyone know if / how it's possible to prevent a container prompt playing in randomization mode from repeating one of the prompts, when it has been played ?

Option is to play one of five different queue spots in a random order while call is queued, but not to repeat any of the prompts. All prompts have same weight assigned.

It works partially, but only 4 of the 5 prompts are played, causing at least one prompt to be repeated in each loop of 5

Loop  Prompt  Prompt  Prompt

1            2             5            5

2            4             2            1

3            5             3            4

4            3             2            3

5            5             5            5
 

Any ideas ?

Henrik

1 Accepted Solution

Accepted Solutions

Okay, this might seem a bit hardcore and you might ask why and how come UCCX does not have this as a built in function. I don't know and at this point I am too tired to investigate although I believe this might be done in an easier and more user friendly way.

I just love Java and I am glad UCCX lets me use it.

We will start by adding two new variables:

index - of type int, initial value: 0

arrayList - of type java.util.ArrayList (yes, type the whole thing in), initial value: new java.util.ArrayList() - again, you will have to type this in, it's not enabled by default and not visible in the dropdown list.

Next, insert a Do step with the following code block:

{
arrayList.add(P[prompt1]);
arrayList.add(P[prompt2]);
arrayList.add(P[prompt3]);
java.util.Collections.shuffle(arrayList);
}

It's simple: by calling the add method on the arrayList variable we add the three prompts to the arrayList variable; or, actually, append them to the end of the list - remember, it's a list so it's ordered, and the Collections.shuffle() method does the trick, by shuffling the list entries - in this case, our prompt references.

Playing them is trivial: add a Play Prompt step with the label PLAY and use the following construct: (Prompt) arrayList.get(index)

Next, use the Increment step to increment the value of the index variable.

Finally, use an If step to check the value of the index variable, comparing its value to the size of the list contained by the arrayList variable: (index<arrayList.size()). If this evaluates to True then just Goto (step) to label PLAY. Otherwise, continue to the rest of the script.

Like this:

 

G.

 

EDIT: Corrected a typo (ArrayLits -> ArrayList).

View solution in original post

9 Replies 9

Gergely Szabo
VIP Alumni
VIP Alumni

Hi,

yes, that could be done (some additional programming required). Where are the recordings? Do you have their handles (filenames, perhaps) before they are expected to be played? Is it UCCX Enhanced or Premium or IP IVR?

G.

Hi

We are running UCCX Premium 9.0.2. Wav files to be played are just prefilled prompt files ex: "prQueueSpot1".

Prompt is played either as a created randomized prompt using the create container prompt step or as a play prompt step with P[prQueueSpot1] %1 || P[prQueueSpot2] %1 || P[prQueueSpot3] %1 || P[prQueueSpot4] %1 || P[prQueueSpot5] %1

In either case at least on of the 5 prompts are repeated and I haven't been able to have it play all 5 prompts randomly at any point

 

Henrik

Hi,

okay, let me try out the solution I have been thinking about, I'll get back to you in an hour.

G.

Okay, this might seem a bit hardcore and you might ask why and how come UCCX does not have this as a built in function. I don't know and at this point I am too tired to investigate although I believe this might be done in an easier and more user friendly way.

I just love Java and I am glad UCCX lets me use it.

We will start by adding two new variables:

index - of type int, initial value: 0

arrayList - of type java.util.ArrayList (yes, type the whole thing in), initial value: new java.util.ArrayList() - again, you will have to type this in, it's not enabled by default and not visible in the dropdown list.

Next, insert a Do step with the following code block:

{
arrayList.add(P[prompt1]);
arrayList.add(P[prompt2]);
arrayList.add(P[prompt3]);
java.util.Collections.shuffle(arrayList);
}

It's simple: by calling the add method on the arrayList variable we add the three prompts to the arrayList variable; or, actually, append them to the end of the list - remember, it's a list so it's ordered, and the Collections.shuffle() method does the trick, by shuffling the list entries - in this case, our prompt references.

Playing them is trivial: add a Play Prompt step with the label PLAY and use the following construct: (Prompt) arrayList.get(index)

Next, use the Increment step to increment the value of the index variable.

Finally, use an If step to check the value of the index variable, comparing its value to the size of the list contained by the arrayList variable: (index<arrayList.size()). If this evaluates to True then just Goto (step) to label PLAY. Otherwise, continue to the rest of the script.

Like this:

 

G.

 

EDIT: Corrected a typo (ArrayLits -> ArrayList).

Hi G :-)

Looks great, I will give it a shot and get back to you with result

Thanks
Henrik

 

Hi G.

I have a colleage who looked at this and made a solution based on you input, so your help is very much appreciated.

It seems that the cisco functionallity plays randomly allright, only it doesn't take into consideration which prompts it has allready played, therefore repeating some of them. This was not what we wanted (or expected with the weight option assigned anyway)

Again thanks for your guidance :-)

Henrik

Hi Henrik,

I have the same requirement for a random play while in queue without repeating the same audio unless all of them have been played already.

I know it is an old post and you might have forgotten what was made back then, if not I would appreciate if you can share this part of your script.

Thanks,

George

Hi George.

Our solution is quite diffrent than described here, but Gergely's input was base for it.

Send me your mail address at "hla@tdcnetdesign.dk" and I'll share the solution we made, if you're still interrested.

Thanks

Henrik

Very helpful, thank you Gergely

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: