HP-UX C SIP Stack Programmer's Guide (Novembery 2007)
160 HP-UX C SIP Stack Programmer’s Guide
Stand-alone Headers
Sample Code
The following code demonstrates how to insert CSeq and Via headers into a
message:
/*===========================================================*/
RvStatus SetStandAloneInMsg(RvSipMsgHandle hMsg,
RvSipCSeqHeaderHandle hCSeq,
RvSipViaHeaderHandle hVia)
{
RvSipHeaderListElemHandle listElem;
/*Sets CSeq header in the message.*/
RvSipMsgSetCSeqHeader(hMsg, hCSeq);
/*Pushes the Via header in the message.*/
RvSipMsgPushHeader(hMsg, RVSIP_LAST_HEADER,
(void*)hVia,
RVSIP_HEADERTYPE_VIA,
&listElem,
(void**)&hVia);
return RV_OK;
}
/*===========================================================*/
REMOVING HEADERS
FROM A MESSAGE
You can remove headers from a message as follows:
You can remove headers to which you have direct access, such
as To, From and CSeq, by calling the appropriate Set function
with NULL. For example:
RvSipMsgSetFromHeader(hMsg,NULL)
You can remove headers kept in the header list, such as Via and
Allow, by calling the list remove function. For example:
RvSipMsgRemoveHeaderAt(hMsg,hListElem)