JsSIP icon indicating copy to clipboard operation
JsSIP copied to clipboard

refer of 2 incoming call failed

Open michelepra opened this issue 2 years ago • 2 comments

When jssip build "Refer-to" header not considering rfc3515 (SIP) Refer Method

A REFER request MAY be placed outside the scope of a dialog created with an INVITE. REFER creates a dialog, and MAY be Record-Routed, hence MUST contain a single Contact header field value. REFERs occurring inside an existing dialog MUST follow the Route/Record- Route logic of that dialog.

RFC 3261 12.1.1. and RFC 3261 12.1.2. say how take "local tag" and "remote tag" for dialog and this is correctly implemented

The behaviour of this rfc mismatch is that refer of 2 incoming call failed (eg. in asterisk server)

Solution is to change "Refer-to" builder from

 if (options.replaces)
   {
     replaces = options.replaces._request.call_id;
     replaces += `;to-tag=${options.replaces._to_tag}`;
     replaces += `;from-tag=${options.replaces._from_tag}`;

     replaces = encodeURIComponent(replaces);
   }

to

  if (options.replaces)
   {
     if (options.replaces._dialog) 
     {
       replaces = options.replaces._dialog.id.call_id;
       replaces += `;to-tag=${options.replaces._dialog.id.remote_tag}`;
       replaces += `;from-tag=${options.replaces._dialog.id.local_tag}`;
     } else {
       replaces = options.replaces._request.call_id;
       replaces += `;to-tag=${options.replaces._to_tag}`;
       replaces += `;from-tag=${options.replaces._from_tag}`;
     }

     replaces = encodeURIComponent(replaces);
   }

michelepra avatar May 11 '23 14:05 michelepra

Hi We got the same issue and this fix solved the problem. Why this is not patched yet ? is there any problems with this fix ?

Karakoukie avatar Apr 17 '24 13:04 Karakoukie

@michelepra or @Karakoukie , are you willing to submit a PR?

jmillan avatar Jul 29 '24 10:07 jmillan