Support A2Billing :

provided by Star2Billing S.L.

Support A2Billing :
It is currently Thu Apr 18, 2024 4:18 am
Voice Broadcast System


All times are UTC




Post new topic Reply to topic  [ 27 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: Calling Cards application: wrong billing
PostPosted: Fri Jan 27, 2012 12:03 pm 
Offline

Joined: Fri Jan 18, 2008 9:54 pm
Posts: 135
Hello Ubunter,

Sorry for being away all that long.
Unfortunately, currently, I have no box within my reach to help reproduce your case, I will have to rely on you to trace and report.

Please elaborate on this :
Quote:
a2billing is inserting in the DB correctly the duration, but something wrong, which is finally not billing the call as it's...


Doy you mean that CDR in the cc_call table is written with correct values ? 14 sec ?


Top
 Profile  
 
 Post subject: Re: Calling Cards application: wrong billing
PostPosted: Fri Jan 27, 2012 3:44 pm 
Offline

Joined: Sun Nov 07, 2010 10:00 pm
Posts: 253
Sorry, let me clarify, because I'm doing chaos exposing my issue, and making you chaos to answer me...:)

I mean, that the records was inserted, apparently correct into the DB, but in the a2billing wasn't showing correct, is that the previous trace, which I provide, what showing correct insert, but the a2billing CDR and the cost wasn't billed properly...

NOW, to be concret:

I just placed a call, this morning, to test, and the call was inserted in the DB as below:
Quote:
mysql> SELECT * FROM cc_call where id='161299';
+--------+-------------------------------+-------------------------------+---------+--------------+---------------------+---------------------+-------------+---------------+-------------+----------------+---------------+-------------+----------+--------+------+--------+---------+-----------------------+------------------+---------+------------------+-------------+
| id | sessionid | uniqueid | card_id | nasipaddress | starttime | stoptime | sessiontime | calledstation | sessionbill | id_tariffgroup | id_tariffplan | id_ratecard | id_trunk | sipiax | src | id_did | buycost | id_card_package_offer | real_sessiontime | dnid | terminatecauseid | destination |
+--------+-------------------------------+-------------------------------+---------+--------------+---------------------+---------------------+-------------+---------------+-------------+----------------+---------------+-------------+----------+--------+------+--------+---------+-----------------------+------------------+---------+------------------+-------------+
| 161299 | Local/7777@callingcard-b01a;2 | My Telecom-1327674666.161 | 1 | | 2012-01-27 15:32:03 | 2012-01-27 15:32:03 | 0 | 376122930857 | -0 | 1 | 8 | 118908 | 7 | 0 | 65893 | NULL | 0.00000 | NULL | 0 | unknown | 1 | 375 |
+--------+-------------------------------+-------------------------------+---------+--------------+---------------------+---------------------+-------------+---------------+-------------+----------------+---------------+-------------+----------+--------+------+--------+---------+-----------------------+------------------+---------+------------------+-------------+
1 row in set (0.00 sec)


As you can see, the call duration is inserted as 0, started, and ended at the same time, so in a2billing CDR it's showing 0 duration, and there's no cost... but i was talking 14 seconds, and in the provider it was billed as 17 seconds, but here it's not billed at all... as you can so....

Comparing this with Asterisk CDR also, look what I found:
Quote:
65893 7777 inbound-from-sip-pstn "65893" <65893> SIP/65893-0000006b Local/7777@callingcard-b01a;1 Dial local/7777@callingcard 2012-01-27 14:31:06 2012-01-27 14:31:06 2012-01-27 14:32:19 73 73 ANSWERED DOCUMENTATION My Telecom-1327674666.159



Conclusion, the call is handled, as you can see, in asterisk is recorded the starting and the ending time, but in a2billing it's not accurate with the really registered and handled by asterisk...

I hope that I expose properly the issue...

And thanks for you help in advance:)
Regards,


Top
 Profile  
 
 Post subject: Re: Calling Cards application: wrong billing
PostPosted: Fri Jan 27, 2012 8:52 pm 
Offline

Joined: Mon Jan 08, 2007 6:56 pm
Posts: 345
first,
Instead of creating a test DID 7777 and going in a circle. Delete that and send the call directly to the calling card context.

