We've Moved! Please visit our new and improved forum over at our new portal: https://portal.plumvoice.com/hc/en-us/community/topics

Mixed Initiatives

Questions and answers about IVR programming for Plum DEV

Moderators: admin, support

Post Reply
jcanter
Posts: 47
Joined: Thu Jun 19, 2003 8:54 am

Mixed Initiatives

Post by jcanter »

Do you have any example code using a mixed initiative? I am trying to test a simple one out. I am most likely doing something wrong with the grammar:

Code: Select all

<?xml version="1.0"?>
<vxml version="2.0">

<form id="place_order">
   <grammar mode="voice" src="sample.jsgf"/>

   <catch event="nomatch noinput">
      <audio src="wav/04.wav">sorry, i didn't catch that.</audio>
      <reprompt/>
   </catch>

   <!-- designates the initial state in a mixed initiative dialog -->
   <initial name="init">
      <prompt>
        <audio src="wav/03.wav">
           Please place your order.
        </audio>
      </prompt>
      <catch event="nomatch noinput">
        <audio src="wav/04.wav">sorry, i didn't catch that.</audio>
        <audio src="wav/11.wav">
           Please place your order.
        </audio>
      </catch>
      <catch event="nomatch noinput" count="2">
        <audio src="wav/04.wav">sorry, i didn't catch that.</audio>
        <assign name="init" expr="true"/>
        <reprompt/>
      </catch>
      <help>
         <audio>
           To place an order your must specify what you would like to eat or drink.
         </audio>
         <audio>
           For example you can say tea or pizza.  
         </audio>
      </help>
    </initial>

    <!-- retrieve origin in case it didn't happen in initial state -->
    <field name="maindish" slot="food">
      <prompt>
        <audio src="wav/06.wav">What is your main dish.</audio>
      </prompt>
    </field>

    <!-- retrieve destination in case it didn't happen in initial state -->
    <field name="beverage" slot="drink">
      <prompt>
        <audio src="wav/08.wav"> What would you like to drink? </audio>
      </prompt>
    </field>

    <!-- confirm origin and destination -->
    <field name="confirm" type="boolean">
      <audio src="wav/10.wav">
         Okay! Your order was
      </audio>
      <prompt> 
         <value expr="maindish"/> 
      </prompt>
      <audio src="wav/05.wav"> and </audio>
      <prompt> 
         <value expr="beverage"/> 
      </prompt>
          <audio>is that correct?</audio>
    <catch event="nomatch noinput">
       Sorry I didn't get that.
      <reprompt/>
    </catch>
   </form>

</vxml>
This is the grammar:

Code: Select all

( pizza {food=pizza;} | burger {food=burger;} | wings {food=wings;} ) [ and ( coke {drink=coke;} | tea {drink=tea;} ) ]
Finally, this is the error:
Wed 28 Jul 2004 05:41:45 PM EDT (000009;001;1091050784) [log] EVENT: Saved utterance 0 for DNIS 5845 on channel 1
Wed 28 Jul 2004 05:41:45 PM EDT (000009;001;1091050784) [rec] DEBUG: SPEECH/DTMF inputmode, no DTMF input, ASR match: filled
Wed 28 Jul 2004 05:41:45 PM EDT (000009;001;1091050784) [rec] EVENT: Found grammar match
Wed 28 Jul 2004 05:41:45 PM EDT (000009;001;1091050784) [rec] EVENT: hypothesis #1: {food: pizza} and {drink: coke}
Wed 28 Jul 2004 05:41:45 PM EDT (000009;001;1091050784) [vxi] DEBUG: VXI::do_recognition - have an answer
Wed 28 Jul 2004 05:41:45 PM EDT (000009;001;1091050784) [vxi] DEBUG: VXI::ProcessRecognitionResult()
Wed 28 Jul 2004 05:41:45 PM EDT (000009;001;1091050784) [jsi] ERROR: errmsg ReferenceError: food is not defined line 1 linetxt tokentxt
Wed 28 Jul 2004 05:41:45 PM EDT (000009;001;1091050784) [vxi] EVENT: received event: error.semantic.ecmascript

support
Posts: 3632
Joined: Mon Jun 02, 2003 3:47 pm
Location: Boston, MA
Contact:

Mixed Initiatives IVR script

Post by support »

Hello,
With some very minor changes to your IVR script you should be able to accomplish what you are trying to do. You should name each <field> to the IVR tag name you want them to be filled by rather than using the slot mechanism.

Code: Select all

<?xml version="1.0"?>
<vxml version="2.0">

<form id="place_order">
   <grammar mode="voice" src="sample.jsgf"/>

   <catch event="nomatch noinput">
      <audio src="wav/04.wav">sorry, i didn't catch that.</audio>
      <reprompt/>
   </catch>

   <!-- designates the initial state in a mixed initiative dialog -->
   <initial name="init">
      <prompt>
        <audio src="wav/03.wav">
           Please place your order.
        </audio>
      </prompt>
      <catch event="nomatch noinput">
        <audio src="wav/04.wav">sorry, i didn't catch that.</audio>
        <audio src="wav/11.wav">
           Please place your order.
        </audio>
      </catch>
      <catch event="nomatch noinput" count="2">
        <audio src="wav/04.wav">sorry, i didn't catch that.</audio>
        <assign name="init" expr="true"/>
        <reprompt/>
      </catch>
      <help>
         <audio>
           To place an order your must specify what you would like to eat or drink.
         </audio>
         <audio>
           For example you can say tea or pizza. 
         </audio>
      </help>
    </initial>

    <!-- retrieve origin in case it didn't happen in initial state -->
    <field name="food">
      <prompt>
        <audio src="wav/06.wav">What is your main dish.</audio>
      </prompt>
    </field>

    <!-- retrieve destination in case it didn't happen in initial state -->
    <field name="drink">
      <prompt>
        <audio src="wav/08.wav"> What would you like to drink? </audio>
      </prompt>
    </field>

    <!-- confirm origin and destination -->
    <field name="confirm" type="boolean">
      <audio src="wav/10.wav">
         Okay! Your order was
      </audio>
      <prompt>
         <value expr="maindish"/>
      </prompt>
      <audio src="wav/05.wav"> and </audio>
      <prompt>
         <value expr="beverage"/>
      </prompt>
          <audio>is that correct?</audio>
    <catch event="nomatch noinput">
       Sorry I didn't get that.
      <reprompt/>
    </catch>
   </form>

</vxml>
Hope This Helps :)

Plum Support
Last edited by support on Thu Feb 25, 2010 4:30 pm, edited 3 times in total.

jcanter
Posts: 47
Joined: Thu Jun 19, 2003 8:54 am

Post by jcanter »

Is it not the standard to use the "slot" attribute or am I looking at that wrong?
The name of the grammar slot used to populate the variable (if it is absent, it defaults to the variable name). This attribute is useful in the case where the grammar format being used has a mechanism for returning sets of slot/value pairs and the slot names differ from the form item variable names.

Post Reply