Support A2Billing :

provided by Star2Billing S.L.

Support A2Billing :
It is currently Wed Aug 05, 2020 10:11 am
Predictive Dialer

All times are UTC

Post new topic Reply to topic  [ 47 posts ]  Go to page Previous  1, 2, 3, 4  Next
Author Message
 Post subject: more
PostPosted: Mon Jan 07, 2008 1:20 am 

Joined: Fri Jan 26, 2007 9:52 pm
Posts: 23
echo ""
echo ""
echo "*************************************************************"
echo "* Please run this script only once, or it will duplicate *"
echo "* settings in all the config files *"
echo "* THIS SCRIPT IS A BETA - Run it at your own risk *"
echo "* *"
echo "* Press CTRL-C now to exit now and abandon the install *"
echo "*************************************************************"
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""

sleep 10

echo "enter your MySQL root password (Default=passw0rd)"
echo ""
echo ""
echo ""

echo "*************************************************************"
echo " Installing A2Billing - Downloading files from the internet"
echo ""
echo " Please be patient"
echo "*************************************************************"

mkdir /usr/src/a2billing
cd /usr/src/a2billing
tar zxfv A2Billing_1.3.1.tar.gz

cd /usr/src/a2billing/DataBase/mysql/Mysql-5.x/

echo "GRANT ALL PRIVILEGES ON *.* TO 'a2billinguser'@'localhost' IDENTIFIED BY ' a2billing' WITH GRANT OPTION;" | mysql -p$ROOTPASSWORD
mysqladmin create mya2billing -u a2billinguser -pa2billing
mysql mya2billing -u a2billinguser -pa2billing < a2billing-mysql-schema-MYSQL.5. X-v1.3.0.sql
mysql mya2billing -u a2billinguser -pa2billing < UPDATE-a2billing-v1.3.0-to-v1.3 .1-mysql.sql

#Install some dependencies
yum -y install perl-DBD-Pg

#To set up web based call-back say from text
#pear install --alldeps SOAP-0.9.4

cd /usr/src/a2billing

mv ./A2Billing_UI /var/www/html/A2Billing_UI
mv ./A2BCustomer_UI/ /var/www/html/A2BCustomer_UI
mv a2billing.conf /etc/asterisk/a2billing.conf

cd /usr/src/a2billing/A2Billing_AGI

mv a2billing.php /var/lib/asterisk/agi-bin/.
mv libs_a2billing /var/lib/asterisk/agi-bin

