Monday 9 March 2015

Asterisk blind transfer callback

10:30 Posted by Jurgens Krause , , , No comments

One of the problems with Asterisk, is that, when you blind transfer a call to an internal extension, and the remote side never answers, the call does not automatically go back to the caller. The following piece of dial plan logic should replace your normal internal call logic.

exten =>  _1XX,1,Dial(SIP/${EXTEN},15,tT)
same => n,GotoIf($[${LEN(${BLINDTRANSFER})}=0]?unsuccessful)
same => n,Set(CALLER=${CUT(BLINDTRANSFER,-,1)});
same => n,Goto(CallBack)
same => n(unsuccessful),GotoIf($[($[${LEN($TRANSFERERNAME})}=0]?Fail)
same => n,Set(CALLER=${CUT(TRANSFERERNAME,-,1)});
same => n(CallBack),Set(CALLERID(all)=${EXTEN} <${CALLERID(num)}>)
same => n,Dial(${CALLER},,tT)
same => n(Fail),Hangup()

It works as follows:
1. Line one takes any extension between 100 and 199 and rigs it for 15 seconds. Both the originator and receiver of the call will be able to transfer beyond this point.
2. Asterisk writes the originating channel into the BLINDTRANSFER variable. If it is empty, the blindtransfer variable was not set. The dialplan jumps to the "unsuccessful" label.
3. Asterisk takes the originating extension from the BLINDTRANSFER variable and writes it into a new variable called "CALLER"
4. Jumps to the "CallBack" Label.
5.Asterisk takes the originating extension from the TRANSFERERNAME variable and writes it into a new variable called "CALLER".
6. Asterisk sets the CALLERID as the Transfer Destination and the original CALLERID.
7. Asterisk calls back the extension that initiated the transfer.
8. Asterisk hangs up the call.

0 comments:

Post a Comment