asterisk2billing.org
http://forum.asterisk2billing.org/

Calls are not Billed
http://forum.asterisk2billing.org/viewtopic.php?f=33&t=12596
Page 1 of 1

Author:  spectris [ Sat Oct 22, 2016 5:24 pm ]
Post subject:  Calls are not Billed

Hi all
i relally need your help on this issue blocking my installation.

I'm trying to enable billing for SIP customers that will call trough a sip trunk (italygw) their wanted destination numbers.
The call is well routed and parties can talk each other. I can see the agi script is triggered so , basically the call is well managed .

The sad part is that billing of the call is not working .
2 things are worth of noting during a call : -
- session time remains always 0
- the agi script return always value 4


I'm using
Ubuntu 16.06 +
a2billing 2.2 +
php7 +
asterisk 13


Thanks a lot for your attention

have a nice day

This i an exerpt of a call from customer to 081XXX (took from asterisk cli) :

a2billing.php: file:Class.RateEngine.php - line:1223 - uniqueid:1477155680.36 - [TRUNK STATUS UPDATE : UPDATE cc_trunk SET inuse = inuse + 1 WHERE id_trunk = '3']
-- AGI Script Executing Application: (DIAL) Options: (SIP/italygw/081XXX,60,HRrL(12000000:61000:30000))
> Limit Data for this call:
> timelimit = 12000000 ms (12000.000 s)
> play_warning = 61000 ms (61.000 s)
> play_to_caller = yes
> play_to_callee = no
> warning_freq = 30000 ms (30.000 s)
> start_sound =
> warning_sound = timeleft
> end_sound =
== Using SIP RTP CoS mark 5
-- Called SIP/italygw/081204
-- SIP/italygw-00000019 answered SIP/3980726XXX-00000018
-- Channel SIP/3980726XXX-00000018 joined 'simple_bridge' basic-bridge <4b0b8837-3e1a-40c8-b67b-7805ab97fe44>
-- Channel SIP/italygw-00000019 joined 'simple_bridge' basic-bridge <4b0b8837-3e1a-40c8-b67b-7805ab97fe44>
> 0x7f546c014100 -- Probation passed - setting RTP source address to XXX.74.XXX.117:5004
> 0x7f5460193ca0 -- Probation passed - setting RTP source address to XXX.74.XXX.117:16490
-- Channel SIP/italygw-00000019 left 'simple_bridge' basic-bridge <4b0b8837-3e1a-40c8-b67b-7805ab97fe44>
-- Channel SIP/3980726XXX-00000018 left 'simple_bridge' basic-bridge <4b0b8837-3e1a-40c8-b67b-7805ab97fe44>
a2billing.php: file:Class.RateEngine.php - line:1336 - uniqueid:1477155680.36 - DIAL SIP/italygw/081XXX|60|HRrL(12000000:61000:30000)
a2billing.php: file:Class.RateEngine.php - line:1223 - uniqueid:1477155680.36 - [TRUNK STATUS UPDATE : UPDATE cc_trunk SET inuse = inuse - 1 WHERE id_trunk = '3']
[Oct 22 20:01:34] ERROR[7171][C-000005dc]: utils.c:1402 ast_carefulwrite: write() returned error: Broken pipe
[Oct 22 20:01:34] ERROR[7171][C-000005dc]: utils.c:1402 ast_carefulwrite: write() returned error: Broken pipe
[Oct 22 20:01:34] ERROR[7171][C-000005dc]: utils.c:1402 ast_carefulwrite: write() returned error: Broken pipe
a2billing.php: file:Class.RateEngine.php - line:1490 - uniqueid:1477155680.36 - [USEDRATECARD=0]
[Oct 22 20:01:34] ERROR[7171][C-000005dc]: utils.c:1402 ast_carefulwrite: write() returned error: Broken pipe
a2billing.php: file:Class.RateEngine.php - line:1038 - uniqueid:1477155680.36 - :[sessiontime: - id_cc_package_offer:-1 - package2apply:]
[Oct 22 20:01:34] ERROR[7171][C-000005dc]: utils.c:1402 ast_carefulwrite: write() returned error: Broken pipe
a2billing.php:
[Oct 22 20:01:34] ERROR[7171][C-000005dc]: utils.c:1402 ast_carefulwrite: write() returned error: Broken pipe
a2billing.php:
[Oct 22 20:01:34] ERROR[7171][C-000005dc]: utils.c:1402 ast_carefulwrite: write() returned error: Broken pipe
a2billing.php: file:Class.RateEngine.php - line:1114 - uniqueid:1477155680.36 - [CC_RATE_ENGINE_UPDATESYSTEM: usedratecard K=0 - (sessiontime=0 :: dialstatus= :: buycost=0 :: cost= : signe_cc_call=-: signe=+)]
[Oct 22 20:01:34] ERROR[7171][C-000005dc]: utils.c:1402 ast_carefulwrite: write() returned error: Broken pipe
a2billing.php: file:Class.RateEngine.php - line:1174 - uniqueid:1477155680.36 - [CC_asterisk_stop : SQL: DONE : result=1]
[Oct 22 20:01:34] ERROR[7171][C-000005dc]: utils.c:1402 ast_carefulwrite: write() returned error: Broken pipe
a2billing.php: file:Class.RateEngine.php - line:1175 - uniqueid:1477155680.36 - [CC_asterisk_stop : SQL: INSERT INTO cc_call (uniqueid, sessionid, card_id, nasipaddress, starttime, sessiontime, real_sessiontime, calledstation, terminatecauseid, stoptime, sessionbill, id_tariffgroup, id_tariffplan, id_ratecard, id_trunk, src, sipiax, buycost, id_card_package_offer, dnid, destination , a2b_custom1, a2b_custom2) VALUES ('1477155680.36',
'SIP/3980726483-00000018', '2', '', SUBDATE(CURRENT_TIMESTAMP, INTERVAL 0 SECOND) , '0', NULL, '081204', 0, now() , '-0', '1', '1', '2', '3', '3980726XXX', '0', '0', NULL, '081XXX', '0' , '', '')]
[Oct 22 20:01:34] ERROR[7171][C-000005dc]: utils.c:1402 ast_carefulwrite: write() returned error: Broken pipe
a2billing.php: file:a2billing.php - line:578 - uniqueid:1477155680.36 - [a2billing account stop]
[Oct 22 20:01:34] ERROR[7171][C-000005dc]: utils.c:1402 ast_carefulwrite: write() returned error: Broken pipe
[Oct 22 20:01:34] ERROR[7171][C-000005dc]: utils.c:1402 ast_carefulwrite: write() returned error: Broken pipe
a2billing.php: file:Class.A2Billing.php - line:787 - uniqueid:1477155680.36 - [CARD STATUS UPDATE]
[Oct 22 20:01:34] ERROR[7171][C-000005dc]: utils.c:1402 ast_carefulwrite: write() returned error: Broken pipe
a2billing.php: file:Class.A2Billing.php - line:796 - uniqueid:1477155680.36 - [QUERY USING CARD UPDATE::> UPDATE cc_card SET inuse = inuse - 1, credit = credit + 0.25 WHERE username = '3980726XXX']
[Oct 22 20:01:34] ERROR[7171][C-000005dc]: utils.c:1402 ast_carefulwrite: write() returned error: Broken pipe
-- <SIP/3980726XXX-00000018>AGI Script a2billing.php completed, returning 4
== Spawn extension (a2billing, 081204, 2) exited non-zero on 'SIP/3980726XXX-00000018'

