ZVON > References > VoiceXML Reference |
Intro / Search / ZVON |
Element: | assign |
Attributes: | | expr | name | |
Parents: | | block | catch | error | filled | help | if | noinput | nomatch | |
Description: | Go to Standard |
<assign name="document.ssn" expr="dialog.ssn"/> |
<assign name="flavor" expr="'chocolate'"/> <assign name="document.mycost" expr="document.mycost+14"/> |
<form id="gather_pager_message"> <object name="message" classid="builtin://keypad_text_input"> <prompt> Enter your message by pressing your keypad once per letter. For a space, enter star. To end the message, press the pound sign. </prompt> </object> <block> <assign name="document.pager_message" expr="message.text"/> <goto next="#confirm_pager_message"/> </block> </form> |
<field name="ticket_num" type="digits"> <prompt> Read the 12 digit number from your ticket. </prompt> <help>The 12 digit number is to the lower left.</help> <filled> <if mcond="ticket_num.length != 12"> <prompt> Sorry, I didn't hear exactly 12 digits. </prompt> <assign name="ticket_num" expr="undefined"/> </if> </filled> </field> |
<if cond="city == 'LA'"> <assign name="city" expr="'Los Angeles'"/> <elseif cond="city == 'Philly'"/> <assign name="city" expr="'Philadelphia'"/> <elseif cond="city =='Constantinople'"/> <assign name="city" expr="'Istanbul'"/> </if> <assign name="var1" expr="var1 + 1"/> <if cond="i > 1"> <assign name="i" expr="i-1"/> </if> |
<if cond="city == 'LA'"> <assign name="city" expr="'Los Angeles'"/> <elseif cond="city == 'Philly'"/> <assign name="city" expr="'Philadelphia'"/> <elseif cond="city =='Constantinople'"/> <assign name="city" expr="'Istanbul'"/> </if> <assign name="var1" expr="var1 + 1"/> <if cond="i > 1"> <assign name="i" expr="i-1"/> </if> |
<if cond="city == 'LA'"> <assign name="city" expr="'Los Angeles'"/> <elseif cond="city == 'Philly'"/> <assign name="city" expr="'Philadelphia'"/> <elseif cond="city =='Constantinople'"/> <assign name="city" expr="'Istanbul'"/> </if> <assign name="var1" expr="var1 + 1"/> <if cond="i > 1"> <assign name="i" expr="i-1"/> </if> |
<vxml version="1.0"> <form id="billing_adjustment"> <var name="account_number"/> <var name="home_phone"/> <subdialog name="accountinfo" src="acct_info.vxml#basic"> <filled> <assign name="account_number" expr="accountinfo.acctnum"/> <assign name="home_phone" expr="accountinfo.acctphone"/> </filled> </subdialog> <field name="adjustment_amount" type="currency"> <prompt> What is the value of your account adjustment? </prompt> <filled> <submit next="/cgi-bin/updateaccount"/> </filled> </field> </form> </vxml> |
<form id="get_from_and_to_cities"> <grammar src="http://www.directions.example/grammars/from_to.gram"/> <block> Welcome to the Driving Directions By Phone. </block> <initial name="bypass_init"> <prompt> Where do you want to drive from and to? </prompt> <nomatch count="1"> Please say something like "from Atlanta Georgia to Toledo Ohio". </nomatch> <nomatch count="2"> I’m sorry, I still don’t understand. I’ll ask you for information one piece at a time. <assign name="bypass_init" expr="true"/> <reprompt/> </nomatch> </initial> <field name="from_city"> <grammar src="http://www.directions.example/grammars/city.gram"/> <prompt>From which city are you leaving?</prompt> … etc. … </field> … etc. … </form> |
<form name="transfer"> <var name="mydur" expr="0"/> <block> <audio src="chopin12.wav"/> </block> <transfer name="mycall" dest="phone://18005551234" connecttimeout="30s" bridge="true"> <filled> <assign name="mydur" expr="mycall$.duration"/> <if cond="mycall == 'busy'"> <prompt> Sorry, our customer support team is busy serving other customers. Please try again later. </prompt> <elseif cond="mycall == 'noanswer'"/> <prompt> Sorry, our customer support team's normal hours are 9 am to 7 pm Monday through Saturday. </prompt> </if> </filled> </transfer> <block> <submit namelist="mycall mydur" next="/cgi-bin/report"/> </block> </form> |
<form id="getssn"> <var name="firstname"/> <var name="lastname"/> <field name="ssn"> <grammar src="http://grammarlib/ssn.gram" type="application/x-jsgf"/> <prompt> Please say social security number. </prompt> <filled> <if cond="validssn(firstname,lastname,ssn)"> <assign name="status" expr="true"/> <return namelist="status ssn"/> <else/> <assign name="status" expr="false"/> <return namelist="status"/> </if> </filled> </field> </form> |
<if cond="total > 1000"> <prompt>This is way too much to spend.</prompt> <throw event="com.xyzcorp.acct.toomuchspent"/> </if> <if cond="amount < 29.95"> <assign name="x" expr="amount"/> <else/> <assign name="x" expr="29.95"/> </if> <if cond="flavor == 'vanilla'"> <assign name="flavor_code" expr="'v'"/> <elseif cond="flavor == 'chocolate'"/> <assign name="flavor_code" expr="'h'"/> <elseif cond="flavor == 'strawberry'"/> <assign name="flavor_code" expr="'b'"/> <else/> <assign name="flavor_code" expr="'?'"/> </if> |
<if cond="total > 1000"> <prompt>This is way too much to spend.</prompt> <throw event="com.xyzcorp.acct.toomuchspent"/> </if> <if cond="amount < 29.95"> <assign name="x" expr="amount"/> <else/> <assign name="x" expr="29.95"/> </if> <if cond="flavor == 'vanilla'"> <assign name="flavor_code" expr="'v'"/> <elseif cond="flavor == 'chocolate'"/> <assign name="flavor_code" expr="'h'"/> <elseif cond="flavor == 'strawberry'"/> <assign name="flavor_code" expr="'b'"/> <else/> <assign name="flavor_code" expr="'?'"/> </if> |
<vxml version="1.0"> <form id="getcredit"> <var name="status" expr="'no_result'"/> <var name="username"/> <field name="creditcardnum"> <prompt> What is your credit card number? </prompt> <help> I am trying to collect your credit card information. <reprompt/> </help> <nomatch> <return namelist="status"/> </nomatch> <grammar/> </field> <field name="expirydate" type="date"> <prompt> What is the expiry date of this card? </prompt> <help> I am trying to collect the expiry date of the credit card number you provided. <reprompt/> </help> <nomatch> <return namelist="status"/> </nomatch> </field> <block> <assign name="status" expr="'result'"/> <return namelist="status creditcardnum expirydate"/> </block> </form> </vxml> |
<vxml version="1.0"> <var name="username"/> <form id="buysoftware"> <var name="ccn"/> <var name="exp"/> <grammar/> <initial name="start"> <prompt> Please tell us the software product you wish to buy and the operating system on which it must run. </prompt> <noinput> <assign name="start" expr="true"/> </noinput> </initial> <field name="product"> <prompt> Which software product would you like to buy? </prompt> </field> <field mname="operatingsystem"> <prompt> Which operating system does this software need to run on? </prompt> </field> <subdialog name="cc_results" src="http://somedomain.example/ccn.vxml"> <filled> <if cond="cc_results.status=='no_result'"> Sorry, your credit card information could not be Obtained. This order is cancelled. <exit/> <else/> <assign name="ccn" expr="cc_results.creditcardnum"/> <asssign name="exp" expr="cc_results.expirydate"/> </if> </filled> </subdialog> <block> We will now process your order. Please hold. <submit namelist="username product operatingsystem ccn exp"/> </block> </form> </vxml> |
<vxml version="1.0"> <var name="username"/> <form id="buysoftware"> <var name="ccn"/> <var name="exp"/> <grammar/> <initial name="start"> <prompt> Please tell us the software product you wish to buy and the operating system on which it must run. </prompt> <noinput> <assign name="start" expr="true"/> </noinput> </initial> <field name="product"> <prompt> Which software product would you like to buy? </prompt> </field> <field mname="operatingsystem"> <prompt> Which operating system does this software need to run on? </prompt> </field> <subdialog name="cc_results" src="http://somedomain.example/ccn.vxml"> <filled> <if cond="cc_results.status=='no_result'"> Sorry, your credit card information could not be Obtained. This order is cancelled. <exit/> <else/> <assign name="ccn" expr="cc_results.creditcardnum"/> <asssign name="exp" expr="cc_results.expirydate"/> </if> </filled> </subdialog> <block> We will now process your order. Please hold. <submit namelist="username product operatingsystem ccn exp"/> </block> </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> |