Page 1 of 1

attempting to switch to spanish

Posted: Tue Apr 21, 2009 3:28 pm
by irms
I have a php document that builds the voiceXML based on user preferences. (A scratchpad file posts a variable to the application server, which grabs the preferences from the db).

I'm causing two things to happen hoping the prompts will sound off in the language of the user:

1 - changing the xml:lang attribute in the <vxml> tag to read either "en_us" or "es_us"

2 - echoing all prompts using the translated lines from the database.

The script works just fine in english, but when I try to switch to spanish nothing seems to work. Instead, I get the voice telling me that "xml_lang= something tilde tilde something" -- I'm not sure. I can't quite make out what the voice is saying. But I can tell that it is simply repeating in a loop. This is the part of the log that is repeating:

Code: Select all

Tue 21 Apr 2009 08:17:04 PM UTC:
received event: noinput: 
VXI::queue_prompts()
bargein set to true
INPUTMODES set to "DTMF"
Audio segment added to prompt queue from TTS application/synthesis+ssml for:
---------
VXI::field_element - activating grammars for form = 'call' formitem = 'pin_number'
VXI::do_recognition()
PromptManager::Play()
Newly queued prompts are now being played

Tue 21 Apr 2009 08:17:14 PM UTC:
received event: noinput: 
VXI::queue_prompts()
bargein set to true
INPUTMODES set to "DTMF"
Audio segment added to prompt queue from TTS application/synthesis+ssml for:
---------
VXI::field_element - activating grammars for form = 'call' formitem = 'pin_number'
VXI::do_recognition()
PromptManager::Play()
Newly queued prompts are now being played

Tue 21 Apr 2009 08:17:23 PM UTC:
received event: noinput: 
VXI::queue_prompts()
bargein set to true
INPUTMODES set to "DTMF"
Audio segment added to prompt queue from TTS application/synthesis+ssml for:
---------
VXI::field_element - activating grammars for form = 'call' formitem = 'pin_number'
VXI::do_recognition()
PromptManager::Play()
Newly queued prompts are now being played

Any help would be appreciated.

Thanks!

IVR code to change language preference

Posted: Tue Apr 21, 2009 4:03 pm
by support
Hi,

Could you provide us with the IVR code that you are using so that we may test this? You can private message us your IVR code if you feel uncomfortable sharing your IVR code on the forum.

However, we have done tests in the past similar to this. For example using this IVR code:

leaflanguage.php:

Code: Select all

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

<vxml version="2.0" application="languagenoinput.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="languagenoinput.php">

<form>

<property name="inputmodes" value="dtmf"/>

<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="languagenoinput.php">

<form>

<property name="inputmodes" value="dtmf"/>

<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>
languagenoinput.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>
From this IVR example, the caller would call into leaflanguage.php and select the language preference. From there, it branches to either leaflanguage1.php or leaflanguage2.php and prompts them for digits. For leaflanguage2.php, you should notice that the spanish prompts are played properly and that the xml_lang is set to es_us. Finally, languagenoinput.php sets the noinput and nomatch handlers to play the appropriate message based on the user's language preference. Hope this helps.

Regards,
Plum Support

Posted: Wed Apr 22, 2009 7:38 pm
by irms
Just in case anyone else comes across this problem: it was an encoding problem on my end.

My DB has utf-8 collation and my PHP script was simply echoing a sanitized value into the XML (the xml also needs to be UTF-8).

What I failed to do, however, was use utf8_encode() BEFORE I put the value in XML.


Those odd characters that were in the XML were causing the IVR to "misunderstand" and therefore not work as expected.

Hope this saves someone else a couple of minutes of frustration.