We've Moved! Please visit our new and improved forum over at our new portal: https://portal.plumvoice.com/hc/en-us/community/topics

Switching language

Questions and answers about Plum iOn systems

Moderators: admin, support

Post Reply
shanthint@paydq.com
Posts: 84
Joined: Wed Apr 04, 2007 4:58 pm

Switching language

Post by shanthint@paydq.com »

Hello,
We have plum voice server.We have a voice application in English. Now we need to switch the language to spanish if the caller presses 1. We have all prompts as audio files. so if the called press 1 the spanish audio files should be played instead of English.
I have some ideas to do that. I feel those are not that much professional ways.
Do you guys have any ideas to accomplish this?
Please let me know your ideas.

NOTE: We purchased Spanish TTS engine too.

Thank you.

support
Posts: 3632
Joined: Mon Jun 02, 2003 3:47 pm
Location: Boston, MA
Contact:

IVR application for switching languages

Post by support »

Hi,

Here's one way you could do this:

First, you should separate your English and Spanish audio files on your web server into separate directories. For example, all of your English audio files would be in:

files/audio/English

and all of you Spanish audio files would be in:

files/audio/Spanish

Next, you should make sure that the audio files in these folders have the same file names. So, for example, the English audio files in /files/audio/English would be named:

welcome.wav
goodbye.wav
prompt1.wav
...

and the Spanish audio files in /files/audio/Spanish would be named:

welcome.wav
goodbye.wav
prompt1.wav
...

as well. Next, you can set up a root document to handle the language selection by the user:

rootlanguage.php:

Code: Select all

<?php
header("Content-type: text/xml");
echo("<?xml version=\"1.0\"?>\n");
?>

<vxml version="2.0">
<form id="choose_lang">
<var name="language" expr="''"/>
<field name="lang">
<grammar>1{English}|2{Spanish}</grammar>
<prompt>
For American English, press 1. For Spanish, press 2.
</prompt>
<filled>
<assign name="language" expr="lang"/>
<goto next="leaflanguage.php"/>
</filled>
</field>
</form>
</vxml>


and leaflanguage.php would be:

Code: Select all

<?php
header("Content-type: text/xml");
echo("<?xml version=\"1.0\"?>\n");
?>

<vxml version="2.0" application="rootlanguage.php">
  <form>
    <block>
      <prompt>
        <audio expr="'audio/' + language + '/prompt1.wav'">
          Sorry, your audio file could not be retrieved.
        </audio>
      </prompt>
    </block>
  </form>
</vxml>


where <audio expr="'audio/' + language + '/prompt1.wav'"> would take care of the language that the audio file is played in due to the structuring of your directories. So, all of your audio files would be in this format:

<audio expr="'audio/' + language + '/enteryourfilenamehere.wav'">

throughout your IVR application. Just make sure that you reference your root document in your leaf documents throughout your IVR application and this method should work out for you.

Hope this helps.

Regards,
Plum Support
Last edited by support on Fri Feb 26, 2010 11:49 am, edited 3 times in total.

shanthint@paydq.com
Posts: 84
Joined: Wed Apr 04, 2007 4:58 pm

Post by shanthint@paydq.com »

Thank you very much.
This is the idea I already tried. The problem is, the variable is set in the root document. But it is not passed over to the leaf documents.
And I saw some other post regarding this. I tried apply that solution too like instead just using the variable name, I use
applicaiton.[variableName]. I tried just use the variable name. Neither of them worked.

I have code snippet below. Please take a look at that whether I miss something.

code:

This code didn't even set the variable value.

//ROOT Document


<?xml version="1.0"?>
<vxml version="2.0" xmlns="http://www.w3.org/2001/vxml">

<var name="language" expr="''"/>

<form id="choose_lang">

<field name="select_lang">
<grammar>1{English}|2{Spanish}</grammar>
<prompt>
<audio expr="'recordings/English/'+groupid+'/prompt_greeting.wav'" >
</audio>
<audio src="recordings/English/global/pause.wav"></audio>
</prompt>
<prompt>For English, Press1. For Spanish, Press2</prompt>
<filled>
<assign name="application.language" expr="select_lang" />
The Language is now set to <value expr="language"/>.
<goto next="CustomerEntry.do" maxage="0" maxstale="0" />
</filled>

</field>
</form>
</vxml>


LEAF DOCUMENT:

<?xml version="1.0"?>
<vxml version="2.0" application="Welcome.do" xmlns="http://www.w3.org/2001/vxml">

<form id="customerentry">

