VoiceXML 2.1 Development GuideHome  |  Frameset Home


<assign>  element

The assign element is used to explicitly assign a value to an existing variable, which has been declared, by using the <var> element. See the documentation on ‘variables’ for detailed information on scooping, assignment, and session variables.


usage
<assign expr="CDATA" name="NMTOKEN">


attributes
exprData Type: CDATADefault: Required
The expr defines the new value of the variable in question. Any valid ECMAscript value is considered to be a suitable value.
nameData Type: NMTOKENDefault: Required
The name attribute specifies any currently available variable name within the current scope.



shadow variables
none


parents
<block> <catch> <error> <filled> <help> <if> <noinput> <nomatch>


children
none


code samples
<Assign name-expr> sample
<?xml version="1.0" encoding="UTF-8"?>

<vxml version = "2.1">

<meta name="author" content="Matthew Henry"/>
<meta name="copyright" content="2005 voxeo corporation"/>

<meta name="maintainer" content="YOUR_EMAIL@HERE.COM"/>

<var name="Var1" expr="'sasquatch'"/>

<form id="F_1">
  <block>
    <prompt>here we use the assign elements attributes of
            name and expression.</prompt>
    <prompt>our initial value for the variable is
            <value expr="Var1"/></prompt>
  </block>

  <block>
    <assign name="Var1" expr="'chupacabra'"/>
    <prompt>but after using the assign tag, the value of our
            variable is now <value expr="Var1"/></prompt>
  </block>
</form>

</vxml>



additional links
W3C 2.0 Specification


  ANNOTATIONS: EXISTING POSTS
vinayagan
8/29/2006 9:12 AM (EDT)
Hi,

  I would like to write the vxml certification.I don't know whether is it possible in india.

  If anybody have ideas about the certification centre please inform.

Thanks
nayagan
MattHenry
8/29/2006 11:31 AM (EDT)

Nayagan,

I might suggest that you check the vxml forum, and the prometric site for information regarding VXML developer certification in your region:

http://vxmlforum.com/certification/developer.html
http://www.prometric.com/default.htm

Regards,

~Matthew Henry

vinayagan
8/30/2006 8:45 AM (EDT)
Hi Henry,

  Thanks for you information.

    I entered into http://www.prometric.com/default.htm site.They one option to select testing program in that i couldn't find vxml certification.

  Only xml certification and others are available.

  If possible please tell me what are all the necessary things to complete vxml certification.

Thanks
Nayagan
MattHenry
8/30/2006 12:09 PM (EDT)

Nayagan,

While we have VXML certified developers working in a support capacity, and while our platforms are certified compliant, we don't really have anything to do with the testing process itself.

I would advise that you contact the admins of the vxml forum for test information specific to your region to gather the information that you require.

Regards,

~Matthew henry
vinayagan
8/31/2006 9:34 AM (EDT)
Hi Henry,

  Any specific books are available to prepare for vxml certification.

Thanks
Nayagan
MattHenry
8/31/2006 12:36 PM (EDT)
Nayagan,

The best reference for certification is going to be the w3c specification, and CCXML specification. However, if you prefer to purchase a book, the following link has a few suggestions:

http://www.voicexmlguide.com/appendixl.htm

Overall, this book is really the best one I have seen, even though it is a few years old:

http://www.amazon.com/exec/obidos/tg/detail/-/0471418935/qid=1034112100/sr=8-1/ref=sr_8_1/102-7415965-6947357?v=glance&n=507846


~Matt
mikethompson
8/31/2006 12:44 PM (EDT)
Nayagan,

When I studied for the VoiceXML Certification Test, I primarily used the w3c VoiceXML specification.  If you're not sure where that is located, you can find it here:

VoiceXML 2.0:
http://www.w3.org/TR/2004/REC-voicexml20-20040316/

VoiceXML 2.1:
http://www.w3.org/TR/voicexml21/

Of course, I was also extremely familiar with this documentation.

Hope this helps,
Mike Thompson
Voxeo Corporation
vinayagan
9/4/2006 5:23 AM (EDT)
Hi,

  I Would like to write free mock voiceXML certification exams first.Is couldn't find any specific sites ..

Please let me know If there is any.

Thanks
Nayagan
vinayagan
9/4/2006 5:24 AM (EDT)
Hi,

  I Would like to write free mock voiceXML certification exams first.I couldn't find any specific sites ..

