Refer-To Replaces From/To Tag Selection

Skip to first unread message

Paul Koenig

Apr 24, 2022, 1:17:32 PMApr 24
to JsSIP

I am looking for some guidance on attended transfer Refer-To, and whether the below might be a JsSIP bug.

In JsSIP, ReferSubscriber builds the Refer-To Replaces from-tag and to-tag using the *session's* from-tag and to-tag.

Whereas RFC3891, section 3 says that the UAS receiving the REFER compares the Replaces to-tag with the *dialog's* local tag (and the Replaces from-tag with the dialog's remote tag):

> The Replaces header contains information used to match an existing SIP
> dialog (call-id, to-tag, and from-tag). Upon receiving an INVITE with
> a Replaces header, the User Agent (UA) attempts to match this
> information with a confirmed or early dialog.  The User Agent Server
> (UAS) matches the to-tag and from-tag parameters as if they were tags
> present in an incoming request. In other words, the to-tag parameter
> is compared to the local tag, and the from-tag parameter is compared
> to the remote tag.

It seems like this is causing an issue for some SIP servers where, when the target of an attended transfer is an inbound call, the transfer does not succeed, because the Refer-To Replaces tags are reversed from what the server expects when trying to find the dialog.

This ReferSubscriber patch was working for me as a fix:

@@ -43,8 +43,8 @@ module.exports = class ReferSubscriber extends EventEmitter
     if (options.replaces)
       replaces = options.replaces._request.call_id;
-      replaces += `;to-tag=${options.replaces._to_tag}`;
-      replaces += `;from-tag=${options.replaces._from_tag}`;
+      replaces += `;to-tag=${}`;
+      replaces += `;from-tag=${}`;

       replaces = encodeURIComponent(replaces);

Currently, I am working around the issue by checking whether the target of the transfer was an inbound call, and constructing a fake object where the to tag and from tag are reversed if so. But it seems like there must be a better way!

Thanks very much for any advice!

Reply all
Reply to author
0 new messages