我想再添加一个代码段
以下代码段将从来电者处获取手机号码,并将来电者输入的号码发布到另一页,代码正常,
但是我想查看表格中的那个号码并拉出“输入的电话号码详细信息”,即contact_tbl中包含的电话号码,名字,姓氏,地址, 现在我想提取给定电话号码的这些细节。
<?php
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
?>
<vxml version = "2.1">
<meta name="maintainer" content="your_email_address@wherever.com"/>
<property name="inputmodes" value="dtmf" />
<form id="get_mobile_no">
<field name="mobileno" type="digits?minlength=10;maxlength=10">
<prompt>
<prosody rate="slow"> please enter your 10 digit mobile number !</prosody>
</prompt>
<!--INVALID-->
<nomatch count = "1">
<prompt>
<prosody rate="slow"> Is that a number? Please try again. </prosody>
</prompt>
<reprompt/>
</nomatch>
<!--TIMEOUT-->
<noinput count = "1">
<prompt>Again, please enter your 10 digit mobile number !</prompt>
<reprompt/>
</noinput>
<catch event="noinput nomatch" count="3">
<prompt>Please try again later. Good bye.</prompt>
<exit/> </catch>
<filled>
<prompt>
<prosody rate="slow"> you said
<value expr="mobileno"/>
! Thanks for calling, you may now hang up.</prosody>
</prompt>
</filled>
</field>
<block name="sendData">
<prompt>Entering entering...</prompt>
<submit next="get_dtmf_ip.php" namelist="mobileno" method="post" />
</block>
</form>
</vxml>
示例VXML ivr应用程序,它从用户获取输入并播放来电者输入的号码。
下面的代码工作正常,但是当我删除语法标记时,它会播放一些错误代码,我无法跟踪该错误代码。
现在我想做一点改变,用户可以输入多个号码。
确切的来电者必须输入他们的手机号码。
如何更改代码以接受多个数字。
<?php
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
?>
<vxml version = "2.1">
<meta name="maintainer" content="your_email_address@wherever.com"/>
<form id="guessNumber">
<field name="guess">
<grammar type="text/gsl">
[dtmf-1 dtmf-2 dtmf-3 dtmf-4 dtmf-5 dtmf-6 dtmf-6 dtmf-7 dtmf-8 dtmf-9]
</grammar>
<prompt>
<prosody rate="slow">
Guess what the computer is thinking! Pick a number between 0 and 9.
</prosody>
</prompt>
<nomatch>
<prompt>
<prosody rate="slow">
Is that a number? Please try again.
</prosody>
</prompt>
<reprompt/>
</nomatch>
<filled>
<prompt>
<prosody rate="slow">
you said
<value expr="guess"/>
!
</prosody>
</prompt>
</filled>
</field>
</form>
</vxml>
答案 0 :(得分:0)
这个问题有点陈旧,但对于未来的读者......
很难说出你在问什么。要允许多个数字,请将语法更改为:
<grammar version="1.0" xml:lang="en-US" root="keypress"
mode="dtmf" scope="document">
<rule id="keypress" scope = "public">
<one-of>
<item> 1 </item>
<item> 2 </item>
<item> 3 </item>
<item> 4 </item>
<item> 5 </item>
<item> 6 </item>
<item> 7 </item>
<item> 8 </item>
<item> 9 </item>
<item> 0 </item>
</one-of>
</rule>
</grammar>
然后使用以下命令指定位数:
<field name="guess" type="digits?length=2" >
但是,如果你问如何从调用者那里获得多个响应,只需在表单中添加第二个字段元素,如下所示:
<form id="guessNumber">
<field name="guess1" type="digits?length=1" >
<prompt>
Guess what the computer is thinking! Pick a number between 0 and 9.
</prompt>
</field>
<field name="guess2" type="digits?length=1" >
<prompt>
Guess what the computer is thinking now! Pick a number between 0 and 9.
</prompt>
<filled>
You guessed <value expr="guess1"> and <value expr="guess2">.
</filled>
</field>
</form>
nomatch和韵律元素为清晰起见删除了它们。它们可以重新加入。