VoiceXML and SIP Incoming Header Access

The specification for VoiceXML defines some protocol-independent connection-related variables that can be used to return related connection data. Blueworx Voice Response for Linux Version 7 supports such session variables for the SIP protocol. The settings for the protocol independent connection variables defined by VoiceXML are listed in Table 1:

Table 1. VoiceXML protocol independent connection variables
Connection Variable Possible Value
session.connection.aai The setting of the value associated with the aai or uui keyword in the incoming REQ_HDR (see below for a full explanation)
session.connection.protocol.name "sip"
session.connection.protocol.version 2.0

The settings for the generic protocol specific variables defined by VoiceXML are listed in Table 2:

Table 2. VoiceXML generic protocol specific variables
Variable Value
session.connection.protocol.sip.protocol.value "sip"
session.connection.protocol.sip.protocol.variant RFC3261
session.connection.protocol.sip.protocol.num 24

All SIP headers made available by Blueworx Voice Response are also available as independent VoiceXML variables (in lower case), if the header is present in the call. Headers are returned as a key where the key is the header name. To read a header value use key.value, to read an attribute use key.attribute_name. All key and attribute_names are in lower case. The header and attribute values returned have their case preserved.

In SIP, the TO_HDR contains header data. The corresponding VoiceXML variables are:

session.connection.protocol.sip.to_hdr
session.connection.protocol.sip.to_hdr.value

To check if this variable is currently available, you can use the approach in the following SIP example:

<if cond="session.connection.protocol.sip.to_hdr != undefined">
   <log>;session.connection.protocol.sip.to_hdr.value:
      <value expr="session.connection.protocol.sip.to_hdr.value"/>
   </log>
</if>

Using the SIP REQ_HDR header information in VoiceXML is more complicated because any key value pairs after the first terminator (";" or "&") on the REQ_HDR are returned as variables. For example, the following REQ_HDR:

<'REQ_HDR'='sip:1234@siphost.blueworx.com;uui=uui1;aai=aai1;
            voicexml=Weather.vxml;maxage=3600;maxstale=0'>

resolves to the following independent VoiceXML session.* variables shown in the following VoiceXML example:

<log>session.connection.protocol.sip.req_hdr.value:
     <value expr="session.connection.protocol.sip.req_hdr.value"/></log>
<log>session.connection.protocol.sip.req_hdr.aai:
     <value expr="session.connection.protocol.sip.req_hdr.aai"/></log>
<log>session.connection.protocol.sip.req_hdr.uui:
     <value expr="session.connection.protocol.sip.req_hdr.uui"/></log>
<log>session.connection.protocol.sip.req_hdr.voicexml:
     <value expr="session.connection.protocol.sip.req_hdr.voicexml"/></log>
<log>session.connection.protocol.sip.req_hdr.maxage:
     <value expr="session.connection.protocol.sip.req_hdr.maxage"/></log>
<log>session.connection.protocol.sip.req_hdr.maxstale:
     <value expr="session.connection.protocol.sip.req_hdr.maxstale"/></log>

The last key of aai in the REQ_HDR header is also mapped into the session.connection.aai session variable. If no aai keys are present, the last uui key is mapped. If no aai or uui keys are present, the session.connection.aai session variable is empty.

Note: The Blueworx Voice Response SIP stack:

Using SIP CALLID_HDR and CALLINFO_HDR

For an incoming call, the SIP CALLID_HDR and CALLINFO_HDR can be used in a similar way.

To access CALLID_HDR and CALLINFO_HDR in VoiceXML, use the connection variables shown in the following table:

Table 3. Accessing SIP CALLID_HDR and CALLINFO_HDR headers
Variable Content
session.connection.protocol.sip.callid_hdr.value Call-ID
session.connection.protocol.sip.callinfo_hdr.value Full Call-Info
session.connection.protocol.sip.callinfo_hdr.count The number of Call-Info headers present
session.connection.protocol.sip.callinfo_hdr.infoN.uri The URI for Call-InfoN
session.connection.protocol.sip.callinfo_hdr.infoN.purpose The purpose for Call-InfoN (if present in the header)
session.connection.protocol.sip.callinfo_hdr.infoN.infoparam The infoparam for Call-InfoN (if present in the header), where infoparam is the name of an information parameter present in the information, for example, icon or card.
In this example, the source Call-Info header contains the following:
<http://www.code.com/my-picture.jpg>;purpose=icon
<http://www.example.com/alice/>;purpose=info
<http://www.google.com>;purpose=info;username=access;single
session.connection.protocol.sip.callinfo_hdr.value:
	<http://www.code.com/my-picture.jpg>;purpose=icon,
	<http://www.example.com/alice/>;purpose=info,
	<http://www.google.com>;purpose=info;username=access;single=
session.connection.protocol.sip.callinfo_hdr.count: 3
session.connection.protocol.sip.callinfo_hdr.info1.uri: http://www.code.com/my-picture.jpg
session.connection.protocol.sip.callinfo_hdr.info1.purpose: icon
session.connection.protocol.sip.callinfo_hdr.info2.uri: http://www.example.com/alice/
session.connection.protocol.sip.callinfo_hdr.info2.purpose: info
session.connection.protocol.sip.callinfo_hdr.info3.uri: http://www.google.com
session.connection.protocol.sip.callinfo_hdr.info3.purpose: info
session.connection.protocol.sip.callinfo_hdr.info3.username: access
session.connection.protocol.sip.callinfo_hdr.info3.single:

Accessing other SIP headers

For an incoming call, other, non-standard SIP headers can be achieved in a similar way.

To access other SIP header information in VoiceXML, use the connection variables as in the following generic example:

<if cond="session.connection.protocol.sip.header name != undefined">
   <log>session.connection.protocol.sip.header name.value:
      <value expr="session.connection.protocol.sip.header name.value"/>
   </log>
<else/>
   <log>session.connection.protocol.sip.header name.value: undefined</log>
</if>

Examples

A SIP header with the name supported:

<if cond="session.connection.protocol.sip.supported != undefined">
   <log>session.connection.protocol.sip.supported.value:
      <value expr="session.connection.protocol.sip.supported.value"/>
   </log>
<else/>
   <log>session.connection.protocol.sip.supported.value: undefined</log>
</if>

A SIP header with a name that includes a special character, such as ‘-’, user-to-user:

<if cond="session.connection.protocol.sip['user-to-user'] != undefined">
   <log>session.connection.protocol.sip['user-to-user'].value:
      <value expr="session.connection.protocol.sip['user-to-user'].value"/>
   </log>
<else/>
   <log>session.connection.protocol.sip['user-to-user'].value: undefined</log>
</if>

A SIP header with the name allow:

<if cond="session.connection.protocol.sip.allow != undefined">
   <log>session.connection.protocol.sip.allow.value:
      <value expr="session.connection.protocol.sip.allow.value"/></log>
<else/>
   <log>session.connection.protocol.sip.allow.value: undefined</log>
</if>