HP-UX C SIP Stack Programmer's Guide (Novembery 2007)
64 HP-UX C SIP Stack Programmer’s Guide
Making a TCP Call
Sample Code
The following sample code demonstrates a TCP call.
/*===================================================================================*/
void AppConnectTCPCall(IN RvSipCallLegMgrHandle hCallLegMgr)
{
/*Handles to the call-leg and the contact addresses.*/
RvSipCallLegHandle hCallLeg = NULL;
RvSipAddressHandle hLocalContactAddress = NULL;
RvSipAddressHandle hRemoteContactAddress = NULL;
RvChar *strFrom = "From:sip:user1@172.20.1.49:5060";
RvChar *strTo = "To:sip:user2@172.20.1.49:5060";
RvChar *strLocalContactAddress = "sip:user1@172.20.1.49:5060;transport=TCP";
RvChar *strRemoteContactAddress = "sip:user2@172.20.1.49:5060;transport=TCP";
RvStatus rv, rv1;
/*--------------------------
Creates a new call-leg.
----------------------------*/
rv = RvSipCallLegMgrCreateCallLeg(hCallLegMgr,NULL,&hCallLeg);
if(rv != RV_OK)
{
printf("Failed to create new call-leg\n");
return;
}
printf("Outgoing call-leg %x was created\n",hCallLeg);
/*---------------------------------------
Gets address handles from the call-leg.
---------------------------------------*/
rv = RvSipCallLegGetNewMsgElementHandle(hCallLeg,RVSIP_HEADERTYPE_UNDEFINED,
RVSIP_ADDRTYPE_URL,&hLocalContactAddress);
rv1 = RvSipCallLegGetNewMsgElementHandle(hCallLeg,RVSIP_HEADERTYPE_UNDEFINED,
RVSIP_ADDRTYPE_URL,&hRemoteContactAddress);
if(rv != RV_OK || rv1 != RV_OK)
{
printf("Failed to create contact addresses\n");
return;
}