[asterisk-dev] [Code Review] Add regular expression blacklist filtering for manager events
David Vossel
dvossel at digium.com
Wed May 26 15:51:39 CDT 2010
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/673/#review2094
-----------------------------------------------------------
What you have works, but using astobj2 would be super cool.
You'd just have to add this function below, alloc the filters using ao2_alloc(), and give and remove refs as you add and remove filters from lists.
static void event_filter_destructor(void *obj)
{
struct *event_filter = (struct event_filter *) obj;
regfree(&filter->regx);
}
/trunk/main/manager.c
<https://reviewboard.asterisk.org/r/673/#comment4450>
don't even worry about this now.
/trunk/main/manager.c
<https://reviewboard.asterisk.org/r/673/#comment4451>
remove these two lines, replace with this.
ao2_t_ref(fliter, -1, "bye")
/trunk/main/manager.c
<https://reviewboard.asterisk.org/r/673/#comment4452>
before inserting filter into list add this
ao2_t_ref(fliter, 1, "copy filter to session")
/trunk/main/manager.c
<https://reviewboard.asterisk.org/r/673/#comment4449>
remove these two lines, replace with this.
ao2_t_ref(filter, -1, "bye")
/trunk/main/manager.c
<https://reviewboard.asterisk.org/r/673/#comment4446>
make this line
ao2_t_alloc(sizeof(event_filter), event_filter_destructor, "making a event_filter")
/trunk/main/manager.c
<https://reviewboard.asterisk.org/r/673/#comment4447>
make this
ao2_t_ref(new_fliter, -1, "failed to make regx")
/trunk/main/manager.c
<https://reviewboard.asterisk.org/r/673/#comment4448>
remove these two lines and replace with this.
ao2_t_ref(fliter, -1, "bye")
- David
On 2010-05-26 15:21:36, Jeff Peeler wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/673/
> -----------------------------------------------------------
>
> (Updated 2010-05-26 15:21:36)
>
>
> Review request for Asterisk Developers.
>
>
> Summary
> -------
>
> From the submitter:
> 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).
>
>
> This addresses bug 14861.
> https://issues.asterisk.org/view.php?id=14861
>
>
> Diffs
> -----
>
> /trunk/CHANGES 266103
> /trunk/configs/manager.conf.sample 266103
> /trunk/main/manager.c 266103
>
> Diff: https://reviewboard.asterisk.org/r/673/diff
>
>
> Testing
> -------
>
> I ensured manager events are reported the same without filtering and works as expected with.
>
>
> Thanks,
>
> Jeff
>
>
More information about the asterisk-dev
mailing list