VoiceXML 2.1 Development GuideHome  |  Frameset Home

  tutorial Voice Recognition  |  TOC  |  tutorial Document Navigation   

Tutorial: VoiceXML hello world with call flow inside a page

This tutorial is based on the things you accomplished in previous tutorials. If you have not completed those tutorials, you'll need to go through them first, else you might be left in the dust when we dig into solme of the more advanced concepts presented here.

Step 1: creating our initial VoiceXML structure

From our previous tutorials, we now recognize the following structure as a normal starting point, right? Of course we do.

<?xml version="1.0" encoding="UTF-8"?>
<vxml version = "2.1" >

</vxml>



Step 2: Our second look at voice recognition menus

In our previous Lesson, we designed a menu exclusively with the <field> tag. But this does not necessarily have to be the case. Beneath our <form> tag, we can also use a <block> structure if we want to give basic menu prompts:


<?xml version="1.0" encoding="UTF-8"?>
<vxml version = "2.1">

  <form id="MainMenu">
    <block>
      <prompt bargein="false">
        This is the Hello World Main Menu. 
      </prompt>
    </block>

  </form>


Remember how we said that VoiceXML will default anything not explicitly held in tags as text to read with TTS? Well, we were fibbing somewhat. The truth is, TTS still has to be inside some kind of structure. This was briefly mentioned in the first Lesson, but not clarified. Once we are inside the <block> or the <field> then non-tagged text is read as TTS. Make sense?

But what is this whole <prompt> tag about, and why are we telling the VoiceXML server not to allow "barging in"? This tag is indeed familiar, as we have used it in previous tutorials, but so far, we haven't really explained it. Why, you ask? We like building up suspense, that's why. By default, you can always interrupt audio files or text-to-speech, but sometimes you will want your callers/listeners to hear the entire prompt. To veteran users of an application this can be annoying (because they know how navigate through the menus already), but knowing this attribute gives you greater control over how your prompts will behave.


Step 3: Creating our initial script


Let's make ourselves a simple structure with accompanying inline grammars:


<?xml version="1.0" encoding="UTF-8"?>

<vxml version = "2.1" >

<link next="#MainMenu">
  <grammar type="text/gsl">[main back begin]</grammar>
</link>


<form id="MainMenu">
    <block>
      <prompt bargein="false">
        This is the Hello World Main Menu.
      </prompt>
    </block>

    <field name="MeatOrPlant">
      <prompt>
      Are you a Carnivore or Vegetarian.
      </prompt>
      <grammar type="text/gsl">
        <![CDATA[[
              [vegetarian plant veggie] {<MeatOrPlant "plant">}
              [meat carnivore flesh animal] {<MeatOrPlant "meat">}
            ]]]>
        </grammar>
    </field>
  </form>

  <form id="Meat">
    <field name="MeatOrPlant">
      <prompt>
      PETA is coming for you, be afraid. 
      If you wish to try again, please say Main.
      </prompt>
    </field>
  </form>

  <form id="Plant">
    <field name="MeatOrPlant">
      <prompt>
      Protein is the spawn of the devil. 
      If you wish to try again, please say Main.
      </prompt>
    </field>
  </form>
</vxml>



