HP-UX C SIP Stack Programmer's Guide (Novembery 2007)
Working with the Transport Layer 309
Server Connection Reuse
RvSipHeaderListElemHandle hListElem = NULL;
RvStatus rv = RV_OK;
RvSipTransport eTransport;
if(RvSipMsgGetMsgType(hMsgToSend) == RVSIP_MSG_REQUEST)
{
/* Get the top Via header. */
hVia = RvSipMsgGetHeaderByType(hMsgToSend, RVSIP_HEADERTYPE_VIA,
RVSIP_FIRST_HEADER, &hListElem);
/* Get the transport parameter from the top Via header. */
eTransport = RvSipViaHeaderGetTransport(hVia);
if(eTransport == RVSIP_TRANSPORT_UDP)
{
/* No need to set an alias for request over UDP... */
return RV_OK;
}
/* Sets the “;alias” parameter in the Via header. */
rv = RvSipViaHeaderSetAliasParam(hVia, RV_TRUE);
if(RV_OK != rv)
{
printf("Failed to set the ;alias parameter in top Via ");
return rv;
}
/* Set the alias string in the sent-by part of the Via header. */
rv = RvSipViaHeaderSetHost(hVia, "alias.xxx");
if(RV_OK != rv)
{
printf("Failed to set the alias string in top Via header");
return rv;
}
/* Remove the port from the Via header */
rv = RvSipViaHeaderSetPortNum(hVia, UNDEFINED);
if(RV_OK != rv)
{
return rv;
}
}
return RV_OK;
}
/*==================================================================================*/