fix broken filter command in event socket

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12489 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2009-03-06 19:25:19 +00:00
parent f3acb35505
commit 0e18742f20

View File

@ -254,7 +254,7 @@ static void event_handler(switch_event_t *event)
send = 0;
switch_mutex_lock(l->filter_mutex);
for (hp = l->filters->headers; hp; hp = hp->next) {
for (hp = l->filters->headers; hp; hp = hp->next) {
if ((hval = switch_event_get_header(event, hp->name))) {
const char *comp_to = hp->value;
int pos = 1, cmp = 0;
@ -611,7 +611,8 @@ SWITCH_STANDARD_API(event_sink_function)
switch_mutex_lock(listener->filter_mutex);
if (!listener->filters) {
switch_event_create(&listener->filters, SWITCH_EVENT_CHANNEL_DATA);
switch_event_create(&listener->filters, SWITCH_EVENT_CLONE);
listener->filters->event_id = SWITCH_EVENT_CHANNEL_DATA;
}
if (!strcasecmp(action, "delete")) {
@ -622,7 +623,8 @@ SWITCH_STANDARD_API(event_sink_function)
if (!strcasecmp(header_val, "all")) {
switch_event_destroy(&listener->filters);
switch_event_create(&listener->filters, SWITCH_EVENT_CHANNEL_DATA);
switch_event_create(&listener->filters, SWITCH_EVENT_CLONE);
listener->filters->event_id = SWITCH_EVENT_CHANNEL_DATA;
} else {
switch_event_del_header(listener->filters, header_val);
}
@ -1406,13 +1408,15 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even
switch_mutex_lock(listener->filter_mutex);
if (!listener->filters) {
switch_event_create(&listener->filters, SWITCH_EVENT_CHANNEL_DATA);
switch_event_create(&listener->filters, SWITCH_EVENT_CLONE);
listener->filters->event_id = SWITCH_EVENT_CHANNEL_DATA;
}
if (!strcasecmp(header_name, "delete")) {
if (!strcasecmp(header_val, "all")) {
switch_event_destroy(&listener->filters);
switch_event_create(&listener->filters, SWITCH_EVENT_CHANNEL_DATA);
switch_event_create(&listener->filters, SWITCH_EVENT_CLONE);
listener->filters->event_id = SWITCH_EVENT_CHANNEL_DATA;
} else {
switch_event_del_header(listener->filters, header_val);
}