Asterisk tips reverse hold

Automatic Callback on Busy/Camp on

Register on Busy

Best method I am using for call back is

1-Make a file containing information ragarding called and calling party
Please see for details of .call file
This file can be genrated by script or an by executeabele application via system cmd in dial plan

2-Move file to a folder /var/spool/asterisk/outgoing use mv

3-Asterisk will automatically originate and terminate call for both parties.

My older method is as under and was genrating ring only

1- Store Caller and Called party numbers in database when Called party is busy

2- Retrieve these values from database then Call back to caller when Called party hangs up phone
It is working fine with all kind of SIP phones I have basic configuration for extensions.conf is given and can be modified according to requirements

;Store Called Number in DB if he is Busy
exten => _XXXX.,1,Dial(SIP/${EXTEN},20,Ttr)
exten => _XXXX.,2,Congestion()
exten => _XXXX.,102,DBPut(CallBack/${EXTEN}=${CALLERIDNUM})
exten => _XXXX.,103,Busy()

;Auto CallBack Caller on hang up of dialed party
exten => H,1,Goto(h,1)
exten => h,1,DBget(temp=CallBack/${CALLERIDNUM})
exten => h,2,DBdel(CallBack/${CALLERIDNUM})
exten => h,3,Dial(SIP/${temp},20,tr)
exten => h,4,Congestion()
exten => h,102,NoOp(Not Registered for CallBack)
exten => h,104,Busy()


Abdul Ghafoor

Reverse hold

I have no idea what this really should be called, so for lack of a better name, I called it "reverse hold". Hopefully someone else can make use of it, or even make it better, as its the first thing of its kind I've made for asterisk.

Like most people, I'm very busy, so when I call other companies, sitting on hold really sucks. If you have speaker phone, its not so bad, but then you have to sit there and listen to the company's horrible choice in music.

The solution: Reverse Hold.

When you're on hold, blind transfer the call to the special extension. This extension repeats "Press 1 to be connected to the caller, do not hangup" constantly. Once the remote party presses 1, the original extension is dialed back. No more listening to hold music, or having a phone stuck to your ear forever! ;)

It confuses people at first, but for the most part it works great.

This will definitely need some tweaking to fit in to your own setup.


 ;This is used in case you manually set the callerid 
 ;in your extensions.conf, ie: Nufone
 ;It saves the originating EXT for use later on.
 ;I tried getting the src channel, and just dialing it back,
 ;but it didn't work out so well.
 exten => s,1,setGlobalVar(SRC_EXT=${CALLERIDNUM})
 exten => s,2,SetCallerID(${ARG1})
 exten => s,3,SetCIDName(${ARG2})

 exten => s,1,GotoIf($["${SRC_EXT}" = ""]?99:2)
 exten => s,2,NoOp(Reverse Hold from: ${SRC_EXT})
 exten => s,3,AbsoluteTimeout,600  ;10 mins, then force a callback to 
 ; the originating ext as a reminder the call is still on hold

 exten => s,4,Wait,2
 exten => s,5,Background(reverse-hold-repeat)
 exten => s,6,Goto(s,4)                                  ;Loop

 exten => s,99,Macro(set-callerid,5555555555,Foo Company) ;If SRC_EXT 
 ; isn't set already, this will set it

 exten => i,1,Goto(s,4) ; Keep repeating if they don't press 1
 exten => t,1,Goto(s,4)

 exten => 1,1,NoOp(Reverse Hold party dialed 1, calling back: ${SRC_EXT})
 exten => 1,2,Goto(reverse-hold,999,1)

 exten => T,1,NoOp(Reverse Hold timeout, calling back: ${SRC_EXT})
 exten => T,2,Goto(reverse-hold,999,1)

 exten => 999,1,SetCallerID(${EXTEN})
 exten => 999,2,SetCIDName(Reverse-Hold)
 exten => 999,3,AbsoluteTimeout,0
 exten => 999,4,Goto(extensions,${SRC_EXT},1)
 exten => 999,5,Goto(s,4)

 exten => 899,1,Goto(reverse-hold,s,1)

Ideally something like this would become its own application, or tied in to something like parkedcalls. But for now, the above works relatively well. The biggest drawback is there is no way to get back to call on hold until it times out.

You may want to use a conference room to keep them on hold in order to be able to attach and detach yourself at any time. I think bkw wrote an app by which you could process DTMF within a conference, which could be used here. - benjk


-Mike Benoit
ipso AT snappymail DOT ca

Created by: JustRumours, Last modification: Fri 08 of Jun, 2012 (23:16 UTC) by admin
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+