So now we have the basic structure set up for our application. But wait, what the heck is a <link> tag? The <link> element works like a globally scoped grammar, meaning that the grammars nested within it will be active in any voice reco field in the document. By comparison, the other grammars will only be active within their enclosing voice reco fields. Using a <link> allows an easy way for us to allow for a 'top-level' grammar that contains common commands such as 'go back', 'repeat', etc. You will note that both 'BackToMain' fields below do not have any local grammars within them, right? The reason for this, (in case you haven't figured this out already), is that they will be using our <link> grammars.

You probably noticed that our grammar looks a bit different within the <field> than it does within the <link>, in that there is this funky CDATA stuff enclosing the utterances. This quasi-element is used to escape the non-parseable characters that we have in the grammar. As the <field> grammar defines explicit slots, (unlike the <link> grammars), then enclosing these characters('<', and  '{' ), is required for any and all grammars that define slot values.

Step 4: adding the event handlers



<?xml version="1.0" encoding="UTF-8"?>
<vxml version = "2.1" >


<link next="#MainMenu">
  <grammar type="text/gsl">[main back begin]</grammar>
</link>

<form id="MainMenu">
    <block>
      <prompt bargein="false">
        This is the Hello World Main Menu.
      </prompt>
    </block>

    <field name="MeatOrPlant">
    <prompt>
      Are you a Carnivore or Vegetarian.
    </prompt>

      <grammar type="text/gsl">
        <![CDATA[[
              [vegetarian plant veggie] {<MeatOrPlant "plant">}
              [meat carnivore flesh animal] {<MeatOrPlant "meat">}
            ]]]>
        </grammar>

        <noinput>
        <prompt>
            I did not hear anything. Please try again.
          </prompt>
        <reprompt/>
        </noinput>

        <nomatch>
        <prompt>
            I did not recognize that lifestyle choice.  Please try again.
        </prompt>
          <reprompt/>
        </nomatch>   
       
    </field>
<filled>
      <if cond="MeatOrPlant == 'meat'">
      <elseif cond="MeatOrPlant == 'plant'"/>
      </if>
</filled>
  </form>

  <form id="Meat">
    <field name="BackToMain">
    <prompt>
      PETA is coming for you, be afraid. 
      If you wish to try again, please say Main.
    </prompt>
    </field>
    <filled>
  <!-- no way this will get hit -->
    </filled>
  </form>

  <form id="Plant">
    <field name="BackToMain">
    <prompt>
      Protein is the spawn of the devil. 
      If you wish to try again, please say Main.
    </prompt>
    </field>
    <filled>
    <!-- no way this will get hit -->
    </filled>
  </form>
</vxml>


All that remains is the ability to direct the call flow to the proper code segment. But how do we do that? It is actually quite simple and uses a tag called <goto>. Notice that the location of the <goto> is the same name as the id attribute of your various <form> tags; this is important. Also note that within our "meat" and "plant" fields, that there isn't any navigation specified when someone says "Main". Remember, our <link> grammars take care of this, and as such, we don't need redundant code within these form-items. However, we DO need to have these defined as voice recognition <fields>, otherwise, the interpreter wouldn't be listening for any input at all. This is why we don't have "Meat" and "plant" defined as a <block>, and also explains why these form-items do not have local grammars defined :


Step 5: directing the call flow


<?xml version="1.0" encoding="UTF-8"?>
<vxml version = "2.1" >


<link next="#MainMenu">
  <grammar type="text/gsl">[main back begin]</grammar>
</link>

  <form id="MainMenu">
    <block>
      <prompt bargein="false">
        This is the Hello World Main Menu.
      </prompt>
    </block>

    <field name="MeatOrPlant">
    <prompt>
      Are you a "Carnivore" or "Vegetarian".
    </prompt>

      <grammar type="text/gsl">
        <![CDATA[[
              [vegetarian plant veggie] {<MeatOrPlant "plant">}
              [meat carnivore flesh animal] {<MeatOrPlant "meat">}
            ]]]>
        </grammar>

        <noinput>
        <prompt>
            I did not hear anything. Please try again.
          </prompt>
        <reprompt/>
        </noinput>

        <nomatch>
        <prompt>
            I did not recognize that lifestyle choice.  Please try again.
        </prompt>
          <reprompt/>
        </nomatch>   
       
    </field>
<filled>
      <if cond="MeatOrPlant == 'meat'">
      <goto next="#Meat"/>
      <elseif cond="MeatOrPlant == 'plant'"/>
      <goto next="#Plant"/>
      </if>
</filled>
  </form>

  <form id="Meat">
    <field name="BackToMain">
    <prompt>
      PETA is coming for you, be afraid. 
      If you wish to try again, please say Main.
    </prompt>
    </field>
    <filled>
    <!-- no way this will get hit -->
    </filled>
  </form>

  <form id="Plant">
    <field name="BackToMain">
    <prompt>
      Protein is the spawn of the devil. 
      If you wish to try again, please say "Main".
    </prompt>
    </field>
        <filled>
        <!-- no way this will get hit -->
        </filled>
  </form>
</vxml>


There is our complete script. The complexity and length of code continues to increase, but we have a great deal of functionality just in these few VoiceXML tags.


Step 4: upload, and try it out

All that remains now is to upload your new hello world VoiceXML application. In keeping with our naming scheme, we might save this file as http://www.myserver.com/helloworld/helloworld3.xml

Now you can use the Voxeo Account Manager to provision a number to your simple menu application, and then you may call the associated number to hear the results.

Download the Code!

  Source code


What we covered:







  ANNOTATIONS: EXISTING POSTS
anujsharma
6/29/2004 9:49 AM (EDT)
In Step 3, within the first <form> and <field> tags, it should be </prompt> over the inline grammar declaration - Line 19!
MattHenry
6/29/2004 12:20 PM (EDT)
Hi there,


Actually, the order of elements listed within the <field> does not matter at all; <prompt> can precede <grammar>, and can even precede the <filled> if you wanted to code it like this. VoiceXML does not work from the 'top-to-bottom', but rather execution is dictated by the Form Interpretation Algorithm.

Check the below w3c link for clarification on this point:

http://www.w3.org/TR/voicexml20/#dml2.1.6

~Matt
anujsharma
6/29/2004 3:52 PM (EDT)
Where is the ending tag </prompt> for the first <prompt> tag?
Is second <prompt> tag really necessary? What's its significance in this example?
MattHenry
6/29/2004 4:29 PM (EDT)
I'm sorry, but I dont undersand your question. Can you provide some specific details as to this inquiry? I don't know *which* prompt that you are speaking of.......

~Matt
anujsharma
6/30/2004 3:46 PM (EDT)
Please clarify the role of both the <prompt> tags in the following:


    <field name="MeatOrPlant">
      <prompt>
      Are you a Carnivore or Vegetarian.
      <prompt>
      <grammar type="text/gsl">
        <![CDATA[[
              [vegetarian plant veggie] {<MeatOrPlant "plant">}
              [meat carnivore flesh animal] {<MeatOrPlant "meat">}
            ]]]>
      </grammar>
    </field>
MattHenry
6/30/2004 4:37 PM (EDT)
Anuj,


That's a simple typo, which i have rectified on my end. The second instance should be a closing tag, ie:

      <prompt>
      Are you a Carnivore or Vegetarian.
      </prompt>


~ Matt
dgranville
9/21/2004 1:35 PM (EDT)
      <grammar type="text/gsl">
        <![CDATA[[
              [vegetarian plant veggie] {<MeatOrPlant "plant">}
              [meat carnivore flesh animal] {<MeatOrPlant "meat">}
            ]]]>
        </grammar>

Prior to this example in the tutorial, there hasn't been any discussion of what "CDATA" is nor what what the use of braces "{}" and angle brackets "<>" are for.  (Sorry, if it's an obvious XML feature--I'm an HTML guy).
ShaneSmith
9/21/2004 1:55 PM (EDT)
dgranville,

CDATA is used to escape XML characters that usually would cause a parse error.  It's a good idea to use this when using inline grammars, especially if they are generated from a server-side language dynamically.  You can check to make sure your documents parse by opening up the page in your web browser (Internet Explorer) and checking for parse errors.  Hope that helps.

-Shane Smith
-Voxeo Corporation
dgeiregat
10/12/2004 10:03 AM (EDT)
Hello,

2 questions which are maybe answered later in the tutorial. They have to do with the behaviour to the prompts played in <form id="Meat"> or <form id="Plant">.

1) if one remains silent, a timeout mechanism is triggered although not coded for explicitly; same is true if one says something out-of-grammar. Is there some in-built, default functionality for silence and misrecognitions?

