Set global dialplan variable from database (realtime)

There is a [globals] section in the extensions.conf file that can be used to define global dialplan variables. Can these variables be read from the database when Realtime is being used? I tried setting them into the asterisk_config database table but it doesn’t work.

Here you can see the globals section that I am referring to:

Ok, I was able to read the variables from the asterisk_config database table by following this tutorial:
https://www.voip-info.org/asterisk-realtime-static/

Now asterisk is reading the dialplan rules (not only the configuration) from the asterisk_config database table. I would like to have the actual dialplan rules in a different table. This is how my extconfig.conf looks now:

...
[settings]
extensions => pgsql,asterisk,extensions
extensions.conf => pgsql,asterisk,asterisk_config
...

It seems that the extensions database table is not read.

Should I move the dialplan rules and configuration to a single database table?
Thank you.

Ok, I wasn’t clear on the concepts of dynamic and static realtime. I was able to use static realtime to read the extensions.conf content from the database as described here:
https://www.voip-info.org/asterisk-realtime-static/

Then, the actual extensions (dialplan rules) can be read from the database (dynamic realtime, table extensions in my case) if a switch statement is added to the context definition in the static realtime table, like this:

select * from asterisk_config where filename='extensions.conf' and category='agents';
  id  | category | var_name | var_val  | cat_metric |    filename     | commented | var_metric
------+----------+----------+----------+------------+-----------------+-----------+------------
 1122 | agents   | switch   | realtime | 0          | extensions.conf |         0 | 1

Then Asterisk will read the extensions (dynamic realtime) database table to fully define the agents context.

All this works because my extconf.conf is like this:

...
[settings]
extensions => pgsql,asterisk,extensions ; dynamic realtime
extensions.conf => pgsql,asterisk,asterisk_config ; static realtime
...

This page was also useful for me:
http://www.asteriskdocs.org/en/3rd_Edition/asterisk-book-html-chunk/I_section12_tt1465.html

Thanks.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.