SIP headers can be set and sent on the following outbound SIP messages.
For an outbound call using <createcall>
For a transfer using <send>
For a <disconnect>
The headers are sent by creating an object with a value property containing the data to be in the header. This object is then assigned to the hints object of the CCXML tag that initiates the SIP message (createcall, send when sending bvr.transfer or disconnect for a BYE) using the name of the header as the key.
Note that you will need to use the hintsObjectName['header-name-here'] format and not the hintsObjectName.header-name-here format for assigning headers with dashes in the name because ECMAscript will interpret them as minus operations instead of a continuation of the name. For example:
<ccxml version="1.0"> <script>function makeOutboundHeader(value){ var ret = new Object(); ret.value = value; return ret; } </script> <eventprocessor> ... <transition event="ccxml.loaded" name="evt"> <log expr="'[' + testID + ' ccxml.loaded] document loaded on fetch with sessionid ' + session.id"/> <log expr="'[' + testID + ' Expected Result]: ' + expectResult "/> <log expr="'[' + testID + ' Expected Result]: ' + expectResult1 "/> <var name="outbound" expr="new Object()"/> <var name="outbound['x-user-to-user']" expr="makeOutboundHeader('Example header value')"/> <var name="outbound['x-checksum']" expr="makeOutboundHeader('1234567890')"/> <log expr="'[' + testID + ' ccxml.loaded] Outbound header x-user-to-user set as ' + outbound['x-user-to-user'].value"/> <log expr="'[' + testID + ' ccxml.loaded] Outbound header x-checksum set as ' + outbound['x-checksum'].value"/> <var name="target" expr="'sip:1234@siphost.blueworx.com'"/> <createcall dest="target" connectionid="myConnectionID" hints="outbound"/> </transition> ..... <transition event="dialog.transfer"> <var name="target" expr="event$.URI"/> <var name="outbound" expr="new Object()"/> <var name="outbound['x-user-to-user']" expr="makeOutboundHeader('Example header value')"/> <var name="outbound['x-checksum']" expr="makeOutboundHeader('1234567890')"/> <log expr="'Outbound header x-user-to-user set as ' + outbound['x-user-to-user'].value"/> <send target="event$.connectionid" targettype="'connection'" name="'ibmwvr.transfer'" namelist="target" hints="outbound"/> </transition> ... </eventprocessor> </ccxml>