extconfig.conf Setup
Add the following line, swapping your own personal values if you wish:
extensions => mysql,asterisk,extensions_table
You can change mysql to odbc if you want to use odbc.
You can change asterisk to be the name of your database.
You can change extensions_table to be the name of the extensions table we will create below.
modules.conf Setup
Don't forget to load the proper modules or Strange Things (TM) will happen.autoload=yes
or explicitly list them out:
load => res_config_mysql.so
load => app_realtime.so
load => func_realtime.so
load => pbx_realtime.so
load => app_realtime.so
load => func_realtime.so
load => pbx_realtime.so
(props to Corydon76 for setting a few of us straight)
extensions.conf Setup
The way RealTime Extensions work is through a switch statement in the dialplan. Here is an example of my context:[test]
;
; switch => Realtime/[context]@[family][/options]
; If context is not given, current context is default
; If family is not given, family of 'extensions' is default
;
switch => Realtime/mycontext@realtime_ext
This tells Asterisk that any call into the 'test' context are to be switched to RealTime using the context "mycontext" and the family name "realtime_ext".
context is optional: (switch => Realtime/@realtime_ext) and if left off, RealTime will use the current context, in this case "test".
family is also optional: (switch => Realtime/@) and if left off, RealTime will use the family name "extensions".
Currently there are no supported options so you can leave it off.
The family name above can be anything you wish. Just be sure it matches the family name you have stored in extconfig.conf: ( realtime_ext => mysql,asterisk,extensions_table )
And YES! You can have multiple switches and multiple family names using this method.
NOTE: It seems like Asterisk 1.6.0 always matches the realtime context with the name of the static context that contains the switch statement. The above example will always seek for the "Test" context in the database and not for the "mycontext". So you might as well use:
[test]
switch => Realtime
Database Table
Now lets create the table we need:NOTE: You can use any table name you wish, just make sure the table name matches what you have the above family name bound to.
NOTE: You should REALLY add indices for the context, exten and priority columns, as your asterisk system might slow down considerably otherwise. ...