VERY simple billing system

Hello!
here’s what im looking for:
people come, make phone calls, i charge them, they leave, end of story!
i got asterisk running with 4 ip phones, hooked up to voipjet.
i just need a front end software that would add up all the costs of the calls from each ip phone in a time interval. i charge it to the person that used it, i reset the amount to zero, next customer!
no prepaid, no calling cards, no routing, no extensive billing. simple as that.
of course, i need it to be open source, so i can adapt it to my needs and use it at will.
any1 seen something like this around?
astbill & a2billing, the systems ive tried, are charged with too many stuff i dont need!
thanks in advance

I’m just using logging the CDRs in a MySQL database. I’m then using a PHP app to query the records, output them as a PDF, and email the PDF to each customer. It’s very basic and only took me a weekend to write.

You’ll probably do something a bit different since my customers have monthly accounts, but the Asterisk and MySQL billing combo is a good place to start.

Do you import the CSV log into MySQL or does Asterisk write the CDR data to your MySQL directly?

It logs directly to MySQL: voip-info.org/wiki/view/Asterisk+cdr+mysql

I kinda had that idea around…
but i need it to 2 work not in real time, but quite close…
like a flash operator panel! but with an additional field that says something like “total amount”!
and that sounds like more than a week of programming… correct me if im wrong!!

[quote=“amontani”]I kinda had that idea around…
but i need it to 2 work not in real time, but quite close…
like a flash operator panel! but with an additional field that says something like “total amount”!
and that sounds like more than a week of programming… correct me if im wrong!![/quote]
I didn’t do so in the past, but when all the data is in MySQL, why don’t you trigger an AGI script at hangup, that takes the duration and the cost from MySQL and puts the total cost back to its db-field?

Do I think too simple?

now that’s a nice thought!
lets make it happen!
how complicated would it be to get on with programming in perl?

[quote=“amontani”]now that’s a nice thought!
lets make it happen!
how complicated would it be to get on with programming in perl?[/quote]
Even when my programming times are over since some years: Not very difficult, as there are enough classes for db handling out there.

If it fits better, you also can use php, py or C.

thanks
ill get it started, then ill see where i can place, so any1 intereseted might use it

and to be even more pragmatic you could just add a trigger to the cdr table in the database that calculates the total cost and stuff so you dont have to run any agi after hangup.

now there u caught me off guard! any links on “triggers to the cdr table” u got around so i can get myself started?

Triggers are a general database concept and not related to CDRs in particular.
You can learn more about MySQL triggers at
http://dev.mysql.com/tech-resources/articles/mysql-triggers.pdf

I think what is best suited in that case is an AFTER INSERT trigger.

[quote=“srt”]Triggers are a general database concept and not related to CDRs in particular.
You can learn more about MySQL triggers at
http://dev.mysql.com/tech-resources/articles/mysql-triggers.pdf

I think what is best suited in that case is an AFTER INSERT trigger.[/quote]
Definately you are right, but to use that way it needs to know WHEN and WHAT data is written to db, what I don’t know. So it needs to know whether there is a field in the db that gets an INSERT only when the call is finished.

Where to get this information?

[quote=“mstuebner”]Definately you are right, but to use that way it needs to know WHEN and WHAT data is written to db, what I don’t know. So it needs to know whether there is a field in the db that gets an INSERT only when the call is finished.

Where to get this information?[/quote]

Hmm from the source code i suppose. I just had a look at cdr_addon_mysql.c (i dont know if this is the one you are using) and there the cdr record is inserted once the call has finished.
I think thats what the other implementations do, too.
So all fields are inserted at one and a simple after insert trigger should do the trick.

[quote=“srt”]Hmm from the source code i suppose. I just had a look at cdr_addon_mysql.c (i dont know if this is the one you are using) and there the cdr record is inserted once the call has finished.
I think thats what the other implementations do, too.
So all fields are inserted at one and a simple after insert trigger should do the trick.[/quote]
Aha. That was why I wrote “programming times are over since some years”. :smile:

yep. only 1 insert. my trigger’s working fine!
thanks a lot!
now i gotta make the front end!
and here i got no experience whatsoever. im gonna say php’s the best choice to work with db on web pages? i’m i mistaken?

[color=blue][size=150]Why you did not used astcc ??[/size][/color]

Mark write it for you! :wink:

you can install this aplication from cvs:

cd /usr/src
export CVSROOT=:pserver:anoncvs:anoncvs@cvs.digium.com:/usr/cvsroot
cvs login
cvs co astcc
cd astcc
make install

very simple! :smile:

the thing’s that i dont want a calling card app… people come to the store, make a couple of calls, i charge them, and they leave to probably to hopefully come back!