cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
3487
Views
40
Helpful
8
Replies

UCCX - Check for existence of file?

csg-admin
Level 1
Level 1

Hi all,

I'm wondering if there is a step(s) I can use in a script to check for the existence of a wav file in a particular subdirectory of the prompts folder on the server and if this file exists to play it?

Any help appreciated.

8 Replies 8

Anthony Holloway
Cisco Employee
Cisco Employee

What would you do if it wasn't there?  Play a different prompt?

If so, this is a built in feature:

     Play Prompt (--Triggering Contact--, P[missingprompt.wav] || P[realprompt.wav])

This will see that the first prompt does not exist, and play the second prompt.  If the first prompt did exist, then it would play the first prompt and not the second.

There is another solution that is more complex, but basically, you do this:

On Exception UndefinedPromptException Goto MyPrompt1Failure

Play Prompt (--Triggering Contact--, P[myprompt1.wav])

...

Label MyPrompt1Failure

Clear Exception UndefinedPromptException

...

That's brilliant! Thanks very much.

I'm looking to check for the existance of a prompt to make a prompt management script. I have the On Exception com.cisco.prompt.UndefinedPromptException Goto NextLabel but it doesn't catch the Exception (on UCCX 8.0(2)SU3 at least...). In the debugger it is showing this is the exception I am hitting when trying to cast the prompt to a Document (to make a backup copy.) When the file exists it casts to the document and creates the backup copy just fine, but I need it to handle new prompts too (preferably without playing it and trying to catch it on the play step). Any ideas?

Hi Jeffrey,
I'm not sure if this is what you want, but you can check prompt existance without actually playing it this way:

Write following expression in new IF statement:

{ try {  check_prompt = (Document)ivr;   return True; } catch (Exception e) { return False;} }

- where, check_prompt is an empty Document variable, and ivr is a prompt variable. Application will execute true statement if ok, or false if any exception.

Thanks.

Very nice I had tried to make it work originally with a try/catch block, but couldn't get the syntax right. Your solution worked like a charm and lets me get rid of the workaround solution I had written to have a 2nd script that just answers a call and lets the play prompt step play it and let it get caught with the UCCX Exception. Thanks!

No problem, glad that helped you.

The IF Statement is always resolving to true for me, even if the file doesn't exist. Is there anything you recommend to assist in troubleshooting why this might be happening?

Gerry

Thanks for this guidance Anthony +5.  On UCCX 11.6.2 I wasn't able to get the

Play Prompt (--Triggering Contact--, P[missingprompt.wav] || P[realprompt.wav])

but was able to with

Play Prompt (--Triggering Contact--, P[missingprompt.wav] ||| P[realprompt.wav])

I'm not quite sure why this is, after reading through the UCCX Scripting and Development Guide I don't think I'm understanding the differences between the Prompt Escalation Operator || and the Prompt Substitution Operator |||. I know UCCX is very particular with the conversion and syntax of prompt/string values in Menu/Play Prompt steps (P[], etc).  I'll keep researching to see if I can hash this out.

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: