vxml:我可以在语音提示和枚举提示之间切换吗?

发布于 2024-09-07 08:51:44 字数 2815 浏览 2 评论 0原文

我正在使用由类似于 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>

但是,我想使用原始菜单中的 行为重新提示而不是长文本(太长并导致错误)。

问题是:有没有办法在第二种提示样式中使用第一种提示样式?我可以将 and 放在字段内吗?我该怎么做?

I am using vxml powered by an engine similar to TellMe. I adding voice recognition to telephone prompts for a voice mail system. The new menu will first prompt the user for verbal input, and if no match is found, or if no input is given, the user is prompted again with touch tone options.

The original menus look like this:

<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>

The new menu looks like this:

<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>

However, I want to use the <enumerate> and <choice> behavior from the original menu to reprompt instead of the long text (which is too long and causes an error).

HERE'S THE QUESTION: is there a way to use the first style of prompt within the second style of prompt? can i put and inside of a field? and how would i do that?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

掐死时间 2024-09-14 08:51:44

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

关于后一点,您的代码片段没有提到语法,字段也没有指示类型。语法是在 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 数组中,您也可以使用枚举。

一般来说,我会推荐现场方法。您可以更加灵活地提供丰富的提示和错误处理。菜单/选择是一种快捷机制,适用于简单、有限的情况。

The choice element is specific to menu. While can use enumerate in a general prompts, the way it is used in the first example, it is tying the prompts to the allowed input. For a field, you are getting the available inputs from a defined grammar.

On the latter point, your snippet doesn't mention grammar nor does the field indicate a type. Is the grammar defined at a higher level within the VoiceXML document or a built in grammar ? If not, that may be the source of your error.

You can use speech recognition with menus and choices, but the way the selections are defined with the enumeration:

This is a modified example from the VoiceXML 2.0 specification:

<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>

If you put the prompts into an ECMAScript array, you could probably use the enumeration as well.

In general, I would recommend the field approach. You gain a lot more flexibility for providing rich prompts and error handling. menu/choice is a shortcut mechanism that is meant for simple, limited cases.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文