<field name="field_value" >

<grammar src="builtin:dtmf/digits"/>
<grammar src="builtin:grammar/digits"/>

<prompt >
<audio expr="'recordings/'+application.language+'/'+groupid+'prompt_customerid.wav'" ></audio>
</prompt>

</field>
</form>
</vxml>


Anothercode:
This one set the variable but didn't passed over to the leaf doucment

ROOR DOCUMENT:

<?xml version="1.0"?>
<vxml version="2.0" xmlns="http://www.w3.org/2001/vxml">

<form id="choose_lang">
<var name="language" expr="''"/>
<field name="select_lang">
<grammar>1{English}|2{Spanish}</grammar>
<prompt>
<audio expr="'recordings/English/'+groupid+'/prompt_greeting.wav'" >
</audio>
<audio src="recordings/English/global/pause.wav"></audio>
</prompt>
<prompt>For English, Press1. For Spanish, Press2</prompt>
<filled>
<assign name="language" expr="select_lang" />
The Language is now set to <value expr="language"/>.
<goto next="CustomerEntry.do" maxage="0" maxstale="0" />
</filled>

</field>
</form>
</vxml>

LEAF DOCUMENT:

I tried both ways with application.language and just language. No luck.

Do you guys have any idea about what I am missing? Or is this a bug in the platform?

Thank you

support
Posts: 3632
Joined: Mon Jun 02, 2003 3:47 pm
Location: Boston, MA
Contact:

restructured IVR code

Post by support »

Hi,

Sorry, but the segment of IVR code that was given to you was incorrect. It should be restructured to this:

rootlanguage.php:

Code: Select all

<?php
header("Content-type: text/xml");
echo("<?xml version=\"1.0\"?>\n");
?>

<vxml version="2.0">
<var name="language" expr="''"/>
</vxml>


leaf1language.php:

Code: Select all

<?php
header("Content-type: text/xml");
echo("<?xml version=\"1.0\"?>\n");
?>

<vxml version="2.0" application="rootlanguage.php">
<form id="choose_lang">
<field name="lang">
<grammar type="application/x-jsgf" mode="dtmf">1{English}|2{Spanish}</grammar>
<prompt>
For American English, press 1. For Spanish, press 2.
</prompt>
<filled>
<assign name="language" expr="lang"/>
<goto next="leaf2language.php"/>
</filled>
</field>
</form>
</vxml>


leaf2language.php:

Code: Select all

<?php
header("Content-type: text/xml");
echo("<?xml version=\"1.0\"?>\n");
?>

<vxml version="2.0" application="rootlanguage.php">
  <form>
    <block>
      <prompt> The language you selected was <value expr="language"/>. </prompt>
      <audio expr="'audio/' + language + '/prompt1.wav'">
        Sorry, your audio file could not be retrieved.
      </audio>
    </block>
  </form>
</vxml>


So, when you place your call into leaf1document.php, after the user enters DTMF-1 or DTMF-2 for the language, the variable will carry over to the next leaf document.

Hope this helps.

Regards,
Plum Support
Last edited by support on Mon Jan 18, 2010 11:47 am, edited 1 time in total.

hct
Posts: 16
Joined: Sat Feb 28, 2009 1:46 am
Location: Boston
Contact:

Post by hct »

We are attempting a similar multilingual script. However, we are running into two problems. Could you please advise?

1. The default prompts such as "I don't understand" and "Please try one more time" for nomatch are in English. What flag needs to be set to make the vxml root become a Spanish doc? The above example is with several documents but we need to switch languages within a single document.

2. Similarly, how to we enable digit based TTS for Spanish? Still very little success here for us unlike in English which works perfectly. Is a custom grammar needed or perhaps the document root has to be set to the voice property of a Spanish voice engine?

Thanks.

-Joseph

support
Posts: 3632
Joined: Mon Jun 02, 2003 3:47 pm
Location: Boston, MA
Contact:

IVR example to change default prompts

Post by support »

Hi Joseph,

1) You can change these default prompts by adding in <noinput> and <nomatch> tags of your own within your IVR script. For an IVR example:

Code: Select all

<noinput>
Lo siento. No le oí.
</noinput>

<nomatch>
Lo siento. No le entendía.
</nomatch>


2) We've had success at listening to digit-based TTS. How are you implementing this IVR code? Perhaps we can make some suggestions to help you to get this work.

Regards,
Plum Support
Last edited by support on Fri Feb 26, 2010 11:50 am, edited 2 times in total.

