A VoiceXML Version 2.0 application is normally invoked on a connection that is in the CONNECTED state. If the underlying telephony connection allows it, a VoiceXML application can be invoked in the ALERTING state.
In dialog environments where dialogs can take a significant length of time to initialize, particularly when documents are stored on a remote server accessed over a network, you can preload a VoiceXML Version 2.0 application by using a <dialogprepare> element
Whether it is being started immediately or prepared for use, to invoke a VoiceXML 2.0 application, you need to set the type attribute to "'application/xml+vxml'"
<transition event="connection.alerting" name="evt"> <dialogprepare src="'http://www.example.com/welcome.vxml'" type="'application/xml+vxml'" connectionid="evt.connectionid"/> </transition>
When using <dialogprepare>, a connectionid can be provided, but this can be overridden if desired in the subsequent <dialogstart> element. The preloaded dialog can be referenced by the subsequent <dialogstart> element by using the prepareddialogid attribute.
<transition event="connection.connected" name="evt">
<dialogstart src="'welcome.vxml'" type="'application/xml+vxml'" connectionid="evt.connectionid"/>
</transition>
Optionally, your CCXML application can specify data to be passed to the VoiceXML application in one of two ways:
In the following example, a .jsp file is being used to return VoiceXML dynamically. The namelist attribute is used to send parameters to a web server. The document on the web server than has access to these parameters. For example a .jsp file which then modifies then rendered VoiceXML according to the passed parameters.
<transition event="connection.connected" name="evt">
<dialogstart src="'http://www.example.com/welcome.vxml'" type="'application/xml+vxml'"
namelist="Field1 Field2" connectionid="evt.connectionid" />
</transition>
where Field1 and Field2 are the names of previously declared and initialized CCXML variables.
http://www.example.com/welcome.vxml?Field1=Val1&Field2=Val2
http://[2002:914:fc12:195:0000:8a2e:0370:7334]/welcome.vxmlThis applies to all protocols.
The parameters attribute contains a list of one or more whitespace separated CCXML variable names. These variables are sent to the dialog environment as a list of name/value pairs. Names are sent exactly as they are specified and values are formed by converting the referenced ECMAScript variable to string form (which is undefined for objects). The dialog environment determines how passed parameters will be handled
In the following example, a static VoiceXML document welcome.vxml is being launched. The values specified in the parameters attribute of the <dialogprepare> and <dialogstart> elements are created as local session variables within the scope of the document. The names and values specified in the parameters attribute are stored in the session.connection.ccxml.values array and also in the session.ibm.values array. The latter is reserved for ‘platform-specific’ use.
<transition event="connection.connected" name="evt">
<dialogstart src="'http://www.example.com/welcome.vxml'" type="'application/xml+vxml'"
parameters="para1 para2" connectionid="evt.connectionid" />
</transition>
where para1 and para2 are the names of previously declared and initialized CCXML variables.
<?xml version="1.0" encoding="iso-8859-1"?> <vxml version="2.0" xmlns="http://www.w3.org/2001/vxml" xml:lang="en-US"> <form id="LogCalls"> <block> <!-- Obtaining a unique Call ID and the destination department from CCXML --> <var name="callid" expr="session.connection.ccxml.values.para1"/> <var name="dept" expr="session.connection.ccxml.values.para2"/> <log>Unique Call ID is: <value expr="callid" /> Destination department is: <value expr="dept" /> </log> <!-- Submit unique Call ID and the destination department to servlet --> <submit namelist="callid dept" next="http://SupportLine.com/servlet/MonitorCall"/> </block> </form> </vxml>
http://[2002:914:fc12:195:0000:8a2e:0370:7334]/welcome.vxmlThis applies to all protocols.