sip.conf
[8000]
defaultuser=
secret=
canreinvite=yes
context=callingcard
type=friend
nat=
disallow=all
allow=ulaw

exntensions.conf
[callingcard]
exten => _X.,n,Wait(1)
exten => _X.,n,AGI(a2billing.php,1)
exten => _X.,n,Wait(1)
exten => _X.,n,Hangup()



If and when you want to use a real DID, you would NOT define it in A2b but in Asterisk then let Asterisk direct it to the calling card context.
eg;
[voipilink]
type=friend
insecure=port,invite
host=xx.xx.xx.xx
dtmfmode=rfc2833
context=from-pstn
disallow=all
allow=ulaw

[from-pstn]
exten => 18665554444,1,Goto(callingcard,${EXTEN},1)

Second,

Code:
dialcommand_param = ,60,LIW(%TIMEOUT(absolute)=3600%:60000:30000)

make no sense to A2B or asterisk.

A2B is expecting formats such as:
Code:
|60|HiL(%timeout%:61000:30000)
|60|HiL(%timeoutsec%:61000:30000)
|60|HiL(36000000:61000:30000)

Asterisk expecting this:
Code:
|60|HiL(36000000:61000:30000)


setting the asterisk version to 1_6 will change "|" to ",". You do not need to change that yourself.

Give this a test and report back.


Top
 Profile  
 
 Post subject: Re: Calling Cards application: wrong billing
PostPosted: Fri Jan 27, 2012 10:25 pm 
Offline

Joined: Sun Nov 07, 2010 10:00 pm
Posts: 253
vulcan wrote:
first,
Instead of creating a test DID 7777 and going in a circle. Delete that and send the call directly to the calling card context.

sip.conf
[8000]
defaultuser=
secret=
canreinvite=yes
context=callingcard
type=friend
nat=
disallow=all
allow=ulaw

Ok, here, may have reason, even it's just for testing...but done :)

Quote:
exntensions.conf
[callingcard]
exten => _X.,n,Wait(1)
exten => _X.,n,AGI(a2billing.php,1)
exten => _X.,n,Wait(1)
exten => _X.,n,Hangup()


This is the Unique which i changed, i had this:

Quote:
[callingcard]
exten => _X.,1,NoOp(A2Billing Start)
exten => _X.,n,Agi(a2billing.php,1)
exten => _X.,n,Hangup()


And I change it but what do you propose, but giving the wait priority 1.

Quote:
If and when you want to use a real DID, you would NOT define it in A2b but in Asterisk then let Asterisk direct it to the calling card context.

[from-pstn]
exten => 18665554444,1,Goto(callingcard,${EXTEN},1)


I had this:
Quote:
exten => 9510000000,1,Dial(local/${EXTEN}@callingcard)



So, just after modifying the dialplan, and change the dial by goto, it seem to be working..!! Strange, where's the different between dial and goto in the dialpan, it's the same, no?? Or even, the wait application...

No idea, but with this changes i just placed calls for the calling card application, all are properly billed and correct!! Strange... I can't explain it to myself :)


Quote:
Second,

Code:
dialcommand_param = ,60,LIW(%TIMEOUT(absolute)=3600%:60000:30000)

make no sense to A2B or asterisk.

A2B is expecting formats such as:
Code:
|60|HiL(%timeout%:61000:30000)
|60|HiL(%timeoutsec%:61000:30000)
|60|HiL(36000000:61000:30000)

Asterisk expecting this:
Code:
|60|HiL(36000000:61000:30000)



After experiences, we had to impose several restrictions, as using the timeout absolute, to avoid negative balance with large calls duration, avoid call transfer in the dialcommand, and elsewhere...

But, as i said, without touching the dialcommand, just modifying the dialplan, it's working and billing properly....

I'm really wondering, as i know, Goto and dial have equal and similar functions...


Thanks again, really for BOTH :)
Regards,


Top
 Profile  
 
 Post subject: Re: Calling Cards application: wrong billing
PostPosted: Sat Jan 28, 2012 12:12 am 
Offline

Joined: Mon Jan 08, 2007 6:56 pm
Posts: 345
Yes I should have changed wait(1) to priority 1.

