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 ""
read ROOTPASSWORD
echo "*************************************************************"
echo " Installing A2Billing - Downloading files from the internet"
echo ""
echo " Please be patient"
echo "*************************************************************"
mkdir /usr/src/a2billing
cd /usr/src/a2billing
wget
http://a2billing.net/downloads/A2Billing_1.3.1.tar.gz
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 "
[a2billinguser]
secret = a2billing
deny=0.0.0.0/0.0.0.0
permit=127.0.0.1/255.255.255.0
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 "
[a2billing]
exten => _X.,1,Answer
exten => _X.,n,Wait(1)
exten => _X.,n,AGI(a2billing.php|1)
exten => _X.,n,Hangup
[a2billing-callback]
exten => _X.,1,AGI(a2billing.php|1|callback)
exten => _X.,n,Hangup
[a2billing-cid-callback]
exten => _X.,1,AGI(a2billing.php|1|cid-callback|34) ;last parameter is the callb ack area code
exten => _X.,n,Hangup
[a2billing-all-callback]
exten => _X.,1,AGI(a2billing.php|1|all-callback|34) ;last parameter is the callb ack area code
exten => _X.,n,Hangup
[a2billing-did]
exten => _X.,1,AGI(a2billing.php|1|did)
exten => _X.,2,Hangup
[a2billing-voucher]
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
#reload
#quit
#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:
Disclamer
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
http://nerdvittles.com/ 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
[agi-conf3]
; the debug level
; 0=none, 1=low, 2=normal, 3=all
debug=3
; Manage the answer on the call
answer_call= no
; Activate application logging
; logging is optimized to write all the logs at once Very Happy
logger_enable=YES
; File to log
log_file=/tmp/a2billing.log
; play the goodbye message when the user has finished.
say_goodbye=NO
; enable the menu to choose the language
; press 1 for English, pulsa 2 para el espa?ol, Pressez 3 pour Fran?ais
play_menulanguage=NO
; 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)
force_language=
; Introduction prompt : to specify an additional prompt to play at the beginning of the application
; parlezplus-intro_013centimes
intro_prompt=
; length of the cardnumber (number of of digits)
len_cardnumber=10
; Alias-Card length
len_aliasnumber = 12
; Voucher length
len_voucher = 15
; Minimum amount of credit to use the application
min_credit_2call=0
; 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
min_duration_2bill=0
; if user doesn't have enough credit to call a destination, prompt him to enter another cardnumber
notenoughcredit_cardnumber=NO
; if notenoughcredit_cardnumber = YES then assign the CallerID to the new cardnumber
notenoughcredit_assign_newcardnumber_cid=NO
; if YES it will use the DNID and try to dial out, without asking for the phonenumber to call
; value : YES, NO
use_dnid=YES
; list the dnid on which you want to avoid the use of the previous option "use_dnid"
no_auth_dnid=2400,2300
;number of times the user can dial different number
number_try=3
; Play the balance to the user after the authentication (values : yes - no)
say_balance_after_auth=NO
; Play the balance to the user after the call (values : yes - no)
say_balance_after_call=NO
; Play the initial cost of the route (values : yes - no)
say_rateinitial=NO
; Play the amount of time that the user can call (values : yes - no)
say_timetocall=YES
; enable the presentation of a callerID number
auto_setcallerid=yes
; If set, and auto_setcallerid is enabled, the number is sent as
always
force_callerid=
; 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.
cid_sanitize=cid
; enable the callerid authentication
; if this option is active the CC system will check the CID of caller
cid_enable=YES
; if the CID does not exist, you can then ask for a cardnumber from the calling party in order to authenticate the caller
cid_askpincode_ifnot_callerid=No
; if the callerID, this option will allow the system to add it automatically and create a cardnumber to hook them up.
cid_auto_create_card=No
; 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
cid_auto_assign_card_to_cid=NO
; 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)
cid_auto_create_card_typepaid=POSTPAY
; amount of credit of the new card
cid_auto_create_card_credit=0
; if postpay, define the credit limit for the card
cid_auto_create_card_credit_limit=1000
; the tariffgroup to use for the new card (this is the ID that you can find on the admin web interface)
cid_auto_create_card_tariffgroup=6
; if we want to check the callerID over the cardnumber authentication (to guard against spoofing)
callerid_authentication_over_cardnumber=NO
; enable the option to call sip/iax friend for free (values : YES - NO)
sip_iax_friends=yes
; if SIP_IAX_FRIENDS is active, you can define a prefix for the dialed digits to call a pstn number
; values : number
sip_iax_pstn_direct_call_prefix=9
; 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
sip_iax_pstn_direct_call=NO
; Extracharge DIDs, multiple numbers and fees must be separated by comma
;extracharge_did=1800XXXXXXX,1888XXXXXXX
extracharge_did=2031080937
;extracharge_fee=0.02
extracharge_fee=
; More information about the Dial :
http://voip-info.org/wiki-Asterisk+cmd+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!
dialcommand_param="|90|HrL(%timeout%:61000:30000)"
; by default (3600000 = 1HOUR MAX CALL)
dialcommand_param_sipiax_friend="|90|HrL(3600000:61000:30000)"
; Define the order to make the outbound call
; YES -> SIP/dialedphonenumber@gateway_ip - NO SIP/gateway_ip/dialedphonenumber
; Both should work exactly the same but i experimented one case when gateway was supporting dialedphonenumber@gateway_ip
; So in case of trouble, try it out
switchdialcommand=No
; 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
send_reminder=NO
; enable to monitor the call (to record all the conversations)
; value : YES - NO
record_call=NO
; format of the recorded monitor file
monitor_formatfile=gsm
;base currency define the default currency that you want to use to setup your system (see the file /etc/asterisk/rates.inc 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 =
; CURRENCY SECTION
; 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 LES.net 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 TECH = sip
PROVIDER IP= 192.168.1.132 (IP address of my asterisk server)
And the other local is to dial locally in my case Toronto Canada
PROVIDER TECH = sip
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