2) saying 'back' or 'begin' is valid since belonging to the 'link' grammar. But why does the condition <if cond="BackToMain == 'main'"> evaluate to true if one says 'back' or 'begin' ? (and it works!)
I understand the code if one says 'main'.

Regards,
Dirk
MattHenry
10/12/2004 1:09 PM (EDT)
Hiya Dirk,

Allow me to clear this up for you:

1) The platform does supply default handlers for Nomatch/Noinput events if left unspecified by the developer; check the spec at:


http://www.w3.org/TR/voicexml20/#dml5.2.5


2) I can understand your confusion; the conditional statements within <form id="Meat/Plant"> are remnants of an older code version, where a form-level grammar was used in favor of a <link>. Note that these conditional statements are NOT hit upon an utterance of 'main'; the link grammars take care of this entirely. In any case, i have removed these conditionals from the docs, which should be reflected within the next day or two.

Sorry if this caused any head-scratching.

=)

~Matt
DaveMorris
2/24/2006 10:12 PM (EST)
I'm confused about when to use block, when to use prompt, and when not to use one or the other.  For instance in the Step 4 example, the nomatch and noinput responses are not surrounded by prompt tags.  In the Step 5 example they are.  I have some scripts that seem to want to hang up on me even though they are supposed to be speaking and transferring to other forms, and I suspect it has something to do with my confusion about the prompt tag and what it implies.  Does the prompt tag require a response from the caller, or does it just mean "speak this".  And if so, what happens if you just omit the prompt tag and put text in a block tag?

