Sunday, November 23, 2008

Rates setting in asterbilling for asterisk billing

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.

Posted by solo at 04:57:55 | Permalink | No Comments »

adjust astercc parameters to get better performance for asterisk billing

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

Posted by solo at 04:56:41 | Permalink | No Comments »

asterbilling and asterisk2billing (a2billing) for asterisk billing

a2billing is a widly used billing system, so what’s the difference between a2billing and asterbilling?

system theory:

a2billing work with asterisk through AGI, each call would be handled by a2billing.agi, so you need change your astierks context so that when your phone make calls it will go to a2billing.agi, of course you need to copy a2billing scripts to your asterisk server.

asterbilling runs as linux daemons, connect to asterisk via AMI over tcp,  no need change anything on your asterisk, asterbilling can bill it. Even asterbilling could work with a2billing.

license & free:

a2billing: 100% open source and free to use.

asterbilling: only web scripts are open source, and provides 5 free simultaneous channels, have to purchase when need more channels.

performance:

a2billing: like 100 simultaneous calls on single server? i didnt test, :(

asterbilling: passed 240 simultaneous calls testing, but didnt test more.

best usage:

a2billing: calling card, callback or wholesale solutions

asterbilling: billing for embedded astiersk, pbx (like all freepbx based system), callshop, hosted callshop soltution

other keywords:

a2billing: openser

asterbilling: realtime billing, reseller

Posted by solo at 04:55:33 | Permalink | No Comments »

Thursday, November 13, 2008

add language package for asterCRM

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:

English 简体中文

we use de_GER for German so we add line then it looks like

English 简体中文 Germany

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!

Posted by solo at 01:56:48 | Permalink | No Comments »

add google map for your customer in asterCRM

asterCRM support goolge map, so you can add a map for your customer using this feature. 1. you need to apply a google api key go to http://code.google.com/apis/maps/index.html click “Sign up for a Google Maps API key.” on right

click the check box and enter your web site URL then button “Generate API Key”

done! now you get the key for Google Maps API Read the rest of this entry »

Posted by solo at 01:54:36 | Permalink | No Comments »

Dynamic Agent mode with asterisk, FreePBX and asterCRM

Dynamic Agent mode is very useful in a outbound call center, agents login to a queue and hear some music we definied in the queue, then predictive dailer start works, it dials customer numbers and once it get connected the dialer will redirect the call to the queue, and agent in the queue could hear a beep immediately then could start talking to the customer, it’s so quick that customer just think it’s a call from the agent. With asterCRM, agent could get customer information once the call get connected, here we’ll introduce how to set dynamic agent in freepbx and asterisk: First, we need to add some extensions and queues in FreePBX: add extensions: go to FreePBX extensions page, then we add a queue and choose a dynamic agent for it like following figure yes, if you want to add a dynamic agent for a queue, you should add a agent number with A in queue agent list, and we can notice that message from FreePBX. so we need to counfigure agent.conf in asterisk conf directory, here we add a dynamic agent which number is 1000, its passoword is 0000, name is Brad then we add a dialplan for agent login in extensions_custom.conf like following line: update the context of extension 8000 to “agent-test”. here, we had a queue which include a dynamic agnet, well then we need add a user in astercrm, go to the extension management page of astercrmand add a new extension and assign agent 1000 to him: Agnet start work: first the extension have to login as a agent to PBX, when 8000 dial “*789″, it would hear the prompt that require to enter the agent number and password to login as the agent, enter agent number 1000 and password 0000, it can login as agent 1000. login to asaterCRM by brad/1234, the asterCRM could pop-up if anyone call to Agent/1000 or extension 8000.
Posted by solo at 01:52:02 | Permalink | Comments (2)

Thursday, February 28, 2008

get realtime CDR to your mysql from asterisk

Many a time we want to know who is calling and how long it lasts, but asterisk only provide our the cdr when the call is finished, we have to use some agi script or special dialplan to get the real time data, but now we could use “astercc” to get the data in real time no matter what’s the dialplan in your system, which means we can get CDR in real time from any asterisk based system.

astercc works as a daemon in linux, it get events from asterisk AMI and store the CDR to two mysql table.
the first table is “curcdr” which will store all simultaneous calls, when call starts there would be a new record in the table, and when it stops, the record would be removed to another table “mycdr”

the record could be:

mysql> select * from curcdr;
+——+——+———-+—————+—————–+———————+———————+—————–+—————–+————-+———+——–+——–+—————-+—————-+————-+
| id | src | dst | srcchan | dstchan | starttime | answertime | srcuid | dstuid | disposition | groupid | userid | credit | callshopcredit | resellercredit | creditlimit |
+——+——+———-+—————+—————–+———————+———————+—————–+—————–+————-+———+——–+——–+—————-+—————-+————-+
| 3880 | 8807 | 8806 | SIP/8807-6fc2 | SIP/8806-d962 | 2008-02-28 12:26:01 | 2008-02-28 12:26:10 | 1204172801.3813 | 1204172801.3814 | link | 0 | 0 | 0.0000 | 0.0000 | 0.0000 | 0.0000 |
| 3881 | 8000 | 84350822 | SIP/8000-1684 | SIP/trunk1-a73d | 2008-02-28 12:26:13 | 0000-00-00 00:00:00 | 1204172812.3815 | 1204172813.3816 | dial | 0 | 0 | 0.0000 | 0.0000 | 0.0000 | 0.0000 |
+——+——+———-+—————+—————–+———————+———————+—————–+—————–+————-+———+——–+——–+—————-+—————-+————-+

and the record in mycdr could be

mysql> select * from mycdr order by id desc limit 0,2;
+——+———————+——+———-+—————+—————–+———-+———+————-+————-+———–+—————–+—————–+———-+——–+—————-+—————-+———+——–+
| id | calldate | src | dst | channel | dstchannel | duration | billsec | disposition | accountcode | userfield | srcuid | dstuid | calltype | credit | callshopcredit | resellercredit | groupid | userid |
+——+———————+——+———-+—————+—————–+———-+———+————-+————-+———–+—————–+—————–+———-+——–+—————-+—————-+———+——–+
| 3682 | 2008-02-28 12:26:13 | 8000 | 84350822 | SIP/8000-1684 | SIP/trunk1-a73d | 5 | 0 | NO ANSWER | | UNBILLED | 1204172812.3815 | 1204172813.3816 | | 0.0000 | 0.0000 | 0.0000 | 0 | 0 |
| 3681 | 2008-02-28 12:24:40 | 8806 | 8807 | SIP/8806-c36f | SIP/8807-0139 | 8 | 6 | ANSWERED | | UNBILLED | 1204172719.3811 | 1204172720.3812 | | 0.0000 | 0.0000 | 0.0000 | 0 | 0 |
+——+———————+——+———-+—————+—————–+———-+———+————-+————-+———–+—————–+—————–+———-+——–+—————-+—————-+———+——–+
2 rows in set (0.00 sec)

so if you want to get real time cdr datas from your asterisk for your application, you can try astercc, it provide 5 free channels, means it could catch 5 simultaneous calls in your asterisk, it has been tested that astercc could catch as much as 240 simultaneous calls.

astercc daemon could be download from http://sourceforge.net/project/showfile … _id=202441, if you only want to get the calls information, you just need astercc and astercc.conf in directory daemon in the package

Posted by solo at 13:10:03 | Permalink | No Comments »

Thursday, January 31, 2008

how to use asterisk as a predictive dialer

Predictive dialers, systems that automatically place outbound calls and deliver answered calls to agents; they are the key to using your sales force time as efficiently as possible in your outbound call center.

Here we use asterisk and astercrm to build a predictive dialer.

1. we need to install asterisk, for beginner you could use trixbox.
2. install astercrm, it could be on same server with asterisk or on a different one. the newest version is 0.046,  installation guide could be found here.
3. there’s a bug in 0.046, if you have not used a previous version, you need fix the bug, execute these two line in your mysql:

        alter table diallist add creby VARCHAR(20);
        alter table diallist add cretime datetime NOT NULL default ‘0000-00-00 00:00:00′;

4. login as admin/admin, go to “Manager” -> “preference”, we need to set which context to use when make outbound call

the outcontext could be

[from-sipuser]
exten => _X.,1,Dial(SIP/TRUNK1/${EXTEN})

when a outbound campaign start, predictive dialer would first drop the phone number to this context, so this context should be your outbound context.

5. then we go  “Manager” -> “Extension” -> “Group Manage”, click “Add” button to add a new group.

here we need to notice thw parameters: pdcontext and pdextensions, this mean how to handle the call when it’s answered. Here, the context in extensions.conf could be something like

[from-trunk-customer]
exten => queue1, 1, Answer()
exten => queue1, n, Queue(tech-queue) 

when the call is connected, it could be redirect to queue “tech-queue” and answered by agent in this queue.

6. add a account as groupadmin, go “Extension” and click “Add”, add a account, group is AstercrmGroup3, usertype is groupadmin

7. next, we should prepare a diallist, we could use “Import” function to import diallist from a excel or cvs file. The operation could be done using the groupadmin account we just added. Logout and then login as the groupadmin, go to “Import”, select the local file, and then click “Upload”


“import” function could help us import phone numbers to diallist, we check the two check box on the buttom, the 0 in the select box, means the 0 column. click “Import” to continue, when finished, it will tell you “diallist : XXX records insert success”, then we could to “Diallist” and check if it imported:


8. now every thing is ready, we could go “Dialer” to start, coz only a admin could start a predictive dialer, so we logout and login as admin again


we could click “Dial” button to start, the number in input box is the maximum channels number, dialer would stop once the concurrent channels reach this number, it could be modified as you like.

Posted by solo at 13:15:37 | Permalink | Comments (3)

Tuesday, January 29, 2008

two new features in astercc

1. two level billing, administrator -> callshop -> customer
2. profit report
Posted by solo at 03:07:08 | Permalink | No Comments »

Sunday, January 13, 2008

Why doesnt my astercrm popup

here’re two reasons most possibly:

1. astercrm cant get asterisk evens, it’s always empty in table events.

please check if eventsdaemon.pl starts, ensure database & asterisk parameters be correct in the script.

for astercrm 0.0456 or above, could try start eventsdaemon in debug mode, execute:

 eventsdaemon.pl

and check the output message.

2. Popup is disabled in astercrm configuration

in astercrm configuration file: astercrm.conf.php, the fellowing parameters are related to popup:

[system]

it wouldnot  popup unless the length of the callerid is greater than this number

phone_number_length = 6

it wouldnot popup unless the value is 1 when dial out

pop_up_when_dial_out = 1

it wouldnot popup unless the value is 1 when dial in

pop_up_when_dial_in = 1

Posted by solo at 04:59:23 | Permalink | No Comments »