A2Billing FastAGI tcp socket issue
Page 1 of 1

Author:  De`Facto [ Mon Sep 01, 2014 8:48 am ]
Post subject:  A2Billing FastAGI tcp socket issue

Hi All,

I'm trying to expand A2Billing(using version v2.0.14) on 2 separate servers as follows:

server 1 should proccess asterisk(1.8) + web portal
server 2 should proccess the billing script(a2billing.php) and DB(MySQL)

I've managed to make it work regarding call proccessing, although I have the following problem:

The asterisk initiates FastAGI communication and everything works well and the billing works well if the Called side hangs up. However if the Caller hangs up then I have the call filed in the database, but the duration isn't inserted and the call isn't billed. I've managed to find out the following in the asterisk logs:

VERBOSE[3845] res_agi.c: <SIP/3354110529-00376c34>AGI Tx >> 200 result=-1
VERBOSE[3845] res_agi.c: <SIP/3354110529-00376c34>AGI Tx >> HANGUP
VERBOSE[3845] res_agi.c: <SIP/3354110529-00376c34>AGI Rx << GET VARIABLE ANSWEREDTIME
VERBOSE[3845] res_agi.c: <SIP/3354110529-00376c34>AGI Tx >> 200 result=1 (4)
VERBOSE[3845] res_agi.c: <SIP/3354110529-00376c34>AGI Rx << GET VARIABLE DIALSTATUS
VERBOSE[3845] res_agi.c: <SIP/3354110529-00376c34>AGI Tx >> 200 result=1 (ANSWER)
VERBOSE[3845] res_agi.c: <SIP/3354110529-00376c34>AGI Rx << HANGUP
VERBOSE[3845] res_agi.c: <SIP/3354110529-00376c34>AGI Tx >> 511 Command Not Permitted on a dead channel
VERBOSE[3845] res_agi.c: -- <SIP/3354110529-00376c34>AGI Script agi:// completed, returning 4
VERBOSE[3845] res_agi.c: <SIP/3354110529-00376c34>AGI Tx >> HANGUP
ERROR[3845] utils.c: write() returned error: Broken pipe

I suppose that the tcp socket is being closed and the script doesn't exit properly, although there are no errors in the php log, that's why there is no update in the DB.

Did someone handled that issue before? Any Ideas?

Thanks in advance :)

Author:  webudo [ Mon Apr 23, 2018 5:12 am ]
Post subject:  Re: A2Billing FastAGI tcp socket issue

Hello De Facto

Did you manage to make it work?
Without seeing your post, I tried the same thing using xinetd with this method: ... agi-script

Got the same issue.
If A hangs up the call, billing goes ok.
if B hangs up the call, no answered or session time is logged.

What I noticed on the agi log file using level 4 (debug) is this:
[file:Class.RateEngine.php - line:1043 - uniqueid:1524426141.270861]:[CallerID:XXXXXXX]:[CN:1065]:[:[sessiontime:GUP - id_cc_package_offer:-1 - package2apply:]

It does not show the same on asterisk console using level 4 (verbose). Sessiontime shows empty:
:[sessiontime: - id_cc_package_offer:-1 - package2apply:]

I even changed the source code so if $sessiontime = "GUP" then set sessiontime to a static value of 33, and then noticed IF statement returned true because calls are 33 on the logs, but then other parts of the log that reference "sessiontime" get wrong values again.

I modified every get_variable("ANSWEREDTIME") to get_variable("CDR(billsec)") with no luck :(

Anyone has a clue?

Author:  GeekBoy [ Mon Jul 09, 2018 3:18 pm ]
Post subject:  Re: A2Billing FastAGI tcp socket issue

Did you try the newest version, though a new version has not come out in 3+ years

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group