Author Message
ErikJohnson2
Joined: Jan 18, 2006
Messages: 0
Offline
Is it possible to use Dialog Designer to reference audio files dynamically and can they be kept on an external server or must they be part of the project.
ErikJohnson2
Joined: Jan 18, 2006
Messages: 0
Offline
Dialog Designer exposes API in the Phrase class that will let a developer override methods to change the audio file.  To do this, open the Phrase''s associated Java class and override the appropriate method.

The API to work with is:
String getFileName()-Override this to dynamically change the phrase name.  This is helpful if you have audio files that are part of your project and you just want to change the file that is played.

String getURL()-Override this if you want to use external audio files. Specify the URL for the file, this value will be used the generated VXML.

String getText()-Override this to provide backup text.  In the event that the Voice browser cannot fetch the audio file, it will fall back and try to TTS the backup text.

WARNING: By overriding the methods in your phrase class you have the ability to change audio flies & URLs that are generated in VXML. With this flexibilty comes risk; if file names or URLs are incorrect you are likely to have runtime errors.
MarkFohl
Joined: Mar 9, 2007
Messages: 0
Offline
Hi, I'm java-impaired and need a little help on this. I will be working with an application in which I need to access phrases based on the value of a variable. In the old Conversant days, this could be accomplished by accessing a phrase by "talkfile and phrase number". That mechanism is clearly no longer available.

So I read this thread, and you mention a "getFileName" method. I can't find anything like "getFileName". I edited the Java (in a DD 3.x application) for a phrase, and there was use of a "SetFileName" which contained the name of the phrase file. Is this the method you are referring to? Could I somehow use a variable to access dynamic phrases?

Thanks in advance,

-- Mark
ErikJohnson2
Joined: Jan 18, 2006
Messages: 0
Offline
Yes, DD 4.0 introduced the "PhraseVariable" concept which lets you reference audio files by a variable within a prompt. The variable value must identify a phrase in the project (or be an audio URL).

I would recommend that you use 4.0 because it adds a lot more functionality for working with audio files.

You can override methods in a Java class by using the Eclipse menu. Source->Override / Implement methods. You can see the methods that are available for override and then eclipse will add them to the Java class.

For more information on the Phrase Variable, you should look at the DD 4.0 Knowledge Transfer slides (which should be posted to the DD page on Devconnect).
SaninSotoAmaya
Joined: Feb 14, 2014
Messages: 5
Offline
Hello Erick

Where can i download tha DD 4.0 Knowledge Transfer slides?

Please provide me an example of using "PhraseVariable"

Thanks

Sanín
ErikJohnson2
Joined: Jan 18, 2006
Messages: 0
Offline
Apparently the KT slides have not been posted--I'm following up to see when they will be posted to Devconnect.

A very basic example of PhraseVariable is:
Create a project with a phraseset "main". Add phrases to the phraseset: "a", "b", "c", "d", etc.
Create a variable "PhraseID". Set the variable value to be "main:b".
Create a prompt, and add a PhraseVariable. Select the format as "Phraseset:PhraseID" and select the variable "PhraseID".

When you run the application, the prompt will play the phrase "main:b".

There are other ways to use phrase variables, but this is hopefully a good basic example that demonstrates how they are used. The power of them comes from being able to use variables to reference audio files within your application, and how those variables are set is really up to your application needs (ie. could be set in Java code, from a database, webservice, etc..).
MarkFohl
Joined: Mar 9, 2007
Messages: 0
Offline
Thanks, Erik. I think I had seen something in a presentation somewhere, but your example is very helpful.
SaninSotoAmaya
Joined: Feb 14, 2014
Messages: 5
Offline
Hi Erik

Thanks for your answer.

I do changes into my flow in order to use PhraseVariable.

The first time i use it, it works fine, but if i inteend to use later again into the another nodes, i get the following error

App Log: EVENT Id(2) Label() Msg(Error: error.runtime , Error processing request, com.avaya.sce.runtimecommon.SCERuntimeException: Unable to get session variable: Banco)

Banco is my variable defined as SimpleVariable.

Y use this settings:

Data Node
Assign <Banco = "http://localhost:8080/AvalesFenalco/data/spanish/phrases/B">
Concatenate <Banco = Banco.concat(CodigoBanco:value)>
Concatenate <Banco = Banco.concat(".wav")>

The prompt has the segment

Phrase Variable (type="Audio URL", variable="Banco")

I change the type = "Phraseset:Phrase ID" and the the error i obtain it's the same.

Can you help me?

My DD version is 4.0

Thanks in advance

Sanin
ErikJohnson2
Joined: Jan 18, 2006
Messages: 0
Offline
That exception means that the session does not have the variable "Banco", which seems odd.... do you ever remove it from the session?

Can you send me the project so I can take a look? Zip up the project folder and email to: ejohnson@avaya.com
SaninSotoAmaya
Joined: Feb 14, 2014
Messages: 5
Offline
Thans for all Erick

I made some fixes into my project related with deleted items and all is working now.



Go to:   
Mobile view