Welcome to the AstBill Manual
This is still work in progress
We need HELP!
http://astbill.com/helpwanted
About Astbill
As part of AstarTelecom's mission to to deliver Low Cost Call Termination and User Friendly PBX's we are testing a software called AstBill. We belive in organising caller information and make it accessible and useful,
We love to hear from our users because it reminds us of why we're doing this in the first place... to create a better VOIP experience. And there's still so much to do.
THIS IS WORK IN PROGRESS.
The following is an attempt to explain how AstBill is using Asterisk REALTIME engine for provisioning of SIP and IAX accounts.
AstBill the Web-based open source Billing and Management software for Asterisk includes very usefull information.
in AstBill the MySQL table 'astcountrycode' contain 601 records of countries and US states including the countrycode and US State Codes.
The MySQL table 'astroute' contain 1412 routing record for Outgoing trunk routing. In AstBill you can assign each of these routes to any 'outgoing trunk' as you wish. This is the perfect routing engine for Asterisk and unlike other systems. You don't need to enter all the basic data by your self. It is all provided to you FREE OF CHARGE from the AstBill Team.
The MySQL table 'astpricelist' contain 4179 records as examples of pricing records for your customers. You can have as many price lists (brands) for each route you want in any currency.
AstBill is a FREE real time billing engine for Asterisk. By using AstBill to process your Asterisk calls you get real time credit control of your customers.
When any SIP or IAX client places a call AstBill will do a credit control. If the account has Sufficient founds to place a call then AstBill will calculate the amount needed for the duration of the call. (By default calls disconnect after max 60 minutes. You can change that.) AstBill will create a record in the MySQL table 'astcreditres' with the uniqueid, user and MAX COST of the call. Next time somebody are using the same account to make a call AstBill will check that there are founds available for the customer and deduct any entry reserved for that customer in the MySQL table 'astcreditres' before AstBill decide the max length of the call the client is allowed to use.
The CDR in AstBill have two parts. When the call is initiated the CDR info available is stored in the table 'astcdr'. When the call is terminated the rest of the information about the call is updated in the CDR. The cost of the call is calculated and deducted from the customers balance. The record for reserved founds in 'astcreditres' is deleted There are some advantages to this as it allows us to query the database at any time to know how many calls are currently being processed without using the Asterisk Manager Interface.
am looking for some help with a customised astabill billing platform....anyone?
AstBill is not using the Asterisk REALTIME engine for extensions.
We think we have found an excellent solution that is compatible with earlier versions of asterisk. All call processing is done in agi using the Perl script agiastar.agi
If you study agiastar.agi you will see that must of the processing is done by MySQL Stored Procedures. The Perl scrip is basically only a wrapper.
Our use of extensions.conf is simple:
[astartelecom-iax]
exten => _0[0-9].,1,AGI(agiastar.agi,${EXTEN})
exten => _0[0-9].,2,GotoIf($["${BILLSTATUS}" = "NOCREDIT"]?20)
exten => _0[0-9].,3,GotoIf($["${BILLSTATUS}" = "INVALID"]?30)
exten => _0[0-9].,4,Dial(${DIALSTRING})
exten => _0[0-9].,20,Playback(beep)
exten => _0[0-9].,21,Playback(not-enough-credit) ; Tells them they do not have enough money
exten => _0[0-9].,22,Hangup
exten => _0[0-9].,30,Playback(beep)
exten => _0[0-9].,31,Playback(that-is-not-rec-phn-num) ; "That is not a recognized phone number."
exten => _0[0-9].,32,Hangup
MySQL will return the variable ${DIALSTRING} to Asterisk. It will also return ${BILLSTATUS} for credit control. All processing in agiastar.agi is done from the MySQL database In real-time. But we are not using the Asterisk Real-time engine.
With the AstBill solution call handling is completely dynamic. New accounts, change between SIP or IAX, Virtual Accounts and forwarding of calls are all happening in real time as the users are changing the configuration.
You can find more examples in the AstBill manual.
It is still work in progress, but please take a look at
http://astbill.com/manual
For the latest INSTALL.txt
http://astbill.com/install
For the latest CHANGELOG.txt
http://astbill.com/changelog
For Support:
http://astbill.com/forum/3
Installation instructions for AstBill Version 0.9.20
Please read INSTALLMYSQL.txt and have your MySQL 5 Server working before you start the instructions in this file.
1.0 - Introduction:
AstBill is a Billing, Routing and Management software for Asterisk and MySQL
Running on Drupal, A open source content management platform. AstBill gives a Web-Interface to Asterisk.
2.0 - Requirements:
Asterisk - Version 1.2.14
(Most of AstBill is also working on Asterisk 1.0.9 but 1.2.14 is needed for the REALTIME features)
Asterisk - Addons Version 1.2.5
(We are only using the module res_config_mysql from Asterisk - Addons)
See enclosed file modules.conf for modules to unload to awoid error messages
Asterisk - Sounds Version 1.2.1
MySQL - Version 5.0.27
(Astbill is using Views and Stored Procedures, which is only in MySQL 5 and up - See mysql Ver 5 Manual Section 2.7)
Please read INSTALLMYSQL.txt
Install perl DBI DBD-mysql
In Debian you install with the command
apt-get install -y libdbd-mysql-perl
Apache - Version 2.0.54
(It runs fine with apache Version 1.x aswell, but we only test on 2.x)
Drupal - Version 4.6.10 (Included in the wwwroot directory of this AstBill Distribution)
3.0 - Installation Instructions:
First of all, make sure you have all the requirements set up properly.
3.1. Extract astbill-0.9.20.tar.bz2 to /home
cd /home
tar jxvf astbill-0.9.20.tar.bz2
cd /home/astbill
chmod +x install.sh
IMPORTANT: Back up your files in the directory /etc/asterisk
Run the install script. Run it from the AstBill Home Directory!
cd /home/astbill
./install.sh
Read INSTALLMYSQL.txt and Prepare MySQL 5 for AstBill.
You have to edit /etc/asterisk/res_mysql.conf for your OS.
You have to put the right path to mysql.sock. (See INSTALLMYSQL.txt. You need the same path as in /etc/my.cnf)
AstBills WebRoot is now in /home/astbill/wwwroot This is what has to be published to the Web server
On Linux Ensure wwwroot of AstBill is visible for the Apache Web Server
ln -s /home/astbill/wwwroot /var/www/html/astbill
Remember the files in the ajax directory have to be one level down from your web root. In a sub directory called ajax.
This is allready done if you are using AstBill's wwwroot
/home/astbill/astbill.conf contain MySQL username and passwords used for the PHP scrips in the ajax directory
and the Perl agi scrips in the /var/lib/asterisk/agi-bin/ directory.
You have to change this if you change the default mysql username and password. (highly recomended when your system is up and running)
Edit wwwroot/sites/default/settings.php and change the following variables.
(Use the search function of your editor to find the variables!)
example:
nano -w wwwroot/sites/default/settings.php
Make sure the $db_url line matches the database defined in the previous steps:
$db_url = "mysql://username:password@localhost/database";
where 'username', 'password', 'localhost' and 'database' are the
username, password, host and database name for your set up.
The correct example for this guide is :
$db_url = 'mysql://astbilluser:astbill419@localhost/astbill';
Make sure $db_prefix is set to pbx_ or AstBill will NOT WORK!
$db_prefix = 'pbx_';
Set $base_url to the URL of your AstBill main page, with no trailing slash.
$base_url = 'http://127.0.0.1/astbill';
3.5. Test your installation
Go to the url where you have installed drupal
Example http://127.0.0.1/astbill
You should get a login box and a default blue theme with a AstBill logo.
An admin account is already set up.
username: astbill
password: demoastbill
There is no need to download Drupal. Drupal is included in the directory wwwroot
Apache
Make sure to edit /etc/php4/apache2/php.ini and check that
extension=mysql.so
extension=gd.so
You can find them commented under this section, if not just add the above lines.
;;;;;;;;;;;;;;;;;;;;;;
; Dynamic Extensions ;
;;;;;;;;;;;;;;;;;;;;;;
3.3. Preparing Asterisk for AstBill
It is time to start Asterisk
asterisk -vvvvgc
5.0 - Support
Don't forget that this is free software under development!
Chances are good there's a crucial step that hasn't made it
into the documentation. If you have any problems feel free to
contact us on the forum http://astbill.com/forum/3
(please provide enough information to work with, and preferably be aware
of what you're doing!) and keep track of major changes to the
software, including performance improvements and security patches.
The best way to get support is by using the forums, this allows other users to learn from your request.
Andreas Mikkelborg - adoroar [Guess What?] astartelecom.com
Are Casilla - areast [Guess What?] astartelecom.com
AstBill is using MySQL Standard 5.0.13
You can find how to upgrade to 5.0 here.
The Standard binaries are recommended for most users, and includes the InnoDB storage engine.
http://dev.mysql.com/downloads/mysql/5.0.html
Linux (x86, glibc-2.2, static (Standard only), gcc) Standard 5.0.13 24.4M
The following should work on Debian 3.1 Sarge
mkdir -p /usr/local cd /usr/local # See http://dev.mysql.com/downloads/mysql/5.0.html for exact download location # They sometimes change it. wget http://dev.mysql.com/get/Downloads/MySQL-5.0/mysql-standard-5.0.13-rc-linux-i686.tar.gz/from/http://www.mirrorservice.org/sites/ftp.mysql.com/ tar zxvf mysql-standard-5.0.13-rc-linux-i686.tar.gz groupadd mysql useradd -g mysql mysql ln -s /usr/local/mysql-standard-5.0.13-rc-linux-i686 mysql cd mysql scripts/mysql_install_db --user=mysql chown -R root . chown -R mysql data chgrp -R mysql . To start mysqld at boot time you have to copy support-files/mysql.server to the right place for your system. on debian you can put it in /etc/init.d/ and run update-rc.d mysql.server defaults /etc/my.cnf : in the file my.cnf You may have to change the socket to: (This may only apply to Debian) socket = /var/run/mysqld/mysqld.sock To start MySQL cd /usr/local/mysql/bin/ ./mysqld_safe --user=mysql & If you later need to Shutdown MySQL cd /usr/local/mysql/bin/ ./mysqladmin -uroot -p shutdown To Test that MySQL is Running: cd /usr/local/mysql/bin/ ./mysql -p mysql> SHOW DATABASES; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | test | +--------------------+ 3 rows in set (0.00 sec) QUIT;
Preparing MySQL 5 for AstBill
Make sure MySQL 5 is running.
cd /usr/local/mysql/bin (Or where you installed MySQL)
./mysqld_safe --user=mysql &
cd /usr/local/mysql/bin
Create the AstBill database:
./mysqladmin -u root password 'mysql_root_pw' (If you already have a root password for mysql you can ignore this)
./mysqladmin create astbill -p
./mysql --user=root -p astbill < /home/astbill/astbill-0.9.0.5/database/astbill.sql
./mysql --user=root -p astbill < /home/astbill/astbill-0.9.0.5/database/astbill_proc.sql
Grant access to the AstBill database:
./mysql --user root -p
Set the correct permissions for the user astbilluser.
mysql> GRANT ALL PRIVILEGES ON astbill.* TO astbilluser@localhost IDENTIFIED BY 'astbill419';
Query OK, 0 rows affected (0.00 sec)
Since we are using MySQL 5, we convert back to old password hashing algorithm for compatibility reasons.
mysql> SET PASSWORD FOR 'astbilluser'@'localhost' = OLD_PASSWORD('astbill419');
Query OK, 0 rows affected (0.00 sec)
**Note the default mysql username/password is astbilluser/astbill419.
Copy the correct my.cnf to the /etc/my.cnf for your system.
cp /usr/local/mysql/support-files/my-medium.cnf /etc/my.cnf
If you are using Debian and many other Linux you have to change the following in /etc/my.cnf
[client]
socket = /var/run/mysqld/mysqld.sock
[mysqld]
socket = /var/run/mysqld/mysqld.sock
In Debian you also have to do the following to ensure correct permissions for mysqld.sock
mkdir -p /var/run/mysqld
chown -R mysql:www-data /var/run/mysqld
To Test that MySQL is Running:
cd /usr/local/mysql/bin/
./mysql -p
mysql> use astbill;
Database changed
mysql> show tables;
+------------------------------+
| Tables_in_astbill |
+------------------------------+
| astaccount |
| astbrand |
| astcdr |
| astconference |
| astcountrycode |
| astcreditres |
| astcurrency |
| astdialplan |
| astemailtext |
| astextension |
| asthardware |
| asthardwareid |
| astinvoice |
| astinvoiceline |
| astlog |
| astpayment |
| astpricelist |
| astpricelistghost |
| astreseller |
| astroute |
| aststatus |
| asttenant |
| asttrunk |
| astuser |
| asv_friend |
| asv_iax |
| asv_peers |
| asv_sip |
| asv_trunk_dialplan |
| asv_trunk_dialplan2 |
| asv_voicemail |
| asvaccount |
| asvaccount2 |
| asvaccountcalls |
| asvaccountpaid |
| asvaccountprice |
| asvbill |
| asvcall |
| asvprice |
| asvprice_group |
| asvprice_uk |
| asvprice_uk_all |
| asvprice_usa |
| pbx_access |
| pbx_accesslog |
| pbx_aggregator_category |
| pbx_aggregator_category_feed |
| pbx_aggregator_category_item |
| pbx_aggregator_feed |
| pbx_aggregator_item |
| pbx_authmap |
| pbx_blocks |
| pbx_book |
| pbx_boxes |
| pbx_cache |
| pbx_comments |
| pbx_contact_category |
| pbx_contact_directory |
| pbx_directory |
| pbx_files |
| pbx_filter_formats |
| pbx_filters |
| pbx_flood |
| pbx_forum |
| pbx_history |
| pbx_locales_meta |
| pbx_locales_source |
| pbx_locales_target |
| pbx_menu |
| pbx_moderation_filters |
| pbx_moderation_roles |
| pbx_moderation_votes |
| pbx_node |
| pbx_node_access |
| pbx_node_comment_statistics |
| pbx_node_counter |
| pbx_permission |
| pbx_poll |
| pbx_poll_choices |
| pbx_profile_fields |
| pbx_profile_values |
| pbx_queue |
| pbx_role |
| pbx_search_index |
| pbx_search_total |
| pbx_sequences |
| pbx_sessions |
| pbx_system |
| pbx_term_data |
| pbx_term_hierarchy |
| pbx_term_node |
| pbx_term_relation |
| pbx_term_synonym |
| pbx_url_alias |
| pbx_users |
| pbx_users_roles |
| pbx_variable |
| pbx_vocabulary |
| pbx_vocabulary_node_types |
| pbx_watchdog |
+------------------------------+
100 rows in set (0.01 sec)
mysql> show procedure status;
+-------------+-------------------+-----------+----------------+---------------------+---------------------+---------------+---------+
| Db | Name | Type | Definer | Modified | Created | Security_type | Comment |
+-------------+-------------------+-----------+----------------+---------------------+---------------------+---------------+---------+
| astbill | astCreateAcc | PROCEDURE | root@localhost | 2005-10-04 10:05:29 | 2005-10-04 10:05:29 | DEFINER | |
| astbill | astCreateAccount | PROCEDURE | root@localhost | 2005-10-04 10:05:29 | 2005-10-04 10:05:29 | DEFINER | |
| astbill | RateAddcdr | PROCEDURE | root@localhost | 2005-10-04 10:05:29 | 2005-10-04 10:05:29 | DEFINER | |
| astbill | RateCost | PROCEDURE | root@localhost | 2005-10-04 10:05:29 | 2005-10-04 10:05:29 | DEFINER | |
| astbill | RateGetTrunk | PROCEDURE | root@localhost | 2005-10-04 10:05:29 | 2005-10-04 10:05:29 | DEFINER | |
| astbill | RateReserveCredit | PROCEDURE | root@localhost | 2005-10-04 10:05:29 | 2005-10-04 10:05:29 | DEFINER | |
| astbill | RateSale | PROCEDURE | root@localhost | 2005-10-04 10:05:29 | 2005-10-04 10:05:29 | DEFINER | |
| astbill | RateStarDead | PROCEDURE | root@localhost | 2005-10-04 10:05:29 | 2005-10-04 10:05:29 | DEFINER | |
+-------------+-------------------+-----------+----------------+---------------------+---------------------+---------------+---------+
8 rows in set (0.01 sec)
mysql> SHOW DATABASES;
+--------------------+
| Database |
+--------------------+
| information_schema |
| astbill |
| mysql |
| test |
+--------------------+
4 rows in set (0.00 sec)
QUIT;
cd /usr/local/mysql
wget http://dev.mysql.com/get/Downloads/MySQL-5.0/mysql-standard-5.0.13-rc-linux-i686.tar.gz/from/http://www.mirrorservice.org/sites/ftp.mysql.com/
tar zxvf mysql-standard-5.0.13-rc-linux-i686.tar.gz
cd /usr/local/mysql
bin/mysqladmin -uroot -p shutdown
cp -fr /usr/local/mysql/data/* /usr/local/mysql-standard-5.0.13-rc-linux-i686/data/
cd /usr/local
rm mysql
ln -s mysql-standard-5.0.13-rc-linux-i686 mysql
cd mysql
chown -R root .
chown -R mysql data
chgrp -R mysql .
# To start MySQL
bin/mysqld_safe --user=mysql &
By Mohamed at Wed, 2005-10-12 02:58
I had a rought time installing Php-mysql and mysql 5.0.13 and I have notice that other people are having the same issue. This is how I made it work on my system. My installation is from a fresh install.
1. I downloaded Asterisk@home BETA 3 and installed on my system. This has Cento4 and asterisk 1.2 beta.
2. Then did " yum update" to update linux
3. the did " yum remove mysql-server" ( this is to uninstall mysql 4.1 that is installed by default and all the dependencies. )
4. download thesee three packages form mysql.com site
MySQL-server-standard-5.0.13-0.rhel3
MySQL-client-standard-5.0.13-0.rhel3
MySQL-shared-compat-5.0.13-0 –(package includes clientlibXXXX.14 and clientlibxxxxx.15. this is the package that will resolve the clientlibxxxx dependencies when installing php-mysql)
5. installed php-mysql using yum by typeing - "yum install php-mysql"
6. Install perl-DBD-MySQ using yum by typing- "yum install perl-DBD-MySQL"
7. The rest of the steps I followed the installation instruction that came with astbill.
I hope this will help.
Thanks
Mohamed Omar
Some machines have mysql.sock as /var/run/mysqld/mysqld.sock
This is not compatible with Perl library by default
Use the below commands to create a symlink.
mkdir -p /var/lib/mysql
cd /var/lib/mysql
ln -s /var/run/mysqld/mysqld.sock mysql.sock
Dear all
I hope all be ok
gentlemen ...
I be gratefully if I get any information book PDf about astbil
With Thanks
imad
This is a list of How To's written for AstBill.