VoiceXML declaring variables

You can declare variables using the <var> element or the name attribute of various form items. Table 1 lists the possible variable scopes:

Table 1. Variable scope
Scope Description Implementation details
anonymous Used by the <block>, <filled>, and <catch> elements for variables declared in those elements. Supported as documented in VoiceXML 2.1.
application Variables are visible to the application root document and any other loaded application documents that use that root document. Supported as documented in VoiceXML 2.1.
The following application variables have been added to hold the audio recorded during speech recognition:
  • application.lastresult$.asraudio
  • application.lastresult$[i].asraudio
dialog Variables are visible only within the current <form> or <menu> element. Supported as documented in VoiceXML 2.1.
document Variables are visible from any dialog within the current document. Supported as documented in VoiceXML 2.1.
session Variables that are declared and set by the interpreter context. The following session variables are fully supported:
  • session.connection.aai (contains application to application information passed during connection setup)
  • session.connection.local.uri (For inbound calls to BVR, this will contain the SIP URI from the TO header of the SIP INVITE message. For outbound calls from BVR, this will contain the SIP URI from the FROM header of the SIP INVITE message. )
  • session.connection.originator (directly references either the local or remote property)
  • session.connection.remote.uri (For inbound calls to BVR, this will contain the SIP URI from the FROM header of the SIP INVITE message. For outbound calls from BVR, this will contain the SIP URI from the TO header of the SIP INVITE message. )
  • session.blueworx.connection.ani (provides the user part of the SIP URI present in the incoming SIP INVITE message FROM header)
  • session.blueworx.connection.dnis (provides the user part of the SIP URI present in the incoming SIP INVITE message TO header)
  • session.blueworx.callID (provides the unique callID that Blueworx uses in tracing and logging)
The following session variables are not fully supported but can be referenced without causing an error:
  • session.connection.protocol.name (always contains the value "BVR_Generic_Protocol", not the name of the actual underlying telephony protocol)
  • session.connection.protocol.version (contains the installed version of BVR_Generic_Protocol, not the version of the actual underlying telephony protocol)
  • session.connection.redirect (always contains the ECMAScript value "undefined")

II Digit (Information Indicator Digit) and User to User Information functionality are not available.

To ensure that your application is portable, you should check if session variables are defined before attempting to use them:

<if cond="session.x==undefined">
    <exit>
<else>
     ok to access the session variable
<endif>

To see how to encrypt the memory used for variables in VoiceXML, see VoiceXML internal variable encryption