From 3ff0aaa0befa3ff68aa0adeac8ab062d8f9ddcb5 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 7 Jan 2014 00:38:42 +0500 Subject: [PATCH 1/3] FS-5653 --resolve --- libs/esl/fs_cli.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/libs/esl/fs_cli.c b/libs/esl/fs_cli.c index 05286ecc49..968e647e33 100644 --- a/libs/esl/fs_cli.c +++ b/libs/esl/fs_cli.c @@ -85,6 +85,8 @@ static int running = 1; static int thread_running = 0; static char *filter_uuid; static char *logfilter; +static int timeout = 0; +static int connect_timeout = 0; #ifndef WIN32 static EditLine *el; static History *myhistory; @@ -603,6 +605,7 @@ static const char *usage_str = " -d, --debug=level Debug Level (0 - 7)\n" " -b, --batchmode Batch mode\n" " -t, --timeout Timeout for API commands (in miliseconds)\n" + " -T, --connect-timeout Timeout for socket connection (in miliseconds)\n" " -n, --no-color Disable color\n\n"; static int usage(char *name){ @@ -1249,6 +1252,10 @@ static void read_config(const char *dft_cfile, const char *cfile) { profiles[pcount-1].console_fnkeys[i - 1] = strdup(val); } } + } else if (!strcasecmp(var, "timeout")) { + timeout = atoi(val); + } else if (!strcasecmp(var, "connect-timeout")) { + connect_timeout = atoi(val); } } esl_config_close_file(&cfg); @@ -1301,6 +1308,7 @@ int main(int argc, char *argv[]) {"interrupt", 0, 0, 'i'}, {"reconnect", 0, 0, 'R'}, {"timeout", 1, 0, 't'}, + {"connect-timeout", 1, 0, 'T'}, {0, 0, 0, 0} }; char temp_host[128]; @@ -1319,7 +1327,7 @@ int main(int argc, char *argv[]) int argv_log_uuid = 0; int argv_quiet = 0; int argv_batch = 0; - int loops = 2, reconnect = 0, timeout = 0; + int loops = 2, reconnect = 0; char *ccheck; #ifdef WIN32 @@ -1354,7 +1362,7 @@ int main(int argc, char *argv[]) esl_global_set_default_logger(6); /* default debug level to 6 (info) */ for(;;) { int option_index = 0; - opt = getopt_long(argc, argv, "H:P:S:u:p:d:x:l:Ut:qrRhib?n", options, &option_index); + opt = getopt_long(argc, argv, "H:P:S:u:p:d:x:l:Ut:T:qrRhib?n", options, &option_index); if (opt == -1) break; switch (opt) { case 'H': @@ -1418,6 +1426,9 @@ int main(int argc, char *argv[]) case 't': timeout = atoi(optarg); break; + case 'T': + connect_timeout = atoi(optarg); + break; case 'h': case '?': print_banner(stdout, is_color); @@ -1488,7 +1499,7 @@ int main(int argc, char *argv[]) connected = 0; while (--loops > 0) { memset(&handle, 0, sizeof(handle)); - if (esl_connect(&handle, profile->host, profile->port, profile->user, profile->pass)) { + if (esl_connect_timeout(&handle, profile->host, profile->port, profile->user, profile->pass, connect_timeout)) { esl_global_set_default_logger(7); esl_log(ESL_LOG_ERROR, "Error Connecting [%s]\n", handle.err); if (loops == 1) { From 695ac57e4966e16dc5a6634d68133312c9ce8ee8 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 7 Jan 2014 00:47:56 +0500 Subject: [PATCH 2/3] FS-6032 --resolve --- .../applications/mod_commands/mod_commands.c | 35 ++++--------------- 1 file changed, 6 insertions(+), 29 deletions(-) diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index 2b21821ccc..2767644559 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -1108,7 +1108,7 @@ SWITCH_STANDARD_API(in_group_function) SWITCH_STANDARD_API(user_data_function) { - switch_xml_t x_domain, xml = NULL, x_user = NULL, x_group = NULL, x_param, x_params; + switch_xml_t x_user = NULL, x_param, x_params; int argc; char *mydata = NULL, *argv[3], *key = NULL, *type = NULL, *user, *domain, *dup_domain = NULL; char delim = ' '; @@ -1143,7 +1143,7 @@ SWITCH_STANDARD_API(user_data_function) switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "domain", domain); switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "type", type); - if (key && type && switch_xml_locate_user("id", user, domain, NULL, &xml, &x_domain, &x_user, &x_group, params) == SWITCH_STATUS_SUCCESS) { + if (key && type && switch_xml_locate_user_merged("id:number-alias", user, domain, NULL, &x_user, params) == SWITCH_STATUS_SUCCESS) { if (!strcmp(type, "attr")) { const char *attr = switch_xml_attr_soft(x_user, key); result = attr; @@ -1155,29 +1155,6 @@ SWITCH_STANDARD_API(user_data_function) elem = "variable"; } - if ((x_params = switch_xml_child(x_domain, container))) { - for (x_param = switch_xml_child(x_params, elem); x_param; x_param = x_param->next) { - const char *var = switch_xml_attr(x_param, "name"); - const char *val = switch_xml_attr(x_param, "value"); - - if (var && val && !strcasecmp(var, key)) { - result = val; - } - - } - } - - if (x_group && (x_params = switch_xml_child(x_group, container))) { - for (x_param = switch_xml_child(x_params, elem); x_param; x_param = x_param->next) { - const char *var = switch_xml_attr(x_param, "name"); - const char *val = switch_xml_attr(x_param, "value"); - - if (var && val && !strcasecmp(var, key)) { - result = val; - } - } - } - if ((x_params = switch_xml_child(x_user, container))) { for (x_param = switch_xml_child(x_params, elem); x_param; x_param = x_param->next) { const char *var = switch_xml_attr(x_param, "name"); @@ -1194,7 +1171,7 @@ SWITCH_STANDARD_API(user_data_function) if (result) { stream->write_function(stream, "%s", result); } - switch_xml_free(xml); + switch_xml_free(x_user); switch_safe_free(mydata); switch_safe_free(dup_domain); switch_event_destroy(¶ms); @@ -1204,7 +1181,7 @@ SWITCH_STANDARD_API(user_data_function) static switch_status_t _find_user(const char *cmd, switch_core_session_t *session, switch_stream_handle_t *stream, switch_bool_t tf) { - switch_xml_t x_domain = NULL, x_user = NULL, xml = NULL; + switch_xml_t x_user = NULL; int argc; char *mydata = NULL, *argv[3]; char *key, *user, *domain; @@ -1244,7 +1221,7 @@ static switch_status_t _find_user(const char *cmd, switch_core_session_t *sessio goto end; } - if (switch_xml_locate_user(key, user, domain, NULL, &xml, &x_domain, &x_user, NULL, NULL) != SWITCH_STATUS_SUCCESS) { + if (switch_xml_locate_user_merged(key, user, domain, NULL, &x_user, NULL) != SWITCH_STATUS_SUCCESS) { err = "can't find user"; goto end; } @@ -1274,7 +1251,7 @@ static switch_status_t _find_user(const char *cmd, switch_core_session_t *sessio } } - switch_xml_free(xml); + switch_xml_free(x_user); switch_safe_free(mydata); return SWITCH_STATUS_SUCCESS; } From f8844d1398b60e49ae1b6543fd3532c71d4f4e74 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 7 Jan 2014 01:54:31 +0500 Subject: [PATCH 3/3] FS-6020 --resolve --- src/switch_channel.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/switch_channel.c b/src/switch_channel.c index 21b9dedc6f..eb8be218d1 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -1971,6 +1971,7 @@ SWITCH_DECLARE(void) switch_channel_clear_flag(switch_channel_t *channel, switch } switch_mutex_unlock(channel->profile_mutex); + switch_channel_set_callstate(channel, CCS_ACTIVE); } if (flag == CF_ORIGINATOR && switch_channel_test_flag(channel, CF_ANSWERED) && switch_channel_up_nosig(channel)) {