When a voice application executes, a connection has been established between an interpreter context and a remote party. Voice application developers can make use of information about that connection to customize the caller experience and perform call tracking. This information is exposed to a VoiceXML application via the connection object and includes the following:
- A URI identifying the remote party device.
- A URI identifying the interpreter context.
- The protocol used to make the connection as well as information about the protocol.
- Application-to-application data passed to the interpreter by the remote party device, if any.
- Which end of the connection originated the call.
The connection object is available at session scope. Since session is the highest available scope the connection object can be accessed within any context in which variables can be referenced. The following example prints the name of the protocol used to make the connection. Some examples of the value printed include "q931" and "sip".
<vxml version="2.1" xmlns="http://www.w3.org/2001/vxml"> <form> <block> <log> The connection protocol is <value expr="session.connection.protocol.name"/> </log> </block> </form> </vxml>
The following table lists the properties of the connection object. Some properties of the connection object are objects that in turn expose other properties.
|protocol||Object||Defines the protocol used to make the connection.|
|remote||Object||Defines the characteristics of the remote party device.|
|local||Object||Defines the characteristics of the local interpreter context.|
|aai||String||Application-to-application (AAI) data passed to the interpreter by the remote party device. For more information on sending and receiving AAI data, see the AAI Developer's Guide.|
|redirect||Array||An array of connection redirection path objects. The first element is an object containing the original called URI; the last element is an object containing the last redirected URI.|
The following table lists the properties of a redirection path object exposed by an element of the redirect array. The redirect array is exposed by the redirect property of the connection object.
|uri||String||The URI of the intended connection path.|
|reason||String||One of the following values: "unknown", "user busy", "no reply", "deflection during alerting", "deflection immediate response", "mobile subscriber not reachable".|
The following table lists the properties of the protocol object.
|name||String||The name of the protocol used to make the connection.|
|version||String||The version of the protocol used to make the connection.|
|<protocol>||Object||An object encapsulating protocol-specific information. The name of this property matches the value of the name property.|
In the following code snippet, the variable proto_name stores the name of the protocol. The variable proto_ref stores a reference to the protocol-specific object, if any.
var proto_name = connection.protocol.name; var proto_ref = connection.protocol[proto_name];
Currently, the remote object includes a single property, uri, that exposes the URI of the remote party device.
var remote_uri = connection.remote.uri;
Currently, the local object includes a single property, uri, that exposes the URI of the local interpreter context.
var local_uri = connection.local.uri;