Page 298 - Asterisk™: The Future of Telephony
P. 298

var_name
                   The option on the left side of the equals sign (i.e., disallow is the  var_name in
                   disallow=all).
               var_val
                   The value to an option on the right side of the equals sign (i.e., all is the var_val
                   in disallow=all).
               commented
                   Any value other than 0 will evaluate as if it were prefixed with a semicolon in the
                   flat file (commented out).

                                         A Word About Metrics

                  The metrics in static realtime are used to control the order that 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 categories from
                  bottom  to  top―this  is  why  the  order  of  users  and  peers  can  matter  in  sip.conf  or
                  iax.conf). A lower var_metric is processed first within the category because Asterisk will
                  process the order of options top-down within the category (e.g., disallow=all should
                  be set to a value lower than the allow’s value within the category to make sure it is
                  processed first).


               A simple file we can load from static realtime is the musiconhold.conf file. Let’s start by
               moving this file to a temporary location:
                   # cd /etc/asterisk
                   # mv musiconhold.conf musiconhold.conf.old
               In order for the classes to be removed from memory, we need to restart Asterisk. Then
               we can verify our classes are blank by running moh show classes:
                   *CLI> restart now
                   *CLI> moh show classes
                   *CLI>
               So let’s put the [default] class back into Asterisk, but now we’ll load it from the data-
               base. Connect to PostgreSQL and execute the following INSERT statements:
                   INSERT INTO ast_config (filename,category,var_name,var_val)
                   VALUES ('musiconhold.conf','general','mode','files');
                   INSERT INTO ast_config (filename,category,var_name,var_val)
                   VALUES ('musiconhold.conf','general','directory','/var/lib/asterisk/moh');
               You can verify your values have made it into the database by running a SELECT state-
               ment:
                   asterisk=# select filename,category,var_name,var_val from ast_config;
                    filename         | category       | var_name     | var_val
                   ------------------+----------------+--------------+------------------------
                    musiconhold.conf | general        | mode         | files

               270 | Chapter 12: Relational Database Integration
   293   294   295   296   297   298   299   300   301   302   303