Thanks,
Dave
MattHenry
2/24/2006 10:55 PM (EST)


Hiya Dave,

It appears as if I am fully "busted" for sloppy coding in the tutorials.

=^D

Step 4 is in need of some correction, in terms of Best Practices:

When nesting TTS output in a form item, (such as a block, or field), any platform will usually err on the side of caution, and will render it to the caller as expected. However, it's always best to be compliant to the spec for portability reasons, as my attention to detail in this case clearly lacks, (ha-ha).

So sorry about the confusion, and thanks for pointing out this errata; I'll post a correction shortly.

Regards,

~Matthew Henry
bericson
4/28/2006 3:42 PM (EDT)
Within <form id="Meat/Plant">, I'm a bit confused by the purpose/intent of the <field name="BackToMain">. Could you explain that please?
And is the reason the two <filled> tags will not get hit because there is no grammar specified there?

Thanks.
MattHenry
4/28/2006 8:09 PM (EDT)


Hi there,

This is kind of explained in the paragraph just before step 5. In short, we need to have an active reco field within a form in order to make the global <link> grammars active. And you are correct, those <filled> statements will never be executed, as they have no grammar active within them.

~Matt
gregzh
5/9/2006 11:02 AM (EDT)
Hi
I tried this, always get failed, say "internal error in the script...", Could someone help to check this?
I copied the whole script from this tutorial actually.

<?xml version="1.0" encoding="UTF-8"?>
<vxml version = "2.1" >

  <link next="MainMenu">
    <grammar type="text/gsl"> [main back again begin]</grammar>
  </link>

  <form id="MainMenu">
    <block>
    <prompt bargein="false">
      Hello World. This is greg, the first telephone application. Date is May 7, 2006.
    </prompt>
    </block>

    <field name="MeatOrPlant">
    <prompt>
      Are you a carnivore or Vegetarian. 
    </prompt>
    <grammar type="text/gsl">
      <![CDATA[[
          [vegetarian plant veggie number] {<MeatOrPlant "plant">}
          [meat carnivore flesh animal] {<MeatOrPlant "meat">}
      ]]]>
    </grammar>
    </field>

    <filled>
      <if cond="MeatOrPlant == 'meat'">
        <goto next="#Meat"/>
      <elseif cond="MearOrPlant == 'plant'"/>
        <goto next="#Plant"/>
      </if>
    </filled>
  </form>

  <form if="Meat">
    <field name="BackToMain">
    <prompt>
      Protein is the spawn of the devil. 
      If you wish to try again, please say "Main".
    </prompt>
    </field>
  </form>


