[asterisk-dev] Formatting options for CLI output
Nir Simionovich
nir.simionovich at gmail.com
Mon Nov 12 03:02:38 CST 2012
So, I opened a can of worms with this - so let's see if we can put a lid on
it in some form.
I've been digging into the manager code and the various channels.
We can go about this in a few fashions:
1. Adding a format parameter to each of the actions, then changing the
output accordingly.
In general, this is the easiest path, however, the most time consuming
and will create
a havoc of code to manage - bringing us back to the manager spaghetti
code days.
2. Adding brand new actions to the various channel drivers, etc. - this
option will have a similar
impact as option 1 and is as annoying for later maintenance.
3. Adding a proper JSON library, then modifying the behavior of the various
astman related
functions, such as astman_send_listack and astman_append. I've been
looking at several
JSON libraries for ANSI-C, some are more robust than others. However,
the basic functionality
that is required is fairly simple, thus I believe that JSMN should be
enough for this usage
(http://zserge.bitbucket.org/jsmn.html).
What do you think? have I missed something around this? can anyone add some
more thoughts
into the pile here?
Regards,
Nir S
On Sat, Nov 10, 2012 at 9:36 PM, Tzafrir Cohen <tzafrir.cohen at xorcom.com>wrote:
> On Fri, Nov 09, 2012 at 08:29:08AM +0100, Johan Wilfer wrote:
> > 2012-11-09 03:26, Nir Simionovich skrev:
> > >Ok, that’s a +1 by me as well. But, if we go that route, I think we
> > >should be able to format the output of that
> > >action. It would be very useful. Honestly, while on the subject, and I
> > >do admit that what I’m about to say will
> > >be totally out there – it would be really nice if the input to AMI can
> > >be a single JSON array, instead of doing the
> > >ever annoying \n\n in manager – no?
> > >
> > >I’d love to get cracking on this one as I need it – if someone can throw
> > >me some pointers as to how the manager
> > >actually works in that respect.
> > >
> > >Nir S
> > >
> >
> > Would it be possible to add someting that let you run AMI commands
> > from the CLI, and format that in different ways?
> >
> > That way you can use this if you can run something like "asterisk
> > -rx ami json sippeers" and a formatter could turn the \n\n into a
> > JSON array, that you could parse later on?
>
> See astcli in the contribs, which is actually the other way around (get
> CLI commands through the manager in a CLI interface).
>
> The CLI interface is widely used even though it is discourged, because
> it does not require setting up users in manager.conf.
>
> I wonder what it would take to also have the manager interface listen on
> /var/run/asterisk/manager.ctl and pre-authenticate depending on the
> usual conventions for asterisk.ctl .
>
> --
> 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
>
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>
> asterisk-dev mailing list
> To UNSUBSCRIBE or update options visit:
> http://lists.digium.com/mailman/listinfo/asterisk-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20121112/9ad2da21/attachment.htm>
More information about the asterisk-dev
mailing list