Dialogic Dialogic Global Call IP IP Phone User Manual


 
A code example that illustrates the general procedure for retrieving information from all incoming
messages associated with the SUBSCRIBE and NOTIFY methods is included in Section 4.15.2,
“Receiving Responses to SUBSCRIBE Requests”, on page 225.
4.15.4 Responding to SUBSCRIBE Requests
Once an application has received a GCEV_EXTENSION event for a SIP SUBSCRIBE request and
extracted the information from the event, it must send a response message.
The response is sent as an Extension message, passing a parameter block that contains the
following element:
IPSET_MSG_SIP
IPPARM_MSGTYPE
and one of the following two parameter values:
IP_MSGTYPE_SIP_SUBSCRIBE_ACCEPT
IP_MSGTYPE_SIP_SUBSCRIBE_REJECT
The “Accept” message is a 200 OK, while the “Reject” message is a 501 response. In either case,
the response message must include the Call-ID header field value that was received in the
SUBSCRIBE request so that the subscriber can match the response to the request.
The following two code snippets illustrate how an application would send “Accept” and “Reject”
responses to SUBSCRIBE requests.
“Accept” response to SUBSCRIBE request
When accepting a SUBSCRIBE request, a SIP entity normally includes an Expires header field,
which may contain the same value that was received in the Expires header field of the
SUBSCRIBE request or any smaller value.
void CSubNotMgr::SendSIPSubscribeAccept (char* pExpire)
{
char str[MAX_STRING_SIZE];
sprintf(str, "<--- Sending SIP SUBSCRIBE Accept\n");
printandlog(ALL_DEVICES, MISC, NULL, str, 0);
GC_PARM_BLKP parmblkp = NULL; // input parameter block pointer
GC_PARM_BLKP retblkp = NULL; // return parameter block
GC_INFO gc_error_info; // GlobalCall error information data
int retval = GC_SUCCESS;
gc_util_insert_parm_val(&parmblkp,
IPSET_MSG_SIP,
IPPARM_MSGTYPE,
sizeof(int),
IP_MSGTYPE_SIP_SUBSCRIBE_ACCEPT);
// Insert SIP Expire field
gc_util_insert_parm_ref_ex(&parmblkp,
IPSET_SIP_MSGINFO,
IPPARM_EXPIRES_HDR,
(unsigned long)(strlen(pExpire)),
pExpire);