Author:  spectris [ Sat Oct 22, 2016 10:07 pm ]
Post subject:  Re: Calls are not Billed

Hi all rgearding my issue, I aslo downgraded astersik to versione 11.23 but he issue is still there

no call is billed.

any idea please?

Author:  spectris [ Sun Oct 23, 2016 9:09 am ]
Post subject:  Re: Calls are not Billed

following execution path I can see that sessiontime is not taking any value because answeredtime[data] = NOT DEFINED

Anyway when agi->getvariable("ANWEREDTIME") is callled , the result is reflecting the current sessiontime of the call but unluckly later this value is not used.

I cannot believe that a2billing downloadable release have a so evident uncomaptibility with asterisk agi variables protocol.

so I'll continue to consider that someother things are not working on my side

aside comment:
What I can see is that some other mates are struggling on the same and they changed ANSWEREDTIME variable with CDR(billing) . I do not want to do this now becasue I exepct that if any kind of changes like this, that for me are core changes they must be professionally managed in the downloadable package

Author:  spectris [ Sun Oct 23, 2016 2:52 pm ]
Post subject:  Re: Calls are not Billed

Maybe a phpagi bug? all of this are not setting any value in the 'data' component of the array
Code:

            $this->dialstatus = $dialstatus['data'];


           $miobill = $agi->get_variable("CDR(billsec)");

            $A2B->debug(WARN, $agi, __FILE__, __LINE__, "dialstatus=====". print_r($dialstatus,true) . "\n");
            $A2B->debug(WARN, $agi, __FILE__, __LINE__, "answered ====". $answeredtime['data'] . "\n");
            $A2B->debug(WARN, $agi, __FILE__, __LINE__, "billing=====". print_r($miobill) . "]");



Author:  spectris [ Mon Oct 24, 2016 7:24 pm ]
Post subject:  Re: Calls are not Billed

anybody out there ??

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/