mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-14 08:05:37 +00:00
Merge branch 'master' of fs-git:freeswitch
This commit is contained in:
commit
2b8b6cef0c
@ -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);
|
||||
|
@ -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";
|
||||
}
|
||||
}
|
||||
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user