提交 dad2cd19 authored 作者: Mike Jerris's avatar Mike Jerris

Merge pull request #841 in FS/freeswitch from…

Merge pull request #841 in FS/freeswitch from ~ICEHESS/freeswitch:feature/FS-9132-add-more-variables-to-default-filter to master

* commit '8153b6fd':
  FS-9132: [mod_kazoo] remove whitespaces
  FS-9132: [mod_kazoo] Add more vars to default filter
...@@ -148,5 +148,5 @@ void add_kz_commands(switch_loadable_module_interface_t **module_interface, swit ...@@ -148,5 +148,5 @@ void add_kz_commands(switch_loadable_module_interface_t **module_interface, swit
SWITCH_ADD_API(api_interface, "kz_uuid_setvar_multi", UUID_SET_DESC, uuid_setvar_multi_function, UUID_MULTISET_SYNTAX); SWITCH_ADD_API(api_interface, "kz_uuid_setvar_multi", UUID_SET_DESC, uuid_setvar_multi_function, UUID_MULTISET_SYNTAX);
switch_console_set_complete("add kz_uuid_setvar_multi ::console::list_uuid"); switch_console_set_complete("add kz_uuid_setvar_multi ::console::list_uuid");
SWITCH_ADD_API(api_interface, "kz_uuid_setvar", UUID_MULTISET_DESC, uuid_setvar_function, UUID_SET_SYNTAX); SWITCH_ADD_API(api_interface, "kz_uuid_setvar", UUID_MULTISET_DESC, uuid_setvar_function, UUID_SET_SYNTAX);
switch_console_set_complete("add kz_uuid_setvar ::console::list_uuid"); switch_console_set_complete("add kz_uuid_setvar ::console::list_uuid");
} }
...@@ -141,7 +141,7 @@ SWITCH_STANDARD_APP(multiset_function) { ...@@ -141,7 +141,7 @@ SWITCH_STANDARD_APP(multiset_function) {
arg = switch_core_session_strdup(session, arg); arg = switch_core_session_strdup(session, arg);
argc = switch_split(arg, delim, array); argc = switch_split(arg, delim, array);
for(i = 0; i < argc; i++) { for(i = 0; i < argc; i++) {
base_set(session, array[i], SWITCH_STACK_BOTTOM); base_set(session, array[i], SWITCH_STACK_BOTTOM);
} }
...@@ -178,7 +178,7 @@ SWITCH_STANDARD_APP(unset_function) { ...@@ -178,7 +178,7 @@ SWITCH_STANDARD_APP(unset_function) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "UNSET [%s]\n", (char *) data); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "UNSET [%s]\n", (char *) data);
switch_channel_set_variable(switch_core_session_get_channel(session), data, NULL); switch_channel_set_variable(switch_core_session_get_channel(session), data, NULL);
} }
if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_DATA) == SWITCH_STATUS_SUCCESS) { if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_DATA) == SWITCH_STATUS_SUCCESS) {
switch_channel_event_set_data(channel, event); switch_channel_event_set_data(channel, event);
switch_event_fire(&event); switch_event_fire(&event);
...@@ -242,7 +242,7 @@ void add_kz_dptools(switch_loadable_module_interface_t **module_interface, switc ...@@ -242,7 +242,7 @@ void add_kz_dptools(switch_loadable_module_interface_t **module_interface, switc
SWITCH_ADD_APP(app_interface, "kz_unset", UNSET_SHORT_DESC, UNSET_LONG_DESC, unset_function, UNSET_SYNTAX, SWITCH_ADD_APP(app_interface, "kz_unset", UNSET_SHORT_DESC, UNSET_LONG_DESC, unset_function, UNSET_SYNTAX,
SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC | SAF_ZOMBIE_EXEC); SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC | SAF_ZOMBIE_EXEC);
SWITCH_ADD_APP(app_interface, "kz_multiunset", MULTISET_SHORT_DESC, MULTISET_LONG_DESC, multiunset_function, MULTIUNSET_SYNTAX, SWITCH_ADD_APP(app_interface, "kz_multiunset", MULTISET_SHORT_DESC, MULTISET_LONG_DESC, multiunset_function, MULTIUNSET_SYNTAX,
SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC | SAF_ZOMBIE_EXEC); SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC | SAF_ZOMBIE_EXEC);
SWITCH_ADD_APP(app_interface, "kz_export", EXPORT_SHORT_DESC, EXPORT_LONG_DESC, export_function, EXPORT_SYNTAX, SWITCH_ADD_APP(app_interface, "kz_export", EXPORT_SHORT_DESC, EXPORT_LONG_DESC, export_function, EXPORT_SYNTAX,
SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC | SAF_ZOMBIE_EXEC); SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC | SAF_ZOMBIE_EXEC);
} }
...@@ -37,7 +37,7 @@ static char *my_dup(const char *s) { ...@@ -37,7 +37,7 @@ static char *my_dup(const char *s) {
size_t len = strlen(s) + 1; size_t len = strlen(s) + 1;
void *new = malloc(len); void *new = malloc(len);
switch_assert(new); switch_assert(new);
return (char *) memcpy(new, s, len); return (char *) memcpy(new, s, len);
} }
...@@ -58,21 +58,21 @@ static int is_private_header(const char *name) { ...@@ -58,21 +58,21 @@ static int is_private_header(const char *name) {
static switch_status_t kazoo_event_dup(switch_event_t **clone, switch_event_t *event, switch_hash_t *filter) { static switch_status_t kazoo_event_dup(switch_event_t **clone, switch_event_t *event, switch_hash_t *filter) {
switch_event_header_t *header; switch_event_header_t *header;
if (switch_event_create_subclass(clone, SWITCH_EVENT_CLONE, event->subclass_name) != SWITCH_STATUS_SUCCESS) { if (switch_event_create_subclass(clone, SWITCH_EVENT_CLONE, event->subclass_name) != SWITCH_STATUS_SUCCESS) {
return SWITCH_STATUS_GENERR; return SWITCH_STATUS_GENERR;
} }
(*clone)->event_id = event->event_id; (*clone)->event_id = event->event_id;
(*clone)->event_user_data = event->event_user_data; (*clone)->event_user_data = event->event_user_data;
(*clone)->bind_user_data = event->bind_user_data; (*clone)->bind_user_data = event->bind_user_data;
(*clone)->flags = event->flags; (*clone)->flags = event->flags;
for (header = event->headers; header; header = header->next) { for (header = event->headers; header; header = header->next) {
if (event->subclass_name && !strcmp(header->name, "Event-Subclass")) { if (event->subclass_name && !strcmp(header->name, "Event-Subclass")) {
continue; continue;
} }
if (strncmp(header->name, globals.kazoo_var_prefix, globals.var_prefix_length) if (strncmp(header->name, globals.kazoo_var_prefix, globals.var_prefix_length)
&& filter && filter
&& !switch_core_hash_find(filter, header->name) && !switch_core_hash_find(filter, header->name)
...@@ -82,7 +82,7 @@ static switch_status_t kazoo_event_dup(switch_event_t **clone, switch_event_t *e ...@@ -82,7 +82,7 @@ static switch_status_t kazoo_event_dup(switch_event_t **clone, switch_event_t *e
{ {
continue; continue;
} }
if (header->idx) { if (header->idx) {
int i; int i;
for (i = 0; i < header->idx; i++) { for (i = 0; i < header->idx; i++) {
...@@ -92,33 +92,33 @@ static switch_status_t kazoo_event_dup(switch_event_t **clone, switch_event_t *e ...@@ -92,33 +92,33 @@ static switch_status_t kazoo_event_dup(switch_event_t **clone, switch_event_t *e
switch_event_add_header_string(*clone, SWITCH_STACK_BOTTOM, header->name, header->value); switch_event_add_header_string(*clone, SWITCH_STACK_BOTTOM, header->name, header->value);
} }
} }
if (event->body) { if (event->body) {
(*clone)->body = DUP(event->body); (*clone)->body = DUP(event->body);
} }
(*clone)->key = event->key; (*clone)->key = event->key;
return SWITCH_STATUS_SUCCESS; return SWITCH_STATUS_SUCCESS;
} }
static void event_handler(switch_event_t *event) { static void event_handler(switch_event_t *event) {
switch_event_t *clone = NULL; switch_event_t *clone = NULL;
ei_event_stream_t *event_stream = (ei_event_stream_t *) event->bind_user_data; ei_event_stream_t *event_stream = (ei_event_stream_t *) event->bind_user_data;
/* if mod_kazoo or the event stream isn't running dont push a new event */ /* if mod_kazoo or the event stream isn't running dont push a new event */
if (!switch_test_flag(event_stream, LFLAG_RUNNING) || !switch_test_flag(&globals, LFLAG_RUNNING)) { if (!switch_test_flag(event_stream, LFLAG_RUNNING) || !switch_test_flag(&globals, LFLAG_RUNNING)) {
return; return;
} }
if (event->event_id == SWITCH_EVENT_CUSTOM) { if (event->event_id == SWITCH_EVENT_CUSTOM) {
ei_event_binding_t *event_binding = event_stream->bindings; ei_event_binding_t *event_binding = event_stream->bindings;
unsigned short int found = 0; unsigned short int found = 0;
if (!event->subclass_name) { if (!event->subclass_name) {
return; return;
} }
while(event_binding != NULL) { while(event_binding != NULL) {
if (event_binding->type == SWITCH_EVENT_CUSTOM) { if (event_binding->type == SWITCH_EVENT_CUSTOM) {
if(event_binding->subclass_name if(event_binding->subclass_name
...@@ -238,9 +238,9 @@ static void *SWITCH_THREAD_FUNC event_stream_loop(switch_thread_t *thread, void ...@@ -238,9 +238,9 @@ static void *SWITCH_THREAD_FUNC event_stream_loop(switch_thread_t *thread, void
} else { } else {
ei_x_new_with_version(&ebuf); ei_x_new_with_version(&ebuf);
} }
ei_encode_switch_event(&ebuf, event); ei_encode_switch_event(&ebuf, event);
if (globals.event_stream_preallocate > 0 && ebuf.buffsz > globals.event_stream_preallocate) { if (globals.event_stream_preallocate > 0 && ebuf.buffsz > globals.event_stream_preallocate) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "increased event stream buffer size to %d\n", ebuf.buffsz); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "increased event stream buffer size to %d\n", ebuf.buffsz);
} }
......
...@@ -1092,7 +1092,7 @@ static void *SWITCH_THREAD_FUNC handle_node(switch_thread_t *thread, void *obj) ...@@ -1092,7 +1092,7 @@ static void *SWITCH_THREAD_FUNC handle_node(switch_thread_t *thread, void *obj)
ei_x_new(&received_msg->buf); ei_x_new(&received_msg->buf);
} }
} }
while (switch_queue_trypop(ei_node->send_msgs, &pop) == SWITCH_STATUS_SUCCESS while (switch_queue_trypop(ei_node->send_msgs, &pop) == SWITCH_STATUS_SUCCESS
&& ++send_msg_count <= globals.send_msg_batch) { && ++send_msg_count <= globals.send_msg_batch) {
ei_send_msg_t *send_msg = (ei_send_msg_t *) pop; ei_send_msg_t *send_msg = (ei_send_msg_t *) pop;
......
...@@ -477,6 +477,9 @@ switch_hash_t *create_default_filter() { ...@@ -477,6 +477,9 @@ switch_hash_t *create_default_filter() {
switch_core_hash_insert(filter, "whistle_application_name", "1"); switch_core_hash_insert(filter, "whistle_application_name", "1");
switch_core_hash_insert(filter, "whistle_application_response", "1"); switch_core_hash_insert(filter, "whistle_application_response", "1");
switch_core_hash_insert(filter, "whistle_event_name", "1"); switch_core_hash_insert(filter, "whistle_event_name", "1");
switch_core_hash_insert(filter, "kazoo_application_name", "1");
switch_core_hash_insert(filter, "kazoo_application_response", "1");
switch_core_hash_insert(filter, "kazoo_event_name", "1");
switch_core_hash_insert(filter, "sip_auto_answer_notify", "1"); switch_core_hash_insert(filter, "sip_auto_answer_notify", "1");
switch_core_hash_insert(filter, "eavesdrop_group", "1"); switch_core_hash_insert(filter, "eavesdrop_group", "1");
switch_core_hash_insert(filter, "origination_caller_id_name", "1"); switch_core_hash_insert(filter, "origination_caller_id_name", "1");
...@@ -489,6 +492,21 @@ switch_hash_t *create_default_filter() { ...@@ -489,6 +492,21 @@ switch_hash_t *create_default_filter() {
switch_core_hash_insert(filter, "effective_caller_id_number", "1"); switch_core_hash_insert(filter, "effective_caller_id_number", "1");
switch_core_hash_insert(filter, "effective_callee_id_name", "1"); switch_core_hash_insert(filter, "effective_callee_id_name", "1");
switch_core_hash_insert(filter, "effective_callee_id_number", "1"); switch_core_hash_insert(filter, "effective_callee_id_number", "1");
switch_core_hash_insert(filter, "variable_destination_number", "1");
switch_core_hash_insert(filter, "variable_effective_callee_id_name", "1");
switch_core_hash_insert(filter, "variable_effective_callee_id_number", "1");
switch_core_hash_insert(filter, "variable_record_silence_hits", "1");
switch_core_hash_insert(filter, "variable_refer_uuid", "1");
switch_core_hash_insert(filter, "variable_sip_call_id", "1");
switch_core_hash_insert(filter, "variable_sip_h_Referred-By", "1");
switch_core_hash_insert(filter, "variable_sip_h_X-AUTH-PORT", "1");
switch_core_hash_insert(filter, "variable_sip_loopback_req_uri", "1");
switch_core_hash_insert(filter, "variable_sip_received_port", "1");
switch_core_hash_insert(filter, "variable_sip_refer_to", "1");
switch_core_hash_insert(filter, "variable_sip_req_host", "1");
switch_core_hash_insert(filter, "variable_sip_req_uri", "1");
switch_core_hash_insert(filter, "variable_transfer_source", "1");
switch_core_hash_insert(filter, "variable_uuid", "1");
/* Registration headers */ /* Registration headers */
switch_core_hash_insert(filter, "call-id", "1"); switch_core_hash_insert(filter, "call-id", "1");
...@@ -570,6 +588,7 @@ switch_hash_t *create_default_filter() { ...@@ -570,6 +588,7 @@ switch_hash_t *create_default_filter() {
switch_core_hash_insert(filter, "variable_fax_timezone", "1"); switch_core_hash_insert(filter, "variable_fax_timezone", "1");
switch_core_hash_insert(filter, "variable_fax_doc_id", "1"); switch_core_hash_insert(filter, "variable_fax_doc_id", "1");
switch_core_hash_insert(filter, "variable_fax_doc_database", "1"); switch_core_hash_insert(filter, "variable_fax_doc_database", "1");
switch_core_hash_insert(filter, "variable_has_t38", "1");
/* Secure headers */ /* Secure headers */
switch_core_hash_insert(filter, "variable_sdp_secure_savp_only", "1"); switch_core_hash_insert(filter, "variable_sdp_secure_savp_only", "1");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论