提交 30813ca5 authored 作者: Anthony Minessale's avatar Anthony Minessale

FS-3130

上级 c79bfa76
...@@ -305,56 +305,60 @@ static void event_handler(switch_event_t *event) ...@@ -305,56 +305,60 @@ static void event_handler(switch_event_t *event)
} }
} }
if (send && l->filters && l->filters->headers) { if (send) {
switch_event_header_t *hp;
const char *hval;
send = 0;
switch_mutex_lock(l->filter_mutex); switch_mutex_lock(l->filter_mutex);
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;
while (comp_to && *comp_to) {
if (*comp_to == '+') {
pos = 1;
} else if (*comp_to == '-') {
pos = 0;
} else if (*comp_to != ' ') {
break;
}
comp_to++;
}
if (send && pos) { if (l->filters && l->filters->headers) {
continue; switch_event_header_t *hp;
} const char *hval;
if (!comp_to) { send = 0;
continue;
}
if (*hp->value == '/') { for (hp = l->filters->headers; hp; hp = hp->next) {
switch_regex_t *re = NULL; if ((hval = switch_event_get_header(event, hp->name))) {
int ovector[30]; const char *comp_to = hp->value;
cmp = !!switch_regex_perform(hval, comp_to, &re, ovector, sizeof(ovector) / sizeof(ovector[0])); int pos = 1, cmp = 0;
switch_regex_safe_free(re);
} else { while (comp_to && *comp_to) {
cmp = !strcasecmp(hval, comp_to); if (*comp_to == '+') {
} pos = 1;
} else if (*comp_to == '-') {
pos = 0;
} else if (*comp_to != ' ') {
break;
}
comp_to++;
}
if (send && pos) {
continue;
}
if (!comp_to) {
continue;
}
if (cmp) { if (*hp->value == '/') {
if (pos) { switch_regex_t *re = NULL;
send = 1; int ovector[30];
cmp = !!switch_regex_perform(hval, comp_to, &re, ovector, sizeof(ovector) / sizeof(ovector[0]));
switch_regex_safe_free(re);
} else { } else {
send = 0; cmp = !strcasecmp(hval, comp_to);
break; }
if (cmp) {
if (pos) {
send = 1;
} else {
send = 0;
break;
}
} }
} }
} }
switch_mutex_unlock(l->filter_mutex);
} }
switch_mutex_unlock(l->filter_mutex);
} }
if (send && switch_test_flag(l, LFLAG_MYEVENTS)) { if (send && switch_test_flag(l, LFLAG_MYEVENTS)) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论