Dialogic 05-2239-009 User Manual

Page of 604
4.14.5
Receiving OPTIONS Requests
When the Dialogic
®
 Global Call API library is started with the 
IP_VIRTBOARD.E_SIP_OPTIONS_Access field set to ENUM_Enabled (to allow application 
access to OPTIONS requests), the library will act in one of two ways when the SIP stack receives a 
SIP OPTIONS request:
If there is no channel available to handle an incoming connection request (for example, all 
channels in use or gc_WaitCall( ) not having been called), Global Call automatically sends a 
“busy” response. The application can set the specific code that is sent by means of the 
IPSET_SIP_RESPONSE_CODE/ IPPARM_BUSY_REASON parameter, but the default busy 
response is 486 Busy Here. The behavior of sending a busy response allows a remote UA to 
use an OPTIONS request to determine whether it can initiate a new call on the target system. 
If there is a channel available to handle incoming calls, the library generates an Extension 
event (GCEV_EXTENSION) of type IPEXTID_RECEIVEMSG to notify the application of 
the incoming OPTIONS request. The GC_PARM_BLK associated with the Extension event 
will contain a parameter element with the IPSET_MSG_SIP set ID, the IPPARM_MSGTYPE 
parameter ID, and the value IP_MSGTYPE_SIP_OPTIONS.
The application can use the techniques described in 
 to retrieve header fields of interest, including: 
To header field
Request URI 
From header field 
Contact URI 
Accept header field 
Accept-encoding header field 
Accept-language header field 
Supported header field 
Allow header field 
Require header field 
Call-ID header field 
The application can also extract MIME information from the message body using the techniques 
described in 
, on page 191. Note that the MIME part 
that contains SDP information is not exposed to the application. 
The application must retrieve the necessary SIP message header and body information by copying 
the data into its own buffer before the next call to gc_GetMetaEvent( ). Once the next 
gc_GetMetaEvent( ) call is issued, the message information is no longer available from the 
metaevent buffer. 
The following pseudo-code illustrates how to extract an OPTIONS request from a received 
GCEV_EXTENSION event,