From a0d6b642fff4fddf1bd62f39ccf952891c7817e3 Mon Sep 17 00:00:00 2001 From: Daniel Weber Date: Wed, 24 Sep 2014 10:16:35 +0200 Subject: [PATCH 1/7] Fix ManagedEsl.2012.csproj: There is no file 'ESLconnection.2010.cs'. --- libs/esl/managed/ManagedEsl.2012.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/esl/managed/ManagedEsl.2012.csproj b/libs/esl/managed/ManagedEsl.2012.csproj index 732b707988..f08c560db2 100644 --- a/libs/esl/managed/ManagedEsl.2012.csproj +++ b/libs/esl/managed/ManagedEsl.2012.csproj @@ -58,7 +58,7 @@ - + From 412f2148095e8b7c592ebf41d97aa0ec7f1ef82f Mon Sep 17 00:00:00 2001 From: Thomas Kleffel Date: Tue, 14 Oct 2014 22:31:40 +0200 Subject: [PATCH 2/7] Fix url encoding for snom remote commands (required to make # key work) --- src/mod/applications/mod_snom/mod_snom.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/mod/applications/mod_snom/mod_snom.c b/src/mod/applications/mod_snom/mod_snom.c index 81e51a7688..f2462ade32 100644 --- a/src/mod/applications/mod_snom/mod_snom.c +++ b/src/mod/applications/mod_snom/mod_snom.c @@ -116,8 +116,10 @@ SWITCH_STANDARD_API(snom_command_api_function) { int argc; long httpRes = 0; + char *key = NULL; char *url = NULL; char *argv[5] = { 0 }; + char host[32]; char *argdata = NULL; char *userpwd = NULL; char *apiresp = NULL; @@ -141,10 +143,9 @@ SWITCH_STANDARD_API(snom_command_api_function) } if (switch_inet_pton(AF_INET, argv[0], &ip)) { - url = switch_mprintf("http://%s/command.htm?%s=%s",argv[0],argv[1],argv[2]); + strncpy(host, argv[0], sizeof(host)); } else { char *sql = NULL; - char buf[32]; char *ret = NULL; switch_cache_db_handle_t *db = NULL; switch_stream_handle_t apistream = { 0 }; @@ -173,7 +174,7 @@ SWITCH_STANDARD_API(snom_command_api_function) sql = switch_mprintf("select network_ip from registrations where url = '%s'", apiresp); - ret = switch_cache_db_execute_sql2str(db, sql, buf, sizeof(buf), NULL); + ret = switch_cache_db_execute_sql2str(db, sql, host, sizeof(host), NULL); switch_safe_free(sql); switch_cache_db_release_db_handle(&db); @@ -181,11 +182,14 @@ SWITCH_STANDARD_API(snom_command_api_function) stream->write_function(stream, "%s", "-ERR Query '%s' failed!\n", sql); goto end; } - - url = switch_mprintf("http://%s/command.htm?%s=%s",buf,argv[1],argv[2]); } curl_handle = curl_easy_init(); + + key = curl_easy_escape(curl_handle, argv[2], 0); + url = switch_mprintf("http://%s/command.htm?%s=%s", host, argv[1], key); + curl_free(key); + curl_easy_setopt(curl_handle, CURLOPT_HTTPGET, 1); curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, curl_callback); curl_easy_setopt(curl_handle, CURLOPT_URL, url); From f5f6d15709427a1f8125b538fd4f753188bb3e16 Mon Sep 17 00:00:00 2001 From: Thomas Kleffel Date: Tue, 14 Oct 2014 23:26:48 +0200 Subject: [PATCH 3/7] add command 'action' with types 'reboot', 'reset', 'dialeddel', 'misseddel', 'receiveddel' --- src/mod/applications/mod_snom/mod_snom.c | 30 ++++++++++++++++++++---- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/src/mod/applications/mod_snom/mod_snom.c b/src/mod/applications/mod_snom/mod_snom.c index f2462ade32..5aa274e640 100644 --- a/src/mod/applications/mod_snom/mod_snom.c +++ b/src/mod/applications/mod_snom/mod_snom.c @@ -137,8 +137,8 @@ SWITCH_STANDARD_API(snom_command_api_function) goto end; } - if (strcasecmp(argv[1],"key")) { - stream->write_function(stream, "-ERR only KEY command allowed at the moment\n"); + if (strcasecmp(argv[1],"key") && strcasecmp(argv[1],"action")) { + stream->write_function(stream, "-ERR only key or action commands allowed at the moment\n"); goto end; } @@ -186,9 +186,29 @@ SWITCH_STANDARD_API(snom_command_api_function) curl_handle = curl_easy_init(); - key = curl_easy_escape(curl_handle, argv[2], 0); - url = switch_mprintf("http://%s/command.htm?%s=%s", host, argv[1], key); - curl_free(key); + if (0 == strcasecmp(argv[1],"key")) { + key = curl_easy_escape(curl_handle, argv[2], 0); + url = switch_mprintf("http://%s/command.htm?key=%s", host, key); + curl_free(key); + } + + if (0 == strcasecmp(argv[1],"action")) { + if (0 == strcasecmp(argv[2],"reboot")) { + url = switch_mprintf("http://%s/advanced_update.htm?reboot=Reboot", host); + } else if (0 == strcasecmp(argv[2],"reset")) { + url = switch_mprintf("http://%s/advanced_update.htm?reset=Reset", host); + } else if (0 == strcasecmp(argv[2],"dialeddel")) { + url = switch_mprintf("http://%s/index.htm?dialeddel=0", host); + } else if (0 == strcasecmp(argv[2],"misseddel")) { + url = switch_mprintf("http://%s/index.htm?misseddel=0", host); + } else if (0 == strcasecmp(argv[2],"receiveddel")) { + url = switch_mprintf("http://%s/index.htm?receiveddel=0", host); + } else { + stream->write_function(stream, "-ERR action '%s' not supported (supported actions are reboot, reset, dialeddel, misseddel, receiveddel)\n", argv[2]); + curl_easy_cleanup(curl_handle); + goto end; + } + } curl_easy_setopt(curl_handle, CURLOPT_HTTPGET, 1); curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, curl_callback); From 3cd0400d3891ea409f585fb980bb931cabc7bf94 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 16 Oct 2014 10:58:55 -0500 Subject: [PATCH 4/7] FS-6849 #resolve #comment scripts need to have 'from freeswitch import *' at the top. I added it explicitly to compensate. --- src/mod/languages/mod_python/mod_python.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mod/languages/mod_python/mod_python.c b/src/mod/languages/mod_python/mod_python.c index af53ab2107..b27035ca98 100644 --- a/src/mod/languages/mod_python/mod_python.c +++ b/src/mod/languages/mod_python/mod_python.c @@ -250,6 +250,8 @@ static void eval_some_python(const char *funcname, char *args, switch_core_sessi goto done_swap_out; } + PyRun_SimpleString("from freeswitch import *"); + if (session) { sp = mod_python_conjure_session(module, session); } From 6b42e5a231db8ee00fb38658fb33f63ae9332e87 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 16 Oct 2014 11:36:59 -0500 Subject: [PATCH 5/7] FS-6849 #comment change to 'import freeswitch' to only load it --- src/mod/languages/mod_python/mod_python.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/languages/mod_python/mod_python.c b/src/mod/languages/mod_python/mod_python.c index b27035ca98..c9bd2724ec 100644 --- a/src/mod/languages/mod_python/mod_python.c +++ b/src/mod/languages/mod_python/mod_python.c @@ -250,7 +250,7 @@ static void eval_some_python(const char *funcname, char *args, switch_core_sessi goto done_swap_out; } - PyRun_SimpleString("from freeswitch import *"); + PyRun_SimpleString("import freeswitch"); if (session) { sp = mod_python_conjure_session(module, session); From 3bdbdd4abf691799ea979cc72155a7d80d36f242 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 16 Oct 2014 14:39:59 -0500 Subject: [PATCH 6/7] revert cff5209ca3582994dae1353372e2f91b345ab959 --- src/mod/endpoints/mod_sofia/sofia.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 054b656db6..21f4aa1c90 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -9018,8 +9018,6 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia switch_xml_free(x_user); } - nua_handle_destroy(nh); - if (sip->sip_authorization || sip->sip_proxy_authorization) { goto fail; } From 2e1040733686e9117a41a0215762f3e84f49903c Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 16 Oct 2014 16:04:15 -0500 Subject: [PATCH 7/7] actual fix for commit cff5209ca3582994dae1353372e2f91b345ab959 which was in the wrong place --- src/mod/endpoints/mod_sofia/sofia.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 21f4aa1c90..e93f0cc8a9 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -2073,6 +2073,7 @@ void sofia_event_callback(nua_event_t event, switch_mutex_lock(profile->flag_mutex); switch_core_hash_insert(profile->chat_hash, tech_pvt->call_id, strdup(switch_core_session_get_uuid(session))); switch_mutex_unlock(profile->flag_mutex); + nua_handle_destroy(nh); } else { switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); }