-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for SIP transfers #1815
Conversation
Note: fixed a typo in the PR text, where for the |
I Have Tested this update and it worked perfectly. It would also be very nice to be able to merge calls (confrencing). looking forward to have this pull merged in master. |
Cool, thanks!
Not going to happen, sorry. We're never going to decode/transcode in the SIP plugin. |
Merging. |
As the title says, this pull request is aimed at adding support for SIP transfers in the SIP plugin. This was first asked for in #978, and has been a commonly asked feature since, e.g., to build more effective Janus-based softphones in the web, for contact/call centers, etc. This is part of a new series of developments (including #1768 for SIP SUBSCRIBE/NOTIFY and #1772 for multiple calls), sponsored by a Colombian Company with 21 years of experience on developing Telecommunication Solutions.
Since this is part of a set of activities I've been working on related to the SIP plugin, this is actually based on another PR I published a few weeks ago (#1772), that is the one that implements support for multiple SIP calls at the same time for the same account. In fact, SIP transfers, whether they're blind or attended, always end up in someone having two calls at a time in some moments, and as such they wouldn't be possible without the multiple calls support implemented there. The patch includes a documentation of the feature, in a dedicated section that can be generated when compiling the docs via doxygen and that I'll briefly describe here.
The request to ask for a transfer (blind or attended) is called
transfer
, which will originate a SIP REFER in the plugin, and its syntax is the following:The only mandatory argument is the
uri
of the transfer target; thereplace
one is optional, if you omit it, it will be a blind transfer, otherwise it will be an attended one. Notice that thetransfer
request must be sent during a call, and cannot be sent if you're not in a conversation with the person you want to transfer.You'll get a
transferring
event in response to that request. This will also automatically trigger a subscription for the call progress events, so you can expectnotify
events formatted like we alreadydiscussed when talking about the #1768 branch. That will allow the transferor to see how the transfer is proceeding.
On the transferee side (the person receiving the REFER), they'll receive a
transfer
event formatted like this:The
refer_to
is the URI that they need to call,referred_by
is the SIP URI of the transferor;replaces
will only be there if the REFER did include a replaces parameter, as discussed above.What's truly important in the plugin messaging, though, is
refer_id
, which is a unique numeric identifier, internal to the plugin, to address this transfer request. It's important because, if you want toaccept the transfer and do the call, you simply place a regular
call
request (as you're already doing), but adding arefer_id
attribute with the value you just received: this tells the SIP plugin that thisis not a call you're startin on your own, but you're actually following up on the REFER, and so will add the additional SIP headers (e.g.,
Replaces
if it was provided). Of course, remember that, since thetransferee is already in a call with the transferor, to follow up on the REFER you'll need to place the new
call
on a new helper, as introduced in the above-mentioned #1772 branch.For what concerns the transfer targer (the person the REFER tells you to call), it's pretty much a normal incoming call, so you should expect a normal
incomingcall
event; in case this incoming call was originated from a transfer, though, theincomingcall
event will also include areferred_by
(URI of the transferor) and optionally areplaces
attribute. Notice that, in case this is an attendedtransfer, the transfer target is in a call with the transferor already: this means that, in order to be able to receive the new call from the transferee as well, they'll need to have a helper ready BEFORE this
happens, otherwise the incoming call will be automatically rejected by the plugin with a
486 Busy
, without even involing the application. Again, please refer to the multiple calls stuff for that.As a final note, please beware that, in case this is an attended transfer, and there's a
replaces
attribute involved, the plugin will NOT hangup that call for you. It's up to the application to use thatinformation to hangup the replaced call, if they want. Same thing for putting calls on hold while transfering: the plugin will NOT do that for you, control of that part is left entirely up to the application,
to give it more control on what should be done and how.
Hope this is clear enough, and that I'll get some more feedback on it. I didn't get any feedback at all on #1768, which was surprising and annoying: this is a more complex feature, so you want to test it before I merge it.