ZVON > References > VoiceXML Reference
Element:value
Attributes: | class | expr | mode | recsrc |
Parents: | audio | block | catch | choice | div | emp | enumerate | error | field | filled | help | if | initial | menu | noinput | nomatch | object | prompt | pros | record | subdialog | transfer |
Description:

Go to Standard

Examples:


<prompt> Your recorded greeting is
     <value expr="greeting"/> To rerecord, press 1. To keep it, press pound. To return to the main menu press star M. To exit press star, star X.
</prompt>


<prompt> You are calling
     <value expr="home_num"/>
</prompt>


<prompt> You are calling
     <value expr="home_num" class="phone"/>
</prompt>
<prompt>You are calling
     <sayas class="phone">312-555-1212</sayas>
</prompt>


<vxml version="1.0">
     <meta name="author" content="John Doe"/>
     <meta name="maintainer" content="hello-support@hi.example"/>
     <var name="hi" expr="'Hello World!'"/>
     <form>
          <block>
               <value expr="hi"/>Goodbye!
          </block>
     </form>
</vxml>


<field name="lo_fat_meal" type="boolean">
     <prompt> Do you want a low fat meal on this flight? </prompt>
     <help> Low fat means less than 10 grams of fat, and under 250 calories. </help>
     <filled>
          <prompt> I heard
               <emp>
                    <value expr="lo_fat_meal"/>
               </emp>.
          </prompt>
     </filled>
</field>


<menu dtmf="true">
     <prompt> Welcome home.
          <enumerate> For
               <value expr="_prompt"/>, press
               <value expr="_dtmf"/>.
          </enumerate>
     </prompt>
     <choice next="http://www.sports.example/vxml/start.vxml"> sports </choice>
     <choice next="http://www.weather.example/intro.vxml"> weather </choice>
     <choice next="http://www.stargazer.example/voice/astronews.vxml"> Stargazer astrophysics news </choice>
</menu>


<vxml version="1.0" application="app-root.vxml">
     <form id="say_goodbye">
          <field name="answer" type="boolean">
               <prompt>Shall we say
                    <value expr="application.bye"/>?
               </prompt>
               <filled>
                    <if cond="answer">
                         <exit/>
                    </if>
                    <clear namelist="answer"/>
               </filled>
          </field>
     </form>
</vxml>


<vxml version="1.0">
     <script> function factorial(n) { return (n <= 1)? 1 : n * factorial(n-1); } </script>
     <form id="form">
          <field name="fact" type="number">
               <prompt> Tell me a number and I'll tell you its factorial. </prompt>
               <filled>
                    <prompt>
                         <value expr="fact"/> factorial is
                         <value expr="factorial(fact)"/>
                    </prompt>
               </filled>
          </field>
     </form>
</vxml>


<vxml version="1.0">
     <meta name="author" content="John Doe"/>
     <meta name="maintainer" content="hello-support@hi.example"/>
     <var name="hi" expr="'Hello World!'"/>
     <form>
          <block>
               <value expr="hi"/>
               <goto next="#say_goodbye"/>
          </block>
     </form>
     <form id="say_goodbye">
          <block> Goodbye! </block>
     </form>
</vxml>


<block>
     <prompt> The card type is
          <value expr="debit.card"/>.
     </prompt>
     <prompt> The card number is
          <value expr="debit.card_no"/>.
     </prompt>
     <prompt> The expiration date is
          <value expr="debit.expiry_date"/>.
     </prompt>
     <prompt> The approval code is
          <value expr="debit.approval_code"/>.
     </prompt>
     <prompt>The confirmation number is
          <value expr="debit.conf_no"/>.
     </prompt>
</block>


<block>
     <prompt> The card type is
          <value expr="debit.card"/>.
     </prompt>
     <prompt> The card number is
          <value expr="debit.card_no"/>.
     </prompt>
     <prompt> The expiration date is
          <value expr="debit.expiry_date"/>.
     </prompt>
     <prompt> The approval code is
          <value expr="debit.approval_code"/>.
     </prompt>
     <prompt>The confirmation number is
          <value expr="debit.conf_no"/>.
     </prompt>
