返回列表 發帖

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!

Why do you need a callback service?

How much that you that you have to pay if you just receive mobile phone calls?

YH

TOP

其實用callback在不少情況下是可以省回(甚至不用錢)來作通話的...
所以當手機漫遊時...為何callback會比漫遊致電便宜...(所以很hardsell)

在全世界不少地方接聽電話是完全免費的(例如中國/日本)
如果你在這些地區...直接通話的話便會這樣...
另外一個原因是...用Callback的話...即使是由接電一方再撥IDD...有可能會比直接由當地致電便宜

舉例一下...
1)由中國致電香港(假設中國->香港IDD費用$2.x)
1a)直撥
中國-(IDD費用)->香港
(費用可能由$2.x/分鐘計)
1b)Callback
中國<-(Asterisk call back)->香港
由中國致電Asterisk(致電中國號碼致電一分鐘最多$2.x)
香港Call back大陸$0.x/分鐘
那最終便只是要付$2.x+$0.x/分鐘...
如果用得上0088...則兩邊也不用收費...
(中國<-(Asterisk利用香港0088Trunk callback中國)->香港)

日本也可利用上述方法由固網致電...

如果有多條Trunk的話...應該可以用最便宜的那條Trunk做callback...
例如現在一條Trunk是澳門的Trunk...
一條是香港和記含0088 IDD任打的Trunk...
如果某人撥入Asterisk...
要致電回中國的...便用0088那條Trunk...
要致電澳門的...因為0088不包含澳門...
所以便走澳門PSTN那條...

TOP

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

回復 2# 角色

It is free for receiving calls to my mobile

TOP

You may consider the codes shown in the following link:

http://blog.gramels.info/blog/in ... -configuration.html


YH

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

When I have time, I may spend some time on this matter such that other member can make use of the call-back feature.

YH

TOP

朋友们喜欢玩DNF游戏吗?















DNF外挂

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

返回列表