</vxml>
gregzh
5/10/2006 12:26 AM (EDT)
Hi Matt,

Here is the output in the debugger, for my problem.

There is the red color error, but don't know what is the reason.

Thanks.
Greg

=====

02525    6a86    06:48:20 AM    06:48:20.540: Fetch thread 13579: Failed fetch of URL: http://webhosting.voxeo.net/17840/www/MainMenu. com.mot.icsd.voxml.core.VoiceException: Failed fetch with code: 404 (Not Found), URL: http://webhosting.voxeo.net/17840/www/MainMenu
02526    6a86    06:48:20 AM    06:48:20.540: <perf type="fetch" value="0ms"> http://webhosting.voxeo.net/17840/www/MainMenu 0 bytes </perf>
02527    6a86    06:48:20 AM    06:48:20.556: ECMAScript pseudo-evaluating: dialog = new Object(); 
02528    6a86    06:48:20 AM    06:48:20.556: ==> [object Object] 
02529    6a86    06:48:20 AM    06:48:20.556: ECMAScript pseudo-evaluating: application = new Object(); 
02530    6a86    06:48:20 AM    06:48:20.556: ==> [object Object] 
02531    6a86    06:48:20 AM    06:48:20.556: VEC::getCallingNumber(): Calling Number is [gregzhang]
02532    6a86    06:48:20 AM    06:48:20.556: VEC::getCalledNumber(): Called Number is [9990026293]
02533    6a86    06:48:20 AM    06:48:20.556: =========================== An error occurred while executing the following dialog. Initial URL: file:///c:/nuance/callrouting/motnewcall.vxml Current URL: http://webhosting.voxeo.net/17840/www/hello1.xml [click on link for full URL] Calling Number (ANI): gregzhang Called Number (DNIS): 9990026293 Redirecting Number (RDNIS): "" State: MainMenu VoxGateway Version: Load 129 (30 June 2005) Date/Time: 2006/5/8 6:48:20.556 VoiceException: error.badfetch.http.404 Failed fetch with code: 404 (Not Found), URL: http://webhosting.voxeo.net/17840/www/MainMenu Dialog stack trace: State (Dialog) URL (Document) -------------- ------------------------------ MainMenu http://webhosting.voxeo.net/17840/www/hello1.xml?session.calledid=9990026293&session.connection.local.uri=9990026293&session.parentsessionid=6776ddbe4143e9912c3396e6b8aa6a86&session.sessionid=6776ddbe4143e9912c3396e6b8aa6a86&session.connection.remote.uri=gregzhang&session.callerid=gregzhang 
02534    6a86    06:48:20 AM    06:48:20.556: JSCEC::getDefaultLocale(): Returning lang=en-US
02535    6a86    06:48:20 AM    06:48:20.556: JSCEC::stopClip(): stopClip called
02536    6a86    06:48:20 AM    06:48:20.556: Grammar is of type [application/x-builtin]
02537    6a86    06:48:20 AM    06:48:20.556: JSCEC::getDefaultLocale(): Returning lang=en-US
02538    6a86    06:48:20 AM    06:48:20.556: JSCEC::setCurrentGrammarLocale(): Setting locale=en-US
02539    6a86    06:48:20 AM    06:48:20.556: Attempting to install as GSL
02540    6a86    06:48:20 AM    06:48:20.556: Grammar src: builtin://.VMLNull-en-US
02541    6a86    06:48:20 AM    06:48:20.556: Grammar: builtin://.VMLNull-en-US
02542    6a86    06:48:20 AM    06:48:20.556: JSCEC::setCurrentGrammarLocale(): Setting locale=null
02543    6a86    06:48:20 AM    06:48:20.556: behavior.calllog.STATE = MainMenu
02544    6a86    06:48:20 AM    06:48:20.556: behavior.calllog.GRAMMAR = builtin://.VMLNull-en-US
02545    6a86    06:48:20 AM    06:48:20.556: Setting client.InputModes=voice,dtmf
02546    6a86    06:48:20 AM    06:48:20.634: HexString [ 0x0054|0x0068|0x0061|0x0074|0x0020|0x0063|0x006F|0x006E|0x0074|0x0065|0x006E|0x0074| 0x0020|0x0069|0x0073|0x0020|0x006E|0x006F|0x0074|0x0020|0x0061|0x0076|0x0061|0x0069|0x006C| 0x0061|0x0062|0x006C|0x0065|0x0020|0x0061|0x0074|0x0020|0x0074|0x0068|0x0069|0x0073|0x0020| 0x0074|0x0069|0x006D|0x0065|0x002E|0x0020|0x0049|0x0020|0x0063|0x006F|0x0075|0x006C|0x0064| 0x006E|0x0027|0x0074|0x0020|0x0066|0x0069|0x006E|0x0064|0x0020|0x0061|0x0020|0x0077|0x0065| 0x0062|0x0020|0x0070|0x0061|0x0067|0x0065|0x002E| ]
02547    6a86    06:48:20 AM    06:48:20.634: DecString [ 84|104|97|116|32|99|111|110|116|101|110|116|32|105|115|32|110|111|116|32|97|118| 97|105|108|97|98|108|101|32|97|116|32|116|104|105|115|32|116|105|109|101|46|32|73| 32|99|111|117|108|100|110|39|116|32|102|105|110|100|32|97|32|119|101|98|32|112|97| 103|101|46| ]
02548    6a86    06:48:20 AM    06:48:20.634: TEXT:[That content is not available at this time. I couldn't find a web page.]
02549    6a86    06:48:20 AM    06:48:20.634: Listen: entering recognize with to=1
02550    6a86    06:48:20 AM    06:48:20.634: recognize: Entering method with bargein=false and timeout=1
02551    6a86    06:48:20 AM    06:48:20.634: playAndRecognize with [.VMLNull-en-US] bargein [false] timeout [1]
02552    6a86    06:48:27 AM    06:48:27.478: recognize: leaving method with result={ dtype=17 type="NO_SPEECH_TIMEOUT" results=[{ dtype=10 text="<timeout>" probability=1 confidence=100 confidenceWithoutFiller=0 wordConfidences=[] interp=[] }] textRecresult="" numFrames=0 firstPassRecognizerInfo="" secondPassRecognizerInfo="" }
02553    6a86    06:48:27 AM    06:48:27.478: Handling ASR
02554    6a86    06:48:27 AM    06:48:27.478: There were [1] possible results
02555    6a86    06:48:27 AM    06:48:27.478: Caught a VoiceException NOSPEECH
02556    6a86    06:48:27 AM    06:48:27.478: ECMAScript evaluating: __ese=__es.pop(); 
02557    6a86    06:48:27 AM    06:48:27.478: ==> [object Object] [0ms/0ms 4516 chars] 
02558    6a86    06:48:27 AM    06:48:27.478: VEC::close(): Return Variables are: errorReason=Failed+fetch+with+code%3A+404+%28Not+Found%29%2C%0A++++URL%3A+http%3A%2F%2Fwebhosting.voxeo.net%2F17840%2Fwww%2FMainMenu
02559    6a86    06:48:27 AM    06:48:27.494: __AphroditeMsg__: state: terminated
02560    6a86    06:48:27 AM    06:48:27.494: VEC::close() CALL_END: sessionID=6776ddbe4143e9912c3396e6b8aa6a86 parentSessionID=6776ddbe4143e9912c3396e6b8aa6a86 callStartTime=1147070883712 callEndTime=1147070907494 accountID=17840 appID=39655 callType=0 callerID=gregzhang calledID=9990026293 mainURL=http://webhosting.voxeo.net/17840/www/hello1.xml featureFlags=0 calllength=23782
02561    6a86    06:48:27 AM    06:48:27.494: hanging up...
02562    6a86    06:48:27 AM    06:48:27.509: hung up...
02563    6a86    06:48:27 AM    06:48:27.509: URLFetcher::close(): Close exiting...
mikethompson
5/10/2006 11:30 AM (EDT)
Hey Greg,

Looking at the logs, this is simply a failed fetch from the browser.  And to verify, I attempted pulling the following link up in my browser as well:

http://webhosting.voxeo.net/17840/www/MainMenu

This directory does not actually exist.  You'll want to map your application directly to the document URL.  When taking a look at your account I noticed the document you were trying to reach is:

http://webhosting.voxeo.net/17840/www/hello1.xml

simply replace the current URL with the suggest new URL (your xml document) and all should be well.

Regards,
Mike Thompson
Voxeo Extreme Support

bon_thanh
7/10/2006 5:59 PM (EDT)
Hello,

The following is taken from tbe paragraph directly above Step 5:
"However, we DO need to have these defined as voice recognition <fields>, otherwise, the interpreter wouldn't be listening for any input at all. This is why we don't have "Meat" and "plant" defined as a <block>,..."

I don't understand this explanation.

Bonnie
MattHenry
7/10/2006 6:45 PM (EDT)


Bonnie,

Sorry for any confusion. To be totally, clear, let's take a look at two examples:


-- EX 1: working example --

<link next="#MainMenu">
  <grammar type="text/gsl">[main back begin]</grammar>
</link>

<form id="MainMenu">
[b]<!-- our link grammar will be active here -->[/b]
    <field name="MeatOrPlant">
    <prompt>
      Are you a Carnivore or Vegetarian.
    </prompt>
    </field>
  </form>

-- EX 2: non-working example --

<link next="#MainMenu">
  <grammar type="text/gsl">[main back begin]</grammar>
</link>

<form id="MainMenu">
[b]<!-- our link grammar will NOT be active here -->[/b]
    <block>
    <prompt>
      Are you a Carnivore or Vegetarian.
    </prompt>
    </block>
  </form>




In short, if a document doesn't have a voice reco <field> present, then no <link> grammars that are defined will work, as the interpreter needs to be listening for input in the first place. In the second example, there is only form/block/prompt, which will not listen for input at all.


~Matt

ynkrish
1/31/2007 5:09 AM (EST)
Hi,

There is a small spelling mistake in the first para, solme should be changed to some :)

