Change database

From AstBillWiki

Jump to: navigation, search

To change the name of the AstBill Database

There are 4 files to edit if you want to change the name of the AstBill Database.

/home/astbill/astbill.conf
/etc/asterisk/res_mysql.conf
/etc/asterisk/extconfig.conf
sites/default/settings.php

We are changing the name from astbill to voipbilling

astbill.conf
dbhost = localhost<BR>
dbname = voipbilling<BR>
dbuser = astbilluser<BR>
dbpass = astbill419<BR>

res_mysql.conf
[general]
dbhost = localhost
dbname = voipbilling
dbuser = astbilluser
dbpass = astbill419
dbport = 3306
; For Debian
dbsock = /var/run/mysqld/mysqld.sock
; For Asterisk @ Home
; dbsock = /var/lib/mysql/mysql.sock


extconfig.conf
;example => odbc,asterisk,alttable
iaxusers => mysql,voipbilling,asv_iax
iaxpeers => mysql,voipbilling,asv_iax

sipusers => mysql,voipbilling,asv_sip
sippeers => mysql,voipbilling,asv_sip
voicemail => mysql,voipbilling,asv_voicemail
;extensions => odbc,asterisk
;queues => odbc,asterisk
;queue_members => odbc,asterisk

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/voipbilling';



Above instructions can be used for moving Mysql database server from localhost to remote server.
Change localhost to IP address of mysql database server and make following changes in file

/var/lib/asterisk/agi-bin/astlocal.agi

#$dbh = DBI->connect("dbi:mysql:dbname=$config{dbname};server=$config{dbhost}", "$config{dbuser}",
 "$config{dbpass}");

$dbh = DBI->connect("dbi:mysql:$config{dbname};$config{dbhost}", "$config{dbuser}", 
"$config{dbpass}");