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

372 HP-UX C SIP Stack Programmers Guide
Replaces Header
return hNewCallLeg;
}
/*=====================================================================================*/
REPLACES HEADER The Replaces header is a SIP header defined by draft-ietf-sip-replaces. This
header is used to logically replace an existing SIP dialog with a new SIP dialog.
The Replaces header contains the Call-ID, To tag and From tag, which identify a
dialog to be replaced.
The Replaces header may also contain an “early-only” flag. This flag, if present,
indicates that the Replaces header refers only to a dialog which is in an early
state. This means that a dialog has not yet been established (for example, if it
received a 1xx response, but did not yet receive a final response).
A Replaces header can be placed in an INVITE message or it can be part of the
Refer-To header in a REFER message. When a User Agent receives an INVITE
request with a Replaces header, it will search for a call that has the same Call-
ID, From tag and To tag, and if necessary, that is in an early state. If the User
Agent finds one, it will disconnect this call and accept the INVITE request.
When an application receives a REFER with Replaces in the Refer-To header, it
will send the new INVITE, triggered by this REFER with a Replaces header, in
the INVITE message.
SENDING A MESSAGE
WITH REPLACES
HEADER
The application can use the Replaces header in one of the following situations:
When sending a REFER message
When sending an INVITE message
SENDING REFER WITH REPLACES INFORMATION
If the application wants to send a REFER message with Replaces header in the
Refer-To header, it has to create a subscription and call RvSipSubsReferInit() or
RvSipSubsReferInitStr() with the Replaces header that it wants to add to the
Refer-To header.
SENDING INVITE WITH REPLACES HEADER
The application can set the Replaces header in the call-leg before sending an
initial INVITE request, by calling the function,
RvSipCallLegSetReplacesHeader(). If the call-leg was created as a result of an
accepted REFER, and the Refer-To header in the REFER message contained the
Replaces header, the call-leg will insert the Replaces header that was in the
REFER into the INVITE message automatically. If the application wants a