cheers
krish
ynkrish
1/31/2007 5:44 AM (EST)
hi,

One more small correction, the first example vxml present in step3 lacks a </vxml> tag.

cheers
krish
MattHenry
1/31/2007 2:47 PM (EST)


Good catch! I'll have this corrected shortly. Thanks again for noticing this.

~Matt
subhar
6/25/2007 9:32 AM (EDT)
Hello,

  In Step 3: Creating our initial script

  I am prompted the following

ARE you CARNIVORE or VEGETARIAN ?

i am saying Vegetarian here but its not going to

MeatorPlant =='Plant'

Can you help me
voxeojeff
6/25/2007 4:00 PM (EDT)
Hi there,

In order for us to diagnose the issue here, we're going to need to see the script you are using.  Can you provide us with your vxml code that is not working correctly?

Thank you,

Jeff Menkel
Voxeo Corporation
archie172
11/29/2007 5:00 PM (EST)
I'm confused by the behavior of the <link> tag in the script below. I would expect that when I say "info" it jumps to the "cid" block and tells me caller ID information. Instead, it says "Thank you. Now initiating nuclear attack on info" even though "info" is not one of the countries listed.

I understand that it recognizes "info" because of the global <link> tag, but I don't understand why it then fills in the field and executes the <filled> tag instead of jumping immediately out of the field and into the "cid" form tag. This seems contrary to http://www.w3.org/TR/voicexml20/#dml2.1.6.2.3