Please let me know If there is any.

Thanks
Nayagan
MattHenry
9/4/2006 12:18 PM (EDT)


Hello Nayagan,

I might suggest that you take a look at http://www.larson-tech.com/; they have a small amount of publicly available sample tests, (you can purchase the CD, which has a lot more information for getting ready for the test itself).

Regards,

~Matthew Henry
vinayagan
9/8/2006 7:57 AM (EDT)
Hi,

  I am having working experience in vxml and in ECMA Script.. and some syntax knowledge in srgml..

Is that enough to write the vxml certification...What else shall i improve...

Thanks
Nayagan

mikethompson
9/8/2006 2:28 PM (EDT)
Hi Nayagan,

To be quite honest, I spent most of my time reviewing the VoiceXML W3C Specification:
http://www.w3.org/TR/2004/REC-voicexml20-20040316/

If you know the spec like the back of your hand, you will be fine. :)

Best,
Mike Thompson
Voxeo Corporation
optim8
10/1/2006 11:34 AM (EDT)
Hi

I would like to assign a string value containing quotes to a variable.  Part of the string is dynamically determined by another variable value.  How do I go about doing this. (i.e. how do I represent quotes to appear in the final value, within the quotes of the assign tag)

e.g. I would like to assign the following value to a var called 'sql':

"insert into tbl1(Id, Desc) VALUES(13, 'description1 Content')"

the term 'description content' must appear with the quotes (as it is a SQL statement to intert a string value), and the term is held in a variable called descrpt.

I assume it is something like:
<assign name="sql" expr="'insert into tbl1(Id, Desc) VALUES(13, ''' + descrpt + ''')'" />

Thanks.
-c-
MattHenry
10/1/2006 1:47 PM (EDT)


Hi there,

This question borders on an inquiry specific to the dynamic markup that you are using to generate content, which is somewhat outside the scope of the support that we do offer. To be frank, I'm not seeing what good it is going to be to assign a SQL command to a variable in the VXML context: As VXML is a static markup, the only interactions with a DB that can be done are on the side of your JSP/PHP/whatever. For what it's worth, your syntax in assigning this value *looks* correct, although you may want to enclose the value inside of a CDATA block to ensure that no parsing errors occur.

Regards,

~Matthew Henry
vinayagan
12/11/2006 4:36 AM (EST)
Hi,

  Any one can help me in this....

  I would like to know the VXML CERTIFICATION Qustion pattern..

  Whether most of the questions from vxml or it can have ccxml,ssml,srgms,ecma script as well.

  Thanks
  Nayagan
MattHenry
12/11/2006 10:53 AM (EST)

Nayagan,

I should make clear that we don't really have too much to do with the VXML certification testing: Really, questions in this sort of vein should be directed at the VXML Forum, (www.vxmlforum.com), for definitive answers to these sort of questions. While I can't help you out with the specific questions on the certification, I can say that you can expect the majority of the questions, (maybe 80%), to be on VXML. The rest, you can certainly expect to see questions on CCXML, SRGS/SISR grammars, SSML, and ECMAScript.

Good luck,

~Matthew henry
vinayagan
12/26/2006 10:52 AM (EST)
Hi,
  For the following grammar, the utterance "I want to fly to Boston" will return the result "BOS".
<grammar version="1.0" xmlns="http://www.w3.org/2001/06/grammar"
        xml:lang="en-US" tag-format="semantics/1.0-literals" root="flight">
  <rule id="flight" scope="public">
    I want to fly to
    <ruleref uri="#airports"/>
  </rule>
  <rule id="airports" scope="private">
    <one-of>
      <ruleref uri="#USairport "/>
      <ruleref uri="#otherairport"/>
    </one-of>
  </rule>
  <rule id="USairport" scope="private">
    <one-of>
      <item>Boston<tag>BOS</tag></item>
      <item>New York<tag>JFK</tag></item>
      <item>Chicago<tag>ORD</tag></item>
    </one-of>
  </rule>
  <rule id="otherairport" scope="private">
    <one-of>
      <item>Brussels<tag>BRU</tag></item>
      <item>Paris<tag>CDG</tag></item>
      <item>Rome<tag>FCO</tag></item>
    </one-of>
  </rule>
