Following the callback installation document in the Addons/Docs folder helped me immensely, but it still took me a few days to become comfortable with how it's all meant to hang together. Here's what I know.
The contexts
[a2billing-cid-callback] and
[a2billing-all-callback] are for your customers dialing in. The
[a2billling-callback] context is where calls
from the callback daemon itself are going to be handled.
Stop looking for the significance of extension 1000; there is none. By default the
[a2billing-callback] context answers any dialstring, so it doesn't matter what callback dials. 1000 is as good as any.
For a real world example let's first study my extensions.conf:
Code:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; CLI CALL BACK TRIGGERS
exten => 441234567890,1,Goto(a2billing-cid-callback,${EXTEN},1)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; FIXED DESTINATION (ANI) CALL BACK TRIGGERS
; card no. 012345679
exten => 441234567891,1,Set(CALLERID(num)=441112223334)
exten => 441234567891,n,Goto(a2billing-cid-callback,${EXTEN},1)
; card no. 9876543210
exten => 441234567892,1,Set(CALLERID(num)=441113334445)
exten => 441234567892,n,Goto(a2billing-cid-callback,${EXTEN},1)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; VOUCHER TOP UP LINE
exten => 441234567898,1,Goto(a2billing-voucher,${EXTEN},1)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; answer DIDs here into AGI CONF 2
exten => 441234567899,1,Goto(a2billing-did,${EXTEN},1)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; answer everything else as one-stage-dial into AGI CONF 1
exten => _X.,1,Answer
exten => _X.,n,DeadAGI(a2billing.php|1)
exten => _X.,n,Hangup
exten => s,1,Hangup
exten => s,n,Hangup
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; A2B standard contexts
[a2billing-did]
exten => _X.,1,Set(CALLERID(num)=${IF($[${LEN(${CALLERIDNUM})} = 10]?44:)}${CALLERIDNUM})
exten => _X.,n,DeadAGI(a2billing.php|2|did)
exten => _X.,n,Hangup
[a2billing-callback]
exten => _X.,1,Answer
exten => _X.,n,DeadAGI(a2billing.php|1|callback)
exten => _X.,n,Hangup
[a2billing-cid-callback]
exten => _X.,1,Ringing()
exten => _X.,n,Set(CALLERID(num)=${IF($[${LEN(${CALLERIDNUM})} = 10]?44:)}${CALLERIDNUM})
exten => _X.,n,DeadAGI(a2billing.php|3|cid-callback|) ;last parameter is the callback area code
exten => _X.,n,Wait(60)
[a2billing-all-callback]
exten => _X.,1,Ringing()
exten => _X.,n,Set(CALLERID(num)=${IF($[${LEN(${CALLERIDNUM})} = 10]?44:)}${CALLERIDNUM})
exten => _X.,n,DeadAGI(a2billing.php|4|all-callback|44) ;last parameter is the callback area code
exten => _X.,n,Wait(60)
[a2billing-voucher]
exten => _X.,1,Set(CALLERID(num)=${IF($[${LEN(${CALLERIDNUM})} = 10]?44:)}${CALLERIDNUM})
exten => _X.,n,DeadAGI(a2billing.php|1|voucher)
exten => _X.,n,Hangup
[a2billing-predictivedialer]
exten => _X.,1,DeadAGI(a2billing.php|1|predictivedialer)
exten => _X.,n,Hangup
You can see each time I invoke a2billing.php I am passing a different number to it. These reference different sections of a2billing.conf so that we can make each type of call behave slightly differently.
agi-conf1 is for normal calls from access numbers and SIP clients. It answers the call, offers 3 attempts, all the usual stuff.
agi-conf2 is for DIDs, and therefore answer_call is NO, number_try=1, sip_iax_friends is NO (otherwise extracharge is ignored!), jump_voucher_if_min_credit is NO, cid_enable is NO. Mostly common sense settings.
agi-conf3&4 are for callback triggers and are set pretty much the same as agi-conf2 except cid_enable is YES for obvious reasons.
Initially I had a problem with CLI callback as my carrier omits both the country code and national prefix for calls originating within my country. You can see how I match for CLI only 10 digits long and prefix with 44 to form a valid dialstring.
If you're going to use all-callback (ie will ring back any number) please use a special rate table to forbid it calling back premium rate numbers. As has been stated many times previously on this forum ITSPs suffer vast amounts of fraud.
As the code ships, using CLI callback will prompt you to authenticate again on the callback leg. To remove this extra check look around line 500 of a2billing.php and uncomment the following:
Code:
$callerid=$A2B->CallerID;
You might also be interested in
this thread
I hope this clears up a few things for you.