Thanks.

<?xml version="1.0" encoding="UTF-8"?>
<vxml version = "2.1">

    <link next="#cid">
        <grammar type="text/gsl">[info]</grammar>
    </link>

    <form id="norad">
        <block>
            <prompt>
                Hello, you have reached Norad, the control center for the nuclear arsenal of the United States.
            </prompt>
        </block>
        <field name="country">
            Please say the country you wish to bomb.
            <grammar type="text/gsl">
              [(north korea) iran iraq russia antartica canada mexico france [england (great britain)] norway sweden italy lebanon libya]
            </grammar>
        </field>
        <noinput>
            Don't be shy. Just say the name of the country you want us to nuke back to the stone age.
            <reprompt/>
        </noinput>
        <nomatch>
            I did not recognize that country. Please try again.
            <reprompt/>
        </nomatch>
        <filled namelist="country">
            <prompt>
                Thank you. Now initiating nuclear attack on <value expr="country"/>.
            </prompt>
            <exit/>
        </filled>
    </form>

    <form id="cid">
        <block>
            <prompt>
                caller i d is:
                <say-as interpret-as="telephone">
                    <value expr="session.callerid"/>
                </say-as>
                called i d is:
                <say-as interpret-as="telephone">
                    <value expr="session.calledid"/>
                </say-as>
            </prompt>
        </block>
        <exit/>
    </form>
