onsip/SIP.js — pull request #136 by joseph-onsip (2014-12-16 22:16:16+00:00)
Title: Add support for "Replaces" Header (RFC 3891)

With the help of @wakamoleguy and @james-onsip, I think we're ready to add this feature. Most of the changes are in 0cef5cb, the commit message of which is reproduced below. Thoughts on the correctness/API? I'll try to clean up and publish the demo I've been testing with, for anyone who wants to see it in action.

Note that passing a display name with a REFER isn't yet supported. I still need to work that out, but this is functional regardless.

---

Attended Transfer: Add UA configuration option 'replaces' for RFC 3891

Like the 'rel100' option, 'replaces' can take three values:

* SIP.C.supported.UNSUPPORTED
* SIP.C.supported.SUPPORTED (default)
* SIP.C.supported.REQUIRED

The 'replaces' option mainly controls the behavior of the UA upon receiving an
INVITE with the Replaces header. If 'replaces' is UNSUPPORTED, the UA will emit
'invite' as usual. Otherwise, the UA will attempt to follow Section 3 of RFC
3891, automatically accepting the INVITE and terminating the replaced dialog.
Before terminating, the Session associated with the replaced dialog will emit
the 'replaced' event with the new Session, so that the application is aware of
the replacement.

As with 'rel100', the Supported and Require headers sent by the UA will reflect
the configured value.

https://tools.ietf.org/html/rfc3891