Technically a "Dial" is creating a channel and the call will remain in the same context it started in unless changed explicitly. By the time A2B receives control there are already two channels active for the call. The channel when you dial the digits and the channel when Dial is executed.

A2B normally operates on the primary channel and then creates the destination channel by dialling out the call.

"Goto" does not start a new channel, it only passes control to the destination context. In this case, A2B knows what the primary channel is.


Code:
a2billing.php,1: file:Class.RateEngine.php - line:1157 - uniqueid:mydomain.com-1320748576.10 - [TRUNK STATUS UPDATE : UPDATE cc_trunk SET inuse=inuse+1 WHERE id_trunk='10']
    -- AGI Script Executing Application: (DIAL) Options: (SIP/TrunkC/********#346*********,60,LIW(%TIMEOUT(absolute)=3600%:60000:30000))
  == Using UDPTL TOS bits 184
  == Using UDPTL CoS mark 5
  == Using SIP RTP TOS bits 184
  == Using SIP RTP CoS mark 5
    -- Called SIP/TrunkC/********#346*********
    -- SIP/TrunkC-00000009 is making progress passing it to Local/7777@callingcard-67b2;2
    -- Local/7777@callingcard-67b2;2 requested special control 20, passing it to SIP/TrunkC-00000009
    -- Local/7777@callingcard-67b2;2 requested special control 20, passing it to SIP/TrunkC-00000009
    -- SIP/TrunkC-00000009 is ringing


As for your dial string, take a look and you'll see it is passed raw (as is) to asterisk. No conversion done. If I recall, Asterisk stops processing the dial string options at the first error. So in you case all asterisk might be doing is ,60,

Even if you are correct in your timeout value, The "L" should pertain to the value in the brackets eg; L(xxxx:xxx:xxx)

%xxxx% is known as a token in programming, A2B uses it not Asterisk.


Correct me if I'm wrong and explain how that dial string works.


Top
 Profile  
 
 Post subject: Re: Calling Cards application: wrong billing
PostPosted: Sat Jan 28, 2012 10:30 am 
Offline

Joined: Sun Nov 07, 2010 10:00 pm
Posts: 253
Hi Vulcan,
To syntetize, I just retest, and retest again, when I use the Dial application, calls are not properly billed, and causing of that, also i have detected the incomming call showing always as 0 duration in a2billing, but as i wasn't billing for incoming, so I didn't took care for this, before I had this:
Quote:
;exten => _X.,1,Dial(local/0034${EXTEN}@a2billing-did)


and all calls was showing 0 duration, and now after turning to:
Quote:
exten => _X.,1,Goto(a2billing-did,0034${EXTEN},1)


All seem to be properly registered, billed, or recorded in a2billing environment.

About your question, regarding to the dialcommand. The issue, first, even, right now we have solved partially with your previous patch, for the realtime billing, is, that we faced a scam user who was placing large duration calls, and also to avoid calls stacking, and else, so we need to put a maximum duration for each call, so in Asterisk 1.8 it's working properly the new directive AbsolutTimeout which sustitute the previous Timeout, look here: http://www.voip-info.org/wiki/view/Aste ... uteTimeout.
Even, I'm setting the maximum timeout in several reviews, one in the a2billing dialcommand, then in asterisk itself as maximum call duration, and also, as calllimit to limit the channels.
Where also I'm setting this in the dialplan, as my voip dialplan is this:
Quote:
exten => _X.,1,NoOp(A2Billing Start)
exten => T,1,Set(TIMEOUT(absolute)=3600)
exten => _X.,n,Agi(a2billing.php,2)
exten => _X.,n,Congestion()
exten => _X.,n,Hangup()


I'm thinking, but not deeply away of the difference between your proposed wait application:
Quote:
exten => _X.,1,Wait(1)

Any my actual:
Quote:
exten => _X.,1,NoOp(A2Billing Start)


Anyway, my actual dialcommand is this:
Quote:
,60,LIWXo(%TIMEOUT(absolute)=3600%:60000:30000)


But with this, we really succeed to block abusive incoming calls, call transfers, call forward, and elsewhere of fraud possibilities...

If I'm mistaking, thanks to advice, or correct me:)
Regards,


Top
 Profile  
 
 Post subject: Re: Calling Cards application: wrong billing
PostPosted: Sat Jan 28, 2012 6:56 pm 
Offline

Joined: Mon Jan 08, 2007 6:56 pm
Posts: 345
The wait application is not necessary, it was an example context.

I've already said your dial string is incorrect and is not doing what you think it is doing.

Again, it is invalid!!! and not only that, you are not allowing A2B to set the timeout of the call based on the credit and the destination.

When A2B reads the conf1 it replaces the place holder %timeout% with the calculated timeout. Surely you must be aware of that.

This %TIMEOUT(absolute)=3600% means nothing to A2B and Asterisk does nothing with it.

You are attempting to set all calls to a maximum call time of 3600 seconds (1 hour) regardless of credit. So if I have .10 balance I'll get 1 Hour of call if it worked.

I can only suggest a correct dial string based on what i've seen. This is the exact format (no commas , use pipe only. notice the "L" is last and pertains to the brackets).


Code:
|60|IWXoL(%timeout%:60000:30000)


Top
 Profile  
 
 Post subject: Re: Calling Cards application: wrong billing
PostPosted: Sat Jan 28, 2012 8:16 pm 
Offline

Joined: Sun Nov 07, 2010 10:00 pm
Posts: 253
[quote]|60|IWXoL(%timeout%:60000:30000)/quote]

Ok, it's clear, but why pipe only?? it's v.1.8 of asterisk... need commas, no??


Top
 Profile  
 
 Post subject: Re: Calling Cards application: wrong billing
PostPosted: Sat Jan 28, 2012 9:17 pm 
Offline

Joined: Mon Jan 08, 2007 6:56 pm
Posts: 345
A2B is designed for many different versions of asterisk so the pipe is used in the dial string. It gets automatically converted based on asterisk version wen you set for example asterisk_version 1_6. Even though you have 1.8 asterisk 1.6 also uses commas so it will work.

It does not affect anything if you change it to commas, but to maintain consistency to the other dial strings and keeping the current A2B standard for simplicity.

A future A2B version will probably give a 1_8 option to make it look better.

By the way, you should install the second patch I uploaded because you installed the first. viewtopic.php?f=34&t=9308


Top
 Profile  
 
 Post subject: Re: Calling Cards application: wrong billing
PostPosted: Sat Jan 28, 2012 10:39 pm 
Offline

Joined: Sun Nov 07, 2010 10:00 pm
Posts: 253
Hmm, you're right, as I see, i just re-edit the dialcommand string as:
Quote:
|60|IWXoL(%timeout%:60000:30000)


Then retesting, i see asterisk cli printing:
Quote:
,60,IWXoL(1231950000:60000:30000)


Ok, we always was advising each other on forums to adapt the dialcommand to asterisk 1.8, this is the first time that i hear that a2billing is adapting the string himself...

great...
Thank you :)


Top
 Profile  
 
 Post subject: Re: Calling Cards application: wrong billing
PostPosted: Sun Sep 29, 2013 9:21 am 
Offline

Joined: Sun Sep 29, 2013 9:18 am
Posts: 3
Hello,

There is a huge variety of international cards that are available nowadays and you can easily purchase them from your nearly departmental stores. If you do not have the time to visit a store you can simply purchase an international phone cards online over the Internet. There are several online phone card vendors that offer a wide range of international phone cards.


Top
 Profile  
 
 Post subject: Re: Calling Cards application: wrong billing
PostPosted: Sun Sep 29, 2013 4:01 pm 
Offline

Joined: Sun Nov 07, 2010 10:00 pm
Posts: 253
neial2007 wrote:
Hello,

There is a huge variety of international cards that are available nowadays and you can easily purchase them from your nearly departmental stores. If you do not have the time to visit a store you can simply purchase an international phone cards online over the Internet. There are several online phone card vendors that offer a wide range of international phone cards.


SPAM!!!! :furious:


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 27 posts ]  Go to page Previous  1, 2
Predictive Dialer


All times are UTC


Who is online

Users browsing this forum: No registered users and 14 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group