</grammar>
Can anyone help me in understanding the above pgm..
Where i want to fly will store and how the interpretation is happening here.
<rule id = "name">only text</rule>--is that valid rule?

Thanks
Nayagan
sidvoxeo
12/26/2006 1:15 PM (EST)
Hi there,

We would really appreciate if you open support tickets when you have issues with VXML scripts.
I have opened a support ticket with your question (Account Ticket #203443), so that we may be able to track this issue.

Thanks

Sid
ashutosh_gautam
6/18/2007 2:05 AM (EDT)
Hello nayagan,

could u please give me the information about VXML test center in bangalore or anywhere in india.
i have also checked up with these links

http://vxmlforum.com/certification/developer.html
http://www.prometric.com/default.htm

but couldnt found test center in india .

thanks
ashutosh
georgelai
8/22/2007 5:36 AM (EDT)
This is a simple question. I defined a variable, and then assigned it.  I passed this variable to another vxml file, but it defaulted to the defined variable expression.

Is there a way to pass a variable from one vxml file to another?

Here's my code:

### Initial Code #####
<?xml version="1.0" encoding="UTF-8"?>
<vxml version = "2.1">
<meta name="maintainer" content="YOUREMAILADDRESS@HERE.com"/>

<var name="Var1" expr="'sasquatch'"/>

<form id="mainmenu">
  <block>
      <prompt bargein="false">
      Start with <value expr="Var1"/>. <!-- sasquatch -->
      </prompt>
  </block>

  <field name="F_1">
  <grammar src="VoiceGrammar3.php#MYNAME" type="text/gsl"/>

  <prompt bargein="false" timeout="20s">
Give me a name.
  </prompt>
  </field>

  <filled namelist="F_1">
<prompt>
I heard <value expr="F_1"/>.
</prompt>
  </filled>

  <block>
    <assign name="Var1" expr="F_1"/>
    <prompt>Is the following correct? <value expr="Var1"/></prompt>
  </block>
 
 
  <field name="F_2" type="boolean">
<prompt>
      Yes or No?
  </prompt>
  </field>
 
  <filled>
<if cond="F_2 == true">
<!-- USER SAID YES -->
<prompt>
Glad to help.  Goodbye!
</prompt>
<else/>
<!-- USER SAID NO -->
<clear namelist="F_1 F_2"/>
<goto next="callflowB2.xml" /> <!-- this is where Var1 isn't passed -->
</if>
  </filled>
</form>
</vxml>



#### callflowB2.xml ########
<?xml version="1.0" encoding="UTF-8"?>
<vxml version = "2.1" application="callflowB1.xml">
<meta name="maintainer" content="YOUREMAILADDRESS@HERE.com"/>
  <form>
    <block>
      You said <value expr="application.Var1"/>
<!-- repeats 'sasquatch' -->
    </block>
  </form>
</vxml>
MattHenry
8/22/2007 12:54 PM (EDT)


George,

I thionk that what you really want to do here is this:

[color=blue]
<block>
    [b]<assign name="application.Var1" expr="F_1"/>[/b]
    <prompt>Is the following correct? <value expr="application.Var1"/></prompt>
  </block>
[/color]

Let me know if this doesn't work out for you.

~Matt
jefo12
6/17/2008 9:42 AM (EDT)
i need to check whether caller id is present or not...

<var name="callerid"/>
<assign name="callerid" expr ="session.callerid"/>
<submit next="mypage.jsp"method="post" namelist="callerid"/>
if caller id is present i hav to check when he had an appointment and play it...

plz giv me vxmlcode and also related examples...

VoxeoDustin
6/17/2008 10:17 AM (EDT)
Hey Jefo,

Here is a basic example to check that the caller ID is present(a 10 digit number) and not unknown or restricted.

<?xml version="1.0"?>
<vxml version="2.0" xmlns="http://www.w3.org/2001/vxml">
<var name="callerid" expr="session.callerid"/>

<form id="welcome">
  <block>
      <if cond="callerid.length == 10 &amp;&amp; callerid != 'restricted'">
          <log expr="'***** CALLER ID: ' + callerid"/>
      <else/>
          <log expr="'***** CALLER ID NOT PRESENT'"/>
      </if>
  </block>
</form>
</vxml>

Cheers,
Dustin
jefo12
6/18/2008 11:28 AM (EDT)
I need to check if callerid is first valid. IF it is anonymous or unknown, the caller should be prompted to enter his caller id.if the callerid is present check what is the date of his appointment and announce it also ask him whether cancel or reschedule the appointment...
To cancel or to reschedule use subdialog call a jsp and parses the o/p.

FOR CALLERS WHO ARE CALLING FOR THE FIRST TIME SHOULD GO TO NEW APPOINTMENT FORM ID.

PLZ GIVE ME THE VXML CODE FOR THIS.I NEED IT VERY URGENT...
PLZ CAN ANY ONE HELP ME OUT ......
SUGGEST ME ANY RELATED SITES.....






VoxeoDustin
6/18/2008 11:32 AM (EDT)
Hey Jefo,

Here's a basic example that should get you started.

<?xml version="1.0"?>
<vxml version="2.0" xmlns="http://www.w3.org/2001/vxml">
<var name="callerid" expr="session.callerid"/>

<form id="welcome">
  <block>
      <if cond="callerid.length == 10 &amp;&amp; callerid != 'restricted'">
          <log expr="'***** CALLER ID: ' + callerid"/>
          <submit next="mydoc.jsp" namelist="callerid"/>
      <else/>
          <log expr="'***** CALLER ID NOT PRESENT'"/>
          <goto nextitem="enterPhone"/>
      </if>
  </block>

  <field name="enterPhone" type="digits?length=10">
      <prompt> Please enter your phone number </prompt>
      <filled>
          <submit next="mydoc.jsp" namelist="enterPhone"/>
      </filled>
  </field>

</form>
</vxml>

Cheers,
Dustin
jefo12
8/6/2008 5:49 AM (EDT)
hi,

Is there any way to store the array of elements in a variable in voice xml.


<var name="Myarray" expr="new Array()"/>
<assign name="Myarrray" expr="sunday"/>
<assign name="myarrray" expr="monday"/>

i want to store sunday,monday.. in Myarray.Is it possible!if possible give me the reply.

voxeojohnq
8/6/2008 5:55 AM (EDT)
Hi jefo,

In order to manipulate elements within an array, you will have to use the <script> element.  Within the script tags, you can pretty much do anything you can normally do with JavaScript.  I hope this helps!

Regards,

John Quinn
Voxeo Support
sathez
8/22/2008 3:42 AM (EDT)
Hi,
    i am planing to take vxml certification,kindly suggest me what are the things i had to do, wethere any E-books are avaliable for certification








Thanks
sathez
voxeojohnq
8/22/2008 3:52 AM (EDT)
Hello,

There are many resources online that you could use to study up for the certification test.  Other than the documentation and tutorials that we have available, a quick search on google returned http://www.vxmlguide.com/ which seems like it has a study guide and a book available to help you prepare for the test.  If you have any further questions, please don't hesitate to ask.

Regards,

John Quinn
Voxeo Support
mtatum111
9/11/2008 10:03 AM (EDT)
It looks like name is also missing as an attribute of <assign>
Thanks
VoxeoDustin
9/11/2008 10:17 AM (EDT)
Hey,

Thanks for pointing that out. I have corrected the documentation and an updated build should push over soon to the website.

Thanks,
Dustin
dhawansalil
9/17/2008 6:11 AM (EDT)
Hello

I am looking to send my audio data to VXML Server in G.711uLaw format but i have GSM compressed file as input.How can i do GSM--->ULaw conversion so that VXML server understands it?

Also can anyone can really tell me exact significance of EMMA in interpreting user input.
How can i take the application.$lastresult structure and creates an EMMA document out of it.
voxeojeremyr
9/17/2008 2:32 PM (EDT)
Hi,

Are you looking to change the format of a audio recording?  If so any sound editing software out there should work such as Goldwave or Audacity.  Here are the formats we support:
    *  8bit, 8Khz, u-law Wave files (Riff Format)
    * 16bit, 8Khz, PCM Wave files (Riff Format)
    * 8bit, 8Khz, u-law Sphere files
    * 16bit, 8Khz, PCM Sphere files

If this is not the case if you could give us a bit more information we could try to figure something out. 

As far as EMMA documentation, I am not familiar with it but maybe somebody else out there could help you out.

Thanks,
Jeremy Richmond
Voxeo Support

login



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