</block>


<block>
     <prompt> The card type is
          <value expr="debit.card"/>.
     </prompt>
     <prompt> The card number is
          <value expr="debit.card_no"/>.
     </prompt>
     <prompt> The expiration date is
          <value expr="debit.expiry_date"/>.
     </prompt>
     <prompt> The approval code is
          <value expr="debit.approval_code"/>.
     </prompt>
     <prompt>The confirmation number is
          <value expr="debit.conf_no"/>.
     </prompt>
</block>


<block>
     <prompt> The card type is
          <value expr="debit.card"/>.
     </prompt>
     <prompt> The card number is
          <value expr="debit.card_no"/>.
     </prompt>
     <prompt> The expiration date is
          <value expr="debit.expiry_date"/>.
     </prompt>
     <prompt> The approval code is
          <value expr="debit.approval_code"/>.
     </prompt>
     <prompt>The confirmation number is
          <value expr="debit.conf_no"/>.
     </prompt>
</block>


<block>
     <prompt> The card type is
          <value expr="debit.card"/>.
     </prompt>
     <prompt> The card number is
          <value expr="debit.card_no"/>.
     </prompt>
     <prompt> The expiration date is
          <value expr="debit.expiry_date"/>.
     </prompt>
     <prompt> The approval code is
          <value expr="debit.approval_code"/>.
     </prompt>
     <prompt>The confirmation number is
          <value expr="debit.conf_no"/>.
     </prompt>
</block>


<vxml version="1.0">
     <form>
          <record name="greeting" beep="true" maxtime="10s" finalsilence="4000ms" dtmfterm="true" type="audio/wav">
               <prompt> At the tone, please say your greeting. </prompt>
               <noinput> I didn't hear anything, please try again. </noinput>
          </record>
          <field name="confirm" type="boolean">
               <prompt> Your greeting is
                    <value expr="greeting"/>.
               </prompt>
               <prompt> To keep it, say yes. To discard it, say no. </prompt>
               <filled>
                    <if cond="confirm">
                         <submit next="save_greeting.pl" method="post" namelist="greeting"/>
                    </if>
                    <clear/>
               </filled>
          </field>
     </form>
</vxml>


<vxml version="1.0">
     <form>
          <transcribe name="message" beep="true" maxtime="30s">
               <prompt> What is the message you want to leave? </prompt>
               <nomatch count="2"> Try to make your message simpler. </nomatch>
               <nomatch count="3"> Transferring to operator.
                    <goto next="queue_caller.pl"/>
               </nomatch>
          </transcribe>
          <field name="confirm" type="boolean">
               <prompt> Your message is
                    <value expr="message"/>.
               </prompt>
               <prompt> To send it, say yes. To discard it, say no. </prompt>
               <filled>
                    <if cond="confirm">
                         <submit next="send_page.pl" namelist="message"/>
                    </if>
                    <clear/>
               </filled>
          </field>
     </form>
</vxml>


<vxml version="1.0">
     <form>
          <var name="hours"/>
          <var name="minutes"/>
          <var name="seconds"/>
          <block>
               <script> var d = new Date(); hours = d.getHours(); minutes = d.getMinutes(); seconds = d.getSeconds(); </script>
          </block>
          <field name="hear_another" type="boolean">
               <prompt> The time is
                    <value expr="hours"/> hours,
                    <value expr="minutes"/> minutes, and
                    <value expr="seconds"/> seconds.
               </prompt>
               <prompt>Do you want to hear another time?</prompt>
               <filled>
                    <if cond="hear_another">
                         <clear/>
                    </if>
               </filled>
          </field>
     </form>
</vxml>


