Well, I can't get it to work. Let's start from scratch. I decided to
Here is my complete configuration (at least what I think is important):
A2B "local" trunk config:
Code:
LABEL= Trunk local
ADD PREFIX=
REMOVE PREFIX=999
PROVIDER TECH=SIP
PROVIDER IP=127.0.0.1
A2B "local" ratecard config:
Code:
TARIFFNAME=Tarifa-internos
TRUNK=Trunk local
A2B "local" Rate config:
Code:
RATECARD=Tarifa-internos
DIALPREFIX=999
TRUNK=Trunk local
A2B SIP peer config example (/etc/asterisk/additional_a2billing_sip.conf)
Code:
[5334993676]
type=friend
username=5334993676
accountcode=5334993676
regexten=5334993676
callerid=398893830602693
amaflags=billing
secret=2999286698
nat=yes
dtmfmode=RFC2833
qualify=yes
canreinvite=yes
disallow=all
allow=g729
allow=ulaw
allow=alaw
allow=gsm
host=dynamic
context=a2billing
regseconds=0
cancallforward=yes
Context a2billing configuration (in extensions_trixbox.conf)
Code:
[a2billing]
exten => _X.,1,Answer
exten => _X.,2,Wait,2
exten => _X.,3,DeadAGI,a2billing.php
exten => _X.,4,Wait,2
exten => _X.,5,Hangup
Important configs from a2billing.conf:
Code:
use_dnid=NO
sip_iax_friends=NO
switchdialcommand=NO
And now.... the logs files! This is what I get when I place a call from extension 0168140206 to extension 5334993676
Code:
-- Executing Answer("SIP/0168140206-9e5b", "") in new stack
-- Executing Wait("SIP/0168140206-9e5b", "2") in new stack
-- Executing DeadAGI("SIP/0168140206-9e5b", "a2billing.php") in new stack
-- Launched AGI Script /var/lib/asterisk/agi-bin/a2billing.php
a2billing.php: line:58 - IDCONFIG : 1
a2billing.php:
a2billing.php: line:67 - MODE : standard
a2billing.php:
a2billing.php: A2Billing AGI internal configuration:
a2billing.php: Array
a2billing.php: (
a2billing.php: [debug] => 3
a2billing.php: [answer_call] => 1
a2billing.php: [logger_enable] => 1
a2billing.php: [log_file] => /tmp/a2billing.log
a2billing.php: [say_goodbye] =>
a2billing.php: [play_menulanguage] =>
a2billing.php: [force_language] =>
a2billing.php: [intro_prompt] =>
a2billing.php: [len_cardnumber] => 10
a2billing.php: [len_aliasnumber] => 15
a2billing.php: [len_voucher] => 15
a2billing.php: [min_credit_2call] => 0
a2billing.php: [min_duration_2bill] => 2
a2billing.php: [notenoughcredit_cardnumber] => 1
a2billing.php: [notenoughcredit_assign_newcardnumber_cid] => 1
a2billing.php: [use_dnid] =>
a2billing.php: [no_auth_dnid] => Array
a2billing.php: (
a2billing.php: [0] => 2400
a2billing.php: [1] => 2300
a2billing.php: )
a2billing.php:
a2billing.php: [number_try] => 3
a2billing.php: [say_balance_after_auth] =>
a2billing.php: [say_balance_after_call] =>
a2billing.php: [say_rateinitial] =>
a2billing.php: [say_timetocall] =>
a2billing.php: [auto_setcallerid] =>
a2billing.php: [force_callerid] =>
a2billing.php: [cid_sanitize] =>
a2billing.php: [cid_enable] =>
a2billing.php: [cid_askpincode_ifnot_callerid] => 1
a2billing.php: [cid_auto_create_card] =>
a2billing.php: [cid_auto_assign_card_to_cid] => 1
a2billing.php: [cid_auto_create_card_typepaid] => POSTPAY
a2billing.php: [cid_auto_create_card_credit] => 0
a2billing.php: [cid_auto_create_card_credit_limit] => 1000
a2billing.php: [cid_auto_create_card_tariffgroup] => 6
a2billing.php: [callerid_authentication_over_cardnumber] =>
a2billing.php: [sip_iax_friends] =>
a2billing.php: [sip_iax_pstn_direct_call_prefix] => 9
a2billing.php: [sip_iax_pstn_direct_call] => 1
a2billing.php: [extracharge_did] => Array
a2billing.php: (
a2billing.php: [0] =>
a2billing.php: )
a2billing.php:
a2billing.php: [extracharge_fee] => Array
a2billing.php: (
a2billing.php: [0] =>
a2billing.php: )
a2billing.php:
a2billing.php: [dialcommand_param] => |30|HL(%timeout%:61000:30000)
a2billing.php: [dialcommand_param_sipiax_friend] => |30|HL(3600000:61000:30000)
a2billing.php: [switchdialcommand] =>
a2billing.php: [maxtime_tocall_negatif_free_route] => 5400
a2billing.php: [send_reminder] =>
a2billing.php: [record_call] =>
a2billing.php: [monitor_formatfile] => gsm
a2billing.php: [base_currency] => ars
a2billing.php: [agi_force_currency] =>
a2billing.php: [currency_association] => Array
a2billing.php: (
a2billing.php: [0] => usd:prepaid-dollar
a2billing.php: [1] => mxn:pesos
a2billing.php: [2] => eur:euro
a2billing.php: [3] => ars:pesos
a2billing.php: [4] => all:credit
a2billing.php: )
a2billing.php:
a2billing.php: [file_conf_enter_destination] => prepaid-enter-dest
a2billing.php: [file_conf_enter_menulang] => prepaid-menulang2
a2billing.php: [currency_association_internal] => Array
a2billing.php: (
a2billing.php: [usd] => prepaid-dollar
a2billing.php: [mxn] => pesos
a2billing.php: [eur] => euro
a2billing.php: [ars] => pesos
a2billing.php: [all] => credit
a2billing.php: )
a2billing.php:
a2billing.php: )
a2billing.php:
a2billing.php: AGI Request:
a2billing.php: Array
a2billing.php: (
a2billing.php: [agi_request] => a2billing.php
a2billing.php: [agi_channel] => SIP/0168140206-9e5b
a2billing.php: [agi_language] => en
a2billing.php: [agi_type] => SIP
a2billing.php: [agi_uniqueid] => 1156857372.13
a2billing.php: [agi_callerid] => 975952314404328
a2billing.php: [agi_calleridname] => Natalio
a2billing.php: [agi_callingpres] => 0
a2billing.php: [agi_callingani2] => 0
a2billing.php: [agi_callington] => 0
a2billing.php: [agi_callingtns] => 0
a2billing.php: [agi_dnid] => 999
a2billing.php: [agi_rdnis] => unknown
a2billing.php: [agi_context] => a2billing
a2billing.php: [agi_extension] => 999
a2billing.php: [agi_priority] => 3
a2billing.php: [agi_enhanced] => 0.0
a2billing.php: [agi_accountcode] => 0168140206
a2billing.php: )
a2billing.php:
a2billing.php: line:490 get_agi_request_parameter = 975952314404328 ; SIP/0168140206-9e5b ; 1156857372.13 ; 0168140206 ; 999
a2billing.php: line:138 - [ANSWER CALL]
a2billing.php: line:1470 - SELECT credit, tariff, activated, inuse, simultaccess, typepaid, creditlimit, language, removeinterprefix, redial, enableexpire, UNIX_TIMESTAMP(expirationdate), expiredays, nbused, UNIX_TIMESTAMP(firstusedate), UNIX_TIMESTAMP(cc_card.creationdate), cc_card.currency, cc_card.lastname, cc_card.firstname, cc_card.email, cc_card.uipass, cc_card.id_campaign, cc_card.id, useralias FROM cc_card LEFT JOIN cc_tariffgroup ON tariff=cc_tariffgroup.id WHERE username='0168140206'
a2billing.php: line:1473 - Array
a2billing.php: line:519 - UPDATE cc_card SET inuse=inuse+1 WHERE username='0168140206'
a2billing.php: line:166 - [CHANNEL STATUS : 6 = Line is up]
a2billing.php: line:170 - [CREDIT STATUS : 7.90000]
a2billing.php: line:171 - [CREDIT MIN_CREDIT_2CALL : 0]
a2billing.php: line:544 - && && 3&& 0
-- Playing 'prepaid-enter-dest' (language 'es')
a2billing.php: line:551 - RES DTMF :
a2billing.php: line:571 - DESTINATION ::>
a2billing.php: line:573 - APPLY_RULES DESTINATION ::>
a2billing.php: line:166 - [CHANNEL STATUS : 6 = Line is up]
a2billing.php: line:170 - [CREDIT STATUS : 7.90000]
a2billing.php: line:171 - [CREDIT MIN_CREDIT_2CALL : 0]
a2billing.php: line:544 - 0 && && 3&& 1
-- Playing 'prepaid-enter-dest' (language 'es')
a2billing.php: line:551 - RES DTMF : 9995334993676
a2billing.php: line:571 - DESTINATION ::> 9995334993676
a2billing.php: line:573 - APPLY_RULES DESTINATION ::> 9995334993676
a2billing.php: line:612 - OK - RESFINDRATE::> 1
a2billing.php: line:634 - RES_ALL_CALCULTIMEOUT ::> 1
a2billing.php: line:651 - TIMEOUT::> 5400 : minutes=90 - seconds=0
a2billing.php: line:819 - app_callingcard: Dialing 'SIP/127.0.0.1/5334993676|30|HL(5400000:61000:30000)' with timeout of '5400'.
a2billing.php:
-- AGI Script Executing Application: (Dial) Options: (SIP/127.0.0.1/5334993676|30|HL(5400000:61000:30000))
-- Limit Data for this call:
-- - timelimit = 5400000
-- - play_warning = 61000
-- - play_to_caller= yes
-- - play_to_callee= no
-- - warning_freq = 30000
-- - start_sound = UNDEF
-- - warning_sound = timeleft
-- - end_sound = UNDEF
-- Called 127.0.0.1/5334993676
-- Got SIP response 482 "Loop Detected" back from 127.0.0.1
-- Now forwarding SIP/0168140206-9e5b to 'Local/5334993676@from-sip-external' (thanks to SIP/127.0.0.1-7d0a)
-- Executing NoOp("Local/5334993676@from-sip-external-50bc,2", "Received incoming SIP connection from unknown peer to 5334993676") in new stack
-- Executing Set("Local/5334993676@from-sip-external-50bc,2", "DID=5334993676") in new stack
-- Executing Goto("Local/5334993676@from-sip-external-50bc,2", "s|1") in new stack
-- Goto (from-sip-external,s,1)
-- Executing GotoIf("Local/5334993676@from-sip-external-50bc,2", "0?from-trunk|5334993676|1") in new stack
-- Executing Set("Local/5334993676@from-sip-external-50bc,2", "TIMEOUT(absolute)=15") in new stack
-- Channel will hangup at 2006-08-29 13:16:48 UTC.
-- Executing Answer("Local/5334993676@from-sip-external-50bc,2", "") in new stack
-- Local/5334993676@from-sip-external-50bc,1 answered SIP/0168140206-9e5b
-- Executing Wait("Local/5334993676@from-sip-external-50bc,2", "2") in new stack
-- Executing Playback("Local/5334993676@from-sip-external-50bc,2", "ss-noservice") in new stack
-- Playing 'ss-noservice' (language 'en')
-- Executing NoOp("Local/5334993676@from-sip-external-50bc,2", "Hangup") in new stack
-- Executing Set("Local/5334993676@from-sip-external-50bc,2", "DID=s") in new stack
-- Executing Goto("Local/5334993676@from-sip-external-50bc,2", "s|1") in new stack
-- Goto (from-sip-external,s,1)
-- Executing GotoIf("Local/5334993676@from-sip-external-50bc,2", "0?from-trunk|s|1") in new stack
-- Executing Set("Local/5334993676@from-sip-external-50bc,2", "TIMEOUT(absolute)=15") in new stack
-- Channel will hangup at 2006-08-29 13:16:53 UTC.
-- Executing Answer("Local/5334993676@from-sip-external-50bc,2", "") in new stack
a2billing.php: line:931 - -> dialstatus : ANSWER, answered time is 5
a2billing.php:
a2billing.php: line:706 - INSERT INTO cc_call (uniqueid,sessionid,username,nasipaddress,starttime,sessiontime, calledstation, terminatecause, stoptime, calledrate, sessionbill, calledcountry, calledsub, destination, id_tariffgroup, id_tariffplan, id_ratecard, id_trunk, src, sipiax, buyrate, buycost) VALUES ('2156857372.13', 'SIP/0168140206-9e5b', '0168140206', '', CURRENT_TIMESTAMP - INTERVAL 5 SECOND , '5', '9995334993676', 'ANSWER', now(), '0', '-0', '', '', 'Internos Locales (sin costo)', '1', '5', '5', '4', '975952314404328', '0', '0', '0')
a2billing.php: line:729 - UPDATE cc_card SET credit= credit+0 , redial='9995334993676' , lastuse=now(), nbused=nbused+1 WHERE username='0168140206'
a2billing.php: line:735 - UPDATE cc_trunk SET secondusedreal = secondusedreal + 5 WHERE id_trunk='4'
a2billing.php: line:739 - UPDATE cc_tariffplan SET secondusedreal = secondusedreal + 5 WHERE id='5'
a2billing.php: line:166 - [CHANNEL STATUS : 6 = Line is up]
a2billing.php: line:170 - [CREDIT STATUS : 7.9]
a2billing.php: line:171 - [CREDIT MIN_CREDIT_2CALL : 0]
a2billing.php: line:544 - 0 && && 3&& 2
-- Playing 'prepaid-enter-dest' (language 'es')
a2billing.php: line:551 - RES DTMF : -1
a2billing.php: line:571 - DESTINATION ::> -1
a2billing.php: line:573 - APPLY_RULES DESTINATION ::> -1
My interpretation is that the call is been redirected to context "from-sip-external". Which I detail here:
Code:
[from-sip-external]
;give external sip users congestion and hangup
; Yes. This is _really_ meant to be _. - I know asterisk whinges about it, but
; I do know what I'm doing. This is correct.
exten => _.,1,NoOp(Received incoming SIP connection from unknown peer to ${EXTEN})
exten => _.,n,Set(DID=${IF($["${EXTEN:1:2}"=""]?s:${EXTEN})})
exten => _.,n,Goto(s,1)
exten => s,1,GotoIf($["${ALLOW_SIP_ANON}"="yes"]?from-trunk,${DID},1)
exten => s,n,Set(TIMEOUT(absolute)=15)
exten => s,n,Answer
exten => s,n,Wait(2)
exten => s,n,Playback(ss-noservice)
exten => s,n,Congestion
exten => s,n,Hangup
exten => h,1,NoOp(Hangup)
exten => i,1,NoOp(Invalid)
exten => t,1,NoOp(Timeout)
I hope that someone (gue?) can stay with me
!