Is it possible to delete the keys belonging to a family in AstDB at Asterisk startup? I would like to repopulate it from another source each time Asterisk is restarted. I know there is a DBdeltree(<family>) function. Is there a context that only runs once (automatically) at Asterisk startup (so that I can call this function)? Also is AstDB lookup faster than a func_odbc lookup? Is there a faster way to perform a lookup in Asterisk; e.g. create a lookup table in memory perhaps? I'm new to Asterisk... Thanks, Matt -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20111120/3f0c09f9/attachment.htm>
From: asterisk-users-bounces at lists.digium.com [mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Matt Hamilton Sent: Sunday, November 20, 2011 1:25 PM To: asterisk-users at lists.digium.com Subject: [asterisk-users] Deleting AstDB family at start Is it possible to delete the keys belonging to a family in AstDB at Asterisk startup? I would like to repopulate it from another source each time Asterisk is restarted. I know there is a DBdeltree(<family>) function. Is there a context that only runs once (automatically) at Asterisk startup (so that I can call this function)? Also is AstDB lookup faster than a func_odbc lookup? Is there a faster way to perform a lookup in Asterisk; e.g. create a lookup table in memory perhaps? I'm new to Asterisk... Thanks, Matt After a little research and testing, these are my answers: Is it possible to delete the keys belonging to a family in AstDB at Asterisk startup? I would like to repopulate it from another source each time Asterisk is restarted. not explicitly. The [general] context is executed at asterisk reload (answer to question 2), but doesn't execute dialplan functions. You could put a call in /usr/sbin/safe_asterisk to clear your keys using a "local call" in /var/spool/asterisk/outgoing [clearkeys] Exten => start,1,answer() Exten => start,n,dbdeltree(foo) Exten => start,n,hangup Also is AstDB lookup faster than a func_odbc lookup? IMO yes since Asterisk has a built-in connection to it's Berkley or SQLite database and the odbc lookup has to go through more layers. Finally Is there a faster way to perform a lookup in Asterisk; e.g. create a lookup table in memory perhaps? Set and retrieve Global variables for small searches. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20111121/550f8ec5/attachment-0001.htm>
Thanks Danny. > [clearkeys]> Exten => start,1,answer()> Exten => start,n,dbdeltree(foo)> Exten => start,n,hangup > Set and retrieve Global variables for small searches. I will try the "local call" option to [clearkeys]. I guess I can also use a global flag to call dbdeltree only once in the existing context before entering anything into AstDB. Matt -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20111121/82bb724a/attachment.htm>
On Sun, 20 Nov 2011, Matt Hamilton wrote:> Is it possible to delete the keys belonging to a family in AstDB at > Asterisk startup? I would like to repopulate it from another source each > time Asterisk is restarted.How about: [sudo] /usr/sbin/asterisk -r -x 'database deltree example' in /etc/init.d/asterisk or safe_asterisk? -- Thanks in advance, ------------------------------------------------------------------------- Steve Edwards sedwards at sedwards.com Voice: +1-760-468-3867 PST Newline Fax: +1-760-731-3000
On Sun, Nov 20, 2011 at 02:25:13PM -0500, Matt Hamilton wrote:> > Is it possible to delete the keys belonging to a family in AstDB at > Asterisk startup? I would like to repopulate it from another source > each time Asterisk is restarted.Why not use global variables instead? -- Tzafrir Cohen icq#16849755 jabber:tzafrir.cohen at xorcom.com +972-50-7952406 mailto:tzafrir.cohen at xorcom.com http://www.xorcom.com iax:guest at local.xorcom.com/tzafrir