On 10/21/06, Colin Whittaker <[EMAIL PROTECTED]> wrote:
> Is there a way to add the Replaces parameters to a Refer-To: SIP header ?

You mean like
refer-to: <sip:[EMAIL PROTECTED]>

The Replaces header is encoded as query part of the SIP URI.

> I see a lot about the Replaces: header, but nothing about the parameter.

The code to handle replaces and headers encoded in the URI was added
after 1.12.3, it is only in darcs. The interesting functions are

sofia-sip/sip_header.h:
  sip_headers_as_url_query()
  sip_url_query_as_taglist()
sofia-sip/url.h:
  url_query_as_header_string()
sofia-sip/nua.h:
  nua_handle_make_replaces()
  nua_handle_by_replaces()
sofia-sip/nta.h (these were already in 1.12.3):
  nta_leg_make_replaces()
  nta_leg_by_replaces()

Now let say we have a call from A to B, and B wants to transfer call
to C. He calls C on a handle nh_c (and probably tells that hey, there
is an incoming call from A, I'll transfer her to you). Next, he gets a
replaces header, like

sip_replaces_t *r = nua_handle_make_replaces(nh_c, home, 0);

Then he converts it as a query part in the Refer-To header

char *query = sip_headers_as_url_query(home, SIPTAG_REPLACES(r), TAG_END());
sip_refer_to_t *r_to =
  sip_refer_to_format(home, "<%s?%s>", url_as_string(uri_of_c), query);

He sends refer-to in a REFER request to A, like

nua_refer(nh_a, SIPTAG_REFER_TO(r_to), TAG_END())

A receives REFER request and she just uses the URI from refer-to, like

nua_invite(nh, NUTAG_URL(sip->sip_refer_to->r_url), ...)

and nua decodes the query part and adds Replaces header to the INVITE
request sent to C.

C receives the INVITE request that contains the Replaces header. If he
accepts the call, he gets the nua handle of the call which the new
call is intended to replace with nua_handle_by_replaces(). The handle
corresponds to the call B made with C earlier. It is the other end of
the call, the other end within B was represented with nh_c. He just
sends BYE to the old call with B and 200 OK to A.

When A receives 200 OK to her INVITE to C, she, will send a NOTIFY to
B, the body of NOTIFY contains 200 OK.

Upon receiveing the NOTIFY B drops the call with A by sending a BYE.

-- 
Pekka.Pessi mail at nokia.com

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Sofia-sip-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel

Reply via email to