SDK 6.7.3 is the latest Brooktrout development kit providing feature rich capabilities to our partners.  As usual, we’ve added some new features that will be quite useful, and I will discuss a few of them here to give more details on what they do and why they can help you.  The last new feature to be discussed is the ability for an application to access SIP headers.

We have gotten requests to have access to various pieces of an incoming SIP INVITE message.  Previous to SDK 6.7.3, we provided some of that information, like the From and To fields of the INVITE, but we'd get requests for other things like the IP address of the sending gateway or the SIP Call ID.  Those items were simply not available at the API layer so the application did not have access to them, at least not without doing something creative, like parsing the ECC log themselves. 

So now in SDK 6.7.3, rather than just adding more parts of the INVITE header piecemeal, we're providing the entire set of headers to the application.  The application can now provide a buffer when a call comes in and all the headers from the INVITE will be put into it so the application can pick and choose which one it cares about.  The headers will be put into a linked list that the application can scroll through and choose whichever it cares about.

It's a good idea to make sure the buffer is large enough.  If the supplied buffer is too small to fit all the headers, whatever headers that will fit will be put into the buffer and the application will be given an error message to indicate that not all headers are included.

Here's a bit of sample code that can help get you started:

BT_ZERO(args_tel);
args_tel.sip_header_list = (BT_SIP_HEADER_LIST *)malloc(1000);
memset(args_tel.sip_header_list, 0, 1000);
args_tel.sip_header_list_len = 1000;
BfvLineWaitForCall (lp, &args_tel);

if (args_tel.sip_header_list_len == SIP_HEADER_INVALID_LEN)
   printf ("\nBuffer too small.  Not all headers received.\n");
else
   printf ("\nAll headers received.\n");

num_headers = args_tel.sip_header_list->num_sip_headers;
printf("number of headers received = %d\n", num_headers);
      
for (header_count = 0; header_count < num_headers; header_count++)
{
   printf ("header name = %s, header value = %s\n",
   args_tel.sip_header_list->sip_headers.header.header_name,
   args_tel.sip_header_list->sip_headers.header.header_value);

   if (header_count < num_headers - 1) // Don't move the linked list beyond the number of headers
           args_tel.sip_header_list->sip_headers = *args_tel.sip_header_list->sip_headers.next_header;
}