Dynamic Music On Hold

Home » Asterisk Users » Dynamic Music On Hold
Asterisk Users 2 Comments

Hello everyone, I am trying to activate Music On Hold using DB on Asterisk 13. It works fine but in order to use new Music On hold definitions I have to reload the moh module.

– The following is my configuration in extconfig.conf – I added the following line:
musiconhold.conf => mysql,asterisk,bit_ast_config

– The following is the table in the database:
mysql> select * from bit_ast_config;
+—-+————+————-+—————-+———————–+———–+—————+———-+
| id | cat_metric | var_metric | commented | filename |
category | var_name | var_val |
+—-+————+————-+—————-+———————–+———–+—————+———-+
| 2 | 0 | 0 | 0 |
musiconhold.conf | yaron | directory | moh |
| 3 | 0 | 0 | 0 |
musiconhold.conf | yaron | mode | files |
| 10 | 0 | 0 | 0 |
musiconhold.conf | yaron1 | directory | moh |
| 11 | 0 | 0 | 0 |
musiconhold.conf | yaron1 | mode | files |
+—-+————+————-+—————-+———————–+———–+—————+———-+

Is there a way to do automatically add new moh definitions without reloading the moh module?
Thanks, Yaron.

2 thoughts on - Dynamic Music On Hold

  • You actually want to use the “realtime” database and not the
    “static”. With the realtime database all changes will take effect immediately. The following link explains the difference between realtime and static:

    https://wiki.asterisk.org/wiki/display/AST/Realtime+Database+Configuration

    Here is the structure I use:

    CREATE TABLE `musiconhold` (
    `name` varchar(80) COLLATE utf8_unicode_ci NOT NULL,
    `directory` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT ”,
    `application` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT ”,
    `mode` varchar(80) COLLATE utf8_unicode_ci NOT NULL DEFAULT ”,
    `digit` char(1) COLLATE utf8_unicode_ci NOT NULL DEFAULT ”,
    `sort` varchar(16) COLLATE utf8_unicode_ci NOT NULL DEFAULT ”,
    `format` varchar(16) COLLATE utf8_unicode_ci NOT NULL DEFAULT ”,
    PRIMARY KEY (`name`)
    ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

  • Thanks Carlos, I have created the table and changed the extconfig to :
    musiconhold => mysql,asterisk,musiconhold

    It works fine.

    Yaron