Monday, 9 March 2015

Asterisk blind transfer callback

10:30 Posted by Jurgens Krause , , , 1 comment

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.

1 comment:

  1. I am improving in intercom system. I have an elderly parent that is sometimes in the kitchen or his room and cannot answer the phone, So i have setup auto-answer at the two locations.

    please assist as you have vast knowledge with asterisk.
    Issue: When i call the room and the person is in the kitchen, i have to hangup and dial again to try the kitchen, this is painful and time consuming.

    Solution that I would love: Call one location and press any key such as ** and be transferred to the other extension and vise versa. So in a way a toggle switch to transfer to another extension with out redialing.