Linking an Application Server to an IVR Node using SOAP

SOAP (Simple Object Access Protocol) is an XML message-based protocol specification used to allow applications running on a decentralized, distributed environment to exchange information. It relies on Extensible Markup Language (XML) as its message format, and usually relies on other application layer protocols, such as RPT and HTTP, for message negotiation and transmission.

Sample SOAP Message

Following is a sample data interchange using the HTTP/SOAP protocol. (The indentation shown is for illustration purposes only.)


POST /ivr.xml HTTP/1.1
SOAPAction: IvrInput
Content-Type: application/xml
Content-Length: 123
      <From>Fred Feuerstein <></From>
      <To>Tom Test <></To>

In the vodia namespace, the record CDR indicates that a CDR shall be transmitted. The CDR may have the following attributes:

  • CallID: This attribute contains the call-ID of the call and makes it possible to put the IVR input into a session context. It is also used as an identifier in the response to the request.
  • Output: The digits that the user has entered into the IVR node.
  • The To and From fields indicate the To and From headers of the call.


The response on the file tells what should be done with the input. An example return could look like the following:

HTTP/1.1 200 Ok
Content-Type: application/xml
Content-Length: 123
      <Destination>123</Destination >
    </sns:IVROutput >

The response has the following attributes:

  • CallID: This attribute contains the caller-ID of the call. It is used to identify the affected call.
  • Destination: This string indicates which account to switch to.

Example PHP File

This example shows how to process the CDR on an Apache web server using the PHP extension. This example just extracts the data and writes it into a plain file.


function start_element($parser, $name, $attrs) 
   global $elem;

function end_element($parser, $name) 

function xml_data($parser, $data) 
   global $elem,

   if($elem=="CALLID") $callid .= $data;
   else if($elem=="TYPE") $type .= $data;
   else if($elem=="DOMAIN") $domain .= $data;
   else if($elem=="LANGUAGE") $language .= $data;
   else if($elem=="FROM") $from .= $data;
   else if($elem=="TO") $to .= $data;
   else if($elem=="FROMUSER") $fromUser .= $data;	
   else if($elem=="TOUSER") $toUser .= $data;
   else if($elem=="CHARGEACCOUNT") $chargeAccount .= $data;
   else if($elem=="CHARGENUMBER") $chargeNumber .= $data;	
   else if($elem=="TIMESTART") $timeStart .= $data;
   else if($elem=="TIMECONNECTED") $timeConnected .= $data;
   else if($elem=="TIMEEND") $timeEnd .= $data;	

$content = file_get_contents("php://input");

$xml_parser = xml_parser_create();
xml_set_element_handler($xml_parser, "start_element", "end_element"); 
xml_set_character_data_handler($xml_parser, "xml_data");

if(!xml_parse($xml_parser, $content, true)) 
   die(sprintf("Get XML error parsing %s: %s at line %d",

$fd = fopen("C:/Temp/cdr.txt", "a");
if( $fd )
   fwrite( $fd, "callid = $callid, \r\n 
                 type = $type, \r\n 
                 language = $language, \r\n 
                 domain = $domain, \r\n  
                 from = $from, \r\n  
                 to = $to, \r\n  
                 fromUser = $fromUser, \r\n  
                 toUser = $toUser, \r\n  
                 chargeAccount = $chargeAccount, \r\n  
                 chargeNumber = $chargeNumber, \r\n  
                 timeStart = $timeStart, \r\n  
                 timeConnected = $timeConnected, \r\n  
                 timeEnd = $timeEnd, \r\n  ";		 	

   fclose( $fd );
   echo "ok";