Asterisk and IBSng Integration
محتویات |
Asterisk Configuration
Checking Modules
Make sure the modules "cdr_pgsql.so" and "res_config_pgsql.so" exist in /usr/lib/asterisk/modules/
- If not so, follow this document to compile them:
http://www.voip-info.org/tiki-index.php?page=Asterisk+cdr+pgsql
Make asterisk to load pgsql modules
Edit the file /etc/asterisk/modules.conf, and the state of these modules (cdr_pgsql.so and res_config_pgsql.so) to "load". (The default is "noload")
Set the config files to integrate with IBSng
Now we should make asterisk to join IBSng.
First configure asterisk to load some tables in IBS dynamically.
Append these lines to "/etc/asterisk/extconfig.conf":
sipusers => pgsql,IBSng,asterisk.sip_buddies sippeers => pgsql,IBSng,asterisk.sip_buddies iaxusers => pgsql,IBSng,asterisk.iax_buddies iaxpeers => pgsql,IBSng,asterisk.iax_buddies extensions => pgsql,IBSng,asterisk.extensions
Note: sip and iax are used when we want to add these users via IBSng.
Then, edit the file "/etc/asterisk/res_pgsql.conf" to define the database parameters:
[general] dbhost=x.x.x.x <= IBSng IP Address dbport=5432 dbname=IBSn dbuser=asteriskuser dbpass=xxxx
We'll create the user (asterisk) in database later.
Restart Asterisk
Finally you have to restart Asterisk service to apply the changes.
Database Configuration
First we'd better to define a new user in database for asterisk (we set it as dbuser in res_pgsql.conf before):
# su - postgres createuser asteriskuser -P Enter password for new role: Enter it again: Shall the new role be a superuser? (y/n) <= y
Note: You can also limit this user to access "asterisk" table only.
Now, we should edit the file "postgresql.conf" to make postgresql (normally on IBSng server) to accept foreign requests.
Edit /etc/postgresql/XXX/main/postgresql.conf, and set "listen_addresses" to '*'.
Then, let the asterisk connect to database by adding the following line to /etc/postgresql/XXX/main/pg_hba.conf:
host IBSng asteriskuser x.x.x.x/32 md5
And, we should create asterisk table in database:
cd /usr/local/IBSng/db psql -U ibs IBSng < asterisk.sql
Finally restart postgresql service to apply our changes. (Please make sure the IBSng service is stop during restarting postgresql.)
Adding Asterisk as a RAS in IBSng
You can find the document here.