Summary:ASTERISK-19364: add concise option to core show hints
Reporter:Wolfgang Pichler (wuwu)Labels:
Date Opened:2012-02-14 23:53:46.000-0600Date Closed:2017-12-12 19:05:26.000-0600
Versions:Feature Tracker Frequency of
Environment:Attachments:( 0) coreshowhintsconcise.patch
( 1) coreshowhintsconcise.patch
Description:add an optional parameter "concise" to core show hints - so you can get a better machine parseable result with using "core show hints concise" - as with "sip show peers concise"
Comments:By: Wolfgang Pichler (wuwu) 2012-02-14 23:57:16.118-0600

the patch against asterisk 1.8.8-rc2 for this feature. Should apply to any other version without problems

By: Walter Doekes (wdoekes) 2012-02-15 01:51:53.686-0600

Hi. Thanks for the patch. A couple of remarks:

- any patch should be in unified diff format (diff -u).
- new features should be provided as a patch against trunk, even when trivial.

By: Richard Mudgett (rmudgett) 2012-02-15 09:38:07.766-0600

It is my understanding that "concise" CLI commands are not recommended.  There should be available or new AMI actions added to get that information instead.

By: Wolfgang Pichler (wuwu) 2012-02-15 22:48:06.973-0600

Why are the not recommended ? The are great - just think about all the small perl (or whatever) scripts which does fetch information from asterisk using "asterisk -rx ..."
the normal cli output is often not useable for machine parsing - so concise is something which should get implemented for every command...

An other option would be - to implement a switch - lets say asterisk -rx "core show hints" will give you the normal output as now - asterisk -rxm "core show hints" will give you machine parseable output... And "core set machineparseableoutput 1" (a better name would be great ;-) ) turns it on on cli - with 0 turn it off

By: Matt Jordan (mjordan) 2012-02-20 11:01:54.503-0600

You've already pointed out why we don't prefer to encourage people to use CLI output as a software input: CLI output is for people.  Hence why most of its output isn't intended for software - in general, its meant to be human-readable, not machine readable.  AMI is an interface designed for software interaction, and hence we encourage output designed for software consumption to use that interface.

If you want this patch to be considered at all, you need to address Walter's points (need to be developed against trunk, needs to be in unified diff format (diff -u)).  Since its flying in the face of the current Asterisk design philosophy, it will face a steep uphill battle getting included.

By: Wolfgang Pichler (wuwu) 2012-02-20 13:08:46.530-0600

patch against asterisk trunk - done with svn diff

By: Wolfgang Pichler (wuwu) 2012-02-20 13:16:05.339-0600

i do understand the point here - AMI is for machine interaction - CLI is for human interaction. That is quit fine. But "asterisk -rx " is such a handy feature to get some values out of asterisk without the overhead of AMI - or AJAM - so i think it would be a bad idea to mark it for removal. It think many small scripts out there do rely on asterisk -rx - so forcing people to not use it any more would cause a lot of work for the sys admins out there

By: Corey Farrell (coreyfarrell) 2017-12-12 19:05:26.898-0600

Adding concise output for commands would bloat CLI handlers for little benefit.  As mentioned previously AMI is designed to provide information to other programs.  In addition we now have ARI which provides HTTP based API access.

If you disagree feel free to follow the Patch Contribution Process \[1\] and post to gerrit \[2\] but be aware this feature would face resistance.

\[1\] https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process
\[2\] https://wiki.asterisk.org/wiki/display/AST/Gerrit+Usage