VXML:音声プロンプトと列挙プロンプトを切り替えることはできますか?

StackOverflow https://stackoverflow.com/questions/3144716

質問

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> 元のメニューから長いテキストの代わりに再繰り返すように動作します(これは長すぎてエラーを引き起こします)。

質問は次のとおりです。2番目のスタイルのプロンプト内で最初のスタイルのプロンプトを使用する方法はありますか?フィールドの内側に入れてもいいですか?どうすればいいですか?

役に立ちましたか?

解決

選択要素はメニューに固有です。一般的なプロンプトで列挙することはできますが、最初の例で使用する方法は、プロンプトを許可された入力に結び付けることです。フィールドの場合、定義された文法から利用可能な入力を取得しています。

後者のポイントでは、スニペットは文法について言及せず、フィールドがタイプを示していません。文法は、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