From 35e4c978ce625eb9b57a72b225540c0e87a23875 Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Sun, 1 Feb 2015 11:25:06 +0530 Subject: [PATCH 01/21] Do not autoload mod_v8 in the default config [FS-7263] mod_v8 is commented out in modules.conf (possibly because it requires v8 development files installed), but is present in modules.conf. This commit updates modules.conf.xml to reflect the defaults present in modules.conf and not try and autoload mod_v8. With this change, the spurious warning during start up goes away. --- conf/vanilla/autoload_configs/modules.conf.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/vanilla/autoload_configs/modules.conf.xml b/conf/vanilla/autoload_configs/modules.conf.xml index 092372d68c..1940561ec0 100644 --- a/conf/vanilla/autoload_configs/modules.conf.xml +++ b/conf/vanilla/autoload_configs/modules.conf.xml @@ -110,7 +110,7 @@ - + From 30917dd19c84ed2b15c2a5ae12e28c5587f895e2 Mon Sep 17 00:00:00 2001 From: Chris Rienzo Date: Wed, 11 Feb 2015 11:55:46 -0500 Subject: [PATCH 02/21] 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 03/21] 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 04/21] 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 05/21] 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 06/21] 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 07/21] 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 08/21] 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 09/21] 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 10/21] 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 11/21] 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 12/21] 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 13/21] 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 95e59e651a5138ed2f294e54e74d8f5df4709ac5 Mon Sep 17 00:00:00 2001 From: Brian West Date: Mon, 16 Feb 2015 09:17:20 -0600 Subject: [PATCH 14/21] 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 7cf5a846348020a2f6fcc7614ef10c2296d8ec9d Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 16 Feb 2015 16:06:43 -0600 Subject: [PATCH 15/21] 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 16/21] 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 17/21] 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 18/21] 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 19/21] 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 20/21] 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 21/21] 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");