HP-UX C SIP Stack Programmer's Guide (Novembery 2007)

158 HP-UX C SIP Stack Programmers Guide
Stand-alone Headers
/*===================================================================================*/
RvStatus createHeadersInMessage
(HRPOOL hPool, RvSipMsgHandle hMsg)
{
RvStatus status;
RvSipAddressHandle uri;
RvSipPartyHeaderHandle fromHeader;
RvSipContactHeaderHandle contactHeader;
/*Creates a From header in the message and creates and set a URL object in it.*/
status = RvSipFromHeaderConstructInMsg(hMsg, &fromHeader);
if(status!= RV_OK)
return status;
status = RvSipAddrConstructInPartyHeader(fromHeader, RVSIP_ADDRTYPE_URL, &uri);
if(status!= RV_OK)
return status;
/*Sets the URL parameters by parsing the encoded URL or by setting parameters using
the Set functions*/
RvSipAddrParse(uri, "sip:john@acme.com");
/*Creates a Contact header at the head of the message header list and sets the
header parameters.*/
status = RvSipContactHeaderConstructInMsg(hMsg, RV_TRUE, &contactHeader);
if(status!= RV_OK)
return status;
/*Sets the Contact header parameters.*/
RvSipContactHeaderSetDisplayName(contactHeader, "ContactName");
/*Sets other parameters...*/
return RV_OK;
}
/*===================================================================================*/
STAND-ALONE
H
EADERS
A stand-alone header is a header object that is constructed independently of any
particular message. You can set a stand-alone header in a message.