[asterisk-users] astdb delete all keys with the value of x

jonathan white jw at uvacity.com
Thu Apr 24 05:40:22 CDT 2014

I guess the question is which method has the least processor overhead.


On 21 Apr 2014 15:54, "Josh Metzger" <joshdmetzger at gmail.com> wrote:

> To do it without using an external database, you could create a shell
> script to do it that you would execute with a system call.  You could get a
> list of everything with:
> asterisk -rx "database show"
> From there, you could grep the results for the value you are looking for,
> use awk or even cut to get the family and key names, then for each match,
> run:
> asterisk -rx "database del <family> <key>"
> It's a dirty way of doing it, but it would work.  When I used the Asterisk
> DB for something, I was able to change my dialplan around to make things
> unique for each call so I could run a "DBDeltree" after the call was
> complete.  That being said, you definitely get a lot more control with an
> external database and it's easy to make the calls within your dialplan.  It
> really depends on how big of a system you're setting up and how often you
> would need to run these commands to determine if it's worth the added
> trouble of installing / configuring / maintaining something like MySQL.
> For me, I've used MySQL very heavily in the past, and only recently have I
> created something that uses the Asterisk database (after using Asterisk for
> 6 years).  Even then it was more of a challenge to myself to see if I could
> make it work, but for what I'm doing it really is probably the best option
> (especially since it's on a pre-existing Asterisk install that was not
> configured with ODBC support).
> -Josh
> On Mon, Apr 21, 2014 at 10:27 AM, Jonathan White <jw at uvacity.com> wrote:
>>   I’m trying to use the asterisk database but I think there is a
>> limitation in deleting records I need to make my logic work.
>> I understand that I can delete all family members with a specific key
>> and that I can delete an entire family of keys
>> but I would like to be able to delete specific keys which have the same
>> value, is this possible?
>> I have tried moving things around so making the family the value I am
>> interested in but the way the call flow works I don’t get that information
>> at the correct point when I need it.
>> At present I think there is not an answer to this problem and I will have
>> to use an ODBC link to a better featured database I can run more
>> complicated queries against.
>> What does the community think?
>> Thanks
>> ------------------------------
>>    <http://www.avast.com/>
>> This email is free from viruses and malware because avast! Antivirus<http://www.avast.com/>protection is active.
>> --
>> _____________________________________________________________________
>> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>> New to Asterisk? Join us for a live introductory webinar every Thurs:
>>                http://www.asterisk.org/hello
>> asterisk-users mailing list
>> To UNSUBSCRIBE or update options visit:
>>    http://lists.digium.com/mailman/listinfo/asterisk-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20140424/30200ad2/attachment-0001.html>

More information about the asterisk-users mailing list