Does asterisk do callback?

Does asterisk support international callback?

Is it an out of the box the thing?

Obelix,

It is not really out of the box, but a few lines of script and a dialplan will get you there.

You can have a look at the following link where I got my solution from:

voip-info.org/tiki-index.php … 20callback

This is my implementation:

First in file Extension.conf:

;Call back to save money while interstate/overseas
;Dial extension 2XX to set call back number and get call back. Where XX is the normal (in-office extension)
;We store the number keyed in for possible call-backs to same number later (multiple calls from same remote phone number)
[callback-set]
exten => _2XX,1,Answer
exten => _2XX,2,Read(phone_number|IC-enter-phone-complete|20)
exten => _2XX,3,DbPut(ICcallback/${EXTEN}=${phone_number})
exten => _2XX,4,AbsoluteTimeout(9000) ;Maximum 2.5 hours call (9000 seconds) in case something goes wrong
exten => _2XX,5,system(bash /etc/asterisk/Callback_Script SIP/${phone_number} @myprovider)
exten => _2XX,6,Hangup

;Use extension 3XX to execute subsequent call back to same number (avoiding to re-input the number)
[callback-same-number]
exten => _3XX,1,SetVar(MyKey=2${EXTEN:1})
exten => _3XX,2,DbGet(phone_number=ICcallback/${MyKey})
exten => _3XX,3,AbsoluteTimeout(9000) ;Maximum 2.5 hours call (9000 seconds) in case something goes wrong
exten => _3XX,4,GotoIf($["${phone_number}" != “”]?5:7)
exten => _3XX,5,system(bash /etc/asterisk/Callback_Script SIP/ ${phone_number} @myprovider)
exten => _3XX,6,Hangup
exten => _3XX,7,Congestion

[callback-generic-in]
;When a call-back arrives here, ask the user to press 1. This allows to terminate the call after 70 seconds if it has gone nowhere.
exten => 10,1,Answer
exten => 10,2,DigitTimeout,1
exten => 10,3,ResponseTimeout,70
exten => 10,4,AbsoluteTimeout(9000) ;Maximum 2.5 hours call (9000 seconds) in case something goes wrong
exten => 10,5,Background(IC-press-1)

;He/she is then presented with a dial-tone as if in the office PBX.
exten => 1,1,DigitTimeout,5
exten => 1,2,ResponseTimeout,15
exten => 1,3,AbsoluteTimeout(9000) ;Maximum 2.5 hours call (9000 seconds) in case something goes wrong
exten => 1,4,DISA(no-password,main-out)
exten => 1,5,Hangup

;other option is 1# instead of 1 (faster as it skips the digit timeout).
exten => 1#,1,Goto(1,1)

exten => t,1,Hangup ;Can’t loop indefinitaly as the call may never make it overseas or may
;get stuck somewhere else

exten => i,1,Goto(10,2) ;Entered a digit, but invalid, try again

Then the file Callback_Script located (in my case) in /etc/asterisk/ :

if [ “x$1” != “x” ];then channel="$1"; else exit; fi

if [ “x$2” != “x” ];then phone_number="$2"; else exit; fi

sip_provider="$3"

#note use of ‘-’ in ‘-EOF1’ - Escapes tab at beginning of lines
CALLFILE=$(cat <<-EOF1
Channel: $channel$phone_number$sip_provider
MaxRetries: 1
RetryTime:70
WaitTime: 50
Context: callback-generic-in
Extension: 10
Priority: 1

EOF1)

echo “$CALLFILE” >> /var/spool/asterisk/outgoing/$phone_number.call

Make sure the script is executable (change the file’s flags).

All this was based on the (very good) information located on the Asterisk Wiki above. If you have a dedicated incoming phone number for each person/extension, you can implement the solution in the wiki where you do not need to even pay for the original call as theincoming ring is used to trigger a call back, but in my case I had to get inside the pbx and therefore I end-up paying for a very short call every time, but in any case it is much cheaper overall than calls from overseas.

Hopes this helps.

Panoramix (Also known as John)

Thanks a lot John.

I will take some time to test the underlying technology and sort it out.

These are quite good examples

also look on google for an agi script called callback.agi