[asterisk-users] Dialplan Gurus? Can Asterisk 1.4x CHANNEL function be used to retrieve info about OTHER channels?

Tzafrir Cohen tzafrir.cohen at xorcom.com
Tue Jun 22 05:42:44 CDT 2010


On Tue, Jun 22, 2010 at 11:25:29AM +0100, Tiago Geada wrote:
> Hi!
> 
> If it was me, I would create a bash script calling asterisk -vrx "core show
> commands"
> 
> something like:
> 
> for chan in $(asterisk -vrx "core show channels concise");
> do
> asterisk -vrx "core show channel $(echo $chan|cut -d \! -f1)"|grep -i
> native;
> done

The overhead of each 'asterisk -rx' command is noticable. If you have 10
calls or more, this can have an odd effect.

Not to mention that the fact that it is so slow exposes its raciness[1].

> 
> On 21 June 2010 16:08, bruce bruce <bruceb444 at gmail.com> wrote:
> 
> > Hi Everyone,
> >
> > I want to know if a specific codec type is used at least one. For example,
> > I want to know if out of the 100 calls on the system if there is a 1 channel
> > that is running G.729 codec right now. If using dial-plan and I dial in, I
> > can use this to obtain information about CURRENT channel. But it won't allow
> > me to obtain information about OTHER channels and that is what I want to do.
> > I want a search for all channels and an output spit out as g729 or TRUE or
> > FALSE if there is a g729 channel.
> >
> > exten => s,1,Answer()
> > exten => s,n,Set(foo=${CHANNEL(audioreadformat)})
> > exten => s,n,NoOp(${foo})
> >
> > Above ^^^^ NoOp spits out g729 if I call in with a g729 codec. But I want that to be about other channels and not the one I am calling into.
> >
> > Thanks,
> >
> > Bruce

[1] Which should naturally be fixed using locks :-)

-- 
               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



More information about the asterisk-users mailing list