<vxml version="1.0">
     <property name="caching" value="safe"/>
     <property name="audiofetchhint" value="safe"/>
     <property name="confidence" value="0.75"/>
     <form>
          <property name="confidence" value="0.5"/>
          <property name="bargein" value="false"/>
          <grammar src="address_book.gram" type="application/x-jsgf"/>
          <block>
               <prompt> Welcome to the Voice Address Book </prompt>
          </block>
          <initial name="start">
               <property name="timeout" value="5s"/>
               <prompt> Who would you like to call? </prompt>
          </initial>
          <field name="person">
               <prompt> Say the name of the person you would like to call. </prompt>
          </field>
          <field name="location">
               <prompt> Say the location of the person you would like to call. </prompt>
          </field>
          <field name="confirm" type="boolean">
               <prompt> You said to call
                    <value expr="person$.utterance"/> at
                    <value expr="location$.utterance"/>. Is this correct?
               </prompt>
               <filled>
                    <if cond="confirm">
                         <submit next="http://www.messagecentral.example/voice/make_call" namelist="person location"/>
                    </if>
                    <clear/>
               </filled>
          </field>
     </form>
</vxml>


<form id="weather_info">
     <grammar src="cityandstate.gram" type="application/x-jsgf"/>
     <block>
          <prompt bargein="false"> Welcome to the weather information service.
               <audio src="http://www.online-ads.example/wis.wav"/>
          </prompt>
     </block>
     <initial name="start">
          <prompt> For what city and state would you like the weather? </prompt>
          <help> Please say the name of the city and state for which you you would like a weather report.</help>
          <noinput count="1">
               <reprompt/>
          </noinput>
          <noinput count="2">
               <reprompt/>
               <assign name="start" expr="true"/>
          </noinput>
     </initial>
     <field name="state">
          <prompt>What state?</prompt>
          <help>Please speak the state for which you want the weather.</help>
     </field>
     <field name="city">
          <prompt>Please say the city in
               <value expr="state"/> for which you want the weather.
          </prompt>
          <help>Please speak the city for which you want the weather.</help>
          <filled>
               <if cond="city == 'Los Angeles' && state == undefined">
                    <assign name="state" expr="'California'"/>
               </if>
          </filled>
     </field>
     <field name="go_ahead" type="boolean" modal="true">
          <prompt>Do you want to hear the weather for
               <value expr="city"/>,
               <value expr="state"/>?
          </prompt>
          <filled>
               <if cond="go_ahead">
                    <prompt bargein="false">
                         <audio src="http://www.online-ads.example/wis2.wav"/>
                    </prompt>
                    <submit next="/servlet/weather" namelist="city state"/>
               </if>
               <clear namelist="start city state go_ahead"/>
          </filled>
     </field>
</form>


<form id="weather_info">
     <grammar src="cityandstate.gram" type="application/x-jsgf"/>
     <block>
          <prompt bargein="false"> Welcome to the weather information service.
               <audio src="http://www.online-ads.example/wis.wav"/>
          </prompt>
     </block>
     <initial name="start">
          <prompt> For what city and state would you like the weather? </prompt>
          <help> Please say the name of the city and state for which you you would like a weather report.</help>
          <noinput count="1">
               <reprompt/>
          </noinput>
          <noinput count="2">
               <reprompt/>
               <assign name="start" expr="true"/>
          </noinput>
     </initial>
     <field name="state">
          <prompt>What state?</prompt>
          <help>Please speak the state for which you want the weather.</help>
     </field>
     <field name="city">
          <prompt>Please say the city in
               <value expr="state"/> for which you want the weather.
          </prompt>
          <help>Please speak the city for which you want the weather.</help>
          <filled>
               <if cond="city == 'Los Angeles' && state == undefined">
                    <assign name="state" expr="'California'"/>
               </if>
          </filled>
     </field>
     <field name="go_ahead" type="boolean" modal="true">
          <prompt>Do you want to hear the weather for
               <value expr="city"/>,
               <value expr="state"/>?
          </prompt>
          <filled>
               <if cond="go_ahead">
                    <prompt bargein="false">
                         <audio src="http://www.online-ads.example/wis2.wav"/>
                    </prompt>
                    <submit next="/servlet/weather" namelist="city state"/>
               </if>
               <clear namelist="start city state go_ahead"/>
          </filled>
     </field>
</form>