Merge branch 'master' of ssh://freeswitch.org:7999/fs/freeswitch
This commit is contained in:
commit
ac17d86d92
|
@ -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)
|
||||
|
|
|
@ -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-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
|
||||
|
|
|
@ -110,7 +110,7 @@
|
|||
<!-- <load module="mod_posix_timer"/> -->
|
||||
|
||||
<!-- Languages -->
|
||||
<load module="mod_v8"/>
|
||||
<!-- <load module="mod_v8"/> -->
|
||||
<!-- <load module="mod_perl"/> -->
|
||||
<!-- <load module="mod_python"/> -->
|
||||
<!-- <load module="mod_java"/> -->
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
|
||||
AM_CFLAGS = $(COMP_VENDOR_CFLAGS)
|
||||
AM_LDFLAGS = $(COMP_VENDOR_LDFLAGS)
|
||||
AUTOMAKE_OPTIONS = subdir-objects
|
||||
|
||||
noinst_SCRIPTS = broadvoice.spec
|
||||
|
||||
|
|
|
@ -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 \
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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 ;
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
Wed Jan 7 11:24:56 PST 2015
|
||||
Wed Feb 11 12:35:25 EST 2015
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -87,7 +87,7 @@ if not exist "$(ProjectDir)$(IntDir)\auth_client.obj" "autogen.cmd"
|
|||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\..\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)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;IN_LIBSOFIA_SIP_UA_STATIC;LIBSOFIA_SIP_UA_STATIC;LIBSRES_STATIC;PTW32_STATIC_LIB;HAVE_IPHLPAPI_H;SU_DEBUG=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<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)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
|
@ -124,7 +124,7 @@ if not exist "$(ProjectDir)$(IntDir)\auth_client.obj" "autogen.cmd"
|
|||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\..\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)</AdditionalIncludeDirectories>
|
||||
<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;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<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)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
|
@ -159,7 +159,7 @@ if not exist "$(ProjectDir)$(IntDir)\auth_client.obj" "autogen.cmd"
|
|||
<Optimization>MaxSpeed</Optimization>
|
||||
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
|
||||
<AdditionalIncludeDirectories>..\..\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)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;IN_LIBSOFIA_SIP_UA_STATIC;LIBSOFIA_SIP_UA_STATIC;LIBSRES_STATIC;PTW32_STATIC_LIB;HAVE_IPHLPAPI_H;SU_DEBUG=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<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)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
|
@ -197,7 +197,7 @@ if not exist "$(ProjectDir)$(IntDir)\auth_client.obj" "autogen.cmd"
|
|||
<Optimization>MaxSpeed</Optimization>
|
||||
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
|
||||
<AdditionalIncludeDirectories>..\..\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)</AdditionalIncludeDirectories>
|
||||
<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;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<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)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
|
||||
* Copyright (C) 2005-2015, Anthony Minessale II <anthm@freeswitch.org>
|
||||
*
|
||||
* 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;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
* Copyright (C) 2009-2014, Anthony Minessale II <anthm@freeswitch.org>
|
||||
* Copyright (C) 2009-2015, Anthony Minessale II <anthm@freeswitch.org>
|
||||
*
|
||||
* 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;
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 <grammar>";
|
||||
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");
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -73,7 +73,7 @@ alias emcas='emacs'
|
|||
alias meacs='emacs'
|
||||
alias mecas='emacs'
|
||||
alias bgit='git commit --author "Brian West <brian@freeswitch.org>"'
|
||||
alias mgit='git commit --author "Mike Jerris <mike@freeswitch.org>"'
|
||||
alias mgit='git commit --author "Mike Jerris <mike@jerris.com>"'
|
||||
alias tgit='git commit --author "Anthony Minessale <anthm@freeswitch.org>"'
|
||||
alias dp='emacs /usr/local/freeswitch/conf/dialplan/default.xml'
|
||||
alias go='/usr/local/freeswitch/bin/freeswitch -nonat'
|
||||
|
|
Loading…
Reference in New Issue