</vxml>
VoxeoDustin
11/30/2007 10:11 AM (EST)
Hey Archie,

This is a bug that has been addressed and fixed in Prophecy 8 which is available as a free download at http://www.voxeo.com/prophecy/ . It will also be available on our staging platform in the near future.

-Dustin
jpw
1/13/2008 7:55 PM (EST)
Why is it in this example, if you don't say anything, it continually acts like you chose carnivore, over and over. Eg, it never hangs up, or times out.
voxeojeff
1/14/2008 11:45 AM (EST)
Hello jpw,

If the user doesn't say anything, then the <noinput> handler should be executed and then the user should be prompted again:

<noinput>
  <prompt>
    I did not hear anything. Please try again.
  </prompt>
  <reprompt/>
</noinput>

That being said, if this is not the behavior you are experiencing, then please go ahead and submit a private account ticket, with some debugger logs illustrating this issue, along with the code you're using.  Specifically,

1) Open the debugger window, (Account => Application Debugger)
2) Call the application, and reproduce the error
3) Click the 'support' tab in the debugger
4) Note any pertinent line numbers in the output that we should focus our attention on

Regards,

Jeff
danlamb
5/1/2008 3:08 AM (EDT)
Is there anyway to have variables persist.

For example,

In my first form I set:
<assign name="deviceName" expr="F_1"/>

But then in my second form, I can't do this:
<value expr="deviceName"/>

I tried using appplication.deviceName, but that did not seem to work either... is the only workaround to use the submit form functionality, or is there another way to maintain variables?
voxeojeremyr
5/1/2008 6:29 AM (EDT)
Hi danlamb,

Yes, there is a way to make variables persist.  It all has do with variable scoping.  The key to this is where you define them.  If you define or declare them in a form then they will only be available in that form.  If however you declare them above that form, say at the document level, they will be available to the entire document.

Here is an example of a document scoped variable:
<?xml version="1.0" encoding="UTF-8"?>
<vxml version = "2.1" >
  <var name="tempVar" expr="15"/>
  <form>
    <block>
    <prompt>
      Hello World. This is my first telephone application.
    </prompt>
    </block>
  </form>
</vxml>


You can find more information on variable scope here:
http://docs.voxeo.com/voicexml/2.0/

Hope this helps,
Jeremy Richmond
Voxeo Support


login
  tutorial Voice Recognition  |  TOC  |  tutorial Document Navigation   

© 2008 Voxeo Corporation  |  Voxeo IVR  |  VoiceXML & CCXML IVR Developer Site