[asterisk-users] Querying channel variables via the Manager API
lenz-ml at oinko.net
Tue Apr 17 16:30:24 MST 2007
I was looking for something completely stateless - the problem with the
approach you propose is that sometimes an event gets lost, or not logged
correctly, and an engine like QueueMetrics' contains way too much code to
handle such cases, even though Asterisk's logging facilities are usually
I was thinking that there must be a way to tell Asterisk "give me a
complete dump of all the available channel information including
variables", as it seems a reasonable query to me :) - of course there are
possible real-life workarounds, like caching a channel's status and
variables and avoiding querying it again and again unless a timer has
expired, but this is of course more complex and a bit less reliable than
just asking for a fresh snapshot.
BTW, I personally love Python, though I'm personally more fluent with
Perl, after 12+ years using it :)
Thanks for your offer anyway - I'll check it!
In data Wed, 18 Apr 2007 01:09:54 +0200, Earl Terwilliger <earl at micpc.com>
> Hi Lenz,
> Why not do it the same way as you do the queue log (for queuemetrics)?
> i.e. have a program which captures all events (or certain events), logs
> to a MySql database and then you just query the database.
> There are many packages out there that run an Asterisk manager command at
> frequent intervals to obtain what they want. To me (as you have found
> this is
> very inefficient).
> I have an open source package called Asterisk Event Monitor that has a
> script (ah.. I think you like perl better? but I like python) that
> to the Asterisk Manager and logs all events to a MySql table. There are
> scripts that show the events and display the status of sip users, zap
> channels,etc. but you don't need that. The python script is similar to
> qloader script in that my script grabs all the events and writes them to
> MySql database. Anything you need to see is thus more efficiently
> from the database table.
> any question about it , holler..
> the code is here:
> On Tuesday 17 April 2007 17:32, Lenz wrote:
>> Hello list,
>> we are developing a new application that uses the Manager API in order
>> find a set of channels where variables are set in a predefined way. To
>> this, we currently send a Status command to obtain all available
>> and then query them all, one by one, fot the status of a certain
>> variable. As you can imagine, this gets rapidly pretty tedious as the
>> number of active channels on a server grows and requires a lot of
>> round-trips to and from the Asterisk server.
>> I was wondering if there are more efficient ways to get:
>> 1. a variable as set on all channels
>> 2. the complete list of channel variables for one channel, using
>> manager response block and not reverting to an execute CLI command "
>> channel Local/1234 at x "
>> Anybody has ideas/hints on how to make all this a bit less cumbersome?
>> Best regards,
> --Bandwidth and Colocation provided by Easynews.com --
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
Home of QueueMetrics - http://queuemetrics.com
More information about the asterisk-users