mv /usr/src/a2billing/addons/sounds/* /var/lib/asterisk/sounds

mkdir /var/lib/asterisk/a2billing/
mv /usr/src/a2billing/CallBack/callback-daemon /var/lib/asterisk/a2billing/

cd /etc/asterisk/
touch additional_a2billing_iax.conf
touch additional_a2billing_sip.conf
touch extensions_a2billing.conf
touch iax_custom.conf

#set-up a2billing.conf MySQL and Manager
sed -i '/postgres/s/dbtype/;dbtype/g' /etc/asterisk/a2billing.conf
echo "Disable Pgsql dbtype"
sed -i '/mysql/s/;dbtype/dbtype/g' /etc/asterisk/a2billing.conf
echo "enable Pgsql dbtype"
sed -i '/manager_user/s/myasterisk/a2billinguser/g' /etc/asterisk/a2billing.conf
echo "Asterisk Manager USer"
sed -i '/manager_secret/s/mycode/a2billing/g' /etc/asterisk/a2billing.conf
echo "Asterisk Manager Password"

echo "#include additional_a2billing_sip.conf" >> /etc/asterisk/sip_custom.conf
echo "#include additional_a2billing_iax.conf" >> /etc/asterisk/iax_custom.conf
echo "#include extensions_a2billing.conf" >> /etc/asterisk/extensions_custom.con f

#Create manager_custom.conf
echo "
secret = a2billing
read = system,call,log,verbose,command,agent,user
write = system,call,log,verbose,command,agent,user
" >> /etc/asterisk/manager_custom.conf

#Add the A2Billing context

echo "
exten => _X.,1,Answer
exten => _X.,n,Wait(1)
exten => _X.,n,AGI(a2billing.php|1)
exten => _X.,n,Hangup

exten => _X.,1,AGI(a2billing.php|1|callback)
exten => _X.,n,Hangup

exten => _X.,1,AGI(a2billing.php|1|cid-callback|34) ;last parameter is the callb ack area code
exten => _X.,n,Hangup

exten => _X.,1,AGI(a2billing.php|1|all-callback|34) ;last parameter is the callb ack area code
exten => _X.,n,Hangup

exten => _X.,1,AGI(a2billing.php|1|did)
exten => _X.,2,Hangup

exten => _X.,1,AGI(a2billing.php|1|voucher)
exten => _X.,n,Hangup
" >> /etc/asterisk/extensions_a2billing.conf

#set ownership
chown -R asterisk:asterisk /var/www/html
chown -R asterisk:asterisk /etc/asterisk
chown -R asterisk:asterisk /var/lib/asterisk/

#set up crontabs for cuurrency updates invoices and billing.
echo '0 * * * * php /var/lib/asterisk/agi-bin/libs_a2billing/crontjob/a2billing_ alarm.php
0 10 21 * * php /var/lib/asterisk/agi-bin/libs_a2billing/crontjob/a2billing_auto refill.php
0 12 * * * php /var/lib/asterisk/agi-bin/libs_a2billing/crontjob/a2billing_batch _process.php
0 2 * * * php /var/lib/asterisk/agi-bin/libs_a2billing/crontjob/a2billing_bill_d iduse.php
0 6 1 * * php /var/lib/asterisk/agi-bin/libs_a2billing/crontjob/a2billing_check_ account.php
0 6 1 * * php /var/lib/asterisk/agi-bin/libs_a2billing/crontjob/a2billing_invoic e_cront.php
0 6 1 * * php /var/lib/asterisk/agi-bin/libs_a2billing/crontjob/a2billing_subscr iption_fee.php
0 6 * * * php /var/lib/asterisk/agi-bin/libs_a2billing/crontjob/currencies_updat e_yahoo.php
' >> /var/spool/cron/asterisk

#Set up callback
#To set up web based call-back say from text
#pear install --alldeps SOAP-0.9.4
#Perl module Config::IniFiles
#perl -MCPAN -e shell
#install Config::IniFiles

#cd /var/lib/asterisk/a2billing/callback-daemon/
#install --owner=root --group=root --mode=700 a2billing-callback-daemon.rc /etc/ rc.d/init.d/a2billing-callback-daemon
#chkconfig --add a2billing-callback-daemon && chkconfig a2billing-callback-daemo n on
#service a2billing-callback-daemon start

echo ""
echo ""
echo ""
echo ""
echo ""
echo "*******************************************************************"
echo "Please read the documentation in "
echo "/usr/src/a2billing/addons/Callback to enable callback funtionality"
echo "*******************************************************************"
echo "A2Billing is installed"
echo "-------------------------------------------------"
echo ""
echo "Please Reboot as soon as you are able"
echo ""
echo "*******************************************************************"
echo ""
echo "The default username is root"
echo "The default password is myroot"
echo "*******************************************************************"
echo ""
echo ""
echo ""
echo ""
echo ""
echo ""

sleep 5

Added after 8 minutes:

email me your email address and i will let you log in and look at it

thanks i am stomped i ve been at my desk for a week trying to figure this out i don't have any other problems other than that i can get the did to show up in the user panel but the calls don't come in

Added after 18 minutes:

i got it to work wowwwwwwwwwwwwwwwwwwwwww Stavros dude thanks and thanks alot smixon buddy you guys were right it was exactly what you said it would be it wasn't been forwarded the right way i will post a how to on how exactly to do it from the top.

my way of giving back

Added after 2 hours 2 minutes:


This may not work for everyone but it worked for me

How to get incoming did to work

1 buy a DID

2 setup your asterisk server with that latest build of a2billing yellow jacket 1.3.1

3 I use PBX IN A FLASH from current version 1.1 but this should work for everyone else as long as you have a2b 1.3.1

4. in the extensions_a2billing.conf there is a [a2billing-did] script change it to
[custom-a2billing-did] then below that line put these other lines
exten => 6474764424,1,NoOp,${CALLERID(all)}
exten => 6474764424,2,AGI(a2billing.php|3|did)
exten => 6474764424,3,Hangup

this part is important let me explain exten => 6474764424,2,AGI(a2billing.php|3|did)
you will most likely want to create another config file because you will want to do things with a2billing that the original file that is there wont do (here is mine) (IE have no recording sounds prompt when you make a call.) So at the end of the original file you would put this new conf3 or whatever number you want to call it just make sure it matches.

Location where this file is etc/asterisk/a2billing.conf


; the debug level
; 0=none, 1=low, 2=normal, 3=all

; Manage the answer on the call
answer_call= no

; Activate application logging
; logging is optimized to write all the logs at once Very Happy

; File to log

; play the goodbye message when the user has finished.

; enable the menu to choose the language
; press 1 for English, pulsa 2 para el espa?ol, Pressez 3 pour Fran?ais

; force the use of a language, if you dont want to use it leave the option empty
; Values : ES, EN, FR, etc... (according to the audio you have installed)

; Introduction prompt : to specify an additional prompt to play at the beginning of the application
; parlezplus-intro_013centimes

; length of the cardnumber (number of of digits)

; Alias-Card length
len_aliasnumber = 12

; Voucher length
len_voucher = 15

; Minimum amount of credit to use the application

; this is the minimum duration in seconds of a call in order to be billed
; any call with a length less than min_duration_2bill will have a 0 cost
; useful not to charge callers for system errors when a call was answered but it actually didn't connect

; if user doesn't have enough credit to call a destination, prompt him to enter another cardnumber

; if notenoughcredit_cardnumber = YES then assign the CallerID to the new cardnumber

; if YES it will use the DNID and try to dial out, without asking for the phonenumber to call
; value : YES, NO

; list the dnid on which you want to avoid the use of the previous option "use_dnid"

;number of times the user can dial different number

; Play the balance to the user after the authentication (values : yes - no)

; Play the balance to the user after the call (values : yes - no)

; Play the initial cost of the route (values : yes - no)

; Play the amount of time that the user can call (values : yes - no)

; enable the presentation of a callerID number

; If set, and auto_setcallerid is enabled, the number is sent as

; If force_callerid is not set, then this ensures that CID is set to one of the ccard's configured caller IDs or blank if none available.
; NO - disable this feature, caller ID can be anything.
; CID - Caller ID must be one of the customers caller IDs
; DID - Caller ID must be one of the customers DID nos.
; BOTH - Caller ID must be one of the above two items.

; enable the callerid authentication
; if this option is active the CC system will check the CID of caller

; if the CID does not exist, you can then ask for a cardnumber from the calling party in order to authenticate the caller

; if the callerID, this option will allow the system to add it automatically and create a cardnumber to hook them up.

; if the callerID authenticate is on, this option will allow the assign the cardnumber enter to the callerID if the callerID wasnt in the DB

; If cid_auto_create_card has been set to YES, the following option will define with which parameters the card will be create
; billing type of the new card
; ( value : POSTPAY or PREPAY)
; amount of credit of the new card

; if postpay, define the credit limit for the card

; the tariffgroup to use for the new card (this is the ID that you can find on the admin web interface)

; if we want to check the callerID over the cardnumber authentication (to guard against spoofing)

; enable the option to call sip/iax friend for free (values : YES - NO)

; if SIP_IAX_FRIENDS is active, you can define a prefix for the dialed digits to call a pstn number
; values : number

; this will enable a prompt to enter your destination number.
; if number start by sip_iax_pstn_direct_call_prefix we do directly a sip iax call, if not we do a normal call

; Extracharge DIDs, multiple numbers and fees must be separated by comma

; More information about the Dial :
; 30 : The timeout parameter is optional. If not specifed, the Dial command will wait indefinitely, exiting only when the originating channel hangs up, or all the dialed channels return a busy or error condition. Otherwise it specifies a maximum time, in seconds, that the Dial command is to wait for a channel to answer.
; H: Allow the caller to hang up by dialing *
; r: Generate a ringing tone for the calling party
; m: Provide Music on Hold to the calling party until the called channel answers.
; L(x[][]): Limit the call to 'x' ms, warning when 'y' ms are left, repeated every 'z' ms)
; %timeout% tag is replaced by the calculated timeout according the credit & destination rate!


; by default (3600000 = 1HOUR MAX CALL)

; Define the order to make the outbound call
; YES -> SIP/[email protected]_ip - NO SIP/gateway_ip/dialedphonenumber
; Both should work exactly the same but i experimented one case when gateway was supporting [email protected]_ip
; So in case of trouble, try it out

; For free calls, limit the duration: amount in seconds
maxtime_tocall_negatif_free_route = 5400

; Send a reminder email to the user when they are under min_credit_2call

; enable to monitor the call (to record all the conversations)
; value : YES - NO

; format of the recorded monitor file

;base currency define the default currency that you want to use to setup your system (see the file /etc/asterisk/ to know the currency code)
base_currency = usd

; Force to play the balance to the caller in a predefined currency, to use the currency set for by the customer leave this field empty
agi_force_currency =

; Define all the audio (without file extensions) that you want to play according to currency (use , to separate, ie "usd:prepaid-dollar,mxn:pesos,eur:Euro,all:credit")
currency_association = usd:prepaid-dollar,mxn:pesos,eur:euro,all:credit

; Please enter the file name you want to play when we prompt the calling party to enter the destination number
; file_conf_enter_destination = prepaid-enter-number-u-calling-1-or-011
file_conf_enter_destination = prepaid-enter-dest

; Please enter the file name you want to play when we prompt the calling party to choose the prefered language
; file_conf_enter_menulang = prepaid-menulang
file_conf_enter_menulang = prepaid-menulang2

6474764424 is my DID number so you need to put your own number there that you just purchased this number is from but any number will work just make sure your did number is pointed to your Asterisk/a2billing server

5. go to freepbx and setup a inbound route with the DID number you just bought and point to a Custom App: in that destination field you put custom-a2billing-did,6474764424,1 remove my number and put the did number you just bought there.

This takes care of the things you need to do in freepbx/config file locations for now

6. Now go to a2billing administrator login Create a Trunk or 2 I have 2 one is call internal and the other one is called local

The internal trunk is to dial the FREEPBX internal extension these are my settings
PROVIDER IP= (IP address of my asterisk server)

And the other local is to dial locally in my case Toronto Canada
PROVIDER IP= name of my trunk which is called Local and it is also called that in Freepbx which you should have setup has a outbound route in freepbx

This is very important Now to get the did to show up in the user account you must add the did under the did tab field and you must setup a DID Group with the did belonging to that group and you must add the did to the customers card number where it says DIDGROUP when you are in the customers card page.

7. Now go to the rate card tab and create a call plan create a new rate card and then add rates you should know how to do this if you don’t make a post

You don’t want to charge for internal call but you do want to charge for external calls

The other thing to do is to make sure your system check the numbers internally first before dial out to the outside.

We are almost done

8. Now create a customer or customers cards make sure you add a SIP/IAX FRIEND to the card assign the dids group to the card add SIMULTANEOUS ACCESS

Added after 12 minutes:

Now go back into the did tab and make sure these are done click on add destination.

In the destination field if it’s a sip destination put sip/card number or any sip device number and check the VOIP_CALL setting or if it’s a telephone number just put the number there
In the ID CARD section put the calling card number that you want associated with the DID number
The trunks you setup should know how to route the calls to the different locations ie internal or external

And make your call

 Post subject:
PostPosted: Mon Jan 07, 2008 10:28 pm 

Joined: Mon Oct 01, 2007 10:44 pm
Posts: 230
Location: Bovey, Devon, UK
Oh boy, now I'm hitting this issue. Is there a clean resolution?


OK, having read the posts, it doesn't seem that simple, especially for large amounts of numbers. So some thoughts on logic.

In DID setup

Option to make this a billable call, ie allow the setting of a per minute value

Modify rate engine to recongnise above and bill to DID.

Thoughts anyone?

 Post subject:
PostPosted: Wed Jan 09, 2008 8:50 am 

Joined: Fri Jun 23, 2006 3:56 pm
Posts: 4065

A bit of an error in the script from PBX-in-a-Flash, I'm embarrassed to say, as I wrote it.

It should have said: -

exten => _X.,1,Answer
exten => _X.,n,Wait(1)
exten => _X.,n,DeadAGI(a2billing.php|1)
exten => _X.,n,Hangup

, Note the DeadAGI, rather than AGI. This was a hangover from the asterisk 1.2.21 problems we were having.

The same applies for all the others entries.

In terms of using DID with FreePBX and A2Billing, the general idea was to bring in the DID into inbound routes in FreePBX, then using a custom destination, pass the call into the appropriate context, thus keeping everything in a web GUI, however, there is nothing to stop you typing in your own settings rather than using the FreePBX GUI.

There is also a mistake with settig up the manager_custom.conf in relation to callback, the quick fix is to change it all back to the original settings in a2billing.conf (myasterisk / mycode)


Joe Roper

 Post subject:
PostPosted: Wed Jan 09, 2008 2:40 pm 
User avatar

Joined: Tue Jun 06, 2006 12:14 pm
Posts: 685
Location: florida
I encountered another area where someone mentioned use of AGI versus deadAGI ?? Which should we be using? I'm still using deadAGI

 Post subject:
PostPosted: Wed Jan 09, 2008 3:18 pm 
User avatar

Joined: Thu Jun 22, 2006 2:19 pm
Posts: 2890
Location: Devon, UK
I believe the current best advice is DeadAGI() on Asterisk 1.2, and AGI() on Asterisk 1.4. Confirmation of that Asterisk 1.4 setting would be lovely. I seem to remember it complains when the call first comes in, but otherwise functions fine.
In the long term I think the Asterisk devs want us to move towards using both! AGI() should handle the call until it hangs up, then we shall have to call DeadAGI() in the hope we can write a CDR for the call. It sounds well dodgy to me. :?

 Post subject: PBXinaFlash
PostPosted: Wed Jan 23, 2008 3:56 pm 
User avatar

Joined: Tue Jun 06, 2006 12:14 pm
Posts: 685
Location: florida
Joe, you're the one behind this project ?? (PBXinaFlash)

Based on that I saw you referenced, and i like Ward and his way of thinking, I downloaded it and am giving it a try. Perhaps I can trash all my Trixbox's out there.

 Post subject:
PostPosted: Wed Jan 23, 2008 4:52 pm 

Joined: Fri Jun 23, 2006 3:56 pm
Posts: 4065

Yes, guilty as charged, it was me who wrote the ISO for PiaF, while Tom King is doing a sterling job writing update scripts, and Ward Mundy is building all sorts of goodies like mail call etc, hence my absence from this forum for the last few weeks.


 Post subject: Per minute DID billing
PostPosted: Wed Jun 04, 2008 12:33 am 
User avatar

Joined: Tue May 13, 2008 4:37 am
Posts: 22
Location: Coeur d Alene, Id
Has anyone come up with an answer, patch, etc on how to make the system bill for DIDs (Origination) by the minute?

Looking to setup different bill rates for DID per minute usage for different tiers, toll-free, etc.

I know this question has been asked over and over. email or call day/night

[email protected]
208-664-2869 X2101

 Post subject:
PostPosted: Wed Jun 04, 2008 5:01 am 
User avatar

Joined: Tue May 13, 2008 4:37 am
Posts: 22
Location: Coeur d Alene, Id
Hmm. Just so Im clear, we are talking about a fix to bill per minute for Incoming calls to a DID. A2Billing bills for termination, but I need to specify BY DID a per minute rate. This is because of different rates to different ratecenters, toll free, etc.

Could this not be accomplished by creating 2 separate sets of rate cards? One for outgoing and one for incoming, both with separate tables.


Added after 3 hours 28 minutes:

Okay, well I will post a bounty for whomever can get this implemented and STABLE. this could consist of cash and/or origination/termination/DIDs through my company .

Also looking for PHP programmer to build and design interfacing with our vendors via API functionality. We can discuss more if you like.

 Post subject: Re: Bill Incoming DID Per/Min
PostPosted: Tue Oct 07, 2008 9:59 pm 

Joined: Tue Jul 22, 2008 5:36 am
Posts: 6
manchu wrote:
Hi, this is what i did.

I created a rate and set prefix as eg: 2
I created a trunk with %dialingnumber%
I created a rate card and associated to the Local trunk
I added the ratecard to the Calling Plan
Then in the did destination i add the prefix before the extension number eg: extension number is 4444 so in destination i put 24444 (Not voip call)
So when the call comes in it is routed thru the correct trunk based on the prefix..

I'm trying to understand this setup to see if it would work for what I want.
In this scenario, when a call comes into the billed DID and is routed to ext 4444, it is run through a2billing?

 Post subject: Re: Charging per minute to Incoming DID!!!
PostPosted: Fri Jul 10, 2009 12:51 am 

Joined: Fri Apr 06, 2007 8:26 pm
Posts: 34
I have not been able to get DID per minute billing to work.

I have a SIP provider connected to my * with FPBX and A2B. The DIDś are received from the SIP provider via SIP I get them to directly to [a2billing-did]. The DIDś are correctly processed in A2B and in the destination I have the IAX Trunk of a second * so that the destination is "IAX2/fpbx-trunk-name/12345678".

This works perfectly with VOIP Call = on.
The per month charges are working but the per minute charges do not work. It always shows 0 but has the record with a time.

I found in another post that I need to set Voip Call = no to get the per minute billing to work but then my DIDś and 800 no longer get fowarded with the destination mentioned.

How can I get arround this?

 Post subject: Re: Charging per minute to Incoming DID!!!
PostPosted: Fri Jul 10, 2009 6:03 am 

Joined: Fri Jun 23, 2006 3:56 pm
Posts: 4065

Voip call = yes will push the call out via VoIP, and will not charge for the call.
VoIP call = no will send the call out of an existing trunk as per your rate card/callplan and charge for the call.

So to make a per minute charge, you are going to have to create a trunk, and have the DID use that.


 Post subject: Re: Charging per minute to Incoming DID!!!
PostPosted: Fri Jul 10, 2009 1:58 pm 

Joined: Fri Apr 06, 2007 8:26 pm
Posts: 34
OK finally I am starting to get the logic...ok...the only thing I am missing now is how to select a A2B trunk in the destination for the DID??

To send the call through FPBX trunk i set up the destination in the A2B DID settings to IAX2/fpbx-trunk-name/12345678 but this only works with VOIP = on.

So now I have set up a Trunk in A2B which has "IAX2" as tech and "fpbx-trunk-name/%dialingnumber%" as destination but I cannot select that trunk for an outgoing call from the DID destination. (I have setup a ratecard with "defautprefix" in the prefix to catch all numbers and assign the same rate to them as well as a rate for this case so that is all OK).

What destination do I set up so that it uses an A2B created trunk??

 Post subject: Re: Charging per minute to Incoming DID!!!
PostPosted: Fri Jul 10, 2009 2:12 pm 
User avatar

Joined: Thu Jun 22, 2006 2:19 pm
Posts: 2890
Location: Devon, UK
warlock52 wrote:
how to select a A2B trunk in the destination for the DID??
You can't select a trunk in the DID destination, but when voip_call is NO the destination will be passed through the rate-cards to find a trunk to terminate, which you can use to your advantage.

Prefix all your DID destinations with an imaginary country prefix, e.g. 786000, then add a rate for this prefix to the rate-cards. This rate can then force the trunk, and the trunk should be configured to strip this 786000 prefix.

 Post subject: Re: Charging per minute to Incoming DID!!!
PostPosted: Tue Jul 14, 2009 6:45 am 
User avatar

Joined: Tue May 13, 2008 4:37 am
Posts: 22
Location: Coeur d Alene, Id
I put together some documentation for creating accounts, and adding DIDS that are to be charged per minute. This process assumes you have made the necessary modifications to A2Billing for the workaround to allow for this. This is useful if you are training staff or have other staff that will be doing the entry on a regular basis. Feel free to rebrand/edit to your needs. I am also available to help with some process documentation on other items. Thanks!


Adam Johnson
Wholesale VoIP - Origination - Termination - DIDs - LNP - E911

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 47 posts ]  Go to page Previous  1, 2, 3, 4  Next
Auto Dialer Software

All times are UTC

Who is online

Users browsing this forum: No registered users and 3 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