Sponsor: VoiceMeUp - Corporate & Wholesale VoIP Services

VoIP Mailing List Archives
Mailing list archives for the VoIP community
 SearchSearch 

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


 
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> Asterisk Users
View previous topic :: View next topic  
Author Message
jw at uvacity.com
Guest





PostPosted: Mon Apr 21, 2014 9:28 am    Post subject: [asterisk-users] astdb delete all keys with the value of x Reply with quote

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 [/url]
This email is free from viruses and malware because [url=http://www.avast.com/]avast! Antivirus
protection is active.
Back to top
joshdmetzger at gmail.com
Guest





PostPosted: Mon Apr 21, 2014 9:54 am    Post subject: [asterisk-users] astdb delete all keys with the value of x Reply with quote

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@uvacity.com (jw@uvacity.com)> wrote:
Quote:
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




[/url]
This email is free from viruses and malware because [url=http://www.avast.com/]avast! Antivirus
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
Back to top
jw at uvacity.com
Guest





PostPosted: Thu Apr 24, 2014 5:40 am    Post subject: [asterisk-users] astdb delete all keys with the value of x Reply with quote

I guess the question is which method has the least processor overhead.
Thanks
J On 21 Apr 2014 15:54, "Josh Metzger" <joshdmetzger@gmail.com (joshdmetzger@gmail.com)> wrote:
Quote:
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@uvacity.com (jw@uvacity.com)> wrote:
Quote:
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




[/url]
This email is free from viruses and malware because [url=http://www.avast.com/]avast! Antivirus
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



Back to top
Display posts from previous:   
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> Asterisk Users All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group

VoiceMeUp - Corporate & Wholesale VoIP Services