Summary:ASTERISK-03159: [PATCH] support filtering of SIP "show users" and "show peers"
Reporter:Kevin P. Fleming (kpfleming)Labels:
Date Opened:2005-01-02 10:18:27.000-0600Date Closed:2008-01-15 15:20:51.000-0600
Versions:Frequency of
Environment:Attachments:( 0) 3222_sip_show_filter_rev3.diff.txt
Description:Attached patch allows CLI user to optionally supply a regular expression (which can be a plain string) to filter the results of "sip show users" or "sip show peers".


Disclaimer is on file.
Comments:By: () 2005-01-02 10:47:31.000-0600

Would this work with the manager interface also?

By: Kevin P. Fleming (kpfleming) 2005-01-02 10:51:02.000-0600

The same technique could work, but this patch does not provide that.

By: Olle Johansson (oej) 2005-01-02 13:33:25.000-0600

Hey, there are already filters...
"include", "exclude", "begin"

This will collide with those, or?

By: Mark Spencer (markster) 2005-01-02 18:03:45.000-0600

Does not apply to CVS anyway.

By: Kevin P. Fleming (kpfleming) 2005-01-02 22:58:29.000-0600

oej: No, "sip show peers" and "sip show users" do not currently have include/exclude/begin; the only place in * that has that is "iax2 show peers".

Mark: You are correct, when I uploaded this patch I neglected to note that it was relative to bug 3221, which contains a fix for ASTOBJ_CONTAINER_TRAVERSE. Sorry, my bad.

By: twisted (twisted) 2005-01-03 01:40:03.000-0600

kpfleming: actually, sip does currently have the begin/include/exclude matching:

pablo*CLI> sip show peers <tab>
begin    exclude  include

By: Brian West (bkw918) 2005-01-03 01:40:56.000-0600

just an FYI you can exec all cli commands via the manager interface.


By: Kevin P. Fleming (kpfleming) 2005-01-03 09:47:25.000-0600

You are both correct, of course. I don't know how I missed the include/exclude/begin stuff in "sip show peers" when I looked at it so many times...

As far as CLI commands being executed via the manager interface, I didn't realize that, and now I understand how this include/exclude/begin stuff would be useful there. It's not terribly intuitive from the CLI, though (especially "begin").

So, I guess this begs the question: both this bug and 3223 are going to be incompatible with the old "show peers" filtering, but they provide easier to use and more powerful filtering in its place. In addition, they add this filtering to "show users". Since I've already added regex filtering to "group show channels", I think it'd be nice to standardize on using regex filtering _throughout_ the CLI, rather than inconsistent methods like we have now.


By: Kevin P. Fleming (kpfleming) 2005-01-04 11:33:04.000-0600

Additional note: now that chan_sip has been converted to ASTOBJ, "sip show peers" no longer lists the peers in any specific order, so "sip show peers begin" is not very useful. I think for the future users will need to rely on filtering the list with specific patterns, rather than relying on any particular order.

By: Mark Spencer (markster) 2005-01-04 14:54:34.000-0600

I guess i'll take the change in the command line in this case, as long as they are consistent with the others, but generally I am reluctant to change the command line unless there is a *really* good reason to do so.

By: Kevin P. Fleming (kpfleming) 2005-01-04 15:22:34.000-0600

Agreed, that's why I spent so much time documenting it :-) Thanks for listening.

By: Mark Spencer (markster) 2005-01-09 04:05:48.000-0600

I think this one has been open for discussion long enough.  If you'll go ahead and supply an updated patch, I'll go ahead and merge it in.  Thanks!

By: Kevin P. Fleming (kpfleming) 2005-01-09 07:51:47.000-0600

Rediffed against current CVS, and removes "include/exclude/begin" from "sip show peers".

By: Mark Spencer (markster) 2005-01-09 12:45:06.000-0600

Fixed in CVS head.

By: Digium Subversion (svnbot) 2008-01-15 15:20:51.000-0600

Repository: asterisk
Revision: 4734

U   trunk/channels/chan_sip.c

r4734 | markster | 2008-01-15 15:20:51 -0600 (Tue, 15 Jan 2008) | 2 lines

Allow sip show users/peers to filter on regexp (bug ASTERISK-3159)