Asterisk V1.6.0.8, Freepbx V2.5.1, and A2Billing V1.3.4: Installation Guide For Linux Ubuntu 8.10
Asterisk V1.6.0.8, Freepbx V2.5.1, and A2Billing V1.3.4: Installation Guide For Linux Ubuntu 8.10
Asterisk v1.6.0.8, FreePBX v2.5.1, and A2Billing v1.3.4 : Installation Guide for Linux UBUNTU 8.10
Hariharan Subramanian, Himanshu Gera and Sunny Gogar Electrical and Computer Engineering, University of Florida
# apt-get install bison openssl libssl-dev libasound2-dev libc6-dev libnewt-dev libncurses5-dev zlib1g-dev gcc make g + + libusb-dev fxload
The packages are then Downloaded, extracted and installed following the below mentioned steps: 5.The packages are downloaded and extracted from the following:
# wget http://ftp.digium.com/pub/asterisk/asterisk-1.6.0.1.tar.gz # wget http://downloads.digium.com/pub/telephony/libpri/libpri-1.4.8.tar.gz # wget http://downloads.digium.com/pub/telephony/dahdi-linux/dahdi-linux-2.1.0.3.tar.gz # wget http://downloads.digium.com/pub/telephony/dahdi-tools/dahdi-tools-2.1.0.2.tar.gz # tar xvzf asterisk-1.6.0.1.tar.gz # tar xvzf libpri-1.4.8.tar.gz # tar xzvf dahdi-linux-2.1.0.3.tar.gz # tar xzvf dahdi-tools-2.1.0.2.tar.gz
6.Then Compiling the dahdi-linux is done by using:
10. Finally, compile the Asterisk. Currently the last available version is 1.6.0.2, but I had problems trying to install it. So I recommend installing the 1.6.0.1 version, which until now has not had a single problem. To install it, run:
#. / configure # make # make install # make samples / / install the examples # make config
# cd /usr/src/ # sudo wget http://downloads.digium.com/pub/asterisk/asterisk-addons-1.6.0.8.tar.gz # sudo tar -zxvf asterisk-addons-1.6.0.8.tar.gz # cd asterisk-addons-1.6.0.8 # ./configure # make clean # make # sudo make install
2. Download FreePBX
# sudo nano /etc/apache/envvars change : export APACHE_RUN_USER=www-data & export APACHE_RUN_GROUP=wwwdata to: export APACHE_RUN_USER=asterisk & export APACHE_RUN_GROUP=asterisk # sudo nano /etc/apache2/sites-enabled/000-default
3
# sudo nano /etc/php5/apache2/php.ini change: upload_max_filesize to upload_max_filesize = 20M # sudo nano /etc/php5/cli/php.ini change: upload_max_filesize to upload_max_filesize = 20M Set the php lib directory to be owned by asterisk so that it can make changes to the php.ini # sudo chown asterisk:asterisk /var/lib/php5 -R Set ownership of the /var/www directory to asterisk so it can write to files # sudo chown asterisk:asterisk /var/www -R
5. Restart Apache
mysqladmin create asterisk mysqladmin create asteriskcdrdb mysql asterisk < SQL/newinstall.sql mysql asteriskcdrdb < SQL/cdr_mysql_table.sql mysql GRANT ALL PRIVILEGES ON asterisk.* TO asteriskuser@localhost IDENTIFIED BY 'amp109'; GRANT ALL PRIVILEGES ON asteriskcdrdb.* TO asteriskuser@localhost IDENTIFIED BY 'amp109'; flush privileges; quit
Note: Before installing Freepbx make sure you copy this particular file because FreePBX installation will overwrite it
If all the FreePBX requirements are satisfied then installation will run smoothly and you will be asked certain details to be entered. If not then make sure you have all of these installed on your system.
apt-get install asterisk asterisk-mysql asterisk-mp3 php-db php5-gd php-pear sox curl
Just use the default values for everything by pressing an enter for every question asked dont change anything except ampwebroot because these are freepbx configuration requirements and they have to be same as default for the beginners. Advanced settings can be done but not covered here. Out of all the questions you will need to change only this
AMPWEBROOT=/var/www/
Note: If you have put FreePBX on a subdirectory, the panel will not work under the admin pages. There are two approaches to make it work Step 1: Change the file /var/www/freepbx/admin/views/panel.php
// where it reads // '<iframe width="97%" height="600" frameborder="0" align="top" src="../../panel/index_amp.php?context='.$deptname.'"></iframe>'. // you should erase one step back in the uri, as it shows here '<iframe width="97%" height="600" frameborder="0" align="top" src="../panel/index_amp.php?context='.$deptname.'"></iframe>'.
Go to step 2.
Or
Step 1: create a virtual server and access your freepbx as http://freepbx If you have access to the dns you can add a virtual server in Apache and avoid this last . Edit the file /etc/apache2/sites-available/freepbx and put this.
<VirtualHost *:80> ServerName freepbx ServerAlias freepbx ServerAdmin [email protected] ErrorLog /var/log/apache2/freepbx.error.log CustomLog /var/log/apache2/freepbx.access.log combined DocumentRoot /var/www/freepbx <Directory /var/www/freepbx> Options Indexes FollowSymLinks MultiViews Order allow,deny AllowOverride All
5
Allow from all </Directory> <Directory /var/www/freepbx/admin> AuthType Basic AuthName "Restricted Area" AuthUserFile freepbx-passwd Require user admin </Directory>
</VirtualHost>
Make a symlink to make it available
ln -s /etc/apache2/sites-available/freepbx /etc/apache2/sites-enabled/099-freepbx
And add a password file with the password you want.
/etc/init.d/apache2 restart
Restore the backup you've made of your modules.conf
cp ~/asterisk-modules.conf /etc/asterisk/modules.conf
If you have forgotten to make that backup, disable two libraries that are stopping asterisk to work. To disable a library you can add lines in /etc/asterisk/modules.conf. The autoload directive will load anything in the lib directory (/usr/lib/asterisk/modules) unless you put the line noload in the configuration file, before the global directive.
GRANT ALL PRIVILEGES ON mya2billing.* TO 'a2billinguser'@'%' IDENTIFIED BY 'a2billing' WITH GRANT OPTION; //security issue GRANT ALL PRIVILEGES ON mya2billing.* TO 'a2billinguser'@'localhost' IDENTIFIED BY 'a2billing' WITH GRANT OPTION; GRANT ALL PRIVILEGES ON mya2billing.* TO 'a2billinguser'@'localhost.localdomain' IDENTIFIED BY 'a2billing' WITH GRANT OPTION; \q (to quit)
3. Create a2billing database
cd trunk/Database/mysql/<mysql-version> mysql mya2billing -u a2billinguser -p < a2billing-mysql-schema-MYSQL.5.X-v1.2.3.sql <insert a2billing password: "a2billing"> exit
5. Verify database installation
mysql mya2billing -u a2billinguser -p Prompt will ask you for password, in our case enter 'a2billing'.It should the correct details if not try to again dropping the database and repeat the steps for creating the database. Make sure you have correct A2Billing database in MySQL 6. Configure A2Billing with your database.Place the file a2billing.conf into your /etc/asterisk/ directory
cp /usr/src/a2billing/trunk/a2billing.conf /etc/asterisk/
7. Setup the database access
vi /etc/asterisk/a2billing.conf
You will have to change the username=a2billing,database=a2billing and password = "yoursecretpassword"
configuration for the Web interface [webui] ; Path to store the asterisk configuration files buddyfilepath = /etc/asterisk/ ; Email of the admin (not used yet) email_admin = [email protected] ; Card lenght len_cardnumber = 10 ; Voucher lenght len_voucher = 15 ;amount of MOH class you have created in musiconhold.conf : acc_1, acc_2... acc_10 class etc... num_musiconhold_class = 10 ;MANAGER CONNECTION PARAMETERS manager_host = localhost manager_username = myasterisk manager_secret = mycode ; Allow to display the help section inside the admin interface (YES - NO) show_help="YES" ; Parameter of the upload ; PLEASE CHECK ALSO THE VALUE IN YOUR PHP.INI THE LIMIT IF 2MG BY DEFAULT my_max_file_size_import = 512000 my_max_file_size = 512000 ; in bytes ; Not used yet, goal is to upload files and use them directly in the IVR
8
dir_store_audio = /var/lib/asterisk/sounds/a2billing ;Parameter of the upload my_max_file_size_audio=3072000 ; in bytes ; the file type extensions allowed to be uploaded such as "gsm, mp3, wav" (separate by ,) file_ext_allow = gsm, mp3, wav ; the file type extensions allowed to be uploaded for the musiconhold such as "gsm, mp3, wav" (separate by ,) file_ext_allow_musiconhold = mp3 ; ENABLE THE CDR VIEWER TO LINK ON THE MONITOR FILES (YES - NO) link_audio_file = "NO" ; PATH TO LINK ON THE RECORDED MONITOR FILES monitor_path = /var/spool/asterisk/monitor // grant access to apache user on read mode for the directory :> chmod 755 /var/spool/asterisk/monitor/ ; FORMAT OF THE RECORDED MONITOR FILE monitor_formatfile = gsm ; Display the icon in the invoice show_icon_invoice = "YES" ; Display the top frame (useful if you want to save space on your little tiny screen ) show_top_frame = "NO"
Files / directory right set writing rights /etc/asterisk/ in order to let the web interface write the sip/iax configuration files
#include additional_a2billing_sip.conf
In iax.conf, add the following line at the end
#include additional_a2billing_iax.conf
9. Configure the manager
vi /etc/asterisk/manager.conf
Ensure that enabled=yes
11. Install The AGI components : IVR asterisk2billing application Place the entire content of the directory A2Billing_AGI into your agi-bin directory.
; the debug level ; 0=none, 1=low, 2=normal, 3=all debug=0 ; if we want to manage the answer on the call answer_call=yes ; Active the logging of the application ; logging is optimized to write all the logs at once :D logger_enable=YES ; File to log log_file=/tmp/a2billing.log ; if YES Use Set(LANGUAGE()=fr) instead, for me it didnt work from AGI ; ### if (SETLANGUAGE_DEPRECATE==YES) $myres = $agi->agi_exec("EXEC
10
Set('LANGUAGE()=$language')"); setlanguage_deprecate=YES ; play the goodbye message when the user finish say_goodbye=NO ; enable the menu to choose the language ; press 1 for English, pulsa 2 para el espaol, Pressez 3 pour Franais 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 install) force_language= ; Introduction prompt : to specify an additional prompt to play at the beginning of the application ; parlezplus-intro_013centimes intro_prompt= ; lenght of the cardnumber (amount of digits) len_cardnumber=10 ; Alias-Card lenght len_aliasnumber = 15 ; Voucher lenght len_voucher = 15 ; this is the minimum amount of credit to use the application min_credit_2call=0 ; if user doesnt have enough credit to call a destination XXX prompt him to enter an other cardnumber notenoughcredit_cardnumber=YES ; if notenoughcredit_cardnumber = YES then assign the CallerID to the new cardnumber notenoughcredit_assign_newcardnumber_cid=YES ; if YES it will catch the DNID and try to dial it out directly without asking for the phonenumber to call ; value : YES, NO use_dnid=NO ; list the dnid on which you want to avoid the use of the previous option "use_dnid" no_auth_dnid=2400,2300 ;number of time the user can dial different number
11
number_try=3
; Play the balance to the user after the authentication (values : yes - no) say_balance_after_auth=YES ; Play the balance to the user after the call (values : yes - no) say_balance_after_call=NO ; Play the time the user can call (values : yes - no) say_timetocall=YES ; enable the callerid authentication ; if this option is active the CC system will check the CID of caller cid_enable=NO ; if the cid doesnt exist you can then ask a cardnumber to the calling party in order to authenticate the caller cid_askpincode_ifnot_callerid=YES ; 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=YES ; 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 here 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 ; enable the option to call sip/iax friend for free (values : YES - NO) sip_iax_friends=NO
12
; if SIP_IAX_FRIENDS is active, you define a prefix for the dialed phonenumber to call directly a pstn number ; values : number sip_iax_pstn_direct_call_prefix=9 ; this will enable a prompt to enter your destination number_try ; 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 ; 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[:y][:z]): 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="|30|HL(%timeout%:61000:30000)" ; by default (3600000 = 1HOUR MAX CALL) dialcommand_param_sipiax_friend="|30|HL(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 troubles, try it out switchdialcommand=NO
; When a call find a negative route or a free route is adviced to limite the call duration : amount in secons maxtime_tocall_negatif_free_route = 5400
; enable to monitor the call (to record all the conversation) ; value : YES - NO record_call=NO ; format of the recorded monitor file
13
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 extension) 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 here the file you want to play when we prompt the calling party to enter his destination number ; file_conf_enter_destination = prepaid-enter-number-u-calling-1-or-011 file_conf_enter_destination = prepaid-enter-dest ; Please enter here the file 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 ; the debug shell (ONLY FOR THE DEVELOPERS) ; 0=no, 1=yes debugshell=0
[a2billing] ; CallingCard application exten => _X.,1,Answer exten => _X.,2,Wait,2 exten => _X.,3,DeadAGI,a2billing.php exten => _X.,4,Wait,2 exten => _X.,5,Hangup
If you just want to be able to start A2Billing from FreePBX , create a new custom trunk with 'Custom Dial String' set to 'A2B/1' and add the following to /etc/asterisk/extensions_custom.conf:
[macro-dialout-trunk-predial-hook]
14
exten => s,1,GotoIf($["${OUT_${DIAL_TRUNK}:4:4}" = "A2B/"]?custom-freepbxa2billing,${OUTNUM},1:2) exten => s,2,MacroExit [custom-freepbx-a2billing] exten => _X.,1,DeadAGI(a2billing.php|${OUT_${DIAL_TRUNK}:8}) exten => _X.,n,Hangup()
CLI>reload CLI>exit
15