Menggunakan opensipsdbctl
Setup database
vi /usr/local/etc/opensips/opensipsctlrc
atau
vi /etc/opensips/opensipsctlrc
Pastikan
DBENGINE=MYSQL DBHOST=localhost DBROUSER=opensipsro DBROPW=opensipsro DBNAME=opensips DBRWUSER=opensips DBRWPW="opensipsrw" DBROOTUSER="root"
Pastikan MySQL beroperasi
$ sudo su - # /etc/init.d/mysql restart
Menu Help
# opensipsdbctl -h MySQL password for root: /usr/local/sbin/opensipsdbctl $Revision: 3997 $
usage: opensipsdbctl create <db name or db_path, optional> .....(creates a new database) opensipsdbctl dropopensipsdbctl -h <db name or db_path, optional> .......(!entirely deletes tables!) opensipsdbctl reinit <db name or db_path, optional> .....(!entirely deletes and than re-creates tables!) opensipsdbctl backup <file> .................................(dumps current database to file) opensipsdbctl restore <file> ................................(restores tables from a file) opensipsdbctl copy <new_db> .................................(creates a new db from an existing one) opensipsdbctl migrate <old_db> <new_db> .....................(migrates DB from 1.2 to 1.3, not implemented yet!) opensipsdbctl presence ......................................(adds the presence related tables) opensipsdbctl extra .........................................(adds the extra tables)
if you want to manipulate database as other database user than root, want to change database name from default value "opensips", or want to use other values for users and password, edit the "config vars" section of the command opensipsdbctl.
Inisialisasi Database
Membuat database opensips. Pastikan perintah opensipsdbctl di jalankan dari folder /usr/local/src/opensips-1.10.0-tls/scripts/
cd /usr/local/src/opensips-1.10.0-tls/scripts/ opensipsdbctl create
MySQL password for root:
INFO: test server charset INFO: creating database opensips ... INFO: Core OpenSIPS tables succesfully created.
Install presence related tables? (y/n): y
INFO: creating presence tables into opensips ... INFO: Presence tables succesfully created.
Install tables for imc cpl siptrace domainpolicy carrierroute userblacklist registrant? (y/n): y
INFO: creating extra tables into opensips ... INFO: Extra tables succesfully created.
Cek Database
Cek apakah opensips database telah terbuat
mysqlshow -u root -p
Akan keluar tampilan
+--------------------+ | Databases | +--------------------+ | information_schema | | mysql | | opensips | +--------------------+
Delete / Drop Database
Jika ada masalah dengan database & kita perlu mendelete database yang lama, maka lakukan perintah
mysql -u root -p Enter password: mysql> drop database opensips; mysql> quit