Christoph Adomeit
2007-Jan-08 08:59 UTC
[asterisk-users] Adding 4000 Lines to asteriskdb via asterisk -rx ?
Hi there, I want to add 4000 Callerids and Callernames to my asterisk-db. (/var/lib/asterisk/astdb) I do not want an external database or an sql-database because I do not want asterisk to depend on external processes. However, when I do 4000 "database put number name" via a shellscript and "asterisk -rx" I only have 600 entries later in my asterisk- database. The asterisk sockets seems not to be designed for bulk updates to the asterisk-db. I also don't want to add 4000 "sleep 1" to my shell-script. Does anybody have an Idea how to add these lines to asterisk ? I managed to Build a Perl DB_File Module for db1.8.5 but I do not have the know how how to use DB_file and db1 databases. Are there some external utilities to lock and update the asteriskdb ? Is there a better way ? Thanks Christoph -- Two hours of trial and error can save ten minutes of manual reading. GATWORKS GmbH Christoph.Adomeit@gatworks.de Internetloesungen vom Feinsten Fon. +49 2166 9149-32 Fax. +49 2166 9149-10
Steven
2007-Jan-08 09:50 UTC
[asterisk-users] Re: Adding 4000 Lines to asteriskdb via asterisk -rx ?
How much would all of that data slow down asterisk? Is astdb made to handle that much data? -- -- Steven http://www.glimasoutheast.org "Christoph Adomeit" <Christoph.Adomeit@gatworks.de> wrote in message news:20070108155958.GA443@mp3.niederrhein.de...> Hi there, > > I want to add 4000 Callerids and Callernames to my asterisk-db. > (/var/lib/asterisk/astdb) > > I do not want an external database or an sql-database because I do > not want asterisk to depend on external processes. > > However, when I do 4000 "database put number name" via a shellscript > and "asterisk -rx" I only have 600 entries later in my asterisk- > database. The asterisk sockets seems not to be designed for > bulk updates to the asterisk-db. I also don't want to add 4000 > "sleep 1" to my shell-script. > > Does anybody have an Idea how to add these lines to asterisk ? I > managed to Build a Perl DB_File Module for db1.8.5 but I do not > have the know how how to use DB_file and db1 databases. > > Are there some external utilities to lock and update the asteriskdb ? > Is there a better way ? > > Thanks > Christoph > > -- > Two hours of trial and error can save ten minutes of manual reading. > GATWORKS GmbH > Christoph.Adomeit@gatworks.de Internetloesungen vom Feinsten > Fon. +49 2166 9149-32 Fax. +49 2166 9149-10 > _______________________________________________ > --Bandwidth and Colocation provided by Easynews.com -- > > asterisk-users mailing list > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users >
Tzafrir Cohen
2007-Jan-08 17:29 UTC
[asterisk-users] Adding 4000 Lines to asteriskdb via asterisk -rx ?
On Mon, Jan 08, 2007 at 04:59:58PM +0100, Christoph Adomeit wrote:> Hi there, > > I want to add 4000 Callerids and Callernames to my asterisk-db. > (/var/lib/asterisk/astdb) > > I do not want an external database or an sql-database because I do > not want asterisk to depend on external processes. > > However, when I do 4000 "database put number name" via a shellscript > and "asterisk -rx" I only have 600 entries later in my asterisk- > database. The asterisk sockets seems not to be designed for > bulk updates to the asterisk-db. I also don't want to add 4000 > "sleep 1" to my shell-script.If you have a 'sleep 1', you have a badly written script. You should wait for Asterisk to finish. However 4000 invocations of Asterisk can be a pain. Asterisk takes quite a while to start. I consider Asterisk's behaviour here a bug. Sadly others don't agree.> > Does anybody have an Idea how to add these lines to asterisk ? I > managed to Build a Perl DB_File Module for db1.8.5 but I do not > have the know how how to use DB_file and db1 databases.Option A: Use the manager interface. Option B: write directly to the socket: ere: usint a small utility called socat (there's that package in Debian) http://threebit.net/mail-archive/asterisk-users/msg27519.html The downside is that you can't tell of you had an error.> > Are there some external utilities to lock and update the asteriskdb ?Grab the sources of the berkely DB from the Asterisk source. It should have a utility for manipulating a databae. Nothing about locking, though, I guess. -- Tzafrir Cohen icq#16849755 jabber:tzafrir@jabber.org +972-50-7952406 mailto:tzafrir.cohen@xorcom.com http://www.xorcom.com iax:guest@local.xorcom.com/tzafrir
Gordon Henderson
2007-Jan-11 03:28 UTC
[asterisk-users] Adding 4000 Lines to asteriskdb via asterisk -rx ?
On Mon, 8 Jan 2007, Christoph Adomeit wrote:> Are there some external utilities to lock and update the asteriskdb ? > Is there a better way ?A bit late on this and I see that there's a nice bit of perl posted to use the manager interface, but I've been doing something similar by writing a file which is then #included by extensions.conf, then zeroing the file after an asterisk -rx 'extensions reload' ('diaplan reload' for the 1.4 people out there) Eg. lines of: DB(speedDialNum/10)=07712191046 DB(speedDialNam/10)=Gordon DB(speedDialRNum/191046)=10 etc. I'm not 100% sure the diaplan is meant to be abused in this way - it doesn't work on initial asterisk startup presumably because the DB engine/module isn't loaded... so because I have a small number of these for other purposes in the dialplan, I issue an extensions reload after starting asterisk for the very first time (in the /etc/init.d/asterisk script) Maybe a bit of a "hit it on the head" approach, but it's quite simple. I just did a test with 10000 artificially generated values and it was about 1.5 seconds on my 1GHz box. (vs. 0.2 seconds without the file, and generated a 1.4MB astdb - hardly a massive file!) Cheers, Gordon