From 8d599a82bc69e5eb71cdc4ddf112b6f3d09c20f7 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 26 Jan 2015 10:31:15 -0500 Subject: [PATCH 01/91] one more tweak to not jump back and forth on ice when you have 2 reachable --- src/switch_rtp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/switch_rtp.c b/src/switch_rtp.c index ad93d8ee71..4ad259cce3 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -1154,6 +1154,7 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d host, port); switch_rtp_change_ice_dest(rtp_session, ice, host, port); + ice->last_ok = now; } From f795acbff2ac13c5ac7be85fc41753116b9c7a07 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 26 Jan 2015 11:01:40 -0600 Subject: [PATCH 02/91] FS-7193 #resolve --- src/mod/endpoints/mod_sofia/mod_sofia.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 68453edf34..7438d140a1 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -4247,11 +4247,12 @@ static switch_status_t sofia_manage(char *relative_oid, switch_management_action return SWITCH_STATUS_SUCCESS; } -static void protect_dest_uri(switch_caller_profile_t *cp) +static int protect_dest_uri(switch_caller_profile_t *cp) { char *p = cp->destination_number, *o = p; char *q = NULL, *e = NULL, *qenc = NULL; switch_size_t enclen = 0; + int mod = 0; while((p = strchr(p, '/'))) { q = p++; @@ -4267,11 +4268,11 @@ static void protect_dest_uri(switch_caller_profile_t *cp) } } - if (!go) return; + if (!go) return 0; *q++ = '\0'; } else { - return; + return 0; } if (!strncasecmp(q, "sips:", 5)) { @@ -4281,7 +4282,7 @@ static void protect_dest_uri(switch_caller_profile_t *cp) } if (!(e = strchr(q, '@'))) { - return; + return 0; } *e++ = '\0'; @@ -4290,9 +4291,12 @@ static void protect_dest_uri(switch_caller_profile_t *cp) enclen = (strlen(q) * 2) + 2; qenc = switch_core_alloc(cp->pool, enclen); switch_url_encode(q, qenc, enclen); + mod = 1; } cp->destination_number = switch_core_sprintf(cp->pool, "%s/%s@%s", o, qenc ? qenc : q, e); + + return mod; } static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event, @@ -4312,6 +4316,7 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session int cid_locked = 0; switch_channel_t *o_channel = NULL; sofia_gateway_t *gateway_ptr = NULL; + int mod = 0; *new_session = NULL; @@ -4321,7 +4326,7 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session } if (!switch_true(switch_event_get_header(var_event, "sofia_suppress_url_encoding"))) { - protect_dest_uri(outbound_profile); + mod = protect_dest_uri(outbound_profile); } if (!(nsession = switch_core_session_request_uuid(sofia_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, @@ -4509,7 +4514,7 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session c++; tech_pvt->e_dest = switch_core_session_strdup(nsession, c); } - } else if ((host = strchr(dest, '%'))) { + } else if (!mod && (host = strchr(dest, '%'))) { char buf[1024]; *host = '@'; tech_pvt->e_dest = switch_core_session_strdup(nsession, dest); From c16f9ec1d97500bf03a196a1ff0d7b9b30b51d5f Mon Sep 17 00:00:00 2001 From: Ken Rice Date: Mon, 26 Jan 2015 15:57:33 -0600 Subject: [PATCH 03/91] FS-7191 #resolve #comment edit pgsql example connection string to remove unneeded option that may cause a failure on some systems. --- conf/vanilla/autoload_configs/switch.conf.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/vanilla/autoload_configs/switch.conf.xml b/conf/vanilla/autoload_configs/switch.conf.xml index 102a2a7f1e..8e66e7159f 100644 --- a/conf/vanilla/autoload_configs/switch.conf.xml +++ b/conf/vanilla/autoload_configs/switch.conf.xml @@ -152,7 +152,7 @@ - + - + From 30917dd19c84ed2b15c2a5ae12e28c5587f895e2 Mon Sep 17 00:00:00 2001 From: Chris Rienzo Date: Wed, 11 Feb 2015 11:55:46 -0500 Subject: [PATCH 32/91] FS-7265 #resolve #comment [mod_mongo] add mongo_find_n API --- src/mod/applications/mod_mongo/mod_mongo.c | 114 +++++++++++++++++++-- 1 file changed, 106 insertions(+), 8 deletions(-) diff --git a/src/mod/applications/mod_mongo/mod_mongo.c b/src/mod/applications/mod_mongo/mod_mongo.c index aeb375a9d5..0de63fd0b6 100644 --- a/src/mod/applications/mod_mongo/mod_mongo.c +++ b/src/mod/applications/mod_mongo/mod_mongo.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2014, Anthony Minessale II + * Copyright (C) 2005-2015, Anthony Minessale II * * Version: MPL 1.1 * @@ -44,6 +44,7 @@ #define DELIMITER ';' #define FIND_ONE_SYNTAX "mongo_find_one ns; query; fields; options" +#define FIND_N_SYNTAX "mongo_find_n ns; query; fields; options; n" #define MAPREDUCE_SYNTAX "mongo_mapreduce ns; query" SWITCH_MODULE_LOAD_FUNCTION(mod_mongo_load); @@ -184,6 +185,102 @@ SWITCH_STANDARD_API(mongo_mapreduce_function) return status; } +SWITCH_STANDARD_API(mongo_find_n_function) +{ + switch_status_t status = SWITCH_STATUS_SUCCESS; + char *db = NULL, *collection = NULL, *json_query = NULL, *json_fields = NULL, *query_options_str = NULL; + int query_options = 0; + int n = 1; + + db = strdup(cmd); + switch_assert(db != NULL); + + if ((collection = strchr(db, '.'))) { + *collection++ = '\0'; + if ((json_query = strchr(collection, DELIMITER))) { + *json_query++ = '\0'; + if ((json_fields = strchr(json_query, DELIMITER))) { + *json_fields++ = '\0'; + if ((query_options_str = strchr(json_fields, DELIMITER))) { + char *n_str; + *query_options_str++ = '\0'; + if (!zstr(query_options_str)) { + query_options = parse_query_options(query_options_str); + } + if ((n_str = strchr(query_options_str, DELIMITER))) { + *n_str++ = '\0'; + if (switch_is_number(n_str)) { + n = atoi(n_str); + if (n < 1) { + n = 1; + } + } + } + } + } + } + } + + if (!zstr(db) && !zstr(collection) && !zstr(json_query) && !zstr(json_fields)) { + bson_error_t error; + mongoc_client_t *conn = get_connection(); + if (conn) { + mongoc_collection_t *col = mongoc_client_get_collection(conn, db, collection); + if (col) { + bson_t *query = bson_new_from_json((uint8_t *)json_query, strlen(json_query), &error); + bson_t *fields = bson_new_from_json((uint8_t *)json_fields, strlen(json_fields), &error); + if (query && fields) { + /* send query */ + mongoc_cursor_t *cursor = mongoc_collection_find(col, query_options, 0, n, 0, query, fields, NULL); + if (cursor && !mongoc_cursor_error(cursor, &error)) { + /* get results from cursor */ + const bson_t *result; + stream->write_function(stream, "-OK\n["); + if (mongoc_cursor_more(cursor) && mongoc_cursor_next(cursor, &result)) { + char *json_result; + json_result = bson_as_json(result, NULL); + stream->write_function(stream, "%s", json_result); + bson_free(json_result); + } + while (mongoc_cursor_more(cursor) && mongoc_cursor_next(cursor, &result)) { + char *json_result; + json_result = bson_as_json(result, NULL); + stream->write_function(stream, ",%s", json_result); + bson_free(json_result); + } + stream->write_function(stream, "]\n"); + } else { + stream->write_function(stream, "-ERR\nquery failed!\n"); + } + if (cursor) { + mongoc_cursor_destroy(cursor); + } + } else { + stream->write_function(stream, "-ERR\nmissing query or fields!\n%s\n", FIND_ONE_SYNTAX); + } + if (query) { + bson_destroy(query); + } + if (fields) { + bson_destroy(fields); + } + mongoc_collection_destroy(col); + } else { + stream->write_function(stream, "-ERR\nunknown collection: %s\n", collection); + } + connection_done(conn); + } else { + stream->write_function(stream, "-ERR\nfailed to get connection!\n"); + } + } else { + stream->write_function(stream, "-ERR\n%s\n", FIND_N_SYNTAX); + } + + switch_safe_free(db); + + return status; +} + SWITCH_STANDARD_API(mongo_find_one_function) { switch_status_t status = SWITCH_STATUS_SUCCESS; @@ -218,21 +315,21 @@ SWITCH_STANDARD_API(mongo_find_one_function) bson_t *query = bson_new_from_json((uint8_t *)json_query, strlen(json_query), &error); bson_t *fields = bson_new_from_json((uint8_t *)json_fields, strlen(json_fields), &error); if (query && fields) { - int ok = 0; /* send query */ mongoc_cursor_t *cursor = mongoc_collection_find(col, query_options, 0, 1, 0, query, fields, NULL); - if (cursor && mongoc_cursor_more(cursor) && !mongoc_cursor_error(cursor, &error)) { + if (cursor && !mongoc_cursor_error(cursor, &error)) { /* get result from cursor */ const bson_t *result; - if (mongoc_cursor_next(cursor, &result)) { + if (mongoc_cursor_more(cursor) && mongoc_cursor_next(cursor, &result)) { char *json_result; json_result = bson_as_json(result, NULL); stream->write_function(stream, "-OK\n%s\n", json_result); bson_free(json_result); - ok = 1; + } else { + /* empty set */ + stream->write_function(stream, "-OK\n{}\n"); } - } - if (!ok) { + } else { stream->write_function(stream, "-ERR\nquery failed!\n"); } if (cursor) { @@ -256,7 +353,7 @@ SWITCH_STANDARD_API(mongo_find_one_function) stream->write_function(stream, "-ERR\nfailed to get connection!\n"); } } else { - stream->write_function(stream, "-ERR\n%s\n", FIND_ONE_SYNTAX); + stream->write_function(stream, "-ERR\n%s\n", FIND_ONE_SYNTAX); } switch_safe_free(db); @@ -349,6 +446,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_mongo_load) } SWITCH_ADD_API(api_interface, "mongo_find_one", "findOne", mongo_find_one_function, FIND_ONE_SYNTAX); + SWITCH_ADD_API(api_interface, "mongo_find_n", "find", mongo_find_n_function, FIND_N_SYNTAX); SWITCH_ADD_API(api_interface, "mongo_mapreduce", "Map/Reduce", mongo_mapreduce_function, MAPREDUCE_SYNTAX); return SWITCH_STATUS_SUCCESS; From 5afdffb6614af505324904bcce3db42671aedbe5 Mon Sep 17 00:00:00 2001 From: Mike Jerris Date: Wed, 11 Feb 2015 10:58:51 -0600 Subject: [PATCH 33/91] FS-7262: #resolve #comment fix regression in native recording using record thread from FS-7083 326289c --- src/switch_ivr_async.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index 60de27c73e..0b58c11433 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -1183,7 +1183,7 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s { const char *var = switch_channel_get_variable(channel, "RECORD_USE_THREAD"); - if (zstr(var) || switch_true(var)) { + if (!rh->native && rh->fh && (zstr(var) || switch_true(var))) { switch_threadattr_t *thd_attr = NULL; switch_memory_pool_t *pool = switch_core_session_get_pool(session); int sanity = 200; From cceeecb04cc2e4fab0e81eb0bba1a0d263982ae8 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Wed, 11 Feb 2015 12:14:53 -0500 Subject: [PATCH 34/91] FS-7264: silence inet_ntop deprecated warnings --- libs/win32/sofia/libsofia_sip_ua_static.2012.vcxproj | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libs/win32/sofia/libsofia_sip_ua_static.2012.vcxproj b/libs/win32/sofia/libsofia_sip_ua_static.2012.vcxproj index bd8a68bd2c..5a9eea4f8c 100644 --- a/libs/win32/sofia/libsofia_sip_ua_static.2012.vcxproj +++ b/libs/win32/sofia/libsofia_sip_ua_static.2012.vcxproj @@ -87,7 +87,7 @@ if not exist "$(ProjectDir)$(IntDir)\auth_client.obj" "autogen.cmd" Disabled ..\..\sofia-sip\win32;..\..\sofia-sip\libsofia-sip-ua\su;..\..\sofia-sip\libsofia-sip-ua\ipt;..\..\sofia-sip\libsofia-sip-ua\sresolv;..\..\sofia-sip\libsofia-sip-ua\bnf;..\..\sofia-sip\libsofia-sip-ua\url;..\..\sofia-sip\libsofia-sip-ua\msg;..\..\sofia-sip\libsofia-sip-ua\sip;..\..\sofia-sip\libsofia-sip-ua\nta;..\..\sofia-sip\libsofia-sip-ua\nua;..\..\sofia-sip\libsofia-sip-ua\iptsec;..\..\sofia-sip\libsofia-sip-ua\http;..\..\sofia-sip\libsofia-sip-ua\nth;..\..\sofia-sip\libsofia-sip-ua\nea;..\..\sofia-sip\libsofia-sip-ua\sdp;..\..\sofia-sip\libsofia-sip-ua\soa;..\..\sofia-sip\libsofia-sip-ua\stun;..\..\sofia-sip\libsofia-sip-ua\tport;..\..\sofia-sip\libsofia-sip-ua\features;..\..\pthreads-w32-2-9-1;.;..\..\openssl-$(OpenSSLVersion)\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_LIB;IN_LIBSOFIA_SIP_UA_STATIC;LIBSOFIA_SIP_UA_STATIC;LIBSRES_STATIC;PTW32_STATIC_LIB;HAVE_IPHLPAPI_H;SU_DEBUG=0;%(PreprocessorDefinitions) + WIN32;_DEBUG;_LIB;IN_LIBSOFIA_SIP_UA_STATIC;LIBSOFIA_SIP_UA_STATIC;LIBSRES_STATIC;PTW32_STATIC_LIB;HAVE_IPHLPAPI_H;SU_DEBUG=0;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebugDLL @@ -124,7 +124,7 @@ if not exist "$(ProjectDir)$(IntDir)\auth_client.obj" "autogen.cmd" Disabled ..\..\sofia-sip\win32;..\..\sofia-sip\libsofia-sip-ua\su;..\..\sofia-sip\libsofia-sip-ua\ipt;..\..\sofia-sip\libsofia-sip-ua\sresolv;..\..\sofia-sip\libsofia-sip-ua\bnf;..\..\sofia-sip\libsofia-sip-ua\url;..\..\sofia-sip\libsofia-sip-ua\msg;..\..\sofia-sip\libsofia-sip-ua\sip;..\..\sofia-sip\libsofia-sip-ua\nta;..\..\sofia-sip\libsofia-sip-ua\nua;..\..\sofia-sip\libsofia-sip-ua\iptsec;..\..\sofia-sip\libsofia-sip-ua\http;..\..\sofia-sip\libsofia-sip-ua\nth;..\..\sofia-sip\libsofia-sip-ua\nea;..\..\sofia-sip\libsofia-sip-ua\sdp;..\..\sofia-sip\libsofia-sip-ua\soa;..\..\sofia-sip\libsofia-sip-ua\stun;..\..\sofia-sip\libsofia-sip-ua\tport;..\..\sofia-sip\libsofia-sip-ua\features;..\..\pthreads-w32-2-9-1;.;..\..\openssl-$(OpenSSLVersion)\include;%(AdditionalIncludeDirectories) - _WIN64;WIN32;_DEBUG;_LIB;IN_LIBSOFIA_SIP_UA_STATIC;LIBSOFIA_SIP_UA_STATIC;LIBSRES_STATIC;PTW32_STATIC_LIB;HAVE_IPHLPAPI_H;SU_DEBUG=0;%(PreprocessorDefinitions) + _WIN64;WIN32;_DEBUG;_LIB;IN_LIBSOFIA_SIP_UA_STATIC;LIBSOFIA_SIP_UA_STATIC;LIBSRES_STATIC;PTW32_STATIC_LIB;HAVE_IPHLPAPI_H;SU_DEBUG=0;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebugDLL @@ -159,7 +159,7 @@ if not exist "$(ProjectDir)$(IntDir)\auth_client.obj" "autogen.cmd" MaxSpeed OnlyExplicitInline ..\..\sofia-sip\win32;..\..\sofia-sip\libsofia-sip-ua\su;..\..\sofia-sip\libsofia-sip-ua\ipt;..\..\sofia-sip\libsofia-sip-ua\sresolv;..\..\sofia-sip\libsofia-sip-ua\bnf;..\..\sofia-sip\libsofia-sip-ua\url;..\..\sofia-sip\libsofia-sip-ua\msg;..\..\sofia-sip\libsofia-sip-ua\sip;..\..\sofia-sip\libsofia-sip-ua\nta;..\..\sofia-sip\libsofia-sip-ua\nua;..\..\sofia-sip\libsofia-sip-ua\iptsec;..\..\sofia-sip\libsofia-sip-ua\http;..\..\sofia-sip\libsofia-sip-ua\nth;..\..\sofia-sip\libsofia-sip-ua\nea;..\..\sofia-sip\libsofia-sip-ua\sdp;..\..\sofia-sip\libsofia-sip-ua\soa;..\..\sofia-sip\libsofia-sip-ua\stun;..\..\sofia-sip\libsofia-sip-ua\tport;..\..\sofia-sip\libsofia-sip-ua\features;..\..\pthreads-w32-2-9-1;.;..\..\openssl-$(OpenSSLVersion)\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_LIB;IN_LIBSOFIA_SIP_UA_STATIC;LIBSOFIA_SIP_UA_STATIC;LIBSRES_STATIC;PTW32_STATIC_LIB;HAVE_IPHLPAPI_H;SU_DEBUG=0;%(PreprocessorDefinitions) + WIN32;NDEBUG;_LIB;IN_LIBSOFIA_SIP_UA_STATIC;LIBSOFIA_SIP_UA_STATIC;LIBSRES_STATIC;PTW32_STATIC_LIB;HAVE_IPHLPAPI_H;SU_DEBUG=0;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions) true MultiThreadedDLL true @@ -197,7 +197,7 @@ if not exist "$(ProjectDir)$(IntDir)\auth_client.obj" "autogen.cmd" MaxSpeed OnlyExplicitInline ..\..\sofia-sip\win32;..\..\sofia-sip\libsofia-sip-ua\su;..\..\sofia-sip\libsofia-sip-ua\ipt;..\..\sofia-sip\libsofia-sip-ua\sresolv;..\..\sofia-sip\libsofia-sip-ua\bnf;..\..\sofia-sip\libsofia-sip-ua\url;..\..\sofia-sip\libsofia-sip-ua\msg;..\..\sofia-sip\libsofia-sip-ua\sip;..\..\sofia-sip\libsofia-sip-ua\nta;..\..\sofia-sip\libsofia-sip-ua\nua;..\..\sofia-sip\libsofia-sip-ua\iptsec;..\..\sofia-sip\libsofia-sip-ua\http;..\..\sofia-sip\libsofia-sip-ua\nth;..\..\sofia-sip\libsofia-sip-ua\nea;..\..\sofia-sip\libsofia-sip-ua\sdp;..\..\sofia-sip\libsofia-sip-ua\soa;..\..\sofia-sip\libsofia-sip-ua\stun;..\..\sofia-sip\libsofia-sip-ua\tport;..\..\sofia-sip\libsofia-sip-ua\features;..\..\pthreads-w32-2-9-1;.;..\..\openssl-$(OpenSSLVersion)\include;%(AdditionalIncludeDirectories) - _WIN64;WIN32;NDEBUG;_LIB;IN_LIBSOFIA_SIP_UA_STATIC;LIBSOFIA_SIP_UA_STATIC;LIBSRES_STATIC;PTW32_STATIC_LIB;HAVE_IPHLPAPI_H;SU_DEBUG=0;%(PreprocessorDefinitions) + _WIN64;WIN32;NDEBUG;_LIB;IN_LIBSOFIA_SIP_UA_STATIC;LIBSOFIA_SIP_UA_STATIC;LIBSRES_STATIC;PTW32_STATIC_LIB;HAVE_IPHLPAPI_H;SU_DEBUG=0;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions) true MultiThreadedDLL true From d17edb59dc1a55641fc0042c7339fb6fcae27b18 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Wed, 11 Feb 2015 12:39:56 -0500 Subject: [PATCH 35/91] FS-7264: fix signed/unsigned warnings on windows building ws.c --- libs/sofia-sip/.update | 2 +- libs/sofia-sip/libsofia-sip-ua/tport/ws.c | 4 ++-- src/mod/endpoints/mod_verto/ws.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libs/sofia-sip/.update b/libs/sofia-sip/.update index 3d6072b228..f5b42d453c 100644 --- a/libs/sofia-sip/.update +++ b/libs/sofia-sip/.update @@ -1 +1 @@ -Wed Jan 7 11:24:56 PST 2015 +Wed Feb 11 12:35:25 EST 2015 diff --git a/libs/sofia-sip/libsofia-sip-ua/tport/ws.c b/libs/sofia-sip/libsofia-sip-ua/tport/ws.c index e990f7f815..8a46b65502 100644 --- a/libs/sofia-sip/libsofia-sip-ua/tport/ws.c +++ b/libs/sofia-sip/libsofia-sip-ua/tport/ws.c @@ -311,7 +311,7 @@ int ws_handshake(wsh_t *wsh) proto_buf); respond[511] = 0; - if (ws_raw_write(wsh, respond, strlen(respond)) != strlen(respond)) { + if (ws_raw_write(wsh, respond, strlen(respond)) != (ssize_t)strlen(respond)) { goto err; } @@ -406,7 +406,7 @@ ssize_t ws_raw_write(wsh_t *wsh, void *data, size_t bytes) ssize_t r; int sanity = 2000; int ssl_err = 0; - ssize_t wrote = 0; + size_t wrote = 0; if (wsh->ssl) { do { diff --git a/src/mod/endpoints/mod_verto/ws.c b/src/mod/endpoints/mod_verto/ws.c index e990f7f815..8a46b65502 100644 --- a/src/mod/endpoints/mod_verto/ws.c +++ b/src/mod/endpoints/mod_verto/ws.c @@ -311,7 +311,7 @@ int ws_handshake(wsh_t *wsh) proto_buf); respond[511] = 0; - if (ws_raw_write(wsh, respond, strlen(respond)) != strlen(respond)) { + if (ws_raw_write(wsh, respond, strlen(respond)) != (ssize_t)strlen(respond)) { goto err; } @@ -406,7 +406,7 @@ ssize_t ws_raw_write(wsh_t *wsh, void *data, size_t bytes) ssize_t r; int sanity = 2000; int ssl_err = 0; - ssize_t wrote = 0; + size_t wrote = 0; if (wsh->ssl) { do { From 202fe38661a925e6ce61caff2f129239be9371f2 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Wed, 11 Feb 2015 12:40:49 -0500 Subject: [PATCH 36/91] fix email address to match what i usually commit with --- support-d/.bashrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/support-d/.bashrc b/support-d/.bashrc index 05b3b38149..2aab0224c9 100644 --- a/support-d/.bashrc +++ b/support-d/.bashrc @@ -58,7 +58,7 @@ alias emcas='emacs' alias meacs='emacs' alias mecas='emacs' alias bgit='git commit --author "Brian West "' -alias mgit='git commit --author "Mike Jerris "' +alias mgit='git commit --author "Mike Jerris "' alias tgit='git commit --author "Anthony Minessale "' alias dp='emacs /usr/local/freeswitch/conf/dialplan/default.xml' alias go='/usr/local/freeswitch/bin/freeswitch -nonat' From 299b313b786a4a3e999a5503e7b303991c9c3cd6 Mon Sep 17 00:00:00 2001 From: Vineet Chaudhary Date: Thu, 12 Feb 2015 18:41:12 +0530 Subject: [PATCH 37/91] FS-7269 : Add error logs in exec_user_method() when exception occurs. In exec_user_method() report ERROR LOG to console in cases exceptions occurs, like if any of class/method/userMethod->arg is null or for any reason which sets status to SWITCH_STATUS_FALSE because that prevents loading mod_java and users don't have clue why it is failing to load. With this patch error logs can tell why method failed to execute. --- src/mod/languages/mod_java/modjava.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/mod/languages/mod_java/modjava.c b/src/mod/languages/mod_java/modjava.c index 17b72d5826..811237d5fd 100644 --- a/src/mod/languages/mod_java/modjava.c +++ b/src/mod/languages/mod_java/modjava.c @@ -128,6 +128,7 @@ static switch_status_t exec_user_method(user_method_t * userMethod) { if (class == NULL) { (*env)->ExceptionDescribe(env); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s Class not found\n",userMethod->class); status = SWITCH_STATUS_FALSE; goto done; } @@ -136,6 +137,7 @@ static switch_status_t exec_user_method(user_method_t * userMethod) { if (method == NULL) { (*env)->ExceptionDescribe(env); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s Method not found\n",userMethod->method); status = SWITCH_STATUS_FALSE; goto done; } @@ -145,6 +147,7 @@ static switch_status_t exec_user_method(user_method_t * userMethod) { if (arg == NULL) { (*env)->ExceptionDescribe(env); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Args not found\n"); status = SWITCH_STATUS_FALSE; goto done; } From 5904bec1b62f13a1e837dace5da1be95cc9a9578 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 12 Feb 2015 10:44:42 -0600 Subject: [PATCH 38/91] FS-7236 refactor to fix audio problem from 7c6367052cc35c457cf6bcee49e473e744422d29 --- .../mod_conference/mod_conference.c | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index f296844a2c..1340d3bc6d 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -9578,16 +9578,7 @@ SWITCH_STANDARD_APP(conference_function) member.channel = switch_core_session_get_channel(session); member.pool = switch_core_session_get_pool(session); - if (!(mid = switch_channel_get_private(channel, "__confmid"))) { - mid = switch_core_session_alloc(session, sizeof(*mid)); - *mid = next_member_id(); - switch_channel_set_private(channel, "__confmid", mid); - } - - switch_channel_set_variable_printf(channel, "conference_member_id", "%u", *mid); - /* Prepare MUTEXS */ - member.id = *mid; switch_mutex_init(&member.flag_mutex, SWITCH_MUTEX_NESTED, member.pool); switch_mutex_init(&member.write_mutex, SWITCH_MUTEX_NESTED, member.pool); switch_mutex_init(&member.read_mutex, SWITCH_MUTEX_NESTED, member.pool); @@ -9596,14 +9587,26 @@ SWITCH_STANDARD_APP(conference_function) switch_mutex_init(&member.audio_out_mutex, SWITCH_MUTEX_NESTED, member.pool); switch_thread_rwlock_create(&member.rwlock, member.pool); - /* Install our Signed Linear codec so we get the audio in that format */ - switch_core_session_set_read_codec(member.session, &member.read_codec); - if (setup_media(&member, conference)) { //flags = 0; goto done; } + + if (!(mid = switch_channel_get_private(channel, "__confmid"))) { + mid = switch_core_session_alloc(session, sizeof(*mid)); + *mid = next_member_id(); + switch_channel_set_private(channel, "__confmid", mid); + } + + switch_channel_set_variable_printf(channel, "conference_member_id", "%u", *mid); + member.id = *mid; + + + /* Install our Signed Linear codec so we get the audio in that format */ + switch_core_session_set_read_codec(member.session, &member.read_codec); + + mflags = conference->mflags; set_mflags(flags_str, &mflags); mflags |= MFLAG_RUNNING; From 414017ae261e05b03e66fbf008aa5abaece52ad6 Mon Sep 17 00:00:00 2001 From: Brian West Date: Thu, 12 Feb 2015 12:32:43 -0600 Subject: [PATCH 39/91] FS-7270 remove libtool-bin since this is specific to Jesse, update libjpeg-dev to libjpeg8-dev sigh why change the name of the package --- build/Makefile.centos6 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/Makefile.centos6 b/build/Makefile.centos6 index f2b9ecab1c..48ac589815 100644 --- a/build/Makefile.centos6 +++ b/build/Makefile.centos6 @@ -7,7 +7,7 @@ # # RPMS=git gcc-c++ autoconf automake libtool wget python ncurses-devel zlib-devel libjpeg-devel openssl-devel e2fsprogs-devel sqlite-devel libcurl-devel pcre-devel speex-devel ldns-devel libedit-devel -DEBS=git build-essential automake autoconf libtool wget python uuid-dev zlib1g-dev libjpeg-dev libncurses5-dev libssl-dev libpcre3-dev libcurl4-openssl-dev libldns-dev libedit-dev libspeexdsp-dev libspeexdsp-dev libsqlite3-dev perl libgdbm-dev libdb-dev bison libvlc-dev libtool-bin pkg-config +DEBS=git build-essential automake autoconf libtool wget python uuid-dev zlib1g-dev libjpeg8-dev libncurses5-dev libssl-dev libpcre3-dev libcurl4-openssl-dev libldns-dev libedit-dev libspeexdsp-dev libspeexdsp-dev libsqlite3-dev perl libgdbm-dev libdb-dev bison libvlc-dev pkg-config freeswitch: deps has-git freeswitch.git/Makefile cd freeswitch.git && make From c4e1201d7e1a32dd958a8a768f9296232dc8c93a Mon Sep 17 00:00:00 2001 From: Brian West Date: Thu, 12 Feb 2015 12:39:49 -0600 Subject: [PATCH 40/91] FS-7270 #resolve libtool or libtool-bin will do --- build/Makefile.centos6 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/Makefile.centos6 b/build/Makefile.centos6 index 48ac589815..aae1cfb8e6 100644 --- a/build/Makefile.centos6 +++ b/build/Makefile.centos6 @@ -7,7 +7,7 @@ # # RPMS=git gcc-c++ autoconf automake libtool wget python ncurses-devel zlib-devel libjpeg-devel openssl-devel e2fsprogs-devel sqlite-devel libcurl-devel pcre-devel speex-devel ldns-devel libedit-devel -DEBS=git build-essential automake autoconf libtool wget python uuid-dev zlib1g-dev libjpeg8-dev libncurses5-dev libssl-dev libpcre3-dev libcurl4-openssl-dev libldns-dev libedit-dev libspeexdsp-dev libspeexdsp-dev libsqlite3-dev perl libgdbm-dev libdb-dev bison libvlc-dev pkg-config +DEBS=git build-essential automake autoconf 'libtool|libtool-bin' wget python uuid-dev zlib1g-dev libjpeg8-dev libncurses5-dev libssl-dev libpcre3-dev libcurl4-openssl-dev libldns-dev libedit-dev libspeexdsp-dev libspeexdsp-dev libsqlite3-dev perl libgdbm-dev libdb-dev bison libvlc-dev pkg-config freeswitch: deps has-git freeswitch.git/Makefile cd freeswitch.git && make From 9e8a94a149b35ffd98af4c307a11cc963452fe4b Mon Sep 17 00:00:00 2001 From: Brian West Date: Thu, 12 Feb 2015 12:56:26 -0600 Subject: [PATCH 41/91] FS-7270 tweak for jesse --- build/Makefile.centos6 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/Makefile.centos6 b/build/Makefile.centos6 index aae1cfb8e6..20da5f34b2 100644 --- a/build/Makefile.centos6 +++ b/build/Makefile.centos6 @@ -7,7 +7,7 @@ # # RPMS=git gcc-c++ autoconf automake libtool wget python ncurses-devel zlib-devel libjpeg-devel openssl-devel e2fsprogs-devel sqlite-devel libcurl-devel pcre-devel speex-devel ldns-devel libedit-devel -DEBS=git build-essential automake autoconf 'libtool|libtool-bin' wget python uuid-dev zlib1g-dev libjpeg8-dev libncurses5-dev libssl-dev libpcre3-dev libcurl4-openssl-dev libldns-dev libedit-dev libspeexdsp-dev libspeexdsp-dev libsqlite3-dev perl libgdbm-dev libdb-dev bison libvlc-dev pkg-config +DEBS=git build-essential automake autoconf 'libtool|libtool-bin' wget python uuid-dev zlib1g-dev 'libjpeg8-dev|libjpeg62-turbo-dev' libncurses5-dev libssl-dev libpcre3-dev libcurl4-openssl-dev libldns-dev libedit-dev libspeexdsp-dev libspeexdsp-dev libsqlite3-dev perl libgdbm-dev libdb-dev bison libvlc-dev pkg-config freeswitch: deps has-git freeswitch.git/Makefile cd freeswitch.git && make From d7ebf121c6d45cf311c0778f453831c8353613e9 Mon Sep 17 00:00:00 2001 From: Brian West Date: Thu, 12 Feb 2015 13:10:02 -0600 Subject: [PATCH 42/91] FS-7270 look for -bin first --- build/Makefile.centos6 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/Makefile.centos6 b/build/Makefile.centos6 index 20da5f34b2..582c3192da 100644 --- a/build/Makefile.centos6 +++ b/build/Makefile.centos6 @@ -7,7 +7,7 @@ # # RPMS=git gcc-c++ autoconf automake libtool wget python ncurses-devel zlib-devel libjpeg-devel openssl-devel e2fsprogs-devel sqlite-devel libcurl-devel pcre-devel speex-devel ldns-devel libedit-devel -DEBS=git build-essential automake autoconf 'libtool|libtool-bin' wget python uuid-dev zlib1g-dev 'libjpeg8-dev|libjpeg62-turbo-dev' libncurses5-dev libssl-dev libpcre3-dev libcurl4-openssl-dev libldns-dev libedit-dev libspeexdsp-dev libspeexdsp-dev libsqlite3-dev perl libgdbm-dev libdb-dev bison libvlc-dev pkg-config +DEBS=git build-essential automake autoconf 'libtool-bin|libtool' wget python uuid-dev zlib1g-dev 'libjpeg8-dev|libjpeg62-turbo-dev' libncurses5-dev libssl-dev libpcre3-dev libcurl4-openssl-dev libldns-dev libedit-dev libspeexdsp-dev libspeexdsp-dev libsqlite3-dev perl libgdbm-dev libdb-dev bison libvlc-dev pkg-config freeswitch: deps has-git freeswitch.git/Makefile cd freeswitch.git && make From 69a7b5fd1175fe80576fda42923118c7a057468f Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 13 Feb 2015 14:09:44 -0600 Subject: [PATCH 43/91] FS-7066 FS-7253 FS-7231 #comment revert some of patch --- src/switch_time.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/switch_time.c b/src/switch_time.c index c226b90592..009853b70b 100644 --- a/src/switch_time.c +++ b/src/switch_time.c @@ -413,10 +413,10 @@ static switch_status_t timerfd_start_interval(interval_timer_t *it, int interval return SWITCH_STATUS_GENERR; } - val.it_interval.tv_sec = 0; - val.it_interval.tv_nsec = interval * 1000000; + val.it_interval.tv_sec = interval / 1000; + val.it_interval.tv_nsec = (interval % 1000) * 1000000; val.it_value.tv_sec = 0; - val.it_value.tv_nsec = val.it_interval.tv_nsec; + val.it_value.tv_nsec = 100000; if (timerfd_settime(fd, TFD_TIMER_ABSTIME, &val, NULL) < 0) { close(fd); From ded03004a21a317783b06c6141430007641af7c6 Mon Sep 17 00:00:00 2001 From: Dave Olszewski Date: Mon, 9 Feb 2015 17:49:21 -0800 Subject: [PATCH 44/91] FS-7284 allow -base to satisfy "You must specify all or none of -conf, -log, and -db" --- src/switch.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/switch.c b/src/switch.c index 2433535152..f3998501f1 100644 --- a/src/switch.c +++ b/src/switch.c @@ -519,7 +519,7 @@ int main(int argc, char *argv[]) char *local_argv[1024] = { 0 }; int local_argc = argc; char *arg_argv[128] = { 0 }; - int alt_dirs = 0, log_set = 0, run_set = 0, do_kill = 0; + int alt_dirs = 0, alt_base = 0, log_set = 0, run_set = 0, do_kill = 0; int priority = 0; #ifdef __sun switch_core_flag_t flags = SCF_USE_SQL; @@ -898,6 +898,7 @@ int main(int argc, char *argv[]) return 255; } strcpy(SWITCH_GLOBAL_dirs.base_dir, local_argv[x]); + alt_base = 1; } else if (!strcmp(local_argv[x], "-temp")) { @@ -1046,7 +1047,7 @@ int main(int argc, char *argv[]) return 255; } - if (alt_dirs && alt_dirs != 3) { + if (alt_dirs && alt_dirs != 3 && !alt_base) { fprintf(stderr, "You must specify all or none of -conf, -log, and -db\n"); return 255; } From 2890afc9184b142c931a98fff267d408e807b862 Mon Sep 17 00:00:00 2001 From: Dave Olszewski Date: Mon, 9 Feb 2015 18:03:56 -0800 Subject: [PATCH 45/91] FS-7285 allow eavesdrop to bridge only one leg Add channel variables eavesdrop_bridge_aleg and eavesdrop_bridge_bleg, and if one is set to true on the eavesdrop channel, bridge that leg from the target. If neither is specified, bridge both. --- src/include/switch_types.h | 4 +++- src/mod/applications/mod_dptools/mod_dptools.c | 10 ++++++++++ src/switch_ivr_async.c | 16 ++++++++++++++-- 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 6cd4836846..e0d11ca934 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -331,7 +331,9 @@ typedef enum { ED_MUX_READ = (1 << 0), ED_MUX_WRITE = (1 << 1), ED_DTMF = (1 << 2), - ED_COPY_DISPLAY = (1 << 3) + ED_COPY_DISPLAY = (1 << 3), + ED_BRIDGE_READ = (1 << 4), + ED_BRIDGE_WRITE = (1 << 5) } switch_eavesdrop_flag_enum_t; typedef uint32_t switch_eavesdrop_flag_t; diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index fc515a50e0..d7eb90b417 100644 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -818,11 +818,21 @@ SWITCH_STANDARD_APP(eavesdrop_function) switch_channel_t *channel = switch_core_session_get_channel(session); const char *require_group = switch_channel_get_variable(channel, "eavesdrop_require_group"); const char *enable_dtmf = switch_channel_get_variable(channel, "eavesdrop_enable_dtmf"); + const char *bridge_aleg = switch_channel_get_variable(channel, "eavesdrop_bridge_aleg"); + const char *bridge_bleg = switch_channel_get_variable(channel, "eavesdrop_bridge_bleg"); if (enable_dtmf) { flags = switch_true(enable_dtmf) ? ED_DTMF : ED_NONE; } + /* Defaults to both, if neither is set */ + if (switch_true(bridge_aleg)) { + flags |= ED_BRIDGE_READ; + } + if (switch_true(bridge_bleg)) { + flags |= ED_BRIDGE_WRITE; + } + if (!strcasecmp((char *) data, "all")) { switch_cache_db_handle_t *db = NULL; char *errmsg = NULL; diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index 0b58c11433..2755d90a4b 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -1758,6 +1758,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_session(switch_core_session char cid_buf[1024] = ""; switch_caller_profile_t *cp = NULL; uint32_t sanity = 600; + switch_media_bug_flag_t read_flags = 0, write_flags = 0; if (!switch_channel_media_up(channel)) { goto end; @@ -1847,6 +1848,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_session(switch_core_session write_frame.buflen = sizeof(buf); write_frame.rate = codec.implementation->actual_samples_per_second; + /* Make sure that at least one leg is bridged, default to both */ + if (! (flags & (ED_BRIDGE_READ | ED_BRIDGE_WRITE))) { + flags |= ED_BRIDGE_READ | ED_BRIDGE_WRITE; + } + ep->eavesdropper = session; ep->flags = flags; switch_mutex_init(&ep->mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(tsession)); @@ -1862,10 +1868,16 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_session(switch_core_session switch_buffer_add_mutex(ep->r_buffer, ep->r_mutex); + if (flags & ED_BRIDGE_READ) { + read_flags = SMBF_READ_STREAM | SMBF_READ_REPLACE; + } + if (flags & ED_BRIDGE_WRITE) { + write_flags = SMBF_WRITE_STREAM | SMBF_WRITE_REPLACE; + } + if (switch_core_media_bug_add(tsession, "eavesdrop", uuid, eavesdrop_callback, ep, 0, - SMBF_READ_STREAM | SMBF_WRITE_STREAM | SMBF_READ_REPLACE | SMBF_WRITE_REPLACE | - SMBF_READ_PING | SMBF_THREAD_LOCK | SMBF_NO_PAUSE, + read_flags | write_flags | SMBF_READ_PING | SMBF_THREAD_LOCK | SMBF_NO_PAUSE, &bug) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot attach bug\n"); goto end; From 95e59e651a5138ed2f294e54e74d8f5df4709ac5 Mon Sep 17 00:00:00 2001 From: Brian West Date: Mon, 16 Feb 2015 09:17:20 -0600 Subject: [PATCH 46/91] Tweak Cent5 auto build --- build/Makefile.centos5 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build/Makefile.centos5 b/build/Makefile.centos5 index 79a2485986..cddd8f29ee 100644 --- a/build/Makefile.centos5 +++ b/build/Makefile.centos5 @@ -11,10 +11,10 @@ FSPREFIX=/usr/local/freeswitch PREFIX=/usr/local/freeswitch DOWNLOAD=http://files.freeswitch.org/downloads/libs JPEG=v8d -OPENSSL=1.0.1j +OPENSSL=1.0.1l SQLITE=autoconf-3080403 PCRE=8.35 -CURL=7.35.0 +CURL=7.40.0 SPEEX=1.2rc1 LIBEDIT=20140618-3.1 LDNS=1.6.17 @@ -76,7 +76,7 @@ curl: curl-$(CURL)/.done curl-$(CURL)/.done: curl-$(CURL) curl-$(CURL): (test -d $@) || (wget -4 -O $@.tar.gz $(DOWNLOAD)/$@.tar.gz && tar zxfv $@.tar.gz) - (cd $@ && ./configure --prefix=$(PREFIX) && make && sudo make install && touch .done) + (cd $@ && ./configure LDFLAGS='-L$(PREFIX)/lib -Wl,-rpath=$(PREFIX)/lib' CFLAGS='-I$(PREFIX)/include' --prefix=$(PREFIX) && make && sudo make install && touch .done) speex: speex-$(SPEEX)/.done speex-$(SPEEX)/.done: speex-$(SPEEX) From 23b10d5da35b3ffb113063d0b6cffab07ba6c4ce Mon Sep 17 00:00:00 2001 From: Antonio Eugenio Burriel Date: Mon, 16 Feb 2015 17:45:44 +0100 Subject: [PATCH 47/91] Get ordering of dates in Spanish right (dd-mm-yyyy) 1. Switch from mm-dd-yyyy to dd-mm-yyyy 2. Insert "de" (Spanish for "of") preposition. 3. Document this new voice recording "of.wav". As reported in FS-7279. --- docs/phrase/phrase_es.xml | 1 + docs/phrase/phrase_es_ES.xml | 1 + docs/phrase/phrase_es_MX.xml | 1 + src/mod/say/mod_say_es/mod_say_es.c | 4 +++- 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/phrase/phrase_es.xml b/docs/phrase/phrase_es.xml index 518d7fce64..dd62e6fef3 100644 --- a/docs/phrase/phrase_es.xml +++ b/docs/phrase/phrase_es.xml @@ -222,6 +222,7 @@ I will translate them anyways + diff --git a/docs/phrase/phrase_es_ES.xml b/docs/phrase/phrase_es_ES.xml index 9a7521a065..a3f937f33c 100644 --- a/docs/phrase/phrase_es_ES.xml +++ b/docs/phrase/phrase_es_ES.xml @@ -171,6 +171,7 @@ + diff --git a/docs/phrase/phrase_es_MX.xml b/docs/phrase/phrase_es_MX.xml index edabd9f45c..182511d808 100644 --- a/docs/phrase/phrase_es_MX.xml +++ b/docs/phrase/phrase_es_MX.xml @@ -170,6 +170,7 @@ + diff --git a/src/mod/say/mod_say_es/mod_say_es.c b/src/mod/say/mod_say_es/mod_say_es.c index 8de56e861e..f648a72956 100644 --- a/src/mod/say/mod_say_es/mod_say_es.c +++ b/src/mod/say/mod_say_es/mod_say_es.c @@ -335,8 +335,10 @@ static switch_status_t es_say_time(switch_core_session_t *session, char *tosay, if (say_date) { say_file("time/day-%d.wav", tm.tm_wday); - say_file("time/mon-%d.wav", tm.tm_mon); say_num(tm.tm_mday, SSM_PRONOUNCED); + say_file("time/of.wav"); + say_file("time/mon-%d.wav", tm.tm_mon); + say_file("time/of.wav"); say_num(tm.tm_year + 1900, SSM_PRONOUNCED); } From 7cf5a846348020a2f6fcc7614ef10c2296d8ec9d Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 16 Feb 2015 16:06:43 -0600 Subject: [PATCH 48/91] FS-7122 reversion --- libs/srtp/test/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/srtp/test/Makefile.am b/libs/srtp/test/Makefile.am index 4af9005ac3..2651f2714f 100644 --- a/libs/srtp/test/Makefile.am +++ b/libs/srtp/test/Makefile.am @@ -1,4 +1,4 @@ -AUTOMAKE_OPTIONS = gnu subdir-objects +AUTOMAKE_OPTIONS = gnu AM_CFLAGS = $(new_AM_CFLAGS) -I$(top_srcdir)/include -I$(top_srcdir)/crypto/include AM_CPPFLAGS = $(AM_CFLAGS) AM_LDFLAGS = $(new_AM_LDFLAGS) -L$(srcdir) -lsrtp From 9f3f348984ca932899ca462407b855cd45aa179a Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 16 Feb 2015 16:13:13 -0600 Subject: [PATCH 49/91] CentOS 5 dosn't support subdir-objects --- libs/libdingaling/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/libdingaling/Makefile.am b/libs/libdingaling/Makefile.am index 5da1715ef4..37bf42cb31 100644 --- a/libs/libdingaling/Makefile.am +++ b/libs/libdingaling/Makefile.am @@ -1,6 +1,6 @@ EXTRA_DIST = SUBDIRS = -AUTOMAKE_OPTIONS = foreign subdir-objects +AUTOMAKE_OPTIONS = foreign NAME=dingaling PREFIX=$(prefix) TOUCH_TARGET=@if test -f "$@" ; then touch "$@" ; fi ; From 0dd71fd9fb6242cdd79b01725dc8081271f42503 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 16 Feb 2015 16:20:14 -0600 Subject: [PATCH 50/91] FS-7122 REVERT --- libs/broadvoice/Makefile.am | 1 - libs/broadvoice/src/Makefile.am | 1 - 2 files changed, 2 deletions(-) diff --git a/libs/broadvoice/Makefile.am b/libs/broadvoice/Makefile.am index a681b8d450..f99395399c 100644 --- a/libs/broadvoice/Makefile.am +++ b/libs/broadvoice/Makefile.am @@ -20,7 +20,6 @@ AM_CFLAGS = $(COMP_VENDOR_CFLAGS) AM_LDFLAGS = $(COMP_VENDOR_LDFLAGS) -AUTOMAKE_OPTIONS = subdir-objects noinst_SCRIPTS = broadvoice.spec diff --git a/libs/broadvoice/src/Makefile.am b/libs/broadvoice/src/Makefile.am index c96590e472..9b197ba891 100644 --- a/libs/broadvoice/src/Makefile.am +++ b/libs/broadvoice/src/Makefile.am @@ -21,7 +21,6 @@ AM_CFLAGS = $(COMP_VENDOR_CFLAGS) AM_LDFLAGS = $(COMP_VENDOR_LDFLAGS) -AUTOMAKE_OPTIONS = subdir-objects MAINTAINERCLEANFILES = Makefile.in EXTRA_DIST = libbroadvoice.dsp \ From efd3744a216cc8d5fdb00fa8c9b321bae6263004 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 16 Feb 2015 16:25:35 -0600 Subject: [PATCH 51/91] FS-7122: Working with william to find a better way --- libs/libcodec2/Makefile.am | 2 +- libs/libcodec2/src/Makefile.am | 2 +- libs/libcodec2/unittest/Makefile.am | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libs/libcodec2/Makefile.am b/libs/libcodec2/Makefile.am index 8c24f42fe4..1aa4a11879 100644 --- a/libs/libcodec2/Makefile.am +++ b/libs/libcodec2/Makefile.am @@ -1,5 +1,5 @@ AM_CFLAGS = -Isrc -fPIC -Wall -O3 -lm -AUTOMAKE_OPTIONS = gnu subdir-objects +AUTOMAKE_OPTIONS = gnu NAME = codec2 AM_CPPFLAGS = $(AM_CFLAGS) diff --git a/libs/libcodec2/src/Makefile.am b/libs/libcodec2/src/Makefile.am index f06c42e0f6..1153b3ccbd 100644 --- a/libs/libcodec2/src/Makefile.am +++ b/libs/libcodec2/src/Makefile.am @@ -1,5 +1,5 @@ AM_CFLAGS = -I../src -fPIC -Wall -O3 -g -AUTOMAKE_OPTIONS = gnu subdir-objects +AUTOMAKE_OPTIONS = gnu NAME = codec2 AM_CPPFLAGS = $(AM_CFLAGS) diff --git a/libs/libcodec2/unittest/Makefile.am b/libs/libcodec2/unittest/Makefile.am index e9a216d48e..a8f12a0c00 100644 --- a/libs/libcodec2/unittest/Makefile.am +++ b/libs/libcodec2/unittest/Makefile.am @@ -1,5 +1,5 @@ AM_CFLAGS = -I../src -I$(abs_srcdir)/../src -fPIC -g -DFLOATING_POINT -DVAR_ARRAYS -O2 -Wall -AUTOMAKE_OPTIONS = gnu subdir-objects +AUTOMAKE_OPTIONS = gnu NAME = libcodec2 AM_CPPFLAGS = $(AM_CFLAGS) From 82f267adc1cd44d078cc27f0d522292fb69bbe0b Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 16 Feb 2015 16:59:55 -0600 Subject: [PATCH 52/91] FS-7122 forgot to add file to last commit --- libs/silk/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/silk/Makefile.am b/libs/silk/Makefile.am index a410e96998..c1d88b3a55 100644 --- a/libs/silk/Makefile.am +++ b/libs/silk/Makefile.am @@ -1,5 +1,5 @@ AM_CFLAGS = -Isrc -I$(abs_srcdir)/src -Iinterface -I$(abs_srcdir)/interface -fPIC -O3 -AUTOMAKE_OPTIONS = gnu subdir-objects +AUTOMAKE_OPTIONS = gnu NAME = libSKP_SILK_SDK AM_CPPFLAGS = $(AM_CFLAGS) From 7437b3112f7d8b07f53707eba11664f035a65a1e Mon Sep 17 00:00:00 2001 From: William King Date: Mon, 16 Feb 2015 16:04:24 -0800 Subject: [PATCH 53/91] Debian rules update to handle a pre-bootstrapped orig file --- debian/rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/rules b/debian/rules index 6bfd911f4d..d85cf4e8f8 100755 --- a/debian/rules +++ b/debian/rules @@ -63,7 +63,7 @@ override_dh_auto_clean: .stamp-bootstrap: @$(call show_vars) - ./bootstrap.sh -j + [ -f ./bootstrap.sh ] && ./bootstrap.sh -j || ./rebootstrap.sh -j touch $@ .stamp-configure: .stamp-bootstrap From eb9379b5f0152f5b312d8e58dc0960f4655efc95 Mon Sep 17 00:00:00 2001 From: Chris Rienzo Date: Tue, 17 Feb 2015 09:52:49 -0500 Subject: [PATCH 54/91] FS-7164 [mod_rayo] support input grammar URL for MRCP only. Mixing URL and embedded grammars in same input request (but in different grammar elements) should work --- src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c | 5 +- .../mod_rayo/rayo_input_component.c | 105 +++++++++++------- 2 files changed, 70 insertions(+), 40 deletions(-) diff --git a/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c b/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c index 7f65bd406a..133618632f 100644 --- a/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c +++ b/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2009-2014, Anthony Minessale II + * Copyright (C) 2009-2015, Anthony Minessale II * * Version: MPL 1.1 * @@ -212,6 +212,7 @@ static int get_next_speech_channel_number(void); #define BUILTIN_ID "builtin:" #define SESSION_ID "session:" #define HTTP_ID "http://" +#define HTTPS_ID "https://" #define FILE_ID "file://" #define INLINE_ID "inline:" static int text_starts_with(const char *text, const char *match); @@ -3207,7 +3208,7 @@ static switch_status_t recog_asr_load_grammar(switch_asr_handle_t *ah, const cha } /* figure out what type of grammar this is */ - if (text_starts_with(grammar, HTTP_ID) || text_starts_with(grammar, FILE_ID) || text_starts_with(grammar, SESSION_ID) + if (text_starts_with(grammar, HTTP_ID) || text_starts_with(grammar, HTTPS_ID) || text_starts_with(grammar, FILE_ID) || text_starts_with(grammar, SESSION_ID) || text_starts_with(grammar, BUILTIN_ID)) { switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) Grammar is URI\n", schannel->name); type = GRAMMAR_TYPE_URI; diff --git a/src/mod/event_handlers/mod_rayo/rayo_input_component.c b/src/mod/event_handlers/mod_rayo/rayo_input_component.c index 0eaabae613..a32cdf8602 100644 --- a/src/mod/event_handlers/mod_rayo/rayo_input_component.c +++ b/src/mod/event_handlers/mod_rayo/rayo_input_component.c @@ -1,6 +1,6 @@ /* * mod_rayo for FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2013-2014, Grasshopper + * Copyright (C) 2013-2015, Grasshopper * * Version: MPL 1.1 * @@ -383,6 +383,8 @@ static int validate_call_input(iks *input, const char **error) { iks *grammar; const char *content_type; + int has_grammar = 0; + int use_mrcp = 0; /* validate input attributes */ if (!VALIDATE_RAYO_INPUT(input)) { @@ -390,26 +392,48 @@ static int validate_call_input(iks *input, const char **error) return 0; } - /* missing grammar */ - grammar = iks_find(input, "grammar"); - if (!grammar) { + use_mrcp = !strncmp("unimrcp", iks_find_attrib(input, "recognizer") ? iks_find_attrib(input, "recognizer") : globals.default_recognizer, 7); + + /* validate grammar elements */ + for (grammar = iks_find(input, "grammar"); grammar; grammar = iks_next_tag(grammar)) { + /* is this a grammar? */ + if (strcmp("grammar", iks_name(grammar))) { + continue; + } + content_type = iks_find_attrib(grammar, "content-type"); + if (zstr(content_type)) { + /* grammar URL */ + if (zstr(iks_find_attrib(grammar, "url"))) { + *error = "url or content-type must be set"; + return 0; + } else if (!use_mrcp) { + *error = "url only supported with unimrcp recognizer"; + return 0; + } + } else { + /* inline grammar / only support srgs */ + if (!zstr(iks_find_attrib(grammar, "url"))) { + *error = "url not allowed with content-type"; + return 0; + } else if (strcmp("application/srgs+xml", content_type)) { + *error = "Unsupported content type"; + return 0; + } + + /* missing inline grammar body */ + if (zstr(iks_find_cdata(input, "grammar"))) { + *error = "Grammar content is missing"; + return 0; + } + } + has_grammar = 1; + } + + if (!has_grammar) { *error = "Missing "; return 0; } - /* only support srgs */ - content_type = iks_find_attrib(grammar, "content-type"); - if (!zstr(content_type) && strcmp("application/srgs+xml", content_type)) { - *error = "Unsupported content type"; - return 0; - } - - /* missing grammar body */ - if (zstr(iks_find_cdata(input, "grammar"))) { - *error = "Grammar content is missing"; - return 0; - } - return 1; } @@ -512,30 +536,35 @@ static char *setup_grammars_unimrcp(struct input_component *component, switch_co continue; } - /* get the srgs contained in this grammar */ - if (!(grammar_cdata = iks_child(grammar_tag)) || iks_type(grammar_cdata) != IKS_CDATA) { - *stanza_error = STANZA_ERROR_BAD_REQUEST; - *error_detail = "Missing grammar"; - switch_safe_free(grammar_uri_list.data); - return NULL; - } + if (!zstr(iks_find_attrib_soft(grammar_tag, "content-type"))) { + /* get the srgs contained in this grammar */ + if (!(grammar_cdata = iks_child(grammar_tag)) || iks_type(grammar_cdata) != IKS_CDATA) { + *stanza_error = STANZA_ERROR_BAD_REQUEST; + *error_detail = "Missing grammar"; + switch_safe_free(grammar_uri_list.data); + return NULL; + } - /* load the grammar */ - grammar = switch_core_sprintf(RAYO_POOL(component), "inline:%s", iks_cdata(grammar_cdata)); - grammar_name = switch_core_sprintf(RAYO_POOL(component), "grammar-%d", rayo_actor_seq_next(RAYO_ACTOR(component))); - /* unlock handler mutex, otherwise deadlock will happen if switch_ivr_detect_speech_load_grammar removes the media bug */ - switch_mutex_unlock(component->handler->mutex); - if (switch_ivr_detect_speech_load_grammar(session, grammar, grammar_name) != SWITCH_STATUS_SUCCESS) { + /* load the grammar */ + grammar = switch_core_sprintf(RAYO_POOL(component), "inline:%s", iks_cdata(grammar_cdata)); + grammar_name = switch_core_sprintf(RAYO_POOL(component), "grammar-%d", rayo_actor_seq_next(RAYO_ACTOR(component))); + /* unlock handler mutex, otherwise deadlock will happen if switch_ivr_detect_speech_load_grammar removes the media bug */ + switch_mutex_unlock(component->handler->mutex); + if (switch_ivr_detect_speech_load_grammar(session, grammar, grammar_name) != SWITCH_STATUS_SUCCESS) { + switch_mutex_lock(component->handler->mutex); + *stanza_error = STANZA_ERROR_INTERNAL_SERVER_ERROR; + *error_detail = "Failed to load grammar"; + switch_safe_free(grammar_uri_list.data); + return NULL; + } switch_mutex_lock(component->handler->mutex); - *stanza_error = STANZA_ERROR_INTERNAL_SERVER_ERROR; - *error_detail = "Failed to load grammar"; - switch_safe_free(grammar_uri_list.data); - return NULL; - } - switch_mutex_lock(component->handler->mutex); - /* add grammar to uri-list */ - grammar_uri_list.write_function(&grammar_uri_list, "session:%s\r\n", grammar_name); + /* add grammar to uri-list */ + grammar_uri_list.write_function(&grammar_uri_list, "session:%s\r\n", grammar_name); + } else { + /* add URI to uri-list */ + grammar_uri_list.write_function(&grammar_uri_list, "%s\r\n", iks_find_attrib_soft(grammar_tag, "url")); + } } switch_core_asr_text_param(ah, "start-recognize", "true"); From d738cb661d124357ccd6756ade9ee52e19dbb517 Mon Sep 17 00:00:00 2001 From: Brian West Date: Tue, 17 Feb 2015 10:23:38 -0600 Subject: [PATCH 55/91] Update .bashrc with some helper aliases --- support-d/.bashrc | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/support-d/.bashrc b/support-d/.bashrc index 05b3b38149..6ccce922bd 100644 --- a/support-d/.bashrc +++ b/support-d/.bashrc @@ -35,6 +35,21 @@ if [ "`id -u`" = "0" ]; then fi fi +if [ "${UNAME}" = "Darwin" ]; then + if [ -d ~/src/depot_tools ]; then + export PATH=$PATH:~/src/depot_tools + fi + if [ -d "/Applications/Chromium.app" ]; then + alias chromium='CHROME_LOG_FILE=chrome.log /Applications/Chromium.app/Contents/MacOS/Chromium --args --enable-usermedia-screen-capturing --usermedia-screen-capturing --enable-logging --v=1 --vmodule=*source*/talk/*=5 2>&1 | tee console.log' + fi + if [ -d "/Applications/Google Chrome Canary.app" ]; then + alias canary='CHROME_LOG_FILE=chrome.log /Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Chrome\ Canary --args --enable-usermedia-screen-capturing --usermedia-screen-capturing --enable-logging --v=1 --vmodule=*source*/talk/*=5 2>&1 | tee console.log' + fi + if [ -d "/Applications/Google Chrome.app" ]; then + alias chrome='CHROME_LOG_FILE=chrome.log /Applications/Google\ Chrome.app/Concd outtents/MacOS/Google\ Chrome --args --enable-usermedia-screen-capturing --usermedia-screen-capturing --enable-logging --v=1 --vmodule=*source*/talk/*=5 2>&1 | tee console.log' + fi +fi + if [ ! -f ~/.inputrc ]; then export INPUTRC="/etc/inputrc" fi @@ -66,8 +81,11 @@ alias fstop='top -p `cat /usr/local/freeswitch/run/freeswitch.pid`' alias fsgdb='gdb /usr/local/freeswitch/bin/freeswitch `cat /usr/local/freeswitch/run/freeswitch.pid`' alias fscore='gdb /usr/local/freeswitch/bin/freeswitch `ls -rt core.* | tail -n1`' alias emacs='emacs -nw' -alias jitteron='tc qdisc add dev eth0 root handle 1: netem delay 40ms 20ms ; tc qdisc add dev eth0 parent 1:1 pfifo limit 1000' -alias jitteroff='tc qdisc del dev eth0 root netem' + +if [ "${UNAME}" = "Linux" ]; then + alias jitteron='tc qdisc add dev eth0 root handle 1: netem delay 40ms 20ms ; tc qdisc add dev eth0 parent 1:1 pfifo limit 1000' + alias jitteroff='tc qdisc del dev eth0 root netem' +fi # Auto Update the .bashrc if hostname contains freeswitch.org if [[ $(hostname) =~ "freeswitch.org" ]]; then From 302a339fdffa175c5ca41a83e0e4cf96ca87b4c9 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Tue, 17 Feb 2015 12:20:24 -0500 Subject: [PATCH 56/91] FS-7294: Enable -Werror when building with clang compiler #resolve --- configure.ac | 1 + libs/libdingaling/src/sha1.c | 9 + .../libsofia-sip-ua/soa/soa_static.c | 19 ++ .../applications/mod_voicemail_ivr/config.c | 2 +- src/mod/endpoints/mod_sofia/sofia.c | 210 +++++++++--------- src/mod/endpoints/mod_sofia/sofia_glue.c | 4 +- src/mod/endpoints/mod_sofia/sofia_presence.c | 7 +- src/mod/endpoints/mod_sofia/sofia_reg.c | 8 +- src/mod/formats/mod_shout/mod_shout.c | 12 +- src/switch_ivr_play_say.c | 6 +- src/switch_rtp.c | 6 +- 11 files changed, 151 insertions(+), 133 deletions(-) diff --git a/configure.ac b/configure.ac index 2e61464d58..e41e62d4ed 100644 --- a/configure.ac +++ b/configure.ac @@ -375,6 +375,7 @@ if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then elif test "x${ax_cv_c_compiler_vendor}" = "xclang" ; then APR_ADDTO(SWITCH_AM_CFLAGS, -fPIC) APR_ADDTO(SWITCH_AM_CXXFLAGS, -fPIC) + APR_ADDTO(SWITCH_AM_CFLAGS, -Werror) elif test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then APR_ADDTO(SWITCH_AM_CFLAGS, -fPIC) APR_ADDTO(SWITCH_AM_CXXFLAGS, -fPIC) diff --git a/libs/libdingaling/src/sha1.c b/libs/libdingaling/src/sha1.c index c54154a866..b96446c122 100644 --- a/libs/libdingaling/src/sha1.c +++ b/libs/libdingaling/src/sha1.c @@ -57,11 +57,20 @@ #include "sha1.h" +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunused-const-variable" +#endif + #ifndef lint static const char rcsid[] = "$Id: sha1.c 680 2003-07-25 21:57:38Z asaddi $"; #endif /* !lint */ +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + #define ROTL(x, n) (((x) << (n)) | ((x) >> (32 - (n)))) #define ROTR(x, n) (((x) >> (n)) | ((x) << (32 - (n)))) diff --git a/libs/sofia-sip/libsofia-sip-ua/soa/soa_static.c b/libs/sofia-sip/libsofia-sip-ua/soa/soa_static.c index 87216c6b5a..0e192acd0c 100644 --- a/libs/sofia-sip/libsofia-sip-ua/soa/soa_static.c +++ b/libs/sofia-sip/libsofia-sip-ua/soa/soa_static.c @@ -732,10 +732,19 @@ int soa_sdp_upgrade(soa_session_t *ss, if (session == NULL || user == NULL) return (errno = EFAULT), -1; +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wnon-literal-null-conversion" +#endif + Ns = sdp_media_count(session, sdp_media_any, (sdp_text_t)0, (sdp_proto_e)0, (sdp_text_t)0); Nu = sdp_media_count(user, sdp_media_any, (sdp_text_t)0, (sdp_proto_e)0, (sdp_text_t)0); Nr = sdp_media_count(remote, sdp_media_any, (sdp_text_t)0, (sdp_proto_e)0, (sdp_text_t)0); +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + if (remote == NULL) Nmax = Ns + Nu; else if (Ns < Nr) @@ -1144,6 +1153,11 @@ static int offer_answer_step(soa_session_t *ss, else if (remote == NULL) return soa_set_status(ss, 500, "No remote SDP"); +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wnon-literal-null-conversion" +#endif + /* Pre-negotiation Step: Expand truncated remote SDP */ if (local && remote) switch (action) { case generate_answer: @@ -1160,6 +1174,11 @@ static int offer_answer_step(soa_session_t *ss, break; } +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + + /* Step A: Create local SDP session (based on user-supplied SDP) */ if (local == NULL) switch (action) { case generate_offer: diff --git a/src/mod/applications/mod_voicemail_ivr/config.c b/src/mod/applications/mod_voicemail_ivr/config.c index b0cf543411..b2b7d40116 100644 --- a/src/mod/applications/mod_voicemail_ivr/config.c +++ b/src/mod/applications/mod_voicemail_ivr/config.c @@ -169,7 +169,7 @@ static void populate_dtmfa_from_event(vmivr_menu_t *menu) { } } } - menu->dtmfa[i++] = '\0'; + menu->dtmfa[i++] = NULL; } vmivr_profile_t *get_profile(switch_core_session_t *session, const char *profile_name) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 1eafbe4384..b97a1c9804 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -299,15 +299,15 @@ static void extract_vars(sofia_profile_t *profile, sip_t const *sip, switch_channel_t *channel = switch_core_session_get_channel(session); if (sip) { - if (sip->sip_from && sip->sip_from->a_url) + if (sip->sip_from) url_set_chanvars(session, sip->sip_from->a_url, sip_from); - if (sip->sip_request && sip->sip_request->rq_url) + if (sip->sip_request) url_set_chanvars(session, sip->sip_request->rq_url, sip_req); - if (sip->sip_to && sip->sip_to->a_url) + if (sip->sip_to) url_set_chanvars(session, sip->sip_to->a_url, sip_to); - if (sip->sip_contact && sip->sip_contact->m_url) + if (sip->sip_contact) url_set_chanvars(session, sip->sip_contact->m_url, sip_contact); - if (sip->sip_referred_by && sip->sip_referred_by->b_url) + if (sip->sip_referred_by) url_set_chanvars(session, sip->sip_referred_by->b_url, sip_referred_by); if (sip->sip_to && sip->sip_to->a_tag) { switch_channel_set_variable(channel, "sip_to_tag", sip->sip_to->a_tag); @@ -585,7 +585,7 @@ void sofia_handle_sip_i_notify(switch_core_session_t *session, int status, switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "event-package", sip->sip_event->o_type); switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "event-id", sip->sip_event->o_id); - if (sip->sip_contact && sip->sip_contact->m_url) { + if (sip->sip_contact) { switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "contact", "%s@%s", sip->sip_contact->m_url->url_user, sip->sip_contact->m_url->url_host); } @@ -748,7 +748,7 @@ void sofia_handle_sip_i_notify(switch_core_session_t *session, int status, int acl_ok = 1; char *last_acl = NULL; - if (sip->sip_to && sip->sip_to->a_url && sip->sip_to->a_url->url_user && sip->sip_to->a_url->url_host + if (sip->sip_to && sip->sip_to->a_url->url_user && sip->sip_to->a_url->url_host && sip->sip_payload && sip->sip_payload->pl_data ) { sofia_glue_get_addr(de->data->e_msg, network_ip, sizeof(network_ip), NULL); @@ -1137,7 +1137,7 @@ void sofia_update_callee_id(switch_core_session_t *session, sofia_profile_t *pro if (!fs) { if ((passerted = sip_p_asserted_identity(sip))) { - if (passerted->paid_url && passerted->paid_url->url_user) { + if (passerted->paid_url->url_user) { number = passerted->paid_url->url_user; } if (!zstr(passerted->paid_display)) { @@ -1574,14 +1574,12 @@ static void our_sofia_event_callback(nua_event_t event, if (sip->sip_referred_by) { referred_by = sofia_glue_get_url_from_contact(sip_header_as_string(nua_handle_home(nh), (void *) sip->sip_referred_by), 0); ref_by_user = sip->sip_referred_by->b_url->url_user; - } - else if(sip->sip_to && sip->sip_to->a_url) - { + } else if(sip->sip_to){ referred_by = sofia_glue_get_url_from_contact(sip_header_as_string(nua_handle_home(nh), (void *) sip->sip_to), 0); ref_by_user = sip->sip_to->a_url->url_user; } - if (sip->sip_to && sip->sip_to->a_url) { + if (sip->sip_to) { req_user = sip->sip_to->a_url->url_user; req_host = sip->sip_to->a_url->url_host; } @@ -2050,7 +2048,7 @@ void sofia_event_callback(nua_event_t event, switch(event) { case nua_i_terminated: - if ((status == 401 || status == 407 || status == 403) && sofia_private && sofia_private->uuid) { + if ((status == 401 || status == 407 || status == 403) && sofia_private) { switch_core_session_t *session; if ((session = switch_core_session_locate(sofia_private->uuid))) { @@ -2219,7 +2217,7 @@ void sofia_event_callback(nua_event_t event, if (sip->sip_from) { channel_name = url_set_chanvars(session, sip->sip_from->a_url, sip_from); } - if (!channel_name && sip->sip_contact && sip->sip_contact->m_url) { + if (!channel_name && sip->sip_contact) { channel_name = url_set_chanvars(session, sip->sip_contact->m_url, sip_contact); } if (sip->sip_referred_by) { @@ -5896,8 +5894,8 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status } if (sip && - sip->sip_from && sip->sip_from->a_url && sip->sip_from->a_url->url_user && sip->sip_from->a_url->url_host && - sip->sip_to && sip->sip_to->a_url && sip->sip_to->a_url->url_user && sip->sip_to->a_url->url_host) { + sip->sip_from && sip->sip_from->a_url->url_user && sip->sip_from->a_url->url_host && + sip->sip_to && sip->sip_to->a_url->url_user && sip->sip_to->a_url->url_host) { sql = switch_mprintf("select 'appearance-index=1' from sip_subscriptions where expires > -1 and hostname='%q' and event='call-info' and " "sub_to_user='%q' and sub_to_host='%q'", mod_sofia_globals.hostname, sip->sip_to->a_url->url_user, @@ -6046,41 +6044,39 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status } for (p_contact = sip->sip_contact; p_contact; p_contact = p_contact->m_next) { - if (p_contact->m_url) { - full_contact = sip_header_as_string(home, (void *) p_contact); - invite_contact = sofia_glue_strip_uri(full_contact); + full_contact = sip_header_as_string(home, (void *) p_contact); + invite_contact = sofia_glue_strip_uri(full_contact); - switch_snprintf(var_name, sizeof(var_name), "sip_redirect_contact_%d", i); - switch_channel_set_variable(a_channel, var_name, full_contact); + switch_snprintf(var_name, sizeof(var_name), "sip_redirect_contact_%d", i); + switch_channel_set_variable(a_channel, var_name, full_contact); - if (i == 0) { - switch_channel_set_variable(channel, "sip_redirected_to", full_contact); - switch_channel_set_variable(a_channel, "sip_redirected_to", full_contact); - } - - if (p_contact->m_url->url_user) { - switch_snprintf(var_name, sizeof(var_name), "sip_redirect_contact_user_%d", i); - switch_channel_set_variable(channel, var_name, p_contact->m_url->url_user); - switch_channel_set_variable(a_channel, var_name, p_contact->m_url->url_user); - } - if (p_contact->m_url->url_host) { - switch_snprintf(var_name, sizeof(var_name), "sip_redirect_contact_host_%d", i); - switch_channel_set_variable(channel, var_name, p_contact->m_url->url_host); - switch_channel_set_variable(a_channel, var_name, p_contact->m_url->url_host); - } - if (p_contact->m_url->url_params) { - switch_snprintf(var_name, sizeof(var_name), "sip_redirect_contact_params_%d", i); - switch_channel_set_variable(channel, var_name, p_contact->m_url->url_params); - switch_channel_set_variable(a_channel, var_name, p_contact->m_url->url_params); - } - - switch_snprintf(var_name, sizeof(var_name), "sip_redirect_dialstring_%d", i); - switch_channel_set_variable_printf(channel, var_name, "sofia/%s/%s", sip_redirect_profile, invite_contact); - switch_channel_set_variable_printf(a_channel, var_name, "sofia/%s/%s", sip_redirect_profile, invite_contact); - stream.write_function(&stream, "%ssofia/%s/%s", i ? separator : "", sip_redirect_profile, invite_contact); - free(invite_contact); - i++; + if (i == 0) { + switch_channel_set_variable(channel, "sip_redirected_to", full_contact); + switch_channel_set_variable(a_channel, "sip_redirected_to", full_contact); } + + if (p_contact->m_url->url_user) { + switch_snprintf(var_name, sizeof(var_name), "sip_redirect_contact_user_%d", i); + switch_channel_set_variable(channel, var_name, p_contact->m_url->url_user); + switch_channel_set_variable(a_channel, var_name, p_contact->m_url->url_user); + } + if (p_contact->m_url->url_host) { + switch_snprintf(var_name, sizeof(var_name), "sip_redirect_contact_host_%d", i); + switch_channel_set_variable(channel, var_name, p_contact->m_url->url_host); + switch_channel_set_variable(a_channel, var_name, p_contact->m_url->url_host); + } + if (p_contact->m_url->url_params) { + switch_snprintf(var_name, sizeof(var_name), "sip_redirect_contact_params_%d", i); + switch_channel_set_variable(channel, var_name, p_contact->m_url->url_params); + switch_channel_set_variable(a_channel, var_name, p_contact->m_url->url_params); + } + + switch_snprintf(var_name, sizeof(var_name), "sip_redirect_dialstring_%d", i); + switch_channel_set_variable_printf(channel, var_name, "sofia/%s/%s", sip_redirect_profile, invite_contact); + switch_channel_set_variable_printf(a_channel, var_name, "sofia/%s/%s", sip_redirect_profile, invite_contact); + stream.write_function(&stream, "%ssofia/%s/%s", i ? separator : "", sip_redirect_profile, invite_contact); + free(invite_contact); + i++; } redirect_dialstring = stream.data; @@ -7795,7 +7791,7 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t switch_channel_set_variable(tech_pvt->channel, "transfer_disposition", "recv_replace"); - if (refer_to->r_url && refer_to->r_url->url_headers) { + if (refer_to->r_url->url_headers) { rep = (char *) switch_stristr("Replaces=", refer_to->r_url->url_headers); } @@ -8118,7 +8114,7 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t const char *port = NULL; const char *rep_h = NULL; - if (refer_to && refer_to->r_url && refer_to->r_url->url_port) { + if (refer_to && refer_to->r_url->url_port) { port = refer_to->r_url->url_port; } @@ -8132,7 +8128,7 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t nightmare_xfer_helper = switch_core_alloc(npool, sizeof(*nightmare_xfer_helper)); nightmare_xfer_helper->exten = switch_core_strdup(npool, exten); - if (refer_to->r_url && (refer_to->r_url->url_params || refer_to->r_url->url_headers)) { + if (refer_to->r_url->url_params || refer_to->r_url->url_headers) { if (refer_to->r_url->url_headers) { nightmare_xfer_helper->exten_with_params = switch_core_sprintf(npool, "{sip_invite_params=%s?%s}%s", @@ -8153,7 +8149,7 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t nightmare_xfer_helper->bridge_to_uuid = switch_core_strdup(npool, br_a); nightmare_xfer_helper->pool = npool; - if (refer_to->r_url && refer_to->r_url->url_headers) { + if (refer_to->r_url->url_headers) { char *h, *v, *hp; p = switch_core_session_strdup(session, refer_to->r_url->url_headers); while (p && *p) { @@ -8323,7 +8319,7 @@ static switch_status_t create_info_event(sip_t const *sip, switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "SIP-Content-Type", sip->sip_content_type->c_type); } - if (sip->sip_from && sip->sip_from->a_url) { + if (sip->sip_from) { if (sip->sip_from->a_url->url_user) { switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "SIP-From-User", sip->sip_from->a_url->url_user); } @@ -8333,7 +8329,7 @@ static switch_status_t create_info_event(sip_t const *sip, } } - if (sip->sip_to && sip->sip_to->a_url) { + if (sip->sip_to) { if (sip->sip_to->a_url->url_user) { switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "SIP-To-User", sip->sip_to->a_url->url_user); } @@ -8344,7 +8340,7 @@ static switch_status_t create_info_event(sip_t const *sip, } - if (sip->sip_contact && sip->sip_contact->m_url) { + if (sip->sip_contact) { if (sip->sip_contact->m_url->url_user) { switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "SIP-Contact-User", sip->sip_contact->m_url->url_user); } @@ -8793,9 +8789,10 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia int is_tcp = 0, is_tls = 0; const char *uparams = NULL; char *name_params = NULL; + const char *req_uri = NULL; + char *req_user = NULL; - - if (sip && sip->sip_contact && sip->sip_contact->m_url && sip->sip_contact->m_url->url_params) { + if (sip && sip->sip_contact && sip->sip_contact->m_url->url_params) { uparams = sip->sip_contact->m_url->url_params; } else { uparams = NULL; @@ -8829,7 +8826,7 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia goto fail; } - if (!(sip->sip_contact && sip->sip_contact->m_url)) { + if (!(sip->sip_contact)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "NO CONTACT!\n"); nua_respond(nh, 400, "Missing Contact Header", TAG_END()); goto fail; @@ -8880,7 +8877,7 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia char *last_acl = NULL; const char *contact_host = NULL; - if (sip && sip->sip_contact && sip->sip_contact->m_url) { + if (sip && sip->sip_contact) { contact_host = sip->sip_contact->m_url->url_host; } @@ -9088,7 +9085,7 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia } } - if (sip->sip_via || (sip->sip_contact && sip->sip_contact->m_url)) { + if (sip->sip_via || sip->sip_contact) { char tmp[35] = ""; const char *ipv6 = strchr(tech_pvt->mparams.remote_ip, ':'); @@ -9169,7 +9166,7 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia switch_event_destroy(&v_event); } - if (sip->sip_from && sip->sip_from->a_url) { + if (sip->sip_from) { from_user = sip->sip_from->a_url->url_user; from_host = sip->sip_from->a_url->url_host; //channel_name = url_set_chanvars(session, sip->sip_from->a_url, sip_from); @@ -9204,7 +9201,7 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia } if ((rpid = sip_remote_party_id(sip))) { - if (rpid->rpid_url && rpid->rpid_url->url_user) { + if (rpid->rpid_url->url_user) { char *full_rpid_header = sip_header_as_string(nh->nh_home, (void *) rpid); from_user = rpid->rpid_url->url_user; if (!zstr(full_rpid_header)) { @@ -9220,7 +9217,7 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia } if ((passerted = sip_p_asserted_identity(sip))) { - if (passerted->paid_url && passerted->paid_url->url_user) { + if (passerted->paid_url->url_user) { char *full_paid_header = sip_header_as_string(nh->nh_home, (void *) passerted); //char *full_paid_header = (char *)(passerted->paid_common->h_data); from_user = passerted->paid_url->url_user; @@ -9243,7 +9240,7 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia } if ((ppreferred = sip_p_preferred_identity(sip))) { - if (ppreferred->ppid_url && ppreferred->ppid_url->url_user) { + if (ppreferred->ppid_url->url_user) { char *full_ppid_header = sip_header_as_string(nh->nh_home, (void *) ppreferred); from_user = ppreferred->ppid_url->url_user; if (!zstr(full_ppid_header)) { @@ -9269,58 +9266,55 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia extract_header_vars(profile, sip, session, nh); - if (sip->sip_request->rq_url) { - const char *req_uri = url_set_chanvars(session, sip->sip_request->rq_url, sip_req); - char *user = NULL; - if (sip->sip_request->rq_url->url_user) { + req_uri = url_set_chanvars(session, sip->sip_request->rq_url, sip_req); + if (sip->sip_request->rq_url->url_user) { - user = switch_core_session_strdup(session, sip->sip_request->rq_url->url_user); - if (profile->parse_invite_tel_params) { - if (strchr(user, ';')) { - int argc1, x1 = 0; - char *argv1[32] = { 0 }; + req_user = switch_core_session_strdup(session, sip->sip_request->rq_url->url_user); + if (profile->parse_invite_tel_params) { + if (strchr(req_user, ';')) { + int argc1, x1 = 0; + char *argv1[32] = { 0 }; - if ((argc1 = switch_separate_string(user, ';', argv1, (sizeof(argv1) / sizeof(argv1[0]))))) { - for (x1 = 0; x1 < argc1; x1++) { - if (x1 == 0) { - switch_channel_set_variable(channel, "sip_req_user", argv1[0]); + if ((argc1 = switch_separate_string(req_user, ';', argv1, (sizeof(argv1) / sizeof(argv1[0]))))) { + for (x1 = 0; x1 < argc1; x1++) { + if (x1 == 0) { + switch_channel_set_variable(channel, "sip_req_user", argv1[0]); + } else { + int argc2 = 0; + char *argv2[2] = { 0 }; + if ((argc2 = switch_separate_string(argv1[x1], '=', argv2, (sizeof(argv2) / sizeof(argv2[0])))) == 2) { + char *var_name = NULL; + var_name = switch_mprintf("sip_invite_%s", argv2[0]); + switch_channel_set_variable(channel, var_name, argv2[1]); + switch_safe_free( var_name ); } else { - int argc2 = 0; - char *argv2[2] = { 0 }; - if ((argc2 = switch_separate_string(argv1[x1], '=', argv2, (sizeof(argv2) / sizeof(argv2[0])))) == 2) { - char *var_name = NULL; - var_name = switch_mprintf("sip_invite_%s", argv2[0]); - switch_channel_set_variable(channel, var_name, argv2[1]); - switch_safe_free( var_name ); - } else { - char *var_name = NULL; - var_name = switch_mprintf("sip_invite_%s", argv1[x1]); - switch_channel_set_variable(channel, var_name, "true"); - switch_safe_free( var_name ); - } + char *var_name = NULL; + var_name = switch_mprintf("sip_invite_%s", argv1[x1]); + switch_channel_set_variable(channel, var_name, "true"); + switch_safe_free( var_name ); } } } } } } - - if (sofia_test_pflag(profile, PFLAG_FULL_ID)) { - destination_number = req_uri; - } else { - destination_number = user; - } - if (sip->sip_request->rq_url->url_params && (sofia_glue_find_parameter(sip->sip_request->rq_url->url_params, "intercom=true"))) { - switch_channel_set_variable(channel, "sip_auto_answer_detected", "true"); - } } - if (!destination_number && sip->sip_to && sip->sip_to->a_url) { + if (sofia_test_pflag(profile, PFLAG_FULL_ID)) { + destination_number = req_uri; + } else { + destination_number = req_user; + } + if (sip->sip_request->rq_url->url_params && (sofia_glue_find_parameter(sip->sip_request->rq_url->url_params, "intercom=true"))) { + switch_channel_set_variable(channel, "sip_auto_answer_detected", "true"); + } + + if (!destination_number && sip->sip_to) { destination_number = sip->sip_to->a_url->url_user; } /* The human network, OH THE HUMANITY!!! lets send invites with no number! */ - if (!destination_number && sip->sip_from && sip->sip_from->a_url) { + if (!destination_number && sip->sip_from) { destination_number = sip->sip_from->a_url->url_user; } @@ -9330,12 +9324,12 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia destination_number = "service"; } - if (sip->sip_to && sip->sip_to->a_url) { + if (sip->sip_to) { const char *host, *user; int port, check_nat = 0; url_t *transport_url; - if (sip->sip_record_route && sip->sip_record_route->r_url) { + if (sip->sip_record_route) { transport_url = sip->sip_record_route->r_url; } else { transport_url = sip->sip_contact->m_url; @@ -9437,7 +9431,7 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia nua_set_hparams(tech_pvt->nh, SIPTAG_VIA_STR(tech_pvt->user_via), TAG_END()); } - if (sip->sip_contact && sip->sip_contact->m_url) { + if (sip->sip_contact) { url_set_chanvars(session, sip->sip_contact->m_url, sip_contact); } @@ -9581,8 +9575,8 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia char *state = "progressing"; if (sip && - sip->sip_from && sip->sip_from->a_url && sip->sip_from->a_url->url_user && sip->sip_from->a_url->url_host && - sip->sip_to && sip->sip_to->a_url && sip->sip_to->a_url->url_user && sip->sip_to->a_url->url_host) { + sip->sip_from && sip->sip_from->a_url->url_user && sip->sip_from->a_url->url_host && + sip->sip_to && sip->sip_to->a_url->url_user && sip->sip_to->a_url->url_host) { sql = switch_mprintf("select 'appearance-index=1' from sip_subscriptions where expires > -1 and hostname='%q' and event='call-info' and " "sub_to_user='%q' and sub_to_host='%q'", mod_sofia_globals.hostname, sip->sip_to->a_url->url_user, @@ -9700,12 +9694,12 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia char *p = NULL; const char *user = NULL, *host = NULL, *from_user = NULL, *from_host = NULL; - if (sip->sip_to && sip->sip_to->a_url) { + if (sip->sip_to) { user = sip->sip_to->a_url->url_user; host = sip->sip_to->a_url->url_host; } - if (sip->sip_from && sip->sip_from->a_url) { + if (sip->sip_from) { from_user = sip->sip_from->a_url->url_user; from_host = sip->sip_from->a_url->url_host; } diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index c26c66740d..74d4395113 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -2852,7 +2852,7 @@ char *sofia_glue_gen_contact_str(sofia_profile_t *profile, sip_t const *sip, nua const char *ipv6; sip_from_t const *from; - if (!sip || !sip->sip_contact || !sip->sip_contact->m_url) { + if (!sip || !sip->sip_contact) { return NULL; } @@ -2933,7 +2933,7 @@ char *sofia_glue_gen_contact_str(sofia_profile_t *profile, sip_t const *sip, nua np->is_nat = NULL; } - if (sip->sip_record_route && sip->sip_record_route->r_url) { + if (sip->sip_record_route) { char *full_contact = sip_header_as_string(nh->nh_home, (void *) contact); char *route = sofia_glue_strip_uri(sip_header_as_string(nh->nh_home, (void *) sip->sip_record_route)); char *full_contact_dup; diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index 5520e6ec76..7e31b4cfdd 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -3704,7 +3704,7 @@ void sofia_presence_handle_sip_i_subscribe(int status, use_to_tag = to_tag; } - if ( sip->sip_contact && sip->sip_contact->m_url ) { + if (sip->sip_contact) { contact_host = sip->sip_contact->m_url->url_host; contact_port = sip->sip_contact->m_url->url_port; contact_user = sip->sip_contact->m_url->url_user; @@ -4062,7 +4062,7 @@ void sofia_presence_handle_sip_i_subscribe(int status, } - if (nh && nh->nh_ds && nh->nh_ds->ds_usage) { + if (nh && nh->nh_ds->ds_usage) { /* nua_dialog_usage_set_refresh_range(nh->nh_ds->ds_usage, exp_delta + SUB_OVERLAP, exp_delta + SUB_OVERLAP); */ nua_dialog_usage_set_refresh_range(nh->nh_ds->ds_usage, exp_delta, exp_delta); } @@ -5029,8 +5029,7 @@ void sofia_presence_set_chat_hash(private_object_t *tech_pvt, sip_t const *sip) char buf[512]; su_home_t *home = NULL; - if (!tech_pvt || tech_pvt->hash_key || !sip || !sip->sip_from || !sip->sip_from->a_url || - !sip->sip_from->a_url->url_user || !sip->sip_from->a_url->url_host) { + if (!tech_pvt || tech_pvt->hash_key || !sip || !sip->sip_from || !sip->sip_from->a_url->url_user || !sip->sip_from->a_url->url_host) { return; } diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index dad7c09a36..3212531a1e 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -1269,7 +1269,7 @@ uint8_t sofia_reg_handle_register_token(nua_t *nua, sofia_profile_t *profile, nu sofia_private = *sofia_private_p; } - if (sip && sip->sip_contact && sip->sip_contact->m_url && sip->sip_contact->m_url->url_params) { + if (sip && sip->sip_contact && sip->sip_contact->m_url->url_params) { uparams = sip->sip_contact->m_url->url_params; } else { uparams = NULL; @@ -2189,7 +2189,7 @@ void sofia_reg_handle_sip_i_register(nua_t *nua, sofia_profile_t *profile, nua_h sofia_glue_get_addr(de->data->e_msg, network_ip, sizeof(network_ip), &network_port); /* backwards compatibility */ - if (mod_sofia_globals.reg_deny_binding_fetch_and_no_lookup && !(sip->sip_contact && sip->sip_contact->m_url)) { + if (mod_sofia_globals.reg_deny_binding_fetch_and_no_lookup && !sip->sip_contact) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "NO CONTACT! ip: %s, port: %i\n", network_ip, network_port); nua_respond(nh, 400, "Missing Contact Header", TAG_END()); goto end; @@ -2226,7 +2226,7 @@ void sofia_reg_handle_sip_i_register(nua_t *nua, sofia_profile_t *profile, nua_h char *last_acl = NULL; const char *contact_host = NULL; - if (sip && sip->sip_contact && sip->sip_contact->m_url) { + if (sip && sip->sip_contact) { contact_host = sip->sip_contact->m_url->url_host; } @@ -2492,7 +2492,7 @@ void sofia_reg_handle_sip_r_challenge(int status, } } - if (!gateway && !sip_auth_username && sip && sip->sip_to && sip->sip_to->a_url && sip->sip_to->a_url->url_user && sip->sip_to->a_url->url_host) { + if (!gateway && !sip_auth_username && sip && sip->sip_to && sip->sip_to->a_url->url_user && sip->sip_to->a_url->url_host) { switch_xml_t x_user, x_param, x_params; switch_event_t *locate_params; diff --git a/src/mod/formats/mod_shout/mod_shout.c b/src/mod/formats/mod_shout/mod_shout.c index 773e937912..b384d1a8a4 100644 --- a/src/mod/formats/mod_shout/mod_shout.c +++ b/src/mod/formats/mod_shout/mod_shout.c @@ -181,9 +181,6 @@ static inline void free_context(shout_context_t *context) while ((len = lame_encode_flush(context->gfp, mp3buffer, sizeof(mp3buffer))) > 0) { ret = fwrite(mp3buffer, 1, len, context->fp); - if (ret < 0) { - break; - } } lame_mp3_tags_fid(context->gfp, context->fp); @@ -899,7 +896,8 @@ static switch_status_t shout_file_close(switch_file_handle_t *handle) static switch_status_t shout_file_seek(switch_file_handle_t *handle, unsigned int *cur_sample, int64_t samples, int whence) { shout_context_t *context = handle->private_info; - + off_t seek_samples; + if (handle->handler || switch_test_flag(handle, SWITCH_FILE_FLAG_WRITE)) { return SWITCH_STATUS_FALSE; } else { @@ -908,10 +906,10 @@ static switch_status_t shout_file_seek(switch_file_handle_t *handle, unsigned in } switch_buffer_zero(context->audio_buffer); - *cur_sample = mpg123_seek(context->mh, (off_t) samples, whence); + seek_samples = mpg123_seek(context->mh, (off_t) samples, whence); - if (*cur_sample >= 0) { - handle->pos = *cur_sample; + if (seek_samples >= 0) { + handle->pos = *cur_sample = seek_samples; return SWITCH_STATUS_SUCCESS; } diff --git a/src/switch_ivr_play_say.c b/src/switch_ivr_play_say.c index 2bb5bb466a..eda1d6ef01 100644 --- a/src/switch_ivr_play_say.c +++ b/src/switch_ivr_play_say.c @@ -2463,12 +2463,10 @@ SWITCH_DECLARE(void) switch_ivr_clear_speech_cache(switch_core_session_t *sessio if (cache_obj->timer.interval) { switch_core_timer_destroy(&cache_obj->timer); } - if (&cache_obj->sh && cache_obj->sh.speech_interface) { + if (cache_obj->sh.speech_interface) { switch_core_speech_close(&cache_obj->sh, &flags); } - if (&cache_obj->codec) { - switch_core_codec_destroy(&cache_obj->codec); - } + switch_core_codec_destroy(&cache_obj->codec); switch_channel_set_private(channel, SWITCH_CACHE_SPEECH_HANDLES_OBJ_NAME, NULL); } } diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 4ad259cce3..91905df22f 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -2010,14 +2010,14 @@ static int rtcp_stats(switch_rtp_t *rtp_session) stats->period_pkt_count, pkt_seq, stats->cycle, stats->ssrc, rtp_session->timer.samplecount); #endif /* Interarrival jitter calculation */ - pkt_tsdiff = rtp_session->timer.samplecount - ntohl(hdr->ts) ; /* relative transit times for this packet */ + pkt_tsdiff = abs((int)rtp_session->timer.samplecount - (int)ntohl(hdr->ts)); /* relative transit times for this packet */ if (stats->pkt_count < 2) { /* Can not compute Jitter with only one packet */ stats->last_pkt_tsdiff = pkt_tsdiff; } else { - packet_spacing_diff = pkt_tsdiff - stats->last_pkt_tsdiff; /* Jitter : difference of relative transit times for the two packets */ + packet_spacing_diff = abs((int)pkt_tsdiff - (int)stats->last_pkt_tsdiff); /* Jitter : difference of relative transit times for the two packets */ stats->last_pkt_tsdiff = pkt_tsdiff; /* Interarrival jitter estimation, "J(i) = J(i-1) + ( |D(i-1,i)| - J(i-1) )/16" */ - stats->inter_jitter = (stats->inter_jitter + (((double)abs(packet_spacing_diff) - stats->inter_jitter) /16.)); + stats->inter_jitter = (stats->inter_jitter + (((double)packet_spacing_diff - stats->inter_jitter) /16.)); } #ifdef DEBUG_RTCP From f4a6e6e363b071ed21fc941f90b46900a74b86d0 Mon Sep 17 00:00:00 2001 From: William King Date: Tue, 17 Feb 2015 09:22:34 -0800 Subject: [PATCH 57/91] Remove the FreeSWITCH core handler for SIG_CHLD. This does not appear to be needed any longer, and while this is in place a dependent library that tries to start a child process will hang waiting on the SIG_CHLD signal that the FreeSWITCH core 'ate'. FS-7250 #resolve --- src/switch.c | 20 -------------------- src/switch_core.c | 17 ----------------- 2 files changed, 37 deletions(-) diff --git a/src/switch.c b/src/switch.c index 2433535152..89a23b75c7 100644 --- a/src/switch.c +++ b/src/switch.c @@ -90,24 +90,6 @@ static void handle_SIGILL(int sig) return; } -#ifndef WIN32 - -static void handle_SIGCHLD(int sig) -{ - int status = 0; - int pid = 0; - - if (sig) {}; - - pid = wait(&status); - if (pid > 0) { - system_ready = -1; - } - - return; -} -#endif - /* kill a freeswitch process running in background mode */ static int freeswitch_kill_background() { @@ -1088,8 +1070,6 @@ int main(int argc, char *argv[]) fprintf(stderr, "System Error!\n"); exit(-1); } - - signal(SIGCHLD, handle_SIGCHLD); } #endif diff --git a/src/switch_core.c b/src/switch_core.c index b2216ec2b5..85947c25ca 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -1813,16 +1813,6 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc } -#ifndef WIN32 -static void handle_SIGCHLD(int sig) -{ - int status = 0; - - wait(&status); - return; -} -#endif - #ifdef TRAP_BUS static void handle_SIGBUS(int sig) { @@ -2311,13 +2301,6 @@ SWITCH_DECLARE(void) switch_core_set_signal_handlers(void) { /* set signal handlers */ signal(SIGINT, SIG_IGN); -#ifndef WIN32 - if (switch_test_flag((&runtime), SCF_THREADED_SYSTEM_EXEC)) { - signal(SIGCHLD, SIG_DFL); - } else { - signal(SIGCHLD, handle_SIGCHLD); - } -#endif #ifdef SIGPIPE signal(SIGPIPE, SIG_IGN); #endif From 85a5e1db1da551693a284e994338d6df616ff1d5 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Tue, 17 Feb 2015 16:23:53 -0500 Subject: [PATCH 58/91] FS-7294: Enable -Werror when building with clang compiler --- libs/esl/fs_cli.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/esl/fs_cli.c b/libs/esl/fs_cli.c index dbf57c9c15..32fb77111c 100644 --- a/libs/esl/fs_cli.c +++ b/libs/esl/fs_cli.c @@ -1205,7 +1205,7 @@ struct color_map_el color_map[] = { static const char* match_color(const char *s) { struct color_map_el *map = color_map; - while (map->name) { + while (*map->name) { if (!(strcasecmp(s, map->name))) { return map->seq; } From 5f55790d72b2ffb3ea91d12fa884ef88d7ed765d Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Tue, 17 Feb 2015 16:47:17 -0500 Subject: [PATCH 59/91] FS-7294: Enable -Werror when building with clang compiler --- libs/sofia-sip/libsofia-sip-ua/sresolv/sres_sip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/sofia-sip/libsofia-sip-ua/sresolv/sres_sip.c b/libs/sofia-sip/libsofia-sip-ua/sresolv/sres_sip.c index 3d74f66644..bc03a69cfb 100644 --- a/libs/sofia-sip/libsofia-sip-ua/sresolv/sres_sip.c +++ b/libs/sofia-sip/libsofia-sip-ua/sresolv/sres_sip.c @@ -516,7 +516,7 @@ sres_sip_url_transport(url_t const *uri) if (len >= sizeof parameter) return -1; - for (i = 0; sres_sip_tports[i].stp_name; i++) { + for (i = 0; *sres_sip_tports[i].stp_name; i++) { if (su_casematch(parameter, sres_sip_tports[i].stp_name)) return sres_sip_tports[i].stp_number; } From cf53a30a4d9b511737ec9885419da6253d1da4b0 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Tue, 17 Feb 2015 17:12:58 -0500 Subject: [PATCH 60/91] FS-7294: Enable -Werror when building with clang compiler --- libs/sofia-sip/libsofia-sip-ua/sdp/sdp_print.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/sofia-sip/libsofia-sip-ua/sdp/sdp_print.c b/libs/sofia-sip/libsofia-sip-ua/sdp/sdp_print.c index 70a5b23b72..37b58e54bb 100644 --- a/libs/sofia-sip/libsofia-sip-ua/sdp/sdp_print.c +++ b/libs/sofia-sip/libsofia-sip-ua/sdp/sdp_print.c @@ -270,7 +270,7 @@ static void print_session(sdp_printer_t *p, sdp_session_t const *sdp) { p->pr_ok = 1; - if (p->pr_ok && sdp->sdp_version) + if (p->pr_ok) print_version(p, sdp->sdp_version); if (p->pr_ok && sdp->sdp_origin) print_origin(p, sdp->sdp_origin); From 4780a7e2afd535855919c9385ad9b44fefa2fc46 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Tue, 17 Feb 2015 18:18:41 -0500 Subject: [PATCH 61/91] FS-7294: Enable -Werror when building with clang compiler --- libs/sofia-sip/libsofia-sip-ua/nua/nua_client.c | 2 +- libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libs/sofia-sip/libsofia-sip-ua/nua/nua_client.c b/libs/sofia-sip/libsofia-sip-ua/nua/nua_client.c index 0e8c0dd64f..e15d6787de 100644 --- a/libs/sofia-sip/libsofia-sip-ua/nua/nua_client.c +++ b/libs/sofia-sip/libsofia-sip-ua/nua/nua_client.c @@ -176,7 +176,7 @@ int nua_client_create(nua_handle_t *nh, if (tags) { nua_move_signal(cr->cr_signal, nh->nh_nua->nua_signal); - if (cr->cr_signal) { + if (cr->cr_signal[0]) { /* Steal reference from signal */ cr->cr_owner = e->e_nh, e->e_nh = NULL; cr->cr_tags = tags; diff --git a/libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.c b/libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.c index 85f1647d3e..7364d4b255 100644 --- a/libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.c +++ b/libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.c @@ -877,7 +877,7 @@ void nua_stack_shutdown(nua_t *nua) if (status >= 200) { for (nh = nua->nua_handles; nh; nh = nh_next) { nh_next = nh->nh_next; - while (nh->nh_ds && nh->nh_ds->ds_usage) { + while (nh->nh_ds->ds_usage) { nua_dialog_usage_remove(nh, nh->nh_ds, nh->nh_ds->ds_usage, NULL, NULL); } } @@ -1096,7 +1096,7 @@ sip_replaces_t *nua_stack_handle_make_replaces(nua_handle_t *nh, su_home_t *home, int early_only) { - if (nh && nh->nh_ds && nh->nh_ds->ds_leg) + if (nh && nh->nh_ds->ds_leg) return nta_leg_make_replaces(nh->nh_ds->ds_leg, home, early_only); else return NULL; From acce943b5da5f492f4f937dc70c2994170750645 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 17 Feb 2015 20:15:14 -0600 Subject: [PATCH 62/91] FS-7066 FS-7253 FS-7231 #comment remove TFD_TIMER_ABSTIME as it seems to cause some load issues on some machines --- src/switch_time.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/switch_time.c b/src/switch_time.c index 009853b70b..4c8bdf1b26 100644 --- a/src/switch_time.c +++ b/src/switch_time.c @@ -418,7 +418,7 @@ static switch_status_t timerfd_start_interval(interval_timer_t *it, int interval val.it_value.tv_sec = 0; val.it_value.tv_nsec = 100000; - if (timerfd_settime(fd, TFD_TIMER_ABSTIME, &val, NULL) < 0) { + if (timerfd_settime(fd, 0, &val, NULL) < 0) { close(fd); return SWITCH_STATUS_GENERR; } @@ -1041,7 +1041,7 @@ SWITCH_MODULE_RUNTIME_FUNCTION(softtimer_runtime) spec.it_value.tv_sec = spec.it_interval.tv_sec; spec.it_value.tv_nsec = spec.it_interval.tv_nsec; - if (timerfd_settime(tfd, TFD_TIMER_ABSTIME, &spec, NULL)) { + if (timerfd_settime(tfd, 0, &spec, NULL)) { close(tfd); tfd = -1; } @@ -1109,7 +1109,7 @@ SWITCH_MODULE_RUNTIME_FUNCTION(softtimer_runtime) #ifdef HAVE_TIMERFD_CREATE if (last_MICROSECONDS_PER_TICK != runtime.microseconds_per_tick) { spec.it_interval.tv_nsec = runtime.microseconds_per_tick * 1000; - timerfd_settime(tfd, TFD_TIMER_ABSTIME, &spec, NULL); + timerfd_settime(tfd, 0, &spec, NULL); } last_MICROSECONDS_PER_TICK = runtime.microseconds_per_tick; From 68db163aad6be41a15fb919dca89092a09168d1d Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 17 Feb 2015 20:35:19 -0600 Subject: [PATCH 63/91] FS-7066 FS-7253 FS-7231 #comment not so fast, revert --- src/switch_time.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/switch_time.c b/src/switch_time.c index 4c8bdf1b26..009853b70b 100644 --- a/src/switch_time.c +++ b/src/switch_time.c @@ -418,7 +418,7 @@ static switch_status_t timerfd_start_interval(interval_timer_t *it, int interval val.it_value.tv_sec = 0; val.it_value.tv_nsec = 100000; - if (timerfd_settime(fd, 0, &val, NULL) < 0) { + if (timerfd_settime(fd, TFD_TIMER_ABSTIME, &val, NULL) < 0) { close(fd); return SWITCH_STATUS_GENERR; } @@ -1041,7 +1041,7 @@ SWITCH_MODULE_RUNTIME_FUNCTION(softtimer_runtime) spec.it_value.tv_sec = spec.it_interval.tv_sec; spec.it_value.tv_nsec = spec.it_interval.tv_nsec; - if (timerfd_settime(tfd, 0, &spec, NULL)) { + if (timerfd_settime(tfd, TFD_TIMER_ABSTIME, &spec, NULL)) { close(tfd); tfd = -1; } @@ -1109,7 +1109,7 @@ SWITCH_MODULE_RUNTIME_FUNCTION(softtimer_runtime) #ifdef HAVE_TIMERFD_CREATE if (last_MICROSECONDS_PER_TICK != runtime.microseconds_per_tick) { spec.it_interval.tv_nsec = runtime.microseconds_per_tick * 1000; - timerfd_settime(tfd, 0, &spec, NULL); + timerfd_settime(tfd, TFD_TIMER_ABSTIME, &spec, NULL); } last_MICROSECONDS_PER_TICK = runtime.microseconds_per_tick; From b320c525c28f2ec6a9fa345314a7c9ddd33dfb8a Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 17 Feb 2015 20:55:10 -0600 Subject: [PATCH 64/91] FS-7066 FS-7253 FS-7231 #this part should be right --- src/switch_time.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/switch_time.c b/src/switch_time.c index 009853b70b..0a4a94d08c 100644 --- a/src/switch_time.c +++ b/src/switch_time.c @@ -416,7 +416,7 @@ static switch_status_t timerfd_start_interval(interval_timer_t *it, int interval val.it_interval.tv_sec = interval / 1000; val.it_interval.tv_nsec = (interval % 1000) * 1000000; val.it_value.tv_sec = 0; - val.it_value.tv_nsec = 100000; + val.it_value.tv_nsec = val.it_interval.tv_nsec; if (timerfd_settime(fd, TFD_TIMER_ABSTIME, &val, NULL) < 0) { close(fd); From 2c8e9c80ce74191e5815a859a2fc6bc038cbabd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Artur=20Zaprza=C5=82a?= Date: Wed, 18 Feb 2015 12:37:20 +0100 Subject: [PATCH 65/91] Fix SIP_PAYLOAD_INIT2 macro in sip_header.h --- libs/sofia-sip/libsofia-sip-ua/sip/sofia-sip/sip_header.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/sofia-sip/libsofia-sip-ua/sip/sofia-sip/sip_header.h b/libs/sofia-sip/libsofia-sip-ua/sip/sofia-sip/sip_header.h index 484c0a2fe8..8e212b11f3 100644 --- a/libs/sofia-sip/libsofia-sip-ua/sip/sofia-sip/sip_header.h +++ b/libs/sofia-sip/libsofia-sip-ua/sip/sofia-sip/sip_header.h @@ -317,7 +317,7 @@ sip_payload_t *sip_payload_create(su_home_t *, void const *data, isize_t len); * @HIDE */ #define SIP_PAYLOAD_INIT2(data, length) \ - {{{ 0, 0, sip_payload_class, data, length }, NULL, data, length }} + {{{ 0, 0, sip_payload_class, data, length }}, NULL, data, length } /** Create a SIP separator line structure. */ SOFIAPUBFUN sip_separator_t *sip_separator_create(su_home_t *home); From 0df4085c3dbd3a4bfbc602153e86b7b1b7f0f617 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Artur=20Zaprza=C5=82a?= Date: Wed, 18 Feb 2015 14:26:02 +0100 Subject: [PATCH 66/91] Fix race condition when callcenter member cancels the call. --- src/mod/applications/mod_callcenter/mod_callcenter.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index 9f567120b8..6db5f8a2cd 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -1794,8 +1794,9 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa } else { /* Agent didn't answer or originate failed */ int delay_next_agent_call = 0; - sql = switch_mprintf("UPDATE members SET state = '%q', serving_agent = '', serving_system = ''" + sql = switch_mprintf("UPDATE members SET state = case state when '%q' then '%q' else state end, serving_agent = '', serving_system = ''" " WHERE serving_agent = '%q' AND serving_system = '%q' AND uuid = '%q' AND system = 'single_box'", + cc_member_state2str(CC_MEMBER_STATE_TRYING), /* Only switch to Waiting from Trying (state may be set to Abandoned in callcenter_function()) */ cc_member_state2str(CC_MEMBER_STATE_WAITING), h->agent_name, h->agent_system, h->member_uuid); cc_execute_sql(NULL, sql, NULL); From 3ad1628ff0f8ce921ecfd3a434842ea3c0fd99f9 Mon Sep 17 00:00:00 2001 From: Brian West Date: Wed, 18 Feb 2015 09:20:42 -0600 Subject: [PATCH 67/91] FS-7230 #resolve #comment please update --- src/mod/applications/mod_conference/mod_conference.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 1340d3bc6d..ff259e5ffb 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -4534,6 +4534,7 @@ static void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, v member->loop_loop = 1; if (setup_media(member, member->conference)) { + switch_mutex_unlock(member->read_mutex); break; } } From c2fbea8104be06b79e266ae3b5e6a0fe1f8766b6 Mon Sep 17 00:00:00 2001 From: Brian West Date: Wed, 18 Feb 2015 13:03:03 -0600 Subject: [PATCH 68/91] govg alias --- support-d/.bashrc | 1 + 1 file changed, 1 insertion(+) diff --git a/support-d/.bashrc b/support-d/.bashrc index d5694c480e..f392e74dbb 100644 --- a/support-d/.bashrc +++ b/support-d/.bashrc @@ -83,6 +83,7 @@ alias fscore='gdb /usr/local/freeswitch/bin/freeswitch `ls -rt core.* | tail -n1 alias emacs='emacs -nw' if [ "${UNAME}" = "Linux" ]; then + alias govg='valgrind --tool=memcheck --log-file-exactly=vg.log --leak-check=full --leak-resolution=high --show-reachable=yes .libs/freeswitch -vg' alias jitteron='tc qdisc add dev eth0 root handle 1: netem delay 40ms 20ms ; tc qdisc add dev eth0 parent 1:1 pfifo limit 1000' alias jitteroff='tc qdisc del dev eth0 root netem' fi From d6777e3aa1ec7c628f1b00593d88b9eee8993429 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 18 Feb 2015 13:35:28 -0600 Subject: [PATCH 69/91] FS-7066 FS-7253 FS-7231 #comment this should do it #resolve --- src/switch_time.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/switch_time.c b/src/switch_time.c index 0a4a94d08c..8d51292e4b 100644 --- a/src/switch_time.c +++ b/src/switch_time.c @@ -415,10 +415,10 @@ static switch_status_t timerfd_start_interval(interval_timer_t *it, int interval val.it_interval.tv_sec = interval / 1000; val.it_interval.tv_nsec = (interval % 1000) * 1000000; - val.it_value.tv_sec = 0; + val.it_value.tv_sec = val.it_interval.tv_sec; val.it_value.tv_nsec = val.it_interval.tv_nsec; - if (timerfd_settime(fd, TFD_TIMER_ABSTIME, &val, NULL) < 0) { + if (timerfd_settime(fd, 0, &val, NULL) < 0) { close(fd); return SWITCH_STATUS_GENERR; } @@ -1041,7 +1041,7 @@ SWITCH_MODULE_RUNTIME_FUNCTION(softtimer_runtime) spec.it_value.tv_sec = spec.it_interval.tv_sec; spec.it_value.tv_nsec = spec.it_interval.tv_nsec; - if (timerfd_settime(tfd, TFD_TIMER_ABSTIME, &spec, NULL)) { + if (timerfd_settime(tfd, 0, &spec, NULL)) { close(tfd); tfd = -1; } @@ -1109,7 +1109,7 @@ SWITCH_MODULE_RUNTIME_FUNCTION(softtimer_runtime) #ifdef HAVE_TIMERFD_CREATE if (last_MICROSECONDS_PER_TICK != runtime.microseconds_per_tick) { spec.it_interval.tv_nsec = runtime.microseconds_per_tick * 1000; - timerfd_settime(tfd, TFD_TIMER_ABSTIME, &spec, NULL); + timerfd_settime(tfd, 0, &spec, NULL); } last_MICROSECONDS_PER_TICK = runtime.microseconds_per_tick; From 0dfd08bc86e3065b2e118d421207485b93f3d5e4 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 18 Feb 2015 14:40:56 -0600 Subject: [PATCH 70/91] FS-7066 FS-7253 FS-7231 #comment wait, there's more.... need this too, let's never change this code again.... --- src/switch_time.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/switch_time.c b/src/switch_time.c index 8d51292e4b..be3debf560 100644 --- a/src/switch_time.c +++ b/src/switch_time.c @@ -415,8 +415,8 @@ static switch_status_t timerfd_start_interval(interval_timer_t *it, int interval val.it_interval.tv_sec = interval / 1000; val.it_interval.tv_nsec = (interval % 1000) * 1000000; - val.it_value.tv_sec = val.it_interval.tv_sec; - val.it_value.tv_nsec = val.it_interval.tv_nsec; + val.it_value.tv_sec = 0; + val.it_value.tv_nsec = 100000; if (timerfd_settime(fd, 0, &val, NULL) < 0) { close(fd); @@ -1038,8 +1038,8 @@ SWITCH_MODULE_RUNTIME_FUNCTION(softtimer_runtime) if (tfd > -1) { spec.it_interval.tv_sec = 0; spec.it_interval.tv_nsec = runtime.microseconds_per_tick * 1000; - spec.it_value.tv_sec = spec.it_interval.tv_sec; - spec.it_value.tv_nsec = spec.it_interval.tv_nsec; + spec.it_value.tv_sec = 0; + spec.it_value.tv_nsec = 100000; if (timerfd_settime(tfd, 0, &spec, NULL)) { close(tfd); From 5febdbbc08a709b8580efe705830c538ad5de63b Mon Sep 17 00:00:00 2001 From: Brian West Date: Wed, 18 Feb 2015 15:45:05 -0600 Subject: [PATCH 71/91] FS-7297 #comment update the make target installer --- src/mod/codecs/mod_com_g729/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/codecs/mod_com_g729/Makefile.am b/src/mod/codecs/mod_com_g729/Makefile.am index e6586e159f..b311a7c641 100644 --- a/src/mod/codecs/mod_com_g729/Makefile.am +++ b/src/mod/codecs/mod_com_g729/Makefile.am @@ -1,7 +1,7 @@ include $(top_srcdir)/build/modmake.rulesam MODNAME=mod_com_g729 -VERSION=194 +VERSION=201501231218 if ISLINUX From e26605703ff8be1055ffee799722ff488a855995 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Artur=20Zaprza=C5=82a?= Date: Wed, 18 Feb 2015 15:53:19 +0100 Subject: [PATCH 72/91] FS-7299: Implement cookie-file option for mod_xml_cdr. --- conf/vanilla/autoload_configs/xml_cdr.conf.xml | 2 +- src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/conf/vanilla/autoload_configs/xml_cdr.conf.xml b/conf/vanilla/autoload_configs/xml_cdr.conf.xml index d4c4bea8d9..bdb20e63e0 100644 --- a/conf/vanilla/autoload_configs/xml_cdr.conf.xml +++ b/conf/vanilla/autoload_configs/xml_cdr.conf.xml @@ -66,6 +66,6 @@ - + diff --git a/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c b/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c index 56f4500b82..71f51d30ce 100644 --- a/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c +++ b/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c @@ -70,6 +70,7 @@ static struct { int timeout; switch_memory_pool_t *pool; switch_event_node_t *node; + char *cookie_file; } globals; SWITCH_MODULE_LOAD_FUNCTION(mod_xml_cdr_load); @@ -330,6 +331,11 @@ static switch_status_t my_on_reporting(switch_core_session_t *session) switch_curl_easy_setopt(curl_handle, CURLOPT_CAINFO, globals.ssl_cacert_file); } + if (globals.cookie_file) { + switch_curl_easy_setopt(curl_handle, CURLOPT_COOKIEJAR, globals.cookie_file); + switch_curl_easy_setopt(curl_handle, CURLOPT_COOKIEFILE, globals.cookie_file); + } + switch_curl_easy_setopt(curl_handle, CURLOPT_TIMEOUT, globals.timeout); /* these were used for testing, optionally they may be enabled if someone desires @@ -582,6 +588,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_xml_cdr_load) } else if (!strcasecmp(val, "any")) { globals.auth_scheme = (long)CURLAUTH_ANY; } + } else if (!strcasecmp(var, "cookie-file")) { + globals.cookie_file = switch_core_strdup(globals.pool, val); } } From 497605821de139673afcf26f51ec075196af16fa Mon Sep 17 00:00:00 2001 From: Brian West Date: Thu, 19 Feb 2015 14:31:39 -0600 Subject: [PATCH 73/91] Add more debug aliases --- support-d/.bashrc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/support-d/.bashrc b/support-d/.bashrc index f392e74dbb..531c44bdfc 100644 --- a/support-d/.bashrc +++ b/support-d/.bashrc @@ -78,12 +78,13 @@ alias tgit='git commit --author "Anthony Minessale "' alias dp='emacs /usr/local/freeswitch/conf/dialplan/default.xml' alias go='/usr/local/freeswitch/bin/freeswitch -nonat' alias fstop='top -p `cat /usr/local/freeswitch/run/freeswitch.pid`' +alias fsgcore='gcore `cat /usr/local/freeswitch/run/freeswitch.pid`' alias fsgdb='gdb /usr/local/freeswitch/bin/freeswitch `cat /usr/local/freeswitch/run/freeswitch.pid`' alias fscore='gdb /usr/local/freeswitch/bin/freeswitch `ls -rt core.* | tail -n1`' alias emacs='emacs -nw' if [ "${UNAME}" = "Linux" ]; then - alias govg='valgrind --tool=memcheck --log-file-exactly=vg.log --leak-check=full --leak-resolution=high --show-reachable=yes .libs/freeswitch -vg' + alias govg='valgrind --tool=memcheck --log-file=vg.log --leak-check=full --leak-resolution=high --show-reachable=yes .libs/freeswitch -vg' alias jitteron='tc qdisc add dev eth0 root handle 1: netem delay 40ms 20ms ; tc qdisc add dev eth0 parent 1:1 pfifo limit 1000' alias jitteroff='tc qdisc del dev eth0 root netem' fi From 9fe512805b7674ebb36d91d9a7a423a90ba77750 Mon Sep 17 00:00:00 2001 From: Brian West Date: Thu, 19 Feb 2015 14:43:58 -0600 Subject: [PATCH 74/91] FS-7301 #comment set the tx-reinvite-packet-count to 400, seems we are too fast for the remote in this case which is causing your failure #resolve --- conf/vanilla/autoload_configs/spandsp.conf.xml | 3 +++ src/mod/applications/mod_spandsp/mod_spandsp.c | 18 ++++++++++++++++++ src/mod/applications/mod_spandsp/mod_spandsp.h | 2 ++ .../applications/mod_spandsp/mod_spandsp_fax.c | 4 ++-- 4 files changed, 25 insertions(+), 2 deletions(-) diff --git a/conf/vanilla/autoload_configs/spandsp.conf.xml b/conf/vanilla/autoload_configs/spandsp.conf.xml index 2653c40bb8..2471ca52ce 100644 --- a/conf/vanilla/autoload_configs/spandsp.conf.xml +++ b/conf/vanilla/autoload_configs/spandsp.conf.xml @@ -34,6 +34,9 @@ + + + diff --git a/src/mod/applications/mod_spandsp/mod_spandsp.c b/src/mod/applications/mod_spandsp/mod_spandsp.c index 4d70f04b1b..1158026215 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp.c @@ -519,6 +519,8 @@ switch_status_t load_configuration(switch_bool_t reload) spandsp_globals.header = "SpanDSP Fax Header"; spandsp_globals.timezone = ""; spandsp_globals.tonedebug = 0; + spandsp_globals.t38_tx_reinvite_packet_count = 100; + spandsp_globals.t38_rx_reinvite_packet_count = 50; if ((xml = switch_xml_open_cfg("spandsp.conf", &cfg, NULL)) || (xml = switch_xml_open_cfg("fax.conf", &cfg, NULL))) { status = SWITCH_STATUS_SUCCESS; @@ -627,6 +629,22 @@ switch_status_t load_configuration(switch_bool_t reload) } else { spandsp_globals.enable_t38_request = 0; } + } else if (!strcmp(name, "t38-tx-reinvite-packet-count")) { + int delay = atoi(value); + + if (delay >= 0 && delay < 1000) { + spandsp_globals.t38_tx_reinvite_packet_count = delay; + } else { + spandsp_globals.t38_tx_reinvite_packet_count = 100; + } + } else if (!strcmp(name, "t38-rx-reinvite-packet-count")) { + int delay = atoi(value); + + if (delay >= 0 && delay < 1000) { + spandsp_globals.t38_rx_reinvite_packet_count = delay; + } else { + spandsp_globals.t38_rx_reinvite_packet_count = 0; + } } else if (!strcmp(name, "ident")) { if (!strcmp(value, "_undef_")) { spandsp_globals.ident = ""; diff --git a/src/mod/applications/mod_spandsp/mod_spandsp.h b/src/mod/applications/mod_spandsp/mod_spandsp.h index c732c7b357..7f2f5d04a3 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp.h +++ b/src/mod/applications/mod_spandsp/mod_spandsp.h @@ -82,6 +82,8 @@ struct spandsp_globals { char *modem_directory; switch_hash_t *tones; int tonedebug; + int t38_tx_reinvite_packet_count; + int t38_rx_reinvite_packet_count; }; extern struct spandsp_globals spandsp_globals; diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c index 2c0ba42cc1..5a3eb61214 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c @@ -1483,9 +1483,9 @@ void mod_spandsp_fax_process_fax(switch_core_session_t *session, const char *dat switch_ivr_sleep(session, 250, SWITCH_TRUE, NULL); if (pvt->app_mode == FUNCTION_TX) { - req_counter = 100; + req_counter = spandsp_globals.t38_tx_reinvite_packet_count; } else { - req_counter = 50; + req_counter = spandsp_globals.t38_rx_reinvite_packet_count; } while (switch_channel_ready(channel)) { From 54f16398310846a6b793491d21778e0961b48712 Mon Sep 17 00:00:00 2001 From: Spencer Thomason Date: Thu, 19 Feb 2015 15:36:54 -0800 Subject: [PATCH 75/91] FS-7192: [mod_sofia] do not include Expires header in INVITEs responding to a auth challenge --- src/mod/endpoints/mod_sofia/sofia_reg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index 3212531a1e..8c3e4b6fab 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -2548,7 +2548,7 @@ void sofia_reg_handle_sip_r_challenge(int status, tl_gets(tags, NUTAG_CALLSTATE_REF(ss_state), SIPTAG_WWW_AUTHENTICATE_REF(authenticate), TAG_END()); nua_authenticate(nh, - TAG_IF(gateway, SIPTAG_EXPIRES_STR(gateway ? gateway->expires_str : "3600")), + TAG_IF(sofia_private && !zstr(sofia_private->gateway_name), SIPTAG_EXPIRES_STR(gateway ? gateway->expires_str : "3600")), NUTAG_AUTH(authentication), TAG_END()); goto end; From cc61f11fb7001ad7a7882e6591b3e89740dce2e9 Mon Sep 17 00:00:00 2001 From: Spencer Thomason Date: Thu, 19 Feb 2015 15:52:44 -0800 Subject: [PATCH 76/91] FS-7308: [mod_sofia] Only log SLA SQL query SQL when debugging is enabled --- src/mod/endpoints/mod_sofia/sofia.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index b97a1c9804..691e33e76f 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -9828,7 +9828,9 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia if (b_call_id) { char *sql = switch_mprintf("update sip_dialogs set call_info_state='idle' where call_id='%q'", b_call_id); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "SQL: %s\n", sql); + if (mod_sofia_globals.debug_sla > 1) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "QUERY SQL %s\n", sql); + } sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); switch_channel_presence(b_channel, "unknown", "idle", NULL); From ed2fabc2a6b882a29662d6c4a990341e6349e21e Mon Sep 17 00:00:00 2001 From: Yossi Neiman Date: Thu, 19 Feb 2015 19:03:03 -0600 Subject: [PATCH 77/91] FS-7302: Added params to fs_encode.c: -c for path to conf_dir -k for path to log_dir -m for path to mod_dir --- src/fs_encode.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/fs_encode.c b/src/fs_encode.c index 626601d9d6..d2934b51f2 100644 --- a/src/fs_encode.c +++ b/src/fs_encode.c @@ -46,6 +46,13 @@ #pragma warning (disable:167) #endif +static void fs_encode_cleanup() +{ + switch_safe_free(SWITCH_GLOBAL_dirs.conf_dir); + switch_safe_free(SWITCH_GLOBAL_dirs.mod_dir); + switch_safe_free(SWITCH_GLOBAL_dirs.log_dir); +} + int main(int argc, char *argv[]) { int r = 1; @@ -75,6 +82,27 @@ int main(int argc, char *argv[]) for (i = 1; i < argc; i++) { if (argv[i][0] == '-') { switch(argv[i][1]) { + case 'c': + i++; + if((SWITCH_GLOBAL_dirs.conf_dir = (char *) malloc(strlen(argv[i]) + 1)) == NULL) { + return 255; + } + strcpy(SWITCH_GLOBAL_dirs.conf_dir, argv[i]); + break; + case 'k': + i++; + if((SWITCH_GLOBAL_dirs.log_dir = (char *) malloc(strlen(argv[i]) + 1)) == NULL) { + return 255; + } + strcpy(SWITCH_GLOBAL_dirs.log_dir, argv[i]); + break; + case 'm': + i++; + if((SWITCH_GLOBAL_dirs.mod_dir = (char *) malloc(strlen(argv[i]) + 1)) == NULL) { + return 255; + } + strcpy(SWITCH_GLOBAL_dirs.mod_dir, argv[i]); + break; case 'l': i++; /* Load extra modules */ @@ -288,6 +316,8 @@ end: if (pool) { switch_core_destroy_memory_pool(&pool); } + + fs_encode_cleanup(); //switch_core_destroy(); @@ -295,12 +325,16 @@ end: usage: printf("Usage: %s [options] input output\n\n", argv[0]); printf("The output must end in the format, e.g., myfile.SPEEX\n"); + printf("\t\t -c path\t\t Path to the FS configurations.\n"); + printf("\t\t -k path\t\t Path to the FS log directory\n"); printf("\t\t -l module[,module]\t Load additional modules (comma-separated)\n"); + printf("\t\t -m path\t\t Path to the modules.\n"); printf("\t\t -f format\t\t fmtp to pass to the codec\n"); printf("\t\t -p ptime\t\t ptime to use while encoding\n"); printf("\t\t -r rate\t\t sampling rate\n"); printf("\t\t -b bitrate\t\t codec bitrate (if supported)\n"); printf("\t\t -v\t\t\t verbose\n"); + fs_encode_cleanup(); return 1; } From f4aaeedb0c7135f981c4d4b029a833854e28cdc8 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 19 Feb 2015 23:06:41 -0600 Subject: [PATCH 78/91] FS-7306 #resolve --- src/mod/applications/mod_spandsp/mod_spandsp_fax.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c index 5a3eb61214..02187db92d 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c @@ -138,7 +138,7 @@ static int add_pvt(pvt_t *pvt) { int r = 0; - if (t38_state_list.thread_running) { + if (t38_state_list.thread_running > 0) { switch_mutex_lock(t38_state_list.mutex); pvt->next = t38_state_list.head; t38_state_list.head = pvt; @@ -199,12 +199,13 @@ static void *SWITCH_THREAD_FUNC timer_thread_run(switch_thread_t *thread, void * if (switch_core_timer_init(&timer, "soft", ms, samples, NULL) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "timer init failed.\n"); + t38_state_list.thread_running = -1; goto end; } switch_mutex_lock(spandsp_globals.cond_mutex); - while(t38_state_list.thread_running) { + while(t38_state_list.thread_running > 0) { switch_mutex_lock(t38_state_list.mutex); From 74e8db736f95088d7cf38b4c424647f5ebfa2783 Mon Sep 17 00:00:00 2001 From: Spencer Thomason Date: Thu, 19 Feb 2015 16:53:46 -0800 Subject: [PATCH 79/91] FS-7309: [mod_sofia] Allow removal of User-Agent header In certain deployments it might be desirable to remove the User-Agent header from the SIP message. Set the sofia profile parameter "user-agent-string" to "none" to suppress this header. --- conf/insideout/sip_profiles/internal-ipv6.xml | 1 + conf/insideout/sip_profiles/internal.xml | 2 ++ conf/softphone/freeswitch.xml | 2 ++ conf/vanilla/sip_profiles/internal-ipv6.xml | 1 + conf/vanilla/sip_profiles/internal.xml | 3 +++ src/mod/endpoints/mod_sofia/conf/sofia.conf.xml | 3 +++ src/mod/endpoints/mod_sofia/sofia.c | 10 ++++++++-- 7 files changed, 20 insertions(+), 2 deletions(-) diff --git a/conf/insideout/sip_profiles/internal-ipv6.xml b/conf/insideout/sip_profiles/internal-ipv6.xml index 525554f4b8..0ae93cfc82 100644 --- a/conf/insideout/sip_profiles/internal-ipv6.xml +++ b/conf/insideout/sip_profiles/internal-ipv6.xml @@ -5,6 +5,7 @@ + diff --git a/conf/insideout/sip_profiles/internal.xml b/conf/insideout/sip_profiles/internal.xml index 666f7de5ab..158d5974a7 100644 --- a/conf/insideout/sip_profiles/internal.xml +++ b/conf/insideout/sip_profiles/internal.xml @@ -36,6 +36,8 @@ bypass media after an attended transfer. --> + + diff --git a/conf/softphone/freeswitch.xml b/conf/softphone/freeswitch.xml index 3d5faa240c..311ba4fcc2 100644 --- a/conf/softphone/freeswitch.xml +++ b/conf/softphone/freeswitch.xml @@ -129,6 +129,8 @@ + + diff --git a/conf/vanilla/sip_profiles/internal-ipv6.xml b/conf/vanilla/sip_profiles/internal-ipv6.xml index 62b9708e8b..98efa2ffbb 100644 --- a/conf/vanilla/sip_profiles/internal-ipv6.xml +++ b/conf/vanilla/sip_profiles/internal-ipv6.xml @@ -5,6 +5,7 @@ + diff --git a/conf/vanilla/sip_profiles/internal.xml b/conf/vanilla/sip_profiles/internal.xml index a848cb9583..1788780601 100644 --- a/conf/vanilla/sip_profiles/internal.xml +++ b/conf/vanilla/sip_profiles/internal.xml @@ -42,7 +42,10 @@ bypass media after an attended transfer. --> + + + diff --git a/src/mod/endpoints/mod_sofia/conf/sofia.conf.xml b/src/mod/endpoints/mod_sofia/conf/sofia.conf.xml index 52fb8faefb..2e1a849e41 100644 --- a/src/mod/endpoints/mod_sofia/conf/sofia.conf.xml +++ b/src/mod/endpoints/mod_sofia/conf/sofia.conf.xml @@ -80,7 +80,10 @@ + + + diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index b97a1c9804..803e1cb357 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -2872,6 +2872,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void nua_set_params(profile->nua, SIPTAG_ALLOW_STR("INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO"), + SIPTAG_USER_AGENT(SIP_NONE), NUTAG_AUTOANSWER(0), NUTAG_AUTOACK(0), NUTAG_AUTOALERT(0), @@ -2911,7 +2912,9 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void TAG_IF(profile->pres_type, NUTAG_ALLOW_EVENTS("presence.winfo")), TAG_IF(profile->pres_type, NUTAG_ALLOW_EVENTS("message-summary")), TAG_IF(profile->pres_type == PRES_TYPE_PNP, NUTAG_ALLOW_EVENTS("ua-profile")), - NUTAG_ALLOW_EVENTS("refer"), SIPTAG_SUPPORTED_STR(supported), SIPTAG_USER_AGENT_STR(profile->user_agent), TAG_END()); + NUTAG_ALLOW_EVENTS("refer"), SIPTAG_SUPPORTED_STR(supported), + TAG_IF(strcasecmp(profile->user_agent, "_undef_"), SIPTAG_USER_AGENT_STR(profile->user_agent)), + TAG_END()); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Set params for %s\n", profile->name); @@ -2943,6 +2946,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void NTATAG_SERVER_RPORT(profile->server_rport_level), NUTAG_URL(node->url), TAG_END()); /* Last tag should always finish the sequence */ nua_set_params(node->nua, + SIPTAG_USER_AGENT(SIP_NONE), NUTAG_APPL_METHOD("OPTIONS"), NUTAG_APPL_METHOD("REFER"), NUTAG_APPL_METHOD("SUBSCRIBE"), @@ -2954,7 +2958,9 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void NUTAG_ALLOW("INFO"), TAG_IF(profile->pres_type, NUTAG_ALLOW("PUBLISH")), TAG_IF(profile->pres_type, NUTAG_ENABLEMESSAGE(1)), - SIPTAG_SUPPORTED_STR(supported), SIPTAG_USER_AGENT_STR(profile->user_agent), TAG_END()); + SIPTAG_SUPPORTED_STR(supported), + TAG_IF(strcasecmp(profile->user_agent, "_undef_"), SIPTAG_USER_AGENT_STR(profile->user_agent)), + TAG_END()); } switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Activated db for %s\n", profile->name); From b66aa6af92646919da3bd0ec07988ae7dcece54a Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 20 Feb 2015 12:08:22 -0600 Subject: [PATCH 80/91] FS-7306 #comment fix both ways --- src/fs_encode.c | 1 + .../applications/mod_spandsp/mod_spandsp_fax.c | 17 +++++++++-------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/fs_encode.c b/src/fs_encode.c index 626601d9d6..49895390ef 100644 --- a/src/fs_encode.c +++ b/src/fs_encode.c @@ -129,6 +129,7 @@ int main(int argc, char *argv[]) switch_loadable_module_init(SWITCH_FALSE); switch_loadable_module_load_module("", "CORE_PCM_MODULE", SWITCH_TRUE, &err); switch_loadable_module_load_module("", "CORE_SPEEX_MODULE", SWITCH_TRUE, &err); + switch_loadable_module_load_module("", "CORE_SOFTTIMER_MODULE", SWITCH_TRUE, &err); for (i = 0; i < extra_modules_count; i++) { if (switch_loadable_module_load_module((char *) SWITCH_GLOBAL_dirs.mod_dir, (char *) extra_modules[i], SWITCH_TRUE, &err) != SWITCH_STATUS_SUCCESS) { diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c index 02187db92d..c2fc659187 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c @@ -190,6 +190,13 @@ static void *SWITCH_THREAD_FUNC timer_thread_run(switch_thread_t *thread, void * pvt_t *pvt; int samples = 160; int ms = 20; + int r = 0; + + if (switch_core_timer_init(&timer, "soft", ms, samples, NULL) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "timer init failed.\n"); + r = -1; + goto end; + } switch_mutex_lock(t38_state_list.mutex); t38_state_list.thread_running = 1; @@ -197,15 +204,9 @@ static void *SWITCH_THREAD_FUNC timer_thread_run(switch_thread_t *thread, void * switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FAX timer thread started.\n"); - if (switch_core_timer_init(&timer, "soft", ms, samples, NULL) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "timer init failed.\n"); - t38_state_list.thread_running = -1; - goto end; - } - switch_mutex_lock(spandsp_globals.cond_mutex); - while(t38_state_list.thread_running > 0) { + while(t38_state_list.thread_running == 1) { switch_mutex_lock(t38_state_list.mutex); @@ -234,7 +235,7 @@ static void *SWITCH_THREAD_FUNC timer_thread_run(switch_thread_t *thread, void * switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FAX timer thread ended.\n"); switch_mutex_lock(t38_state_list.mutex); - t38_state_list.thread_running = 0; + t38_state_list.thread_running = r; switch_mutex_unlock(t38_state_list.mutex); if (timer.timer_interface) { From 957c8fc910925a16fc377591f04e93d29d3bc395 Mon Sep 17 00:00:00 2001 From: Brian West Date: Fri, 20 Feb 2015 12:41:39 -0600 Subject: [PATCH 81/91] FS-7230 #comment try this #resolve --- src/mod/applications/mod_conference/mod_conference.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index ff259e5ffb..0a680af860 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -8979,6 +8979,9 @@ static int setup_media(conference_member_t *member, conference_obj_t *conference switch_resample_destroy(&member->read_resampler); } + switch_buffer_destroy(&member->resample_buffer); + switch_buffer_destroy(&member->audio_buffer); + switch_buffer_destroy(&member->mux_buffer); switch_core_session_get_read_impl(member->session, &member->orig_read_impl); member->native_rate = read_impl.samples_per_second; From 2d07448822b673af2de6b4b0b4bfcd68b96f3d01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Artur=20Zaprza=C5=82a?= Date: Thu, 19 Feb 2015 11:20:41 +0100 Subject: [PATCH 82/91] FS-7304: Multiple and reversed ranges for XML dialplan date and time conditions --- src/switch_utils.c | 45 ++++++++++++--------------------------------- 1 file changed, 12 insertions(+), 33 deletions(-) diff --git a/src/switch_utils.c b/src/switch_utils.c index 905442e6ce..c0963aeb9e 100644 --- a/src/switch_utils.c +++ b/src/switch_utils.c @@ -3464,42 +3464,21 @@ SWITCH_DECLARE(switch_bool_t) switch_dow_cmp(const char *exp, int val) SWITCH_DECLARE(int) switch_number_cmp(const char *exp, int val) { - char *p; - - if ((p = strchr(exp, '-'))) { - int min; - int max; - - min = atol(exp); - p++; - max = atol(p); - - if (val >= min && val <= max) { - return 1; - } - } else if ((p = strchr(exp, ','))) { - const char *cur = exp; - p++; - while (cur) { - if (atol(cur) == val) { + // Expression exp must be a comma separated list of numbers or ranges. + // To match numbers not in range 9-17, enter the reversed range 18-8. + for (;; ++exp) { + int a = strtol(exp, (char **)&exp, 10); + if (*exp != '-') { + if (a == val) + return 1; + } else { + int b = strtol(++exp, (char **)&exp, 10); + if (a <= b ? (val >= a && val <=b ) : (val >= a || val <= b)) return 1; - } - - cur = p; - if (p && p + 1) { - if ((p = strchr((p + 1), ','))) { - p++; - } - } - } - } else { - if (atol(exp) == val) { - return 1; } + if (*exp != ',') + return 0; } - - return 0; - } SWITCH_DECLARE(int) switch_tod_cmp(const char *exp, int val) From 609c02955f9cda616f5966e58eb094a6f4b8d601 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Sat, 21 Feb 2015 00:49:18 -0600 Subject: [PATCH 83/91] fix the thing the guy mentioned on irc --- src/mod/applications/mod_commands/mod_commands.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index 7215084977..15ceb23ee7 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -3455,7 +3455,11 @@ SWITCH_STANDARD_API(uuid_pre_answer_function) if (uuid && (xsession = switch_core_session_locate(uuid))) { switch_channel_t *channel = switch_core_session_get_channel(xsession); - switch_channel_pre_answer(channel); + if (switch_channel_pre_answer(channel) == SWITCH_STATUS_SUCCESS) { + stream->write_function(stream, "+OK\n"); + } else { + stream->write_function(stream, "-ERROR\n"); + } switch_core_session_rwunlock(xsession); } else { stream->write_function(stream, "-ERROR\n"); From 0a8cc1840b4d5f37cdc6c7bffd0fec726cca2387 Mon Sep 17 00:00:00 2001 From: Peter Olsson Date: Sat, 21 Feb 2015 11:21:27 +0100 Subject: [PATCH 84/91] FS-6520 #comment This should work for VS2013 #resolve --- libs/win32/v8/build-v8.bat | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libs/win32/v8/build-v8.bat b/libs/win32/v8/build-v8.bat index 7dfa758946..21b1af7db6 100644 --- a/libs/win32/v8/build-v8.bat +++ b/libs/win32/v8/build-v8.bat @@ -23,7 +23,13 @@ IF "%1-%2" == "%LAST_BUILD_INFO%" ( SET LIB_DEST_DIR= -IF NOT "%4" == "" ( +IF "%VisualStudioVersion%" == "11.0" ( + SET VS_VERSION=-Gmsvs_version=2012 + ECHO Forcing build to use Visual Studio 2012 +) ELSE IF "%VisualStudioVersion%" == "12.0" ( + SET VS_VERSION=-Gmsvs_version=2013 + ECHO Forcing build to use Visual Studio 2013 +) ELSE IF NOT "%4" == "" ( SET VS_VERSION=-Gmsvs_version=%4 ECHO Forcing build to use Visual Studio %4 ) From 61e250a49b34bc629ec492dacc9ce878cfd8f083 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Sat, 21 Feb 2015 12:11:24 -0600 Subject: [PATCH 85/91] FS-7312 #resolve #comment added feature NEEDS_DOC --- html5/verto/js/src/jquery.jsonrpcclient.js | 10 +++++++--- html5/verto/js/src/jquery.verto.js | 2 ++ src/mod/endpoints/mod_verto/mod_verto.c | 18 ++++++++++++++++++ 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/html5/verto/js/src/jquery.jsonrpcclient.js b/html5/verto/js/src/jquery.jsonrpcclient.js index e6000f084f..9422215921 100644 --- a/html5/verto/js/src/jquery.jsonrpcclient.js +++ b/html5/verto/js/src/jquery.jsonrpcclient.js @@ -71,6 +71,7 @@ login : null, /// auth login passwd : null, /// auth passwd sessid : null, + loginParams : null, getSocket : function(onmessage_cb) { return self._getSocket(onmessage_cb); } }, options); @@ -250,15 +251,18 @@ }; $.JsonRpcClient.prototype.closeSocket = function() { + var self = this; if (self.socketReady()) { - this._ws_socket.onclose = function (w) {console.log("Closing Socket");}; - this._ws_socket.close(); + self._ws_socket.onclose = function (w) {console.log("Closing Socket");}; + self._ws_socket.close(); } }; $.JsonRpcClient.prototype.loginData = function(params) { + var self = this; self.options.login = params.login; self.options.passwd = params.passwd; + self.options.loginParams = params.loginParams; }; $.JsonRpcClient.prototype.connectSocket = function(onmessage_cb) { @@ -418,7 +422,7 @@ if (!self.authing && response.error.code == -32000 && self.options.login && self.options.passwd) { self.authing = true; - this.call("login", { login: self.options.login, passwd: self.options.passwd}, + this.call("login", { login: self.options.login, passwd: self.options.passwd, loginParams: self.options.loginParams}, this._ws_callbacks[response.id].request_obj.method == "login" ? function(e) { self.authing = false; diff --git a/html5/verto/js/src/jquery.verto.js b/html5/verto/js/src/jquery.verto.js index 53deb8feef..9bb5e02ceb 100644 --- a/html5/verto/js/src/jquery.verto.js +++ b/html5/verto/js/src/jquery.verto.js @@ -73,6 +73,7 @@ tag: null, videoParams: {}, audioParams: {}, + loginParams: {}, iceServers: false, ringSleep: 6000 }, options); @@ -90,6 +91,7 @@ login: verto.options.login, passwd: verto.options.passwd, socketUrl: verto.options.socketUrl, + loginParams: verto.options.loginParams, sessid: verto.sessid, onmessage: function(e) { return verto.handleMessage(e.eventData); diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index a61f2a8185..de942f14f5 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -885,6 +885,7 @@ static switch_bool_t check_auth(jsock_t *jsock, cJSON *params, int *code, char * switch_bool_t r = SWITCH_FALSE; const char *passwd = NULL; const char *login = NULL; + cJSON *login_params = NULL; if (!params) { *code = CODE_AUTH_FAILED; @@ -940,6 +941,23 @@ static switch_bool_t check_auth(jsock_t *jsock, cJSON *params, int *code, char * switch_event_create(&req_params, SWITCH_EVENT_REQUEST_PARAMS); switch_assert(req_params); + if ((login_params = cJSON_GetObjectItem(params, "loginParams"))) { + cJSON * i; + + for(i = login_params->child; i; i = i->next) { + if (i->type == cJSON_True) { + switch_event_add_header_string(req_params, SWITCH_STACK_BOTTOM, i->string, "true"); + } else if (i->type == cJSON_False) { + switch_event_add_header_string(req_params, SWITCH_STACK_BOTTOM, i->string, "false"); + } else if (!zstr(i->string) && !zstr(i->valuestring)) { + switch_event_add_header_string(req_params, SWITCH_STACK_BOTTOM, i->string, i->valuestring); + } + } + + DUMP_EVENT(req_params); + + } + switch_event_add_header_string(req_params, SWITCH_STACK_BOTTOM, "action", "jsonrpc-authenticate"); if (switch_xml_locate_user_merged("id", id, domain, NULL, &x_user, req_params) != SWITCH_STATUS_SUCCESS && !jsock->profile->blind_reg) { From 9df39b8fe4f1c0fbfc307e94d2a814802ac01f25 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Sat, 21 Feb 2015 18:17:15 -0600 Subject: [PATCH 86/91] rebuild verto-min --- html5/verto/demo/js/verto-min.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/html5/verto/demo/js/verto-min.js b/html5/verto/demo/js/verto-min.js index 4718b16a03..f8acd1549e 100644 --- a/html5/verto/demo/js/verto-min.js +++ b/html5/verto/demo/js/verto-min.js @@ -60,7 +60,7 @@ return{addAnswerSDP:function(sdp,cbSuccess,cbError){peer.setRemoteDescription(ne var video_constraints={mandatory:{},optional:[]};function getUserMedia(options){var n=navigator,media;n.getMedia=n.webkitGetUserMedia||n.mozGetUserMedia;n.getMedia(options.constraints||{audio:true,video:video_constraints},streaming,options.onerror||function(e){console.error(e);});function streaming(stream){var video=options.video;if(video){video[moz?'mozSrcObject':'src']=moz?stream:window.webkitURL.createObjectURL(stream);} if(options.onsuccess){options.onsuccess(stream);} media=stream;} -return media;}})(jQuery);(function($){$.JsonRpcClient=function(options){var self=this;this.options=$.extend({ajaxUrl:null,socketUrl:null,onmessage:null,login:null,passwd:null,sessid:null,getSocket:function(onmessage_cb){return self._getSocket(onmessage_cb);}},options);self.ws_cnt=0;this.wsOnMessage=function(event){self._wsOnMessage(event);};};$.JsonRpcClient.prototype._ws_socket=null;$.JsonRpcClient.prototype._ws_callbacks={};$.JsonRpcClient.prototype._current_id=1;$.JsonRpcClient.prototype.call=function(method,params,success_cb,error_cb){if(!params){params={};} +return media;}})(jQuery);(function($){$.JsonRpcClient=function(options){var self=this;this.options=$.extend({ajaxUrl:null,socketUrl:null,onmessage:null,login:null,passwd:null,sessid:null,loginParams:null,getSocket:function(onmessage_cb){return self._getSocket(onmessage_cb);}},options);self.ws_cnt=0;this.wsOnMessage=function(event){self._wsOnMessage(event);};};$.JsonRpcClient.prototype._ws_socket=null;$.JsonRpcClient.prototype._ws_callbacks={};$.JsonRpcClient.prototype._current_id=1;$.JsonRpcClient.prototype.call=function(method,params,success_cb,error_cb){if(!params){params={};} if(this.options.sessid){params.sessid=this.options.sessid;} var request={jsonrpc:'2.0',method:method,params:params,id:this._current_id++};if(!success_cb){success_cb=function(e){console.log("Success: ",e);};} if(!error_cb){error_cb=function(e){console.log("Error: ",e);};} @@ -70,7 +70,7 @@ $.ajax({type:'POST',url:this.options.ajaxUrl,data:$.toJSON(request),dataType:'js var request={jsonrpc:'2.0',method:method,params:params};var socket=this.options.getSocket(this.wsOnMessage);if(socket!==null){this._wsCall(socket,request);return;} if(this.options.ajaxUrl===null){throw"$.JsonRpcClient.notify used with no websocket and no http endpoint.";} $.ajax({type:'POST',url:this.options.ajaxUrl,data:$.toJSON(request),dataType:'json',cache:false});};$.JsonRpcClient.prototype.batch=function(callback,all_done_cb,error_cb){var batch=new $.JsonRpcClient._batchObject(this,all_done_cb,error_cb);callback(batch);batch._execute();};$.JsonRpcClient.prototype.socketReady=function(){if(this._ws_socket===null||this._ws_socket.readyState>1){return false;} -return true;};$.JsonRpcClient.prototype.closeSocket=function(){if(self.socketReady()){this._ws_socket.onclose=function(w){console.log("Closing Socket");};this._ws_socket.close();}};$.JsonRpcClient.prototype.loginData=function(params){self.options.login=params.login;self.options.passwd=params.passwd;};$.JsonRpcClient.prototype.connectSocket=function(onmessage_cb){var self=this;if(self.to){clearTimeout(self.to);} +return true;};$.JsonRpcClient.prototype.closeSocket=function(){var self=this;if(self.socketReady()){self._ws_socket.onclose=function(w){console.log("Closing Socket");};self._ws_socket.close();}};$.JsonRpcClient.prototype.loginData=function(params){var self=this;self.options.login=params.login;self.options.passwd=params.passwd;self.options.loginParams=params.loginParams;};$.JsonRpcClient.prototype.connectSocket=function(onmessage_cb){var self=this;if(self.to){clearTimeout(self.to);} if(!self.socketReady()){self.authing=false;if(self._ws_socket){delete self._ws_socket;} self._ws_socket=new WebSocket(self.options.socketUrl);if(self._ws_socket){self._ws_socket.onmessage=onmessage_cb;self._ws_socket.onclose=function(w){if(!self.ws_sleep){self.ws_sleep=1000;} if(self.options.onWSClose){self.options.onWSClose(self);} @@ -78,7 +78,7 @@ console.error("Websocket Lost "+self.ws_cnt+" sleep: "+self.ws_sleep+"msec");sel self.ws_sleep=1000;self.ws_cnt=0;if(self.options.onWSConnect){self.options.onWSConnect(self);} var req;while((req=$.JsonRpcClient.q.pop())){self._ws_socket.send(req);}};}} return self._ws_socket?true:false;};$.JsonRpcClient.prototype._getSocket=function(onmessage_cb){if(this.options.socketUrl===null||!("WebSocket"in window))return null;this.connectSocket(onmessage_cb);return this._ws_socket;};$.JsonRpcClient.q=[];$.JsonRpcClient.prototype._wsCall=function(socket,request,success_cb,error_cb){var request_json=$.toJSON(request);if(socket.readyState<1){self=this;$.JsonRpcClient.q.push(request_json);}else{socket.send(request_json);} -if('id'in request&&typeof success_cb!=='undefined'){this._ws_callbacks[request.id]={request:request_json,request_obj:request,success_cb:success_cb,error_cb:error_cb};}};$.JsonRpcClient.prototype._wsOnMessage=function(event){var response;try{response=$.parseJSON(event.data);if(typeof response==='object'&&'jsonrpc'in response&&response.jsonrpc==='2.0'){if('result'in response&&this._ws_callbacks[response.id]){var success_cb=this._ws_callbacks[response.id].success_cb;delete this._ws_callbacks[response.id];success_cb(response.result,this);return;}else if('error'in response&&this._ws_callbacks[response.id]){var error_cb=this._ws_callbacks[response.id].error_cb;var orig_req=this._ws_callbacks[response.id].request;if(!self.authing&&response.error.code==-32000&&self.options.login&&self.options.passwd){self.authing=true;this.call("login",{login:self.options.login,passwd:self.options.passwd},this._ws_callbacks[response.id].request_obj.method=="login"?function(e){self.authing=false;console.log("logged in");delete self._ws_callbacks[response.id];if(self.options.onWSLogin){self.options.onWSLogin(true,self);}}:function(e){self.authing=false;console.log("logged in, resending request id: "+response.id);var socket=self.options.getSocket(self.wsOnMessage);if(socket!==null){socket.send(orig_req);} +if('id'in request&&typeof success_cb!=='undefined'){this._ws_callbacks[request.id]={request:request_json,request_obj:request,success_cb:success_cb,error_cb:error_cb};}};$.JsonRpcClient.prototype._wsOnMessage=function(event){var response;try{response=$.parseJSON(event.data);if(typeof response==='object'&&'jsonrpc'in response&&response.jsonrpc==='2.0'){if('result'in response&&this._ws_callbacks[response.id]){var success_cb=this._ws_callbacks[response.id].success_cb;delete this._ws_callbacks[response.id];success_cb(response.result,this);return;}else if('error'in response&&this._ws_callbacks[response.id]){var error_cb=this._ws_callbacks[response.id].error_cb;var orig_req=this._ws_callbacks[response.id].request;if(!self.authing&&response.error.code==-32000&&self.options.login&&self.options.passwd){self.authing=true;this.call("login",{login:self.options.login,passwd:self.options.passwd,loginParams:self.options.loginParams},this._ws_callbacks[response.id].request_obj.method=="login"?function(e){self.authing=false;console.log("logged in");delete self._ws_callbacks[response.id];if(self.options.onWSLogin){self.options.onWSLogin(true,self);}}:function(e){self.authing=false;console.log("logged in, resending request id: "+response.id);var socket=self.options.getSocket(self.wsOnMessage);if(socket!==null){socket.send(orig_req);} if(self.options.onWSLogin){self.options.onWSLogin(true,self);}},function(e){console.log("error logging in, request id:",response.id);delete self._ws_callbacks[response.id];error_cb(response.error,this);if(self.options.onWSLogin){self.options.onWSLogin(false,self);}});return;} delete this._ws_callbacks[response.id];error_cb(response.error,this);return;}}}catch(err){console.log("ERROR: "+err);return;} if(typeof this.options.onmessage==='function'){event.eventData=response;if(!event.eventData){event.eventData={};} @@ -93,7 +93,7 @@ for(i=0;i=$.verto.enum.state.active.val){return;} -if(dialog.state.val>=$.verto.enum.state.early.val){dialog.setState($.verto.enum.state.active);}else{if(dialog.gotEarly){console.log("Dialog "+dialog.callID+" Got answer while still establishing early media, delaying...");}else{console.log("Dialog "+dialog.callID+" Answering Channel");dialog.rtc.answer(params.sdp,function(){dialog.setState($.verto.enum.state.active);},function(e){console.error(e);dialog.hangup();});console.log("Dialog "+dialog.callID+"ANSWER SDP",params.sdp);}}};$.verto.dialog.prototype.cidString=function(enc){var dialog=this;var party=dialog.params.remote_caller_id_name+(enc?" <":" <")+dialog.params.remote_caller_id_number+(enc?">":">");return party;};$.verto.dialog.prototype.sendMessage=function(msg,params){var dialog=this;if(dialog.callbacks.onMessage){dialog.callbacks.onMessage(dialog.verto,dialog,msg,params);}};$.verto.dialog.prototype.handleInfo=function(params){var dialog=this;dialog.sendMessage($.verto.enum.message.info,params.msg);};$.verto.dialog.prototype.handleDisplay=function(params){var dialog=this;if(params.display_name){dialog.params.remote_caller_id_name=params.display_name;} +if(dialog.state.val>=$.verto.enum.state.early.val){dialog.setState($.verto.enum.state.active);}else{if(dialog.gotEarly){console.log("Dialog "+dialog.callID+"Got answer while still establishing early media, delaying...");}else{console.log("Dialog "+dialog.callID+"Answering Channel");dialog.rtc.answer(params.sdp,function(){dialog.setState($.verto.enum.state.active);},function(e){console.error(e);dialog.hangup();});console.log("Dialog "+dialog.callID+"ANSWER SDP",params.sdp);}}};$.verto.dialog.prototype.cidString=function(enc){var dialog=this;var party=dialog.params.remote_caller_id_name+(enc?" <":" <")+dialog.params.remote_caller_id_number+(enc?">":">");return party;};$.verto.dialog.prototype.sendMessage=function(msg,params){var dialog=this;if(dialog.callbacks.onMessage){dialog.callbacks.onMessage(dialog.verto,dialog,msg,params);}};$.verto.dialog.prototype.handleInfo=function(params){var dialog=this;dialog.sendMessage($.verto.enum.message.info,params.msg);};$.verto.dialog.prototype.handleDisplay=function(params){var dialog=this;if(params.display_name){dialog.params.remote_caller_id_name=params.display_name;} if(params.display_number){dialog.params.remote_caller_id_number=params.display_number;} dialog.sendMessage($.verto.enum.message.display,{});};$.verto.dialog.prototype.handleMedia=function(params){var dialog=this;if(dialog.state.val>=$.verto.enum.state.early.val){return;} dialog.gotEarly=true;dialog.rtc.answer(params.sdp,function(){console.log("Dialog "+dialog.callID+"Establishing early media");dialog.setState($.verto.enum.state.early);if(dialog.gotAnswer){console.log("Dialog "+dialog.callID+"Answering Channel");dialog.setState($.verto.enum.state.active);}},function(e){console.error(e);dialog.hangup();});console.log("Dialog "+dialog.callID+"EARLY SDP",params.sdp);};$.verto.ENUM=function(s){var i=0,o={};s.split(" ").map(function(x){o[x]={name:x,val:i++};});return Object.freeze(o);};$.verto.enum={};$.verto.enum.states=Object.freeze({new:{requesting:1,recovering:1,ringing:1,destroy:1,answering:1},requesting:{trying:1,hangup:1},recovering:{answering:1,hangup:1},trying:{active:1,early:1,hangup:1},ringing:{answering:1,hangup:1},answering:{active:1,hangup:1},active:{answering:1,requesting:1,hangup:1,held:1},held:{hangup:1,active:1},early:{hangup:1,active:1},hangup:{destroy:1},destroy:{},purge:{destroy:1}});$.verto.enum.state=$.verto.ENUM("new requesting trying recovering ringing answering early active held hangup destroy purge");$.verto.enum.direction=$.verto.ENUM("inbound outbound");$.verto.enum.message=$.verto.ENUM("display info pvtEvent");$.verto.enum=Object.freeze($.verto.enum);$.verto.saved=[];$(window).bind('beforeunload',function(){for(var i in $.verto.saved){var verto=$.verto.saved[i];if(verto){verto.logout();verto.purge();}} From 17585e831a76b9e945f7bda6d2d3cb89c31275f8 Mon Sep 17 00:00:00 2001 From: Brian West Date: Mon, 23 Feb 2015 09:48:08 -0600 Subject: [PATCH 87/91] FS-7307 #resolve dont session log in an api command as there is no session --- src/mod/applications/mod_voicemail/mod_voicemail.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mod/applications/mod_voicemail/mod_voicemail.c b/src/mod/applications/mod_voicemail/mod_voicemail.c index 2f5f1b950c..678f00f366 100644 --- a/src/mod/applications/mod_voicemail/mod_voicemail.c +++ b/src/mod/applications/mod_voicemail/mod_voicemail.c @@ -5712,7 +5712,7 @@ SWITCH_STANDARD_API(vm_fsdb_auth_login_function) switch_event_create(¶ms, SWITCH_EVENT_GENERAL); if (switch_xml_locate_user_merged("id:number-alias", id, domain, NULL, &x_user, params) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Can't find user [%s@%s]\n", id, domain); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Can't find user [%s@%s]\n", id, domain); stream->write_function(stream, "-ERR User not found\n"); } else { switch_xml_t x_param, x_params; @@ -6080,7 +6080,7 @@ SWITCH_STANDARD_API(vm_fsdb_msg_email_function) } switch_simple_email(email, from, header_string, body, switch_event_get_header(cbt.my_params, "VM-Message-File-Path"), profile->convert_cmd, profile->convert_ext); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Sending message to %s\n", email); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Sending message to %s\n", email); switch_safe_free(body); switch_event_fire(&cbt.my_params); From e4f22c82fc8bd07e04b42df49cec07473679d67b Mon Sep 17 00:00:00 2001 From: Italo Rossi Date: Mon, 5 Jan 2015 10:17:25 -0300 Subject: [PATCH 88/91] https://freeswitch.org/jira/browse/FS-7126 fix variable expansion in translate api when there is no session involved. --- .../mod_translate/mod_translate.c | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/mod/applications/mod_translate/mod_translate.c b/src/mod/applications/mod_translate/mod_translate.c index 61feecd36d..b3f9e96ad5 100644 --- a/src/mod/applications/mod_translate/mod_translate.c +++ b/src/mod/applications/mod_translate/mod_translate.c @@ -112,7 +112,7 @@ static switch_status_t load_config(void) return status; } -static void translate_number(char *number, char *profile, char **translated, switch_core_session_t *session, switch_event_t *event) +static void translate_number(char *number, char *profile, char **translated, switch_core_session_t *session, switch_event_t *event, switch_memory_pool_t *pool) { translate_rule_t *hi = NULL; translate_rule_t *rule = NULL; @@ -153,9 +153,11 @@ static void translate_number(char *number, char *profile, char **translated, swi } else if (event) { subbed = switch_event_expand_headers(event, substituted); } - - substituted = switch_core_session_strdup(session, subbed); - + if (session) { + substituted = switch_core_session_strdup(session, subbed); + } else { + substituted = switch_core_strdup(pool, subbed); + } if (subbed != substituted) { switch_safe_free(subbed); } @@ -255,7 +257,7 @@ SWITCH_STANDARD_APP(translate_app_function) } } - translate_number(argv[0], argv[1], &translated, session, event); + translate_number(argv[0], argv[1], &translated, session, event, NULL); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Translated: %s\n", translated); @@ -307,8 +309,8 @@ SWITCH_STANDARD_DIALPLAN(translate_dialplan_hunt) } } - translate_number((char *) caller_profile->destination_number, translate_profile, &translated_dest, session, event); - translate_number((char *) caller_profile->caller_id_number, translate_profile, &translated_cid_num, session, event); + translate_number((char *) caller_profile->destination_number, translate_profile, &translated_dest, session, event, NULL); + translate_number((char *) caller_profile->caller_id_number, translate_profile, &translated_cid_num, session, event, NULL); /* maybe we should translate ani/aniii here too? */ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Profile: [%s] Translated Destination: [%s] Translated CID: [%s]\n", translate_profile, translated_dest, translated_cid_num); @@ -340,12 +342,12 @@ SWITCH_STANDARD_API(translate_function) } switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%s\n", cmd); - mydata = switch_core_strdup(globals.pool, cmd); + mydata = strdup(cmd); if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) { if (!session) { char *areacode = switch_core_get_variable("default_areacode"); - + switch_core_new_memory_pool(&pool); switch_event_create(&event, SWITCH_EVENT_REQUEST_PARAMS); if (zstr(areacode)) { @@ -355,19 +357,21 @@ SWITCH_STANDARD_API(translate_function) switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "areacode", areacode); } } - translate_number(argv[0], argv[1], &translated, session, event); + translate_number(argv[0], argv[1], &translated, session, event, pool); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Translated: %s\n", translated); stream->write_function(stream, "%s", translated); } + free(mydata); end: if (!session) { if (pool) { switch_core_destroy_memory_pool(&pool); } } + return SWITCH_STATUS_SUCCESS; usage: From 320d2eae5253f2a5c7f440e9291d4cc3fab7e3d2 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Mon, 23 Feb 2015 11:51:40 -0500 Subject: [PATCH 89/91] FS-7314 #resolve #comment try to fix openssl configure detection failure caused by broken commit upstream in openssl 1.0.2. I don't have a box with this version of openssl so you'll need to let me know if this doesn't work --- libs/iksemel/openssl.m4 | 2 +- libs/sofia-sip/m4/sac-openssl.m4 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/iksemel/openssl.m4 b/libs/iksemel/openssl.m4 index 8adea2192e..6bf1851021 100644 --- a/libs/iksemel/openssl.m4 +++ b/libs/iksemel/openssl.m4 @@ -33,7 +33,7 @@ else AC_CHECK_LIB(ssl, TLSv1_method,, HAVE_TLS=0 AC_MSG_WARN(OpenSSL protocol library was not found)) - ],[AC_MSG_WARN(OpenSSL include files were not found)]) + ],[AC_MSG_WARN(OpenSSL include files were not found)],[#include ]) fi if test x$HAVE_SSL = x1; then diff --git a/libs/sofia-sip/m4/sac-openssl.m4 b/libs/sofia-sip/m4/sac-openssl.m4 index 7daf7f4773..289d3e132e 100644 --- a/libs/sofia-sip/m4/sac-openssl.m4 +++ b/libs/sofia-sip/m4/sac-openssl.m4 @@ -33,7 +33,7 @@ else AC_CHECK_LIB(ssl, TLSv1_method,, HAVE_TLS=0 AC_MSG_WARN(OpenSSL protocol library was not found)) - ],[AC_MSG_WARN(OpenSSL include files were not found)]) + ],[AC_MSG_WARN(OpenSSL include files were not found)],[#include ]) fi if test x$HAVE_OPENSSL = x1; then From a41505f66b47892e9d5abcc2b6efa8cce0c994da Mon Sep 17 00:00:00 2001 From: Brian West Date: Mon, 23 Feb 2015 16:38:17 -0600 Subject: [PATCH 90/91] FS-7313 #resolve any further issues in this code it will just be removed --- .../applications/mod_voicemail/mod_voicemail.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/mod/applications/mod_voicemail/mod_voicemail.c b/src/mod/applications/mod_voicemail/mod_voicemail.c index 678f00f366..d24fecc6a4 100644 --- a/src/mod/applications/mod_voicemail/mod_voicemail.c +++ b/src/mod/applications/mod_voicemail/mod_voicemail.c @@ -5953,6 +5953,7 @@ SWITCH_STANDARD_API(vm_fsdb_msg_email_function) msg_get_callback_t cbt = { 0 }; char *sql; switch_memory_pool_t *pool; + switch_xml_t x_user = NULL; switch_core_new_memory_pool(&pool); @@ -5972,11 +5973,18 @@ SWITCH_STANDARD_API(vm_fsdb_msg_email_function) if (argv[4]) email = argv[4]; + if (!profile_name || !domain || !id || !uuid || !email) { stream->write_function(stream, "-ERR Missing Arguments\n"); goto done; } + if (switch_xml_locate_user_merged("id", id, domain, NULL, &x_user, NULL) != SWITCH_STATUS_SUCCESS) { + stream->write_function(stream, "-ERR Can't locate user.\n"); + switch_xml_free(x_user); + goto done; + } + if (!(profile = get_profile(profile_name))) { stream->write_function(stream, "-ERR Profile not found\n"); goto done; @@ -5998,6 +6006,7 @@ SWITCH_STANDARD_API(vm_fsdb_msg_email_function) switch_core_time_duration_t duration; char duration_str[80]; char *formatted_cid_num = NULL; + char *msg_uuid = NULL; sql = switch_mprintf("select created_epoch, read_epoch, username, domain, uuid, cid_name, cid_number, in_folder, file_path, message_len, flags, read_flags, forwarded_by from voicemail_msgs WHERE username = '%q' AND domain = '%q' AND uuid = '%q' ORDER BY read_flags, created_epoch", id, domain, uuid); memset(&cbt, 0, sizeof(cbt)); @@ -6005,6 +6014,13 @@ SWITCH_STANDARD_API(vm_fsdb_msg_email_function) vm_execute_sql_callback(profile, profile->mutex, sql, message_get_callback, &cbt); switch_safe_free(sql); + msg_uuid = switch_event_get_header(cbt.my_params, "VM-Message-UUID"); + + if (!msg_uuid) { + profile_rwunlock(profile); + stream->write_function(stream, "-ERR Invalid Message UUID\n"); + goto done; + } if (!strcasecmp(switch_event_get_header(cbt.my_params, "VM-Message-Read-Flags"), URGENT_FLAG_STRING)) { priority = 1; } From 4909cdb7fb658dcaa0f8043afe467b8be5f3e657 Mon Sep 17 00:00:00 2001 From: Brian West Date: Tue, 24 Feb 2015 14:58:26 -0600 Subject: [PATCH 91/91] FS-7322 #resolve --- libs/libzrtp/Makefile.am | 1 - libs/sofia-sip/Makefile.am | 2 +- libs/sofia-sip/s2check/Makefile.am | 2 -- 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/libs/libzrtp/Makefile.am b/libs/libzrtp/Makefile.am index ff5002a69e..2d3b82421d 100644 --- a/libs/libzrtp/Makefile.am +++ b/libs/libzrtp/Makefile.am @@ -4,7 +4,6 @@ # # Viktor Krikun # -AUTOMAKE_OPTIONS = subdir-objects libzrtp_includedir=$(includedir)/libzrtp libzrtp_include_HEADERS = \ diff --git a/libs/sofia-sip/Makefile.am b/libs/sofia-sip/Makefile.am index 3a5bbb0baf..7279695865 100644 --- a/libs/sofia-sip/Makefile.am +++ b/libs/sofia-sip/Makefile.am @@ -5,7 +5,7 @@ # Contact: Pekka Pessi # Licensed under LGPL. See file COPYING. -AUTOMAKE_OPTIONS = foreign 1.7 subdir-objects +AUTOMAKE_OPTIONS = foreign 1.7 SUBDIRS = libsofia-sip-ua $(GLIB_SUBDIRS) packages # tests s2check utils DIST_SUBDIRS = s2check libsofia-sip-ua libsofia-sip-ua-glib utils packages \ diff --git a/libs/sofia-sip/s2check/Makefile.am b/libs/sofia-sip/s2check/Makefile.am index ae4d7502b2..a6332ac681 100644 --- a/libs/sofia-sip/s2check/Makefile.am +++ b/libs/sofia-sip/s2check/Makefile.am @@ -5,8 +5,6 @@ # Contact: Pekka Pessi # Licensed under LGPL. See file COPYING. -AUTOMAKE_OPTIONS = subdir-objects - # ---------------------------------------------------------------------- # Header paths