[asterisk-users] Solved: Problem loading AstDB into variable on restart

Yuan LIU yliu11 at hotmail.com
Tue Feb 6 21:49:43 MST 2007


>From: Gordon Henderson <gordon+asterisk at drogon.net>
>
>>I define
>>
>>[globals]
>>myvar = ${DB(store/myvar)}
>>
>>---
>>But when I want to use ${myvar} in the dial plan, I found that the 
>>variable is null when Asterisk is restarted.  Only a reload would force 
>>globals to read AstDB.  Other variables in globals loads fine.
>>
>>Any idea? (Asterisk 1.2.13)
>
>The DB module isn't loaded at asterisk boot time when the extensions.conf 
>is parsed... I have the same problem, tried to fix

That's right.

Feb  6 20:33:56 ERROR[6290]: pbx.c:1382 ast_func_read: Function DB not 
registered
  == Setting global variable 'myvar' to '0'

So I added this to modules.conf:

preload => pbx_functions.so

Asterisk starts with myvar loaded from AstDB.

Yuan Liu

>it by forceloading the database modules, but either I didn't dully 
>understand what it was doing, or it just didn't work, so my /etc/init.d 
>script now has a wait for a couple of seconds after asterisk -p, then a 
>asterisk -rx 'extensions reload' ...
>
>Not perfect and probably an abuse of the dialplan, but ...
>
>Gordon




More information about the asterisk-users mailing list