VXML: هل يمكنني التبديل بين مطالبة الصوت ومطالبات التعداد؟

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

سؤال

أنا أستخدم VXML مدعومًا بمحرك مشابه لـ TellMe. أقوم بإضافة التعرف على الصوت إلى مطالبات الهاتف لنظام البريد الصوتي. ستطالبك القائمة الجديدة أولاً بالمستخدم للإدخال اللفظي ، وإذا لم يتم العثور على تطابق ، أو إذا لم يتم تقديم أي إدخال ، يتم مطالب المستخدم مرة أخرى بخيارات اللمس.

تبدو القوائم الأصلية مثل هذا:

<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> السلوك من القائمة الأصلية إلى reprompt بدلاً من النص الطويل (وهو طويل جدًا ويسبب خطأً).

إليك السؤال: هل هناك طريقة لاستخدام النمط الأول للمطالبة ضمن النمط الثاني للمطالبة؟ هل يمكنني وضع وداخل حقل؟ وكيف أفعل ذلك؟

هل كانت مفيدة؟

المحلول

عنصر الاختيار خاص بالقائمة. على الرغم من أنه يمكن استخدام التعداد في مطالبات عامة ، فإن الطريقة التي يتم بها استخدامها في المثال الأول ، فإنها تربط المطالبات بالمدخلات المسموح بها. لحقل ، تحصل على المدخلات المتاحة من القواعد المحددة.

على النقطة الأخيرة ، لا يذكر المقتطف الخاص بك القواعد ولا يشير الحقل إلى نوع. هل يتم تعريف القواعد النحوية على مستوى أعلى داخل وثيقة 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