int getCallId(struct sip_msg* msg, OSPTCALLID** callid) { struct hdr_field *cid; int retVal = 1; cid = (struct hdr_field*) msg->callid; if (cid != NULL) { *callid = OSPPCallIdNew(cid->body.len,cid->body.s); if (*callid) { retVal = 0; } else { LOG(L_ERR, "ERROR: osp: getCallId: failed to allocate call-id object for '%.*s'\n",cid->body.len,cid->body.s); } } else { LOG(L_ERR, "ERROR: osp: getCallId: could not find Call-Id-Header\n"); } return retVal; }
/* * Get Call-ID header from SIP message * param msg SIP message * param callid Call ID * return 0 success, -1 failure */ int ospGetCallId( struct sip_msg* msg, OSPTCALLID** callid) { struct hdr_field* hf; int result = -1; hf = (struct hdr_field*)msg->callid; if (hf != NULL) { *callid = OSPPCallIdNew(hf->body.len, (unsigned char*)hf->body.s); if (*callid) { result = 0; } else { LM_ERR("failed to allocate OSPCALLID object for '%.*s'\n", hf->body.len, hf->body.s); } } else { LM_ERR("failed to find Call-ID header\n"); } return result; }