我在处理记录标签中的 dtmf 时遇到问题。
我正在寻找识别在记录期间输入的零并根据该值执行特定操作。讲话前后的任何时间都可以输入零。
通过以下代码段,我看到当我输入零时,应用程序退出。看起来已经到达块标记,但随后处理终止。我不确定这里有什么问题。还是有更好的方法来实现同样的目标?
我在这里也提到了答案:VoiceXML - Recognize DTMF in Recording,但需要更多细节。
<form id="recordMessage">
<property name="termchar" value="" />
<property name="inputmodes" value="dtmf" />
<var name="lastdtmfchar" expr="1"/>
<record name="recording" beep="true" maxtime="120s" dtmfterm="false" type="audio/wav">
<grammar mode="dtmf" version="1.0" root="dtmfSettings" xmlns="http://www.w3.org/2001/06/grammar">
<rule id="dtmfSettings" >
<one-of>
<item>0</item>
<item>#</item>
</one-of>
</rule>
</grammar>
<filled>
<assign name="lastdtmfchar" expr="recording$.termchar"/>
<if cond = "recording$.termchar == '#'">
<prompt> Hash entered
</prompt>
</if>
<if cond = "recording$.termchar == '0'">
<prompt> zero entered
</prompt>
</if>
</filled>
</record>
<block>
<if cond = "lastdtmfchar == '1'">
<prompt> block value not assigned
</prompt>
</if>
<if cond = "lastdtmfchar == '#'">
<prompt> block hash entered
</prompt>
</if>
<if cond = "lastdtmfchar == '0'">
<prompt> block zero entered
</prompt>
</if>
</block>
表单中只有这个记录标签,但根文档有所有的处理程序..
<vxml .....>
<catch event="connection.disconnect.hangup">
<goto next="${hangupUrl}?cause=hangup" />
</catch>
<catch event="connection.disconnect">
<goto next="${hangupUrl}?cause=disconnect" />
</catch>
<catch event="error">
<prompt>
<audio src="${goodbyeUrl">
</audio>
</prompt>
<exit/>
</catch>
<catch event="*">
<prompt>
<audio src="${goodbyeUrl">
</audio>
</prompt>
<exit/>
</catch>
<property name="termchar" value="#"/>
<link dtmf="0" next="${globalHandlerUrl}">
</link>
</vxml>