text
stringlengths
0
152
Using Realtime
|
279
When using Static Realtime, we tell Asterisk which files we want to load from the
database using the following syntax in the extconfig.conf file:
; /etc/asterisk/extconfig.conf
[settings]
filename.conf => driver,database[,table]
There is no configuration file called filename.conf. Instead, use the
actual name of the configuration file you are storing in the data‐
base. If the table name is not specified, Asterisk will use the name
of the file as the table name instead (less the .conf part). Also, all
settings inside the extconfig.conf file should fall under the [set
tings] header. Be aware that you can’t load certain files from real‐
time at all, including asterisk.conf, extconfig.conf, and logger.conf.
The Static Realtime module uses a very specifically formatted table to allow Asterisk
to read the various static files from the database. Table 15-1 illustrates the columns as
they must be defined in your database.
Table 15-1. Table layout and description of ast_config
Column name
id
cat_met
ric
var_met
ric
Column type
Serial,
autoincrementing
Integer
Integer
filename
Varchar 128
category
Varchar 128
var_name
Varchar 128
var_val
Varchar 128
commented
Integer
Description
An autoincrementing unique value for each row in the table.
The weight of the category within the file. A lower metric means it appears higher in
the file (see the sidebar on page 281).
The weight of an item within a category. A lower metric means it appears higher in
the list (see the sidebar on page 281). This is useful for things like codec order in
sip.conf, or iax.conf where you want disallow=all to appear first (metric of 0),
followed by allow=ulaw (metric of 1), then allow=gsm (metric of 2).
The filename the module would normally read from the hard drive of your system
(e.g., musiconhold.conf, sip.conf, iax.conf).
The section name within the file, such as [general]. Do not include the square
brackets around the name when saving to the database.
The option on the left side of the equals sign (e.g., disallow is the var_name in
disallow=all).
The value of an option on the right side of the equals sign (e.g., all is the
var_val in disallow=all).
Any value other than 0 will evaluate as if it were prefixed with a semicolon in the
flat file (commented out).
280
|
Chapter 15: Relational Database Integration
A Word About Metrics
The metrics in Static Realtime are used to control the order in which objects are read
into memory. Think of the cat_metric and var_metric as the original line numbers
in the flat file. A higher cat_metric is processed first, because Asterisk matches cate‐
gories from bottom to top. Within a category, though, a lower var_metric is pro‐
cessed first, because Asterisk processes the options top-down (e.g., disallow=all
should be set to a value lower than the allow’s value within a category to make sure it
is processed first).
There’s not much more to say about Static Realtime. It was very useful in the past, but
has now been mostly superseded by Dynamic Realtime. If you want to read more