Asterisk RealTime database Architecture

Terminology/Files

Driver – A compiled module containing database specific code that accepts the generalized function calls that RealTime makes. As of this writing, only ODBC, MySQL (via asterisk-addons) and LDAP (see http://free.oxymium.net/Asterisk/ and http://bugs.digium.com/view.php?id=5768) drivers are available.
Family – A name associated with a RealTime call. Examples: sippeers, sipusers, voicemail.
extconfig.conf – The configuration file that contains the information necessary to bind specific families to specific drivers.
res_odbc.conf – The configuration file for ODBC RealTime.
res_mysql.conf – The configuration file for MySQL RealTime.
res_ldap.conf – The configuration file for LDAP RealTime.
ODBC – Open DataBase Connectivity
MySQL – the world’s most popular open source database
OpenLDAP – Open source implementation of the Lightweight Directory Access Protocol

There are 2 methods of using RealTime: ODBC and MySQL. Yes, you can use ODBC to connect to MySQL and many other ODBC supported databases. (Being an avid MySQL user and advocate, I didn’t want to bother with ODBC so I wrote the RealTime MySQL driver over the weekend.)

Extconfig – RealTime

RealTime configuration is where configuration values are read/updated in real time.

Example: Lets say you have 2 SIP users defined in your sip.conf and you want to add a 3rd. You add them to the file then execute the command ‘sip reload’. This re-reads your sip.conf and allows the 3rd to register.
With RealTime, all you do is add 1 new record to the table that sipusers has been bound to. No reloading necessary.

RealTime maps take the following fomat:
[settings]

<family name> => <driver>,<database name>~np~[~/np~,table_name~np~]~/np~
sippeers => mysql,asterisk,sip_peers
sipusers => mysql,asterisk,sip_users
queues => mysql,asterisk,queue_table
queue_members => mysql,asterisk,queue_member_table
meetme => mysql,asterisk,meetme_table
voicemail => mysql,asterisk^
Above we have four examples. The first example will bind the family name “sippeers” to the table “sip_peers” in the database “asterisk” using the MySQL driver. The last example will bind the family name “voicemail” to the table “voicemail” (because we ommited the table name, it defaults to the family name) in the database “test” using the MySQL driver.

It is worth noting that sipusers and sippeers may both refer to the same table, if you wish.

NOTE: extconfig.conf is parsed each time you connect to the asterisk CLI.

Related Posts

  • 53
    To enable the query log, put this in /etc/my.cnf in the [mysqld] section log = /path/to/query.log #works for mysql < 5.1.29 Also, to enable it from MySQL console SET general_log = 1; Remember that this logfile can grow very big on a busy server. update: With mysql 5.1.29+ , the log option is deprecated. To specify…
    Tags: mysql, table, database, file
  • 49
    What is database? Database is an organized collection of information about an entity having controlled redundancy and serves multiple applications. DBMS (database management system) is an application software that is developed to create and manipulate the data in database. A query language can easily access a data in a database.…
    Tags: database, mysql
  • 45
      To rename a table in MySQL you just need to run a command named RENAME TABLE, the syntax is very easy to use. RENAME TABLE table1 TO table2; The RENAME TABLE command will rename the table atomically, which means your table will be locked during the command. You can…
    Tags: table, mysql
  • 43
    What is Asterisk? Asterisk is an open source framework for building communications applications. Asterisk turns an ordinary computer into a communications server. Asterisk powers IP PBX systems, VoIP gateways, conference servers and other custom solutions. It is used by small businesses, large businesses, call centers, carriers and government agencies, worldwide.…
    Tags: asterisk

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: