sometimes when you go CDR page to check CDRs for resellers, groups or some clid in your system, but nothing there or some records missed, and then u go database and checked, find there’s data in cdr table “mycdr”, so why it’s missed in asterBilling interface? Reason 1: historyCdr issue check your asterbilling.conf.php in asterbilling web scripts folder by default the option is “useHistoryCdr = 1”, and asterbilling CDR page will go table “historycdr” to fetch data, but astercc daemon only put data to table “mycdr” untill someone “checkout” the records, the data will be moved to table “historycdr”, so if u cant find all data in web interface, change this option to “0” or “checkout” the records.
Reason 2: clid issue Even though the astercc daemon will put all CDR it get to database, but not all records will be billed, only after you set the “clid” in asterbilling. So if u see the value of fields “resellerid” and “groupid” in “mycdr” is -1, please check if u set the “clid” correctly, the “src” field should be matched with clid.
There’re some parameters in file astercc.conf for astercc daemons. We can change them to get a beter performance for asterisk billing. please note that u need to restart asterrc daemon to reload configration. refreshrate = 60 refreshrate is the seconds asterrc daemon reload data from database, when u change asterBilling setting a lot, like rate, clid … , u need this parameter, but once your system is stable, u can set it to -1, so that after asterrc load the data when it start, it would not read from database again and again. refreshlock = 30 The seconds we refresh data for astercclock to lock booth, or lock group, reseller. calculateallcdr = no when set to yes, asterrc will re-calculate all records with groupid =-1 or resellerid = -1 in mycdr table, this could be used when u want to calculate the CDRs with no billing . calculateoldcdr = no when set to yes, asterrc will re-calculate all records in mycdr table, this could be used when u want to calculate the history CDR. This could be used when your rate changed and you want to reset all credits. callbackbill = src ; src: bill src only ; dst: bill dst only ; both: both src and dst removeNonSysCDR = 0 ; if we need use asterrc to remove CDR with resellerid = -1 or groupid = -1 removeNoAnswerCDR = 0 ; if we need use asterrc to remove no answer CDR
There are three rates in asterBilling, reseller rate, callshop rate and customer rate.
- reseller rate: the rate admin sell to reseller
- callshop rate (group rate): the rate reseller sell to callshop (group)
- customer rate: the rate callshop sell to customers
Rates in asterBilling could be inherited, for example, here’s two records in resellerrate
dialpreifx = 0086
number length = 0
connect charge = 0.2
init block = 60
rate = 0.2
billing block = 60
resellerid = 0
dialpreifx = 0049
number length = 0
connect charge = 0.4
init block = 60
rate = 0.4
billing block = 60
resellerid = 0
Because we dont specify which reseller is this rate for (resellerid = 0), this rate could be used for all resellers. So what if some resellers want to change this rate rather than use this “default” rate? quite simple, just add another rate for the reseller:
dialpreifx = 0086
number length = 0
connect charge = 0.2
init block = 60
rate = 0.2
billing block = 60
resellerid = 1
so for this reseller (resellerid=1), when customer dial a number begin with 0086, it will use this new rate, we can call it “overwrite”, but for other resellers who dont set their rate, it would use the one admin setted.
Just like reseller rate, group rate could also be inherited.
A:
dialpreifx = 0086
number length = 0
connect charge = 0.2
init block = 60
rate = 0.2
billing block = 60
resellerid = 1
grouprid = 1
B:
dialpreifx = 0086
number length = 0
connect charge = 0.4
init block = 60
rate = 0.4
billing block = 60
resellerid = 1
grouprid = 0
C:
dialpreifx = 0086
number length = 0
connect charge = 0.4
init block = 60
rate = 0.4
billing block = 60
resellerid = 0
groupid = 0
so rate C is a rate for all reseller and all group, rate B is for all groups in reseller 1, rate A is only for group 1.
Through inherit rate, admin could be much easier to control the rates, like just set one rate for all resellers, and adjust some when they require some difference, also reseller could just set one rate for his callshops, and only do minor change to provide different rate plan.
asterCC package provides a call center solution and a billing solution for asterisk, the most important feature is, asterCC could work with all asterisk based solutions and no need do any modification to the original system, as we have tested, including:
- Trixbox
- Elastix
- Callweaver
- Freepbx
- Magiclink
- Fonesoft
- asterisk2billing (a2b)
- pbx in a flash
- …
so when you are using a asterisk based system and want to add call center or billing features, asterCC is a good choice.
asterCC solutions connect to your asterisk via AMI over tcp, so even a embedded asterisk equipment would use asterCC for billing or contact center.
asterCC works based callerid, so it doesnt care what’s the asterisk dialplan or how a agi work, as long as you have correct callerid in your asterisk, asterCC could work with it.
Working as daemon service in linux, asterCC is stable and extremely efficient, we have test that it could support at least 240 simultanieous asterisk calls.
Open source as all web scripts is, there’s also the possibility that you make your own solution based astercc daemons, and with the 5 free simultanieous channel license it provides by default, no need to pay a dollar for small business, like to bill an asterisk pbx with users less than 12.
asterBilling is a realtime billing solution for asterisk, could be used as a hosted callshop or just a simple billing system for your asterisk pbx. Many people are using freepbx based system as their pbx, like trixbox, elastix … so here i’ll introduce you how to use asterBilling to bill your asterisk pbx.
the first thing is, you must have freepbx installed and have a user their, say you want to bill these two users: solo <8000> and donnie <8001>
next go to asterBilling manager login (like http://asterccserver/asterbilling/manager_login.php) and login as “admin”
Although we only want to bill our pbx, still have to add a reseller first, go to “reseller” and click “Add” button, pur some message in the form and click “continue”
i left “Credit Lmit” to be null and “Limit Type” to “No limt” coz i just want to know how much each phone dialed each month.
then go to “Account Group” and add a group there
asterrc is a billing script in asterCC package, together with astercc, asterrc could provide you the realtime billing feature to your asterisk system.
there’re some billing fields in table ‘curcdr’, they are
`credit` : credit by customer rate (rates in table ‘myrate’)
`callshopcredit`: credit by callshop (rates in table ‘callshoprate’)
`resellercredit`: credit by reseller (rates in table ‘resellerrate’)
`creditlimit`: if we have a creditlimit for this call, if it has once the ‘credit’ reach the number, the call would be hang up
`destination` : destination of the call, get from table ‘myrate’
`memo` : rate of the call, get from table ‘myrate’
asterrc daemon will maintain these fields during a live call, and we have same fields in table mycdr, so when a call is finished, we can also get the credit of the call.
Also, we have billing fields in table ‘clid’, ‘accountgroup’,’resellergroup’
`curcredit` current credit (works as a billing flag)
`credit_clid` total clid credit for the item
`credit_group` total group credit for the item
`credit_reseller` total reseller credit for the item
Here’s a example to show you how asterrc works
say we have defined a rate, we sell to reseller in 0.1 a minute, reseller sell to callshop in 0.2 a minute, and callshop sell 0.4 a minute to customer, when customer start a call, astercc will get the live CDR into table curcdr, and asterrc will put value 0.4, 0.2, 0.1 to fields ‘credit’, ‘callshopcredit’, ‘resellercredit’ when it’s the first minute, and then 0.8, 0.4, 0.2 when it’s the second minute …. when it’s 2 minutes and a half, customer hangup the call, then we get a record with billing message 1.2 in ‘credit’, 0.6 in ‘callshopcredit’, 0.3 in ‘resellercredit’, meantime fields in clid, accountgroup and resellergroup would be updated, credit_clid = credit_clid + 1.2, credit_group = credit_group + 0.6, credit_reseller = credit_reseller + 0.3.
field ‘curcredit’ is used to save credit for comparing with creditlimt, it is updated after a call is finished, if limit type is set and curcredit is greater or equal with the creditlimit, the call would be hangup, when clid/group/reseller charges, we set curcredit = curcredit – {fund charged} so that curcredit is less than creditlimit and calls can go out.
Say a reseller pay you 500 euro, and u set his limit type to prepaid, and creditlimit = 500, then it is curcredit = 0, limittype= prepaid, creditlimit = 500 in table resellergroup, then booths under this reseller start to call , curcredit will increase by resellerrate, when it reachs 500, all calls stoped, reseller comes to you and charge 2000 euro, here you have two options
1. set credit limit to 500+2000 = 2500, but not recommend, coz there’d no log for changing of creditlimit
2. charge 2000 to curcredit, then curcredit = 500-2000 = -1500, and this operation would be logged in credithistory, so that you can check the charge history of each customer.
Hope this could help you under stand how asterbilling works.
In July, 2007, we start a project, the aim is to provide a call center system for asterisk, which should be all web based and no rely on dialplan, also should have some simple CRM features. That’s how asterCRM came, we made it all open source and free to use so that it could grow faster. On 2007-08-08, we released the first version, 0.01beta, then 0.01, 0.03, 0.04 … it upgraded almost every month. At the same time, we’d like to provide a realtime billing solution for asterisk, then we made tow daemons running in linux, astercc and asterrc, astercc could catch live CDR from asterisk and asterrc could bill based rate and destination. We found this billing solution is perfect for hosted callshop, then we released asterCC on 2008-3-5, asterCC means the core of the system is the astercc daemon. After asterCC released, we found that we could get a much better performance and much more features if we use astercc damon in asterCRM, then we start integrate astercc daemon into asterCRM, then we released 0.0461 and 0.047beta, so that asterCRM could work based astercc daemon smoothly. So for now, both the billing solution and the call center solution need astercc daemon, then we decide rename them and package both into one software, we use asterCC as the package name, asterCRM as call center solution as it was, and use asterBilling as the software for realtime billing. asterCC ——asterCRM ——asterBilling asterCRM and asterBilling are both open source software, but the point is that you have to purchase license to get more simultaneous channels support in astercc daemon, by default it provide 5 free license so you can experience how asterCRM and asterBilling works.
For now asterCRM provides user two languages, English and Simplified Chinese, if you want to add a new language, follow this article you can make it yourself.
say you want to add German to astercrm, first go to astercrm/login.php and find the following lines:
<OPTION value=”en_US”>English</OPTION>
<OPTION value=”cn_ZH”>简体中文</OPTION>
we use de_GER for German so we add line then it looks like
<OPTION value=”en_US”>English</OPTION>
<OPTION value=”cn_ZH”>简体中文</OPTION>
<OPTION value=”de_GER”>Germany</OPTION>
save the file, then when you enter astercrm login page, you can see
select Germany and login, and we go to next to change words.
asterCRM language files locate in astercrm/include/language, where you can see files like
account_cn_ZH.php
account_en_US.php
portal_cn_ZH.php
portal_en_US.php
…
so cn_ZH means Simplified Chinese, for Germany one, you can copy account_cn_ZH.php as account_de_GER.php, copy portal_cn_ZH.php as portal_de_GER.php
dont copy from en_US file coz for some words we have English as default in pages, so it could be not integral in the language file, en_US files could be used as reference.
then open the copied file account_de_GER.php with some text editor, and start translate, so it looks like
<?
$add_account = “Ein neues Benutzerkonto wurde hinzugefügt”;
$update_rec = “Eintrag wurde aktualisiert”;
…
?>
save the file with format UTF-8 when you finish.
translate one by one …, not much but need some patient untill all finish.
The last thing, change all images, go to astercrm/skin/default, you can see folders like “images_cn”, “images_en”.. copy images_en as images_de then modify all images in the folder.
refresh your browser then you can see asterCRM with your translation!
- Download and unzip the source
- Create the directories and move astercc daemon scripts:
- Create the MySQL database and table, asterCC need mysql 4.1 or above
- Update /etc/asterisk/manager.conf to enable Manager connections
- Modify /var/www/html/astercc/astercc.conf.php and /opt/asterisk/scripts/astercc/astercc.conf to fit your configration
- Start astercc daemons
- Set folder access
- Testing: browse to http://localhost/astercc
- Set your first booth
- go Reseller and add a reseller
- go Group add a group belong to the reseller
- go Clid add some clid for this group, then the account in asterisk with the clid would be billing as a user in this group
- go Account add a account, usertype could be groupadmin and belongs to the group you just added
- go Rate to Customer and add some rate for the group, if you dont select reseller or group, the rate could be the default rate all all resellers/groups
- login as groupadmin account, then you should see some box as the attachments.
- try make a call using the ip phone with the clid, you could see the calling and billing message in the box
cd /var/www/html
wget http://voxel.dl.sourceforge.net/sourceforge/astercc/astercc-0.09beta.zip
unzip astercc-0.09beta.zip
mv astercc-0.09beta astercc
mkdir -p /opt/asterisk/scripts/astercc/
mv /var/www/html/astercc/daemons/* /opt/asterisk/scripts/astercc/
chmod +x /opt/asterisk/scripts/astercc/astercc
chmod +x /opt/asterisk/scripts/astercc/asterrc
chmod +x /opt/asterisk/scripts/astercc/asterccd
mysqladmin -uyourmysqluser -pyourmysqlpasswd create astercc
mysql -uyourmysqluser -pyourmysqlpasswd astercc <sql/astercc.sql
Note: here we create the database named astercc, you could use whatever db name you want use your configration to replace yourmysqluser and yourmysqlpasswd
Note: asterisk and astercc could be on different server
Add something like this to the manager.conf file:
[general] enabled = yes
port = 5038
bindaddr = 0.0.0.0
;displayconnects = yes;the following line could be changed by yourself
[eventsdaemon] secret = myeventsdaemon
read = system,call,log,verbose,command,agent,user
write = system,call,log,verbose,command,agent,user
deny=0.0.0.0/0.0.0.0
; only allow local access, if you want to run astercrm on another server
; use your astercrm ip to replace 127.0.0.1 or add a new line
permit=127.0.0.1/255.255.255.0
/opt/asterisk/scripts/astercc/asterccd start
Note: If your astercc scripts in other directory,
you need to modify script path in CONFIGURATION SECTION of asterccd and asterccdaemon
to fit your script path (modify path of astercc,asterrc and asterccdaemon in asterccd;
modify path of asterccd and monitor log in asterccdaemon).Start astercc daemons when system startup:
Note: This option can only fit to redhat-release system.
If you want astercc daemons to start automatically when you boot your
machine, you need to :cp /opt/asterisk/scripts/astercc/asterccd /etc/rc.d/init.d
chmod 755 /etc/rc.d/init.d/asterccd
chkconfig –add asterccdAdvice: Configure your astercc restart once everyday, it’s not necessary, but it’s good for your astercc operation.
for example: you want to restart astercc at 0′clock everyday,just do the following line as root.
crontab -e
add a line:
0 0 * * * /etc/rc.d/init.d/asterccd restart
end of this file, the first ‘0’ figures minutes and the second ‘0’ figures hours.
chmod 777 /var/www/html/astercc/upload
browse to http://localhost/astercc
or http://YOUR-WEB-SERVER-ADDRESS/astercc
login with admin/admin