Questions and answers about IVR programming for Plum DEV
Moderators: admin , support
jcooper
Posts: 45 Joined: Tue Jul 22, 2008 5:22 pm
Post
by jcooper » Tue Nov 04, 2008 1:13 am
Hi, I am trying to implement a better way to read a confirmation number back (using prosody -25% now and its not that clear).
So i came up with the bright? idea of using a foreach loop. Code is below:
Code: Select all
<script>
<![CDATA[
var confirmnumber = "12345";
]]>
</script>
<field name="ConfCode">
<grammar type="application/srgs+xml" root="OOConf" mode="dtmf" version = "1.0">
<rule id="OOConf" scope="private">
<one-of>
<item>1</item>
<item>2</item>
<item>*</item>
</one-of>
</rule>
</grammar>
<prompt>
Your confirmation number is:
<foreach array="confirmnumber" item="digit">
<value expr="digit"/>
</foreach>
<break/>
To repeat press 1, to continue press 2, to exit the system press the star key.
</prompt>
<filled>
<if cond="ConfCode=='1'">
<clear namelist="ConfCode"/>
<reprompt/>
<elseif cond="ConfCode=='2'"/>
<goto next="#Menu"/>
<else/>
<disconnect />
</if>
</filled>
</field>
This works but the problem is that after it has finished saying the last digit (5) it does not play the remainder of the prompt. Any ideas?
Also, as a side note, if i don't do the assignment in the script tag (e.g. do a var tag) it won't read anything back. How odd is that?
support
Posts: 3632 Joined: Mon Jun 02, 2003 3:47 pm
Location: Boston, MA
Contact:
Post
by support » Tue Nov 04, 2008 12:16 pm
Hi,
I would recommend not using the IVR tag, foreach, for this purpose as once you get to the
<foreach> portion of your IVR code, it will not proceed with the rest of your prompt because it expects a response from the user.
Instead, you should prepend a comma for your variable of digits. This would slow down the read back of digits to the user. For IVR example:
Code: Select all
<?php
header("Content-type: text/xml");
echo("<?xml version=\"1.0\"?>\n");
?>
<vxml version="2.0">
<var name="fieldvalue" expr="12345"/>
<form>
<block>
<prompt>
<speak xml:lang="en-US">
<prosody rate="-25%">
<voice name="Samantha" gender="female">
<say-as type="digits"><value expr="fieldvalue.toString().replace(/(.)/g, '$1, ')"/></say-as>
</voice>
</prosody>
</speak>
</prompt>
</block>
</form>
</vxml>
Hope this sample IVR code helps.
Regards,
Plum Support
Last edited by
support on Wed Feb 24, 2010 12:48 pm, edited 4 times in total.
soso
Posts: 62 Joined: Tue Apr 22, 2008 8:11 am
Post
by soso » Tue Jun 02, 2009 2:29 am
Great !
Thanks.