hct
Posts: 16
Joined: Sat Feb 28, 2009 1:46 am
Location: Boston
Contact:

Post by hct »

Thanks, however what I meant was in a global sense. Our 7 scripts total 11K lines. While I know they could be broken out into sub dialogs and separate files, our client wants 84 unique scripts which are actually easier to implement with branching among common pathways.

To this end, a global capacity to change the noinput and nomatch voice prompts which the platform is generating by default is preferred to defining them in every single instance of user input. Is this possible or is the only answer the above code segment you sent?

On the TTS question, I meant ASR, not TTS. My apologies. We fixed this however, so I place it below to assist anyone else.

Thanks.

-Joseph

Our finest attempt yet:

Code: Select all

<field name="inp_yyyy">
    <grammar xml:lang="es-US" src="builtin:grammar/digits?length=4"/>
    <prompt>
        Please state the four digits of the year.
    </prompt>
    <filled>
        <!--Do something-->
    </filled>
</field>

hct
Posts: 16
Joined: Sat Feb 28, 2009 1:46 am
Location: Boston
Contact:

Post by hct »

This will be the last post for a while because I am twice in a row mistaken. My apologies. I was blinded with glee when the above example worked for Spanish voice digit entry, but it does not for dtmf. How would you achieve both at once similar to the

Code: Select all

<field name="fooField" type="digits?length=4">
which in English works for both voice and dtmf to enter the digit string?

A final thanks.

-Joseph

support
Posts: 3632
Joined: Mon Jun 02, 2003 3:47 pm
Location: Boston, MA
Contact:

IVR code to demonstrate how to use noinput and nomatch tags

Post by support »

Hi,

About your question on noinput/nomatch, here is an IVR code example that will demonstrate how to set your <noinput> and <nomatch> in your root document so that they will correspond to the language chosen by the caller:

languageroot.php:

Code: Select all

<?php
header("Content-type: text/xml");
echo("<?xml version=\"1.0\"?>\n");
?>

<vxml version="2.0">

<var name="language" expr="''"/>

<noinput>
<if cond="language=='Spanish'">
<prompt>
<voice name="alberto">
Lo siento. No le oí.
</voice>
</prompt>
<else/>
<prompt>
I'm sorry, I didn't hear you.
</prompt>
</if>
<reprompt/>
</noinput>

<nomatch>
<if cond="language=='Spanish'">
<prompt>
<voice name="alberto">
Lo siento. No le entendía.
</voice>
</prompt>
<else/>
<prompt>
I'm sorry, I didn't understand you.
</prompt>
</if>
<reprompt/>
</nomatch>

</vxml>


leaflanguage.php:

Code: Select all

<?php
header("Content-type: text/xml");
echo("<?xml version=\"1.0\"?>\n");
?>

<vxml version="2.0" application="languageroot.php">

<form id="choose_lang">

<field name="lang">
<grammar>1{English}|2{Spanish}</grammar>
<prompt>
For American English, press 1. For Spanish, press 2.
</prompt>
<filled>
<assign name="language" expr="lang"/>

<if cond="lang=='English'">
<goto next="leaflanguage1.php"/>
<else/>
<goto next="leaflanguage2.php"/>
</if>

</filled>
</field>

</form>
</vxml>


leaflanguage1.php:

Code: Select all

<?php
header("Content-type: text/xml");
echo("<?xml version=\"1.0\"?>\n");
?>

<vxml version="2.0" application="languageroot.php">

<form>

<field name="englishdigits" type="digits?length=4">
<prompt>
Please enter some digits.
</prompt>

<filled>
<prompt>
You entered <say-as type="acronym"><value expr="englishdigits"/></say-as>
</prompt>
</filled>
</field>

</form>
</vxml>


leaflanguage2.php

Code: Select all

<?php
header("Content-type: text/xml");
echo("<?xml version=\"1.0\"?>\n");
?>

<vxml version="2.0" xml:lang="es_us" application="languageroot.php">

<form>

<field name="spanishdigits" type="digits?length=4">
<prompt>
<voice name="alberto">
¿Puede usted incorporar algunos dígitos satisface?
</voice>
</prompt>

<filled>
<prompt>
<voice name="alberto">
Usted entró <value expr="spanishdigits.toString().replace(/(.)/g, '$1, ')"/>
</voice>
</prompt>
</filled>
</field>

</form>
</vxml>


This IVR example also demonstrates both dtmf and voice entry for digits for Spanish.

Hope this helps.

Regards,
Plum Support

Post Reply