標題: Callback in asterisk [打印本頁] 作者: Qnewbie 時間: 2010-5-10 23:50 標題: Callback in asterisk
本帖最後由 Qnewbie 於 2010-8-10 19:59 編輯
A piece of cake!
As the price plan for pay as you go mobile is sky high(I made a call for 20 seconds today and the price tag is about 5.5HKD!!!), I need the callback service!
Following the link http://blog.jploh.com/2007/01/28/asterisk-callback-disa/. You might modify some file localtions. /opt/etc/asterisk/ might change to /etc/asterisk/ in a linux, or for 角色 C-hing, just copy and paste for LINKSYS NSLU...
The auth. code should be changed from exten => s,n,Authenticate(87235) to something you like
My primary result is
== Using SIP RTP CoS mark 5
-- Executing [s@frominternal:1] NoOp("SIP/075512345678-00000000", "Incoming call from # 1380013800") in new stack
-- Executing [s@frominternal:2] GotoIf("SIP/075512345678-00000000", "1?myCallBack,s,1") in new stack
-- Goto (myCallBack,s,1)
-- Executing [s@myCallBack:1] NoOp("SIP/075512345678-00000000", "Hangup then callback to cellphone") in new stack
-- Executing [s@myCallBack:2] Hangup("SIP/075512345678-00000000", "") in new stack
== Spawn extension (myCallBack, s, 2) exited non-zero on 'SIP/075512345678-00000000'
-- Executing [h@myCallBack:1] NoOp("SIP/075512345678-00000000", "copy callback.call file to /etc/var/spool/asterisk/outgoing") in new stack
-- Executing [h@myCallBack:2] System("SIP/075512345678-00000000", "/etc/var/lib/asterisk/bin/callback_bin") in new stack
-- Executing [h@myCallBack:3] Hangup("SIP/075512345678-00000000", "") in new stack
== Spawn extension (myCallBack, h, 3) exited non-zero on 'SIP/075512345678-00000000'
[May 11 23:20:30] WARNING[9135]: pbx_spool.c:234 apply_outgoing: Unknown keyword ' Channel' at line 1 of /etc/var/spool/asterisk/outgoing/callback.call
I use " Channel", which should be "Channel" and causes the error!作者: 角色 時間: 2010-5-11 10:09
Why do you need a callback service?
How much that you that you have to pay if you just receive mobile phone calls?
A more detail note for callback, it gives some hints for future usage.
[custom-CallBack]
;;prepare for callback and DISA
exten => s,1,NoOp(Hangup then callback to cellphone)
exten => s,2,Hangup()
exten => h,1,NoOp(copy callback.call file to /var/spool/asterisk/outgoing)
exten => h,2,System(/etc/asterisk/callback_exe)
exten => h,3,Hangup()
複製代碼
This code just call the callback initiater's number. The spool function is extreme useful for callback. Note the h, it means deadagi, should be executed after hang up.
The callback.call file
Channel: SIP/6081112222@MyVSP
Context: custom-DISA-out
Extension: s
Priority: 1
CallerID: 6085558888
複製代碼
Basically, the Channel statement instructs asterisk type fo trunk, the callback number, and using which trunk. It is a shorten Dial command.
The Following three lines tell asterisk how to treat the connected callback number, i.e., custom-DISA-out, s, 1 should be run after connection. The last line is to set the CallerID to 6085558888.
The custom-DISA-out:
[custom-DISA-out]
exten => s,1,Wait(1)
exten => s,n,Background(agent-pass)
exten => s,n,Authenticate(87235) ;this number is the password
exten => s,n,Background(pls-wait-connect-call)
exten => s,n,DISA(no-password, out-pstn)
複製代碼
It requires password to entry the DISA for using out-pstn dialplan.
The whole flow is following:
1. Caller calls access number and gives his/her tel. number.
2. Asterisk hangs up the call(if possible), calls the Caller' number.
3. The caller picks up the callback, entries the password.
4. If the password is correct, give the right dialplan to the caller(e?).