Asterisk Realtime

From KlavoWiki
Jump to navigationJump to search

Prerequisite

yum -y install mysql-connector-odbc unixODBC-devel libtool-ltdl-devel

If Asterisk is already installed, re-configure

ODBC

Check that ODBC is installed and that the appropriate driver is installed

odbcinst -q -d
vi /etc/odbc.ini

Add the following contents

[asterisk]
Description         = Asterisk Database
Driver              = MySQL
Database            = asterisk
User                = root
Password            = passw0rd
Server              = 192.168.25.33
Socket              = /var/lib/mysql/mysql.sock

Verify connection to the database is successful.

echo "select 1" | isql -v asterisk

res_odbc

vi /etc/asterisk/res_odbc.conf

Edit the following sections.

[asterisk]
enabled => yes
dsn => asterisk
pre-connect => yes

Configure Asterisk

vi /etc/asterisk/extconfig.conf

uncomment

sippeers => odbc,asterisk
voicemail => odbc,asterisk

The above will be based on the selections that Asterisk will be used for Realtime.

Extensions Configuration

Within extensions.conf add the Realtime switch based on the context that your extension will reside in.

vi /etc/asterisk/extensions.conf
[internal-extensions]
switch => Realtime

exten => _10XX,Dial(SIP/${EXTEN})

Database Tables

All the SQL tables reside in:

./asterisk-13.6.0/contrib/realtime/mysql/mysql_config.sql

Populating MySql is easy as

mysqladmin create asterisk
mysql asterisk < ./asterisk-13.6.0/contrib/realtime/mysql/mysql_config.sql