[Home]

Summary:ASTERISK-13925: [patch] filter for manager events
Reporter:Marcus Hunger (fnordian)Labels:
Date Opened:2009-04-08 11:09:28Date Closed:2010-06-22 11:29:20
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Core/NewFeature
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) eventfilter.patch
( 1) eventfilter2.patch
( 2) eventfilter3.patch
Description:Hi,
to allow better filtering of ami-events than configuring categories, I created an option "eventfilter" for manager-users. Events to be sent are matched against regexes specified in these options and are discarded if the regex matches (blacklisting).
Comments:By: antoine (antoine) 2009-08-14 04:59:08

Hi,

Can anyone explain how does it work ?

By: Marcus Hunger (fnordian) 2009-08-21 10:35:04

you add regexs to your manager config and all events matching these will not be sent over ami.

e.g.:

eventfilter=Event: Newexten

this helps keeping the load on ami low.

By: rsw686 (rsw686) 2010-03-23 14:09:27

Any idea when this might be tested and added into Asterisk? I could use this feature as Asterisk eats up CPU cycles when you have 100 or so manager connections with just call read permissions. I am only interested in Dial and ExtenStatus events so I can alert users with information from our CRM about the incoming call.

By: Paul Belanger (pabelanger) 2010-04-20 23:25:43

This will require documentation.

By: Ronald Chan (loloski) 2010-05-16 05:27:41

I really want to test this, ight timing but the problem is

patch -p1 < event.diff --dry-run
patching file main/manager.c
Hunk #2 succeeded at 777 (offset 626 lines).
Hunk #3 FAILED at 839.
Hunk #4 FAILED at 874.
Hunk ASTERISK-1 succeeded at 1507 with fuzz 2 (offset 378 lines).
Hunk ASTERISK-2 succeeded at 3240 (offset 614 lines).
Hunk ASTERISK-3 succeeded at 3035 (offset 378 lines).
Hunk ASTERISK-4 succeeded at 5495 with fuzz 2 (offset 1253 lines).
Hunk ASTERISK-5 succeeded at 4643 (offset 380 lines).
Hunk ASTERISK-6 FAILED at 4681.
3 out of 10 hunks FAILED -- saving rejects to file main/manager.c.rej

By: Ronald Chan (loloski) 2010-05-16 05:30:07

right timing, but this is failed to compile on latest trunk. can some shed some light without this patch, how can you discard a lot of events that you don't need to listen?

By: Marcus Hunger (fnordian) 2010-05-17 11:51:26

i've updated the patch to apply and compile with current trunk.

By: Paul Belanger (pabelanger) 2010-05-17 12:04:16

Some changes to be made:

1. // is not a valid comment block.  /* comment */
2. Do not declare variables mid-block.
3. Be sure to use ast_free.

By: John Todd (jtodd) 2010-05-18 13:27:54

This is really cool!  Can the documentation happen?  This sounds like it would be very useful.  I'd like to see this in 1.8...

By: Russell Bryant (russell) 2010-05-18 13:28:08

This should also be using our list macros instead of open coded linked lists.

By: Marcus Hunger (fnordian) 2010-05-21 02:58:27

i changed the comment-style and the memory-allocation code to use ast_* functions. about the mid-block variable declarations, i am not really sure what you mean. unless i missed something, all variables are declared at the beginning of a block.

By: Jeff Peeler (jpeeler) 2010-05-21 10:11:49

I created a review for this, but didn't convert over to the list macros properly.

By: Marcus Hunger (fnordian) 2010-05-21 10:45:18

the list macros caused some confusion about what the patch intends to do.

By: Digium Subversion (svnbot) 2010-06-22 11:29:18

Repository: asterisk
Revision: 271868

U   trunk/CHANGES
U   trunk/configs/manager.conf.sample
U   trunk/main/manager.c

------------------------------------------------------------------------
r271868 | jpeeler | 2010-06-22 11:29:17 -0500 (Tue, 22 Jun 2010) | 14 lines

Add regular expression filtering for manager events.

This patch as documented in the sample config allows one to optionally apply
white, black, or both types of filtering to manager events. The new
'eventfilter' option is set per user.

(closes issue ASTERISK-13925)
Reported by: fnordian
Patches:
     eventfilter3.patch uploaded by fnordian (license 110),
     modified by me

Review: https://reviewboard.asterisk.org/r/673/

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=271868

By: Alexey (alex001) 2013-11-23 09:42:44.452-0600

Very nice feature , but not worked on 99% events :( (check on 1.8.12.0 - 1.8.23.0).
Function send_string filtered in process_events , but not filtered in astman_append , used in most cases.