From a8cb98c7f98055c7d05bf500bb49f88f8e370441 Mon Sep 17 00:00:00 2001 From: Chris Rienzo Date: Tue, 19 Mar 2013 08:59:39 -0400 Subject: [PATCH 1/6] mod_http_cache: added http_cache file format that won't conflict with mod_httapi. --- .../mod_http_cache/mod_http_cache.c | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/mod/applications/mod_http_cache/mod_http_cache.c b/src/mod/applications/mod_http_cache/mod_http_cache.c index 77f93a0d25..6dbb55b1fb 100644 --- a/src/mod/applications/mod_http_cache/mod_http_cache.c +++ b/src/mod/applications/mod_http_cache/mod_http_cache.c @@ -1172,15 +1172,13 @@ struct http_context { /** * Open URL * @param handle - * @param prefix URL prefix * @param path the URL * @return SWITCH_STATUS_SUCCESS if opened */ -static switch_status_t file_open(switch_file_handle_t *handle, const char *prefix, const char *path) +static switch_status_t http_cache_file_open(switch_file_handle_t *handle, const char *path) { switch_status_t status = SWITCH_STATUS_SUCCESS; struct http_context *context = switch_core_alloc(handle->memory_pool, sizeof(*context)); - const char *url = switch_core_sprintf(handle->memory_pool, "%s%s", prefix, path); const char *local_path; if (switch_test_flag(handle, SWITCH_FILE_FLAG_WRITE)) { @@ -1188,7 +1186,7 @@ static switch_status_t file_open(switch_file_handle_t *handle, const char *prefi return SWITCH_STATUS_FALSE; } - local_path = url_cache_get(&gcache, NULL, url, 1, handle->memory_pool); + local_path = url_cache_get(&gcache, NULL, path, 1, handle->memory_pool); if (!local_path) { return SWITCH_STATUS_FALSE; } @@ -1198,7 +1196,7 @@ static switch_status_t file_open(switch_file_handle_t *handle, const char *prefi handle->channels, handle->samplerate, SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL)) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to open HTTP cache file: %s, %s\n", local_path, url); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to open HTTP cache file: %s, %s\n", local_path, path); return status; } @@ -1229,7 +1227,7 @@ static switch_status_t file_open(switch_file_handle_t *handle, const char *prefi */ static switch_status_t http_file_open(switch_file_handle_t *handle, const char *path) { - return file_open(handle, "http://", path); + return http_cache_file_open(handle, switch_core_sprintf(handle->memory_pool, "http://%s", path)); } /** @@ -1240,7 +1238,7 @@ static switch_status_t http_file_open(switch_file_handle_t *handle, const char * */ static switch_status_t https_file_open(switch_file_handle_t *handle, const char *path) { - return file_open(handle, "https://", path); + return http_cache_file_open(handle, switch_core_sprintf(handle->memory_pool, "https://%s", path)); } /** @@ -1269,6 +1267,7 @@ static switch_status_t http_file_close(switch_file_handle_t *handle) static char *http_supported_formats[] = { "http", NULL }; static char *https_supported_formats[] = { "https", NULL }; +static char *http_cache_supported_formats[] = { "http_cache", NULL }; /** * Called when FreeSWITCH loads the module @@ -1277,6 +1276,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_http_cache_load) { switch_api_interface_t *api; int i; + switch_file_interface_t *file_interface; *module_interface = switch_loadable_module_create_module_interface(pool, modname); @@ -1293,8 +1293,15 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_http_cache_load) return SWITCH_STATUS_TERM; } + file_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_FILE_INTERFACE); + file_interface->interface_name = modname; + file_interface->extens = http_cache_supported_formats; + file_interface->file_open = http_cache_file_open; + file_interface->file_close = http_file_close; + file_interface->file_read = http_file_read; + if (gcache.enable_file_formats) { - switch_file_interface_t *file_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_FILE_INTERFACE); + file_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_FILE_INTERFACE); file_interface->interface_name = modname; file_interface->extens = http_supported_formats; file_interface->file_open = http_file_open; From 8afe9f3c3fd3bef6d75d3c0d27384ae0aa093132 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 19 Mar 2013 08:31:52 -0500 Subject: [PATCH 2/6] FS-5196 --resolve --- src/mod/applications/mod_httapi/mod_httapi.c | 42 +++++++++++++++----- 1 file changed, 31 insertions(+), 11 deletions(-) diff --git a/src/mod/applications/mod_httapi/mod_httapi.c b/src/mod/applications/mod_httapi/mod_httapi.c index 5c782fe090..75d896db45 100644 --- a/src/mod/applications/mod_httapi/mod_httapi.c +++ b/src/mod/applications/mod_httapi/mod_httapi.c @@ -2690,12 +2690,11 @@ static switch_status_t http_file_file_seek(switch_file_handle_t *handle, unsigne return switch_core_file_seek(&context->fh, cur_sample, samples, whence); } -static switch_status_t http_file_file_open(switch_file_handle_t *handle, const char *path) +static switch_status_t file_open(switch_file_handle_t *handle, const char *path, int is_https) { http_file_context_t *context; char *parsed = NULL, *pdup = NULL; const char *pa = NULL; - int is_https = 0; switch_status_t status; if (!strncmp(path, "http://", 7)) { @@ -2818,6 +2817,14 @@ static switch_status_t http_file_file_open(switch_file_handle_t *handle, const c return SWITCH_STATUS_SUCCESS; } +static switch_status_t http_file_file_open(switch_file_handle_t *handle, const char *path) { + return file_open(handle, path, 0); +} + +static switch_status_t https_file_file_open(switch_file_handle_t *handle, const char *path) { + return file_open(handle, path, 1); +} + static switch_status_t http_file_file_close(switch_file_handle_t *handle) { http_file_context_t *context = handle->private_info; @@ -2904,6 +2911,7 @@ static switch_status_t http_file_file_read(switch_file_handle_t *handle, void *d /* Registration */ static char *http_file_supported_formats[SWITCH_MAX_CODECS] = { 0 }; +static char *https_file_supported_formats[SWITCH_MAX_CODECS] = { 0 }; /* /HTTP FILE INTERFACE */ @@ -2912,7 +2920,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_httapi_load) { switch_api_interface_t *httapi_api_interface; switch_application_interface_t *app_interface; - switch_file_interface_t *file_interface; + switch_file_interface_t *http_file_interface; + switch_file_interface_t *https_file_interface; /* connect my internal structure to the blank pointer passed to me */ *module_interface = switch_loadable_module_create_module_interface(pool, modname); @@ -2927,14 +2936,25 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_httapi_load) http_file_supported_formats[0] = "http"; - file_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_FILE_INTERFACE); - file_interface->interface_name = modname; - file_interface->extens = http_file_supported_formats; - file_interface->file_open = http_file_file_open; - file_interface->file_close = http_file_file_close; - file_interface->file_read = http_file_file_read; - file_interface->file_write = http_file_write; - file_interface->file_seek = http_file_file_seek; + http_file_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_FILE_INTERFACE); + http_file_interface->interface_name = modname; + http_file_interface->extens = http_file_supported_formats; + http_file_interface->file_open = http_file_file_open; + http_file_interface->file_close = http_file_file_close; + http_file_interface->file_read = http_file_file_read; + http_file_interface->file_write = http_file_write; + http_file_interface->file_seek = http_file_file_seek; + + https_file_supported_formats[0] = "https"; + + https_file_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_FILE_INTERFACE); + https_file_interface->interface_name = modname; + https_file_interface->extens = https_file_supported_formats; + https_file_interface->file_open = https_file_file_open; + https_file_interface->file_close = http_file_file_close; + https_file_interface->file_read = http_file_file_read; + https_file_interface->file_write = http_file_write; + https_file_interface->file_seek = http_file_file_seek; switch_snprintf(globals.cache_path, sizeof(globals.cache_path), "%s%shttp_file_cache", SWITCH_GLOBAL_dirs.storage_dir, SWITCH_PATH_SEPARATOR); switch_dir_make_recursive(globals.cache_path, SWITCH_DEFAULT_DIR_PERMS, pool); From c7fcf8c3c694d39719390f10109d625166ac7a86 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 19 Mar 2013 08:39:19 -0500 Subject: [PATCH 3/6] FS-5200 --resolve this patch did not apply please be up to date with latest HEAD when generating patches --- src/mod/applications/mod_httapi/mod_httapi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/applications/mod_httapi/mod_httapi.c b/src/mod/applications/mod_httapi/mod_httapi.c index 75d896db45..9a329e7cfc 100644 --- a/src/mod/applications/mod_httapi/mod_httapi.c +++ b/src/mod/applications/mod_httapi/mod_httapi.c @@ -2604,7 +2604,7 @@ static switch_status_t locate_url_file(http_file_context_t *context, const char if (switch_strcasecmp_any(ct, "audio/mpeg", "audio/x-mpeg", "audio/mp3", "audio/x-mp3", "audio/mpeg3", "audio/x-mpeg3", "audio/mpg", "audio/x-mpg", "audio/x-mpegaudio", NULL)) { newext = "mp3"; - } else if (switch_strcasecmp_any(ct, "audio/wav", "audio/x-wave", "audio/wav", NULL)) { + } else if (switch_strcasecmp_any(ct, "audio/wav", "audio/x-wave", "audio/wav", "audio/wave", NULL)) { newext = "wav"; } } From 43b3a98b09c6092b8b5b245cbaa6b48be978c4f8 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 19 Mar 2013 08:51:20 -0500 Subject: [PATCH 4/6] FS-5011 please update and retest with new logs --- src/switch_core_io.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/switch_core_io.c b/src/switch_core_io.c index 4298942eb6..f936985737 100644 --- a/src/switch_core_io.c +++ b/src/switch_core_io.c @@ -339,6 +339,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi if (tap_only) { need_codec = 0; + do_resample = 0; + do_bugs = 0; } From de9714d7721b185f21c53c6df41b6cb63467d332 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 19 Mar 2013 09:16:36 -0500 Subject: [PATCH 5/6] FS-5194 --resolve --- src/switch_ivr_originate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index e273e76ed6..d1e3c37649 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -2372,7 +2372,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess or_argc = 1; } - for (r = 0; r < or_argc; r++) { + for (r = 0; r < or_argc && (!cancel_cause || *cancel_cause == 0); r++) { char *p, *end = NULL; int q = 0, alt = 0; From 20110f456930425e309f7f8c9367547665b58b05 Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Tue, 19 Mar 2013 14:32:03 -0400 Subject: [PATCH 6/6] Freetdm - ISDN:Fix for race condition where we receive a new call, and did not finish clearing existing call internally. --- .../ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c index c2d18f01a9..b414d4dfb1 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c @@ -210,7 +210,9 @@ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event) } break; case FTDM_CHANNEL_STATE_TERMINATING: - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_INFO, "Processing SETUP in TERMINATING state, saving SETUP info for later processing\n"); + case FTDM_CHANNEL_STATE_HANGUP: + case FTDM_CHANNEL_STATE_HANGUP_COMPLETE: + ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Processing SETUP in %s state, saving SETUP info for later processing\n", ftdm_channel_state2str(ftdmchan->state)); ftdm_assert(!sngisdn_test_flag(sngisdn_info, FLAG_GLARE), "Trying to save GLARE info, but we already had a glare\n"); sngisdn_set_flag(sngisdn_info, FLAG_GLARE);