Installation Guide
Preparing your system for Asterisk2Billing
This chapter aims to help you to prepare you system for Asterisk2Billing. Choose an Operating System / Distribution
Know Os working with A2billing ( tested)
- Fedora Core 2,3,4,5
- Debian 3.01
- Centos
The Asterisk PBX was originally designed for the Linux operating system. Due to the popularity of Asterisk, it has since been ported to BSD and Mac OS X. Nevertheless, Digium PSTN cards are designed to work on Linux i386. The use of Linux is recommended.
I personally love Fedora :D but it's a question of preferences... Install Asterisk & have it up running
Information is from the VoIP-Info Wiki : http://voip-info.org Get Asterisk from precompiled binary packages
There are precompiled binary packages available for download, created by non-Digium contributors:
- RPM packages for Linux : http://voip-info.org/tiki-index.php?page=Asterisk+RPM
- DEB packages for Linux : http://voip-info.org/tiki-index.php?page=Asterisk+DEB
- Asterisk.pkg install package for MacOS X : http://www.astmasters.net/stuff/Asterisk.pkg.tgz
For those who are using Trixbox, you can follow the instructions here - TrixboxInstall
Additionally, Trixbox user who wants to use the SVN Trunk can upgrade to MySQL5 with the instructions at TrixboxMysql
Get Asterisk from sources & compile
Please check out : http://www.asterisk.org Commands to get the current snapshot from the release branch of SVN:
# svn checkout http://svn.digium.com/svn/asterisk/branches/1.2 asterisk-1.2 # svn checkout http://svn.digium.com/svn/zaptel/branches/1.2 zaptel-1.2 # svn checkout http://svn.digium.com/svn/libpri/branches/1.2 libpri-1.2
Now, you have to compile the sources.
cd /usr/src/libpri make && make install cd /usr/src/zaptel make && make install cd /usr/src/asterisk make && make install
Links for Asterisk installation
- Asterisk OS Platforms
- 10-minute guide to Asterisk
- Step-by-step Installation
- Asterisk Download
- Asterisk Compile
Linux Requirements
- Apache
- PHP
- POSTGRESQL or Mysql
- php-pcntl ( check with php -m )
- use phpagi 2.14 included http://phpagi.sourceforge.net
- need GD library
- jpgraph_lib (included)
Verify the server installation
Verify that Asterisk is working
Are you able to make calls between two SIP/IAX friends registered on your Asterisk PBX? Are you able to make an outgoing call through one of your registrars (e.g. fwd...) from a SIP phone? If you answered no to any of the above questions, you should check your Asterisk configuration, that is unfortunately not covered in this document.
If you need information about Asterisk configuration, we will advise you to read the Asterisk Handbook Verify Apache/PHP installation APACHE
Check if the httpd server is installed with <t>rpm -qa|grep httpd<\t> if you don't find httpd, it means that you didn't find it, lol :)
To install the Apache server, you can quickly use YUM or APT-GET, or you can find the appropriate packages for your distribution and install them.
apt-get install httpd
(debian OS)
Or
yum install httpd
(Fedora OS. etc.)
Check httpd status if it's install already (On RedHat? Linux 9 & Fedora)
/etc/init.d/httpd status
Normally, you should get something like this
httpd (pid 7486 3710 3709 3708 3707 3706 3705 3704 3703 3700) is running...
if you see that it's not running
/etc/init.d/httpd start
Starting httpd: [ OK ]
To enable apache server permanently to start after reboot, please check chkconfig or something similar if you are running another distro: if you don't check your Apache configuration. [edit] PHP
check if it's install
rpm -qa | grep php
you should get something like
php-imap-4.3.10-2.4 php-pgsql-4.3.10-2.4 php-4.3.10-2.4 php-mysql-4.3.10-2.4 php-mbstring-4.3.10-2.4 php-mmcache-4.3.10_2.4.6-4.1.fc2 php-pear-4.3.10-2.4 php-pcntl-4.3.9-3.1.1
PHP
Requirements are :
php, php-pgsql or php-mysql, perhaps php-gd (if it's a recent distro).
php-pcntl. If one of those are missing you will have to install it, see YUM or apt-get or by getting the appropriate packages.
Some systems like Debian has not a php-pcntl package but you can check if you have the pcntl module typing php -m. You can enable the pcntl support installing php5-cli with aptitude.
CentOS & Debian will probably request a little change in the php.ini (vi /etc/php.ini) you will have to add the following line where extension are defined. extension=pgsql.so (don't forget to reload apache after changes) Verify your postgresql installation [edit] Check if postgres is install
rpm -qa | grep postgres
you should have something like this
postgresql-server-7.3.2-3 postgresql-libs-7.3.2-3 postgresql-7.3.2-3
To install postgresql, if there are well configured, you can use YUM or APT-GET, if not you will have to find the appropriate packages and install it. apt-get install postgresql postgresql-server or for CentOS apt-get install rhdb
Check postgresql status (On RedHat?):
/etc/init.d/postgresql status
Or
service postgresql status
Or with CentOS
/etc/init.d/rhdb status
If it doesnt run yet, you have to start postgresql (On RedHat?):
/etc/init.d/postgresql start
Or
service postgresql start
Or
with CentOS
/etc/init.d/rhdb start
Normally, you should get this on RedHat?
Starting postgresql: [ OK ]
To enable postgresql server permanently to start after reboot, please check chkconfig (chkconfig postgresql --level 2345 on) [edit] Verify your Mysql installation
Check if Mysql is install :
rpm -qa | grep mysql
you should have something like this
mysql-3.23.58-16.FC3.1 mysql-server-3.23.58-16.FC3.1 mysql-devel-3.23.58-16.FC3.1
To install mysql, if there are well configured, you can use YUM or APT-GET, if not you will have to find the appropriate packages and install it.
apt-get install mysql mysql-server
Check mysql status (On RedHat?):
''/etc/init.d/mysqld status''
Or
service mysqld status
If it doesnt run yet, you have to start postgresql (On RedHat?):
/etc/init.d/postgresql start
Or
service postgresql start
Or with CentOS:
/etc/init.d/rhdb start
Normally, you should get this on RedHat?
Starting postgresql: [ OK ]
To enable postgresql server permanently to start after reboot, please check chkconfig (chkconfig postgresql --level 2345 on) Let's prepare our postgresql database server for A2Billing
Let's verify that postgresql allows access to all local users to all databases :
vi /var/lib/pgsql/data/pg_hba.conf
make sure that it ends with
local all all trust host all all 127.0.0.1 255.255.255.255 trust host all all your-webserver-ip 255.255.255.255 trust
vi /var/lib/pgsql/data/postgresql.conf
Make sure you uncomment and set []
tcpip_socket = True port = 5432
Remember the hosts were your postgresql and Apache are must trust each other or at least open this port if there is a firewall between your database and your web server.
/etc/init.d/postgresql restart
Or
service postgresql restart
Or with CentOS
/etc/init.d/rhdb restart Stopping postgresql service: [ OK ] Starting postgresql service: [ OK ]
Conclusion
You should have a fully installed Linux distribution working with Asterisk. The next chapter will deal with obtaining and installation A2Billing.
Getting & Installing A2Billing
This chapter aims to help you to install A2Billing on your system.
Getting the tarball
Note: Check [http://asterisk2billing.org] to find the most recent version!!!
cd /usr/src mkdir a2billing cd a2billing wget -O a2billing.tar.gz http://www.asterisk2billing.org/download.php?get=Asterisk2Billing_release_Chameleon_v1_2_3.tar.gz
Unpack the tarballs
tar -xzvf a2billing.tar.gz
Create the application's database - Postgres
su - postgres
Create Asterisk2Billing system/database user
Login as postgres and add a database user
create the postgres user, we use the username 'a2billinguser' but you can use whatever you want
createuser -W a2billinguser
You will be asked if the user can create databases, answer yes You will be asked if the user can create other users, answer no Use whatever password you want.
Create the database and populate it with the sql dump - postgresql
Create a2billing database
createdb -O a2billinguser a2billing
(that is an O for Owner)
su - postgres
Login to new database to check ownership
psql -d a2billing \du
List of database users
User name | User ID | Attributes -------------------------------------------------- a2billinguser | 100 | create database postgres | 1 | superuser, create database (2 rows) \q (to exit from database)
Import data schema into new database
psql -d a2billing -f /usr/src/a2billing/a2billing-pgsql-schema.sql -U a2billinguser -W
it will ask you for password then input the password you set before this step. This will create all the table with the 'a2billinguser' as Owner.
Let's verify database installation
psql -d a2billing -U a2billinguser -W
a2billing=> SELECT * FROM cc_ui_authen;
userid | login | password | groupid | perms | confaddcust | name | direction | zipcode | state | phone | fax | datecreation
--------+-------+------------+---------+-------+-------------+------+-----------+---------+-------+-------+-----+-------------------------------
2 | admin | mypassword | 0 | 1023 | | | | | | | | 2005-02-27 04:14:05.391501+02
1 | root | myroot | 0 | 1023 | | | | | | | | 2005-02-27 03:33:27.691314+02
(2 rows)
If you got the above, congratulations, you have installed correctly the postgresql database (that was the most difficult part). If you didn't, take a break, drop the database and start over.
To resume what we need :
- Postgres must be running.
- Postgres must trust local connections from the user a2billinguser on the database a2billing using a supported auth method(pg_hba.conf).
- Postgres must allow tcpip connections on port 5432 (postgresql.conf, firewall).
- The a2billing database must be owned by the application's user ( in our case, the user a2billinguser).
Create the application's database - Mysql
create database mya2billing;
Create Asterisk2Billing system/database user
Login on mysql database and ad a new mysql database user
As root
mysql mysql
create the mysql user, we use a username 'a2billinguser' but you can use whatever you want
SQL queries to create the new mysql user :
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)
Create the database and populate it with the sql dump - mysql
Create a2billing database
mysqladmin create mya2billing -u a2billinguser -p
prompt will ask you for password, in our case enter 'a2billing'
Import data schema into new 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">
it will ask you for password then input the password you set before this step. This will create all the table with the 'a2billinguser' as Owner.
Another alternative will be using 'source' command in mysql prompt. I used that command and it had MySQL create the required tables successfully.
Let's verify database installation
mysql mya2billing -u a2billinguser -p
prompt will ask you for password, in our case enter 'a2billing'
mysql> SELECT * FROM cc_ui_authen; +--------+-------+------------+---------+-------+-------------+------+-----------+---------+-------+-------+------+----------------+ | userid | login | password | groupid | perms | confaddcust | name | direction | zipcode | state | phone | fax | datecreation | +--------+-------+------------+---------+-------+-------------+------+-----------+---------+-------+-------+------+----------------+ | 2 | admin | mypassword | 0 | 1023 | NULL | NULL | NULL | NULL | NULL | NULL | NULL | 20050226211405 | | 1 | root | myroot | 0 | 1023 | NULL | NULL | NULL | NULL | NULL | NULL | NULL | 20050226203327 | +--------+-------+------------+---------+-------+-------------+------+-----------+---------+-------+-------+------+----------------+ 2 rows in set (0.00 sec)
If you got the above, congratulations, you have installed correctly the mysql database. If you didn't, take a break, drop the database and start over.
Configure A2Billing with your database
[edit] Install the file for the asterisk2billing configuration
Place the file a2billing.conf into your /etc/asterisk/ directory
cp /usr/src/a2billing/trunk/a2billing.conf /etc/asterisk/
This file contains all the configuration information for the Asterisk2Billing platform : Database connection parameters, AGI behaviour, Web interface Custom, etc...
First, let's start by setup the database access.
vi /etc/asterisk/a2billing.conf
This file contains different section to configure the several part of the application :
- section [database] : To configure the database connection
- section [webui] : To customize the web user interface
- section [recprocess] : configuration for the Reccurring process (cront job)
- section [agi-confX] : configuration for the AGI, several configurations can be defined, ie "agi-conf1", "agi-conf2", etc... the groupid parameter will define which configuration to use. Usage : DeadAGI(a2billing.php|%groupid%) by default agi-conf1 is used
First let's configure the database connection in the section [database], for this we have to change the username=a2billing,database=a2billing and password="yoursecretpassword"
[database] hostname=localhost port=5432 user=a2billinguser password=a2billing dbname=mya2billing dbtype=mysql
change the dbtype to "postgres" if you are running a2billing on PostgreSQL.
Description of the parameter
- HOST: This is the Database host name. Example: localhost
- PORT: Database port. Example: 5432
- USER: Username to access to the database. Example: a2billinguser
- PASS: Database password of the user. Example: password
- DBNAME: Name of the Database. Example: a2billing
- DB_TYPE: Database type. support: postgres (mysql is also supported)
Install management interface
Place the directory "A2Billing_UI" into your DocumentRoot? directory of your web server.
cp -rf /usr/src/a2billing/trunk/A2Billing_UI /var/www/html/. cd /var/www/html/A2Billing_UI chmod 777 templates_c
For you information you can check the apache DocumentRoot? in the httpd.conf file
# DocumentRoot?: The directory out of which you will serve your # documents. By default, all requests are taken from this directory, but # symbolic links and aliases may be used to point to other locations.
DocumentRoot "/var/www/html"
Configure & customize the Interface : a2billing.conf
To configure the Web interface you will need to make changes in the section [webui]
;
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 = info@areski.net ; 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 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
chmod 777 /etc/asterisk
mkdir /var/lib/asterisk/mohmp3/acc_1 mkdir /var/lib/asterisk/mohmp3/acc_2 mkdir /var/lib/asterisk/mohmp3/acc_ etc...
until the number you set in the a2billing.conf for the parameter NUM_MUSICONHOLD_CLASS, if 10 you will have to create 10 directory
Set writing rights for the web interface
chmod 777 /var/lib/asterisk/mohmp3/acc_*
the following directory "a2billing" is not used yet... but we will in the near future to configure automaticaly some audio files.
mkdir /var/lib/asterisk/sounds/a2billing chmod 777 /var/lib/asterisk/sounds/a2billing
SIP/IAX friends include
Asterisk2Billing is generating is own configuration files for SIP and IAX when you are using the SIP/IAX Friends features.
In sip.conf, add the following line at the end
#include additional_a2billing_sip.conf
In iax.conf, add the following line at the end
#include additional_a2billing_iax.conf
Configure the manager
Edit the manager configuration files,
vi /etc/asterisk/manager.conf
Ensure that enabled=yes
[general] enabled = yes port = 5038 bindaddr = 0.0.0.0 ;displayconnects = yes
Add an entry to allow a manager connection
[myasterisk] secret = mycode read = system,call,log,verbose,command,agent,user write = system,call,log,verbose,command,agent,user Configure MusicOnHold?
Edit the MusicOnHold? configuration files,
vi /etc/asterisk/musiconhold.conf
Add the following at the end, we are going here until acc_10, but you must define as many directory that you have create previously
; class definitions For A2Billing acc_1 => mp3:/var/lib/asterisk/mohmp3/acc_1 acc_2 => mp3:/var/lib/asterisk/mohmp3/acc_2 acc_3 => mp3:/var/lib/asterisk/mohmp3/acc_3 acc_4 => mp3:/var/lib/asterisk/mohmp3/acc_4 acc_5 => mp3:/var/lib/asterisk/mohmp3/acc_5 acc_6 => mp3:/var/lib/asterisk/mohmp3/acc_6 acc_7 => mp3:/var/lib/asterisk/mohmp3/acc_7 acc_8 => mp3:/var/lib/asterisk/mohmp3/acc_8 acc_9 => mp3:/var/lib/asterisk/mohmp3/acc_9 acc_10 => mp3:/var/lib/asterisk/mohmp3/acc_10
Give a try'''
Point your browser to http://hostname/A2billing_UI/index.php From this point, you should be able to login to the webpage Try log in with login=root, pass=myroot or login=admin, pass=mypassword Don't forget to change later your root and admin password.
Increase security of the Admin interface with an htaccess
The security of the admin interface is really important. If a thrid get connected to your admin interface he will be able to see information about your card/trunk, you can imagine then how he can use this data.
The htaccess will increase definitely the security of the web interface, so we will advice you to configure one over the admin/customer interface. We don't explain here how to do so, but through the links below you will find some good tutorial explaining how to do it.
- http://httpd.apache.org/docs/1.3/howto/htaccess.html
- http://www.freewebmasterhelp.com/tutorials/htaccess/3
- http://www.php-editors.com/apache_manual/howto/auth.html
- http://www.sitedeveloper.ws/tutorials/htaccess.htm
Install the customer web interface
Place the directory "A2BCustomer_UI" into your DocumentRoot? directory of your web server.
cp -rf /usr/src/a2billing/trunk/A2BCustomer_UI /var/www/html/. cd /var/www/html/A2BCustomer_UI chmod 777 templates_c
The customer web interface will use the file a2billing.conf to know the database parameter. Refer to the previous section "Install the file for the asterisk2billing configuration" to know how to define those database connection.
Install The AGI components : IVR asterisk2billing application
Place the entire content of the directory A2Billing_AGI into your agi-bin directory.
cd /usr/src/a2billing/trunk/A2Billing_AGI cp a2billing.php /var/lib/asterisk/agi-bin/. cp -rf libs_a2billing /var/lib/asterisk/agi-bin/.
Make sure the script is runnable
chmod +x /var/lib/asterisk/agi-bin/a2billing.php
Install Sounds files
cp sounds/* /var/lib/asterisk/sounds/. cp sounds/en/* /var/lib/asterisk/sounds/.
Note you will be asked if you want to overwrite, answer yes
For other language:
- install A2Billing Spanish Audio into /var/lib/asterisk/sounds/es/
- install A2Billing French Audio into /var/lib/asterisk/sounds/fr/
Don't forget to get the appropriate asterisk audio files to play the balance, time to call, other... To get the international asterisk audio files, you can find those available through the link
Configure & customize the AGI : a2billing.conf
To configure database access for the AGI we will still refer to the previous point "Install the file for the asterisk2billing configuration" that describe the [database] section.
section [agi-confX] : configuration for the AGI, several configurations can be defined, ie "agi-conf1", "agi-conf2", etc... the groupid parameter will define which configuration to use. Usage : DeadAGI(a2billing.php|%groupid%) by default agi-conf1 is used
Let's have a look over the parameter :
; 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 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 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 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
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
; 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
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
Configure extensions to run asterisk2billing into Asterisk
Edit extension.conf (/etc/asterisk/extensions.conf) Add the following link to the appropriate context, below I will create the context "asterisk2billing"
[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 use AMP, process as bellow (Can anybody confirm the following, this info is from the wiki and I dont use AMP to check it by myself)
for AMP and trixbox V1.0 it should go into extensions_trixbox.conf GP 12/6/6
Edit extension_custom.conf (/etc/asterisk/extension_custom.conf) and then add the following under the from-internal-custom context.
;asterisk2billing 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
You can replace above the _X. by a number if you want to set the application over a specific extension.
Note
If you just want to be able to start A2Billing from FreePBX (and therefore trixbox), 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]
exten => s,1,GotoIf($["${OUT_${DIAL_TRUNK}:4:4}" = "A2B/"]?custom-freepbx-a2billing,${OUTNUM},1:2)
exten => s,2,MacroExit
[custom-freepbx-a2billing]
exten => _X.,1,DeadAGI(a2billing.php|${OUT_${DIAL_TRUNK}:8})
exten => _X.,n,Hangup()
If you need to get clever, you can select which of A2B's [agi-confX] sections is used by changing the custom dial string, ie 'A2B/3' would use [agi-conf3].
Reload Asterisk to apply the changes
> Run asterisk -r CLI>reload CLI>exit
After setting an inbound route to use the A2B custom app, make a call into your PBX and you should hear "please enter your pin number...".
This should end the agi-php installation'''
