ZVON > References > VoiceXML Reference |
Intro / Search / ZVON |
Element: | var |
Attributes: | | expr | name | |
Parents: | | block | catch | error | filled | form | help | if | noinput | nomatch | vxml | |
Description: | Go to Standard |
<var name="phone" expr="6305551212"/> <var name="y" expr="document.z+1"/> |
<var name="home_phone"/> <var name="pi" expr="3.14159"/> <var name="city" expr="'Sacramento'"/> |
<vxml version="1.0"> <var name="bye" expr="'Ciao'"/> <link next="operator_xfer.vxml"> <grammar> operator </grammar> </link> </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"/>Goodbye! </block> </form> </vxml> |
<form id="test"> <var name="one" expr="1"/> <field name="two" expr="one+1" type="number"/> <var name="three" expr="two+1"/> <field name="go_on" type="boolean"> <prompt>Say yes or no to continue</prompt> </field> <filled> <goto next="#tally"/> </filled> </form> |
<form id="another_joke"> <var name="r" expr="Math.random()"/> <field name="another" type="boolean"> <prompt cond="r < .50"> Would you like to hear another elephant joke? </prompt> <prompt cond="r >= .50"> For another joke say yes. To exit say no. </prompt> <filled> <if cond="another"> <goto next="#pick_joke"/> </if> </filled> </field> </form> |
<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> |
<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> |
<vxml version="1.0"> <form id="getdriverlicense"> <var name="birthday" expr="'1980-02-10'"/> <field name="drivelicense"> <grammar src="http://grammarlib/drivegrammar.gram" type="application/x-jsgf"/> <prompt> Please say your driver’s license number. </prompt> <filled> <if cond="validdrivelicense(drivelicense,birthday)"> <var name="status" expr="true"/> <else/> <var name="status" expr="false"/> </if> <return namelist="drivelicense status"/> </filled> </field> </form> </vxml> |
<vxml version="1.0"> <form id="getdriverlicense"> <var name="birthday" expr="'1980-02-10'"/> <field name="drivelicense"> <grammar src="http://grammarlib/drivegrammar.gram" type="application/x-jsgf"/> <prompt> Please say your driver’s license number. </prompt> <filled> <if cond="validdrivelicense(drivelicense,birthday)"> <var name="status" expr="true"/> <else/> <var name="status" expr="false"/> </if> <return namelist="drivelicense status"/> </filled> </field> </form> </vxml> |
<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> |
<form> <subdialog name="result" src="#getdriverslicense"> <param name="birthday" expr="'2000-02-10'"/> <filled> <submit next="http://myservice.example/cgi-bin/process"/> </filled> </subdialog> </form> <form id="getdriverslicense"> <var name="birthday"/> <field name="drivelicense"> <grammar src="http://grammarlib/drivegrammar.gram" type="application/x-jsgf"/> <prompt> Please say your driver's license. </prompt> <filled> <if cond="validdrivelicense(drivelicense,birthday)"> <var name="status" expr="true"/> <else/> <var name="status" expr="false"/> </if> <return namelist="drivelicense status"/> </filled> </field> </form> |
<form> <subdialog name="result" src="#getdriverslicense"> <param name="birthday" expr="'2000-02-10'"/> <filled> <submit next="http://myservice.example/cgi-bin/process"/> </filled> </subdialog> </form> <form id="getdriverslicense"> <var name="birthday"/> <field name="drivelicense"> <grammar src="http://grammarlib/drivegrammar.gram" type="application/x-jsgf"/> <prompt> Please say your driver's license. </prompt> <filled> <if cond="validdrivelicense(drivelicense,birthday)"> <var name="status" expr="true"/> <else/> <var name="status" expr="false"/> </if> <return namelist="drivelicense status"/> </filled> </field> </form> |
<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"> <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> |