System information
musiconhold.conf => odbc,asterisk,ast_config
Then connect to the Asterisk console and perform a reload:
*CLI> module reload res_musiconhold.so
You can now verify that your music on hold classes are loading from the database by
running moh show classes:
*CLI> moh show classes
Class: general
Mode: files
Directory: /var/lib/asterisk/moh
And there you go: musiconhold.conf loaded from the database. If you have issues with
the reload of the module loading the data into memory, try restarting Asterisk. You can
perform the same steps in order to load other flat files from the database, as needed.
Dynamic Realtime
The dynamic realtime system is used to load objects that may change often, such as
SIP/IAX2 users and peers, queues and their members, and voicemail messages. Like-
wise, when new records are likely to be added on a regular basis, we can utilize the
power of the database to let us load this information on an as-needed basis.
All of realtime is configured in the /etc/asterisk/extconfig.conf file, but dynamic realtime
has well-defined configuration names. Defining something like SIP peers is done with
the following format:
; extconfig.conf
sippeers => driver,database[,table]
The table name is optional. If it is omitted, Asterisk will use the predefined name (i.e.,
sippeers) to identify the table in which to look up the data.
Remember that we have both SIP peers and SIP users: peers are end-
points we send calls to, and a user is something we receive calls from.
A friend is shorthand that defines both.
In our example, we’ll be using the ast_sippeers table to store our SIP peer information.
So, to configure Asterisk to load all SIP peers from our database using realtime, we
would define something like this:
; extconfig.conf
sippeers => odbc,asterisk,ast_sipfriends
To also load our SIP users from the database, we would define the sipusers object
like so:
sipusers => odbc,asterisk,ast_sipfriends
Using Realtime | 371