我正在使用与Tellme相似的发动机供电的VXML。我在语音邮件系统的电话提示中添加了语音识别。新菜单将首先提示用户进行口头输入,如果找不到匹配,或者如果不给出输入,则会再次提示用户使用触摸音。

原始菜单看起来像这样:

<menu id="msgedit">
        <prompt><enumerate><value expr="_prompt"/>press <value expr="_dtmf"/>.</enumerate></prompt>
        <choice dtmf="9" next="#checkurgent">To deliver your message </choice>
        <choice dtmf="7" next="#playmsg">To play your message </choice> 
        <choice dtmf="3" next="#rerecord">To discard your message and record over </choice>
        <choice dtmf="2" next="#addtomsg">To add to your message </choice>
        <choice dtmf="6" next="#testnumber">To enter a phone number where you may be reached </choice>
        <choice dtmf="1" next="#cancel">To cancel making a message </choice>
        <!-- handle no input/no match -->   
</menu>

新菜单看起来像这样:

<form id="msgedit">
      <field name="choice">
         <prompt>
         <if count == 0">
            Please choose one of the following. 
            deliver, play back, rerecord, add to, 
            enter a callback number, or cancel.
            <else/>
            Please choose one of the following. 
            To deliver your message, press 9. 
            To play back your message, press 7. 
            To discard your message and rerecord, press 3. 
            To add to your message, press 2. 
            To enter a callback number, press 6. 
            To cancel your message, press 1.
         </if>
         </prompt>
      </field>
      <filled>
         <if cond="choice == 'deliver' || choice == '9'">
            <goto next="#checkurgent"/>
            <elseif cond="choice == 'play' || choice == '7'"/>
            <goto next="#playmsg"/>
            <elseif cond="choice == 'rerecord' || choice == '3'"/>
            <goto next="#rerecord"/>
            <elseif cond="choice == 'add' || choice == 'add to' || choice == '2'"/>
            <goto next="#addtomsg"/>
            <elseif cond="choice == 'enter callback number' || choice == 'callback number' || choice =='6'"/>
            <goto next="#testnumber"/>
            <elseif cond="choice == 'cancel' || choice =='1'"/>
            <goto next="#cancel"/>
            <else/>
            <throw event="nomatch"/>
         </if>
      </filled>
      <!-- handle no input/no match -->
   </form>

但是,我想使用 <enumerate><choice> 从原始菜单到重复的行为而不是长文本(这太长,导致错误)。

这是一个问题:是否有一种方法可以在第二个提示中使用第一种提示?我可以放置一个领域吗?我该怎么做?

有帮助吗?

解决方案

选择元素是特定于菜单的。虽然可以在一般提示中使用枚举,但在第一个示例中使用的方式是将提示与允许的输入联系在一起。对于一个字段,您将从定义的语法中获得可用的输入。

在后一点上,您的摘要没有提及语法,也没有指示类型。语法是在VoiceXML文档中的较高级别定义还是内置的语法?如果没有,那可能是您错误的根源。

您可以使用菜单和选择的语音识别,但是选择列举的方式的方式:

这是VoiceXML 2.0规范的修改示例:

<menu>
  <choice dtmf="1" next="http://www.sports.example.com/vxml/start.vxml">
    <grammar src="sports.grxml" type="application/srgs+xml"/>
    Press 1 or say Sports for sports scores
  </choice>
  <choice dtmf="2" next="http://www.weather.example.com/intro.vxml">
   <grammar src="weather.grxml" type="application/srgs+xml"/>
   Press 2 or say weather for weather
  </choice>
  <choice dtmf="3" next="http://www.stargazer.example.com/voice/astronews.vxml">
   <grammar src="astronews.grxml" type="application/srgs+xml"/>
   press 3 or say Stargazer astrophysics for ?
  </choice>
</menu>

如果将提示提示放入eCmascript阵列中,则可能也可以使用枚举。

通常,我会推荐现场方法。提供丰富的提示和错误处理,您会获得更多的灵活性。菜单/选择是一种快捷机制,用于简单,有限的情况。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top