[asterisk-users] [asterisk-app-dev] Handling transfers with ARI
Jean Aunis
jean.aunis at prescom.fr
Thu Dec 24 01:53:07 CST 2020
Thank you all for the hints.
I ended up using a mix of dialplan to deal with the Local channels, and
ARI to detect the transfer and redirect. It doesn't look like a "clean"
solution but I have nothing better for the moment :
Dialplan :
exten =
100,1,GotoIf($[$["${SIPTRANSFER}"="yes"]&$["${CHANNEL(channeltype)}"="Local"]]?waittransfer:)
; deal with channel being transfered
same = n,Transfer(100)
same = n,Hangup()
; deal with Asterisk-managed Local channel
same = n(waittransfer),Wait(2)
same = n,Hangup()
NodeJS :
bridge.once('BridgeAttendedTransfer', event => {
var transferee = new ari.Channel(event.transferee.id);
transferee.continueInDialplan({
context: event.context,
extension: event.exten,
priority: 1
});
});
Le 23/12/2020 à 19:46, Phil Mickelson a écrit :
> Unfortunately, I suspect my situation is different from yours in that
> I control everything. And, when Bob wants to transfer the call he
> clicks a button on the screen, not a button on the phone. I don't use
> any part of the dialplan except to start ARI.
>
> Sorry.
>
> Phil
>
> On Wed, Dec 23, 2020 at 2:56 AM Jean Aunis <jean.aunis at prescom.fr
> <mailto:jean.aunis at prescom.fr>> wrote:
>
> Thanks for the answer.
>
> Not sure I get the idea : when a SIP phone performs a
> blind-transfer, I have no control over what Asterisk does with the
> channels. During my tests, Bob's channel was automatically pulled
> out of the bridge, and replaced with a Local channel whose peer
> goes through the dialplan to the transfer destination.
>
> How can you link the newly created Local channel with Alice's one ?
>
> For the moment, I have a piece of solution with the
> BridgeBlindTransfer event, but I still have troubles with these
> Local channel issues.
>
> Le 22/12/2020 à 20:13, Phil Mickelson a écrit :
>> Not sure if this will help but what I do is fairly simple. A
>> couple of things:
>>
>> 1. This is all written in JS using Node.js.
>> 2. I use ari-client from npm.
>>
>> To me this is very simple. You already have the bridge and
>> channel setup for Alice. I create another channel that dials
>> Charlie. And, as soon as the create channel call comes back I
>> just set the channel id (was Bob) in the bridge to the new
>> channel for Charlie. That's it. If it doesn't get answered I
>> hope it goes to VM. However, that's the downside of a blind
>> transfer. I have some code in there for what happens if Alice
>> hangs up before Charlie answers, etc but that's because I keep
>> track of every call in my system.
>>
>> And I wrote all of this before there were Promises and
>> Async/Await. Hopefully next year I'll have the time to rewrite
>> the whole thing.
>>
>> And, for the people at Asterisk who came up with the idea of
>> ARI. Thank you soooo much. Hope everyone has a wonderful
>> holiday and that 2021 is much better than 2020!
>>
>> Phil
>>
>> On Tue, Dec 22, 2020 at 5:38 AM Jean Aunis <jean.aunis at prescom.fr
>> <mailto:jean.aunis at prescom.fr>> wrote:
>>
>> Hello,
>>
>> I'm struggling to find a way to properly handle blind
>> transfers with ARI.
>>
>> This is my use case :
>>
>> - Alice calls Bob through Asterisk
>>
>> - dialing and bridging is done with ARI
>>
>> - when Bob blind-transfers to Charlie, I would like to use the
>> "redirect" ARI operation, or the Transfer application
>>
>> But here is the issue : since the channels are stasis-managed,
>> transferring is done with Local channels which remain in the
>> path, so
>> Transfer and redirect have no effect on them. And Alice's
>> channel is not
>> aware that it is being transferred.
>>
>> Has somebody already dealt with this ?
>>
>> Regards,
>>
>> Jean
>>
>>
>> _______________________________________________
>> asterisk-app-dev mailing list
>> asterisk-app-dev at lists.digium.com
>> <mailto:asterisk-app-dev at lists.digium.com>
>> http://lists.digium.com/cgi-bin/mailman/listinfo/asterisk-app-dev
>>
>>
>> _______________________________________________
>> asterisk-app-dev mailing list
>> asterisk-app-dev at lists.digium.com <mailto:asterisk-app-dev at lists.digium.com>
>> http://lists.digium.com/cgi-bin/mailman/listinfo/asterisk-app-dev
> _______________________________________________
> asterisk-app-dev mailing list
> asterisk-app-dev at lists.digium.com
> <mailto:asterisk-app-dev at lists.digium.com>
> http://lists.digium.com/cgi-bin/mailman/listinfo/asterisk-app-dev
>
>
> _______________________________________________
> asterisk-app-dev mailing list
> asterisk-app-dev at lists.digium.com
> http://lists.digium.com/cgi-bin/mailman/listinfo/asterisk-app-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20201224/101b2997/attachment-0001.html>
-------------- next part --------------
_______________________________________________
asterisk-app-dev mailing list
asterisk-app-dev at lists.digium.com
http://lists.digium.com/cgi-bin/mailman/listinfo/asterisk-app-dev
More information about the asterisk-users
mailing list