Page 297 - Asterisk™: The Future of Telephony
P. 297
When using static realtime, we tell Asterisk which files we want to load from the da-
tabase using the following syntax in the extconfig.conf file:
; /etc/asterisk/extconfig.conf
filename.conf => driver,database[,table]
If the table name is not specified, then Asterisk will use the name of the
file instead.
The static realtime module uses a specifically formatted table to read the configuration
of static files in from the database. You can define the table for static realtime in Post-
greSQL as follows:
CREATE TABLE ast_config
(
id serial NOT NULL,
cat_metric int4 NOT NULL DEFAULT 0,
var_metric int4 NOT NULL DEFAULT 0,
filename varchar(128) NOT NULL DEFAULT ''::character varying,
category varchar(128) NOT NULL DEFAULT 'default'::character varying,
var_name varchar(128) NOT NULL DEFAULT ''::character varying,
var_val varchar(128) NOT NULL DEFAULT ''::character varying,
commented int2 NOT NULL DEFAULT 0,
CONSTRAINT ast_config_id_pk PRIMARY KEY (id)
)
WITHOUT OIDS;
A brief explanation about the columns is required in order to understand how Asterisk
takes the rows from the database and applies them to the configuration for the various
modules you may load:
cat_metric
The weight of the category within the file. A lower metric means it appears higher
in the file (see the sidebar “A Word About Metrics”).
var_metric
The weight of an item within a category. A lower metric means it appears higher
in the list. 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 by allow=gsm (metric of 2) (see the sidebar “A Word About Metrics”).
filename
The filename the module would normally read from the hard drive of your system
(i.e., musiconhold.conf, sip.conf, iax.conf, etc.).
category
The section name within the file, such as [general], but don’t save to the database
using the square brackets.
Using Realtime | 269