返回列表 發帖

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!

本帖最後由 Qnewbie 於 2010-5-11 20:16 編輯

回復 2# 角色

It is free for receiving calls to my mobile

TOP

Both mehtods are based on the system(cp /var/spool/asterisk/provider.call /var/spool/asterisk/outgoing/), which is direct dial-out of asterisk.

The variable asterisk callback is another good stuff from gramels.

TOP

A more detail note for callback, it gives some hints for future usage.
  1. [custom-CallBack]
  2. ;;prepare for callback and DISA
  3. exten => s,1,NoOp(Hangup then callback to cellphone)
  4. exten => s,2,Hangup()
  5. exten => h,1,NoOp(copy callback.call file to /var/spool/asterisk/outgoing)
  6. exten => h,2,System(/etc/asterisk/callback_exe)
  7. 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
  1. Channel: SIP/6081112222@MyVSP
  2. Context: custom-DISA-out
  3. Extension: s
  4. Priority: 1
  5. 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:
  1. [custom-DISA-out]
  2. exten => s,1,Wait(1)
  3. exten => s,n,Background(agent-pass)
  4. exten => s,n,Authenticate(87235) ;this number is the password
  5. exten => s,n,Background(pls-wait-connect-call)
  6. 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?).

TOP

返回列表