[asterisk-users] Improving CLI Help - was [Re: 1.6.2 No "soft hangup"?]

Jose P. Espinal jpe at slackware-es.com
Wed Apr 21 20:40:54 CDT 2010


Hi,

Maybe you could do something in shellscript too:

e.g.
asterisk -rx "help" | grep -ia "something"

That would behave just as describe in the suggestion (but it's easier to 
do :P)

You could place that in a  tiny shellscript, that takes the 'something' 
as an argument:

#!/bin/bash
token=$1
asterisk -rx "help" | grep -ia "${token}"

Save that with the name of your preference (somewhere inside your $PATH, 
would be nice), and just execute it like a normal command:

[name_you_gave_it] sip
[name_you_gave_it] peer
[name_you_gave_it] whatever


Note:
You then could make a lot of fancy customizations to parameters of your 
script, etc., and even use other tools for if needed (e.g. gawk, sed, etc.)



sean darcy wrote:
> Olle E. Johansson wrote:
>   
>>> Further to Steve Edward's comment, I think things would be more
>>> obvious if the help system was improved slightly, for instance:
>>>
>>> If you were trying to figure out the commands dealing with peers, you
>>> would be able to type:
>>> *CLI> help peer
>>> No "peer" command found.  Possible alternatives:
>>>                iax2 show peer Show details on specific IAX peer
>>>               iax2 show peers List defined IAX peers
>>>                sip show peers List defined SIP peers
>>>                 sip show peer Show details on specific SIP peer
>>>          (and so on, maybe using the "[More]" option to help it be readable)
>>>
>>> In this case, if I could use the "help" system to search on all
>>> occurrences of the word "hangup" in the available commands, I would
>>> probably have found it myself instead of bothering the list.
>>>       
>> THat's a very good idea. Thank you! 
>>
>> Now we need someone that codes it :-)
>>
>> /O
>>     
> Well I'm certainly not the one who could code it, but is there any way 
> to simply "grep" all the help. So, for instance, if you did "help 
> hangup" you got:
>
> hangup request <no description available>
>
> which you now get,
>
> followed by all the commands that have "hangup" in them, including their 
> descriptions. For instance:
>
> But see:
> channel request hangup <channel>
>          Request that a channel be hung up. The hangup takes effect
>          the next time the driver reads or writes from the channel
> etc
> etc
>
> sean
>
>
>   

-- 
Jose P. Espinal
http://www.eslackware.com
IRC: [OFTC|FreeNode]
Khratos @ #slackware | #asterisk/-doc/-bugs




More information about the asterisk-users mailing list