From 83acda04131c17469fd0fbe0cb4597c15466bfe5 Mon Sep 17 00:00:00 2001 From: Tamas Cseke Date: Thu, 2 Oct 2014 09:16:01 +0200 Subject: [PATCH 01/95] file_string write failover FS-4930 --- .../applications/mod_dptools/mod_dptools.c | 86 ++++++++++++++++++- 1 file changed, 82 insertions(+), 4 deletions(-) diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index 2127787e37..fc515a50e0 100644 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -4483,25 +4483,33 @@ SWITCH_STANDARD_APP(limit_hash_execute_function) /* for apr_pstrcat */ #define DEFAULT_PREBUFFER_SIZE 1024 * 64 -struct file_string_source; +struct file_string_audio_col { + switch_audio_col_t col; + char *value; + struct file_string_audio_col *next; +}; + +typedef struct file_string_audio_col file_string_audio_col_t; struct file_string_context { + char *file; char *argv[128]; int argc; int index; int samples; switch_file_handle_t fh; + file_string_audio_col_t *audio_cols; }; typedef struct file_string_context file_string_context_t; - static switch_status_t next_file(switch_file_handle_t *handle) { file_string_context_t *context = handle->private_info; char *file; const char *prefix = handle->prefix; - + switch_status_t status = SWITCH_STATUS_SUCCESS; + top: context->index++; @@ -4544,6 +4552,11 @@ static switch_status_t next_file(switch_file_handle_t *handle) } if (switch_core_file_open(&context->fh, file, handle->channels, handle->samplerate, handle->flags, NULL) != SWITCH_STATUS_SUCCESS) { + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't open file %s\n", file); + if (switch_test_flag(handle, SWITCH_FILE_FLAG_WRITE)) { + switch_file_remove(file, handle->memory_pool); + } goto top; } @@ -4553,6 +4566,39 @@ static switch_status_t next_file(switch_file_handle_t *handle) handle->dbuf = NULL; } + if (switch_test_flag(handle, SWITCH_FILE_FLAG_WRITE)) { + file_string_audio_col_t *col_ptr = context->audio_cols; + + while (col_ptr) { + switch_core_file_set_string(&context->fh, col_ptr->col, col_ptr->value); + col_ptr = col_ptr->next; + } + + if (context->file && switch_test_flag(handle, SWITCH_FILE_DATA_SHORT)) { /* TODO handle other data type flags */ + switch_size_t len; + uint16_t buf[SWITCH_RECOMMENDED_BUFFER_SIZE] = { 0 }; + switch_status_t status; + switch_file_handle_t fh = { 0 }; + + if ((status = switch_core_file_open(&fh, context->file, handle->channels, handle->samplerate, + SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL)) == SWITCH_STATUS_SUCCESS) { + do { + len = SWITCH_RECOMMENDED_BUFFER_SIZE / handle->channels; + if ((status = switch_core_file_read(&fh, buf, &len)) == SWITCH_STATUS_SUCCESS) { + status = switch_core_file_write(&context->fh, buf, &len); + } + } while (status == SWITCH_STATUS_SUCCESS); + + switch_core_file_close(&fh); + switch_file_remove(context->file, handle->memory_pool); + + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't open %s\n", context->file); + } + } + } + context->file = file; + handle->samples = context->fh.samples; handle->cur_samplerate = context->fh.samplerate; handle->cur_channels = context->fh.real_channels; @@ -4577,7 +4623,7 @@ static switch_status_t next_file(switch_file_handle_t *handle) } } - return SWITCH_STATUS_SUCCESS; + return status; } @@ -4626,6 +4672,36 @@ static switch_status_t file_string_file_close(switch_file_handle_t *handle) return SWITCH_STATUS_SUCCESS; } +static switch_status_t file_string_file_set_string(switch_file_handle_t *handle, switch_audio_col_t col, const char *string) +{ + file_string_context_t *context = handle->private_info; + file_string_audio_col_t *col_ptr = context->audio_cols; + + while (col_ptr && col != col_ptr->col) { + col_ptr = col_ptr->next; + } + + if (col_ptr) { + col_ptr->value = switch_core_strdup(handle->memory_pool, string); + } else { + col_ptr = switch_core_alloc(handle->memory_pool, sizeof(*col_ptr)); + col_ptr->value = switch_core_strdup(handle->memory_pool, string); + col_ptr->col = col; + col_ptr->next = context->audio_cols; + context->audio_cols = col_ptr; + } + + return switch_core_file_set_string(&context->fh, col, string); +} + +static switch_status_t file_string_file_get_string(switch_file_handle_t *handle, switch_audio_col_t col, const char **string) +{ + file_string_context_t *context = handle->private_info; + + return switch_core_file_get_string(&context->fh, col, string); +} + + static switch_status_t file_string_file_read(switch_file_handle_t *handle, void *data, size_t *len) { file_string_context_t *context = handle->private_info; @@ -5644,6 +5720,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load) file_interface->file_read = file_string_file_read; file_interface->file_write = file_string_file_write; file_interface->file_seek = file_string_file_seek; + file_interface->file_set_string = file_string_file_set_string; + file_interface->file_get_string = file_string_file_get_string; file_url_supported_formats[0] = "file"; From 79de78a0fba1bd8379667b6cae73db00288f760e Mon Sep 17 00:00:00 2001 From: Brian West Date: Wed, 19 Nov 2014 21:51:09 -0600 Subject: [PATCH 02/95] FS-7021 #resolve --- src/switch_ivr_originate.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index 10130dc224..65d3b0c496 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -2458,6 +2458,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess switch_ivr_sleep(oglobals.session, sleep_ms, SWITCH_TRUE, NULL); if (!switch_channel_ready(caller_channel)) { status = SWITCH_STATUS_FALSE; + /* set try and retries to 0 */ + try = 0; + retries = 0; goto done; } } else { From 1f1103143dc5ebd81040f871f3143b37fad85ba9 Mon Sep 17 00:00:00 2001 From: Steven Ayre Date: Thu, 20 Nov 2014 18:40:01 +0000 Subject: [PATCH 03/95] FS-7019 add support for building on ubuntu trusty and utopic --- debian/bootstrap.sh | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index b179f594c0..33adae6095 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -7,7 +7,9 @@ conf_dir="../conf" lang_dir="../conf/vanilla/lang" fs_description="FreeSWITCH is a scalable open source cross-platform telephony platform designed to route and interconnect popular communication protocols using audio, video, text or any other form of media." mod_build_depends="." mod_depends="." mod_recommends="." mod_suggests="." -supported_distros="squeeze wheezy jessie sid" +supported_debian_distros="squeeze wheezy jessie sid" +supported_ubuntu_distros="trusty utopic" +supported_distros=" $supported_debian_distros $supported_ubuntu_distros " avoid_mods=( applications/mod_limit applications/mod_mongo @@ -50,6 +52,10 @@ avoid_mods_squeeze=( formats/mod_vlc languages/mod_managed ) +avoid_mods_trusty=( +) +avoid_mods_utopic=( +) manual_pkgs=( freeswitch-all freeswitch @@ -277,9 +283,11 @@ list_freeswitch_all_dbg_replaces () { print_source_control () { local libtool_dep="libtool, libtool-bin" - if test "$codename" = wheezy || test "$codename" = squeeze; then - libtool_dep="libtool" - fi + case "$codename" in + squeeze|wheezy|trusty) + libtool_dep="libtool" + ;; + esac cat < Date: Wed, 19 Nov 2014 20:28:23 +0000 Subject: [PATCH 04/95] FS-7019 build error on utopic (lber_types.h: No such file or directory) --- debian/bootstrap.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index 33adae6095..1502bc9271 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -55,6 +55,7 @@ avoid_mods_squeeze=( avoid_mods_trusty=( ) avoid_mods_utopic=( + directories/mod_ldap ) manual_pkgs=( freeswitch-all From de902011018b09a9382f595f8ddba76423fdd379 Mon Sep 17 00:00:00 2001 From: Steven Ayre Date: Fri, 21 Nov 2014 01:28:38 +0000 Subject: [PATCH 05/95] FS-7019 full list of distributions to target based on distribution autodetection --- debian/util.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/debian/util.sh b/debian/util.sh index a7cb4dc400..3e42ab90e9 100755 --- a/debian/util.sh +++ b/debian/util.sh @@ -385,7 +385,16 @@ build_all () { done shift $(($OPTIND-1)) [ -n "$archs" ] || archs="amd64 i386" - [ -n "$distros" ] || distros="sid jessie wheezy" + if [ -z "$distros" ]; then + case "$(lsb_release -is)" in + Ubuntu) + distros="utopic trusty" + ;; + *) # default to assuming Debian + distros="sid jessie wheezy" + ;; + esac + fi ! $depinst || aptitude install -y \ rsync git less cowbuilder ccache \ devscripts equivs build-essential From a45dca3e0d460780260db7d9d5e9fd8cd40b92df Mon Sep 17 00:00:00 2001 From: Steven Ayre Date: Fri, 21 Nov 2014 01:32:59 +0000 Subject: [PATCH 06/95] FS-7019 add note on how to build on Ubuntu --- debian/README.source | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/debian/README.source b/debian/README.source index f067c0ebe4..b2cd1bb3a9 100644 --- a/debian/README.source +++ b/debian/README.source @@ -72,6 +72,16 @@ will generate packages for all supported Debian releases. Simply run: ./debian/util.sh build-all -ibn -z9 +Building on Ubuntu +------------------ + +Building on supported Ubuntu releases requires the main and universe +APT components in the pbuilder chroot. You should enable the universe +component in your system's APT sources.list and use the -t option to +use your system sources in the chroot: + + ./debian/util.sh build-all -ibn -z9 -t + Building only some modules -------------------------- From a6401813a133d2f08ff9c465f8ae50b3a1dba8a4 Mon Sep 17 00:00:00 2001 From: Steven Ayre Date: Fri, 21 Nov 2014 17:59:56 +0000 Subject: [PATCH 07/95] FS-7019 detect debian explicitly, error on unknown distribution --- debian/util.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/debian/util.sh b/debian/util.sh index 3e42ab90e9..7452be5591 100755 --- a/debian/util.sh +++ b/debian/util.sh @@ -390,9 +390,13 @@ build_all () { Ubuntu) distros="utopic trusty" ;; - *) # default to assuming Debian + Debian) distros="sid jessie wheezy" ;; + *) + echo "Unknown distribution" + exit -1 + ;; esac fi ! $depinst || aptitude install -y \ From 0822f6a0200662bb01576fb3a0ce923acd9596a6 Mon Sep 17 00:00:00 2001 From: Steven Ayre Date: Fri, 21 Nov 2014 18:44:20 +0000 Subject: [PATCH 08/95] FS-7019 swap debian/ubuntu autodetection order --- debian/util.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/debian/util.sh b/debian/util.sh index 7452be5591..f024a8c9c0 100755 --- a/debian/util.sh +++ b/debian/util.sh @@ -387,12 +387,12 @@ build_all () { [ -n "$archs" ] || archs="amd64 i386" if [ -z "$distros" ]; then case "$(lsb_release -is)" in - Ubuntu) - distros="utopic trusty" - ;; Debian) distros="sid jessie wheezy" ;; + Ubuntu) + distros="utopic trusty" + ;; *) echo "Unknown distribution" exit -1 From 32c27b3b1bac2648964d01a0a70d6fdcb5ed9768 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 24 Nov 2014 16:32:38 -0600 Subject: [PATCH 09/95] missing deb --- build/Makefile.centos6 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/Makefile.centos6 b/build/Makefile.centos6 index 89f221335a..bcacb69f49 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 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 +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 freeswitch: deps has-git freeswitch.git/Makefile cd freeswitch.git && make From 0d636aff160bf6dc970708f8b0963b7e98f60b92 Mon Sep 17 00:00:00 2001 From: Chris Rienzo Date: Mon, 24 Nov 2014 10:38:11 -0500 Subject: [PATCH 10/95] FS-7031 [unimrcp] revert configure.gnu change- doesn't work when using non-source build dir. --- libs/unimrcp/configure.gnu | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libs/unimrcp/configure.gnu b/libs/unimrcp/configure.gnu index c8aef238bc..0427ff27c6 100755 --- a/libs/unimrcp/configure.gnu +++ b/libs/unimrcp/configure.gnu @@ -1,4 +1,3 @@ #! /bin/sh -srcpath=$(pwd) -$srcpath/configure "$@" --with-apr=$srcpath/../apr --disable-shared --with-pic --with-apr-util=$srcpath/../apr-util --with-sofia-sip=$srcpath/../sofia-sip - +srcpath=$(dirname $0 2>/dev/null ) || srcpath="." +$srcpath/configure "$@" --with-apr=../apr --disable-shared --with-pic --with-apr-util=../apr-util --with-sofia-sip=../sofia-sip From f4876d591b2b64df25d3017f817ee593b355f93c Mon Sep 17 00:00:00 2001 From: Chris Rienzo Date: Mon, 24 Nov 2014 12:11:12 -0500 Subject: [PATCH 11/95] FS-7031 [unimrcp] update sofia-sip.m4 so that it can build when relative path is used in configure.gnu --with-sofia-sip --- libs/unimrcp/build/acmacros/sofia-sip.m4 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libs/unimrcp/build/acmacros/sofia-sip.m4 b/libs/unimrcp/build/acmacros/sofia-sip.m4 index a8ee444e13..a7e4539f10 100644 --- a/libs/unimrcp/build/acmacros/sofia-sip.m4 +++ b/libs/unimrcp/build/acmacros/sofia-sip.m4 @@ -46,10 +46,11 @@ AC_DEFUN([UNIMRCP_CHECK_SOFIA], dnl Check for path to Sofia-SIP source/build tree for dir in $sofia_path ; do sofia_uadir="$dir/libsofia-sip-ua" + sofia_srcdir=`(cd $srcdir/$dir && pwd)` if test -d "$sofia_uadir"; then found_sofia="yes" - UNIMRCP_SOFIA_INCLUDES="-I$sofia_uadir -I$sofia_uadir/bnf -I$sofia_uadir/features -I$sofia_uadir/http -I$sofia_uadir/ipt -I$sofia_uadir/iptsec -I$sofia_uadir/msg -I$sofia_uadir/nea -I$sofia_uadir/nta -I$sofia_uadir/nth -I$sofia_uadir/nua -I$sofia_uadir/sdp -I$sofia_uadir/sip -I$sofia_uadir/soa -I$sofia_uadir/sresolv -I$sofia_uadir/stun -I$sofia_uadir/su -I$sofia_uadir/tport -I$sofia_uadir/url" - UNIMRCP_SOFIA_LIBS="$sofia_uadir/libsofia-sip-ua.la" + UNIMRCP_SOFIA_INCLUDES="-I$sofia_srcdir/$sofia_uadir -I$sofia_srcdir/$sofia_uadir/bnf -I$sofia_srcdir/$sofia_uadir/features -I$sofia_srcdir/$sofia_uadir/http -I$sofia_srcdir/$sofia_uadir/ipt -I$sofia_srcdir/$sofia_uadir/iptsec -I$sofia_srcdir/$sofia_uadir/msg -I$sofia_srcdir/$sofia_uadir/nea -I$sofia_srcdir/$sofia_uadir/nta -I$sofia_srcdir/$sofia_uadir/nth -I$sofia_srcdir/$sofia_uadir/nua -I$sofia_srcdir/$sofia_uadir/sdp -I$sofia_srcdir/$sofia_uadir/sip -I$sofia_srcdir/$sofia_uadir/soa -I$sofia_srcdir/$sofia_uadir/sresolv -I$sofia_srcdir/$sofia_uadir/stun -I$sofia_srcdir/$sofia_uadir/su -I$sofia_srcdir/$sofia_uadir/tport -I$sofia_srcdir/$sofia_uadir/url" + UNIMRCP_SOFIA_LIBS="$sofia_srcdir/$sofia_uadir/libsofia-sip-ua.la" sofia_version="`sed -n 's/#define SOFIA_SIP_VERSION.* "\(.*\)"/\1/p' $sofia_uadir/features/sofia-sip/sofia_features.h`" break fi From 061f3cb98057a960f10959f798ae5baf4ddb0de9 Mon Sep 17 00:00:00 2001 From: Chris Rienzo Date: Tue, 25 Nov 2014 08:24:50 -0500 Subject: [PATCH 12/95] FS-7031 #resolve #comment [unimrcp] update library again to pull in upstream fix for --with-sofia-sip=../sofia-sip --- libs/unimrcp/build/acmacros/sofia-sip.m4 | 6 +- .../libs/mrcp-client/include/mrcp_client.h | 48 +++++------ .../mrcp-client/include/mrcp_client_session.h | 10 +-- .../mrcp-client/include/mrcp_client_types.h | 8 +- .../libs/mrcp-client/src/mrcp_application.c | 8 +- .../libs/mrcp-client/src/mrcp_client.c | 54 ++++++------- .../mrcp-client/src/mrcp_client_session.c | 4 +- .../libs/mrcp-server/include/mrcp_server.h | 26 +++--- .../mrcp-server/include/mrcp_server_session.h | 8 +- .../mrcp-server/include/mrcp_server_types.h | 6 +- .../libs/mrcp-server/src/mrcp_server.c | 36 ++++----- .../mrcp-signaling/include/mrcp_sig_agent.h | 6 +- .../src/mrcp_client_connection.c | 10 +-- .../src/mrcp_server_connection.c | 12 +-- .../libs/uni-rtsp/include/rtsp_server.h | 6 +- libs/unimrcp/libs/uni-rtsp/src/rtsp_client.c | 10 +-- libs/unimrcp/libs/uni-rtsp/src/rtsp_server.c | 14 ++-- .../include/mrcp_sofiasip_server_agent.h | 4 +- .../src/mrcp_sofiasip_client_agent.c | 80 ++++++++----------- .../src/mrcp_sofiasip_server_agent.c | 37 ++++----- .../include/mrcp_unirtsp_server_agent.h | 4 +- .../src/mrcp_unirtsp_client_agent.c | 16 ++-- .../libunimrcp-client/src/unimrcp_client.c | 26 +++--- .../libunimrcp-server/src/unimrcp_server.c | 28 +++---- .../tests/mrcptest/src/parse_gen_suite.c | 10 +-- .../tests/rtsptest/src/parse_gen_suite.c | 10 +-- 26 files changed, 233 insertions(+), 254 deletions(-) diff --git a/libs/unimrcp/build/acmacros/sofia-sip.m4 b/libs/unimrcp/build/acmacros/sofia-sip.m4 index a7e4539f10..1d83eacf79 100644 --- a/libs/unimrcp/build/acmacros/sofia-sip.m4 +++ b/libs/unimrcp/build/acmacros/sofia-sip.m4 @@ -46,11 +46,11 @@ AC_DEFUN([UNIMRCP_CHECK_SOFIA], dnl Check for path to Sofia-SIP source/build tree for dir in $sofia_path ; do sofia_uadir="$dir/libsofia-sip-ua" - sofia_srcdir=`(cd $srcdir/$dir && pwd)` if test -d "$sofia_uadir"; then found_sofia="yes" - UNIMRCP_SOFIA_INCLUDES="-I$sofia_srcdir/$sofia_uadir -I$sofia_srcdir/$sofia_uadir/bnf -I$sofia_srcdir/$sofia_uadir/features -I$sofia_srcdir/$sofia_uadir/http -I$sofia_srcdir/$sofia_uadir/ipt -I$sofia_srcdir/$sofia_uadir/iptsec -I$sofia_srcdir/$sofia_uadir/msg -I$sofia_srcdir/$sofia_uadir/nea -I$sofia_srcdir/$sofia_uadir/nta -I$sofia_srcdir/$sofia_uadir/nth -I$sofia_srcdir/$sofia_uadir/nua -I$sofia_srcdir/$sofia_uadir/sdp -I$sofia_srcdir/$sofia_uadir/sip -I$sofia_srcdir/$sofia_uadir/soa -I$sofia_srcdir/$sofia_uadir/sresolv -I$sofia_srcdir/$sofia_uadir/stun -I$sofia_srcdir/$sofia_uadir/su -I$sofia_srcdir/$sofia_uadir/tport -I$sofia_srcdir/$sofia_uadir/url" - UNIMRCP_SOFIA_LIBS="$sofia_srcdir/$sofia_uadir/libsofia-sip-ua.la" + sofia_abs_uadir="`cd $sofia_uadir && pwd`" + UNIMRCP_SOFIA_INCLUDES="-I$sofia_abs_uadir -I$sofia_abs_uadir/bnf -I$sofia_abs_uadir/features -I$sofia_abs_uadir/http -I$sofia_abs_uadir/ipt -I$sofia_abs_uadir/iptsec -I$sofia_abs_uadir/msg -I$sofia_abs_uadir/nea -I$sofia_abs_uadir/nta -I$sofia_abs_uadir/nth -I$sofia_abs_uadir/nua -I$sofia_abs_uadir/sdp -I$sofia_abs_uadir/sip -I$sofia_abs_uadir/soa -I$sofia_abs_uadir/sresolv -I$sofia_abs_uadir/stun -I$sofia_abs_uadir/su -I$sofia_abs_uadir/tport -I$sofia_abs_uadir/url" + UNIMRCP_SOFIA_LIBS="$sofia_abs_uadir/libsofia-sip-ua.la" sofia_version="`sed -n 's/#define SOFIA_SIP_VERSION.* "\(.*\)"/\1/p' $sofia_uadir/features/sofia-sip/sofia_features.h`" break fi diff --git a/libs/unimrcp/libs/mrcp-client/include/mrcp_client.h b/libs/unimrcp/libs/mrcp-client/include/mrcp_client.h index b34ce5b50b..87d36e21fe 100644 --- a/libs/unimrcp/libs/mrcp-client/include/mrcp_client.h +++ b/libs/unimrcp/libs/mrcp-client/include/mrcp_client.h @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * $Id: mrcp_client.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ + * $Id: mrcp_client.h 2251 2014-11-21 02:36:44Z achaloyan@gmail.com $ */ #ifndef MRCP_CLIENT_H @@ -133,34 +133,34 @@ MRCP_DECLARE(apt_bool_t) mrcp_client_signaling_settings_register(mrcp_client_t * MRCP_DECLARE(apt_bool_t) mrcp_client_connection_agent_register(mrcp_client_t *client, mrcp_connection_agent_t *connection_agent); /** Create MRCP profile */ -MRCP_DECLARE(mrcp_profile_t*) mrcp_client_profile_create( - mrcp_resource_factory_t *resource_factory, - mrcp_sig_agent_t *signaling_agent, - mrcp_connection_agent_t *connection_agent, - mpf_engine_t *media_engine, - mpf_termination_factory_t *rtp_factory, - mpf_rtp_settings_t *rtp_settings, - mrcp_sig_settings_t *signaling_settings, - apr_pool_t *pool); +MRCP_DECLARE(mrcp_client_profile_t*) mrcp_client_profile_create( + mrcp_resource_factory_t *resource_factory, + mrcp_sig_agent_t *signaling_agent, + mrcp_connection_agent_t *connection_agent, + mpf_engine_t *media_engine, + mpf_termination_factory_t *rtp_factory, + mpf_rtp_settings_t *rtp_settings, + mrcp_sig_settings_t *signaling_settings, + apr_pool_t *pool); /** Create MRCP profile (extended version) */ -MRCP_DECLARE(mrcp_profile_t*) mrcp_client_profile_create_ex( - mrcp_version_e mrcp_version, - mrcp_resource_factory_t *resource_factory, - mrcp_sa_factory_t *sa_factory, - mrcp_ca_factory_t *ca_factory, - mpf_engine_factory_t *mpf_factory, - mpf_termination_factory_t *rtp_factory, - mpf_rtp_settings_t *rtp_settings, - mrcp_sig_settings_t *signaling_settings, - apr_pool_t *pool); +MRCP_DECLARE(mrcp_client_profile_t*) mrcp_client_profile_create_ex( + mrcp_version_e mrcp_version, + mrcp_resource_factory_t *resource_factory, + mrcp_sa_factory_t *sa_factory, + mrcp_ca_factory_t *ca_factory, + mpf_engine_factory_t *mpf_factory, + mpf_termination_factory_t *rtp_factory, + mpf_rtp_settings_t *rtp_settings, + mrcp_sig_settings_t *signaling_settings, + apr_pool_t *pool); /** * Set a tag to the profile. * @param profile the profile to set a tag for * @param tag the tag to set */ -MRCP_DECLARE(void) mrcp_client_profile_tag_set(mrcp_profile_t *profile, const char *tag); +MRCP_DECLARE(void) mrcp_client_profile_tag_set(mrcp_client_profile_t *profile, const char *tag); /** * Register MRCP profile. @@ -168,7 +168,7 @@ MRCP_DECLARE(void) mrcp_client_profile_tag_set(mrcp_profile_t *profile, const ch * @param profile the profile to set * @param name the name of the profile */ -MRCP_DECLARE(apt_bool_t) mrcp_client_profile_register(mrcp_client_t *client, mrcp_profile_t *profile, const char *name); +MRCP_DECLARE(apt_bool_t) mrcp_client_profile_register(mrcp_client_t *client, mrcp_client_profile_t *profile, const char *name); /** * Register MRCP application. @@ -231,7 +231,7 @@ MRCP_DECLARE(mrcp_connection_agent_t*) mrcp_client_connection_agent_get(const mr * @param client the MRCP client to get from * @param name the name to lookup */ -MRCP_DECLARE(mrcp_profile_t*) mrcp_client_profile_get(const mrcp_client_t *client, const char *name); +MRCP_DECLARE(mrcp_client_profile_t*) mrcp_client_profile_get(const mrcp_client_t *client, const char *name); /** * Get available profiles. @@ -241,7 +241,7 @@ MRCP_DECLARE(mrcp_profile_t*) mrcp_client_profile_get(const mrcp_client_t *clien * @param tag the tag to be used as a filter (no filter is specified if tag is NULL) * @return FALSE if the provided max number of profiles is less than the actual number of profiles */ -MRCP_DECLARE(apt_bool_t) mrcp_client_profiles_get(const mrcp_client_t *client, mrcp_profile_t *profiles[], apr_size_t *count, const char *tag); +MRCP_DECLARE(apt_bool_t) mrcp_client_profiles_get(const mrcp_client_t *client, mrcp_client_profile_t *profiles[], apr_size_t *count, const char *tag); /** * Get directory layout. diff --git a/libs/unimrcp/libs/mrcp-client/include/mrcp_client_session.h b/libs/unimrcp/libs/mrcp-client/include/mrcp_client_session.h index cb73c3e496..f6a3c645ee 100644 --- a/libs/unimrcp/libs/mrcp-client/include/mrcp_client_session.h +++ b/libs/unimrcp/libs/mrcp-client/include/mrcp_client_session.h @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * $Id: mrcp_client_session.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ + * $Id: mrcp_client_session.h 2251 2014-11-21 02:36:44Z achaloyan@gmail.com $ */ #ifndef MRCP_CLIENT_SESSION_H @@ -57,14 +57,13 @@ struct mrcp_client_session_t { /** External object associated with session */ void *app_obj; /** Profile to use */ - mrcp_profile_t *profile; + mrcp_client_profile_t *profile; /** Media context */ mpf_context_t *context; /** Codec manager */ const mpf_codec_manager_t *codec_manager; - /** RTP termination array (mrcp_termination_slot_t) */ apr_array_header_t *terminations; /** MRCP control channel array (mrcp_channel_t*) */ @@ -133,9 +132,8 @@ struct rtp_termination_slot_t { apr_size_t id; }; - -/** MRCP profile */ -struct mrcp_profile_t { +/** MRCP client profile */ +struct mrcp_client_profile_t { /** Unique profile name */ const char *name; /** Arbitrary tag set/used by user application */ diff --git a/libs/unimrcp/libs/mrcp-client/include/mrcp_client_types.h b/libs/unimrcp/libs/mrcp-client/include/mrcp_client_types.h index 8355b8669c..61a555bcbe 100644 --- a/libs/unimrcp/libs/mrcp-client/include/mrcp_client_types.h +++ b/libs/unimrcp/libs/mrcp-client/include/mrcp_client_types.h @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * $Id: mrcp_client_types.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ + * $Id: mrcp_client_types.h 2251 2014-11-21 02:36:44Z achaloyan@gmail.com $ */ #ifndef MRCP_CLIENT_TYPES_H @@ -33,8 +33,10 @@ APT_BEGIN_EXTERN_C /** Opaque MRCP client declaration */ typedef struct mrcp_client_t mrcp_client_t; -/** Opaque MRCP profile declaration */ -typedef struct mrcp_profile_t mrcp_profile_t; +/** Opaque MRCP client profile declaration */ +typedef struct mrcp_client_profile_t mrcp_client_profile_t; +/** Backward compatible declaration of MRCP profile */ +typedef mrcp_client_profile_t mrcp_profile_t; /** Opaque MRCP application declaration */ typedef struct mrcp_application_t mrcp_application_t; diff --git a/libs/unimrcp/libs/mrcp-client/src/mrcp_application.c b/libs/unimrcp/libs/mrcp-client/src/mrcp_application.c index f4eff6bd50..849847720b 100644 --- a/libs/unimrcp/libs/mrcp-client/src/mrcp_application.c +++ b/libs/unimrcp/libs/mrcp-client/src/mrcp_application.c @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * $Id: mrcp_application.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ + * $Id: mrcp_application.c 2251 2014-11-21 02:36:44Z achaloyan@gmail.com $ */ #include "mrcp_application.h" @@ -72,7 +72,7 @@ MRCP_DECLARE(const apt_dir_layout_t*) mrcp_application_dir_layout_get(const mrcp /** Create client session */ MRCP_DECLARE(mrcp_session_t*) mrcp_application_session_create(mrcp_application_t *application, const char *profile_name, void *obj) { - mrcp_profile_t *profile; + mrcp_client_profile_t *profile; mrcp_client_session_t *session; if(!application || !application->client || !profile_name) { return NULL; @@ -194,7 +194,7 @@ MRCP_DECLARE(mrcp_channel_t*) mrcp_application_channel_create( void *obj) { mrcp_resource_t *resource; - mrcp_profile_t *profile; + mrcp_client_profile_t *profile; mrcp_client_session_t *client_session = (mrcp_client_session_t*)session; if(!client_session || !client_session->profile) { /* Invalid params */ @@ -317,7 +317,7 @@ MRCP_DECLARE(apt_bool_t) mrcp_application_resource_discover(mrcp_session_t *sess MRCP_DECLARE(mrcp_message_t*) mrcp_application_message_create(mrcp_session_t *session, mrcp_channel_t *channel, mrcp_method_id method_id) { mrcp_message_t *mrcp_message; - mrcp_profile_t *profile; + mrcp_client_profile_t *profile; mrcp_client_session_t *client_session = (mrcp_client_session_t*)session; if(!client_session || !channel || !channel->resource) { return NULL; diff --git a/libs/unimrcp/libs/mrcp-client/src/mrcp_client.c b/libs/unimrcp/libs/mrcp-client/src/mrcp_client.c index 0993187aba..0212ff8a86 100644 --- a/libs/unimrcp/libs/mrcp-client/src/mrcp_client.c +++ b/libs/unimrcp/libs/mrcp-client/src/mrcp_client.c @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * $Id: mrcp_client.c 2234 2014-11-12 01:38:17Z achaloyan@gmail.com $ + * $Id: mrcp_client.c 2251 2014-11-21 02:36:44Z achaloyan@gmail.com $ */ #include @@ -51,7 +51,7 @@ struct mrcp_client_t { apr_hash_t *cnt_agent_table; /** Table of RTP settings (mpf_rtp_settings_t*) */ apr_hash_t *rtp_settings_table; - /** Table of profiles (mrcp_profile_t*) */ + /** Table of profiles (mrcp_client_profile_t*) */ apr_hash_t *profile_table; /** Table of applications (mrcp_application_t*) */ @@ -471,15 +471,15 @@ MRCP_DECLARE(mrcp_connection_agent_t*) mrcp_client_connection_agent_get(const mr } /** Create MRCP profile */ -MRCP_DECLARE(mrcp_profile_t*) mrcp_client_profile_create( - mrcp_resource_factory_t *resource_factory, - mrcp_sig_agent_t *signaling_agent, - mrcp_connection_agent_t *connection_agent, - mpf_engine_t *media_engine, - mpf_termination_factory_t *rtp_factory, - mpf_rtp_settings_t *rtp_settings, - mrcp_sig_settings_t *signaling_settings, - apr_pool_t *pool) +MRCP_DECLARE(mrcp_client_profile_t*) mrcp_client_profile_create( + mrcp_resource_factory_t *resource_factory, + mrcp_sig_agent_t *signaling_agent, + mrcp_connection_agent_t *connection_agent, + mpf_engine_t *media_engine, + mpf_termination_factory_t *rtp_factory, + mpf_rtp_settings_t *rtp_settings, + mrcp_sig_settings_t *signaling_settings, + apr_pool_t *pool) { mrcp_sa_factory_t *sa_factory = NULL; mrcp_ca_factory_t *ca_factory = NULL; @@ -516,18 +516,18 @@ MRCP_DECLARE(mrcp_profile_t*) mrcp_client_profile_create( } /** Create MRCP profile (extended version) */ -MRCP_DECLARE(mrcp_profile_t*) mrcp_client_profile_create_ex( - mrcp_version_e mrcp_version, - mrcp_resource_factory_t *resource_factory, - mrcp_sa_factory_t *sa_factory, - mrcp_ca_factory_t *ca_factory, - mpf_engine_factory_t *mpf_factory, - mpf_termination_factory_t *rtp_factory, - mpf_rtp_settings_t *rtp_settings, - mrcp_sig_settings_t *signaling_settings, - apr_pool_t *pool) +MRCP_DECLARE(mrcp_client_profile_t*) mrcp_client_profile_create_ex( + mrcp_version_e mrcp_version, + mrcp_resource_factory_t *resource_factory, + mrcp_sa_factory_t *sa_factory, + mrcp_ca_factory_t *ca_factory, + mpf_engine_factory_t *mpf_factory, + mpf_termination_factory_t *rtp_factory, + mpf_rtp_settings_t *rtp_settings, + mrcp_sig_settings_t *signaling_settings, + apr_pool_t *pool) { - mrcp_profile_t *profile = apr_palloc(pool,sizeof(mrcp_profile_t)); + mrcp_client_profile_t *profile = apr_palloc(pool,sizeof(mrcp_client_profile_t)); profile->name = NULL; profile->tag = NULL; profile->mrcp_version = mrcp_version; @@ -545,7 +545,7 @@ MRCP_DECLARE(mrcp_profile_t*) mrcp_client_profile_create_ex( } /** Set a tag to the profile */ -MRCP_DECLARE(void) mrcp_client_profile_tag_set(mrcp_profile_t *profile, const char *tag) +MRCP_DECLARE(void) mrcp_client_profile_tag_set(mrcp_client_profile_t *profile, const char *tag) { if(profile) { apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set Profile Tag [%s]",tag); @@ -554,7 +554,7 @@ MRCP_DECLARE(void) mrcp_client_profile_tag_set(mrcp_profile_t *profile, const ch } /** Register MRCP profile */ -MRCP_DECLARE(apt_bool_t) mrcp_client_profile_register(mrcp_client_t *client, mrcp_profile_t *profile, const char *name) +MRCP_DECLARE(apt_bool_t) mrcp_client_profile_register(mrcp_client_t *client, mrcp_client_profile_t *profile, const char *name) { if(!profile || !name) { apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Register Profile: no name"); @@ -602,17 +602,17 @@ MRCP_DECLARE(apt_bool_t) mrcp_client_profile_register(mrcp_client_t *client, mrc } /** Get profile by name */ -MRCP_DECLARE(mrcp_profile_t*) mrcp_client_profile_get(const mrcp_client_t *client, const char *name) +MRCP_DECLARE(mrcp_client_profile_t*) mrcp_client_profile_get(const mrcp_client_t *client, const char *name) { return apr_hash_get(client->profile_table,name,APR_HASH_KEY_STRING); } /** Get available profiles */ -MRCP_DECLARE(apt_bool_t) mrcp_client_profiles_get(const mrcp_client_t *client, mrcp_profile_t *profiles[], apr_size_t *count, const char *tag) +MRCP_DECLARE(apt_bool_t) mrcp_client_profiles_get(const mrcp_client_t *client, mrcp_client_profile_t *profiles[], apr_size_t *count, const char *tag) { apr_hash_index_t *it; void *val; - mrcp_profile_t *profile; + mrcp_client_profile_t *profile; apr_size_t i = 0; apt_bool_t status = TRUE; diff --git a/libs/unimrcp/libs/mrcp-client/src/mrcp_client_session.c b/libs/unimrcp/libs/mrcp-client/src/mrcp_client_session.c index 97af3cb10a..851e7ffcba 100644 --- a/libs/unimrcp/libs/mrcp-client/src/mrcp_client_session.c +++ b/libs/unimrcp/libs/mrcp-client/src/mrcp_client_session.c @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * $Id: mrcp_client_session.c 2237 2014-11-12 01:48:46Z achaloyan@gmail.com $ + * $Id: mrcp_client_session.c 2251 2014-11-21 02:36:44Z achaloyan@gmail.com $ */ #include "mrcp_client_session.h" @@ -684,7 +684,7 @@ static apt_bool_t mrcp_client_channel_add(mrcp_client_session_t *session, mrcp_c mpf_rtp_termination_descriptor_t *rtp_descriptor = NULL; rtp_termination_slot_t *slot; apr_pool_t *pool = session->base.pool; - mrcp_profile_t *profile = session->profile; + mrcp_client_profile_t *profile = session->profile; if(mrcp_client_channel_find(session,channel,NULL) == TRUE) { /* update */ return mrcp_client_channel_modify(session,channel,TRUE); diff --git a/libs/unimrcp/libs/mrcp-server/include/mrcp_server.h b/libs/unimrcp/libs/mrcp-server/include/mrcp_server.h index 0f3232fcc4..a51186dd88 100644 --- a/libs/unimrcp/libs/mrcp-server/include/mrcp_server.h +++ b/libs/unimrcp/libs/mrcp-server/include/mrcp_server.h @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * $Id: mrcp_server.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ + * $Id: mrcp_server.h 2251 2014-11-21 02:36:44Z achaloyan@gmail.com $ */ #ifndef MRCP_SERVER_H @@ -138,16 +138,16 @@ MRCP_DECLARE(apt_bool_t) mrcp_server_connection_agent_register( mrcp_connection_agent_t *connection_agent); /** Create MRCP profile */ -MRCP_DECLARE(mrcp_profile_t*) mrcp_server_profile_create( - const char *id, - mrcp_version_e mrcp_version, - mrcp_resource_factory_t *resource_factory, - mrcp_sig_agent_t *signaling_agent, - mrcp_connection_agent_t *connection_agent, - mpf_engine_t *media_engine, - mpf_termination_factory_t *rtp_factory, - mpf_rtp_settings_t *rtp_settings, - apr_pool_t *pool); +MRCP_DECLARE(mrcp_server_profile_t*) mrcp_server_profile_create( + const char *id, + mrcp_version_e mrcp_version, + mrcp_resource_factory_t *resource_factory, + mrcp_sig_agent_t *signaling_agent, + mrcp_connection_agent_t *connection_agent, + mpf_engine_t *media_engine, + mpf_termination_factory_t *rtp_factory, + mpf_rtp_settings_t *rtp_settings, + apr_pool_t *pool); /** * Register MRCP profile. @@ -157,7 +157,7 @@ MRCP_DECLARE(mrcp_profile_t*) mrcp_server_profile_create( */ MRCP_DECLARE(apt_bool_t) mrcp_server_profile_register( mrcp_server_t *server, - mrcp_profile_t *profile, + mrcp_server_profile_t *profile, apr_table_t *plugin_map); /** @@ -219,7 +219,7 @@ MRCP_DECLARE(mrcp_connection_agent_t*) mrcp_server_connection_agent_get(const mr * @param server the MRCP client to get from * @param name the name to lookup */ -MRCP_DECLARE(mrcp_profile_t*) mrcp_server_profile_get(const mrcp_server_t *server, const char *name); +MRCP_DECLARE(mrcp_server_profile_t*) mrcp_server_profile_get(const mrcp_server_t *server, const char *name); APT_END_EXTERN_C diff --git a/libs/unimrcp/libs/mrcp-server/include/mrcp_server_session.h b/libs/unimrcp/libs/mrcp-server/include/mrcp_server_session.h index 61ea0c8141..af456a021a 100644 --- a/libs/unimrcp/libs/mrcp-server/include/mrcp_server_session.h +++ b/libs/unimrcp/libs/mrcp-server/include/mrcp_server_session.h @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * $Id: mrcp_server_session.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ + * $Id: mrcp_server_session.h 2251 2014-11-21 02:36:44Z achaloyan@gmail.com $ */ #ifndef MRCP_SERVER_SESSION_H @@ -80,7 +80,7 @@ struct mrcp_server_session_t { /** MRCP server */ mrcp_server_t *server; /** MRCP profile */ - mrcp_profile_t *profile; + mrcp_server_profile_t *profile; /** Media context */ mpf_context_t *context; @@ -109,8 +109,8 @@ struct mrcp_server_session_t { apr_size_t subrequest_count; }; -/** MRCP profile */ -struct mrcp_profile_t { +/** MRCP server profile */ +struct mrcp_server_profile_t { /** Identifier of the profile */ const char *id; /** MRCP version */ diff --git a/libs/unimrcp/libs/mrcp-server/include/mrcp_server_types.h b/libs/unimrcp/libs/mrcp-server/include/mrcp_server_types.h index a301921df4..99c0b615ae 100644 --- a/libs/unimrcp/libs/mrcp-server/include/mrcp_server_types.h +++ b/libs/unimrcp/libs/mrcp-server/include/mrcp_server_types.h @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * $Id: mrcp_server_types.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ + * $Id: mrcp_server_types.h 2251 2014-11-21 02:36:44Z achaloyan@gmail.com $ */ #ifndef MRCP_SERVER_TYPES_H @@ -33,8 +33,8 @@ APT_BEGIN_EXTERN_C /** Opaque MRCP server declaration */ typedef struct mrcp_server_t mrcp_server_t; -/** Opaque MRCP profile declaration */ -typedef struct mrcp_profile_t mrcp_profile_t; +/** Opaque MRCP server profile declaration */ +typedef struct mrcp_server_profile_t mrcp_server_profile_t; APT_END_EXTERN_C diff --git a/libs/unimrcp/libs/mrcp-server/src/mrcp_server.c b/libs/unimrcp/libs/mrcp-server/src/mrcp_server.c index 3fff2b77d7..d37528917e 100644 --- a/libs/unimrcp/libs/mrcp-server/src/mrcp_server.c +++ b/libs/unimrcp/libs/mrcp-server/src/mrcp_server.c @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * $Id: mrcp_server.c 2178 2014-09-13 02:36:05Z achaloyan@gmail.com $ + * $Id: mrcp_server.c 2251 2014-11-21 02:36:44Z achaloyan@gmail.com $ */ #include "mrcp_server.h" @@ -57,7 +57,7 @@ struct mrcp_server_t { apr_hash_t *cnt_agent_table; /** Table of RTP settings (mpf_rtp_settings_t*) */ apr_hash_t *rtp_settings_table; - /** Table of profiles (mrcp_profile_t*) */ + /** Table of profiles (mrcp_server_profile_t*) */ apr_hash_t *profile_table; /** Table of sessions */ @@ -459,18 +459,18 @@ MRCP_DECLARE(mrcp_connection_agent_t*) mrcp_server_connection_agent_get(const mr } /** Create MRCP profile */ -MRCP_DECLARE(mrcp_profile_t*) mrcp_server_profile_create( - const char *id, - mrcp_version_e mrcp_version, - mrcp_resource_factory_t *resource_factory, - mrcp_sig_agent_t *signaling_agent, - mrcp_connection_agent_t *connection_agent, - mpf_engine_t *media_engine, - mpf_termination_factory_t *rtp_factory, - mpf_rtp_settings_t *rtp_settings, - apr_pool_t *pool) +MRCP_DECLARE(mrcp_server_profile_t*) mrcp_server_profile_create( + const char *id, + mrcp_version_e mrcp_version, + mrcp_resource_factory_t *resource_factory, + mrcp_sig_agent_t *signaling_agent, + mrcp_connection_agent_t *connection_agent, + mpf_engine_t *media_engine, + mpf_termination_factory_t *rtp_factory, + mpf_rtp_settings_t *rtp_settings, + apr_pool_t *pool) { - mrcp_profile_t *profile = apr_palloc(pool,sizeof(mrcp_profile_t)); + mrcp_server_profile_t *profile = apr_palloc(pool,sizeof(mrcp_server_profile_t)); profile->id = id; profile->mrcp_version = mrcp_version; profile->resource_factory = resource_factory; @@ -485,7 +485,7 @@ MRCP_DECLARE(mrcp_profile_t*) mrcp_server_profile_create( return profile; } -static apt_bool_t mrcp_server_engine_table_make(mrcp_server_t *server, mrcp_profile_t *profile, apr_table_t *plugin_map) +static apt_bool_t mrcp_server_engine_table_make(mrcp_server_t *server, mrcp_server_profile_t *profile, apr_table_t *plugin_map) { int i; mrcp_resource_t *resource; @@ -528,7 +528,7 @@ static apt_bool_t mrcp_server_engine_table_make(mrcp_server_t *server, mrcp_prof /** Register MRCP profile */ MRCP_DECLARE(apt_bool_t) mrcp_server_profile_register( mrcp_server_t *server, - mrcp_profile_t *profile, + mrcp_server_profile_t *profile, apr_table_t *plugin_map) { if(!profile || !profile->id) { @@ -568,7 +568,7 @@ MRCP_DECLARE(apt_bool_t) mrcp_server_profile_register( } /** Get profile by name */ -MRCP_DECLARE(mrcp_profile_t*) mrcp_server_profile_get(const mrcp_server_t *server, const char *name) +MRCP_DECLARE(mrcp_server_profile_t*) mrcp_server_profile_get(const mrcp_server_t *server, const char *name) { return apr_hash_get(server->profile_table,name,APR_HASH_KEY_STRING); } @@ -842,9 +842,9 @@ static apt_bool_t mrcp_server_channel_task_msg_signal( return apt_task_msg_signal(task,task_msg); } -static mrcp_profile_t* mrcp_server_profile_get_by_agent(mrcp_server_t *server, mrcp_server_session_t *session, mrcp_sig_agent_t *signaling_agent) +static mrcp_server_profile_t* mrcp_server_profile_get_by_agent(mrcp_server_t *server, mrcp_server_session_t *session, const mrcp_sig_agent_t *signaling_agent) { - mrcp_profile_t *profile; + mrcp_server_profile_t *profile; apr_hash_index_t *it; void *val; it = apr_hash_first(session->base.pool,server->profile_table); diff --git a/libs/unimrcp/libs/mrcp-signaling/include/mrcp_sig_agent.h b/libs/unimrcp/libs/mrcp-signaling/include/mrcp_sig_agent.h index 6acc24621f..a7595066d5 100644 --- a/libs/unimrcp/libs/mrcp-signaling/include/mrcp_sig_agent.h +++ b/libs/unimrcp/libs/mrcp-signaling/include/mrcp_sig_agent.h @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * $Id: mrcp_sig_agent.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ + * $Id: mrcp_sig_agent.h 2253 2014-11-21 02:57:19Z achaloyan@gmail.com $ */ #ifndef MRCP_SIG_AGENT_H @@ -43,7 +43,7 @@ struct mrcp_sig_settings_t { char *resource_location; /** Map of the MRCP resource names (v1 only) */ apr_table_t *resource_map; - /** Force destination ip address. Should be used only in case + /** Force destination IP address. Should be used only in case SDP contains incorrect connection address (local IP address behind NAT) */ apt_bool_t force_destination; /** Optional feature tags */ @@ -70,7 +70,7 @@ struct mrcp_sig_agent_t { /** Virtual create_server_session */ mrcp_session_t* (*create_server_session)(mrcp_sig_agent_t *signaling_agent); /** Virtual create_client_session */ - apt_bool_t (*create_client_session)(mrcp_session_t *session, mrcp_sig_settings_t *settings); + apt_bool_t (*create_client_session)(mrcp_session_t *session, const mrcp_sig_settings_t *settings); }; /** Create signaling agent. */ diff --git a/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_client_connection.c b/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_client_connection.c index 99006b72bc..359df52f47 100644 --- a/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_client_connection.c +++ b/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_client_connection.c @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * $Id: mrcp_client_connection.c 2235 2014-11-12 01:41:51Z achaloyan@gmail.com $ + * $Id: mrcp_client_connection.c 2249 2014-11-19 05:26:24Z achaloyan@gmail.com $ */ #include "mrcp_connection.h" @@ -527,7 +527,7 @@ static apt_bool_t mrcp_client_agent_messsage_send(mrcp_connection_agent_t *agent stream.text.length = stream.pos - stream.text.buf; *stream.pos = '\0'; - apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,channel->log_obj,"Send MRCPv2 Stream %s [%"APR_SIZE_T_FMT" bytes]\n%.*s", + apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,channel->log_obj,"Send MRCPv2 Data %s [%"APR_SIZE_T_FMT" bytes]\n%.*s", connection->id, stream.text.length, connection->verbose == TRUE ? stream.text.length : 0, @@ -537,12 +537,12 @@ static apt_bool_t mrcp_client_agent_messsage_send(mrcp_connection_agent_t *agent status = TRUE; } else { - apt_obj_log(APT_LOG_MARK,APT_PRIO_WARNING,channel->log_obj,"Failed to Send MRCPv2 Stream %s", + apt_obj_log(APT_LOG_MARK,APT_PRIO_WARNING,channel->log_obj,"Failed to Send MRCPv2 Data %s", connection->id); } } else { - apt_obj_log(APT_LOG_MARK,APT_PRIO_WARNING,channel->log_obj,"Failed to Generate MRCPv2 Stream %s", + apt_obj_log(APT_LOG_MARK,APT_PRIO_WARNING,channel->log_obj,"Failed to Generate MRCPv2 Data %s", connection->id); } } @@ -632,7 +632,7 @@ static apt_bool_t mrcp_client_poller_signal_process(void *obj, const apr_pollfd_ /* calculate actual length of the stream */ stream->text.length = offset + length; stream->pos[length] = '\0'; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Receive MRCPv2 Stream %s [%"APR_SIZE_T_FMT" bytes]\n%.*s", + apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Receive MRCPv2 Data %s [%"APR_SIZE_T_FMT" bytes]\n%.*s", connection->id, length, connection->verbose == TRUE ? length : 0, diff --git a/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_server_connection.c b/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_server_connection.c index 67fd4561c9..3a77ff23d4 100644 --- a/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_server_connection.c +++ b/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_server_connection.c @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * $Id: mrcp_server_connection.c 2235 2014-11-12 01:41:51Z achaloyan@gmail.com $ + * $Id: mrcp_server_connection.c 2249 2014-11-19 05:26:24Z achaloyan@gmail.com $ */ #include "mrcp_connection.h" @@ -581,7 +581,7 @@ static apt_bool_t mrcp_server_agent_messsage_send(mrcp_connection_agent_t *agent stream.text.length = stream.pos - stream.text.buf; *stream.pos = '\0'; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Send MRCPv2 Stream %s [%"APR_SIZE_T_FMT" bytes]\n%.*s", + apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Send MRCPv2 Data %s [%"APR_SIZE_T_FMT" bytes]\n%.*s", connection->id, stream.text.length, connection->verbose == TRUE ? stream.text.length : 0, @@ -591,11 +591,11 @@ static apt_bool_t mrcp_server_agent_messsage_send(mrcp_connection_agent_t *agent status = TRUE; } else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Send MRCPv2 Stream"); + apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Send MRCPv2 Data"); } } else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Generate MRCPv2 Stream"); + apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Generate MRCPv2 Data"); } } while(result == APT_MESSAGE_STATUS_INCOMPLETE); @@ -620,7 +620,7 @@ static apt_bool_t mrcp_server_message_handler(mrcp_connection_t *connection, mrc } else if(status == APT_MESSAGE_STATUS_INVALID) { /* error case */ - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Parse MRCPv2 Stream"); + apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Parse MRCPv2 Data"); if(message && message->resource) { mrcp_message_t *response; response = mrcp_response_create(message,message->pool); @@ -668,7 +668,7 @@ static apt_bool_t mrcp_server_poller_signal_process(void *obj, const apr_pollfd_ stream->text.length = offset + length; stream->pos[length] = '\0'; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Receive MRCPv2 Stream %s [%"APR_SIZE_T_FMT" bytes]\n%.*s", + apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Receive MRCPv2 Data %s [%"APR_SIZE_T_FMT" bytes]\n%.*s", connection->id, length, connection->verbose == TRUE ? length : 0, diff --git a/libs/unimrcp/libs/uni-rtsp/include/rtsp_server.h b/libs/unimrcp/libs/uni-rtsp/include/rtsp_server.h index 8da0bf41ff..768ed2c23a 100644 --- a/libs/unimrcp/libs/uni-rtsp/include/rtsp_server.h +++ b/libs/unimrcp/libs/uni-rtsp/include/rtsp_server.h @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * $Id: rtsp_server.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ + * $Id: rtsp_server.h 2252 2014-11-21 02:45:15Z achaloyan@gmail.com $ */ #ifndef RTSP_SERVER_H @@ -137,8 +137,8 @@ RTSP_DECLARE(const apt_str_t*) rtsp_server_session_id_get(const rtsp_server_sess RTSP_DECLARE(const rtsp_message_t*) rtsp_server_session_request_get(const rtsp_server_session_t *session); /** - * Get the session destination (client) ip address. - * @param session the session to get ip address from + * Get the session destination (client) IP address. + * @param session the session to get IP address from */ RTSP_DECLARE(const char*) rtsp_server_session_destination_get(const rtsp_server_session_t *session); diff --git a/libs/unimrcp/libs/uni-rtsp/src/rtsp_client.c b/libs/unimrcp/libs/uni-rtsp/src/rtsp_client.c index 8f90367d73..bf783aba65 100644 --- a/libs/unimrcp/libs/uni-rtsp/src/rtsp_client.c +++ b/libs/unimrcp/libs/uni-rtsp/src/rtsp_client.c @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * $Id: rtsp_client.c 2220 2014-11-11 02:39:48Z achaloyan@gmail.com $ + * $Id: rtsp_client.c 2249 2014-11-19 05:26:24Z achaloyan@gmail.com $ */ #ifdef WIN32 @@ -836,7 +836,7 @@ static apt_bool_t rtsp_client_message_send(rtsp_client_t *client, rtsp_client_co stream->text.length = stream->pos - stream->text.buf; *stream->pos = '\0'; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Send RTSP Stream %s [%"APR_SIZE_T_FMT" bytes]\n%s", + apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Send RTSP Data %s [%"APR_SIZE_T_FMT" bytes]\n%s", rtsp_connection->id, stream->text.length, stream->text.buf); @@ -844,11 +844,11 @@ static apt_bool_t rtsp_client_message_send(rtsp_client_t *client, rtsp_client_co status = TRUE; } else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Send RTSP Stream"); + apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Send RTSP Data"); } } else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Generate RTSP Stream"); + apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Generate RTSP Data"); } } while(result == APT_MESSAGE_STATUS_INCOMPLETE); @@ -934,7 +934,7 @@ static apt_bool_t rtsp_client_poller_signal_process(void *obj, const apr_pollfd_ /* calculate actual length of the stream */ stream->text.length = offset + length; stream->pos[length] = '\0'; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Receive RTSP Stream %s [%"APR_SIZE_T_FMT" bytes]\n%s", + apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Receive RTSP Data %s [%"APR_SIZE_T_FMT" bytes]\n%s", rtsp_connection->id, length, stream->pos); diff --git a/libs/unimrcp/libs/uni-rtsp/src/rtsp_server.c b/libs/unimrcp/libs/uni-rtsp/src/rtsp_server.c index 510cdca558..428634fde2 100644 --- a/libs/unimrcp/libs/uni-rtsp/src/rtsp_server.c +++ b/libs/unimrcp/libs/uni-rtsp/src/rtsp_server.c @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * $Id: rtsp_server.c 2173 2014-09-11 01:42:21Z achaloyan@gmail.com $ + * $Id: rtsp_server.c 2252 2014-11-21 02:45:15Z achaloyan@gmail.com $ */ #ifdef WIN32 @@ -271,7 +271,7 @@ RTSP_DECLARE(const rtsp_message_t*) rtsp_server_session_request_get(const rtsp_s return session->active_request; } -/** Get the session destination (client) ip address */ +/** Get the session destination (client) IP address */ RTSP_DECLARE(const char*) rtsp_server_session_destination_get(const rtsp_server_session_t *session) { if(session->connection) { @@ -611,7 +611,7 @@ static apt_bool_t rtsp_server_message_send(rtsp_server_t *server, rtsp_server_co stream->text.length = stream->pos - stream->text.buf; *stream->pos = '\0'; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Send RTSP Stream %s [%"APR_SIZE_T_FMT" bytes]\n%s", + apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Send RTSP Data %s [%"APR_SIZE_T_FMT" bytes]\n%s", rtsp_connection->id, stream->text.length, stream->text.buf); @@ -619,11 +619,11 @@ static apt_bool_t rtsp_server_message_send(rtsp_server_t *server, rtsp_server_co status = TRUE; } else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Send RTSP Stream"); + apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Send RTSP Data"); } } else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Generate RTSP Stream"); + apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Generate RTSP Data"); } } while(result == APT_MESSAGE_STATUS_INCOMPLETE); @@ -645,7 +645,7 @@ static apt_bool_t rtsp_server_message_handler(rtsp_server_connection_t *rtsp_con else if(status == APT_MESSAGE_STATUS_INVALID) { /* error case */ rtsp_message_t *response; - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Parse RTSP Stream"); + apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Parse RTSP Data"); if(message) { response = rtsp_response_create(message,RTSP_STATUS_CODE_BAD_REQUEST, RTSP_REASON_PHRASE_BAD_REQUEST,message->pool); @@ -850,7 +850,7 @@ static apt_bool_t rtsp_server_poller_signal_process(void *obj, const apr_pollfd_ /* calculate actual length of the stream */ stream->text.length = offset + length; stream->pos[length] = '\0'; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Receive RTSP Stream %s [%"APR_SIZE_T_FMT" bytes]\n%s", + apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Receive RTSP Data %s [%"APR_SIZE_T_FMT" bytes]\n%s", rtsp_connection->id, length, stream->pos); diff --git a/libs/unimrcp/modules/mrcp-sofiasip/include/mrcp_sofiasip_server_agent.h b/libs/unimrcp/modules/mrcp-sofiasip/include/mrcp_sofiasip_server_agent.h index 81302b4188..4cc78c6fbf 100644 --- a/libs/unimrcp/modules/mrcp-sofiasip/include/mrcp_sofiasip_server_agent.h +++ b/libs/unimrcp/modules/mrcp-sofiasip/include/mrcp_sofiasip_server_agent.h @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * $Id: mrcp_sofiasip_server_agent.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ + * $Id: mrcp_sofiasip_server_agent.h 2252 2014-11-21 02:45:15Z achaloyan@gmail.com $ */ #ifndef MRCP_SOFIASIP_SERVER_AGENT_H @@ -48,7 +48,7 @@ struct mrcp_sofia_server_config_t { char *origin; /** SIP transport */ char *transport; - /** Force destination ip address. Should be used only in case + /** Force destination IP address. Should be used only in case SDP contains incorrect connection address (local IP address behind NAT) */ apt_bool_t force_destination; /** SIP T1 timer */ diff --git a/libs/unimrcp/modules/mrcp-sofiasip/src/mrcp_sofiasip_client_agent.c b/libs/unimrcp/modules/mrcp-sofiasip/src/mrcp_sofiasip_client_agent.c index 71e9da0375..fded058da1 100644 --- a/libs/unimrcp/modules/mrcp-sofiasip/src/mrcp_sofiasip_client_agent.c +++ b/libs/unimrcp/modules/mrcp-sofiasip/src/mrcp_sofiasip_client_agent.c @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * $Id: mrcp_sofiasip_client_agent.c 2225 2014-11-12 00:45:19Z achaloyan@gmail.com $ + * $Id: mrcp_sofiasip_client_agent.c 2253 2014-11-21 02:57:19Z achaloyan@gmail.com $ */ typedef struct mrcp_sofia_agent_t mrcp_sofia_agent_t; @@ -25,6 +25,7 @@ typedef struct mrcp_sofia_session_t mrcp_sofia_session_t; #include #include #include +#include #include #include #include @@ -52,8 +53,7 @@ struct mrcp_sofia_agent_t { struct mrcp_sofia_session_t { mrcp_session_t *session; - mrcp_sig_settings_t *sip_settings; - char *sip_to_str; + const mrcp_sig_settings_t *sip_settings; su_home_t *home; nua_handle_t *nh; @@ -82,7 +82,7 @@ static const mrcp_session_request_vtable_t session_request_vtable = { }; static apt_bool_t mrcp_sofia_config_validate(mrcp_sofia_agent_t *sofia_agent, mrcp_sofia_client_config_t *config, apr_pool_t *pool); -static apt_bool_t mrcp_sofia_session_create(mrcp_session_t *session, mrcp_sig_settings_t *settings); +static apt_bool_t mrcp_sofia_session_create(mrcp_session_t *session, const mrcp_sig_settings_t *settings); static void mrcp_sofia_event_callback( nua_event_t nua_event, int status, @@ -203,26 +203,21 @@ static void mrcp_sofia_task_initialize(apt_task_t *task) * an incoming call, etc, occur. */ sofia_agent->nua = nua_create( - sofia_agent->root, /* Event loop */ - mrcp_sofia_event_callback, /* Callback for processing events */ - sofia_agent, /* Additional data to pass to callback */ - NUTAG_URL(sofia_agent->sip_bind_str), /* Address to bind to */ - TAG_IF(sofia_config->tport_log == TRUE,TPTAG_LOG(1)), /* Print out SIP messages to the console */ - TAG_IF(sofia_config->tport_dump_file,TPTAG_DUMP(sofia_config->tport_dump_file)), /* Dump SIP messages to the file */ - TAG_END()); /* Last tag should always finish the sequence */ - if(sofia_agent->nua) { - nua_set_params( - sofia_agent->nua, - NUTAG_AUTOANSWER(0), - NUTAG_APPL_METHOD("OPTIONS"), - TAG_IF(sofia_config->sip_t1,NTATAG_SIP_T1(sofia_config->sip_t1)), - TAG_IF(sofia_config->sip_t2,NTATAG_SIP_T2(sofia_config->sip_t2)), - TAG_IF(sofia_config->sip_t4,NTATAG_SIP_T4(sofia_config->sip_t4)), - TAG_IF(sofia_config->sip_t1x64,NTATAG_SIP_T1X64(sofia_config->sip_t1x64)), - SIPTAG_USER_AGENT_STR(sofia_config->user_agent_name), - TAG_END()); - } - else { + sofia_agent->root, /* Event loop */ + mrcp_sofia_event_callback, /* Callback for processing events */ + sofia_agent, /* Additional data to pass to callback */ + NUTAG_URL(sofia_agent->sip_bind_str), /* Address to bind to */ + NUTAG_AUTOANSWER(0), + NUTAG_APPL_METHOD("OPTIONS"), + TAG_IF(sofia_config->sip_t1,NTATAG_SIP_T1(sofia_config->sip_t1)), + TAG_IF(sofia_config->sip_t2,NTATAG_SIP_T2(sofia_config->sip_t2)), + TAG_IF(sofia_config->sip_t4,NTATAG_SIP_T4(sofia_config->sip_t4)), + TAG_IF(sofia_config->sip_t1x64,NTATAG_SIP_T1X64(sofia_config->sip_t1x64)), + SIPTAG_USER_AGENT_STR(sofia_config->user_agent_name), + TAG_IF(sofia_config->tport_log == TRUE,TPTAG_LOG(1)), /* Print out SIP messages to the console */ + TAG_IF(sofia_config->tport_dump_file,TPTAG_DUMP(sofia_config->tport_dump_file)), /* Dump SIP messages to the file */ + TAG_END()); /* Last tag should always finish the sequence */ + if(!sofia_agent->nua) { apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create NUA [%s] %s", apt_task_name_get(task), sofia_agent->sip_bind_str); @@ -265,8 +260,9 @@ static APR_INLINE mrcp_sofia_agent_t* mrcp_sofia_agent_get(mrcp_session_t *sessi return session->signaling_agent->obj; } -static apt_bool_t mrcp_sofia_session_create(mrcp_session_t *session, mrcp_sig_settings_t *settings) +static apt_bool_t mrcp_sofia_session_create(mrcp_session_t *session, const mrcp_sig_settings_t *settings) { + const char *sip_to_str; mrcp_sofia_agent_t *sofia_agent = mrcp_sofia_agent_get(session); mrcp_sofia_session_t *sofia_session; session->request_vtable = &session_request_vtable; @@ -285,13 +281,13 @@ static apt_bool_t mrcp_sofia_session_create(mrcp_session_t *session, mrcp_sig_se session->obj = sofia_session; if(settings->user_name && *settings->user_name != '\0') { - sofia_session->sip_to_str = apr_psprintf(session->pool,"sip:%s@%s:%hu", + sip_to_str = apr_psprintf(session->pool,"sip:%s@%s:%hu", settings->user_name, settings->server_ip, settings->server_port); } else { - sofia_session->sip_to_str = apr_psprintf(session->pool,"sip:%s:%hu", + sip_to_str = apr_psprintf(session->pool,"sip:%s:%hu", settings->server_ip, settings->server_port); } @@ -299,7 +295,7 @@ static apt_bool_t mrcp_sofia_session_create(mrcp_session_t *session, mrcp_sig_se sofia_session->nh = nua_handle( sofia_agent->nua, sofia_session, - SIPTAG_TO_STR(sofia_session->sip_to_str), + SIPTAG_TO_STR(sip_to_str), SIPTAG_FROM_STR(sofia_agent->sip_from_str), TAG_IF(sofia_agent->sip_contact_str,SIPTAG_CONTACT_STR(sofia_agent->sip_contact_str)), TAG_IF(settings->feature_tags,SIPTAG_ACCEPT_CONTACT_STR(settings->feature_tags)), @@ -461,33 +457,21 @@ static void mrcp_sofia_on_session_redirect( tagi_t tags[]) { mrcp_session_t *session = sofia_session->session; + sip_to_t *sip_to; sip_contact_t *sip_contact; - if(!sip) { + if(!sip || !sip->sip_contact) { return; } sip_contact = sip->sip_contact; - if(!sip_contact) { - return; - } - if(sip_contact->m_url->url_user && *sip_contact->m_url->url_user != '\0') { - sofia_session->sip_to_str = apr_psprintf(session->pool,"sip:%s@%s:%s", - sip_contact->m_url->url_user, - sip_contact->m_url->url_host, - sip_contact->m_url->url_port); - } - else { - sofia_session->sip_to_str = apr_psprintf(session->pool,"sip:%s:%s", - sip_contact->m_url->url_host, - sip_contact->m_url->url_port); - } - apr_thread_mutex_lock(sofia_session->mutex); - apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,session->log_obj,"Redirect "APT_NAMESID_FMT" to %s", + sip_to = sip_to_create(sofia_session->home, (const url_string_t *) sip_contact->m_url); + + apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,session->log_obj,"Redirect "APT_NAMESID_FMT" to "URL_PRINT_FORMAT, session->name, - MRCP_SESSION_SID(session), - sofia_session->sip_to_str); + MRCP_SESSION_SID(session), + URL_PRINT_ARGS(sip_to->a_url)); if(sofia_session->nh) { nua_handle_bind(sofia_session->nh, NULL); @@ -498,7 +482,7 @@ static void mrcp_sofia_on_session_redirect( sofia_session->nh = nua_handle( sofia_agent->nua, sofia_session, - SIPTAG_TO_STR(sofia_session->sip_to_str), + SIPTAG_TO(sip_to), SIPTAG_FROM_STR(sofia_agent->sip_from_str), TAG_IF(sofia_agent->sip_contact_str,SIPTAG_CONTACT_STR(sofia_agent->sip_contact_str)), TAG_END()); diff --git a/libs/unimrcp/modules/mrcp-sofiasip/src/mrcp_sofiasip_server_agent.c b/libs/unimrcp/modules/mrcp-sofiasip/src/mrcp_sofiasip_server_agent.c index 427b3f9c57..26871190cd 100644 --- a/libs/unimrcp/modules/mrcp-sofiasip/src/mrcp_sofiasip_server_agent.c +++ b/libs/unimrcp/modules/mrcp-sofiasip/src/mrcp_sofiasip_server_agent.c @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * $Id: mrcp_sofiasip_server_agent.c 2221 2014-11-11 02:44:03Z achaloyan@gmail.com $ + * $Id: mrcp_sofiasip_server_agent.c 2250 2014-11-19 05:41:12Z achaloyan@gmail.com $ */ typedef struct mrcp_sofia_agent_t mrcp_sofia_agent_t; @@ -182,26 +182,21 @@ static void mrcp_sofia_task_initialize(apt_task_t *task) * an incoming call, etc, occur. */ sofia_agent->nua = nua_create( - sofia_agent->root, /* Event loop */ - mrcp_sofia_event_callback, /* Callback for processing events */ - sofia_agent, /* Additional data to pass to callback */ - NUTAG_URL(sofia_agent->sip_bind_str), /* Address to bind to */ - TAG_IF(sofia_config->tport_log == TRUE,TPTAG_LOG(1)), /* Print out SIP messages to the console */ - TAG_IF(sofia_config->tport_dump_file,TPTAG_DUMP(sofia_config->tport_dump_file)), /* Dump SIP messages to the file */ - TAG_END()); /* Last tag should always finish the sequence */ - if(sofia_agent->nua) { - nua_set_params( - sofia_agent->nua, - NUTAG_AUTOANSWER(0), - NUTAG_APPL_METHOD("OPTIONS"), - TAG_IF(sofia_config->sip_t1,NTATAG_SIP_T1(sofia_config->sip_t1)), - TAG_IF(sofia_config->sip_t2,NTATAG_SIP_T2(sofia_config->sip_t2)), - TAG_IF(sofia_config->sip_t4,NTATAG_SIP_T4(sofia_config->sip_t4)), - TAG_IF(sofia_config->sip_t1x64,NTATAG_SIP_T1X64(sofia_config->sip_t1x64)), - SIPTAG_USER_AGENT_STR(sofia_config->user_agent_name), - TAG_END()); - } - else { + sofia_agent->root, /* Event loop */ + mrcp_sofia_event_callback, /* Callback for processing events */ + sofia_agent, /* Additional data to pass to callback */ + NUTAG_URL(sofia_agent->sip_bind_str), /* Address to bind to */ + NUTAG_AUTOANSWER(0), + NUTAG_APPL_METHOD("OPTIONS"), + TAG_IF(sofia_config->sip_t1,NTATAG_SIP_T1(sofia_config->sip_t1)), + TAG_IF(sofia_config->sip_t2,NTATAG_SIP_T2(sofia_config->sip_t2)), + TAG_IF(sofia_config->sip_t4,NTATAG_SIP_T4(sofia_config->sip_t4)), + TAG_IF(sofia_config->sip_t1x64,NTATAG_SIP_T1X64(sofia_config->sip_t1x64)), + SIPTAG_USER_AGENT_STR(sofia_config->user_agent_name), + TAG_IF(sofia_config->tport_log == TRUE,TPTAG_LOG(1)), /* Print out SIP messages to the console */ + TAG_IF(sofia_config->tport_dump_file,TPTAG_DUMP(sofia_config->tport_dump_file)), /* Dump SIP messages to the file */ + TAG_END()); /* Last tag should always finish the sequence */ + if(!sofia_agent->nua) { apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create NUA [%s] %s", apt_task_name_get(task), sofia_agent->sip_bind_str); diff --git a/libs/unimrcp/modules/mrcp-unirtsp/include/mrcp_unirtsp_server_agent.h b/libs/unimrcp/modules/mrcp-unirtsp/include/mrcp_unirtsp_server_agent.h index e83e8a5350..c326bb650d 100644 --- a/libs/unimrcp/modules/mrcp-unirtsp/include/mrcp_unirtsp_server_agent.h +++ b/libs/unimrcp/modules/mrcp-unirtsp/include/mrcp_unirtsp_server_agent.h @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * $Id: mrcp_unirtsp_server_agent.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ + * $Id: mrcp_unirtsp_server_agent.h 2252 2014-11-21 02:45:15Z achaloyan@gmail.com $ */ #ifndef MRCP_UNIRTSP_SERVER_AGENT_H @@ -50,7 +50,7 @@ struct rtsp_server_config_t { /** Number of max RTSP connections */ apr_size_t max_connection_count; - /** Force destination ip address. Should be used only in case + /** Force destination IP address. Should be used only in case SDP contains incorrect connection address (local IP address behind NAT) */ apt_bool_t force_destination; }; diff --git a/libs/unimrcp/modules/mrcp-unirtsp/src/mrcp_unirtsp_client_agent.c b/libs/unimrcp/modules/mrcp-unirtsp/src/mrcp_unirtsp_client_agent.c index 321e3e48f7..760a10c069 100644 --- a/libs/unimrcp/modules/mrcp-unirtsp/src/mrcp_unirtsp_client_agent.c +++ b/libs/unimrcp/modules/mrcp-unirtsp/src/mrcp_unirtsp_client_agent.c @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * $Id: mrcp_unirtsp_client_agent.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ + * $Id: mrcp_unirtsp_client_agent.c 2253 2014-11-21 02:57:19Z achaloyan@gmail.com $ */ #include @@ -42,11 +42,11 @@ struct mrcp_unirtsp_agent_t { }; struct mrcp_unirtsp_session_t { - mrcp_message_t *mrcp_message; - mrcp_session_t *mrcp_session; - rtsp_client_session_t *rtsp_session; - mrcp_sig_settings_t *rtsp_settings; - su_home_t *home; + mrcp_message_t *mrcp_message; + mrcp_session_t *mrcp_session; + rtsp_client_session_t *rtsp_session; + const mrcp_sig_settings_t *rtsp_settings; + su_home_t *home; }; @@ -74,7 +74,7 @@ static const rtsp_client_vtable_t session_response_vtable = { mrcp_unirtsp_on_session_event }; -static apt_bool_t mrcp_unirtsp_session_create(mrcp_session_t *session, mrcp_sig_settings_t *settings); +static apt_bool_t mrcp_unirtsp_session_create(mrcp_session_t *session, const mrcp_sig_settings_t *settings); static apt_bool_t rtsp_config_validate(mrcp_unirtsp_agent_t *agent, rtsp_client_config_t *config, apr_pool_t *pool); static apt_bool_t mrcp_unirtsp_on_resource_discover(mrcp_unirtsp_agent_t *agent, mrcp_unirtsp_session_t *session, rtsp_message_t *request, rtsp_message_t *response); @@ -133,7 +133,7 @@ static APR_INLINE mrcp_unirtsp_agent_t* client_agent_get(apt_task_t *task) return agent; } -static apt_bool_t mrcp_unirtsp_session_create(mrcp_session_t *mrcp_session, mrcp_sig_settings_t *settings) +static apt_bool_t mrcp_unirtsp_session_create(mrcp_session_t *mrcp_session, const mrcp_sig_settings_t *settings) { mrcp_unirtsp_agent_t *agent = mrcp_session->signaling_agent->obj; mrcp_unirtsp_session_t *session; diff --git a/libs/unimrcp/platforms/libunimrcp-client/src/unimrcp_client.c b/libs/unimrcp/platforms/libunimrcp-client/src/unimrcp_client.c index 5218fb1021..65cb74221a 100644 --- a/libs/unimrcp/platforms/libunimrcp-client/src/unimrcp_client.c +++ b/libs/unimrcp/platforms/libunimrcp-client/src/unimrcp_client.c @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * $Id: unimrcp_client.c 2231 2014-11-12 01:32:03Z achaloyan@gmail.com $ + * $Id: unimrcp_client.c 2252 2014-11-21 02:45:15Z achaloyan@gmail.com $ */ #include @@ -62,14 +62,14 @@ struct unimrcp_client_loader_t { /** Pool to allocate memory from */ apr_pool_t *pool; - /** Default ip address (named property) */ + /** Default IP address (named property) */ const char *ip; - /** Default external (NAT) ip address (named property) */ + /** Default external (NAT) IP address (named property) */ const char *ext_ip; - /** Default server ip address (named property) */ + /** Default server IP address (named property) */ const char *server_ip; - /** Implicitly detected, cached ip address */ + /** Implicitly detected, cached IP address */ const char *auto_ip; }; @@ -271,7 +271,7 @@ static char* unimrcp_client_ip_address_get(unimrcp_client_loader_t *loader, cons } if(attr && strcasecmp(attr->value,"auto") == 0) { - /* implicitly detect ip address, if not already detected */ + /* implicitly detect IP address, if not already detected */ if(!loader->auto_ip) { char *auto_addr = DEFAULT_IP_ADDRESS; apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Detecting IP Address"); @@ -281,7 +281,7 @@ static char* unimrcp_client_ip_address_get(unimrcp_client_loader_t *loader, cons return apr_pstrdup(loader->pool,loader->auto_ip); } else if(attr && strcasecmp(attr->value,"iface") == 0) { - /* get ip address by network interface name */ + /* get IP address by network interface name */ char *ip_addr = DEFAULT_IP_ADDRESS; if(is_cdata_valid(elem) == TRUE) { const char *iface_name = cdata_text_get(elem); @@ -292,11 +292,11 @@ static char* unimrcp_client_ip_address_get(unimrcp_client_loader_t *loader, cons } if(is_cdata_valid(elem)) { - /* use specified ip address */ + /* use specified IP address */ return cdata_copy(elem,loader->pool); } - /* use default ip address */ + /* use default IP address */ return apr_pstrdup(loader->pool,loader->ip); } @@ -443,11 +443,11 @@ static apt_bool_t unimrcp_client_sip_uac_load(unimrcp_client_loader_t *loader, c } if(!config->local_ip) { - /* use default ip address if not specified */ + /* use default IP address if not specified */ config->local_ip = apr_pstrdup(loader->pool,loader->ip); } if(!config->ext_ip && loader->ext_ip) { - /* use default ext ip address if not specified */ + /* use default ext IP address if not specified */ config->ext_ip = apr_pstrdup(loader->pool,loader->ext_ip); } @@ -942,7 +942,7 @@ static mpf_engine_factory_t* unimrcp_client_mpf_factory_create(unimrcp_client_lo static apt_bool_t unimrcp_client_mrcpv2_profile_load(unimrcp_client_loader_t *loader, const apr_xml_elem *root, const char *id, const char *tag) { const apr_xml_elem *elem; - mrcp_profile_t *profile; + mrcp_client_profile_t *profile; mrcp_sa_factory_t *sa_factory = NULL; mrcp_ca_factory_t *ca_factory = NULL; mpf_engine_factory_t *mpf_factory = NULL; @@ -998,7 +998,7 @@ static apt_bool_t unimrcp_client_mrcpv2_profile_load(unimrcp_client_loader_t *lo static apt_bool_t unimrcp_client_mrcpv1_profile_load(unimrcp_client_loader_t *loader, const apr_xml_elem *root, const char *id, const char *tag) { const apr_xml_elem *elem; - mrcp_profile_t *profile; + mrcp_client_profile_t *profile; mrcp_sa_factory_t *sa_factory = NULL; mpf_engine_factory_t *mpf_factory = NULL; mpf_termination_factory_t *rtp_factory = NULL; diff --git a/libs/unimrcp/platforms/libunimrcp-server/src/unimrcp_server.c b/libs/unimrcp/platforms/libunimrcp-server/src/unimrcp_server.c index ee03dba003..90f1805412 100644 --- a/libs/unimrcp/platforms/libunimrcp-server/src/unimrcp_server.c +++ b/libs/unimrcp/platforms/libunimrcp-server/src/unimrcp_server.c @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * $Id: unimrcp_server.c 2231 2014-11-12 01:32:03Z achaloyan@gmail.com $ + * $Id: unimrcp_server.c 2252 2014-11-21 02:45:15Z achaloyan@gmail.com $ */ #include @@ -65,12 +65,12 @@ struct unimrcp_server_loader_t { /** Pool to allocate memory from */ apr_pool_t *pool; - /** Default ip address (named property) */ + /** Default IP address (named property) */ const char *ip; - /** Default external (NAT) ip address (named property) */ + /** Default external (NAT) IP address (named property) */ const char *ext_ip; - /** Implicitly detected, cached ip address */ + /** Implicitly detected, cached IP address */ const char *auto_ip; }; @@ -211,7 +211,7 @@ static char* unimrcp_server_ip_address_get(unimrcp_server_loader_t *loader, cons } if(attr && strcasecmp(attr->value,"auto") == 0) { - /* implicitly detect ip address, if not already detected */ + /* implicitly detect IP address, if not already detected */ if(!loader->auto_ip) { char *auto_addr = DEFAULT_IP_ADDRESS; apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Detecting IP Address"); @@ -221,7 +221,7 @@ static char* unimrcp_server_ip_address_get(unimrcp_server_loader_t *loader, cons return apr_pstrdup(loader->pool,loader->auto_ip); } else if(attr && strcasecmp(attr->value,"iface") == 0) { - /* get ip address by network interface name */ + /* get IP address by network interface name */ char *ip_addr = DEFAULT_IP_ADDRESS; if(is_cdata_valid(elem) == TRUE) { const char *iface_name = cdata_text_get(elem); @@ -232,11 +232,11 @@ static char* unimrcp_server_ip_address_get(unimrcp_server_loader_t *loader, cons } if(is_cdata_valid(elem)) { - /* use provided ip address */ + /* use provided IP address */ return cdata_copy(elem,loader->pool); } - /* use default ip address */ + /* use default IP address */ return apr_pstrdup(loader->pool,loader->ip); } @@ -386,11 +386,11 @@ static apt_bool_t unimrcp_server_sip_uas_load(unimrcp_server_loader_t *loader, c } if(!config->local_ip) { - /* use default ip address if not specified */ + /* use default IP address if not specified */ config->local_ip = apr_pstrdup(loader->pool,loader->ip); } if(!config->ext_ip && loader->ext_ip) { - /* use default ext ip address if not specified */ + /* use default ext IP address if not specified */ config->ext_ip = apr_pstrdup(loader->pool,loader->ext_ip); } @@ -452,7 +452,7 @@ static apt_bool_t unimrcp_server_rtsp_uas_load(unimrcp_server_loader_t *loader, } if(!config->local_ip) { - /* use default ip address if not specified */ + /* use default IP address if not specified */ config->local_ip = apr_pstrdup(loader->pool,loader->ip); } @@ -509,7 +509,7 @@ static apt_bool_t unimrcp_server_mrcpv2_uas_load(unimrcp_server_loader_t *loader } if(!mrcp_ip) { - /* use default ip address if not specified */ + /* use default IP address if not specified */ mrcp_ip = apr_pstrdup(loader->pool,loader->ip); } @@ -853,7 +853,7 @@ static apr_table_t* resource_engine_map_load(const apr_xml_elem *root, apr_pool_ static apt_bool_t unimrcp_server_mrcpv2_profile_load(unimrcp_server_loader_t *loader, const apr_xml_elem *root, const char *id) { const apr_xml_elem *elem; - mrcp_profile_t *profile; + mrcp_server_profile_t *profile; mrcp_sig_agent_t *sip_agent = NULL; mrcp_connection_agent_t *mrcpv2_agent = NULL; mpf_engine_t *media_engine = NULL; @@ -910,7 +910,7 @@ static apt_bool_t unimrcp_server_mrcpv2_profile_load(unimrcp_server_loader_t *lo static apt_bool_t unimrcp_server_mrcpv1_profile_load(unimrcp_server_loader_t *loader, const apr_xml_elem *root, const char *id) { const apr_xml_elem *elem; - mrcp_profile_t *profile; + mrcp_server_profile_t *profile; mrcp_sig_agent_t *rtsp_agent = NULL; mpf_engine_t *media_engine = NULL; mpf_termination_factory_t *rtp_factory = NULL; diff --git a/libs/unimrcp/tests/mrcptest/src/parse_gen_suite.c b/libs/unimrcp/tests/mrcptest/src/parse_gen_suite.c index 13b32915f9..9d087cdcb3 100644 --- a/libs/unimrcp/tests/mrcptest/src/parse_gen_suite.c +++ b/libs/unimrcp/tests/mrcptest/src/parse_gen_suite.c @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * $Id: parse_gen_suite.c 2215 2014-11-06 03:07:23Z achaloyan@gmail.com $ + * $Id: parse_gen_suite.c 2249 2014-11-19 05:26:24Z achaloyan@gmail.com $ */ #include @@ -39,15 +39,15 @@ static apt_bool_t test_stream_generate(mrcp_generator_t *generator, mrcp_message if(status == APT_MESSAGE_STATUS_COMPLETE) { stream.text.length = stream.pos - stream.text.buf; *stream.pos = '\0'; - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Generated MRCP Stream [%"APR_SIZE_T_FMT" bytes]\n%s",stream.text.length,stream.text.buf); + apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Generated MRCPv2 Data [%"APR_SIZE_T_FMT" bytes]\n%s",stream.text.length,stream.text.buf); } else if(status == APT_MESSAGE_STATUS_INCOMPLETE) { *stream.pos = '\0'; - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Generated MRCP Stream [%"APR_SIZE_T_FMT" bytes] continuation awaited\n%s",stream.text.length,stream.text.buf); + apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Generated MRCPv2 Data [%"APR_SIZE_T_FMT" bytes] continuation awaited\n%s",stream.text.length,stream.text.buf); continuation = TRUE; } else if(status == APT_MESSAGE_STATUS_INVALID) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Generate MRCP Stream"); + apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Generate MRCPv2 Data"); } } while(continuation == TRUE); @@ -128,7 +128,7 @@ static apt_bool_t test_file_process(apt_test_suite_t *suite, mrcp_resource_facto /* calculate actual length of the stream */ stream.text.length = offset + length; stream.pos[length] = '\0'; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Parse MRCP Stream [%"APR_SIZE_T_FMT" bytes]\n%s",length,stream.pos); + apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Parse MRCPv2 Data [%"APR_SIZE_T_FMT" bytes]\n%s",length,stream.pos); /* reset pos */ apt_text_stream_reset(&stream); diff --git a/libs/unimrcp/tests/rtsptest/src/parse_gen_suite.c b/libs/unimrcp/tests/rtsptest/src/parse_gen_suite.c index b860770dbd..136ded899b 100644 --- a/libs/unimrcp/tests/rtsptest/src/parse_gen_suite.c +++ b/libs/unimrcp/tests/rtsptest/src/parse_gen_suite.c @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * - * $Id: parse_gen_suite.c 2240 2014-11-13 01:18:47Z achaloyan@gmail.com $ + * $Id: parse_gen_suite.c 2249 2014-11-19 05:26:24Z achaloyan@gmail.com $ */ #include @@ -36,15 +36,15 @@ static apt_bool_t test_stream_generate(rtsp_generator_t *generator, rtsp_message if(status == APT_MESSAGE_STATUS_COMPLETE) { stream.text.length = stream.pos - stream.text.buf; *stream.pos = '\0'; - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Generated RTSP Stream [%"APR_SIZE_T_FMT" bytes]\n%s",stream.text.length,stream.text.buf); + apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Generated RTSP Data [%"APR_SIZE_T_FMT" bytes]\n%s",stream.text.length,stream.text.buf); } else if(status == APT_MESSAGE_STATUS_INCOMPLETE) { *stream.pos = '\0'; - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Generated RTSP Stream [%"APR_SIZE_T_FMT" bytes] continuation awaited\n%s",stream.text.length,stream.text.buf); + apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Generated RTSP Data [%"APR_SIZE_T_FMT" bytes] continuation awaited\n%s",stream.text.length,stream.text.buf); continuation = TRUE; } else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Generate RTSP Stream"); + apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Generate RTSP Data"); } } while(continuation == TRUE); @@ -95,7 +95,7 @@ static apt_bool_t test_file_process(apt_test_suite_t *suite, const char *file_pa /* calculate actual length of the stream */ stream.text.length = offset + length; stream.pos[length] = '\0'; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Parse RTSP Stream [%"APR_SIZE_T_FMT" bytes]\n%s",length,stream.pos); + apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Parse RTSP Data [%"APR_SIZE_T_FMT" bytes]\n%s",length,stream.pos); /* reset pos */ apt_text_stream_reset(&stream); From 382e683b15748473e1c06774f0b8bc56cc7210f2 Mon Sep 17 00:00:00 2001 From: matteo brancaleoni Date: Tue, 25 Nov 2014 15:38:45 +0100 Subject: [PATCH 13/95] Use FTDM_UINT64_FMT macro to log uint64_t values, in order to not break x86 builds. --- libs/freetdm/src/ftdm_io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 0b0673ba84..9e43c526dc 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -1497,7 +1497,7 @@ static __inline__ int chan_is_avail(ftdm_channel_t *check) } /* circuit now available for outbound dialing */ check->last_release_time = 0; - ftdm_log_chan(check, FTDM_LOG_DEBUG, "Channel is now available, release guard timer expired %zdms ago\n", (time_diff - check->span->sig_release_guard_time_ms)); + ftdm_log_chan(check, FTDM_LOG_DEBUG, "Channel is now available, release guard timer expired %" FTDM_UINT64_FMT "ms ago\n", (time_diff - check->span->sig_release_guard_time_ms)); } return 1; } From 5bbef7f1e500d6f11d57559cedfd140e77523681 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 25 Nov 2014 17:02:10 -0600 Subject: [PATCH 14/95] FS-7015 #comment please test --- src/mod/endpoints/mod_sofia/sofia.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index c602d4273d..bd450b7ddd 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -6551,7 +6551,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, } } tech_pvt->mparams.last_sdp_str = NULL; - + tech_pvt->mparams.last_sdp_response = NULL; if (r_sdp && (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA))) { const char *var; From e55aee14bb186e516e117e00e44e8c84ffd51b53 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Sun, 30 Nov 2014 16:55:01 -0600 Subject: [PATCH 15/95] FS-7025 %FEATURE #comment please test --- src/switch_core_io.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/switch_core_io.c b/src/switch_core_io.c index 1cd902473e..69e98e84f5 100644 --- a/src/switch_core_io.c +++ b/src/switch_core_io.c @@ -1838,10 +1838,26 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_send_dtmf(switch_core_sessio if (switch_channel_test_flag(session->channel, CF_DROP_DTMF)) { const char *file = switch_channel_get_variable_dup(session->channel, "drop_dtmf_masking_file", SWITCH_FALSE, -1); + const char *digits; if (!zstr(file)) { switch_ivr_broadcast(switch_core_session_get_uuid(session), file, SMF_ECHO_ALEG); } + + if ((digits = switch_channel_get_variable_dup(session->channel, "drop_dtmf_masking_digits", SWITCH_FALSE, -1)) && !zstr(digits)) { + char *p; + switch_dtmf_t x_dtmf = { 0, switch_core_default_dtmf_duration(0), DTMF_FLAG_SKIP_PROCESS, 0}; + + switch_channel_clear_flag(session->channel, CF_DROP_DTMF); + for(p = digits; p && *p; p++) { + if (is_dtmf(*p)) { + x_dtmf.digit = *p; + switch_core_session_send_dtmf(session, &x_dtmf); + } + } + switch_channel_set_flag(session->channel, CF_DROP_DTMF); + } + return SWITCH_STATUS_SUCCESS; } From dc9e9042d16554830bdec0d691f003f90057cfe2 Mon Sep 17 00:00:00 2001 From: Seven Du Date: Mon, 1 Dec 2014 09:40:18 +0800 Subject: [PATCH 16/95] #comment FS-7025 fix compiler warning introduced from e55aee14 --- src/switch_core_io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/switch_core_io.c b/src/switch_core_io.c index 69e98e84f5..7589832d59 100644 --- a/src/switch_core_io.c +++ b/src/switch_core_io.c @@ -1845,7 +1845,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_send_dtmf(switch_core_sessio } if ((digits = switch_channel_get_variable_dup(session->channel, "drop_dtmf_masking_digits", SWITCH_FALSE, -1)) && !zstr(digits)) { - char *p; + const char *p; switch_dtmf_t x_dtmf = { 0, switch_core_default_dtmf_duration(0), DTMF_FLAG_SKIP_PROCESS, 0}; switch_channel_clear_flag(session->channel, CF_DROP_DTMF); From 46adbece5ea98bea7ef9bb141c3f01073698164c Mon Sep 17 00:00:00 2001 From: Chris Rienzo Date: Mon, 1 Dec 2014 14:53:25 -0500 Subject: [PATCH 17/95] FS-7030 #comment [unimrcp] restore visual studio 2010/2012 project files added by FS project --- .../libs/apr-toolkit/aprtoolkit.2010.vcxproj | 163 ++++++++++++ .../libs/apr-toolkit/aprtoolkit.2012.vcxproj | 167 ++++++++++++ libs/unimrcp/libs/mpf/mpf.2010.vcxproj | 191 ++++++++++++++ .../unimrcp/libs/mpf/mpf.2010.vcxproj.filters | 239 ++++++++++++++++++ libs/unimrcp/libs/mpf/mpf.2012.vcxproj | 195 ++++++++++++++ .../unimrcp/libs/mpf/mpf.2012.vcxproj.filters | 233 +++++++++++++++++ .../libs/mrcp-client/mrcpclient.2010.vcxproj | 122 +++++++++ .../libs/mrcp-client/mrcpclient.2012.vcxproj | 126 +++++++++ .../mrcp-signaling/mrcpsignaling.2010.vcxproj | 121 +++++++++ .../mrcpsignaling.2010.vcxproj.filters | 35 +++ .../mrcp-signaling/mrcpsignaling.2012.vcxproj | 125 +++++++++ .../mrcpsignaling.2012.vcxproj.filters | 35 +++ libs/unimrcp/libs/mrcp/mrcp.2010.vcxproj | 154 +++++++++++ .../libs/mrcp/mrcp.2010.vcxproj.filters | 133 ++++++++++ libs/unimrcp/libs/mrcp/mrcp.2012.vcxproj | 158 ++++++++++++ .../libs/mrcp/mrcp.2012.vcxproj.filters | 151 +++++++++++ .../mrcpv2transport.2010.vcxproj | 124 +++++++++ .../mrcpv2transport.2010.vcxproj.filters | 44 ++++ .../mrcpv2transport.2012.vcxproj | 128 ++++++++++ .../mrcpv2transport.2012.vcxproj.filters | 44 ++++ .../libs/uni-rtsp/unirtsp.2010.vcxproj | 132 ++++++++++ .../uni-rtsp/unirtsp.2010.vcxproj.filters | 56 ++++ .../libs/uni-rtsp/unirtsp.2012.vcxproj | 136 ++++++++++ .../uni-rtsp/unirtsp.2012.vcxproj.filters | 56 ++++ .../mrcp-sofiasip/mrcpsofiasip.2010.vcxproj | 138 ++++++++++ .../mrcpsofiasip.2010.vcxproj.filters | 35 +++ .../mrcp-sofiasip/mrcpsofiasip.2012.vcxproj | 142 +++++++++++ .../mrcpsofiasip.2012.vcxproj.filters | 35 +++ .../mrcp-unirtsp/mrcpunirtsp.2010.vcxproj | 133 ++++++++++ .../mrcpunirtsp.2010.vcxproj.filters | 35 +++ .../mrcp-unirtsp/mrcpunirtsp.2012.vcxproj | 137 ++++++++++ .../mrcpunirtsp.2012.vcxproj.filters | 35 +++ 32 files changed, 3758 insertions(+) create mode 100644 libs/unimrcp/libs/apr-toolkit/aprtoolkit.2010.vcxproj create mode 100644 libs/unimrcp/libs/apr-toolkit/aprtoolkit.2012.vcxproj create mode 100644 libs/unimrcp/libs/mpf/mpf.2010.vcxproj create mode 100644 libs/unimrcp/libs/mpf/mpf.2010.vcxproj.filters create mode 100644 libs/unimrcp/libs/mpf/mpf.2012.vcxproj create mode 100644 libs/unimrcp/libs/mpf/mpf.2012.vcxproj.filters create mode 100644 libs/unimrcp/libs/mrcp-client/mrcpclient.2010.vcxproj create mode 100644 libs/unimrcp/libs/mrcp-client/mrcpclient.2012.vcxproj create mode 100644 libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.2010.vcxproj create mode 100644 libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.2010.vcxproj.filters create mode 100644 libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.2012.vcxproj create mode 100644 libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.2012.vcxproj.filters create mode 100644 libs/unimrcp/libs/mrcp/mrcp.2010.vcxproj create mode 100644 libs/unimrcp/libs/mrcp/mrcp.2010.vcxproj.filters create mode 100644 libs/unimrcp/libs/mrcp/mrcp.2012.vcxproj create mode 100644 libs/unimrcp/libs/mrcp/mrcp.2012.vcxproj.filters create mode 100644 libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2010.vcxproj create mode 100644 libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2010.vcxproj.filters create mode 100644 libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2012.vcxproj create mode 100644 libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2012.vcxproj.filters create mode 100644 libs/unimrcp/libs/uni-rtsp/unirtsp.2010.vcxproj create mode 100644 libs/unimrcp/libs/uni-rtsp/unirtsp.2010.vcxproj.filters create mode 100644 libs/unimrcp/libs/uni-rtsp/unirtsp.2012.vcxproj create mode 100644 libs/unimrcp/libs/uni-rtsp/unirtsp.2012.vcxproj.filters create mode 100644 libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2010.vcxproj create mode 100644 libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2010.vcxproj.filters create mode 100644 libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2012.vcxproj create mode 100644 libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2012.vcxproj.filters create mode 100644 libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.2010.vcxproj create mode 100644 libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.2010.vcxproj.filters create mode 100644 libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.2012.vcxproj create mode 100644 libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.2012.vcxproj.filters diff --git a/libs/unimrcp/libs/apr-toolkit/aprtoolkit.2010.vcxproj b/libs/unimrcp/libs/apr-toolkit/aprtoolkit.2010.vcxproj new file mode 100644 index 0000000000..5a8627dbff --- /dev/null +++ b/libs/unimrcp/libs/apr-toolkit/aprtoolkit.2010.vcxproj @@ -0,0 +1,163 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + aprtoolkit + {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2} + aprtoolkit + Win32Proj + + + + StaticLibrary + Unicode + true + + + StaticLibrary + Unicode + + + StaticLibrary + Unicode + true + + + StaticLibrary + Unicode + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + + + + APT_STATIC_LIB;%(PreprocessorDefinitions) + + + + + X64 + + + APT_STATIC_LIB;%(PreprocessorDefinitions) + ProgramDatabase + + + + + APT_STATIC_LIB;%(PreprocessorDefinitions) + + + + + X64 + + + APT_STATIC_LIB;%(PreprocessorDefinitions) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {f057da7f-79e5-4b00-845c-ef446ef055e3} + false + + + + + + \ No newline at end of file diff --git a/libs/unimrcp/libs/apr-toolkit/aprtoolkit.2012.vcxproj b/libs/unimrcp/libs/apr-toolkit/aprtoolkit.2012.vcxproj new file mode 100644 index 0000000000..646ab231ea --- /dev/null +++ b/libs/unimrcp/libs/apr-toolkit/aprtoolkit.2012.vcxproj @@ -0,0 +1,167 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + aprtoolkit + {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2} + aprtoolkit + Win32Proj + + + + StaticLibrary + Unicode + true + v110 + + + StaticLibrary + Unicode + v110 + + + StaticLibrary + Unicode + true + v110 + + + StaticLibrary + Unicode + v110 + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + + + + APT_STATIC_LIB;%(PreprocessorDefinitions) + + + + + X64 + + + APT_STATIC_LIB;%(PreprocessorDefinitions) + ProgramDatabase + + + + + APT_STATIC_LIB;%(PreprocessorDefinitions) + + + + + X64 + + + APT_STATIC_LIB;%(PreprocessorDefinitions) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {f057da7f-79e5-4b00-845c-ef446ef055e3} + false + + + + + + diff --git a/libs/unimrcp/libs/mpf/mpf.2010.vcxproj b/libs/unimrcp/libs/mpf/mpf.2010.vcxproj new file mode 100644 index 0000000000..2a89b638c5 --- /dev/null +++ b/libs/unimrcp/libs/mpf/mpf.2010.vcxproj @@ -0,0 +1,191 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + mpf + {B5A00BFA-6083-4FAE-A097-71642D6473B5} + mpf + Win32Proj + + + + StaticLibrary + Unicode + true + + + StaticLibrary + Unicode + + + StaticLibrary + Unicode + true + + + StaticLibrary + Unicode + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + + + + codecs;%(AdditionalIncludeDirectories) + APT_STATIC_LIB;MPF_STATIC_LIB;%(PreprocessorDefinitions) + + + + + X64 + + + codecs;%(AdditionalIncludeDirectories) + APT_STATIC_LIB;MPF_STATIC_LIB;%(PreprocessorDefinitions) + false + ProgramDatabase + + + + + codecs;%(AdditionalIncludeDirectories) + APT_STATIC_LIB;MPF_STATIC_LIB;%(PreprocessorDefinitions) + + + + + X64 + + + codecs;%(AdditionalIncludeDirectories) + APT_STATIC_LIB;MPF_STATIC_LIB;%(PreprocessorDefinitions) + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libs/unimrcp/libs/mpf/mpf.2010.vcxproj.filters b/libs/unimrcp/libs/mpf/mpf.2010.vcxproj.filters new file mode 100644 index 0000000000..0e4bc84d13 --- /dev/null +++ b/libs/unimrcp/libs/mpf/mpf.2010.vcxproj.filters @@ -0,0 +1,239 @@ + + + + + {3d69fc35-a195-4376-9508-ef77d7b27e71} + + + {81e2eace-c57a-4135-92cd-cc3575dfb088} + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {6fc3533a-b688-477d-914d-e0ffb15aa9a9} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + + + codecs\g711 + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + + + codecs\g711 + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + \ No newline at end of file diff --git a/libs/unimrcp/libs/mpf/mpf.2012.vcxproj b/libs/unimrcp/libs/mpf/mpf.2012.vcxproj new file mode 100644 index 0000000000..9a8e7ed24b --- /dev/null +++ b/libs/unimrcp/libs/mpf/mpf.2012.vcxproj @@ -0,0 +1,195 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + mpf + {B5A00BFA-6083-4FAE-A097-71642D6473B5} + mpf + Win32Proj + + + + StaticLibrary + Unicode + true + v110 + + + StaticLibrary + Unicode + v110 + + + StaticLibrary + Unicode + true + v110 + + + StaticLibrary + Unicode + v110 + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + + + + codecs;%(AdditionalIncludeDirectories) + APT_STATIC_LIB;MPF_STATIC_LIB;%(PreprocessorDefinitions) + + + + + X64 + + + codecs;%(AdditionalIncludeDirectories) + APT_STATIC_LIB;MPF_STATIC_LIB;%(PreprocessorDefinitions) + false + ProgramDatabase + + + + + codecs;%(AdditionalIncludeDirectories) + APT_STATIC_LIB;MPF_STATIC_LIB;%(PreprocessorDefinitions) + + + + + X64 + + + codecs;%(AdditionalIncludeDirectories) + APT_STATIC_LIB;MPF_STATIC_LIB;%(PreprocessorDefinitions) + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/libs/unimrcp/libs/mpf/mpf.2012.vcxproj.filters b/libs/unimrcp/libs/mpf/mpf.2012.vcxproj.filters new file mode 100644 index 0000000000..72d0db06fe --- /dev/null +++ b/libs/unimrcp/libs/mpf/mpf.2012.vcxproj.filters @@ -0,0 +1,233 @@ + + + + + {3d69fc35-a195-4376-9508-ef77d7b27e71} + + + {81e2eace-c57a-4135-92cd-cc3575dfb088} + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {6fc3533a-b688-477d-914d-e0ffb15aa9a9} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + + + codecs\g711 + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + src + + + + + codecs\g711 + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + diff --git a/libs/unimrcp/libs/mrcp-client/mrcpclient.2010.vcxproj b/libs/unimrcp/libs/mrcp-client/mrcpclient.2010.vcxproj new file mode 100644 index 0000000000..7a9d7856c6 --- /dev/null +++ b/libs/unimrcp/libs/mrcp-client/mrcpclient.2010.vcxproj @@ -0,0 +1,122 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + mrcpclient + {72782932-37CC-46AE-8C7F-9A7B1A6EE108} + mrcpclient + Win32Proj + + + + StaticLibrary + Unicode + true + + + StaticLibrary + Unicode + + + StaticLibrary + Unicode + true + + + StaticLibrary + Unicode + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + + + + APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions) + + + + + X64 + + + APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions) + ProgramDatabase + + + + + APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions) + + + + + X64 + + + APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions) + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libs/unimrcp/libs/mrcp-client/mrcpclient.2012.vcxproj b/libs/unimrcp/libs/mrcp-client/mrcpclient.2012.vcxproj new file mode 100644 index 0000000000..3426eb6381 --- /dev/null +++ b/libs/unimrcp/libs/mrcp-client/mrcpclient.2012.vcxproj @@ -0,0 +1,126 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + mrcpclient + {72782932-37CC-46AE-8C7F-9A7B1A6EE108} + mrcpclient + Win32Proj + + + + StaticLibrary + Unicode + true + v110 + + + StaticLibrary + Unicode + v110 + + + StaticLibrary + Unicode + true + v110 + + + StaticLibrary + Unicode + v110 + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + + + + APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions) + + + + + X64 + + + APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions) + ProgramDatabase + + + + + APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions) + + + + + X64 + + + APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions) + + + + + + + + + + + + + + + + + diff --git a/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.2010.vcxproj b/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.2010.vcxproj new file mode 100644 index 0000000000..f11e3bd765 --- /dev/null +++ b/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.2010.vcxproj @@ -0,0 +1,121 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + mrcpsignaling + {12A49562-BAB9-43A3-A21D-15B60BBB4C31} + mrcpsignaling + Win32Proj + + + + StaticLibrary + Unicode + true + + + StaticLibrary + Unicode + + + StaticLibrary + Unicode + true + + + StaticLibrary + Unicode + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + + + + APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions) + + + + + X64 + + + APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions) + ProgramDatabase + + + + + APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions) + + + + + X64 + + + APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions) + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.2010.vcxproj.filters b/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.2010.vcxproj.filters new file mode 100644 index 0000000000..4e5d30c3da --- /dev/null +++ b/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.2010.vcxproj.filters @@ -0,0 +1,35 @@ + + + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {f3dc550f-1a0f-4b9e-b077-3b6940dc5531} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + + + include + + + include + + + include + + + include + + + + + src + + + src + + + \ No newline at end of file diff --git a/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.2012.vcxproj b/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.2012.vcxproj new file mode 100644 index 0000000000..3127301c9d --- /dev/null +++ b/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.2012.vcxproj @@ -0,0 +1,125 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + mrcpsignaling + {12A49562-BAB9-43A3-A21D-15B60BBB4C31} + mrcpsignaling + Win32Proj + + + + StaticLibrary + Unicode + true + v110 + + + StaticLibrary + Unicode + v110 + + + StaticLibrary + Unicode + true + v110 + + + StaticLibrary + Unicode + v110 + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + + + + APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions) + + + + + X64 + + + APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions) + ProgramDatabase + + + + + APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions) + + + + + X64 + + + APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions) + + + + + + + + + + + + + + + + diff --git a/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.2012.vcxproj.filters b/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.2012.vcxproj.filters new file mode 100644 index 0000000000..4e5d30c3da --- /dev/null +++ b/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.2012.vcxproj.filters @@ -0,0 +1,35 @@ + + + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {f3dc550f-1a0f-4b9e-b077-3b6940dc5531} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + + + include + + + include + + + include + + + include + + + + + src + + + src + + + \ No newline at end of file diff --git a/libs/unimrcp/libs/mrcp/mrcp.2010.vcxproj b/libs/unimrcp/libs/mrcp/mrcp.2010.vcxproj new file mode 100644 index 0000000000..ed2c29bbf8 --- /dev/null +++ b/libs/unimrcp/libs/mrcp/mrcp.2010.vcxproj @@ -0,0 +1,154 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + mrcp + {1C320193-46A6-4B34-9C56-8AB584FC1B56} + mrcp + Win32Proj + + + + StaticLibrary + Unicode + true + + + StaticLibrary + Unicode + + + StaticLibrary + Unicode + true + + + StaticLibrary + Unicode + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + + + + %(AdditionalIncludeDirectories) + APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions) + + + + + X64 + + + %(AdditionalIncludeDirectories) + APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions) + ProgramDatabase + + + + + %(AdditionalIncludeDirectories) + APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions) + + + + + X64 + + + %(AdditionalIncludeDirectories) + APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libs/unimrcp/libs/mrcp/mrcp.2010.vcxproj.filters b/libs/unimrcp/libs/mrcp/mrcp.2010.vcxproj.filters new file mode 100644 index 0000000000..119921b34b --- /dev/null +++ b/libs/unimrcp/libs/mrcp/mrcp.2010.vcxproj.filters @@ -0,0 +1,133 @@ + + + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {19ad4bde-c4f4-4937-9073-ca2780341d76} + + + {8ec996ac-8a0a-4bf0-9b3c-535616585109} + h;hpp;hxx;hm;inl;inc;xsd + + + {5ba77874-7c17-4748-b5ba-b07b7f0a2169} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {f30fd049-a10d-4aea-b4bb-3eb674690fdd} + + + {7e71717b-6f22-4c59-ba50-7b5a15516b2f} + h;hpp;hxx;hm;inl;inc;xsd + + + {c66dbb84-ce9d-4408-b54d-4d0ec51069fb} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {f20cfd62-4bb9-42de-bf1c-d578c8cd1a18} + + + {039a4834-7ddb-40e7-9177-55d11ef1e733} + h;hpp;hxx;hm;inl;inc;xsd + + + {dc087d31-8ecf-473c-baa1-f3091e16014d} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + + + include + + + include + + + message\include + + + message\include + + + message\include + + + message\include + + + control\include + + + control\include + + + control\include + + + control\include + + + resources\include + + + resources\include + + + resources\include + + + resources\include + + + resources\include + + + resources\include + + + + + message\src + + + message\src + + + message\src + + + message\src + + + control\src + + + control\src + + + control\src + + + resources\src + + + resources\src + + + resources\src + + + resources\src + + + resources\src + + + resources\src + + + \ No newline at end of file diff --git a/libs/unimrcp/libs/mrcp/mrcp.2012.vcxproj b/libs/unimrcp/libs/mrcp/mrcp.2012.vcxproj new file mode 100644 index 0000000000..f3f11ff9e4 --- /dev/null +++ b/libs/unimrcp/libs/mrcp/mrcp.2012.vcxproj @@ -0,0 +1,158 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + mrcp + {1C320193-46A6-4B34-9C56-8AB584FC1B56} + mrcp + Win32Proj + + + + StaticLibrary + Unicode + true + v110 + + + StaticLibrary + Unicode + v110 + + + StaticLibrary + Unicode + true + v110 + + + StaticLibrary + Unicode + v110 + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + + + + %(AdditionalIncludeDirectories) + APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions) + + + + + X64 + + + %(AdditionalIncludeDirectories) + APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions) + ProgramDatabase + + + + + %(AdditionalIncludeDirectories) + APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions) + + + + + X64 + + + %(AdditionalIncludeDirectories) + APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/libs/unimrcp/libs/mrcp/mrcp.2012.vcxproj.filters b/libs/unimrcp/libs/mrcp/mrcp.2012.vcxproj.filters new file mode 100644 index 0000000000..03e7ae72e8 --- /dev/null +++ b/libs/unimrcp/libs/mrcp/mrcp.2012.vcxproj.filters @@ -0,0 +1,151 @@ + + + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {19ad4bde-c4f4-4937-9073-ca2780341d76} + + + {8ec996ac-8a0a-4bf0-9b3c-535616585109} + h;hpp;hxx;hm;inl;inc;xsd + + + {5ba77874-7c17-4748-b5ba-b07b7f0a2169} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {f30fd049-a10d-4aea-b4bb-3eb674690fdd} + + + {7e71717b-6f22-4c59-ba50-7b5a15516b2f} + h;hpp;hxx;hm;inl;inc;xsd + + + {c66dbb84-ce9d-4408-b54d-4d0ec51069fb} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {f20cfd62-4bb9-42de-bf1c-d578c8cd1a18} + + + {039a4834-7ddb-40e7-9177-55d11ef1e733} + h;hpp;hxx;hm;inl;inc;xsd + + + {dc087d31-8ecf-473c-baa1-f3091e16014d} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + + + include + + + include + + + message\include + + + message\include + + + message\include + + + message\include + + + control\include + + + control\include + + + control\include + + + control\include + + + resources\include + + + resources\include + + + resources\include + + + resources\include + + + resources\include + + + resources\include + + + include + + + include + + + include + + + + + message\src + + + message\src + + + message\src + + + message\src + + + control\src + + + control\src + + + control\src + + + resources\src + + + resources\src + + + resources\src + + + resources\src + + + resources\src + + + resources\src + + + message\src + + + message\src + + + message\src + + + diff --git a/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2010.vcxproj b/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2010.vcxproj new file mode 100644 index 0000000000..33ed618305 --- /dev/null +++ b/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2010.vcxproj @@ -0,0 +1,124 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + mrcpv2transport + {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA} + mrcpv2transport + Win32Proj + + + + StaticLibrary + Unicode + true + + + StaticLibrary + Unicode + + + StaticLibrary + Unicode + true + + + StaticLibrary + Unicode + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + + + + APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions) + + + + + X64 + + + APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions) + ProgramDatabase + + + + + APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions) + + + + + X64 + + + APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions) + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2010.vcxproj.filters b/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2010.vcxproj.filters new file mode 100644 index 0000000000..452f77e19d --- /dev/null +++ b/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2010.vcxproj.filters @@ -0,0 +1,44 @@ + + + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {a92d3b8c-d54d-416c-b458-dc57ac24d2e9} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + + + include + + + include + + + include + + + include + + + include + + + + + src + + + src + + + src + + + src + + + \ No newline at end of file diff --git a/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2012.vcxproj b/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2012.vcxproj new file mode 100644 index 0000000000..64f3fb5ffc --- /dev/null +++ b/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2012.vcxproj @@ -0,0 +1,128 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + mrcpv2transport + {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA} + mrcpv2transport + Win32Proj + + + + StaticLibrary + Unicode + true + v110 + + + StaticLibrary + Unicode + v110 + + + StaticLibrary + Unicode + true + v110 + + + StaticLibrary + Unicode + v110 + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + + + + APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions) + + + + + X64 + + + APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions) + ProgramDatabase + + + + + APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions) + + + + + X64 + + + APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions) + + + + + + + + + + + + + + + + + + + diff --git a/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2012.vcxproj.filters b/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2012.vcxproj.filters new file mode 100644 index 0000000000..452f77e19d --- /dev/null +++ b/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2012.vcxproj.filters @@ -0,0 +1,44 @@ + + + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {a92d3b8c-d54d-416c-b458-dc57ac24d2e9} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + + + include + + + include + + + include + + + include + + + include + + + + + src + + + src + + + src + + + src + + + \ No newline at end of file diff --git a/libs/unimrcp/libs/uni-rtsp/unirtsp.2010.vcxproj b/libs/unimrcp/libs/uni-rtsp/unirtsp.2010.vcxproj new file mode 100644 index 0000000000..9fad4f7787 --- /dev/null +++ b/libs/unimrcp/libs/uni-rtsp/unirtsp.2010.vcxproj @@ -0,0 +1,132 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + unirtsp + {504B3154-7A4F-459D-9877-B951021C3F1F} + unirtsp + Win32Proj + + + + StaticLibrary + Unicode + true + + + StaticLibrary + Unicode + + + StaticLibrary + Unicode + true + + + StaticLibrary + Unicode + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + + + + codecs;%(AdditionalIncludeDirectories) + APT_STATIC_LIB;%(PreprocessorDefinitions) + + + + + X64 + + + codecs;%(AdditionalIncludeDirectories) + APT_STATIC_LIB;%(PreprocessorDefinitions) + ProgramDatabase + + + + + codecs;%(AdditionalIncludeDirectories) + APT_STATIC_LIB;%(PreprocessorDefinitions) + + + + + X64 + + + codecs;%(AdditionalIncludeDirectories) + APT_STATIC_LIB;%(PreprocessorDefinitions) + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libs/unimrcp/libs/uni-rtsp/unirtsp.2010.vcxproj.filters b/libs/unimrcp/libs/uni-rtsp/unirtsp.2010.vcxproj.filters new file mode 100644 index 0000000000..5a1581a2c3 --- /dev/null +++ b/libs/unimrcp/libs/uni-rtsp/unirtsp.2010.vcxproj.filters @@ -0,0 +1,56 @@ + + + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {fd4564ef-9f34-4f23-992d-37f127e289a2} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + + + src + + + src + + + src + + + src + + + src + + + src + + + \ No newline at end of file diff --git a/libs/unimrcp/libs/uni-rtsp/unirtsp.2012.vcxproj b/libs/unimrcp/libs/uni-rtsp/unirtsp.2012.vcxproj new file mode 100644 index 0000000000..2d9628ec07 --- /dev/null +++ b/libs/unimrcp/libs/uni-rtsp/unirtsp.2012.vcxproj @@ -0,0 +1,136 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + unirtsp + {504B3154-7A4F-459D-9877-B951021C3F1F} + unirtsp + Win32Proj + + + + StaticLibrary + Unicode + true + v110 + + + StaticLibrary + Unicode + v110 + + + StaticLibrary + Unicode + true + v110 + + + StaticLibrary + Unicode + v110 + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + + + + codecs;%(AdditionalIncludeDirectories) + APT_STATIC_LIB;%(PreprocessorDefinitions) + + + + + X64 + + + codecs;%(AdditionalIncludeDirectories) + APT_STATIC_LIB;%(PreprocessorDefinitions) + ProgramDatabase + + + + + codecs;%(AdditionalIncludeDirectories) + APT_STATIC_LIB;%(PreprocessorDefinitions) + + + + + X64 + + + codecs;%(AdditionalIncludeDirectories) + APT_STATIC_LIB;%(PreprocessorDefinitions) + + + + + + + + + + + + + + + + + + + + + + + diff --git a/libs/unimrcp/libs/uni-rtsp/unirtsp.2012.vcxproj.filters b/libs/unimrcp/libs/uni-rtsp/unirtsp.2012.vcxproj.filters new file mode 100644 index 0000000000..5a1581a2c3 --- /dev/null +++ b/libs/unimrcp/libs/uni-rtsp/unirtsp.2012.vcxproj.filters @@ -0,0 +1,56 @@ + + + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {fd4564ef-9f34-4f23-992d-37f127e289a2} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + + + include + + + include + + + include + + + include + + + include + + + include + + + include + + + + + src + + + src + + + src + + + src + + + src + + + src + + + \ No newline at end of file diff --git a/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2010.vcxproj b/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2010.vcxproj new file mode 100644 index 0000000000..b3931497c7 --- /dev/null +++ b/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2010.vcxproj @@ -0,0 +1,138 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + mrcpsofiasip + {746F3632-5BB2-4570-9453-31D6D58A7D8E} + mrcpsofiasip + Win32Proj + + + + StaticLibrary + Unicode + true + + + StaticLibrary + Unicode + + + StaticLibrary + Unicode + true + + + StaticLibrary + Unicode + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + + + + include;%(AdditionalIncludeDirectories) + APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;LIBSOFIA_SIP_UA_STATIC;%(PreprocessorDefinitions) + + + + + X64 + + + include;%(AdditionalIncludeDirectories) + APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;LIBSOFIA_SIP_UA_STATIC;%(PreprocessorDefinitions) + ProgramDatabase + + + + + include;%(AdditionalIncludeDirectories) + APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;LIBSOFIA_SIP_UA_STATIC;%(PreprocessorDefinitions) + + + + + X64 + + + include;%(AdditionalIncludeDirectories) + APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;LIBSOFIA_SIP_UA_STATIC;%(PreprocessorDefinitions) + + + + + + + + + + + + + + + {70a49bc2-7500-41d0-b75d-edcc5be987a0} + + + + + + \ No newline at end of file diff --git a/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2010.vcxproj.filters b/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2010.vcxproj.filters new file mode 100644 index 0000000000..d2157eea88 --- /dev/null +++ b/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2010.vcxproj.filters @@ -0,0 +1,35 @@ + + + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {6e92b598-880e-4fe5-88fb-f69df8e06a57} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + + + include + + + include + + + include + + + + + src + + + src + + + src + + + \ No newline at end of file diff --git a/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2012.vcxproj b/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2012.vcxproj new file mode 100644 index 0000000000..eed2e6e906 --- /dev/null +++ b/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2012.vcxproj @@ -0,0 +1,142 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + mrcpsofiasip + {746F3632-5BB2-4570-9453-31D6D58A7D8E} + mrcpsofiasip + Win32Proj + + + + StaticLibrary + Unicode + true + v110 + + + StaticLibrary + Unicode + v110 + + + StaticLibrary + Unicode + true + v110 + + + StaticLibrary + Unicode + v110 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + + + + include;%(AdditionalIncludeDirectories) + APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;LIBSOFIA_SIP_UA_STATIC;%(PreprocessorDefinitions) + + + + + X64 + + + include;%(AdditionalIncludeDirectories) + APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;LIBSOFIA_SIP_UA_STATIC;%(PreprocessorDefinitions) + ProgramDatabase + + + + + include;%(AdditionalIncludeDirectories) + APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;LIBSOFIA_SIP_UA_STATIC;%(PreprocessorDefinitions) + + + + + X64 + + + include;%(AdditionalIncludeDirectories) + APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;LIBSOFIA_SIP_UA_STATIC;%(PreprocessorDefinitions) + + + + + + + + + + + + + + + {70a49bc2-7500-41d0-b75d-edcc5be987a0} + + + + + + diff --git a/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2012.vcxproj.filters b/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2012.vcxproj.filters new file mode 100644 index 0000000000..d2157eea88 --- /dev/null +++ b/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2012.vcxproj.filters @@ -0,0 +1,35 @@ + + + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {6e92b598-880e-4fe5-88fb-f69df8e06a57} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + + + include + + + include + + + include + + + + + src + + + src + + + src + + + \ No newline at end of file diff --git a/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.2010.vcxproj b/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.2010.vcxproj new file mode 100644 index 0000000000..f8a573d857 --- /dev/null +++ b/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.2010.vcxproj @@ -0,0 +1,133 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + mrcpunirtsp + {DEB01ACB-D65F-4A62-AED9-58C1054499E9} + mrcpunirtsp + Win32Proj + + + + StaticLibrary + Unicode + true + + + StaticLibrary + Unicode + + + StaticLibrary + Unicode + true + + + StaticLibrary + Unicode + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + + + + include;%(AdditionalIncludeDirectories) + APT_STATIC_LIB;RTSP_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;LIBSOFIA_SIP_UA_STATIC;%(PreprocessorDefinitions) + + + + + X64 + + + include;%(AdditionalIncludeDirectories) + APT_STATIC_LIB;RTSP_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;LIBSOFIA_SIP_UA_STATIC;%(PreprocessorDefinitions) + ProgramDatabase + + + + + include;%(AdditionalIncludeDirectories) + APT_STATIC_LIB;RTSP_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;LIBSOFIA_SIP_UA_STATIC;%(PreprocessorDefinitions) + + + + + X64 + + + include;%(AdditionalIncludeDirectories) + APT_STATIC_LIB;RTSP_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;LIBSOFIA_SIP_UA_STATIC;%(PreprocessorDefinitions) + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.2010.vcxproj.filters b/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.2010.vcxproj.filters new file mode 100644 index 0000000000..a990550f29 --- /dev/null +++ b/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.2010.vcxproj.filters @@ -0,0 +1,35 @@ + + + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {f87f8ada-12d1-412b-bd14-7e62df3f92a0} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + + + include + + + include + + + include + + + + + src + + + src + + + src + + + \ No newline at end of file diff --git a/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.2012.vcxproj b/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.2012.vcxproj new file mode 100644 index 0000000000..e437916ee8 --- /dev/null +++ b/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.2012.vcxproj @@ -0,0 +1,137 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + mrcpunirtsp + {DEB01ACB-D65F-4A62-AED9-58C1054499E9} + mrcpunirtsp + Win32Proj + + + + StaticLibrary + Unicode + true + v110 + + + StaticLibrary + Unicode + v110 + + + StaticLibrary + Unicode + true + v110 + + + StaticLibrary + Unicode + v110 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + $(PlatformName)\$(Configuration)\ + + + + include;%(AdditionalIncludeDirectories) + APT_STATIC_LIB;RTSP_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;LIBSOFIA_SIP_UA_STATIC;%(PreprocessorDefinitions) + + + + + X64 + + + include;%(AdditionalIncludeDirectories) + APT_STATIC_LIB;RTSP_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;LIBSOFIA_SIP_UA_STATIC;%(PreprocessorDefinitions) + ProgramDatabase + + + + + include;%(AdditionalIncludeDirectories) + APT_STATIC_LIB;RTSP_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;LIBSOFIA_SIP_UA_STATIC;%(PreprocessorDefinitions) + + + + + X64 + + + include;%(AdditionalIncludeDirectories) + APT_STATIC_LIB;RTSP_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;LIBSOFIA_SIP_UA_STATIC;%(PreprocessorDefinitions) + + + + + + + + + + + + + + + + diff --git a/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.2012.vcxproj.filters b/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.2012.vcxproj.filters new file mode 100644 index 0000000000..a990550f29 --- /dev/null +++ b/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.2012.vcxproj.filters @@ -0,0 +1,35 @@ + + + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {f87f8ada-12d1-412b-bd14-7e62df3f92a0} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + + + include + + + include + + + include + + + + + src + + + src + + + src + + + \ No newline at end of file From bad5dc3022c56af44f1920d272eb34d628e60cb1 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 1 Dec 2014 15:10:00 -0600 Subject: [PATCH 18/95] FS-7037 #resolve --- src/mod/endpoints/mod_sofia/sofia.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index bd450b7ddd..0f0f492e99 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -6539,12 +6539,12 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, goto done; } - if (!r_sdp && (status > 100 || switch_channel_test_flag(channel, CF_ANSWERED)) && status < 300) { - if (ss_state == nua_callstate_ready) { + if (!r_sdp && (status == 100 || status == 200)) { + if (ss_state == nua_callstate_completing) { if (tech_pvt->mparams.last_sdp_response) { r_sdp = tech_pvt->mparams.last_sdp_response; } - } else { + } else if (ss_state == nua_callstate_received) { if (tech_pvt->mparams.last_sdp_str) { r_sdp = tech_pvt->mparams.last_sdp_str; } From a8c5a0c87bf97ad0f84df2ad53d6eef2a951eee9 Mon Sep 17 00:00:00 2001 From: Hristo Trendev Date: Tue, 2 Dec 2014 17:08:12 +0100 Subject: [PATCH 19/95] add timezone support to mod_say_{de,es,ja,nl,th,zh} This is nothing more than a shameless copy/paste from another mod_say module, which already had timezone support. It simply checks if the timezone variable is set and if it contains a valid timezone, then this timezone will be used when announcing times/dates. FS-7048 #resolve --- src/mod/say/mod_say_de/mod_say_de.c | 15 ++++++++++++++- src/mod/say/mod_say_es/mod_say_es.c | 15 ++++++++++++++- src/mod/say/mod_say_ja/mod_say_ja.c | 15 ++++++++++++++- src/mod/say/mod_say_nl/mod_say_nl.c | 15 ++++++++++++++- src/mod/say/mod_say_th/mod_say_th.c | 15 ++++++++++++++- src/mod/say/mod_say_zh/mod_say_zh.c | 15 ++++++++++++++- 6 files changed, 84 insertions(+), 6 deletions(-) diff --git a/src/mod/say/mod_say_de/mod_say_de.c b/src/mod/say/mod_say_de/mod_say_de.c index 2116942ca2..00af9dd1fe 100644 --- a/src/mod/say/mod_say_de/mod_say_de.c +++ b/src/mod/say/mod_say_de/mod_say_de.c @@ -226,6 +226,8 @@ static switch_status_t de_say_time(switch_core_session_t *session, char *tosay, switch_time_t target = 0; switch_time_exp_t tm; uint8_t say_date = 0, say_time = 0; + switch_channel_t *channel = switch_core_session_get_channel(session); + const char *tz = switch_channel_get_variable(channel, "timezone"); if (say_args->type == SST_TIME_MEASUREMENT) { int64_t hours = 0; @@ -314,7 +316,18 @@ static switch_status_t de_say_time(switch_core_session_t *session, char *tosay, } else { target = switch_micro_time_now(); } - switch_time_exp_lt(&tm, target); + + if (tz) { + int check = atoi(tz); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Timezone is [%s]\n", tz); + if (check) { + switch_time_exp_tz(&tm, target, check); + } else { + switch_time_exp_tz_name(tz, &tm, target); + } + } else { + switch_time_exp_lt(&tm, target); + } switch (say_args->type) { case SST_CURRENT_DATE_TIME: diff --git a/src/mod/say/mod_say_es/mod_say_es.c b/src/mod/say/mod_say_es/mod_say_es.c index efda97b468..8de56e861e 100644 --- a/src/mod/say/mod_say_es/mod_say_es.c +++ b/src/mod/say/mod_say_es/mod_say_es.c @@ -220,6 +220,8 @@ static switch_status_t es_say_time(switch_core_session_t *session, char *tosay, switch_time_t target = 0; switch_time_exp_t tm; uint8_t say_date = 0, say_time = 0; + switch_channel_t *channel = switch_core_session_get_channel(session); + const char *tz = switch_channel_get_variable(channel, "timezone"); if (say_args->type == SST_TIME_MEASUREMENT) { int64_t hours = 0; @@ -304,7 +306,18 @@ static switch_status_t es_say_time(switch_core_session_t *session, char *tosay, } else { target = switch_micro_time_now(); } - switch_time_exp_lt(&tm, target); + + if (tz) { + int check = atoi(tz); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Timezone is [%s]\n", tz); + if (check) { + switch_time_exp_tz(&tm, target, check); + } else { + switch_time_exp_tz_name(tz, &tm, target); + } + } else { + switch_time_exp_lt(&tm, target); + } switch (say_args->type) { case SST_CURRENT_DATE_TIME: diff --git a/src/mod/say/mod_say_ja/mod_say_ja.c b/src/mod/say/mod_say_ja/mod_say_ja.c index 76d2ac69f9..72c7c38131 100644 --- a/src/mod/say/mod_say_ja/mod_say_ja.c +++ b/src/mod/say/mod_say_ja/mod_say_ja.c @@ -248,6 +248,8 @@ static switch_status_t ja_say_time(switch_core_session_t *session, char *tosay, switch_time_exp_t tm; uint8_t say_date = 0; uint8_t say_time = 0; + switch_channel_t *channel = switch_core_session_get_channel(session); + const char *tz = switch_channel_get_variable(channel, "timezone"); int mod_min; char buffer[3]; @@ -322,7 +324,18 @@ static switch_status_t ja_say_time(switch_core_session_t *session, char *tosay, target = switch_time_make(t, 0); else target = switch_micro_time_now(); - switch_time_exp_lt(&tm, target); + + if (tz) { + int check = atoi(tz); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Timezone is [%s]\n", tz); + if (check) { + switch_time_exp_tz(&tm, target, check); + } else { + switch_time_exp_tz_name(tz, &tm, target); + } + } else { + switch_time_exp_lt(&tm, target); + } switch (say_args->type) { case SST_CURRENT_DATE_TIME: diff --git a/src/mod/say/mod_say_nl/mod_say_nl.c b/src/mod/say/mod_say_nl/mod_say_nl.c index f6dec530d1..6ab2bb98bb 100644 --- a/src/mod/say/mod_say_nl/mod_say_nl.c +++ b/src/mod/say/mod_say_nl/mod_say_nl.c @@ -178,6 +178,8 @@ static switch_status_t nl_say_time(switch_core_session_t *session, char *tosay, switch_time_t target = 0; switch_time_exp_t tm; uint8_t say_date = 0, say_time = 0; + switch_channel_t *channel = switch_core_session_get_channel(session); + const char *tz = switch_channel_get_variable(channel, "timezone"); if (say_args->type == SST_TIME_MEASUREMENT) { int64_t hours = 0; @@ -262,7 +264,18 @@ static switch_status_t nl_say_time(switch_core_session_t *session, char *tosay, } else { target = switch_micro_time_now(); } - switch_time_exp_lt(&tm, target); + + if (tz) { + int check = atoi(tz); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Timezone is [%s]\n", tz); + if (check) { + switch_time_exp_tz(&tm, target, check); + } else { + switch_time_exp_tz_name(tz, &tm, target); + } + } else { + switch_time_exp_lt(&tm, target); + } switch (say_args->type) { case SST_CURRENT_DATE_TIME: diff --git a/src/mod/say/mod_say_th/mod_say_th.c b/src/mod/say/mod_say_th/mod_say_th.c index ac60b01d9a..a78251a024 100644 --- a/src/mod/say/mod_say_th/mod_say_th.c +++ b/src/mod/say/mod_say_th/mod_say_th.c @@ -234,6 +234,8 @@ static switch_status_t th_say_time(switch_core_session_t *session, char *tosay, int32_t t; switch_time_t target = 0; switch_time_exp_t tm; + switch_channel_t *channel = switch_core_session_get_channel(session); + const char *tz = switch_channel_get_variable(channel, "timezone"); #if 0 switch_time_t this_morning; switch_time_exp_t tm2; @@ -323,7 +325,18 @@ static switch_status_t th_say_time(switch_core_session_t *session, char *tosay, target = switch_time_make(t, 0); else target = switch_micro_time_now(); - switch_time_exp_lt(&tm, target); + + if (tz) { + int check = atoi(tz); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Timezone is [%s]\n", tz); + if (check) { + switch_time_exp_tz(&tm, target, check); + } else { + switch_time_exp_tz_name(tz, &tm, target); + } + } else { + switch_time_exp_lt(&tm, target); + } switch (say_args->type) { case SST_CURRENT_DATE_TIME: diff --git a/src/mod/say/mod_say_zh/mod_say_zh.c b/src/mod/say/mod_say_zh/mod_say_zh.c index 457654396d..f84932dd5c 100644 --- a/src/mod/say/mod_say_zh/mod_say_zh.c +++ b/src/mod/say/mod_say_zh/mod_say_zh.c @@ -198,6 +198,8 @@ static switch_status_t zh_say_time(switch_core_session_t *session, char *tosay, int32_t t; switch_time_t target = 0; switch_time_exp_t tm; + switch_channel_t *channel = switch_core_session_get_channel(session); + const char *tz = switch_channel_get_variable(channel, "timezone"); #if 0 switch_time_t this_morning; switch_time_exp_t tm2; @@ -287,7 +289,18 @@ static switch_status_t zh_say_time(switch_core_session_t *session, char *tosay, target = switch_time_make(t, 0); else target = switch_micro_time_now(); - switch_time_exp_lt(&tm, target); + + if (tz) { + int check = atoi(tz); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Timezone is [%s]\n", tz); + if (check) { + switch_time_exp_tz(&tm, target, check); + } else { + switch_time_exp_tz_name(tz, &tm, target); + } + } else { + switch_time_exp_lt(&tm, target); + } switch (say_args->type) { case SST_CURRENT_DATE_TIME: From 72c3df5ed39b724590b5266fb31eea090f56dba7 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 2 Dec 2014 16:46:08 -0600 Subject: [PATCH 20/95] FS-6891 FS-6713 #comment revert 1b612fecb6e8db11da9b15c5522b87e7b642423d --- src/switch_core_io.c | 2 +- src/switch_ivr_async.c | 154 ++++++++++++----------------------------- 2 files changed, 45 insertions(+), 111 deletions(-) diff --git a/src/switch_core_io.c b/src/switch_core_io.c index 7589832d59..8a1dd97120 100644 --- a/src/switch_core_io.c +++ b/src/switch_core_io.c @@ -1414,7 +1414,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess switch_time_t tdiff = diff; while(tdiff > 1) { - switch_buffer_write(bp->raw_write_buffer, fill_data, len); + switch_buffer_write(bp->raw_read_buffer, fill_data, len); tdiff--; } } diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index 1b209ae196..4dad74c6f9 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -1043,20 +1043,8 @@ struct record_helper { switch_time_t last_write_time; switch_bool_t hangup_on_error; switch_codec_implementation_t read_impl; - switch_bool_t speech_detected; - const char *completion_cause; }; -/** - * Set the recording completion cause. The cause can only be set once, to minimize the logic in the record_callback. - * [The completion_cause strings are essentially those of an MRCP Recorder resource.] - */ -static void set_completion_cause(struct record_helper *rh, const char *completion_cause) -{ - if (!rh->completion_cause) { - rh->completion_cause = completion_cause; - } -} static switch_bool_t is_silence_frame(switch_frame_t *frame, int silence_threshold, switch_codec_implementation_t *codec_impl) { @@ -1084,30 +1072,6 @@ static switch_bool_t is_silence_frame(switch_frame_t *frame, int silence_thresho return is_silence; } -static void send_record_stop_event(switch_channel_t *channel, switch_codec_implementation_t *read_impl, struct record_helper *rh) -{ - switch_event_t *event; - - if (rh->fh) { - switch_channel_set_variable_printf(channel, "record_samples", "%d", rh->fh->samples_out); - if (read_impl->actual_samples_per_second) { - switch_channel_set_variable_printf(channel, "record_seconds", "%d", rh->fh->samples_out / read_impl->actual_samples_per_second); - switch_channel_set_variable_printf(channel, "record_ms", "%d", rh->fh->samples_out / (read_impl->actual_samples_per_second / 1000)); - } - } - if (!zstr(rh->completion_cause)) { - switch_channel_set_variable_printf(channel, "record_completion_cause", "%s", rh->completion_cause); - } - - if (switch_event_create(&event, SWITCH_EVENT_RECORD_STOP) == SWITCH_STATUS_SUCCESS) { - switch_channel_event_set_data(channel, event); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Record-File-Path", rh->file); - if (!zstr(rh->completion_cause)) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Record-Completion-Cause", rh->completion_cause); - } - switch_event_fire(&event); - } -} static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, switch_abc_type_t type) { @@ -1129,8 +1093,6 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s } rh->silence_time = switch_micro_time_now(); rh->silence_timeout_ms = rh->initial_timeout_ms; - rh->speech_detected = SWITCH_FALSE; - rh->completion_cause = NULL; switch_core_session_get_read_impl(session, &rh->read_impl); @@ -1237,15 +1199,10 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s while (switch_core_media_bug_read(bug, &frame, SWITCH_TRUE) == SWITCH_STATUS_SUCCESS) { len = (switch_size_t) frame.datalen / 2; - if (len && switch_core_file_write(rh->fh, mask ? null_data : data, &len) != SWITCH_STATUS_SUCCESS) { + if (len && switch_core_file_write(rh->fh, mask ? null_data : data, &len) != SWITCH_STATUS_SUCCESS && rh->hangup_on_error) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error writing %s\n", rh->file); - /* File write failed */ - set_completion_cause(rh, "uri-failure"); - if (rh->hangup_on_error) { - switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); - switch_core_session_reset(session, SWITCH_TRUE, SWITCH_TRUE); - } - send_record_stop_event(channel, &read_impl, rh); + switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); + switch_core_session_reset(session, SWITCH_TRUE, SWITCH_TRUE); return SWITCH_FALSE; } } @@ -1256,27 +1213,22 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Discarding short file %s\n", rh->file); switch_channel_set_variable(channel, "RECORD_DISCARDED", "true"); switch_file_remove(rh->file, switch_core_session_get_pool(session)); - set_completion_cause(rh, "input-too-short"); } - if (switch_channel_down_nosig(channel)) { - /* We got hung up */ - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Channel is hung up\n"); - if (rh->speech_detected) { - /* Treat it as equivalent with final-silence */ - set_completion_cause(rh, "success-silence"); - } else { - /* Treat it as equivalent with inital-silence timeout */ - set_completion_cause(rh, "no-input-timeout"); - } - } else { - /* Set the completion_cause to maxtime reached, unless it's already set */ - set_completion_cause(rh, "success-maxtime"); + if (read_impl.actual_samples_per_second) { + switch_channel_set_variable_printf(channel, "record_seconds", "%d", rh->fh->samples_out / read_impl.actual_samples_per_second); + switch_channel_set_variable_printf(channel, "record_ms", "%d", rh->fh->samples_out / (read_impl.actual_samples_per_second / 1000)); } + switch_channel_set_variable_printf(channel, "record_samples", "%d", rh->fh->samples_out); + } - - send_record_stop_event(channel, &read_impl, rh); - + + if (switch_event_create(&event, SWITCH_EVENT_RECORD_STOP) == SWITCH_STATUS_SUCCESS) { + switch_channel_event_set_data(channel, event); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Record-File-Path", rh->file); + switch_event_fire(&event); + } + switch_channel_execute_on(channel, SWITCH_RECORD_POST_PROCESS_EXEC_APP_VARIABLE); if ((var = switch_channel_get_variable(channel, SWITCH_RECORD_POST_PROCESS_EXEC_API_VARIABLE))) { @@ -1316,65 +1268,47 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s frame.data = data; frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE; + for (;;) { + status = switch_core_media_bug_read(bug, &frame, SWITCH_FALSE); - status = switch_core_media_bug_read(bug, &frame, SWITCH_FALSE); - - if (status == SWITCH_STATUS_SUCCESS || status == SWITCH_STATUS_BREAK) { + if (status == SWITCH_STATUS_SUCCESS || status == SWITCH_STATUS_BREAK) { - len = (switch_size_t) frame.datalen / 2; + len = (switch_size_t) frame.datalen / 2; - if (len && switch_core_file_write(rh->fh, mask ? null_data : data, &len) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error writing %s\n", rh->file); - /* File write failed */ - set_completion_cause(rh, "uri-failure"); - if (rh->hangup_on_error) { + if (len && switch_core_file_write(rh->fh, mask ? null_data : data, &len) != SWITCH_STATUS_SUCCESS && rh->hangup_on_error) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error writing %s\n", rh->file); switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); switch_core_session_reset(session, SWITCH_TRUE, SWITCH_TRUE); + return SWITCH_FALSE; } - return SWITCH_FALSE; - } - /* check for silence timeout */ - if (rh->silence_threshold) { - switch_codec_implementation_t read_impl = { 0 }; - switch_core_session_get_read_impl(session, &read_impl); - if (is_silence_frame(&frame, rh->silence_threshold, &read_impl)) { - if (!rh->silence_time) { - /* start of silence */ - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Start of silence detected\n"); - rh->silence_time = switch_micro_time_now(); - } else { - /* continuing silence */ - int duration_ms = (int)((switch_micro_time_now() - rh->silence_time) / 1000); - if (rh->silence_timeout_ms > 0 && duration_ms >= rh->silence_timeout_ms) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Recording file %s timeout: %i >= %i\n", rh->file, duration_ms, rh->silence_timeout_ms); - if (rh->speech_detected) { - /* Reached final silence timeout */ - set_completion_cause(rh, "success-silence"); - } else { - /* Reached initial silence timeout */ - set_completion_cause(rh, "no-input-timeout"); - /* Discard the silent file? */ + /* check for silence timeout */ + if (rh->silence_threshold) { + switch_codec_implementation_t read_impl = { 0 }; + switch_core_session_get_read_impl(session, &read_impl); + if (is_silence_frame(&frame, rh->silence_threshold, &read_impl)) { + if (!rh->silence_time) { + /* start of silence */ + rh->silence_time = switch_micro_time_now(); + } else { + /* continuing silence */ + int duration_ms = (int)((switch_micro_time_now() - rh->silence_time) / 1000); + if (rh->silence_timeout_ms > 0 && duration_ms >= rh->silence_timeout_ms) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Recording file %s timeout: %i >= %i\n", rh->file, duration_ms, rh->silence_timeout_ms); + switch_core_media_bug_set_flag(bug, SMBF_PRUNE); } - switch_core_media_bug_set_flag(bug, SMBF_PRUNE); } - } - } else { /* not silence */ - if (rh->silence_time) { - /* end of silence */ - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Start of speech detected\n"); - rh->speech_detected = SWITCH_TRUE; - rh->silence_time = 0; - /* switch from initial timeout to final timeout */ - rh->silence_timeout_ms = rh->final_timeout_ms; + } else { /* not silence */ + if (rh->silence_time) { + /* end of silence */ + rh->silence_time = 0; + /* switch from initial timeout to final timeout */ + rh->silence_timeout_ms = rh->final_timeout_ms; + } } } } else { - /* no silence detection */ - if (!rh->speech_detected) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "No silence detection configured; assuming start of speech\n"); - rh->speech_detected = SWITCH_TRUE; - } + break; } } } From 2a7b0227338e2b10cf71d5cb16c477000156c575 Mon Sep 17 00:00:00 2001 From: Brian West Date: Tue, 2 Dec 2014 10:51:48 -0600 Subject: [PATCH 21/95] FS-6980 #resolve don't crash when using native recording on recordstop the redo --- src/switch_ivr_async.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index 4dad74c6f9..da988323f5 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -1215,12 +1215,13 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s switch_file_remove(rh->file, switch_core_session_get_pool(session)); } - if (read_impl.actual_samples_per_second) { - switch_channel_set_variable_printf(channel, "record_seconds", "%d", rh->fh->samples_out / read_impl.actual_samples_per_second); - switch_channel_set_variable_printf(channel, "record_ms", "%d", rh->fh->samples_out / (read_impl.actual_samples_per_second / 1000)); + if (rh->fh) { + switch_channel_set_variable_printf(channel, "record_samples", "%d", rh->fh->samples_out); + if (read_impl.actual_samples_per_second) { + switch_channel_set_variable_printf(channel, "record_seconds", "%d", rh->fh->samples_out / read_impl.actual_samples_per_second); + switch_channel_set_variable_printf(channel, "record_ms", "%d", rh->fh->samples_out / (read_impl.actual_samples_per_second / 1000)); + } } - switch_channel_set_variable_printf(channel, "record_samples", "%d", rh->fh->samples_out); - } if (switch_event_create(&event, SWITCH_EVENT_RECORD_STOP) == SWITCH_STATUS_SUCCESS) { From b69c93eb782cbb63bf0a523db140850752fa428a Mon Sep 17 00:00:00 2001 From: Brian West Date: Tue, 2 Dec 2014 12:32:49 -0600 Subject: [PATCH 22/95] FS-7030 work in progress --- libs/unimrcp/build/tools/unimrcpservice.vcxproj | 4 ++-- libs/unimrcp/libs/apr-toolkit/aprtoolkit.2010.vcxproj | 4 ++-- libs/unimrcp/libs/apr-toolkit/aprtoolkit.2012.vcxproj | 4 ++-- libs/unimrcp/libs/apr-toolkit/aprtoolkit.vcxproj | 4 ++-- libs/unimrcp/libs/mpf/mpf.2010.vcxproj | 4 ++-- libs/unimrcp/libs/mpf/mpf.2012.vcxproj | 4 ++-- libs/unimrcp/libs/mpf/mpf.vcxproj | 4 ++-- libs/unimrcp/libs/mrcp-client/mrcpclient.2010.vcxproj | 4 ++-- libs/unimrcp/libs/mrcp-client/mrcpclient.2012.vcxproj | 4 ++-- libs/unimrcp/libs/mrcp-client/mrcpclient.vcxproj | 4 ++-- libs/unimrcp/libs/mrcp-engine/mrcpengine.vcxproj | 4 ++-- libs/unimrcp/libs/mrcp-server/mrcpserver.vcxproj | 4 ++-- libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.2010.vcxproj | 4 ++-- libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.2012.vcxproj | 4 ++-- libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.vcxproj | 4 ++-- libs/unimrcp/libs/mrcp/mrcp.2010.vcxproj | 4 ++-- libs/unimrcp/libs/mrcp/mrcp.2012.vcxproj | 4 ++-- libs/unimrcp/libs/mrcp/mrcp.vcxproj | 4 ++-- .../libs/mrcpv2-transport/mrcpv2transport.2010.vcxproj | 4 ++-- .../libs/mrcpv2-transport/mrcpv2transport.2012.vcxproj | 4 ++-- libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.vcxproj | 4 ++-- libs/unimrcp/libs/uni-rtsp/unirtsp.2010.vcxproj | 4 ++-- libs/unimrcp/libs/uni-rtsp/unirtsp.2012.vcxproj | 4 ++-- libs/unimrcp/libs/uni-rtsp/unirtsp.vcxproj | 4 ++-- libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2010.vcxproj | 4 ++-- libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2012.vcxproj | 4 ++-- libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.vcxproj | 4 ++-- libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.2010.vcxproj | 4 ++-- libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.2012.vcxproj | 4 ++-- libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.vcxproj | 4 ++-- libs/unimrcp/platforms/asr-client/asrclient.vcxproj | 4 ++-- libs/unimrcp/platforms/libasr-client/libasrclient.vcxproj | 4 ++-- .../platforms/libunimrcp-client/libunimrcpclient.vcxproj | 4 ++-- .../platforms/libunimrcp-server/libunimrcpserver.vcxproj | 4 ++-- libs/unimrcp/platforms/umc/umc.vcxproj | 4 ++-- libs/unimrcp/platforms/unimrcp-client/unimrcpclient.vcxproj | 4 ++-- libs/unimrcp/platforms/unimrcp-server/unimrcpserver.vcxproj | 4 ++-- libs/unimrcp/plugins/demo-recog/demorecog.vcxproj | 4 ++-- libs/unimrcp/plugins/demo-synth/demosynth.vcxproj | 4 ++-- libs/unimrcp/plugins/demo-verifier/demoverifier.vcxproj | 4 ++-- libs/unimrcp/plugins/mrcp-recorder/mrcprecorder.vcxproj | 4 ++-- libs/unimrcp/tests/apttest/apttest.vcxproj | 4 ++-- libs/unimrcp/tests/mpftest/mpftest.vcxproj | 4 ++-- libs/unimrcp/tests/mrcptest/mrcptest.vcxproj | 4 ++-- libs/unimrcp/tests/rtsptest/rtsptest.vcxproj | 4 ++-- libs/unimrcp/tests/strtablegen/strtablegen.vcxproj | 4 ++-- 46 files changed, 92 insertions(+), 92 deletions(-) diff --git a/libs/unimrcp/build/tools/unimrcpservice.vcxproj b/libs/unimrcp/build/tools/unimrcpservice.vcxproj index f8bb3a3404..63e1324ba3 100644 --- a/libs/unimrcp/build/tools/unimrcpservice.vcxproj +++ b/libs/unimrcp/build/tools/unimrcpservice.vcxproj @@ -46,7 +46,7 @@ - + @@ -58,7 +58,7 @@ - + diff --git a/libs/unimrcp/libs/apr-toolkit/aprtoolkit.2010.vcxproj b/libs/unimrcp/libs/apr-toolkit/aprtoolkit.2010.vcxproj index 5a8627dbff..adb6133854 100644 --- a/libs/unimrcp/libs/apr-toolkit/aprtoolkit.2010.vcxproj +++ b/libs/unimrcp/libs/apr-toolkit/aprtoolkit.2010.vcxproj @@ -53,7 +53,7 @@ - + @@ -63,7 +63,7 @@ - + diff --git a/libs/unimrcp/libs/apr-toolkit/aprtoolkit.2012.vcxproj b/libs/unimrcp/libs/apr-toolkit/aprtoolkit.2012.vcxproj index 646ab231ea..121d78f516 100644 --- a/libs/unimrcp/libs/apr-toolkit/aprtoolkit.2012.vcxproj +++ b/libs/unimrcp/libs/apr-toolkit/aprtoolkit.2012.vcxproj @@ -57,7 +57,7 @@ - + @@ -67,7 +67,7 @@ - + diff --git a/libs/unimrcp/libs/apr-toolkit/aprtoolkit.vcxproj b/libs/unimrcp/libs/apr-toolkit/aprtoolkit.vcxproj index 1c4031a02e..29980e1941 100644 --- a/libs/unimrcp/libs/apr-toolkit/aprtoolkit.vcxproj +++ b/libs/unimrcp/libs/apr-toolkit/aprtoolkit.vcxproj @@ -53,7 +53,7 @@ - + @@ -65,7 +65,7 @@ - + diff --git a/libs/unimrcp/libs/mpf/mpf.2010.vcxproj b/libs/unimrcp/libs/mpf/mpf.2010.vcxproj index 2a89b638c5..1cde1ffe65 100644 --- a/libs/unimrcp/libs/mpf/mpf.2010.vcxproj +++ b/libs/unimrcp/libs/mpf/mpf.2010.vcxproj @@ -53,7 +53,7 @@ - + @@ -63,7 +63,7 @@ - + diff --git a/libs/unimrcp/libs/mpf/mpf.2012.vcxproj b/libs/unimrcp/libs/mpf/mpf.2012.vcxproj index 9a8e7ed24b..92502914e3 100644 --- a/libs/unimrcp/libs/mpf/mpf.2012.vcxproj +++ b/libs/unimrcp/libs/mpf/mpf.2012.vcxproj @@ -57,7 +57,7 @@ - + @@ -67,7 +67,7 @@ - + diff --git a/libs/unimrcp/libs/mpf/mpf.vcxproj b/libs/unimrcp/libs/mpf/mpf.vcxproj index 730174d4f8..6bbb3f5371 100644 --- a/libs/unimrcp/libs/mpf/mpf.vcxproj +++ b/libs/unimrcp/libs/mpf/mpf.vcxproj @@ -53,7 +53,7 @@ - + @@ -65,7 +65,7 @@ - + diff --git a/libs/unimrcp/libs/mrcp-client/mrcpclient.2010.vcxproj b/libs/unimrcp/libs/mrcp-client/mrcpclient.2010.vcxproj index 7a9d7856c6..630ae4c4fc 100644 --- a/libs/unimrcp/libs/mrcp-client/mrcpclient.2010.vcxproj +++ b/libs/unimrcp/libs/mrcp-client/mrcpclient.2010.vcxproj @@ -53,7 +53,7 @@ - + @@ -63,7 +63,7 @@ - + diff --git a/libs/unimrcp/libs/mrcp-client/mrcpclient.2012.vcxproj b/libs/unimrcp/libs/mrcp-client/mrcpclient.2012.vcxproj index 3426eb6381..22f3535575 100644 --- a/libs/unimrcp/libs/mrcp-client/mrcpclient.2012.vcxproj +++ b/libs/unimrcp/libs/mrcp-client/mrcpclient.2012.vcxproj @@ -57,7 +57,7 @@ - + @@ -67,7 +67,7 @@ - + diff --git a/libs/unimrcp/libs/mrcp-client/mrcpclient.vcxproj b/libs/unimrcp/libs/mrcp-client/mrcpclient.vcxproj index d33b64741f..3447a31724 100644 --- a/libs/unimrcp/libs/mrcp-client/mrcpclient.vcxproj +++ b/libs/unimrcp/libs/mrcp-client/mrcpclient.vcxproj @@ -53,7 +53,7 @@ - + @@ -65,7 +65,7 @@ - + diff --git a/libs/unimrcp/libs/mrcp-engine/mrcpengine.vcxproj b/libs/unimrcp/libs/mrcp-engine/mrcpengine.vcxproj index fcf2be3d80..1288995027 100644 --- a/libs/unimrcp/libs/mrcp-engine/mrcpengine.vcxproj +++ b/libs/unimrcp/libs/mrcp-engine/mrcpengine.vcxproj @@ -53,7 +53,7 @@ - + @@ -65,7 +65,7 @@ - + diff --git a/libs/unimrcp/libs/mrcp-server/mrcpserver.vcxproj b/libs/unimrcp/libs/mrcp-server/mrcpserver.vcxproj index 2c09de002a..1d3fff21bc 100644 --- a/libs/unimrcp/libs/mrcp-server/mrcpserver.vcxproj +++ b/libs/unimrcp/libs/mrcp-server/mrcpserver.vcxproj @@ -53,7 +53,7 @@ - + @@ -65,7 +65,7 @@ - + diff --git a/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.2010.vcxproj b/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.2010.vcxproj index f11e3bd765..96db7443fa 100644 --- a/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.2010.vcxproj +++ b/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.2010.vcxproj @@ -53,7 +53,7 @@ - + @@ -63,7 +63,7 @@ - + diff --git a/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.2012.vcxproj b/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.2012.vcxproj index 3127301c9d..12cdfa54aa 100644 --- a/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.2012.vcxproj +++ b/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.2012.vcxproj @@ -57,7 +57,7 @@ - + @@ -67,7 +67,7 @@ - + diff --git a/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.vcxproj b/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.vcxproj index b37946889a..13a3708693 100644 --- a/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.vcxproj +++ b/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.vcxproj @@ -53,7 +53,7 @@ - + @@ -65,7 +65,7 @@ - + diff --git a/libs/unimrcp/libs/mrcp/mrcp.2010.vcxproj b/libs/unimrcp/libs/mrcp/mrcp.2010.vcxproj index ed2c29bbf8..4f8141856c 100644 --- a/libs/unimrcp/libs/mrcp/mrcp.2010.vcxproj +++ b/libs/unimrcp/libs/mrcp/mrcp.2010.vcxproj @@ -53,7 +53,7 @@ - + @@ -63,7 +63,7 @@ - + diff --git a/libs/unimrcp/libs/mrcp/mrcp.2012.vcxproj b/libs/unimrcp/libs/mrcp/mrcp.2012.vcxproj index f3f11ff9e4..286eafc445 100644 --- a/libs/unimrcp/libs/mrcp/mrcp.2012.vcxproj +++ b/libs/unimrcp/libs/mrcp/mrcp.2012.vcxproj @@ -57,7 +57,7 @@ - + @@ -67,7 +67,7 @@ - + diff --git a/libs/unimrcp/libs/mrcp/mrcp.vcxproj b/libs/unimrcp/libs/mrcp/mrcp.vcxproj index 81fa915bac..b2e453c4e8 100644 --- a/libs/unimrcp/libs/mrcp/mrcp.vcxproj +++ b/libs/unimrcp/libs/mrcp/mrcp.vcxproj @@ -53,7 +53,7 @@ - + @@ -65,7 +65,7 @@ - + diff --git a/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2010.vcxproj b/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2010.vcxproj index 33ed618305..d4baebf6d0 100644 --- a/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2010.vcxproj +++ b/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2010.vcxproj @@ -53,7 +53,7 @@ - + @@ -63,7 +63,7 @@ - + diff --git a/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2012.vcxproj b/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2012.vcxproj index 64f3fb5ffc..46999a1325 100644 --- a/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2012.vcxproj +++ b/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2012.vcxproj @@ -57,7 +57,7 @@ - + @@ -67,7 +67,7 @@ - + diff --git a/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.vcxproj b/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.vcxproj index 4d99d355c3..25e83af762 100644 --- a/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.vcxproj +++ b/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.vcxproj @@ -53,7 +53,7 @@ - + @@ -65,7 +65,7 @@ - + diff --git a/libs/unimrcp/libs/uni-rtsp/unirtsp.2010.vcxproj b/libs/unimrcp/libs/uni-rtsp/unirtsp.2010.vcxproj index 9fad4f7787..7ec0a225f0 100644 --- a/libs/unimrcp/libs/uni-rtsp/unirtsp.2010.vcxproj +++ b/libs/unimrcp/libs/uni-rtsp/unirtsp.2010.vcxproj @@ -53,7 +53,7 @@ - + @@ -63,7 +63,7 @@ - + diff --git a/libs/unimrcp/libs/uni-rtsp/unirtsp.2012.vcxproj b/libs/unimrcp/libs/uni-rtsp/unirtsp.2012.vcxproj index 2d9628ec07..1755172f88 100644 --- a/libs/unimrcp/libs/uni-rtsp/unirtsp.2012.vcxproj +++ b/libs/unimrcp/libs/uni-rtsp/unirtsp.2012.vcxproj @@ -57,7 +57,7 @@ - + @@ -67,7 +67,7 @@ - + diff --git a/libs/unimrcp/libs/uni-rtsp/unirtsp.vcxproj b/libs/unimrcp/libs/uni-rtsp/unirtsp.vcxproj index 052ad044e2..82cedac8fe 100644 --- a/libs/unimrcp/libs/uni-rtsp/unirtsp.vcxproj +++ b/libs/unimrcp/libs/uni-rtsp/unirtsp.vcxproj @@ -53,7 +53,7 @@ - + @@ -65,7 +65,7 @@ - + diff --git a/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2010.vcxproj b/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2010.vcxproj index b3931497c7..ba5452532c 100644 --- a/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2010.vcxproj +++ b/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2010.vcxproj @@ -55,7 +55,7 @@ - + @@ -69,7 +69,7 @@ - + diff --git a/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2012.vcxproj b/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2012.vcxproj index eed2e6e906..68fe1c6d7a 100644 --- a/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2012.vcxproj +++ b/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2012.vcxproj @@ -59,7 +59,7 @@ - + @@ -73,7 +73,7 @@ - + diff --git a/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.vcxproj b/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.vcxproj index 037cc3685e..cd2e9a2251 100644 --- a/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.vcxproj +++ b/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.vcxproj @@ -55,7 +55,7 @@ - + @@ -71,7 +71,7 @@ - + diff --git a/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.2010.vcxproj b/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.2010.vcxproj index f8a573d857..a60be5bc38 100644 --- a/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.2010.vcxproj +++ b/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.2010.vcxproj @@ -55,7 +55,7 @@ - + @@ -69,7 +69,7 @@ - + diff --git a/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.2012.vcxproj b/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.2012.vcxproj index e437916ee8..56807ad345 100644 --- a/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.2012.vcxproj +++ b/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.2012.vcxproj @@ -59,7 +59,7 @@ - + @@ -73,7 +73,7 @@ - + diff --git a/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.vcxproj b/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.vcxproj index 200d68b92b..5e08915fe4 100644 --- a/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.vcxproj +++ b/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.vcxproj @@ -55,7 +55,7 @@ - + @@ -71,7 +71,7 @@ - + diff --git a/libs/unimrcp/platforms/asr-client/asrclient.vcxproj b/libs/unimrcp/platforms/asr-client/asrclient.vcxproj index 5e20263b20..af032d1dca 100644 --- a/libs/unimrcp/platforms/asr-client/asrclient.vcxproj +++ b/libs/unimrcp/platforms/asr-client/asrclient.vcxproj @@ -46,7 +46,7 @@ - + @@ -58,7 +58,7 @@ - + diff --git a/libs/unimrcp/platforms/libasr-client/libasrclient.vcxproj b/libs/unimrcp/platforms/libasr-client/libasrclient.vcxproj index 0323b37fcf..744bf1cf6e 100644 --- a/libs/unimrcp/platforms/libasr-client/libasrclient.vcxproj +++ b/libs/unimrcp/platforms/libasr-client/libasrclient.vcxproj @@ -53,7 +53,7 @@ - + @@ -65,7 +65,7 @@ - + diff --git a/libs/unimrcp/platforms/libunimrcp-client/libunimrcpclient.vcxproj b/libs/unimrcp/platforms/libunimrcp-client/libunimrcpclient.vcxproj index 2c2d99ea50..eba5aa5662 100644 --- a/libs/unimrcp/platforms/libunimrcp-client/libunimrcpclient.vcxproj +++ b/libs/unimrcp/platforms/libunimrcp-client/libunimrcpclient.vcxproj @@ -53,7 +53,7 @@ - + @@ -65,7 +65,7 @@ - + diff --git a/libs/unimrcp/platforms/libunimrcp-server/libunimrcpserver.vcxproj b/libs/unimrcp/platforms/libunimrcp-server/libunimrcpserver.vcxproj index a64579d7c1..a4ba6c4943 100644 --- a/libs/unimrcp/platforms/libunimrcp-server/libunimrcpserver.vcxproj +++ b/libs/unimrcp/platforms/libunimrcp-server/libunimrcpserver.vcxproj @@ -53,7 +53,7 @@ - + @@ -65,7 +65,7 @@ - + diff --git a/libs/unimrcp/platforms/umc/umc.vcxproj b/libs/unimrcp/platforms/umc/umc.vcxproj index 4727671ea5..36c4cb2aaa 100644 --- a/libs/unimrcp/platforms/umc/umc.vcxproj +++ b/libs/unimrcp/platforms/umc/umc.vcxproj @@ -46,7 +46,7 @@ - + @@ -58,7 +58,7 @@ - + diff --git a/libs/unimrcp/platforms/unimrcp-client/unimrcpclient.vcxproj b/libs/unimrcp/platforms/unimrcp-client/unimrcpclient.vcxproj index e060a41cee..e477078f01 100644 --- a/libs/unimrcp/platforms/unimrcp-client/unimrcpclient.vcxproj +++ b/libs/unimrcp/platforms/unimrcp-client/unimrcpclient.vcxproj @@ -46,7 +46,7 @@ - + @@ -58,7 +58,7 @@ - + diff --git a/libs/unimrcp/platforms/unimrcp-server/unimrcpserver.vcxproj b/libs/unimrcp/platforms/unimrcp-server/unimrcpserver.vcxproj index e3e7594bbe..e2d74c9575 100644 --- a/libs/unimrcp/platforms/unimrcp-server/unimrcpserver.vcxproj +++ b/libs/unimrcp/platforms/unimrcp-server/unimrcpserver.vcxproj @@ -46,7 +46,7 @@ - + @@ -58,7 +58,7 @@ - + diff --git a/libs/unimrcp/plugins/demo-recog/demorecog.vcxproj b/libs/unimrcp/plugins/demo-recog/demorecog.vcxproj index 9a7adfa8c5..562c8b4902 100644 --- a/libs/unimrcp/plugins/demo-recog/demorecog.vcxproj +++ b/libs/unimrcp/plugins/demo-recog/demorecog.vcxproj @@ -52,7 +52,7 @@ - + @@ -62,7 +62,7 @@ - + diff --git a/libs/unimrcp/plugins/demo-synth/demosynth.vcxproj b/libs/unimrcp/plugins/demo-synth/demosynth.vcxproj index 3afc81ed5a..4df06203cb 100644 --- a/libs/unimrcp/plugins/demo-synth/demosynth.vcxproj +++ b/libs/unimrcp/plugins/demo-synth/demosynth.vcxproj @@ -52,7 +52,7 @@ - + @@ -62,7 +62,7 @@ - + diff --git a/libs/unimrcp/plugins/demo-verifier/demoverifier.vcxproj b/libs/unimrcp/plugins/demo-verifier/demoverifier.vcxproj index fe472259e4..6dfd17cd6b 100644 --- a/libs/unimrcp/plugins/demo-verifier/demoverifier.vcxproj +++ b/libs/unimrcp/plugins/demo-verifier/demoverifier.vcxproj @@ -52,7 +52,7 @@ - + @@ -62,7 +62,7 @@ - + diff --git a/libs/unimrcp/plugins/mrcp-recorder/mrcprecorder.vcxproj b/libs/unimrcp/plugins/mrcp-recorder/mrcprecorder.vcxproj index 53710b658f..9a3a6a5aa6 100644 --- a/libs/unimrcp/plugins/mrcp-recorder/mrcprecorder.vcxproj +++ b/libs/unimrcp/plugins/mrcp-recorder/mrcprecorder.vcxproj @@ -52,7 +52,7 @@ - + @@ -62,7 +62,7 @@ - + diff --git a/libs/unimrcp/tests/apttest/apttest.vcxproj b/libs/unimrcp/tests/apttest/apttest.vcxproj index 90a1e85163..a766f033b1 100644 --- a/libs/unimrcp/tests/apttest/apttest.vcxproj +++ b/libs/unimrcp/tests/apttest/apttest.vcxproj @@ -46,7 +46,7 @@ - + @@ -58,7 +58,7 @@ - + diff --git a/libs/unimrcp/tests/mpftest/mpftest.vcxproj b/libs/unimrcp/tests/mpftest/mpftest.vcxproj index 134792797c..a28878891a 100644 --- a/libs/unimrcp/tests/mpftest/mpftest.vcxproj +++ b/libs/unimrcp/tests/mpftest/mpftest.vcxproj @@ -46,7 +46,7 @@ - + @@ -58,7 +58,7 @@ - + diff --git a/libs/unimrcp/tests/mrcptest/mrcptest.vcxproj b/libs/unimrcp/tests/mrcptest/mrcptest.vcxproj index 7e3309b489..c49e4193a6 100644 --- a/libs/unimrcp/tests/mrcptest/mrcptest.vcxproj +++ b/libs/unimrcp/tests/mrcptest/mrcptest.vcxproj @@ -46,7 +46,7 @@ - + @@ -58,7 +58,7 @@ - + diff --git a/libs/unimrcp/tests/rtsptest/rtsptest.vcxproj b/libs/unimrcp/tests/rtsptest/rtsptest.vcxproj index 6adedfe996..5f0b4546fc 100644 --- a/libs/unimrcp/tests/rtsptest/rtsptest.vcxproj +++ b/libs/unimrcp/tests/rtsptest/rtsptest.vcxproj @@ -46,7 +46,7 @@ - + @@ -58,7 +58,7 @@ - + diff --git a/libs/unimrcp/tests/strtablegen/strtablegen.vcxproj b/libs/unimrcp/tests/strtablegen/strtablegen.vcxproj index 5cd5add13d..11845bbc67 100644 --- a/libs/unimrcp/tests/strtablegen/strtablegen.vcxproj +++ b/libs/unimrcp/tests/strtablegen/strtablegen.vcxproj @@ -46,7 +46,7 @@ - + @@ -58,7 +58,7 @@ - + From 35558993c9785f5b20972e589958c405f21dd2c3 Mon Sep 17 00:00:00 2001 From: Chris Rienzo Date: Tue, 2 Dec 2014 14:59:27 -0500 Subject: [PATCH 23/95] FS-5816 #resolve #comment re-add completion cause to session record stop event --- src/switch_ivr_async.c | 101 ++++++++++++++++++++++++++++++++++------- 1 file changed, 85 insertions(+), 16 deletions(-) diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index da988323f5..25ec4d7285 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -1043,8 +1043,20 @@ struct record_helper { switch_time_t last_write_time; switch_bool_t hangup_on_error; switch_codec_implementation_t read_impl; + switch_bool_t speech_detected; + const char *completion_cause; }; +/** + * Set the recording completion cause. The cause can only be set once, to minimize the logic in the record_callback. + * [The completion_cause strings are essentially those of an MRCP Recorder resource.] + */ +static void set_completion_cause(struct record_helper *rh, const char *completion_cause) +{ + if (!rh->completion_cause) { + rh->completion_cause = completion_cause; + } +} static switch_bool_t is_silence_frame(switch_frame_t *frame, int silence_threshold, switch_codec_implementation_t *codec_impl) { @@ -1072,6 +1084,31 @@ static switch_bool_t is_silence_frame(switch_frame_t *frame, int silence_thresho return is_silence; } +static void send_record_stop_event(switch_channel_t *channel, switch_codec_implementation_t *read_impl, struct record_helper *rh) +{ + switch_event_t *event; + + if (rh->fh) { + switch_channel_set_variable_printf(channel, "record_samples", "%d", rh->fh->samples_out); + if (read_impl->actual_samples_per_second) { + switch_channel_set_variable_printf(channel, "record_seconds", "%d", rh->fh->samples_out / read_impl->actual_samples_per_second); + switch_channel_set_variable_printf(channel, "record_ms", "%d", rh->fh->samples_out / (read_impl->actual_samples_per_second / 1000)); + } + } + + if (!zstr(rh->completion_cause)) { + switch_channel_set_variable_printf(channel, "record_completion_cause", "%s", rh->completion_cause); + } + + if (switch_event_create(&event, SWITCH_EVENT_RECORD_STOP) == SWITCH_STATUS_SUCCESS) { + switch_channel_event_set_data(channel, event); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Record-File-Path", rh->file); + if (!zstr(rh->completion_cause)) { + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Record-Completion-Cause", rh->completion_cause); + } + switch_event_fire(&event); + } +} static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, switch_abc_type_t type) { @@ -1093,6 +1130,8 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s } rh->silence_time = switch_micro_time_now(); rh->silence_timeout_ms = rh->initial_timeout_ms; + rh->speech_detected = SWITCH_FALSE; + rh->completion_cause = NULL; switch_core_session_get_read_impl(session, &rh->read_impl); @@ -1199,10 +1238,15 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s while (switch_core_media_bug_read(bug, &frame, SWITCH_TRUE) == SWITCH_STATUS_SUCCESS) { len = (switch_size_t) frame.datalen / 2; - if (len && switch_core_file_write(rh->fh, mask ? null_data : data, &len) != SWITCH_STATUS_SUCCESS && rh->hangup_on_error) { + if (len && switch_core_file_write(rh->fh, mask ? null_data : data, &len) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error writing %s\n", rh->file); - switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); - switch_core_session_reset(session, SWITCH_TRUE, SWITCH_TRUE); + /* File write failed */ + set_completion_cause(rh, "uri-failure"); + if (rh->hangup_on_error) { + switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); + switch_core_session_reset(session, SWITCH_TRUE, SWITCH_TRUE); + } + send_record_stop_event(channel, &read_impl, rh); return SWITCH_FALSE; } } @@ -1213,22 +1257,26 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Discarding short file %s\n", rh->file); switch_channel_set_variable(channel, "RECORD_DISCARDED", "true"); switch_file_remove(rh->file, switch_core_session_get_pool(session)); + set_completion_cause(rh, "input-too-short"); } - if (rh->fh) { - switch_channel_set_variable_printf(channel, "record_samples", "%d", rh->fh->samples_out); - if (read_impl.actual_samples_per_second) { - switch_channel_set_variable_printf(channel, "record_seconds", "%d", rh->fh->samples_out / read_impl.actual_samples_per_second); - switch_channel_set_variable_printf(channel, "record_ms", "%d", rh->fh->samples_out / (read_impl.actual_samples_per_second / 1000)); + if (switch_channel_down_nosig(channel)) { + /* We got hung up */ + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Channel is hung up\n"); + if (rh->speech_detected) { + /* Treat it as equivalent with final-silence */ + set_completion_cause(rh, "success-silence"); + } else { + /* Treat it as equivalent with inital-silence timeout */ + set_completion_cause(rh, "no-input-timeout"); } + } else { + /* Set the completion_cause to maxtime reached, unless it's already set */ + set_completion_cause(rh, "success-maxtime"); } } - if (switch_event_create(&event, SWITCH_EVENT_RECORD_STOP) == SWITCH_STATUS_SUCCESS) { - switch_channel_event_set_data(channel, event); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Record-File-Path", rh->file); - switch_event_fire(&event); - } + send_record_stop_event(channel, &read_impl, rh); switch_channel_execute_on(channel, SWITCH_RECORD_POST_PROCESS_EXEC_APP_VARIABLE); @@ -1276,10 +1324,14 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s len = (switch_size_t) frame.datalen / 2; - if (len && switch_core_file_write(rh->fh, mask ? null_data : data, &len) != SWITCH_STATUS_SUCCESS && rh->hangup_on_error) { + if (len && switch_core_file_write(rh->fh, mask ? null_data : data, &len) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error writing %s\n", rh->file); - switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); - switch_core_session_reset(session, SWITCH_TRUE, SWITCH_TRUE); + /* File write failed */ + set_completion_cause(rh, "uri-failure"); + if (rh->hangup_on_error) { + switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); + switch_core_session_reset(session, SWITCH_TRUE, SWITCH_TRUE); + } return SWITCH_FALSE; } @@ -1290,6 +1342,7 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s if (is_silence_frame(&frame, rh->silence_threshold, &read_impl)) { if (!rh->silence_time) { /* start of silence */ + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Start of silence detected\n"); rh->silence_time = switch_micro_time_now(); } else { /* continuing silence */ @@ -1297,16 +1350,32 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s if (rh->silence_timeout_ms > 0 && duration_ms >= rh->silence_timeout_ms) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Recording file %s timeout: %i >= %i\n", rh->file, duration_ms, rh->silence_timeout_ms); switch_core_media_bug_set_flag(bug, SMBF_PRUNE); + if (rh->speech_detected) { + /* Reached final silence timeout */ + set_completion_cause(rh, "success-silence"); + } else { + /* Reached initial silence timeout */ + set_completion_cause(rh, "no-input-timeout"); + /* Discard the silent file? */ + } } } } else { /* not silence */ if (rh->silence_time) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Start of speech detected\n"); + rh->speech_detected = SWITCH_TRUE; /* end of silence */ rh->silence_time = 0; /* switch from initial timeout to final timeout */ rh->silence_timeout_ms = rh->final_timeout_ms; } } + } else { + /* no silence detection */ + if (!rh->speech_detected) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "No silence detection configured; assuming start of speech\n"); + rh->speech_detected = SWITCH_TRUE; + } } } else { break; From 80649df65c830a9e0b7bdddc6ccbda9277c42e1e Mon Sep 17 00:00:00 2001 From: Italo Rossi Date: Tue, 2 Dec 2014 22:57:43 -0300 Subject: [PATCH 24/95] fix FS-7049 - Count and list agents based on their state --- .../mod_callcenter/mod_callcenter.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index 8d4c0caf06..7a34883345 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -3220,6 +3220,7 @@ SWITCH_STANDARD_API(cc_config_api_function) const char *sub_action = argv[0 + initial_argc]; const char *queue_name = argv[1 + initial_argc]; const char *status = NULL; + const char *state = NULL; struct list_result cbt; /* queue list agents */ @@ -3227,7 +3228,13 @@ SWITCH_STANDARD_API(cc_config_api_function) if (argc-initial_argc > 2) { status = argv[2 + initial_argc]; } - if (status) { + if (argc-initial_argc > 3) { + state = argv[3 + initial_argc]; + } + if (state) { + sql = switch_mprintf("SELECT agents.* FROM agents,tiers WHERE tiers.agent = agents.name AND tiers.queue = '%q' AND agents.status = '%q' AND agents.state = '%q'", queue_name, status, state); + } + else if (status) { sql = switch_mprintf("SELECT agents.* FROM agents,tiers WHERE tiers.agent = agents.name AND tiers.queue = '%q' AND agents.status = '%q'", queue_name, status); } else { sql = switch_mprintf("SELECT agents.* FROM agents,tiers WHERE tiers.agent = agents.name AND tiers.queue = '%q'", queue_name); @@ -3266,6 +3273,7 @@ SWITCH_STANDARD_API(cc_config_api_function) const char *sub_action = argv[0 + initial_argc]; const char *queue_name = argv[1 + initial_argc]; const char *status = NULL; + const char *state = NULL; char res[256] = ""; /* queue count agents */ @@ -3273,7 +3281,13 @@ SWITCH_STANDARD_API(cc_config_api_function) if (argc-initial_argc > 2) { status = argv[2 + initial_argc]; } - if (status) { + if (argc-initial_argc > 3) { + state = argv[3 + initial_argc]; + } + if (state) { + sql = switch_mprintf("SELECT count(*) FROM agents,tiers WHERE tiers.agent = agents.name AND tiers.queue = '%q' AND agents.status = '%q' AND agents.state = '%q'", queue_name, status, state); + } + else if (status) { sql = switch_mprintf("SELECT count(*) FROM agents,tiers WHERE tiers.agent = agents.name AND tiers.queue = '%q' AND agents.status = '%q'", queue_name, status); } else { sql = switch_mprintf("SELECT count(*) FROM agents,tiers WHERE tiers.agent = agents.name AND tiers.queue = '%q'", queue_name); From 35ba6a33b17036cf7ab3693d3e28d224ce68af55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois?= Date: Wed, 3 Dec 2014 10:16:22 +0100 Subject: [PATCH 25/95] FS-6766, fix verto caller ringback missing on conference bridge --- src/mod/endpoints/mod_verto/mod_verto.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index c784d8d1a2..7ad088f780 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -2141,6 +2141,8 @@ static switch_status_t verto_on_init(switch_core_session_t *session) if (switch_channel_direction(tech_pvt->channel) == SWITCH_CALL_DIRECTION_OUTBOUND) { if ((status = verto_connect(tech_pvt->session, "verto.invite")) != SWITCH_STATUS_SUCCESS) { switch_channel_hangup(tech_pvt->channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); + } else { + switch_channel_mark_ring_ready(tech_pvt->channel); } } From db66cdb56f85b1529914fe0fcdce2f00e6f764af Mon Sep 17 00:00:00 2001 From: Dave Kompel Date: Wed, 3 Dec 2014 12:56:48 -0500 Subject: [PATCH 26/95] Fix mrcp libraries to build right --- .../libs/apr-toolkit/aprtoolkit.2012.vcxproj | 24 +++++------ libs/unimrcp/libs/mpf/mpf.2012.vcxproj | 22 +++++----- .../libs/mrcp-client/mrcpclient.2012.vcxproj | 24 +++++------ .../mrcp-signaling/mrcpsignaling.2012.vcxproj | 24 +++++------ libs/unimrcp/libs/mrcp/mrcp.2012.vcxproj | 22 +++++----- .../mrcpv2transport.2012.vcxproj | 24 +++++------ .../libs/uni-rtsp/unirtsp.2012.vcxproj | 24 +++++------ .../mrcp-sofiasip/mrcpsofiasip.2012.vcxproj | 40 +++++++++---------- .../mrcp-unirtsp/mrcpunirtsp.2012.vcxproj | 40 +++++++++---------- .../mod_unimrcp/mod_unimrcp.2012.vcxproj | 10 ++--- 10 files changed, 127 insertions(+), 127 deletions(-) diff --git a/libs/unimrcp/libs/apr-toolkit/aprtoolkit.2012.vcxproj b/libs/unimrcp/libs/apr-toolkit/aprtoolkit.2012.vcxproj index 121d78f516..911273ff8e 100644 --- a/libs/unimrcp/libs/apr-toolkit/aprtoolkit.2012.vcxproj +++ b/libs/unimrcp/libs/apr-toolkit/aprtoolkit.2012.vcxproj @@ -1,4 +1,4 @@ - + @@ -52,34 +52,34 @@ - - + + - - + + - - + + - - + + <_ProjectFileVersion>10.0.30319.1 $(PlatformName)\$(Configuration)\ $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ + $(SolutionDir)$(PlatformName)\$(Configuration)\ $(PlatformName)\$(Configuration)\ $(PlatformName)\$(Configuration)\ $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ + $(SolutionDir)$(PlatformName)\$(Configuration)\ $(PlatformName)\$(Configuration)\ @@ -164,4 +164,4 @@ - + \ No newline at end of file diff --git a/libs/unimrcp/libs/mpf/mpf.2012.vcxproj b/libs/unimrcp/libs/mpf/mpf.2012.vcxproj index 92502914e3..954d665189 100644 --- a/libs/unimrcp/libs/mpf/mpf.2012.vcxproj +++ b/libs/unimrcp/libs/mpf/mpf.2012.vcxproj @@ -1,4 +1,4 @@ - + @@ -52,23 +52,23 @@ - - + + - - + + - - + + - - + + @@ -79,7 +79,7 @@ $(PlatformName)\$(Configuration)\ $(PlatformName)\$(Configuration)\ $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ + $(SolutionDir)$(PlatformName)\$(Configuration)\ $(PlatformName)\$(Configuration)\ @@ -192,4 +192,4 @@ - + \ No newline at end of file diff --git a/libs/unimrcp/libs/mrcp-client/mrcpclient.2012.vcxproj b/libs/unimrcp/libs/mrcp-client/mrcpclient.2012.vcxproj index 22f3535575..b2a208673f 100644 --- a/libs/unimrcp/libs/mrcp-client/mrcpclient.2012.vcxproj +++ b/libs/unimrcp/libs/mrcp-client/mrcpclient.2012.vcxproj @@ -1,4 +1,4 @@ - + @@ -52,34 +52,34 @@ - - + + - - + + - - + + - - + + <_ProjectFileVersion>10.0.30319.1 $(PlatformName)\$(Configuration)\ $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ + $(SolutionDir)$(PlatformName)\$(Configuration)\ $(PlatformName)\$(Configuration)\ $(PlatformName)\$(Configuration)\ $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ + $(SolutionDir)$(PlatformName)\$(Configuration)\ $(PlatformName)\$(Configuration)\ @@ -123,4 +123,4 @@ - + \ No newline at end of file diff --git a/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.2012.vcxproj b/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.2012.vcxproj index 12cdfa54aa..840c02b553 100644 --- a/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.2012.vcxproj +++ b/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.2012.vcxproj @@ -1,4 +1,4 @@ - + @@ -52,34 +52,34 @@ - - + + - - + + - - + + - - + + <_ProjectFileVersion>10.0.30319.1 $(PlatformName)\$(Configuration)\ $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ + $(SolutionDir)$(PlatformName)\$(Configuration)\ $(PlatformName)\$(Configuration)\ $(PlatformName)\$(Configuration)\ $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ + $(SolutionDir)$(PlatformName)\$(Configuration)\ $(PlatformName)\$(Configuration)\ @@ -122,4 +122,4 @@ - + \ No newline at end of file diff --git a/libs/unimrcp/libs/mrcp/mrcp.2012.vcxproj b/libs/unimrcp/libs/mrcp/mrcp.2012.vcxproj index 286eafc445..e85c3caffc 100644 --- a/libs/unimrcp/libs/mrcp/mrcp.2012.vcxproj +++ b/libs/unimrcp/libs/mrcp/mrcp.2012.vcxproj @@ -1,4 +1,4 @@ - + @@ -52,23 +52,23 @@ - - + + - - + + - - + + - - + + @@ -79,7 +79,7 @@ $(PlatformName)\$(Configuration)\ $(PlatformName)\$(Configuration)\ $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ + $(SolutionDir)$(PlatformName)\$(Configuration)\ $(PlatformName)\$(Configuration)\ @@ -155,4 +155,4 @@ - + \ No newline at end of file diff --git a/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2012.vcxproj b/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2012.vcxproj index 46999a1325..c165570e9b 100644 --- a/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2012.vcxproj +++ b/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2012.vcxproj @@ -1,4 +1,4 @@ - + @@ -52,34 +52,34 @@ - - + + - - + + - - + + - - + + <_ProjectFileVersion>10.0.30319.1 $(PlatformName)\$(Configuration)\ $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ + $(SolutionDir)$(PlatformName)\$(Configuration)\ $(PlatformName)\$(Configuration)\ $(PlatformName)\$(Configuration)\ $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ + $(SolutionDir)$(PlatformName)\$(Configuration)\ $(PlatformName)\$(Configuration)\ @@ -125,4 +125,4 @@ - + \ No newline at end of file diff --git a/libs/unimrcp/libs/uni-rtsp/unirtsp.2012.vcxproj b/libs/unimrcp/libs/uni-rtsp/unirtsp.2012.vcxproj index 1755172f88..6013474980 100644 --- a/libs/unimrcp/libs/uni-rtsp/unirtsp.2012.vcxproj +++ b/libs/unimrcp/libs/uni-rtsp/unirtsp.2012.vcxproj @@ -1,4 +1,4 @@ - + @@ -52,34 +52,34 @@ - - + + - - + + - - + + - - + + <_ProjectFileVersion>10.0.30319.1 $(PlatformName)\$(Configuration)\ $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ + $(SolutionDir)$(PlatformName)\$(Configuration)\ $(PlatformName)\$(Configuration)\ $(PlatformName)\$(Configuration)\ $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ + $(SolutionDir)$(PlatformName)\$(Configuration)\ $(PlatformName)\$(Configuration)\ @@ -133,4 +133,4 @@ - + \ No newline at end of file diff --git a/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2012.vcxproj b/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2012.vcxproj index 68fe1c6d7a..d6ad81dc49 100644 --- a/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2012.vcxproj +++ b/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2012.vcxproj @@ -1,4 +1,4 @@ - + @@ -52,42 +52,42 @@ - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + <_ProjectFileVersion>10.0.30319.1 $(PlatformName)\$(Configuration)\ $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ + $(SolutionDir)$(PlatformName)\$(Configuration)\ $(PlatformName)\$(Configuration)\ $(PlatformName)\$(Configuration)\ $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ + $(SolutionDir)$(PlatformName)\$(Configuration)\ $(PlatformName)\$(Configuration)\ @@ -139,4 +139,4 @@ - + \ No newline at end of file diff --git a/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.2012.vcxproj b/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.2012.vcxproj index 56807ad345..8f2d9eead2 100644 --- a/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.2012.vcxproj +++ b/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.2012.vcxproj @@ -1,4 +1,4 @@ - + @@ -52,42 +52,42 @@ - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + <_ProjectFileVersion>10.0.30319.1 $(PlatformName)\$(Configuration)\ $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ + $(SolutionDir)$(PlatformName)\$(Configuration)\ $(PlatformName)\$(Configuration)\ $(PlatformName)\$(Configuration)\ $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ + $(SolutionDir)$(PlatformName)\$(Configuration)\ $(PlatformName)\$(Configuration)\ @@ -134,4 +134,4 @@ - + \ No newline at end of file diff --git a/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.2012.vcxproj b/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.2012.vcxproj index 5c3ba42c25..5835d683d6 100644 --- a/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.2012.vcxproj +++ b/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.2012.vcxproj @@ -1,4 +1,4 @@ - + @@ -81,7 +81,7 @@ - $(SolutionDir)Debug/bin;%(AdditionalLibraryDirectories) + $(SolutionDir)Debug/bin;$(AdditionalLibraryDirectories) false @@ -97,7 +97,7 @@ - $(SolutionDir)\$(Platform)Debug;%(AdditionalLibraryDirectories) + $(SolutionDir)$(PlatformName)\$(Configuration)\;%(AdditionalLibraryDirectories) false @@ -127,7 +127,7 @@ - $(SolutionDir)\$(Platform)Debug;%(AdditionalLibraryDirectories) + $(SolutionDir)$(PlatformName)\$(Configuration)\;%(AdditionalLibraryDirectories) false @@ -207,4 +207,4 @@ - + \ No newline at end of file From c327455cde606aaa4f80a6a5962461b2fde16802 Mon Sep 17 00:00:00 2001 From: Brian West Date: Wed, 3 Dec 2014 13:36:39 -0600 Subject: [PATCH 27/95] FS-7030 #resolve --- libs/unimrcp/libs/mpf/mpf.2012.vcxproj | 1 + libs/unimrcp/libs/mpf/mpf.2012.vcxproj.filters | 7 +++++-- .../libs/mrcpv2-transport/mrcpv2transport.2012.vcxproj | 1 + .../mrcpv2-transport/mrcpv2transport.2012.vcxproj.filters | 3 +++ .../modules/mrcp-sofiasip/mrcpsofiasip.2012.vcxproj | 1 + .../mrcp-sofiasip/mrcpsofiasip.2012.vcxproj.filters | 3 +++ 6 files changed, 14 insertions(+), 2 deletions(-) diff --git a/libs/unimrcp/libs/mpf/mpf.2012.vcxproj b/libs/unimrcp/libs/mpf/mpf.2012.vcxproj index 954d665189..6c2941b39a 100644 --- a/libs/unimrcp/libs/mpf/mpf.2012.vcxproj +++ b/libs/unimrcp/libs/mpf/mpf.2012.vcxproj @@ -131,6 +131,7 @@ + diff --git a/libs/unimrcp/libs/mpf/mpf.2012.vcxproj.filters b/libs/unimrcp/libs/mpf/mpf.2012.vcxproj.filters index 72d0db06fe..d79e3f31a4 100644 --- a/libs/unimrcp/libs/mpf/mpf.2012.vcxproj.filters +++ b/libs/unimrcp/libs/mpf/mpf.2012.vcxproj.filters @@ -1,4 +1,4 @@ - + @@ -104,6 +104,9 @@ src + + src + @@ -230,4 +233,4 @@ include - + \ No newline at end of file diff --git a/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2012.vcxproj b/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2012.vcxproj index c165570e9b..9e4e95d197 100644 --- a/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2012.vcxproj +++ b/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2012.vcxproj @@ -117,6 +117,7 @@ + diff --git a/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2012.vcxproj.filters b/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2012.vcxproj.filters index 452f77e19d..576ef8ae7e 100644 --- a/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2012.vcxproj.filters +++ b/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2012.vcxproj.filters @@ -40,5 +40,8 @@ src + + src + \ No newline at end of file diff --git a/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2012.vcxproj b/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2012.vcxproj index d6ad81dc49..61945a1bb3 100644 --- a/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2012.vcxproj +++ b/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2012.vcxproj @@ -129,6 +129,7 @@ + diff --git a/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2012.vcxproj.filters b/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2012.vcxproj.filters index d2157eea88..33ff479678 100644 --- a/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2012.vcxproj.filters +++ b/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2012.vcxproj.filters @@ -31,5 +31,8 @@ src + + src + \ No newline at end of file From e8cf9c7d35c0572006c149e4a1defa647b4a606c Mon Sep 17 00:00:00 2001 From: Chris Rienzo Date: Wed, 3 Dec 2014 16:03:58 -0500 Subject: [PATCH 28/95] FS-7045 #resolve #comment [mod_rayo] guarantee that dialed call can be joined when answered event is sent. --- src/mod/event_handlers/mod_rayo/mod_rayo.c | 109 +++++++++++++++------ 1 file changed, 81 insertions(+), 28 deletions(-) diff --git a/src/mod/event_handlers/mod_rayo/mod_rayo.c b/src/mod/event_handlers/mod_rayo/mod_rayo.c index 614975ee15..4a840fd610 100644 --- a/src/mod/event_handlers/mod_rayo/mod_rayo.c +++ b/src/mod/event_handlers/mod_rayo/mod_rayo.c @@ -141,6 +141,10 @@ struct rayo_call { switch_event_t *end_event; /** True if ringing event sent to client */ int ringing_sent; + /** true if rayo app has started */ + int rayo_app_started; + /** delayed delivery of answer event because rayo APP wasn't started yet */ + switch_event_t *answer_event; /** True if request to create this call failed */ int dial_request_failed; }; @@ -1167,6 +1171,9 @@ done: if (event) { switch_event_destroy(&event); } + if (call->answer_event) { + switch_event_destroy(&call->answer_event); + } switch_core_hash_destroy(&call->pcps); } @@ -1350,6 +1357,8 @@ static struct rayo_call *rayo_call_init(struct rayo_call *call, switch_memory_po call->dial_request_id = NULL; call->end_event = NULL; call->dial_request_failed = 0; + call->rayo_app_started = 0; + call->answer_event = NULL; switch_core_hash_init(&call->pcps); } @@ -2080,31 +2089,38 @@ static iks *join_call(struct rayo_call *call, switch_core_session_t *session, st /* check if joining to rayo call */ struct rayo_call *b_call = RAYO_CALL_LOCATE(call_uri); - if (!b_call) { - /* not a rayo call */ - response = iks_new_error_detailed(node, STANZA_ERROR_SERVICE_UNAVAILABLE, "b-leg is gone"); - } else if (!has_call_control(b_call, msg)) { - /* not allowed to join to this call */ - response = iks_new_error(node, STANZA_ERROR_NOT_ALLOWED); - } else if (b_call->joined) { - /* don't support multiple joined calls */ - response = iks_new_error_detailed(node, STANZA_ERROR_CONFLICT, "multiple joined calls not supported"); + if (b_call) { + if (!call->rayo_app_started) { + /* A-leg not under rayo control yet */ + response = iks_new_error_detailed(node, STANZA_ERROR_UNEXPECTED_REQUEST, "a-leg is not ready to join"); + } else if (!b_call->rayo_app_started) { + /* B-leg not under rayo control yet */ + response = iks_new_error_detailed(node, STANZA_ERROR_UNEXPECTED_REQUEST, "b-leg is not ready to join"); + } else if (!has_call_control(b_call, msg)) { + /* not allowed to join to this call */ + response = iks_new_error(node, STANZA_ERROR_NOT_ALLOWED); + } else if (b_call->joined) { + /* don't support multiple joined calls */ + response = iks_new_error_detailed(node, STANZA_ERROR_CONFLICT, "multiple joined calls not supported"); + } else { + /* bridge this call to call-uri */ + switch_channel_set_variable(switch_core_session_get_channel(session), "bypass_media", bypass); + if (switch_false(bypass)) { + switch_channel_pre_answer(switch_core_session_get_channel(session)); + } + call->pending_join_request = iks_copy(node); + if (switch_ivr_uuid_bridge(rayo_call_get_uuid(call), rayo_call_get_uuid(b_call)) != SWITCH_STATUS_SUCCESS) { + iks *request = call->pending_join_request; + iks *result = iks_new_error(request, STANZA_ERROR_SERVICE_UNAVAILABLE); + call->pending_join_request = NULL; + RAYO_SEND_REPLY(call, iks_find_attrib_soft(request, "from"), result); + iks_delete(call->pending_join_request); + } + } RAYO_RELEASE(b_call); } else { - /* bridge this call to call-uri */ - switch_channel_set_variable(switch_core_session_get_channel(session), "bypass_media", bypass); - if (switch_false(bypass)) { - switch_channel_pre_answer(switch_core_session_get_channel(session)); - } - call->pending_join_request = iks_copy(node); - if (switch_ivr_uuid_bridge(rayo_call_get_uuid(call), rayo_call_get_uuid(b_call)) != SWITCH_STATUS_SUCCESS) { - iks *request = call->pending_join_request; - iks *result = iks_new_error(request, STANZA_ERROR_SERVICE_UNAVAILABLE); - call->pending_join_request = NULL; - RAYO_SEND_REPLY(call, iks_find_attrib_soft(request, "from"), result); - iks_delete(call->pending_join_request); - } - RAYO_RELEASE(b_call); + /* not a rayo call */ + response = iks_new_error_detailed(node, STANZA_ERROR_SERVICE_UNAVAILABLE, "b-leg is gone"); } return response; } @@ -2187,7 +2203,10 @@ static iks *join_mixer(struct rayo_call *call, switch_core_session_t *session, s iks *node = msg->payload; iks *response = NULL; - if (call->joined_id) { + if (!call->rayo_app_started) { + /* A-leg not under rayo control yet */ + response = iks_new_error_detailed(node, STANZA_ERROR_UNEXPECTED_REQUEST, "call is not ready to join"); + } else if (call->joined_id) { /* adjust join conference params */ if (!strcmp("duplex", direction)) { if ((response = exec_conference_api(session, mixer_name, "unmute", node)) || @@ -3379,10 +3398,17 @@ static void on_call_answer_event(struct rayo_client *rclient, switch_event_t *ev { struct rayo_call *call = RAYO_CALL_LOCATE_BY_ID(switch_event_get_header(event, "Unique-ID")); if (call) { - iks *revent = iks_new_presence("answered", RAYO_NS, - switch_event_get_header(event, "variable_rayo_call_jid"), - switch_event_get_header(event, "variable_rayo_dcp_jid")); - RAYO_SEND_MESSAGE(call, RAYO_JID(rclient), revent); + switch_mutex_lock(RAYO_ACTOR(call)->mutex); + if (call->rayo_app_started) { + iks *revent = iks_new_presence("answered", RAYO_NS, + switch_event_get_header(event, "variable_rayo_call_jid"), + switch_event_get_header(event, "variable_rayo_dcp_jid")); + RAYO_SEND_MESSAGE(call, RAYO_JID(rclient), revent); + } else if (!call->answer_event) { + /* delay sending this event until the rayo APP has started */ + switch_event_dup(&call->answer_event, event); + } + switch_mutex_unlock(RAYO_ACTOR(call)->mutex); RAYO_RELEASE(call); } } @@ -3840,6 +3866,13 @@ SWITCH_STANDARD_APP(rayo_app) clients_to_offer_count = switch_separate_string(data_dup, ',', clients_to_offer, sizeof(clients_to_offer) / sizeof(clients_to_offer[0])); } + /* It is now safe for inbound call to be fully controlled by rayo client */ + if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_INBOUND) { + switch_mutex_lock(RAYO_ACTOR(call)->mutex); + call->rayo_app_started = 1; + switch_mutex_unlock(RAYO_ACTOR(call)->mutex); + } + /* Offer call to all (or specified) ONLINE clients */ /* TODO load balance offers so first session doesn't always get offer first? */ switch_mutex_lock(globals.clients_mutex); @@ -3880,11 +3913,31 @@ done: switch_channel_set_variable(channel, "hold_hangup_xfer_exten", "park:inline:"); switch_channel_set_variable(channel, SWITCH_SEND_SILENCE_WHEN_IDLE_VARIABLE, "-1"); /* required so that output mixing works */ switch_core_event_hook_add_read_frame(session, rayo_call_on_read_frame); + if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) { + /* At this point, this outbound call might already be under control of a rayo client that is waiting for answer before sending + commands. The answered event might have been sent before we are ready to execute commands, so we delayed sending + those events if the rayo APP hadn't started yet. This delay would have only been a few milliseconds. + */ + switch_mutex_lock(RAYO_ACTOR(call)->mutex); + call->rayo_app_started = 1; + if (call->answer_event) { + struct rayo_client *rclient = RAYO_CLIENT(RAYO_LOCATE(rayo_call_get_dcp_jid(call))); + if (rclient) { + on_call_answer_event(rclient, call->answer_event); + switch_event_destroy(&call->answer_event); + RAYO_RELEASE(rclient); + } + } + switch_mutex_unlock(RAYO_ACTOR(call)->mutex); + + /* Outbound calls might have a nested join to another call or conference - do that now */ if (!zstr(app)) { switch_core_session_execute_application(session, app, app_args); } } + + /* Ready for remote control */ switch_ivr_park(session, NULL); } } From b341ff7c1f8e131693159b2523b59dbfc805d182 Mon Sep 17 00:00:00 2001 From: Brian West Date: Wed, 3 Dec 2014 15:06:31 -0600 Subject: [PATCH 29/95] FS-7046: fix data types and casting on some vars to silence windows build warnings --- src/mod/endpoints/mod_verto/mcast/mcast.c | 9 +++++---- src/mod/endpoints/mod_verto/mod_verto.c | 10 +++++----- src/mod/endpoints/mod_verto/mod_verto.h | 2 +- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/mod/endpoints/mod_verto/mcast/mcast.c b/src/mod/endpoints/mod_verto/mcast/mcast.c index 978c3dc6a5..e37ac08efc 100644 --- a/src/mod/endpoints/mod_verto/mcast/mcast.c +++ b/src/mod/endpoints/mod_verto/mcast/mcast.c @@ -48,11 +48,12 @@ #ifndef WIN32 #include #endif -#include "mcast.h" #ifndef WIN32 #include #endif #include +#include "mcast.h" + int mcast_socket_create(const char *host, int16_t port, mcast_handle_t *handle, mcast_flag_t flags) { @@ -68,7 +69,7 @@ int mcast_socket_create(const char *host, int16_t port, mcast_handle_t *handle, handle->send_addr.sin_addr.s_addr = inet_addr(host); handle->send_addr.sin_port = htons(port); - if ( setsockopt(handle->sock, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one)) != 0 ) { + if ( setsockopt(handle->sock, SOL_SOCKET, SO_REUSEADDR, (void *)&one, sizeof(one)) != 0 ) { close(handle->sock); return -1; } @@ -84,7 +85,7 @@ int mcast_socket_create(const char *host, int16_t port, mcast_handle_t *handle, mreq.imr_multiaddr.s_addr = inet_addr(host); mreq.imr_interface.s_addr = htonl(INADDR_ANY); - if (setsockopt(handle->sock, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mreq, sizeof(mreq)) < 0) { + if (setsockopt(handle->sock, IPPROTO_IP, IP_ADD_MEMBERSHIP, (void *)&mreq, sizeof(mreq)) < 0) { close(handle->sock); handle->sock = -1; return -1; @@ -125,7 +126,7 @@ int mcast_socket_create(const char *host, int16_t port, mcast_handle_t *handle, handle->ttl = 255; } - if ( setsockopt(handle->sock, IPPROTO_IP, IP_MULTICAST_TTL, &handle->ttl, sizeof(handle->ttl)) != 0 ) { + if ( setsockopt(handle->sock, IPPROTO_IP, IP_MULTICAST_TTL, (void *)&handle->ttl, sizeof(handle->ttl)) != 0 ) { return -1; } diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index c784d8d1a2..0e5d7c5d04 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -1518,7 +1518,7 @@ new_req: !strncmp(request.content_type, "application/x-www-form-urlencoded", 33)) { char *buffer = NULL; - int len = 0, bytes = 0; + switch_size_t len = 0, bytes = 0; if (request.content_length > 2 * 1024 * 1024 - 1) { char *data = "HTTP/1.1 413 Request Entity Too Large\r\n" @@ -3735,7 +3735,7 @@ static int start_jsock(verto_profile_t *profile, ws_socket_t sock) return -1; } -static ws_socket_t prepare_socket(int ip, int port) +static ws_socket_t prepare_socket(int ip, uint16_t port) { ws_socket_t sock = ws_sock_invalid; #ifndef WIN32 @@ -3840,7 +3840,7 @@ static int profile_one_loop(verto_profile_t *profile) } if (pfds[x].revents & SWITCH_POLL_READ) { - if (profile->mcast_ip && pfds[x].sock == profile->mcast_sub.sock) { + if (profile->mcast_ip && pfds[x].sock == (switch_os_socket_t)profile->mcast_sub.sock) { handle_mcast_sub(profile); } else { start_jsock(profile, pfds[x].sock); @@ -3969,7 +3969,7 @@ static void do_shutdown(void) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Done\n"); } -static void parse_ip(char *host, int *port, in_addr_t *addr, char *input) +static void parse_ip(char *host, uint16_t *port, in_addr_t *addr, char *input) { char *p; struct hostent *hent; @@ -3978,7 +3978,7 @@ static void parse_ip(char *host, int *port, in_addr_t *addr, char *input) if ((p = strchr(host, ':')) != NULL) { *p++ = '\0'; - *port = atoi(p); + *port = (uint16_t)atoi(p); } if ( host[0] < '0' || host[0] > '9' ) { diff --git a/src/mod/endpoints/mod_verto/mod_verto.h b/src/mod/endpoints/mod_verto/mod_verto.h index e1953f67b7..b864dcf8b7 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.h +++ b/src/mod/endpoints/mod_verto/mod_verto.h @@ -156,7 +156,7 @@ typedef struct jsock_s jsock_t; struct ips { char local_ip[256]; in_addr_t local_ip_addr; - int local_port; + uint16_t local_port; int secure; }; From 170fb1715a467a591199dca672b88040ca1285bb Mon Sep 17 00:00:00 2001 From: Brian West Date: Wed, 3 Dec 2014 15:24:37 -0600 Subject: [PATCH 30/95] FS-7046: fix some unreachable code warnings --- src/mod/endpoints/mod_verto/mod_verto.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index 0e5d7c5d04..fe80c0d4b0 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -3760,12 +3760,10 @@ static ws_socket_t prepare_socket(int ip, uint16_t port) if (bind(sock, (struct sockaddr *) &addr, sizeof(addr)) < 0) { die("Bind Error!\n"); - return ws_sock_invalid; } if (listen(sock, MAXPENDING) < 0) { die("Listen error\n"); - return ws_sock_invalid; } return sock; From 7ce51712501a6e89e73ac0439f90ac565224e1b6 Mon Sep 17 00:00:00 2001 From: Brian West Date: Wed, 3 Dec 2014 15:44:27 -0600 Subject: [PATCH 31/95] FS-7046 follow up on type change --- src/mod/endpoints/mod_verto/mod_verto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index fe80c0d4b0..7e91371f0d 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -1539,7 +1539,7 @@ new_req: len = request.content_length - bytes; if ((len = ws_raw_read(&jsock->ws, buffer + bytes, len, jsock->ws.block)) < 0) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Read error %d\n", len); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Read error %" SWITCH_SIZE_T_FMT"\n", len); goto done; } From 4be629037508dedc9fe9e50b118b8b5cb9bf422b Mon Sep 17 00:00:00 2001 From: sgutierrez Date: Thu, 4 Dec 2014 16:07:11 +0100 Subject: [PATCH 32/95] FS-7052 Moving jb queue swap operation out of the debug block. Fixes a bug where the jitter buffer implementation wasn't discarding old packets if debug mode was disabled. --- src/switch_stfu.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/switch_stfu.c b/src/switch_stfu.c index efaec8457a..5923d77a12 100644 --- a/src/switch_stfu.c +++ b/src/switch_stfu.c @@ -744,9 +744,10 @@ static int stfu_n_find_any_frame(stfu_instance_t *in, stfu_queue_t *queue, stfu_ if (was_read == queue->real_array_size) { if (stfu_log != null_logger && in->debug) { stfu_log(STFU_LOG_EMERG, "%s OUT QUEUE EMPTY, SWAPPING\n", in->name); - stfu_n_swap(in); - in->ready = 0; } + + stfu_n_swap(in); + in->ready = 0; return 0; } From 2ce2dccf21fb6cf09b590393cf57e2cedcbbf2d6 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 4 Dec 2014 13:31:19 -0500 Subject: [PATCH 33/95] update gdb scripts for new hash format --- support-d/.gdbinit | 51 ++++++++++++++++++++++++++++++---------------- 1 file changed, 33 insertions(+), 18 deletions(-) diff --git a/support-d/.gdbinit b/support-d/.gdbinit index e32687cfc4..329bc34777 100755 --- a/support-d/.gdbinit +++ b/support-d/.gdbinit @@ -6,11 +6,17 @@ define list_sessions dont-repeat printf "Listing sessions: \n" set $i = 0 - set $x=session_manager.session_table->table->first - while($x != 0x0) - printf "uuid %s is at %p\n", $x->pKey, $x->data - set $x = $x->next - set $i = $i + 1 + set $idx = 0 + set $len = session_manager.session_table->tablelength + while($idx < $len) + set $x = session_manager.session_table->table[$idx] + while($x != 0x0) + printf "uuid %s is at %p\n", $x->k, $x->v + set $i = $i + 1 + set $x = $x->next + end + set $idx = $idx + 1 + end printf "Found %d sessions.\n", $i end @@ -21,11 +27,16 @@ end define hash_it_str dont-repeat set $i = 0 - set $x=$arg0->table->first - while($x != 0x0) - printf "key: %s valueptr: %p\n", $x->pKey, $x->data - set $x = $x->next - set $i = $i + 1 + set $idx = 0 + set $len = $arg0->tablelength + + while($idx < $len) + set $x=$arg0->table->[$idx] + while($x != 0x0) + printf "key: %s valueptr: %p\n", $x->k, $x->v + set $x = $x->next + set $i = $i + 1 + end end end document hash_it_str @@ -37,14 +48,18 @@ end define hash_it_str_x dont-repeat set $i = 0 - set $x=$arg0->table->first - while($x != 0x0) - printf "key: %s\n", $x->pKey - print (($arg1*)$x->data)->$arg2 - printf "\n\n" - set $x = $x->next - set $i = $i + 1 - end + set $idx = 0 + set $len = $arg0->tablelength + while($idx < $len) + set $x=$arg0->table->[$idx] + while($x != 0x0) + printf "key: %s\n", $x->k + print (($arg1*)$x->v)->$arg2 + printf "\n\n" + set $x = $x->next + set $i = $i + 1 + end + end end document hash_it_str_x Usage: hash_it_str_x [hashtable] [value_type] [member] From 1bcdb49bced4be339d73532181fe6fa3938d0bd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Humberto=20Di=C3=B3genes?= Date: Thu, 4 Dec 2014 16:12:20 -0300 Subject: [PATCH 34/95] Fix JIRA (FS-7018): mod_callcenter's longest-idle-agent strategy is unfair --- src/mod/applications/mod_callcenter/mod_callcenter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index 8d4c0caf06..7b89527c79 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -2227,7 +2227,7 @@ static int members_callback(void *pArg, int argc, char **argv, char **columnName } else { if (!strcasecmp(queue->strategy, "longest-idle-agent")) { - sql_order_by = switch_mprintf("level, agents.last_offered_call, position"); + sql_order_by = switch_mprintf("level, agents.last_bridge_end, position"); } else if (!strcasecmp(queue_strategy, "agent-with-least-talk-time")) { sql_order_by = switch_mprintf("level, agents.talk_time, position"); } else if (!strcasecmp(queue_strategy, "agent-with-fewest-calls")) { From 843e4953be26f028d177d72aa0f5ea2d624e2cbf Mon Sep 17 00:00:00 2001 From: Paul Arnold Date: Fri, 5 Dec 2014 09:52:29 +1100 Subject: [PATCH 35/95] FS-7051: Preserve the annexb=no/yes status As per RFC4856, Annex B mode for G.729 is disabled if the SDP contains a fmtp parameter annexb=no and enabled if annexb=yes or the annexb parameter is missing. When responding to an offer mod_sangoma_codec always returns an answer without a fmtp parameter. Even in response to a SDP offer which contains one. This has the effect of responding to a request to disable Annex B with an answer that only Annex B is supported. With this change mod_sangoma_codec copies the fmtp parameter from the offer to the answer fixing the problem. --- .../mod_sangoma_codec/mod_sangoma_codec.c | 39 ++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c b/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c index 096a4c90a7..231bb05189 100644 --- a/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c +++ b/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c @@ -89,13 +89,13 @@ vocallo_codec_t g_codec_map[] = { SNGTC_CODEC_PCMA, IANA_PCMA_A_8000_1, "PCMA", "Sangoma PCMA", 40, 64000, 10000, 80, 160, 80, 8000, 8000, 1 }, { SNGTC_CODEC_L16_1, IANA_L16_A_8000_1, "L16", "Sangoma L16", 40, 120000, 10000, 80, 160, 160, 8000, 8000, 0 }, { SNGTC_CODEC_L16_2, IANA_L16_A_16000_1, "L16", "Sangoma L16 2", 40, 320000, 10000, 160, 320, 320, 16000, 16000, 0 }, - { SNGTC_CODEC_G729AB, IANA_G729_AB_8000_1, "G729", "Sangoma G729", 50, 8000, 10000, 80, 160, 10, 8000, 8000, 1 }, { SNGTC_CODEC_G726_32, IANA_G726_32_8000_1, "G726-32", "Sangoma G.726 32k", 40, 32000, 10000, 80, 160, 40, 8000, 8000, 1 }, { SNGTC_CODEC_G722, IANA_G722_A_8000_1, "G722", "Sangoma G722", 20, 64000, 10000, 80, 160, 80, 8000, 8000, 1 }, /* manually initialized */ { SNGTC_CODEC_GSM_FR, IANA_GSM_A_8000_1, "GSM", "Sangoma GSM", 20, 13200, 20000, 160, 320, 33, 8000, 8000, 0 }, { SNGTC_CODEC_G723_1_63, IANA_G723_A_8000_1, "G723", "Sangoma G723", 90, 6300, 30000, 240, 480, 24, 8000, 8000, 0 }, + { SNGTC_CODEC_G729AB, IANA_G729_AB_8000_1, "G729", "Sangoma G729", 50, 8000, 10000, 80, 160, 10, 8000, 8000, 0 }, { SNGTC_CODEC_AMR_1220, IANA_AMR_A_8000_1, "AMR", "Sangoma AMR", 20, 12200, 20000, 160, 320, 0, 8000, 8000, 0 }, { SNGTC_CODEC_SIREN7_24, IANA_SIREN7, "G7221", "Sangoma G722.1", 20, 24000, 20000, 320, 640, 60, 16000, 16000, 0 }, { SNGTC_CODEC_SIREN7_32, IANA_SIREN7, "G7221", "Sangoma G722.1", 20, 32000, 20000, 320, 640, 80, 16000, 16000, 0 }, @@ -415,6 +415,15 @@ static switch_status_t switch_sangoma_init_siren7(switch_codec_t *codec, switch_ return switch_sangoma_init(codec, flags, codec_settings); } +static switch_status_t switch_sangoma_init_g729(switch_codec_t *codec, switch_codec_flag_t flags, const switch_codec_settings_t *codec_settings) +{ + if (codec->fmtp_in) { + codec->fmtp_out = switch_core_strdup(codec->memory_pool, codec->fmtp_in); + } + + return switch_sangoma_init(codec, flags, codec_settings); +} + static void flush_rtp(switch_rtp_t *rtp) { switch_status_t sres; @@ -1470,6 +1479,34 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sangoma_codec_load) siren_done = 1; break; + case SNGTC_CODEC_G729AB: + for (i = 1; i <= 20; i++) { + if (g_codec_map[c].maxms < (i * 10)) { + break; + } + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Adding %dms implementation of codec %s\n", (i * 10), g_codec_map[c].fs_name); + switch_core_codec_add_implementation(pool, codec_interface, /* the codec interface we allocated and we want to register with the core */ + SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */ + g_codec_map[c].iana, /* the IANA code number, ie http://www.iana.org/assignments/rtp-parameters */ + g_codec_map[c].iana_name, /* the IANA code name */ + NULL, /* default fmtp to send (can be overridden by the init function), fmtp is used in SDP for format specific parameters */ + g_codec_map[c].sampling_rate, /* samples transferred per second */ + g_codec_map[c].actual_sampling_rate, /* actual samples transferred per second */ + g_codec_map[c].bps, /* bits transferred per second */ + g_codec_map[c].mpf * i, /* microseconds per frame */ + g_codec_map[c].spf * i, /* samples per frame */ + g_codec_map[c].bpfd * i, /* number of bytes per frame decompressed */ + g_codec_map[c].bpfc * i, /* number of bytes per frame compressed */ + 1, /* number of channels represented */ + g_codec_map[c].spf * i, /* number of frames per network packet (I dont think this is used at all) */ + switch_sangoma_init_g729, /* function to initialize a codec session using this implementation */ + switch_sangoma_encode, /* function to encode slinear data into encoded data */ + switch_sangoma_decode, /* function to decode encoded data into slinear data */ + switch_sangoma_destroy); /* deinitalize a codec handle using this implementation */ + } + break; + default: break; } From 158c1f23da9263e0c6aacf6a22e0a504c8909e37 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 5 Dec 2014 19:18:28 -0600 Subject: [PATCH 36/95] FS-7002 #resolve #comment please verify --- src/switch_core_media_bug.c | 9 ++++----- src/switch_ivr_async.c | 3 ++- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/switch_core_media_bug.c b/src/switch_core_media_bug.c index 6e9d746ac0..08f2ee30d7 100644 --- a/src/switch_core_media_bug.c +++ b/src/switch_core_media_bug.c @@ -227,9 +227,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_read(switch_media_bug_t *b if (bug->record_frame_size && bug->record_pre_buffer_max && (do_read || do_write) && bug->record_pre_buffer_count < bug->record_pre_buffer_max) { bug->record_pre_buffer_count++; return SWITCH_STATUS_FALSE; - } - - if (!bug->record_frame_size) { + } else { uint32_t frame_size; switch_codec_implementation_t read_impl = { 0 }; //switch_codec_implementation_t other_read_impl = { 0 }; @@ -238,6 +236,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_read(switch_media_bug_t *b switch_core_session_get_read_impl(bug->session, &read_impl); frame_size = read_impl.decoded_bytes_per_packet; bug->record_frame_size = frame_size; + #if 0 if (do_read && do_write) { if (switch_core_session_get_partner(bug->session, &other_session) == SWITCH_STATUS_SUCCESS) { @@ -255,7 +254,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_read(switch_media_bug_t *b } } - bug->record_frame_size = frame_size; + bug->record_frame_size = bytes = frame_size; } #endif } @@ -278,7 +277,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_read(switch_media_bug_t *b fill_read = !do_read; fill_write = !do_write; - if (fill_read && fill_write) { + if ((fill_read && fill_write) || (!fill && fill_read)) { return SWITCH_STATUS_FALSE; } diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index 25ec4d7285..3d3509b091 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -1313,12 +1313,13 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s uint8_t data[SWITCH_RECOMMENDED_BUFFER_SIZE]; switch_frame_t frame = { 0 }; switch_status_t status; + int x = 0; frame.data = data; frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE; for (;;) { - status = switch_core_media_bug_read(bug, &frame, SWITCH_FALSE); + status = switch_core_media_bug_read(bug, &frame, x++ == 0); if (status == SWITCH_STATUS_SUCCESS || status == SWITCH_STATUS_BREAK) { From 99a5b50780b1c3e235d6a4d9f3b3178096ba6a10 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 8 Dec 2014 02:03:17 -0600 Subject: [PATCH 37/95] FS-7063 #resolve --- src/switch_ivr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/switch_ivr.c b/src/switch_ivr.c index c328e177f1..24f177355a 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -2946,7 +2946,7 @@ SWITCH_DECLARE(void) switch_ivr_delay_echo(switch_core_session_t *session, uint3 } - qlen = delay_ms / (interval) / 2; + qlen = delay_ms / (interval); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Setting delay to %dms (%d frames)\n", delay_ms, qlen); jb = stfu_n_init(qlen, qlen, read_impl.samples_per_packet, read_impl.samples_per_second, 0); From 21458f85cc4228e54151350dd89c5c87cc3dfef4 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Fri, 5 Dec 2014 17:28:48 -0500 Subject: [PATCH 38/95] FS-7062: [mod_sofia] on redirect, when uri are passed in without <> with multiple uris, automatically add the q= header param in decending order. This should make 300 Multiple Choices work well with devices that require the q param. If you would like to specify explicit q-values, please use the syntax of redirect where you specify the entire header using the <> --- src/mod/endpoints/mod_sofia/mod_sofia.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 599ab45867..e1438753be 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -1828,11 +1828,13 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi break; case SWITCH_MESSAGE_INDICATE_REDIRECT: +#define MAX_REDIR 128 + if (!zstr(msg->string_arg)) { if (!switch_channel_test_flag(channel, CF_ANSWERED) && !sofia_test_flag(tech_pvt, TFLAG_BYE)) { char *dest = (char *) msg->string_arg; - char *argv[128] = { 0 }; + char *argv[MAX_REDIR] = { 0 }; char *mydata = NULL, *newdest = NULL; int argc = 0, i; switch_size_t len = 0; @@ -1846,10 +1848,20 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi for (i = 0; i < argc; i++) { if (!strchr(argv[i], '<') && !strchr(argv[i], '>')) { - if (i == argc - 1) { - switch_snprintf(newdest + strlen(newdest), len - strlen(newdest), "\"unknown\" <%s>", argv[i]); + if (argc > 1) { + if (i == argc - 1) { + switch_snprintf(newdest + strlen(newdest), len - strlen(newdest), "\"unknown\" <%s>;q=%1.3f", + argv[i], (double)((double)(MAX_REDIR + 1 - i))/1000); + } else { + switch_snprintf(newdest + strlen(newdest), len - strlen(newdest), "\"unknown\" <%s>;q=%1.3f,", + argv[i], (double)((double)(MAX_REDIR + 1 - i))/1000); + } } else { - switch_snprintf(newdest + strlen(newdest), len - strlen(newdest), "\"unknown\" <%s>,", argv[i]); + if (i == argc - 1) { + switch_snprintf(newdest + strlen(newdest), len - strlen(newdest), "\"unknown\" <%s>", argv[i]); + } else { + switch_snprintf(newdest + strlen(newdest), len - strlen(newdest), "\"unknown\" <%s>,", argv[i]); + } } } else { if (i == argc - 1) { From 392c687f2765ed7ac5deb67249a8b80682e846f6 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 8 Dec 2014 12:53:28 -0600 Subject: [PATCH 39/95] FS-7055 #resolve --- src/switch_ivr_originate.c | 67 +++++++++++++++++++++++++++----------- 1 file changed, 48 insertions(+), 19 deletions(-) diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index 65d3b0c496..2429de2e5c 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -1713,6 +1713,7 @@ struct early_state { switch_buffer_t *buffer; int ready; ringback_t *ringback; + int ttl; }; typedef struct early_state early_state_t; @@ -1723,7 +1724,6 @@ static void *SWITCH_THREAD_FUNC early_thread_run(switch_thread_t *thread, void * originate_status_t originate_status[MAX_PEERS] = { {0} }; int16_t mux_data[SWITCH_RECOMMENDED_BUFFER_SIZE / 2] = { 0 }; int32_t sample; - switch_core_session_t *session; switch_codec_t read_codecs[MAX_PEERS] = { {0} }; int i, x, ready = 0, answered = 0, ring_ready = 0; int16_t *data; @@ -1732,14 +1732,16 @@ static void *SWITCH_THREAD_FUNC early_thread_run(switch_thread_t *thread, void * switch_frame_t *read_frame = NULL; switch_codec_implementation_t read_impl = { 0 }; + for (i = 0; i < MAX_PEERS && i < state->ttl; i++) { + if (switch_core_session_read_lock(state->originate_status[i].peer_session) == SWITCH_STATUS_SUCCESS) { + originate_status[i].peer_session = state->originate_status[i].peer_session; + originate_status[i].peer_channel = switch_core_session_get_channel(state->originate_status[i].peer_session); + } + } + if (state->oglobals->session) { switch_core_session_get_read_impl(state->oglobals->session, &read_impl); } - - for (i = 0; i < MAX_PEERS && (session = state->originate_status[i].peer_session); i++) { - originate_status[i].peer_session = session; - switch_core_session_read_lock(session); - } while (state->ready) { datalen = 0; @@ -1747,8 +1749,18 @@ static void *SWITCH_THREAD_FUNC early_thread_run(switch_thread_t *thread, void * ready = 0; answered = 0; - for (i = 0; i < MAX_PEERS && (session = originate_status[i].peer_session); i++) { - switch_channel_t *channel = switch_core_session_get_channel(session); + for (i = 0; i < MAX_PEERS && i < state->ttl; i++) { + switch_core_session_t *session = originate_status[i].peer_session; + switch_channel_t *channel = originate_status[i].peer_channel; + + if (!session) { + break; + } + + if (!channel || !switch_channel_up(channel)) { + continue; + } + if (switch_channel_media_ready(channel)) { ready++; @@ -1797,31 +1809,43 @@ static void *SWITCH_THREAD_FUNC early_thread_run(switch_thread_t *thread, void * } } } - - if (state->ringback->asis && datalen) { + + if (!ready || answered || ring_ready) { + break; + } + + if (!datalen) { + continue; + } + + if (state->ringback->asis) { uint16_t flen = (uint16_t)datalen; switch_mutex_lock(state->mutex); switch_buffer_write(state->buffer, &flen, sizeof(uint16_t)); switch_buffer_write(state->buffer, read_frame->data, datalen); switch_mutex_unlock(state->mutex); - } else if (datalen) { + } else { switch_mutex_lock(state->mutex); switch_buffer_write(state->buffer, mux_data, datalen); switch_mutex_unlock(state->mutex); } - - if (!ready || answered || ring_ready) { - break; - } } - for (i = 0; i < MAX_PEERS && (session = originate_status[i].peer_session); i++) { + for (i = 0; i < MAX_PEERS && i < state->ttl; i++) { + switch_core_session_t *session = originate_status[i].peer_session; + switch_channel_t *channel = originate_status[i].peer_channel; + + if (!session) break; + if (switch_core_codec_ready((&read_codecs[i]))) { - switch_core_session_set_read_codec(session, NULL); switch_core_codec_destroy(&read_codecs[i]); } - switch_core_session_reset(session, SWITCH_FALSE, SWITCH_TRUE); + + if (switch_channel_up_nosig(channel)) { + switch_core_session_reset(session, SWITCH_FALSE, SWITCH_TRUE); + } + switch_core_session_rwunlock(session); } @@ -3117,6 +3141,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess early_state.originate_status = originate_status; early_state.ready = 1; early_state.ringback = &ringback; + early_state.ttl = and_argc; switch_mutex_init(&early_state.mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session)); switch_buffer_create_dynamic(&early_state.buffer, 1024, 1024, 0); switch_thread_create(&oglobals.ethread, thd_attr, early_thread_run, &early_state, switch_core_session_get_pool(session)); @@ -3756,6 +3781,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess for (i = 0; i < and_argc; i++) { switch_channel_state_t state; + switch_core_session_t *peer_session; char *val; if (!originate_status[i].peer_channel) { @@ -3788,7 +3814,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess } switch_channel_clear_flag(originate_status[i].peer_channel, CF_ORIGINATING); - switch_core_session_rwunlock(originate_status[i].peer_session); + peer_session = originate_status[i].peer_session; + originate_status[i].peer_session = NULL; + originate_status[i].peer_channel = NULL; + switch_core_session_rwunlock(peer_session); } if (status == SWITCH_STATUS_SUCCESS || oglobals.idx == IDX_XFER) { From 5ca609e6378ae0ec141e214f7719d204f8a24059 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 8 Dec 2014 20:36:25 -0600 Subject: [PATCH 40/95] factor channel count into flush len --- src/mod/applications/mod_conference/mod_conference.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 1dfbe311d3..b3a5fd525e 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -4277,7 +4277,7 @@ static void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, v switch_channel_audio_sync(channel); - flush_len = switch_samples_per_packet(member->conference->rate, member->conference->interval) * 6; + flush_len = switch_samples_per_packet(member->conference->rate, member->conference->interval) * member->conference->channels * 10; /* As long as we have a valid read, feed that data into an input buffer where the conference thread will take it and mux it with any audio from other channels. */ From 4bcf1d888a4629993923527c26d4dbc6dae5d470 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 8 Dec 2014 16:56:34 -0600 Subject: [PATCH 41/95] use cached time to save cpu --- src/switch_time.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/switch_time.c b/src/switch_time.c index cc5fbe8dbe..71c43cfdd3 100644 --- a/src/switch_time.c +++ b/src/switch_time.c @@ -380,7 +380,7 @@ SWITCH_DECLARE(void) switch_time_set_cond_yield(switch_bool_t enable) static switch_status_t timer_generic_sync(switch_timer_t *timer) { - switch_time_t now = time_now(0); + switch_time_t now = switch_micro_time_now(); int64_t elapsed = (now - timer->start); timer->tick = (elapsed / timer->interval) / 1000; @@ -451,7 +451,7 @@ static switch_status_t _timerfd_init(switch_timer_t *timer) it = switch_core_alloc(timer->memory_pool, sizeof(*it)); if ((rc = timerfd_start_interval(it, timer->interval)) == SWITCH_STATUS_SUCCESS) { - timer->start = time_now(0); + timer->start = switch_micro_time_now(); timer->private_info = it; } @@ -681,9 +681,10 @@ static switch_status_t timer_init(switch_timer_t *timer) timer_private_t *private_info; int sanity = 0; - timer->start = time_now(0); + timer->start = switch_micro_time_now(); if (timer->interval == 1) { + runtime.microseconds_per_tick = 10000; switch_mutex_lock(globals.mutex); globals.timer_count++; switch_mutex_unlock(globals.mutex); From 5376e82669d2f53d8acd06f49a27949bfbb21fcd Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Thu, 4 Dec 2014 12:34:05 -0500 Subject: [PATCH 42/95] FS-6688: don't update the contact when the original had fs_path, the new one doesnt, and the contact didn't change. This will fix the normal case of record route from a proxy without breaking normal changing of a contact --- src/mod/endpoints/mod_sofia/sofia_presence.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index 4c0e3be89e..69a86668d2 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -3882,7 +3882,7 @@ void sofia_presence_handle_sip_i_subscribe(int status, } if ((sub_state != nua_substate_terminated)) { - sql = switch_mprintf("select call_id from sip_subscriptions where call_id='%q' and profile_name='%q' and hostname='%q'", + sql = switch_mprintf("select contact from sip_subscriptions where call_id='%q' and profile_name='%q' and hostname='%q'", call_id, profile->name, mod_sofia_globals.hostname); sofia_glue_execute_sql2str(profile, profile->dbh_mutex, sql, buf, sizeof(buf)); @@ -3900,15 +3900,24 @@ void sofia_presence_handle_sip_i_subscribe(int status, } if (sub_state == nua_substate_active) { + char *contact = contact_str; sstr = switch_mprintf("active;expires=%ld", exp_delta); + if (strstr(buf, "fs_path=") && !strstr(contact_str, "fs_path=")) { + char *e = strchr(buf,';'); + size_t l = e ? buf-e : strlen(buf); + if (strncmp(contact_str,buf,l)) { + contact = buf; + } + } + sql = switch_mprintf("update sip_subscriptions " "set expires=%ld, " - "network_ip='%q',network_port='%d',sip_user='%q',sip_host='%q',full_via='%q',full_to='%q',full_from='%q' " + "network_ip='%q',network_port='%d',sip_user='%q',sip_host='%q',full_via='%q',full_to='%q',full_from='%q',contact='%q' " "where call_id='%q' and profile_name='%q' and hostname='%q'", (long) switch_epoch_time_now(NULL) + exp_delta, - np.network_ip, np.network_port, from_user, from_host, full_via, full_to, full_from, + np.network_ip, np.network_port, from_user, from_host, full_via, full_to, full_from, contact, call_id, profile->name, mod_sofia_globals.hostname); From f024ea3c2bc3f3750968d082ca725f2c8657eedb Mon Sep 17 00:00:00 2001 From: Chris Rienzo Date: Wed, 10 Dec 2014 15:44:10 -0500 Subject: [PATCH 43/95] FS-7047 #comment [mod_rayo] arbitrary MRCP headers can now be sent to unimrcp input components --- .../mod_rayo/rayo_input_component.c | 49 ++++++++++++------- 1 file changed, 30 insertions(+), 19 deletions(-) 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 76bffff055..e199b46b8e 100644 --- a/src/mod/event_handlers/mod_rayo/rayo_input_component.c +++ b/src/mod/event_handlers/mod_rayo/rayo_input_component.c @@ -448,12 +448,14 @@ static char *setup_grammars_pocketsphinx(struct input_component *component, swit static char *setup_grammars_unimrcp(struct input_component *component, switch_core_session_t *session, iks *input, const struct xmpp_error **stanza_error, const char **error_detail) { iks *grammar_tag; + switch_asr_handle_t *ah; switch_stream_handle_t grammar_uri_list = { 0 }; SWITCH_STANDARD_STREAM(grammar_uri_list); /* unlock handler mutex, otherwise deadlock will happen when switch_ivr_detect_speech_init adds a new media bug */ switch_mutex_unlock(component->handler->mutex); - if (switch_ivr_detect_speech_init(session, component->recognizer, "", NULL) != SWITCH_STATUS_SUCCESS) { + ah = switch_core_session_alloc(session, sizeof(*ah)); + if (switch_ivr_detect_speech_init(session, component->recognizer, "", ah) != SWITCH_STATUS_SUCCESS) { switch_mutex_lock(component->handler->mutex); *stanza_error = STANZA_ERROR_INTERNAL_SERVER_ERROR; *error_detail = "Failed to initialize recognizer"; @@ -461,37 +463,45 @@ static char *setup_grammars_unimrcp(struct input_component *component, switch_co } switch_mutex_lock(component->handler->mutex); - /* load unimrcp grammars and return uri-list */ - grammar_uri_list.write_function(&grammar_uri_list, "{start-recognize=true,start-input-timers=%s,confidence-threshold=%f,sensitivity-level=%f", - component->start_timers ? "true" : "false", - component->min_confidence, - component->sensitivity); + /* handle input config */ + switch_core_asr_text_param(ah, "start-input-timers", component->start_timers ? "true" : "false"); + switch_core_asr_text_param(ah, "confidence-threshold", switch_core_sprintf(RAYO_POOL(component), "%f", component->min_confidence)); + switch_core_asr_text_param(ah, "sensitivity-level", switch_core_sprintf(RAYO_POOL(component), "%f", component->sensitivity)); if (component->initial_timeout > 0) { - grammar_uri_list.write_function(&grammar_uri_list, ",no-input-timeout=%d", - component->initial_timeout); + switch_core_asr_text_param(ah, "no-input-timeout", switch_core_sprintf(RAYO_POOL(component), "%d", component->initial_timeout)); } - if (component->max_silence > 0) { - grammar_uri_list.write_function(&grammar_uri_list, ",speech-complete-timeout=%d,speech-incomplete-timeout=%d", - component->max_silence, - component->max_silence); + switch_core_asr_text_param(ah, "speech-complete-timeout", switch_core_sprintf(RAYO_POOL(component), "%d", component->max_silence)); + switch_core_asr_text_param(ah, "speech-incomplete-timeout", switch_core_sprintf(RAYO_POOL(component), "%d", component->max_silence)); } - if (!zstr(component->language)) { - grammar_uri_list.write_function(&grammar_uri_list, ",speech-language=%s", component->language); + switch_core_asr_text_param(ah, "speech-language", component->language); } - if (!strcmp(iks_find_attrib_soft(input, "mode"), "any") || !strcmp(iks_find_attrib_soft(input, "mode"), "dtmf")) { /* set dtmf params */ if (component->inter_digit_timeout > 0) { - grammar_uri_list.write_function(&grammar_uri_list, ",dtmf-interdigit-timeout=%d", component->inter_digit_timeout); + switch_core_asr_text_param(ah, "dtmf-interdigit-timeout", switch_core_sprintf(RAYO_POOL(component), "%d", component->inter_digit_timeout)); } if (component->term_digit) { - grammar_uri_list.write_function(&grammar_uri_list, ",dtmf-term-char=%c", component->term_digit); + switch_core_asr_text_param(ah, "dtmf-term-char", switch_core_sprintf(RAYO_POOL(component), "%c", component->term_digit)); } } - grammar_uri_list.write_function(&grammar_uri_list, "}"); + /* override input configs w/ custom headers */ + { + iks *header = NULL; + for (header = iks_find(input, "header"); header; header = iks_next_tag(header)) { + if (!strcmp("header", iks_name(header))) { + const char *name = iks_find_attrib_soft(header, "name"); + const char *value = iks_find_attrib_soft(header, "value"); + if (!zstr(name) && !zstr(value)) { + switch_core_asr_text_param(ah, (char *)name, value); + } + } + } + } + + switch_core_asr_text_param(ah, "start-recognize", "false"); for (grammar_tag = iks_find(input, "grammar"); grammar_tag; grammar_tag = iks_next_tag(grammar_tag)) { const char *grammar_name; iks *grammar_cdata; @@ -511,7 +521,7 @@ static char *setup_grammars_unimrcp(struct input_component *component, switch_co } /* load the grammar */ - grammar = switch_core_sprintf(RAYO_POOL(component), "{start-recognize=false}inline:%s", iks_cdata(grammar_cdata)); + 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); @@ -527,6 +537,7 @@ static char *setup_grammars_unimrcp(struct input_component *component, switch_co /* add grammar to uri-list */ grammar_uri_list.write_function(&grammar_uri_list, "session:%s\r\n", grammar_name); } + switch_core_asr_text_param(ah, "start-recognize", "true"); return (char *)grammar_uri_list.data; } From a3f630fc2ee61953a8c50295a6317da44aa89a4a Mon Sep 17 00:00:00 2001 From: Chris Rienzo Date: Wed, 10 Dec 2014 16:57:02 -0500 Subject: [PATCH 44/95] FS-7047 #resolve #comment [mod_rayo] arbitrary MRCP headers can now be sent to unimrcp output components --- .../mod_rayo/rayo_output_component.c | 38 ++++++++++++++++++- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/src/mod/event_handlers/mod_rayo/rayo_output_component.c b/src/mod/event_handlers/mod_rayo/rayo_output_component.c index ef097b6411..267f06225c 100644 --- a/src/mod/event_handlers/mod_rayo/rayo_output_component.c +++ b/src/mod/event_handlers/mod_rayo/rayo_output_component.c @@ -51,6 +51,8 @@ struct output_component { int stop; /** output renderer to use */ const char *renderer; + /** optional headers to pass to renderer */ + const char *headers; }; #define OUTPUT_FINISH "finish", RAYO_OUTPUT_COMPLETE_NS @@ -77,6 +79,28 @@ static struct rayo_component *create_output_component(struct rayo_actor *actor, output_component->max_time_ms = iks_find_int_attrib(output, "max-time"); output_component->start_paused = iks_find_bool_attrib(output, "start-paused"); output_component->renderer = switch_core_strdup(RAYO_POOL(output_component), iks_find_attrib_soft(output, "renderer")); + /* get custom headers */ + { + switch_stream_handle_t headers = { 0 }; + iks *header = NULL; + int first = 1; + SWITCH_STANDARD_STREAM(headers); + for (header = iks_find(output, "header"); header; header = iks_next_tag(header)) { + if (!strcmp("header", iks_name(header))) { + const char *name = iks_find_attrib_soft(header, "name"); + const char *value = iks_find_attrib_soft(header, "value"); + if (!zstr(name) && !zstr(value)) { + headers.write_function(&headers, "%s%s=%s", first ? "{" : ",", name, value); + first = 0; + } + } + } + if (headers.data) { + headers.write_function(&headers, "}"); + output_component->headers = switch_core_strdup(RAYO_POOL(output_component), (char *)headers.data); + free(headers.data); + } + } } else { switch_core_destroy_memory_pool(&pool); } @@ -438,7 +462,12 @@ static switch_status_t next_file(switch_file_handle_t *handle) context->ssml = switch_mprintf("ssml://%s", ssml_str); } else { /* renderer will parse the SSML */ - context->ssml = switch_mprintf("tts://%s||%s", output->renderer, ssml_str); + if (!zstr(output->headers) && !strncmp("unimrcp", output->renderer, 7)) { + /* pass MRCP headers */ + context->ssml = switch_mprintf("tts://%s||%s%s", output->renderer, output->headers, ssml_str); + } else { + context->ssml = switch_mprintf("tts://%s||%s", output->renderer, ssml_str); + } } iks_free(ssml_str); } else if (iks_has_children(context->cur_doc)) { @@ -457,7 +486,12 @@ static switch_status_t next_file(switch_file_handle_t *handle) context->ssml = switch_mprintf("ssml://%s", ssml_str); } else { /* renderer will parse the SSML */ - context->ssml = switch_mprintf("tts://%s||%s", output->renderer, ssml_str); + if (!zstr(output->headers) && !strncmp("unimrcp", output->renderer, 7)) { + /* pass MRCP headers */ + context->ssml = switch_mprintf("tts://%s||%s%s", output->renderer, output->headers, ssml_str); + } else { + context->ssml = switch_mprintf("tts://%s||%s", output->renderer, ssml_str); + } } } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Missing \n"); From 06c241a233988c967fa6090832a28219af9dfa57 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 11 Dec 2014 20:57:55 -0600 Subject: [PATCH 45/95] FS-6891 FS-7002 FS-7059 FS-7072 FS-7073 FS-7076 #close #comment All of these bugs are invalidated due to a botched revert -- commit 72c3df5ed39b724590b5266fb31eea090f56dba7 was supposed to revert commit 1b612fecb6e8db11da9b15c5522b87e7b642423d but it only reverted part of it. commit 158c1f23da9263e0c6aacf6a22e0a504c8909e37 from the other day was erroneously created to work around the result of the botched revert so it is reverted. The result of this commit should be to bring it back to effectively properly revert 1b612fecb6e8db11da9b15c5522b87e7b642423d and now you can test and open new bugs if necessary. This includes the segfault in eavesdrop, and any media bug releated reports. Consider working together and only reporting one new bug if you still encounter any more problems and be sure to include details and make sure the jitter buffer is being used. --- src/include/private/switch_core_pvt.h | 3 -- src/switch_core_io.c | 54 +-------------------------- src/switch_ivr_async.c | 3 +- 3 files changed, 3 insertions(+), 57 deletions(-) diff --git a/src/include/private/switch_core_pvt.h b/src/include/private/switch_core_pvt.h index e64541b309..d7933b4880 100644 --- a/src/include/private/switch_core_pvt.h +++ b/src/include/private/switch_core_pvt.h @@ -179,9 +179,6 @@ struct switch_core_session { switch_media_handle_t *media_handle; uint32_t decoder_errors; - switch_time_t last_read_time; - switch_time_t last_write_time; - }; struct switch_media_bug { diff --git a/src/switch_core_io.c b/src/switch_core_io.c index 8a1dd97120..cb056adb73 100644 --- a/src/switch_core_io.c +++ b/src/switch_core_io.c @@ -762,26 +762,11 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi switch_media_bug_t *bp; switch_bool_t ok = SWITCH_TRUE; int prune = 0; - switch_time_t now = switch_micro_time_now(); - switch_time_t diff = 0; - switch_size_t len = session->read_impl.decoded_bytes_per_packet; - unsigned char fill_data[SWITCH_RECOMMENDED_BUFFER_SIZE] = {0}; - switch_thread_rwlock_rdlock(session->bug_rwlock); - if (session->last_read_time && session->last_read_time < now) { - diff = ((now - session->last_read_time) + 3000 ) / session->read_impl.microseconds_per_packet; - - if (diff > 1) { - memset(fill_data, 255, len); - } - } - - session->last_read_time = switch_micro_time_now(); - for (bp = session->bugs; bp; bp = bp->next) { ok = SWITCH_TRUE; - + if (switch_channel_test_flag(session->channel, CF_PAUSE_BUGS) && !switch_core_media_bug_test_flag(bp, SMBF_NO_PAUSE)) { continue; } @@ -801,17 +786,6 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi if (ok && bp->ready && switch_test_flag(bp, SMBF_READ_STREAM)) { switch_mutex_lock(bp->read_mutex); - - if (diff > 1) { - switch_time_t tdiff = diff; - - while(tdiff > 1) { - switch_buffer_write(bp->raw_read_buffer, fill_data, len); - tdiff--; - } - - } - if (bp->read_demux_frame) { uint8_t data[SWITCH_RECOMMENDED_BUFFER_SIZE]; int bytes = read_frame->datalen / 2; @@ -1371,23 +1345,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess if (session->bugs) { switch_media_bug_t *bp; int prune = 0; - switch_time_t now = switch_micro_time_now(); - switch_time_t diff = 0; - switch_size_t len = session->read_impl.decoded_bytes_per_packet; - unsigned char fill_data[SWITCH_RECOMMENDED_BUFFER_SIZE] = {0}; - + switch_thread_rwlock_rdlock(session->bug_rwlock); - - if (session->last_write_time && session->last_write_time < now) { - diff = ((now - session->last_write_time) + 3000 ) / session->read_impl.microseconds_per_packet; - - if (diff > 1) { - memset(fill_data, 255, len); - } - } - - session->last_write_time = switch_micro_time_now(); - for (bp = session->bugs; bp; bp = bp->next) { switch_bool_t ok = SWITCH_TRUE; @@ -1410,15 +1369,6 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess if (switch_test_flag(bp, SMBF_WRITE_STREAM)) { switch_mutex_lock(bp->write_mutex); - if (diff > 1) { - switch_time_t tdiff = diff; - - while(tdiff > 1) { - switch_buffer_write(bp->raw_read_buffer, fill_data, len); - tdiff--; - } - } - switch_buffer_write(bp->raw_write_buffer, write_frame->data, write_frame->datalen); switch_mutex_unlock(bp->write_mutex); diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index 3d3509b091..25ec4d7285 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -1313,13 +1313,12 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s uint8_t data[SWITCH_RECOMMENDED_BUFFER_SIZE]; switch_frame_t frame = { 0 }; switch_status_t status; - int x = 0; frame.data = data; frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE; for (;;) { - status = switch_core_media_bug_read(bug, &frame, x++ == 0); + status = switch_core_media_bug_read(bug, &frame, SWITCH_FALSE); if (status == SWITCH_STATUS_SUCCESS || status == SWITCH_STATUS_BREAK) { From be0e09bd7f94df837d255e5d3f4ef92a5cd3dbdb Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 11 Dec 2014 13:22:43 -0600 Subject: [PATCH 46/95] only negotiate codecs that were previously negotiated on re-invites unless its intentional to change codecs --- src/switch_core_media.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/switch_core_media.c b/src/switch_core_media.c index 1c7c369474..f6e7b32b39 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -3442,6 +3442,12 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s reneg = 0; } + if (sdp_type == SDP_TYPE_RESPONSE && smh->num_negotiated_codecs) { + /* response to re-invite or update, only negotiated codecs are valid */ + reneg = 0; + } + + if (!reneg && smh->num_negotiated_codecs) { codec_array = smh->negotiated_codecs; total_codecs = smh->num_negotiated_codecs; @@ -8002,6 +8008,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_receive_message(switch_core_se a_engine->codec_negotiated = 0; v_engine->codec_negotiated = 0; + smh->num_negotiated_codecs = 0; switch_channel_clear_flag(session->channel, CF_VIDEO_POSSIBLE); switch_core_media_prepare_codecs(session, SWITCH_TRUE); switch_core_media_check_video_codecs(session); From 922fd8152331a9d08452347ad49d94088b54195c Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 11 Dec 2014 17:18:17 -0600 Subject: [PATCH 47/95] FS-7015 #resolve #comment The code was not properly catching the 0.0.0.0 after changing it to work with ICE SDPs because it was looking in the wrong place for the 0.0.0.0 --- src/switch_core_media.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/switch_core_media.c b/src/switch_core_media.c index f6e7b32b39..29d150463e 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -3210,6 +3210,10 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s check_ice(smh, SWITCH_MEDIA_TYPE_AUDIO, sdp, NULL); check_ice(smh, SWITCH_MEDIA_TYPE_VIDEO, sdp, NULL); + if ((sdp->sdp_connection && sdp->sdp_connection->c_address && !strcmp(sdp->sdp_connection->c_address, "0.0.0.0"))) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "RFC2543 from March 1999 called; They want their 0.0.0.0 hold method back.....\n"); + sendonly = 2; /* global sendonly always wins */ + } for (m = sdp->sdp_media; m; m = m->m_next) { sdp_connection_t *connection; @@ -3360,11 +3364,13 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s sdp_rtpmap_t *map; int ice = 0; - if ((m->m_mode == sdp_sendonly || m->m_mode == sdp_inactive || - (m->m_connections && m->m_connections->c_address && !strcmp(m->m_connections->c_address, "0.0.0.0")))) { - sendonly = 2; /* global sendonly always wins */ + if (!sendonly && (m->m_mode == sdp_sendonly || m->m_mode == sdp_inactive)) { + sendonly = 1; } + if (!sendonly && m->m_connections && m->m_connections->c_address && !strcmp(m->m_connections->c_address, "0.0.0.0")) { + sendonly = 1; + } for (attr = sdp->sdp_attributes; attr; attr = attr->a_next) { if (zstr(attr->a_name)) { From f63f8686bc8da391b3c46b24e10571215c8b377f Mon Sep 17 00:00:00 2001 From: Italo Rossi Date: Thu, 11 Dec 2014 23:43:03 -0300 Subject: [PATCH 48/95] FS-7049 - Documentation for state optional paramenter in callcenter_config queue list and count --- src/mod/applications/mod_callcenter/mod_callcenter.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index 7a34883345..6103932706 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -2862,11 +2862,11 @@ static int list_result_callback(void *pArg, int argc, char **argv, char **column "\tcallcenter_config queue unload [queue_name] | \n" \ "\tcallcenter_config queue reload [queue_name] | \n" \ "\tcallcenter_config queue list | \n" \ -"\tcallcenter_config queue list agents [queue_name] [status] | \n" \ +"\tcallcenter_config queue list agents [queue_name] [status] [state] | \n" \ "\tcallcenter_config queue list members [queue_name] | \n" \ "\tcallcenter_config queue list tiers [queue_name] | \n" \ "\tcallcenter_config queue count | \n" \ -"\tcallcenter_config queue count agents [queue_name] [status] | \n" \ +"\tcallcenter_config queue count agents [queue_name] [status] [state] | \n" \ "\tcallcenter_config queue count members [queue_name] | \n" \ "\tcallcenter_config queue count tiers [queue_name]" From 3d515cf49c0bad3fb749074a8dc6eae232c10249 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 11 Dec 2014 18:54:31 -0600 Subject: [PATCH 49/95] re-mark cur_payload as negotiated when detected as such by parser or the rtp could stop working on session re-invite --- src/switch_core_media.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/switch_core_media.c b/src/switch_core_media.c index 29d150463e..8e00b72e2b 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -5106,6 +5106,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi remote_port == a_engine->cur_payload_map->remote_sdp_port) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Audio params are unchanged for %s.\n", switch_channel_get_name(session->channel)); + a_engine->cur_payload_map->negotiated = 1; //XX goto video; } else { @@ -5495,6 +5496,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi if (remote_host && remote_port && !strcmp(remote_host, v_engine->cur_payload_map->remote_sdp_ip) && remote_port == v_engine->cur_payload_map->remote_sdp_port) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Video params are unchanged for %s.\n", switch_channel_get_name(session->channel)); + v_engine->cur_payload_map->negotiated = 1; goto video_up; } else { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Video params changed for %s from %s:%d to %s:%d\n", From ea149be9d867a7c490cec8d7164cc59b6b116d98 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Fri, 12 Dec 2014 09:40:52 -0600 Subject: [PATCH 50/95] windows force datatype conversion on uint64_t to switch_size_t for recent change. maybe we should change the structure to be uint64_t as well? --- src/switch_time.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/switch_time.c b/src/switch_time.c index 71c43cfdd3..6f7d810042 100644 --- a/src/switch_time.c +++ b/src/switch_time.c @@ -384,7 +384,7 @@ static switch_status_t timer_generic_sync(switch_timer_t *timer) int64_t elapsed = (now - timer->start); timer->tick = (elapsed / timer->interval) / 1000; - timer->samplecount = timer->tick * timer->samples; + timer->samplecount = (uint32_t)(timer->tick * timer->samples); return SWITCH_STATUS_SUCCESS; } @@ -717,7 +717,7 @@ static switch_status_t timer_init(switch_timer_t *timer) TIMER_MATRIX[timer->interval].count++; switch_mutex_unlock(globals.mutex); timer->private_info = private_info; - private_info->start = private_info->reference = TIMER_MATRIX[timer->interval].tick; + private_info->start = (switch_size_t)(private_info->reference = TIMER_MATRIX[timer->interval].tick); private_info->start -= 2; /* switch_core_timer_init sets samplecount to samples, this makes first next() step once */ private_info->roll = TIMER_MATRIX[timer->interval].roll; private_info->ready = 1; @@ -748,7 +748,7 @@ static switch_status_t timer_init(switch_timer_t *timer) #define check_roll() if (private_info->roll < TIMER_MATRIX[timer->interval].roll) { \ private_info->roll++; \ - private_info->reference = private_info->start = TIMER_MATRIX[timer->interval].tick; \ + private_info->reference = (switch_size_t)(private_info->start = TIMER_MATRIX[timer->interval].tick); \ private_info->start--; /* Must have a diff */ \ } \ @@ -809,7 +809,7 @@ static switch_status_t timer_sync(switch_timer_t *timer) } /* sync the clock */ - private_info->reference = timer->tick = TIMER_MATRIX[timer->interval].tick; + private_info->reference = (switch_size_t)(timer->tick = TIMER_MATRIX[timer->interval].tick); /* apply timestamp */ timer_step(timer); @@ -847,7 +847,7 @@ static switch_status_t timer_next(switch_timer_t *timer) /* sync up timer if it's not been called for a while otherwise it will return instantly several times until it catches up */ if (delta < -1) { - private_info->reference = timer->tick = TIMER_MATRIX[timer->interval].tick; + private_info->reference = (switch_size_t)(timer->tick = TIMER_MATRIX[timer->interval].tick); } timer_step(timer); @@ -907,7 +907,7 @@ static switch_status_t timer_check(switch_timer_t *timer, switch_bool_t step) timer->tick = TIMER_MATRIX[timer->interval].tick; if (timer->tick < private_info->reference) { - timer->diff = private_info->reference - timer->tick; + timer->diff = (switch_size_t)(private_info->reference - timer->tick); } else { timer->diff = 0; } From 39fa0b966482e214ddf85a2dc793f4f197d8df16 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Fri, 12 Dec 2014 10:02:03 -0600 Subject: [PATCH 51/95] trivial fix for last commit --- src/switch_time.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/switch_time.c b/src/switch_time.c index 6f7d810042..f710105031 100644 --- a/src/switch_time.c +++ b/src/switch_time.c @@ -717,7 +717,7 @@ static switch_status_t timer_init(switch_timer_t *timer) TIMER_MATRIX[timer->interval].count++; switch_mutex_unlock(globals.mutex); timer->private_info = private_info; - private_info->start = (switch_size_t)(private_info->reference = TIMER_MATRIX[timer->interval].tick); + private_info->start = private_info->reference = (switch_size_t)TIMER_MATRIX[timer->interval].tick; private_info->start -= 2; /* switch_core_timer_init sets samplecount to samples, this makes first next() step once */ private_info->roll = TIMER_MATRIX[timer->interval].roll; private_info->ready = 1; @@ -748,7 +748,7 @@ static switch_status_t timer_init(switch_timer_t *timer) #define check_roll() if (private_info->roll < TIMER_MATRIX[timer->interval].roll) { \ private_info->roll++; \ - private_info->reference = (switch_size_t)(private_info->start = TIMER_MATRIX[timer->interval].tick); \ + private_info->reference = private_info->start = (switch_size_t)TIMER_MATRIX[timer->interval].tick; \ private_info->start--; /* Must have a diff */ \ } \ From 19272dc5e230fb3d7e8ede258028f00a6d71459d Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Fri, 12 Dec 2014 10:25:42 -0600 Subject: [PATCH 52/95] FS-7078: fix sip_header_as_string to properly null_terminate on larger header strings --- libs/sofia-sip/.update | 2 +- libs/sofia-sip/libsofia-sip-ua/sip/sip_util.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/libs/sofia-sip/.update b/libs/sofia-sip/.update index d3d7dac4b3..43989408cc 100644 --- a/libs/sofia-sip/.update +++ b/libs/sofia-sip/.update @@ -1 +1 @@ -Wed Nov 12 13:07:56 CST 2014 +Fri Dec 12 10:24:52 CST 2014 diff --git a/libs/sofia-sip/libsofia-sip-ua/sip/sip_util.c b/libs/sofia-sip/libsofia-sip-ua/sip/sip_util.c index a2880df520..555e8a151a 100644 --- a/libs/sofia-sip/libsofia-sip-ua/sip/sip_util.c +++ b/libs/sofia-sip/libsofia-sip-ua/sip/sip_util.c @@ -394,7 +394,7 @@ issize_t sip_header_field_e(char *b, isize_t bsiz, sip_header_t const *h, int fl char *sip_header_as_string(su_home_t *home, sip_header_t const *h) { ssize_t len; - char *rv, s[128]; + char *rv, s[256]; if (h == NULL) return NULL; @@ -412,6 +412,7 @@ char *sip_header_as_string(su_home_t *home, sip_header_t const *h) for (rv = su_alloc(home, len); rv; rv = su_realloc(home, rv, len)) { + memset(rv,0,len); ssize_t n = sip_header_field_e(rv, len, h, 0); if (n > -1 && n + 1 <= len) break; From e783999b51f406985c277fa61f4656969080c712 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 12 Dec 2014 14:55:14 -0600 Subject: [PATCH 53/95] some changes to webrtc to make it work with iDoubs in rtcweb profile mode --- src/include/switch_stun.h | 4 ++-- src/switch_rtp.c | 49 +++++++++++++++++++++++++++++++-------- src/switch_stun.c | 12 ++++++++++ 3 files changed, 53 insertions(+), 12 deletions(-) diff --git a/src/include/switch_stun.h b/src/include/switch_stun.h index 579c6f1bbd..eb4274457b 100644 --- a/src/include/switch_stun.h +++ b/src/include/switch_stun.h @@ -284,9 +284,9 @@ SWITCH_DECLARE(switch_status_t) switch_stun_lookup(char **ip, \return true or false depending on if there are any more attributes */ -#define switch_stun_packet_next_attribute(attribute, end) (attribute && (attribute = (switch_stun_packet_attribute_t *) (attribute->value + switch_stun_attribute_padded_length(attribute))) && ((void *)attribute < end) && attribute->type && ((void *)(attribute + switch_stun_attribute_padded_length(attribute)) < end)) +#define switch_stun_packet_next_attribute(attribute, end) (attribute && (attribute = (switch_stun_packet_attribute_t *) (attribute->value + switch_stun_attribute_padded_length(attribute))) && ((void *)attribute < end) && attribute->type && (((switch_byte_t *)attribute + switch_stun_attribute_padded_length(attribute)) < (switch_byte_t *)end)) -#define switch_stun_packet_next_attribute_hbo(attribute, end) (attribute && (attribute = (switch_stun_packet_attribute_t *) (attribute->value + switch_stun_attribute_padded_length_hbo(attribute))) && ((void *)attribute < end) && attribute->type && ((void *)(attribute + switch_stun_attribute_padded_length_hbo(attribute)) < end)) +#define switch_stun_packet_next_attribute_hbo(attribute, end) (attribute && (attribute = (switch_stun_packet_attribute_t *) (attribute->value + switch_stun_attribute_padded_length_hbo(attribute))) && ((void *)attribute < end) && attribute->type && (((switch_byte_t *)attribute + switch_stun_attribute_padded_length_hbo(attribute)) < (switch_byte_t *)end)) /*! \brief Obtain the correct length in bytes of a stun packet diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 3b17b6ae3b..d068e960ee 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -221,6 +221,7 @@ struct switch_rtp_rfc2833_data { typedef struct { char *ice_user; char *user_ice; + char *luser_ice; char *pass; char *rpass; switch_sockaddr_t *addr; @@ -233,7 +234,7 @@ typedef struct { uint8_t ready; uint8_t rready; int missed_count; - char last_sent_id[12]; + char last_sent_id[13]; } switch_rtp_ice_t; struct switch_rtp; @@ -776,6 +777,14 @@ static switch_status_t ice_out(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice) return status; } +int icecmp(const char *them, switch_rtp_ice_t *ice) +{ + if (strchr(them, ':')) { + return strcmp(them, ice->user_ice); + } + + return strcmp(them, ice->luser_ice); +} static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *data, switch_size_t len) { @@ -827,9 +836,18 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d rtp_session->last_stun = switch_micro_time_now(); switch_stun_packet_first_attribute(packet, attr); - + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG1, "STUN PACKET TYPE: %s\n", + switch_stun_value_to_name(SWITCH_STUN_TYPE_PACKET_TYPE, packet->header.type)); do { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG1, "|---: STUN ATTR %s\n", + switch_stun_value_to_name(SWITCH_STUN_TYPE_ATTRIBUTE, attr->type)); + switch (attr->type) { + case SWITCH_STUN_ATTR_USE_CAND: + { + ice->rready = 1; + } + break; case SWITCH_STUN_ATTR_ERROR_CODE: { switch_stun_error_code_t *err = (switch_stun_error_code_t *) attr->value; @@ -859,18 +877,23 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d char ip[16]; uint16_t port; switch_stun_packet_attribute_get_mapped_address(attr, ip, &port); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG1, "|------: %s:%d\n", ip, port); } break; case SWITCH_STUN_ATTR_USERNAME: if (attr->type) { switch_stun_packet_attribute_get_username(attr, username, sizeof(username)); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG1, "|------: %s\n", username); } break; case SWITCH_STUN_ATTR_PRIORITY: { + uint32_t priority = 0; pri = (uint32_t *) attr->value; - ok = *pri == ice->ice_params->cands[ice->ice_params->chosen[ice->proto]][ice->proto].priority; + priority = ntohl(*pri); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG1, "|------: %u\n", priority); + ok = priority == ice->ice_params->cands[ice->ice_params->chosen[ice->proto]][ice->proto].priority; } break; } @@ -878,18 +901,21 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d if (!switch_stun_packet_next_attribute(attr, end_buf)) { break; } + xlen += 4 + switch_stun_attribute_padded_length(attr); } while (xlen <= packet->header.length); if ((ice->type & ICE_GOOGLE_JINGLE) && ok) { ok = !strcmp(ice->user_ice, username); } + + if (packet->header.type != SWITCH_STUN_BINDING_REQUEST && packet->header.type != SWITCH_STUN_BINDING_RESPONSE) { + goto end; + } if ((ice->type & ICE_VANILLA)) { char foo1[13] = "", foo2[13] = ""; - if (!ok) ok = !strncmp(packet->header.id, ice->last_sent_id, 12); - - + if (!ok) ok = !memcmp(packet->header.id, ice->last_sent_id, 12); if (packet->header.type == SWITCH_STUN_BINDING_RESPONSE) { ok = 1; @@ -905,8 +931,8 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d } } - strncpy(foo1, packet->header.id, 12); - strncpy(foo2, ice->last_sent_id, 12); + memcpy(foo1, packet->header.id, 12); + memcpy(foo2, ice->last_sent_id, 12); if (!ok && ice == &rtp_session->ice && rtp_session->rtcp_ice.ice_params && pri && *pri == rtp_session->rtcp_ice.ice_params->cands[rtp_session->rtcp_ice.ice_params->chosen[1]][1].priority) { @@ -915,9 +941,9 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d } if (!zstr(username)) { - if (!strcmp(username, ice->user_ice)) { + if (!icecmp(username, ice)) { ok = 1; - } else if(!zstr(rtp_session->rtcp_ice.user_ice) && !strcmp(username, rtp_session->rtcp_ice.user_ice)) { + } else if(!zstr(rtp_session->rtcp_ice.user_ice) && !icecmp(username, &rtp_session->rtcp_ice)) { ice = &rtp_session->rtcp_ice; ok = 1; } @@ -3905,6 +3931,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_activate_ice(switch_rtp_t *rtp_sessio { char ice_user[80]; char user_ice[80]; + char luser_ice[80]; switch_rtp_ice_t *ice; char *host = NULL; switch_port_t port = 0; @@ -3922,6 +3949,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_activate_ice(switch_rtp_t *rtp_sessio if ((type & ICE_VANILLA)) { switch_snprintf(ice_user, sizeof(ice_user), "%s:%s", login, rlogin); switch_snprintf(user_ice, sizeof(user_ice), "%s:%s", rlogin, login); + switch_snprintf(luser_ice, sizeof(user_ice), "%s%s", rlogin, login); ice->ready = ice->rready = 0; } else { switch_snprintf(ice_user, sizeof(ice_user), "%s%s", login, rlogin); @@ -3931,6 +3959,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_activate_ice(switch_rtp_t *rtp_sessio ice->ice_user = switch_core_strdup(rtp_session->pool, ice_user); ice->user_ice = switch_core_strdup(rtp_session->pool, user_ice); + ice->luser_ice = switch_core_strdup(rtp_session->pool, luser_ice); ice->type = type; ice->ice_params = ice_params; ice->pass = ""; diff --git a/src/switch_stun.c b/src/switch_stun.c index b29c48d325..1dd35d9bc5 100644 --- a/src/switch_stun.c +++ b/src/switch_stun.c @@ -79,6 +79,17 @@ static const struct value_mapping ATTR_TYPES[] = { {SWITCH_STUN_ATTR_SOURCE_ADDRESS2, "SOURCE_ADDRESS2"}, {SWITCH_STUN_ATTR_DATA, "DATA"}, {SWITCH_STUN_ATTR_OPTIONS, "OPTIONS"}, + {SWITCH_STUN_ATTR_PRIORITY, "PRIORITY"}, + {SWITCH_STUN_ATTR_USE_CAND, "USE_CAND"}, + {SWITCH_STUN_ATTR_PADDING, "PADDING"}, + {SWITCH_STUN_ATTR_RESP_PORT, "RESP_PORT"}, + {SWITCH_STUN_ATTR_SOFTWARE, "SOFTWARE"}, + {SWITCH_STUN_ATTR_ALT_SERVER, "ALT_SERVER"}, + {SWITCH_STUN_ATTR_FINGERPRINT, "FINGERPRINT"}, + {SWITCH_STUN_ATTR_CONTROLLED, "CONTROLLED"}, + {SWITCH_STUN_ATTR_CONTROLLING, "CONTROLLING"}, + {SWITCH_STUN_ATTR_RESP_ORIGIN, "RESP_ORIGIN"}, + {SWITCH_STUN_ATTR_OTHER_ADDR, "OTHER_ADDR"}, {0, 0} }; @@ -263,6 +274,7 @@ SWITCH_DECLARE(switch_stun_packet_t *) switch_stun_packet_parse(uint8_t *buf, ui } break; + case SWITCH_STUN_ATTR_SOFTWARE: case SWITCH_STUN_ATTR_USERNAME: /* ByteString, multiple of 4 bytes */ case SWITCH_STUN_ATTR_PASSWORD: /* ByteString, multiple of 4 bytes */ case SWITCH_STUN_ATTR_DATA: /* ByteString */ From d189e983c899241db0ff086aafebb61e6633715e Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 12 Dec 2014 17:51:34 -0600 Subject: [PATCH 54/95] allow 10ms jb --- src/switch_core_media.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/switch_core_media.c b/src/switch_core_media.c index 8e00b72e2b..d4434a2687 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -1693,9 +1693,9 @@ static void check_jb(switch_core_session_t *session, const char *input) maxlen = (a_engine->read_codec.implementation->microseconds_per_packet / 1000) * abs(maxlen); } - if (jb_msec < 20 || jb_msec > 10000) { + if (jb_msec < 10 || jb_msec > 10000) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, - "Invalid Jitterbuffer spec [%d] must be between 20 and 10000\n", jb_msec); + "Invalid Jitterbuffer spec [%d] must be between 10 and 10000\n", jb_msec); } else { int qlen, maxqlen = 10; From e268a72603ea17d65e379f2234dc198ce37a5a95 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 12 Dec 2014 17:52:02 -0600 Subject: [PATCH 55/95] FS-6994 #resolve --- src/mod/codecs/mod_opus/mod_opus.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/mod/codecs/mod_opus/mod_opus.c b/src/mod/codecs/mod_opus/mod_opus.c index dc51a653f1..18d900a702 100644 --- a/src/mod/codecs/mod_opus/mod_opus.c +++ b/src/mod/codecs/mod_opus/mod_opus.c @@ -402,15 +402,20 @@ static switch_status_t switch_opus_decode(switch_codec_t *codec, { struct opus_context *context = codec->private_info; int samples = 0; - + uint32_t frame_size; + uint32_t frame_samples; + if (!context) { return SWITCH_STATUS_FALSE; } + + frame_samples = *decoded_data_len / 2 / codec->implementation->number_of_channels; + frame_size = frame_samples - (frame_samples % (codec->implementation->actual_samples_per_second / 400)); - samples = opus_decode(context->decoder_object, (*flag & SFF_PLC) ? NULL : encoded_data, encoded_data_len, decoded_data, *decoded_data_len, 0); + samples = opus_decode(context->decoder_object, (*flag & SFF_PLC) ? NULL : encoded_data, encoded_data_len, decoded_data, frame_size, !!(*flag & SFF_PLC)); if (samples < 0) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Decoder Error: %s!\n", opus_strerror(samples)); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Decoder Error: %s fs:%u plc:%d!\n", opus_strerror(samples), frame_size, !!(*flag & SFF_PLC)); return SWITCH_STATUS_GENERR; } From 6dbb4162e81893748a226dc5d4631ebf8f4c7c76 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Sat, 13 Dec 2014 00:57:14 -0600 Subject: [PATCH 56/95] FS-7086 FS-6798 #resolve --- src/switch_core_media.c | 76 ++++++++++++++++++++++++++++++++--------- 1 file changed, 59 insertions(+), 17 deletions(-) diff --git a/src/switch_core_media.c b/src/switch_core_media.c index d4434a2687..6df4387b60 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -7363,6 +7363,7 @@ SWITCH_DECLARE(void) switch_core_media_patch_sdp(switch_core_session_t *session) int bad = 0; switch_media_handle_t *smh; switch_rtp_engine_t *a_engine, *v_engine; + payload_map_t *pmap; switch_assert(session); @@ -7393,10 +7394,22 @@ SWITCH_DECLARE(void) switch_core_media_patch_sdp(switch_core_session_t *session) switch_channel_get_name(session->channel)); return; } - a_engine->cur_payload_map->iananame = switch_core_session_strdup(session, "PROXY"); - a_engine->cur_payload_map->rm_rate = 8000; - a_engine->cur_payload_map->adv_rm_rate = 8000; - a_engine->cur_payload_map->codec_ms = 20; + + clear_pmaps(a_engine); + + pmap = switch_core_media_add_payload_map(session, + SWITCH_MEDIA_TYPE_AUDIO, + "PROXY", + NULL, + SDP_TYPE_RESPONSE, + 0, + 8000, + 8000, + 1, + SWITCH_TRUE); + + a_engine->cur_payload_map = pmap; + } new_sdp = switch_core_session_alloc(session, len); @@ -7539,10 +7552,19 @@ SWITCH_DECLARE(void) switch_core_media_patch_sdp(switch_core_session_t *session) } else if (!strncmp("m=video ", p, 8) && *(p + 8) != '0') { if (!has_video) { switch_core_media_choose_port(session, SWITCH_MEDIA_TYPE_VIDEO, 1); - v_engine->cur_payload_map->rm_encoding = "PROXY-VID"; - v_engine->cur_payload_map->rm_rate = 90000; - v_engine->cur_payload_map->adv_rm_rate = 90000; - v_engine->cur_payload_map->codec_ms = 0; + clear_pmaps(v_engine); + pmap = switch_core_media_add_payload_map(session, + SWITCH_MEDIA_TYPE_AUDIO, + "PROXY-VID", + NULL, + SDP_TYPE_RESPONSE, + 0, + 90000, + 90000, + 1, + SWITCH_TRUE); + v_engine->cur_payload_map = pmap; + switch_snprintf(vport_buf, sizeof(vport_buf), "%u", v_engine->adv_sdp_port); if (switch_channel_media_ready(session->channel) && !switch_rtp_ready(v_engine->rtp_session)) { switch_channel_set_flag(session->channel, CF_VIDEO_POSSIBLE); @@ -8630,6 +8652,7 @@ SWITCH_DECLARE(void) switch_core_media_check_outgoing_proxy(switch_core_session_ switch_rtp_engine_t *a_engine, *v_engine; switch_media_handle_t *smh; const char *r_sdp = NULL; + payload_map_t *pmap; switch_assert(session); @@ -8647,19 +8670,38 @@ SWITCH_DECLARE(void) switch_core_media_check_outgoing_proxy(switch_core_session_ v_engine = &smh->engines[SWITCH_MEDIA_TYPE_VIDEO]; switch_channel_set_flag(session->channel, CF_PROXY_MEDIA); - - a_engine->cur_payload_map->iananame = switch_core_session_strdup(session, "PROXY"); - a_engine->cur_payload_map->rm_rate = 8000; - a_engine->cur_payload_map->adv_rm_rate = 8000; - a_engine->cur_payload_map->codec_ms = 20; + clear_pmaps(a_engine); + clear_pmaps(v_engine); + pmap = switch_core_media_add_payload_map(session, + SWITCH_MEDIA_TYPE_AUDIO, + "PROXY", + NULL, + SDP_TYPE_RESPONSE, + 0, + 8000, + 8000, + 1, + SWITCH_TRUE); + + a_engine->cur_payload_map = pmap; + if (switch_stristr("m=video", r_sdp)) { switch_core_media_choose_port(session, SWITCH_MEDIA_TYPE_VIDEO, 1); - v_engine->cur_payload_map->rm_encoding = "PROXY-VID"; - v_engine->cur_payload_map->rm_rate = 90000; - v_engine->cur_payload_map->adv_rm_rate = 90000; - v_engine->cur_payload_map->codec_ms = 0; + pmap = switch_core_media_add_payload_map(session, + SWITCH_MEDIA_TYPE_AUDIO, + "PROXY-VID", + NULL, + SDP_TYPE_RESPONSE, + 0, + 90000, + 90000, + 1, + SWITCH_TRUE); + + v_engine->cur_payload_map = pmap; + switch_channel_set_flag(session->channel, CF_VIDEO); switch_channel_set_flag(session->channel, CF_VIDEO_POSSIBLE); } From 42acb62120cbff3d03c7920068437e39b810bc1e Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Fri, 5 Dec 2014 19:16:13 -0500 Subject: [PATCH 57/95] Improve mod_bert cpu efficiency * Use memmem() and memcmp() for pattern checks * Use a static pre-built buffer for the write frame --- src/mod/applications/mod_bert/mod_bert.c | 191 ++++++++++++----------- 1 file changed, 101 insertions(+), 90 deletions(-) diff --git a/src/mod/applications/mod_bert/mod_bert.c b/src/mod/applications/mod_bert/mod_bert.c index 0988ffdbb9..72f4055e70 100644 --- a/src/mod/applications/mod_bert/mod_bert.c +++ b/src/mod/applications/mod_bert/mod_bert.c @@ -61,15 +61,6 @@ typedef struct { switch_timer_t timer; } bert_t; -#define bert_increase_milliwatt_index(index) \ - do { \ - if ((index) == (switch_arraylen(ulaw_digital_milliwatt)-1)) { \ - (index) = 0; \ - } else { \ - (index) = ((index) + 1); \ - } \ - } while (0); - #define bert_close_debug_streams(bert, session) \ do { \ int rc = 0; \ @@ -113,12 +104,11 @@ SWITCH_STANDARD_APP(bert_test_function) int32_t interval = 20; int32_t samples = 0; uint8_t *write_samples = NULL; - uint8_t *read_samples = NULL; + uint8_t *m = NULL; const char *timer_name = NULL; + switch_bool_t clean_frame = SWITCH_FALSE; bert_t bert = { 0 }; - memset(&bert, 0, sizeof(bert)); - channel = switch_core_session_get_channel(session); switch_channel_answer(channel); @@ -204,6 +194,21 @@ SWITCH_STANDARD_APP(bert_test_function) switch_channel_set_variable(channel, BERT_STATS_VAR_SYNC_LOST_CNT, "0"); switch_channel_set_variable(channel, BERT_STATS_VAR_SYNC_LOST, "false"); write_samples = write_frame.data; + + /* Prepare the buffer we'll keep sending over and over */ + for (i = 0; i < read_impl.samples_per_packet; i += sizeof(ulaw_digital_milliwatt)) { + memcpy(&write_samples[i], ulaw_digital_milliwatt, sizeof(ulaw_digital_milliwatt)); + } + + write_frame.datalen = read_impl.encoded_bytes_per_packet; + write_frame.samples = read_impl.samples_per_packet; + + if (timer_name) { + write_frame.timestamp = bert.timer.samplecount; + } else { + /* the playback() app does not set write_frame.timestamp unless a timer is used, what's the catch? does it matter? */ + } + for (;;) { if (!switch_channel_ready(channel)) { @@ -219,23 +224,6 @@ SWITCH_STANDARD_APP(bert_test_function) } } - /* Write our frame before anything else happens */ - for (i = 0; i < read_impl.samples_per_packet; i++) { - /* Calculate our next sequence sample to write */ - bert.sequence_sample = ulaw_digital_milliwatt[bert.milliwatt_index]; - //switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "[%d] 0x%X\n", bert.milliwatt_index, bert.sequence_sample); - bert_increase_milliwatt_index(bert.milliwatt_index); - //switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "[%d] 0x%X\n", bert.milliwatt_index, bert.sequence_sample); - write_samples[i] = bert.sequence_sample; - } - - write_frame.datalen = read_impl.samples_per_packet; - write_frame.samples = read_impl.samples_per_packet; - if (timer_name) { - write_frame.timestamp = bert.timer.samplecount; - } else { - /* playback() does not set write_frame.timestamp unless a timer is used, what's the catch? */ - } if (bert.output_debug_f) { fwrite(write_frame.data, write_frame.datalen, 1, bert.output_debug_f); } @@ -244,8 +232,10 @@ SWITCH_STANDARD_APP(bert_test_function) break; } - /* Proceed to read and process the read frame ... - * Note core_session_read_frame is a blocking operation, we should probably do reathing in another thread like playback() does using switch_core_service_session() */ + /* Proceed to read and process the received frame ... + * Note that switch_core_session_read_frame is a blocking operation, we could do reathing in another thread like the playback() app + * does using switch_core_service_session() but OTOH that would lead to more load/cpu usage, extra threads being launched per call leg + * and most likely reduce the overall capacity of the test system */ status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0); if (!SWITCH_READ_ACCEPTABLE(status)) { break; @@ -276,11 +266,10 @@ SWITCH_STANDARD_APP(bert_test_function) } if (read_frame->samples != read_impl.samples_per_packet || !read_frame->datalen) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Read %d samples, expected %d!\n", read_frame->samples, read_impl.samples_per_packet); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Read %d samples, expected %d!\n", read_frame->samples, read_impl.samples_per_packet); continue; } - read_samples = read_frame->data; if (bert.input_debug_f) { size_t ret = fwrite(read_frame->data, read_frame->datalen, 1, bert.input_debug_f); if (ret != 1) { @@ -288,70 +277,92 @@ SWITCH_STANDARD_APP(bert_test_function) } } - /* BERT Sync Loop */ - for (i = 0; i < read_frame->samples; i++) { - if (bert.window_samples == bert.processed_samples) { - float err = 0.0; - /* If the channel is going down, then it is expected we'll have errors, ignore them and bail out */ - if (!switch_channel_ready(channel)) { - bert_close_debug_streams(bert, session); - break; - } - /* Calculate error rate */ - err = ((float)((float)bert.err_samples / (float)bert.processed_samples) * 100.0); - if (err > bert.max_err) { - if (bert.in_sync) { - bert.in_sync = 0; - bert.stats_sync_lost_cnt++; - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "BERT Sync Lost: %f%% loss (count=%u, cng_count=%d, err_samples=%u, session=%s)\n", - err, bert.stats_sync_lost_cnt, bert.stats_cng_cnt, bert.err_samples, switch_core_session_get_uuid(session)); - switch_channel_set_variable_printf(channel, BERT_STATS_VAR_SYNC_LOST_CNT, "%u", bert.stats_sync_lost_cnt); - switch_channel_set_variable(channel, BERT_STATS_VAR_SYNC_LOST, "true"); - if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, BERT_EVENT_LOST_SYNC) == SWITCH_STATUS_SUCCESS) { - switch_channel_event_set_basic_data(channel, event); - switch_event_fire(&event); - } - if (bert.hangup_on_error) { - switch_channel_hangup(channel, SWITCH_CAUSE_MEDIA_TIMEOUT); - bert_close_debug_streams(bert, session); - } - } - } else if (!bert.in_sync) { - bert.in_sync = 1; - synced = 1; - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "BERT Sync Success\n"); - bert.stats_cng_cnt = 0; - bert.timeout = 0; - if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, BERT_EVENT_IN_SYNC) == SWITCH_STATUS_SUCCESS) { + if (bert.window_samples == bert.processed_samples) { + /* BERT err rate calculation */ + float err = 0.0; + /* If the channel is going down, then it is expected we'll have errors, ignore them and bail out */ + if (!switch_channel_ready(channel)) { + bert_close_debug_streams(bert, session); + break; + } + /* Calculate error rate */ + err = ((float)((float)bert.err_samples / (float)bert.processed_samples) * 100.0); + if (err > bert.max_err) { + if (bert.in_sync) { + bert.in_sync = 0; + bert.stats_sync_lost_cnt++; + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "BERT Sync Lost: %f%% loss (count=%u, cng_count=%d, err_samples=%u, session=%s)\n", + err, bert.stats_sync_lost_cnt, bert.stats_cng_cnt, bert.err_samples, switch_core_session_get_uuid(session)); + switch_channel_set_variable_printf(channel, BERT_STATS_VAR_SYNC_LOST_CNT, "%u", bert.stats_sync_lost_cnt); + switch_channel_set_variable(channel, BERT_STATS_VAR_SYNC_LOST, "true"); + if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, BERT_EVENT_LOST_SYNC) == SWITCH_STATUS_SUCCESS) { switch_channel_event_set_basic_data(channel, event); switch_event_fire(&event); } + if (bert.hangup_on_error) { + switch_channel_hangup(channel, SWITCH_CAUSE_MEDIA_TIMEOUT); + bert_close_debug_streams(bert, session); + } } - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG10, "Err=%f%% (%u/%u)\n", err, bert.err_samples, bert.processed_samples); - if (synced && err > bert.max_err_hit) { - bert.max_err_hit = err; - } - if (err > bert.max_err_ever) { - bert.max_err_ever = err; - } - bert.processed_samples = 0; - bert.err_samples = 0; - } - - if (bert.predicted_sample != read_samples[i]) { - bert.err_samples++; - if (!bert.in_sync) { - /* If we're not in sync, we must reset the index on error to start the pattern detection again */ - bert.milliwatt_prediction_index = 0; + } else if (!bert.in_sync) { + bert.in_sync = 1; + synced = 1; + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "BERT Sync Success\n"); + bert.stats_cng_cnt = 0; + bert.timeout = 0; + if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, BERT_EVENT_IN_SYNC) == SWITCH_STATUS_SUCCESS) { + switch_channel_event_set_basic_data(channel, event); + switch_event_fire(&event); } } - - /* Try to guess what the next sample will be in the milliwatt sequence */ - bert.predicted_sample = ulaw_digital_milliwatt[bert.milliwatt_prediction_index]; - bert_increase_milliwatt_index(bert.milliwatt_prediction_index); - - bert.processed_samples++; + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG10, "Err=%f%% (%u/%u)\n", err, bert.err_samples, bert.processed_samples); + if (synced && err > bert.max_err_hit) { + bert.max_err_hit = err; + } + if (err > bert.max_err_ever) { + bert.max_err_ever = err; + } + bert.processed_samples = 0; + bert.err_samples = 0; } + + if ((bert.in_sync || clean_frame) && + !memcmp(read_frame->data, write_frame.data, read_frame->datalen)) { + goto sync_check_done; + } + + /* We're not in sync, or we might be going out of sync, find the start of the pattern ... */ + m = memmem(read_frame->data, read_frame->datalen, ulaw_digital_milliwatt, sizeof(ulaw_digital_milliwatt)); + if (m) { + /* At least some bytes matched, let's find out the err sample count (could be zero if we're lucky and the whole frame matches) */ + uint8_t *end = NULL; + size_t left = 0; + int cerrs = bert.err_samples; + /* Pattern found at least once in the frame, let's check if the rest of the frame also matches */ + m += sizeof(ulaw_digital_milliwatt); + end = (uint8_t *)read_frame->data + read_frame->datalen; + left = (size_t)(end - m); + if (left && !memcmp(m, write_frame.data, left)) { + bert.err_samples += (m - (uint8_t *)read_frame->data - sizeof(ulaw_digital_milliwatt)); + } else if (left) { + int s = 0; + bert.err_samples += (m - (uint8_t *)read_frame->data - sizeof(ulaw_digital_milliwatt)); + /* count error samples */ + for (s = 0; m != end; m++, s++) { + if (ulaw_digital_milliwatt[s%8] != *m) { + bert.err_samples++; + } + } + } + clean_frame = (cerrs == bert.err_samples) ? SWITCH_TRUE : SWITCH_FALSE; + } else { + /* the patter was not found in the whole frame, then the whole frame is out of sync */ + bert.err_samples += read_frame->samples; + clean_frame = SWITCH_FALSE; + } + +sync_check_done: + bert.processed_samples += read_frame->samples; } done: From 17574a88e4ad32dc812e42f453e4c719526d0a4f Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Thu, 11 Dec 2014 17:50:30 -0500 Subject: [PATCH 58/95] Add bert stats to mod_bert::lost_sync event The following values can be read from the event: sync_lost_percent - Error percentage within the analysis window sync_lost_count - How many times sync has been lost cng_count - Counter of confort noise packets err_samples - Number of samples that did not match the sequence --- src/mod/applications/mod_bert/mod_bert.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/mod/applications/mod_bert/mod_bert.c b/src/mod/applications/mod_bert/mod_bert.c index 72f4055e70..a1adb2dd9d 100644 --- a/src/mod/applications/mod_bert/mod_bert.c +++ b/src/mod/applications/mod_bert/mod_bert.c @@ -297,6 +297,10 @@ SWITCH_STANDARD_APP(bert_test_function) switch_channel_set_variable(channel, BERT_STATS_VAR_SYNC_LOST, "true"); if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, BERT_EVENT_LOST_SYNC) == SWITCH_STATUS_SUCCESS) { switch_channel_event_set_basic_data(channel, event); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "sync_lost_percent", "%f", err); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "sync_lost_count", "%u", bert.stats_sync_lost_cnt); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "cng_count", "%u", bert.stats_cng_cnt); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "err_samples", "%u", bert.err_samples); switch_event_fire(&event); } if (bert.hangup_on_error) { From 357ffad817774e705fc673ca92391f92f2b559be Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Mon, 15 Dec 2014 13:37:07 -0600 Subject: [PATCH 59/95] fix windows build error --- libs/sofia-sip/libsofia-sip-ua/sip/sip_util.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libs/sofia-sip/libsofia-sip-ua/sip/sip_util.c b/libs/sofia-sip/libsofia-sip-ua/sip/sip_util.c index 555e8a151a..051ba5ae39 100644 --- a/libs/sofia-sip/libsofia-sip-ua/sip/sip_util.c +++ b/libs/sofia-sip/libsofia-sip-ua/sip/sip_util.c @@ -395,6 +395,7 @@ char *sip_header_as_string(su_home_t *home, sip_header_t const *h) { ssize_t len; char *rv, s[256]; + ssize_t n; if (h == NULL) return NULL; @@ -413,7 +414,7 @@ char *sip_header_as_string(su_home_t *home, sip_header_t const *h) rv; rv = su_realloc(home, rv, len)) { memset(rv,0,len); - ssize_t n = sip_header_field_e(rv, len, h, 0); + n = sip_header_field_e(rv, len, h, 0); if (n > -1 && n + 1 <= len) break; if (n > -1) /* glibc >2.1 */ From a26e29c64714667dc02d2dbc8eab01abc112ea19 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Mon, 15 Dec 2014 14:18:01 -0600 Subject: [PATCH 60/95] vs2010 support for recent unimrcp changes --- .../libs/apr-toolkit/aprtoolkit.2010.vcxproj | 16 +++++----- libs/unimrcp/libs/mpf/mpf.2010.vcxproj | 16 +++++----- .../libs/mrcp-client/mrcpclient.2010.vcxproj | 16 +++++----- .../mrcp-signaling/mrcpsignaling.2010.vcxproj | 16 +++++----- libs/unimrcp/libs/mrcp/mrcp.2010.vcxproj | 16 +++++----- .../mrcpv2transport.2010.vcxproj | 16 +++++----- .../libs/uni-rtsp/unirtsp.2010.vcxproj | 16 +++++----- .../mrcp-sofiasip/mrcpsofiasip.2010.vcxproj | 32 +++++++++---------- .../mrcp-unirtsp/mrcpunirtsp.2010.vcxproj | 32 +++++++++---------- 9 files changed, 88 insertions(+), 88 deletions(-) diff --git a/libs/unimrcp/libs/apr-toolkit/aprtoolkit.2010.vcxproj b/libs/unimrcp/libs/apr-toolkit/aprtoolkit.2010.vcxproj index adb6133854..d66ffc33b9 100644 --- a/libs/unimrcp/libs/apr-toolkit/aprtoolkit.2010.vcxproj +++ b/libs/unimrcp/libs/apr-toolkit/aprtoolkit.2010.vcxproj @@ -48,23 +48,23 @@ - - + + - - + + - - + + - - + + diff --git a/libs/unimrcp/libs/mpf/mpf.2010.vcxproj b/libs/unimrcp/libs/mpf/mpf.2010.vcxproj index 1cde1ffe65..96b83f60b6 100644 --- a/libs/unimrcp/libs/mpf/mpf.2010.vcxproj +++ b/libs/unimrcp/libs/mpf/mpf.2010.vcxproj @@ -48,23 +48,23 @@ - - + + - - + + - - + + - - + + diff --git a/libs/unimrcp/libs/mrcp-client/mrcpclient.2010.vcxproj b/libs/unimrcp/libs/mrcp-client/mrcpclient.2010.vcxproj index 630ae4c4fc..10dd48ae4c 100644 --- a/libs/unimrcp/libs/mrcp-client/mrcpclient.2010.vcxproj +++ b/libs/unimrcp/libs/mrcp-client/mrcpclient.2010.vcxproj @@ -48,23 +48,23 @@ - - + + - - + + - - + + - - + + diff --git a/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.2010.vcxproj b/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.2010.vcxproj index 96db7443fa..80fe748e0d 100644 --- a/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.2010.vcxproj +++ b/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.2010.vcxproj @@ -48,23 +48,23 @@ - - + + - - + + - - + + - - + + diff --git a/libs/unimrcp/libs/mrcp/mrcp.2010.vcxproj b/libs/unimrcp/libs/mrcp/mrcp.2010.vcxproj index 4f8141856c..928b9cd5f2 100644 --- a/libs/unimrcp/libs/mrcp/mrcp.2010.vcxproj +++ b/libs/unimrcp/libs/mrcp/mrcp.2010.vcxproj @@ -48,23 +48,23 @@ - - + + - - + + - - + + - - + + diff --git a/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2010.vcxproj b/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2010.vcxproj index d4baebf6d0..11c03f4178 100644 --- a/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2010.vcxproj +++ b/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2010.vcxproj @@ -48,23 +48,23 @@ - - + + - - + + - - + + - - + + diff --git a/libs/unimrcp/libs/uni-rtsp/unirtsp.2010.vcxproj b/libs/unimrcp/libs/uni-rtsp/unirtsp.2010.vcxproj index 7ec0a225f0..bc29e2968d 100644 --- a/libs/unimrcp/libs/uni-rtsp/unirtsp.2010.vcxproj +++ b/libs/unimrcp/libs/uni-rtsp/unirtsp.2010.vcxproj @@ -48,23 +48,23 @@ - - + + - - + + - - + + - - + + diff --git a/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2010.vcxproj b/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2010.vcxproj index ba5452532c..127caa3133 100644 --- a/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2010.vcxproj +++ b/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2010.vcxproj @@ -48,31 +48,31 @@ - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + diff --git a/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.2010.vcxproj b/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.2010.vcxproj index a60be5bc38..4b15fcbe33 100644 --- a/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.2010.vcxproj +++ b/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.2010.vcxproj @@ -48,31 +48,31 @@ - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + From 4d45e1969170fbf6cc29740c693d7d28baaecacb Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Mon, 15 Dec 2014 15:18:44 -0600 Subject: [PATCH 61/95] vs2010 support for recent unimrcp changes --- libs/unimrcp/libs/apr-toolkit/aprtoolkit.2010.vcxproj | 4 ++-- libs/unimrcp/libs/mrcp-client/mrcpclient.2010.vcxproj | 4 ++-- libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.2010.vcxproj | 4 ++-- libs/unimrcp/libs/mrcp/mrcp.2010.vcxproj | 4 ++-- .../libs/mrcpv2-transport/mrcpv2transport.2010.vcxproj | 4 ++-- libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.vcxproj | 4 ++-- libs/unimrcp/libs/uni-rtsp/unirtsp.2010.vcxproj | 4 ++-- libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2010.vcxproj | 4 ++-- libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.2010.vcxproj | 4 ++-- libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.vcxproj | 4 ++-- 10 files changed, 20 insertions(+), 20 deletions(-) diff --git a/libs/unimrcp/libs/apr-toolkit/aprtoolkit.2010.vcxproj b/libs/unimrcp/libs/apr-toolkit/aprtoolkit.2010.vcxproj index d66ffc33b9..83897bf2af 100644 --- a/libs/unimrcp/libs/apr-toolkit/aprtoolkit.2010.vcxproj +++ b/libs/unimrcp/libs/apr-toolkit/aprtoolkit.2010.vcxproj @@ -53,7 +53,7 @@ - + @@ -63,7 +63,7 @@ - + diff --git a/libs/unimrcp/libs/mrcp-client/mrcpclient.2010.vcxproj b/libs/unimrcp/libs/mrcp-client/mrcpclient.2010.vcxproj index 10dd48ae4c..9d0f176757 100644 --- a/libs/unimrcp/libs/mrcp-client/mrcpclient.2010.vcxproj +++ b/libs/unimrcp/libs/mrcp-client/mrcpclient.2010.vcxproj @@ -53,7 +53,7 @@ - + @@ -63,7 +63,7 @@ - + diff --git a/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.2010.vcxproj b/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.2010.vcxproj index 80fe748e0d..8462a4792b 100644 --- a/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.2010.vcxproj +++ b/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.2010.vcxproj @@ -53,7 +53,7 @@ - + @@ -63,7 +63,7 @@ - + diff --git a/libs/unimrcp/libs/mrcp/mrcp.2010.vcxproj b/libs/unimrcp/libs/mrcp/mrcp.2010.vcxproj index 928b9cd5f2..257a4ba790 100644 --- a/libs/unimrcp/libs/mrcp/mrcp.2010.vcxproj +++ b/libs/unimrcp/libs/mrcp/mrcp.2010.vcxproj @@ -53,7 +53,7 @@ - + @@ -63,7 +63,7 @@ - + diff --git a/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2010.vcxproj b/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2010.vcxproj index 11c03f4178..d9e4961af1 100644 --- a/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2010.vcxproj +++ b/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2010.vcxproj @@ -53,7 +53,7 @@ - + @@ -63,7 +63,7 @@ - + diff --git a/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.vcxproj b/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.vcxproj index 25e83af762..4d99d355c3 100644 --- a/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.vcxproj +++ b/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.vcxproj @@ -53,7 +53,7 @@ - + @@ -65,7 +65,7 @@ - + diff --git a/libs/unimrcp/libs/uni-rtsp/unirtsp.2010.vcxproj b/libs/unimrcp/libs/uni-rtsp/unirtsp.2010.vcxproj index bc29e2968d..24a6dc016e 100644 --- a/libs/unimrcp/libs/uni-rtsp/unirtsp.2010.vcxproj +++ b/libs/unimrcp/libs/uni-rtsp/unirtsp.2010.vcxproj @@ -53,7 +53,7 @@ - + @@ -63,7 +63,7 @@ - + diff --git a/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2010.vcxproj b/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2010.vcxproj index 127caa3133..242c737224 100644 --- a/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2010.vcxproj +++ b/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2010.vcxproj @@ -55,7 +55,7 @@ - + @@ -69,7 +69,7 @@ - + diff --git a/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.2010.vcxproj b/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.2010.vcxproj index 4b15fcbe33..7f162bffba 100644 --- a/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.2010.vcxproj +++ b/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.2010.vcxproj @@ -55,7 +55,7 @@ - + @@ -69,7 +69,7 @@ - + diff --git a/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.vcxproj b/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.vcxproj index 5e08915fe4..200d68b92b 100644 --- a/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.vcxproj +++ b/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.vcxproj @@ -55,7 +55,7 @@ - + @@ -71,7 +71,7 @@ - + From 0b414a8de8479a2136f001bdb8387e9af45d8a3e Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Mon, 15 Dec 2014 16:47:14 -0600 Subject: [PATCH 62/95] vs2010 unimrcp working build --- libs/unimrcp/libs/mpf/mpf.2010.vcxproj | 5 +++-- libs/unimrcp/libs/mpf/mpf.2010.vcxproj.filters | 5 +---- .../libs/mrcpv2-transport/mrcpv2transport.2010.vcxproj | 1 + .../mrcpv2-transport/mrcpv2transport.2010.vcxproj.filters | 3 +++ libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2010.vcxproj | 1 + .../modules/mrcp-sofiasip/mrcpsofiasip.2010.vcxproj.filters | 3 +++ 6 files changed, 12 insertions(+), 6 deletions(-) diff --git a/libs/unimrcp/libs/mpf/mpf.2010.vcxproj b/libs/unimrcp/libs/mpf/mpf.2010.vcxproj index 96b83f60b6..e2ccf2ddab 100644 --- a/libs/unimrcp/libs/mpf/mpf.2010.vcxproj +++ b/libs/unimrcp/libs/mpf/mpf.2010.vcxproj @@ -53,7 +53,7 @@ - + @@ -63,7 +63,7 @@ - + @@ -127,6 +127,7 @@ + diff --git a/libs/unimrcp/libs/mpf/mpf.2010.vcxproj.filters b/libs/unimrcp/libs/mpf/mpf.2010.vcxproj.filters index 0e4bc84d13..d79e3f31a4 100644 --- a/libs/unimrcp/libs/mpf/mpf.2010.vcxproj.filters +++ b/libs/unimrcp/libs/mpf/mpf.2010.vcxproj.filters @@ -104,7 +104,7 @@ src - + src @@ -229,9 +229,6 @@ include - - include - include diff --git a/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2010.vcxproj b/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2010.vcxproj index d9e4961af1..69e67d2d2a 100644 --- a/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2010.vcxproj +++ b/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2010.vcxproj @@ -113,6 +113,7 @@ + diff --git a/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2010.vcxproj.filters b/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2010.vcxproj.filters index 452f77e19d..576ef8ae7e 100644 --- a/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2010.vcxproj.filters +++ b/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2010.vcxproj.filters @@ -40,5 +40,8 @@ src + + src + \ No newline at end of file diff --git a/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2010.vcxproj b/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2010.vcxproj index 242c737224..b4d3bc3ddf 100644 --- a/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2010.vcxproj +++ b/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2010.vcxproj @@ -125,6 +125,7 @@ + diff --git a/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2010.vcxproj.filters b/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2010.vcxproj.filters index d2157eea88..33ff479678 100644 --- a/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2010.vcxproj.filters +++ b/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2010.vcxproj.filters @@ -31,5 +31,8 @@ src + + src + \ No newline at end of file From cee8b30c457f843d14c50b15b02172a986768cdc Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 16 Dec 2014 10:19:05 -0600 Subject: [PATCH 63/95] set rtp_has_crypto for dtls calls --- src/switch_rtp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/switch_rtp.c b/src/switch_rtp.c index d068e960ee..8f7bcefec6 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -3379,6 +3379,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_crypto_key(switch_rtp_t *rtp_sess if (switch_event_create(&fsevent, SWITCH_EVENT_CALL_SECURE) == SWITCH_STATUS_SUCCESS) { if (rtp_session->dtls) { switch_event_add_header(fsevent, SWITCH_STACK_BOTTOM, "secure_type", "srtp:dtls:AES_CM_128_HMAC_SHA1_80"); + switch_channel_set_variable(channel, "rtp_has_crypto", "srtp:dtls:AES_CM_128_HMAC_SHA1_80"); } else { switch_event_add_header(fsevent, SWITCH_STACK_BOTTOM, "secure_type", "srtp:sdes:%s", switch_channel_get_variable(channel, "rtp_has_crypto")); } From d5119a7a771b46db0720d0e49cf88d250a82551c Mon Sep 17 00:00:00 2001 From: Chris Rienzo Date: Wed, 17 Dec 2014 14:49:01 -0500 Subject: [PATCH 64/95] FS-7091 #resolve #comment [mod_rayo] Removed unnecessary mutex lock inside input component's cleanup function since the input component won't be cleaned up unless all references have been released. This fixes a deadlock when output component is created at the same time an input component completes. --- src/mod/event_handlers/mod_rayo/rayo_input_component.c | 2 -- 1 file changed, 2 deletions(-) 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 e199b46b8e..0eaabae613 100644 --- a/src/mod/event_handlers/mod_rayo/rayo_input_component.c +++ b/src/mod/event_handlers/mod_rayo/rayo_input_component.c @@ -736,7 +736,6 @@ static char *create_input_component_id(switch_core_session_t *session, iks *inpu */ static void input_component_cleanup(struct rayo_actor *component) { - switch_mutex_lock(component->mutex); if (INPUT_COMPONENT(component)->speech_mode) { switch_core_session_t *session = switch_core_session_locate(component->parent->id); if (session) { @@ -744,7 +743,6 @@ static void input_component_cleanup(struct rayo_actor *component) switch_core_session_rwunlock(session); } } - switch_mutex_unlock(component->mutex); } /** From 4ce2ce31cae605e2c27f38c6a43e735b035ad9fc Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 17 Dec 2014 18:44:57 -0600 Subject: [PATCH 65/95] FS-7092 #resolve #comment resolved in master --- src/switch_core_media.c | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/src/switch_core_media.c b/src/switch_core_media.c index 6df4387b60..4e50d2cc30 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -3828,6 +3828,23 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s switch_channel_set_variable(session->channel, SWITCH_REMOTE_MEDIA_PORT_VARIABLE, tmp); + if (a_engine->cur_payload_map->pt == smh->mparams->te) { + switch_payload_t pl = 0; + payload_map_t *pmap; + + switch_mutex_lock(smh->sdp_mutex); + for (pmap = a_engine->cur_payload_map; pmap && pmap->allocated; pmap = pmap->next) { + if (pmap->pt > pl) { + pl = pmap->pt; + } + } + switch_mutex_unlock(smh->sdp_mutex); + + smh->mparams->te = (switch_payload_t) ++pl; + } + + + #if 0 if (!switch_true(mirror) && switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND && @@ -6360,8 +6377,12 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess switch_core_session_get_payload_code(orig_session, imp->codec_type == SWITCH_CODEC_TYPE_AUDIO ? SWITCH_MEDIA_TYPE_AUDIO : SWITCH_MEDIA_TYPE_VIDEO, imp->iananame, imp->samples_per_second, &orig_pt, NULL, &orig_fmtp) == SWITCH_STATUS_SUCCESS) { + if (orig_pt == smh->mparams->te) { + smh->mparams->te = (switch_payload_t)smh->payload_space++; + } + smh->ianacodes[i] = orig_pt; - + if (orig_fmtp) { smh->fmtps[i] = switch_core_session_strdup(session, orig_fmtp); } @@ -6484,10 +6505,7 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "m=audio %d %s", port, get_media_profile_name(session, !a_engine->no_crypto && (switch_channel_test_flag(session->channel, CF_DTLS) || a_engine->crypto_type != CRYPTO_INVALID))); - - - - + switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), " %d", a_engine->cur_payload_map->pt); From d78649058412dc051873d53d19806bed3acb8a8a Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Wed, 17 Dec 2014 19:31:16 -0500 Subject: [PATCH 66/95] Fix timestamps in mod_bert broken by the cpu improvements refactoring --- src/mod/applications/mod_bert/mod_bert.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/mod/applications/mod_bert/mod_bert.c b/src/mod/applications/mod_bert/mod_bert.c index a1adb2dd9d..ca861cb25a 100644 --- a/src/mod/applications/mod_bert/mod_bert.c +++ b/src/mod/applications/mod_bert/mod_bert.c @@ -203,12 +203,6 @@ SWITCH_STANDARD_APP(bert_test_function) write_frame.datalen = read_impl.encoded_bytes_per_packet; write_frame.samples = read_impl.samples_per_packet; - if (timer_name) { - write_frame.timestamp = bert.timer.samplecount; - } else { - /* the playback() app does not set write_frame.timestamp unless a timer is used, what's the catch? does it matter? */ - } - for (;;) { if (!switch_channel_ready(channel)) { @@ -222,6 +216,8 @@ SWITCH_STANDARD_APP(bert_test_function) switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failed to step on timer!\n"); break; } + /* the playback() app does not set write_frame.timestamp unless a timer is used, what's the catch? does it matter? */ + write_frame.timestamp = bert.timer.samplecount; } if (bert.output_debug_f) { From ba016c28503ca748a831ae714b037dec64209bda Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 18 Dec 2014 13:08:11 -0600 Subject: [PATCH 67/95] FS-7095 #comment please test --- src/switch_rtp.c | 100 +++++++++++++++++++++++------------------------ 1 file changed, 50 insertions(+), 50 deletions(-) diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 8f7bcefec6..d6dcf9cd22 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -472,6 +472,42 @@ static void do_2833(switch_rtp_t *rtp_session); #define rtp_type(rtp_session) rtp_session->flags[SWITCH_RTP_FLAG_VIDEO] ? "video" : "audio" +static void switch_rtp_change_ice_dest(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, const char *host, switch_port_t port) +{ + int is_rtcp = ice == &rtp_session->rtcp_ice; + const char *err = ""; + + ice->ice_params->cands[ice->ice_params->chosen[ice->proto]][ice->proto].con_addr = switch_core_strdup(rtp_session->pool, host); + ice->ice_params->cands[ice->ice_params->chosen[ice->proto]][ice->proto].con_port = port; + ice->missed_count = 0; + + switch_sockaddr_info_get(&ice->addr, host, SWITCH_UNSPEC, port, 0, rtp_session->pool); + + if (!is_rtcp || rtp_session->flags[SWITCH_RTP_FLAG_RTCP_MUX]) { + switch_rtp_set_remote_address(rtp_session, host, port, 0, SWITCH_FALSE, &err); + } + + if (rtp_session->dtls) { + + if (!is_rtcp || rtp_session->flags[SWITCH_RTP_FLAG_RTCP_MUX]) { + switch_sockaddr_info_get(&rtp_session->dtls->remote_addr, host, SWITCH_UNSPEC, port, 0, rtp_session->pool); + } + + if (is_rtcp && !rtp_session->flags[SWITCH_RTP_FLAG_RTCP_MUX]) { + + switch_sockaddr_info_get(&rtp_session->rtcp_remote_addr, host, SWITCH_UNSPEC, port, 0, rtp_session->pool); + if (rtp_session->rtcp_dtls) { + //switch_sockaddr_info_get(&rtp_session->rtcp_dtls->remote_addr, host, SWITCH_UNSPEC, port, 0, rtp_session->pool); + rtp_session->rtcp_dtls->remote_addr = rtp_session->rtcp_remote_addr; + rtp_session->rtcp_dtls->sock_output = rtp_session->rtcp_sock_output; + } + + } + } + +} + + static handle_rfc2833_result_t handle_rfc2833(switch_rtp_t *rtp_session, switch_size_t bytes, int *do_cng) { @@ -1053,7 +1089,6 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d switch_port_t port = 0, port2 = 0; char buf[80] = ""; char buf2[80] = ""; - const char *err = ""; if (packet->header.type == SWITCH_STUN_BINDING_REQUEST) { uint8_t stunbuf[512]; @@ -1096,28 +1131,20 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d if ((ice->type & ICE_VANILLA)) { switch_stun_packet_attribute_add_integrity(rpacket, ice->pass); switch_stun_packet_attribute_add_fingerprint(rpacket); - } else { - if (hosts_set) { - switch_sockaddr_info_get(&ice->addr, host, SWITCH_UNSPEC, port, 0, rtp_session->pool); - - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_NOTICE, - "ICE Auto Changing %s media address from %s:%u to %s:%u\n", is_rtcp ? "rtcp" : "rtp", - host2, port2, - host, port); - - if (!is_rtcp || rtp_session->flags[SWITCH_RTP_FLAG_RTCP_MUX]) { - switch_rtp_set_remote_address(rtp_session, host, port, 0, SWITCH_FALSE, &err); - } - - if (is_rtcp && !rtp_session->flags[SWITCH_RTP_FLAG_RTCP_MUX]) { - ice->addr = rtp_session->rtcp_remote_addr; - } else { - ice->addr = rtp_session->remote_addr; - } - - } } + if (hosts_set) { + switch_sockaddr_info_get(&ice->addr, host, SWITCH_UNSPEC, port, 0, rtp_session->pool); + + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_NOTICE, + "Auto Changing stun/%s/dtls port from %s:%u to %s:%u\n", is_rtcp ? "rtcp" : "rtp", + host2, port2, + host, port); + + switch_rtp_change_ice_dest(rtp_session, ice, host, port); + } + + bytes = switch_stun_packet_length(rpacket); if (!ice->rready && (ice->type & ICE_VANILLA) && ice->ice_params && hosts_set && !switch_cmp_addr(from_addr, ice->addr)) { @@ -1133,7 +1160,7 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d if (ice->ice_params->cands[i][ice->proto].con_port == port) { if (!strcmp(ice->ice_params->cands[i][ice->proto].con_addr, host) && !strcmp(ice->ice_params->cands[i][ice->proto].cand_type, "relay")) { - + if (rtp_session->last_stun && elapsed < 5000) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_WARNING, "Skiping RELAY stun/%s/dtls port change from %s:%u to %s:%u\n", is_rtcp ? "rtcp" : "rtp", @@ -1152,35 +1179,8 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d "Auto Changing stun/%s/dtls port from %s:%u to %s:%u\n", is_rtcp ? "rtcp" : "rtp", host2, port2, host, port); - - ice->ice_params->cands[ice->ice_params->chosen[ice->proto]][ice->proto].con_addr = switch_core_strdup(rtp_session->pool, host); - ice->ice_params->cands[ice->ice_params->chosen[ice->proto]][ice->proto].con_port = port; - ice->missed_count = 0; - switch_sockaddr_info_get(&ice->addr, host, SWITCH_UNSPEC, port, 0, rtp_session->pool); - - if (!is_rtcp || rtp_session->flags[SWITCH_RTP_FLAG_RTCP_MUX]) { - switch_rtp_set_remote_address(rtp_session, host, port, 0, SWITCH_FALSE, &err); - } - - if (rtp_session->dtls) { - - if (!is_rtcp || rtp_session->flags[SWITCH_RTP_FLAG_RTCP_MUX]) { - switch_sockaddr_info_get(&rtp_session->dtls->remote_addr, host, SWITCH_UNSPEC, port, 0, rtp_session->pool); - } - - if (is_rtcp && !rtp_session->flags[SWITCH_RTP_FLAG_RTCP_MUX]) { - - switch_sockaddr_info_get(&rtp_session->rtcp_remote_addr, host, SWITCH_UNSPEC, port, 0, rtp_session->pool); - if (rtp_session->rtcp_dtls) { - //switch_sockaddr_info_get(&rtp_session->rtcp_dtls->remote_addr, host, SWITCH_UNSPEC, port, 0, rtp_session->pool); - rtp_session->rtcp_dtls->remote_addr = rtp_session->rtcp_remote_addr; - rtp_session->rtcp_dtls->sock_output = rtp_session->rtcp_sock_output; - } - - } - } - + switch_rtp_change_ice_dest(rtp_session, ice, host, port); } switch_socket_sendto(sock_output, from_addr, 0, (void *) rpacket, &bytes); From e0dcd176f4e69df6dfab4cd1210bcf14e2aa3ec2 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 18 Dec 2014 10:07:21 -0600 Subject: [PATCH 68/95] FS-7083 #comment patch to change mod_shout to use lame_encode_buffer_interleaved on stereo channels so we don't have to mess with the input data --- src/mod/formats/mod_shout/mod_shout.c | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/src/mod/formats/mod_shout/mod_shout.c b/src/mod/formats/mod_shout/mod_shout.c index e6ba9a94b2..773e937912 100644 --- a/src/mod/formats/mod_shout/mod_shout.c +++ b/src/mod/formats/mod_shout/mod_shout.c @@ -124,10 +124,6 @@ struct shout_context { int eof; int channels; int stream_channels; - int16_t *l; - switch_size_t llen; - int16_t *r; - switch_size_t rlen; unsigned char *mp3buf; switch_size_t mp3buflen; switch_thread_rwlock_t *rwlock; @@ -1035,24 +1031,10 @@ static switch_status_t shout_file_write(switch_file_handle_t *handle, void *data } if (handle->real_channels == 2) { - switch_size_t i, j = 0; - - if (context->llen < nsamples) { - context->l = switch_core_alloc(context->memory_pool, nsamples * 2); - context->r = switch_core_alloc(context->memory_pool, nsamples * 2); - context->llen = context->rlen = nsamples; - } - - for (i = 0; i < nsamples; i++) { - context->l[i] = audio[j++]; - context->r[i] = audio[j++]; - } - - if ((rlen = lame_encode_buffer(context->gfp, context->l, context->r, (int)nsamples, context->mp3buf, (int)context->mp3buflen)) < 0) { + if ((rlen = lame_encode_buffer_interleaved(context->gfp, audio, (int)nsamples, context->mp3buf, (int)context->mp3buflen)) < 0) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "MP3 encode error %d!\n", rlen); return SWITCH_STATUS_FALSE; } - } else if (handle->real_channels == 1) { if ((rlen = lame_encode_buffer(context->gfp, audio, NULL, (int)nsamples, context->mp3buf, (int)context->mp3buflen)) < 0) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "MP3 encode error %d!\n", rlen); From 0c1e698d0785a01600ee20c4957f83a6e7d2fbbc Mon Sep 17 00:00:00 2001 From: Brian West Date: Thu, 18 Dec 2014 15:47:48 -0600 Subject: [PATCH 69/95] update build deps for debian list --- build/Makefile.centos6 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/Makefile.centos6 b/build/Makefile.centos6 index bcacb69f49..f2b9ecab1c 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 +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 freeswitch: deps has-git freeswitch.git/Makefile cd freeswitch.git && make From cf13a3ddb768f47967ee411f1a386ed337e01c4e Mon Sep 17 00:00:00 2001 From: Brian West Date: Thu, 18 Dec 2014 19:30:44 -0600 Subject: [PATCH 70/95] chmod --- support-d/rbfs | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 support-d/rbfs diff --git a/support-d/rbfs b/support-d/rbfs old mode 100644 new mode 100755 From 42ecb3390e865baa378d2ba3c69f6616718fbbcc Mon Sep 17 00:00:00 2001 From: "Dmitriy N. Borisov" Date: Fri, 19 Dec 2014 11:04:54 +0300 Subject: [PATCH 71/95] list_users tipo correction --- src/mod/applications/mod_commands/mod_commands.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index 6fc06ea07e..eab0b242cd 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -303,7 +303,7 @@ end: SWITCH_STANDARD_API(list_users_function) { int argc; - char *pdata, *argv[8]; + char *pdata, *argv[9]; int32_t arg = 0; switch_xml_t xml_root, x_domains, x_domain_tag; switch_xml_t gts, gt, uts, ut; @@ -313,7 +313,7 @@ SWITCH_STANDARD_API(list_users_function) if ((pdata = strdup(cmd))) { argc = switch_separate_string(pdata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); - if (argc >= 8) { + if (argc >= 9) { stream->write_function(stream, "-USAGE: %s\n", LIST_USERS_SYNTAX); goto done; } From c96d64e7e142d43db1864da17520d69268627aa3 Mon Sep 17 00:00:00 2001 From: "Dmitriy N. Borisov" Date: Fri, 19 Dec 2014 11:13:55 +0300 Subject: [PATCH 72/95] invalid type cast correction --- src/mod/endpoints/mod_sofia/sofia_reg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index b72070ba63..7e26470d73 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -857,7 +857,7 @@ long sofia_reg_uniform_distribution(int max) int result; int range = max + 1; - srand((unsigned) switch_thread_self() + switch_micro_time_now()); + srand((intptr_t) switch_thread_self() + switch_micro_time_now()); result = (int)((double)rand() / (((double)RAND_MAX + (double)1) / range)); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG9, "Generated random %ld, max is %d\n", (long) result, max); From 326289caf976788d745957695b3ef7930a54bfb7 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Sat, 20 Dec 2014 00:25:59 -0600 Subject: [PATCH 73/95] FS-7083 #resolve #comment this should do it. The problem is linked to side-effects from the read thread being delayed by writing to the file handle. It was so much worse on mp3 because the shout encoder blocks while its churning the data and delays it more. This patch adds a dedicated thread for writing to the file and the channel_variable RECORD_USE_THREAD=false will disable it and sync may still be maintained at the cost of dropping more data from the audio signal. --- src/switch_core_media_bug.c | 73 ++++++++++---------- src/switch_ivr_async.c | 131 ++++++++++++++++++++++++++++++------ src/switch_time.c | 2 + 3 files changed, 150 insertions(+), 56 deletions(-) diff --git a/src/switch_core_media_bug.c b/src/switch_core_media_bug.c index 08f2ee30d7..a8af7d8f97 100644 --- a/src/switch_core_media_bug.c +++ b/src/switch_core_media_bug.c @@ -185,9 +185,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_read(switch_media_bug_t *b uint32_t blen; switch_codec_implementation_t read_impl = { 0 }; int16_t *tp; - switch_size_t do_read = 0, do_write = 0; - int fill_read = 0, fill_write = 0; - + switch_size_t do_read = 0, do_write = 0, has_read = 0, has_write = 0, fill_read = 0, fill_write = 0; switch_core_session_get_read_impl(bug->session, &read_impl); @@ -213,50 +211,47 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_read(switch_media_bug_t *b frame->datalen = 0; if (switch_test_flag(bug, SMBF_READ_STREAM)) { + has_read = 1; switch_mutex_lock(bug->read_mutex); do_read = switch_buffer_inuse(bug->raw_read_buffer); switch_mutex_unlock(bug->read_mutex); } if (switch_test_flag(bug, SMBF_WRITE_STREAM)) { + has_write = 1; switch_mutex_lock(bug->write_mutex); do_write = switch_buffer_inuse(bug->raw_write_buffer); switch_mutex_unlock(bug->write_mutex); } + if (bug->record_frame_size && bug->record_pre_buffer_max && (do_read || do_write) && bug->record_pre_buffer_count < bug->record_pre_buffer_max) { bug->record_pre_buffer_count++; return SWITCH_STATUS_FALSE; } else { uint32_t frame_size; switch_codec_implementation_t read_impl = { 0 }; - //switch_codec_implementation_t other_read_impl = { 0 }; - //switch_core_session_t *other_session; - + switch_core_session_get_read_impl(bug->session, &read_impl); frame_size = read_impl.decoded_bytes_per_packet; bug->record_frame_size = frame_size; - -#if 0 - if (do_read && do_write) { - if (switch_core_session_get_partner(bug->session, &other_session) == SWITCH_STATUS_SUCCESS) { - switch_core_session_get_read_impl(other_session, &other_read_impl); - switch_core_session_rwunlock(other_session); + } - if (read_impl.actual_samples_per_second == other_read_impl.actual_samples_per_second) { - if (read_impl.decoded_bytes_per_packet < other_read_impl.decoded_bytes_per_packet) { - frame_size = read_impl.decoded_bytes_per_packet; - } - } else { - if (read_impl.decoded_bytes_per_packet > other_read_impl.decoded_bytes_per_packet) { - frame_size = read_impl.decoded_bytes_per_packet; - } - } - } + if (bug->record_frame_size && do_write > do_read && do_write > (bug->record_frame_size * 2)) { + switch_mutex_lock(bug->write_mutex); + switch_buffer_toss(bug->raw_write_buffer, bug->record_frame_size); + do_write = switch_buffer_inuse(bug->raw_write_buffer); + switch_mutex_unlock(bug->write_mutex); + } - bug->record_frame_size = bytes = frame_size; - } -#endif + + + if ((has_read && !do_read)) { + fill_read = 1; + } + + if ((has_write && !do_write)) { + fill_write = 1; } @@ -274,10 +269,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_read(switch_media_bug_t *b } } - fill_read = !do_read; - fill_write = !do_write; - - if ((fill_read && fill_write) || (!fill && fill_read)) { + if ((fill_read && fill_write) || (fill && (fill_read || fill_write))) { return SWITCH_STATUS_FALSE; } @@ -384,17 +376,26 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_read(switch_media_bug_t *b frame->rate = read_impl.actual_samples_per_second; frame->codec = NULL; - if (fill_read && fill_write) { - return SWITCH_STATUS_BREAK; - } - - if (fill_read || fill_write) { - return SWITCH_STATUS_BREAK; + if (switch_test_flag(bug, SMBF_STEREO)) { + frame->datalen *= 2; + frame->channels = 2; } memcpy(bug->session->recur_buffer, frame->data, frame->datalen); bug->session->recur_buffer_len = frame->datalen; - + + if (has_read) { + switch_mutex_lock(bug->read_mutex); + do_read = switch_buffer_inuse(bug->raw_read_buffer); + switch_mutex_unlock(bug->read_mutex); + } + + if (has_write) { + switch_mutex_lock(bug->write_mutex); + do_write = switch_buffer_inuse(bug->raw_write_buffer); + switch_mutex_unlock(bug->write_mutex); + } + return SWITCH_STATUS_SUCCESS; } diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index 25ec4d7285..21180d789f 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -1044,6 +1044,10 @@ struct record_helper { switch_bool_t hangup_on_error; switch_codec_implementation_t read_impl; switch_bool_t speech_detected; + switch_buffer_t *thread_buffer; + switch_thread_t *thread; + switch_mutex_t *buffer_mutex; + int thread_ready; const char *completion_cause; }; @@ -1110,6 +1114,55 @@ static void send_record_stop_event(switch_channel_t *channel, switch_codec_imple } } +static void *SWITCH_THREAD_FUNC recording_thread(switch_thread_t *thread, void *obj) +{ + switch_media_bug_t *bug = (switch_media_bug_t *) obj; + switch_core_session_t *session = switch_core_media_bug_get_session(bug); + switch_channel_t *channel = switch_core_session_get_channel(session); + struct record_helper *rh; + switch_size_t bsize = SWITCH_RECOMMENDED_BUFFER_SIZE, samples = 0, inuse = 0; + unsigned char *data = switch_core_session_alloc(session, bsize); + int channels = switch_core_media_bug_test_flag(bug, SMBF_STEREO) ? 2 : 1; + + if (switch_core_session_read_lock(session) != SWITCH_STATUS_SUCCESS) { + return NULL; + } + + rh = switch_core_media_bug_get_user_data(bug); + switch_buffer_create_dynamic(&rh->thread_buffer, 1024 * 512, 1024 * 64, 0); + rh->thread_ready = 1; + + while(switch_test_flag(rh->fh, SWITCH_FILE_OPEN)) { + switch_mutex_lock(rh->buffer_mutex); + inuse = switch_buffer_inuse(rh->thread_buffer); + + if (rh->thread_ready && switch_channel_up_nosig(channel) && inuse < bsize) { + switch_mutex_unlock(rh->buffer_mutex); + switch_yield(20000); + continue; + } else if ((!rh->thread_ready || switch_channel_down_nosig(channel)) && !inuse) { + break; + } + + samples = switch_buffer_read(rh->thread_buffer, data, bsize) / 2 / channels; + switch_mutex_unlock(rh->buffer_mutex); + + if (switch_core_file_write(rh->fh, data, &samples) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error writing %s\n", rh->file); + /* File write failed */ + set_completion_cause(rh, "uri-failure"); + if (rh->hangup_on_error) { + switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); + switch_core_session_reset(session, SWITCH_TRUE, SWITCH_TRUE); + } + } + } + + switch_core_session_rwunlock(session); + + return NULL; +} + static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, switch_abc_type_t type) { switch_core_session_t *session = switch_core_media_bug_get_session(bug); @@ -1123,18 +1176,40 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s switch (type) { case SWITCH_ABC_TYPE_INIT: - if (switch_event_create(&event, SWITCH_EVENT_RECORD_START) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Record-File-Path", rh->file); - switch_channel_event_set_data(channel, event); - switch_event_fire(&event); + { + const char *var = switch_channel_get_variable(channel, "RECORD_USE_THREAD"); + + if (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; + + + switch_core_session_get_read_impl(session, &rh->read_impl); + switch_mutex_init(&rh->buffer_mutex, SWITCH_MUTEX_NESTED, pool); + switch_threadattr_create(&thd_attr, pool); + switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE); + switch_thread_create(&rh->thread, thd_attr, recording_thread, bug, pool); + + while(--sanity > 0 && !rh->thread_ready) { + switch_yield(10000); + } + } + + + if (switch_event_create(&event, SWITCH_EVENT_RECORD_START) == SWITCH_STATUS_SUCCESS) { + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Record-File-Path", rh->file); + switch_channel_event_set_data(channel, event); + switch_event_fire(&event); + } + + rh->silence_time = switch_micro_time_now(); + rh->silence_timeout_ms = rh->initial_timeout_ms; + rh->speech_detected = SWITCH_FALSE; + rh->completion_cause = NULL; + + switch_core_session_get_read_impl(session, &rh->read_impl); } - rh->silence_time = switch_micro_time_now(); - rh->silence_timeout_ms = rh->initial_timeout_ms; - rh->speech_detected = SWITCH_FALSE; - rh->completion_cause = NULL; - - switch_core_session_get_read_impl(session, &rh->read_impl); - break; case SWITCH_ABC_TYPE_TAP_NATIVE_READ: { @@ -1232,6 +1307,18 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s uint8_t data[SWITCH_RECOMMENDED_BUFFER_SIZE]; switch_frame_t frame = { 0 }; + if (rh->thread_ready) { + switch_status_t st; + + rh->thread_ready = 0; + switch_thread_join(&st, rh->thread); + } + + if (rh->thread_buffer) { + switch_buffer_destroy(&rh->thread_buffer); + } + + frame.data = data; frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE; @@ -1313,18 +1400,24 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s uint8_t data[SWITCH_RECOMMENDED_BUFFER_SIZE]; switch_frame_t frame = { 0 }; switch_status_t status; + int i = 0; frame.data = data; frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE; for (;;) { - status = switch_core_media_bug_read(bug, &frame, SWITCH_FALSE); + status = switch_core_media_bug_read(bug, &frame, i++ == 0 ? SWITCH_FALSE : SWITCH_TRUE); - if (status == SWITCH_STATUS_SUCCESS || status == SWITCH_STATUS_BREAK) { - - len = (switch_size_t) frame.datalen / 2; - - if (len && switch_core_file_write(rh->fh, mask ? null_data : data, &len) != SWITCH_STATUS_SUCCESS) { + if (status != SWITCH_STATUS_SUCCESS || !frame.datalen) { + break; + } else { + len = (switch_size_t) frame.datalen / 2 / frame.channels; + + if (rh->thread_buffer) { + switch_mutex_lock(rh->buffer_mutex); + switch_buffer_write(rh->thread_buffer, mask ? null_data : data, frame.datalen); + switch_mutex_unlock(rh->buffer_mutex); + } else if (switch_core_file_write(rh->fh, mask ? null_data : data, &len) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error writing %s\n", rh->file); /* File write failed */ set_completion_cause(rh, "uri-failure"); @@ -1377,8 +1470,6 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s rh->speech_detected = SWITCH_TRUE; } } - } else { - break; } } } @@ -2269,7 +2360,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_session(switch_core_session_t } rh->hangup_on_error = hangup_on_error; - + if ((status = switch_core_media_bug_add(session, "session_record", file, record_callback, rh, to, flags, &bug)) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error adding media bug for file %s\n", file); diff --git a/src/switch_time.c b/src/switch_time.c index f710105031..c226b90592 100644 --- a/src/switch_time.c +++ b/src/switch_time.c @@ -1046,6 +1046,8 @@ SWITCH_MODULE_RUNTIME_FUNCTION(softtimer_runtime) tfd = -1; } } + + if (tfd > -1) MATRIX = 0; } #else tfd = -1; From 5fcff501b641177f5c26099dbe78b0b159cf5c43 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Sat, 20 Dec 2014 18:29:44 -0600 Subject: [PATCH 74/95] FS-7093 %FEATURE #resolve #comment added to master --- .../applications/mod_commands/mod_commands.c | 84 +++++++++++++++++++ 1 file changed, 84 insertions(+) diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index eab0b242cd..64f087969f 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -2948,7 +2948,89 @@ SWITCH_STANDARD_API(uuid_chat) return SWITCH_STATUS_SUCCESS; } +#define UUID_DROP_DTMF_SYNTAX " [on | off ] [ mask_digits | mask_file ]" +SWITCH_STANDARD_API(uuid_drop_dtmf) +{ + switch_core_session_t *tsession = NULL; + char *uuid = NULL, *action = NULL, *mask_action = NULL, *mask_arg = NULL; + char *argv[5] = { 0 }; + char *dup; + int argc = 0; + if (zstr(cmd)) { + stream->write_function(stream, "-USAGE: %s\n", UUID_DROP_DTMF_SYNTAX); + return SWITCH_STATUS_SUCCESS; + } + + dup = strdup(cmd); + argc = switch_split(dup, ' ', argv); + + + if (argv[0]) { + uuid = argv[0]; + } + + if (argv[1]) { + action = argv[1]; + } + + if (argv[2]) { + mask_action = argv[2]; + } + + if (argv[3]) { + mask_arg = argv[3]; + } + + if (zstr(uuid)) { + stream->write_function(stream, "-USAGE: %s\n", UUID_DROP_DTMF_SYNTAX); + } else { + if ((tsession = switch_core_session_locate(uuid))) { + switch_channel_t *channel = switch_core_session_get_channel(tsession); + int is_on = 0; + const char *file, *digits; + + if (!zstr(mask_action) && !zstr(mask_arg)) { + if (!strcasecmp(mask_action, "mask_digits")) { + switch_channel_set_variable(channel, "drop_dtmf_masking_digits", mask_arg); + } else if (!strcasecmp(mask_action, "mask_file")) { + switch_channel_set_variable(channel, "drop_dtmf_masking_file", mask_arg); + } else { + stream->write_function(stream, "-USAGE: %s\n", UUID_DROP_DTMF_SYNTAX); + goto end; + } + } + + if (!zstr(action)) { + if (!strcasecmp(action, "on")) { + switch_channel_set_flag(channel, CF_DROP_DTMF); + switch_channel_set_variable(channel, "drop_dtmf", "true"); + } else { + switch_channel_clear_flag(channel, CF_DROP_DTMF); + switch_channel_set_variable(channel, "drop_dtmf", "false"); + } + } + + is_on = switch_channel_test_flag(channel, CF_DROP_DTMF); + file = switch_channel_get_variable_dup(channel, "drop_dtmf_masking_file", SWITCH_FALSE, -1); + digits = switch_channel_get_variable_dup(channel, "drop_dtmf_masking_digits", SWITCH_FALSE, -1); + + stream->write_function(stream, "+OK %s is %s DTMF. mask_file: %s mask_digits: %s\n", uuid, is_on ? "dropping" : "not dropping", + file ? file : "NONE", + digits ? digits : "NONE"); + + switch_core_session_rwunlock(tsession); + } else { + stream->write_function(stream, "-ERR No such channel %s!\n", uuid); + } + } + + end: + + switch_safe_free(dup); + return SWITCH_STATUS_SUCCESS; + +} #define UUID_DEFLECT_SYNTAX " " SWITCH_STANDARD_API(uuid_deflect) @@ -6700,6 +6782,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load) SWITCH_ADD_API(commands_api_interface, "uuid_deflect", "Send a deflect", uuid_deflect, UUID_DEFLECT_SYNTAX); SWITCH_ADD_API(commands_api_interface, "uuid_displace", "Displace audio", session_displace_function, " [start|stop] [] [mux]"); SWITCH_ADD_API(commands_api_interface, "uuid_display", "Update phone display", uuid_display_function, DISPLAY_SYNTAX); + SWITCH_ADD_API(commands_api_interface, "uuid_drop_dtmf", "Drop all DTMF or replace it with a mask", uuid_drop_dtmf, UUID_DROP_DTMF_SYNTAX); SWITCH_ADD_API(commands_api_interface, "uuid_dump", "Dump session vars", uuid_dump_function, DUMP_SYNTAX); SWITCH_ADD_API(commands_api_interface, "uuid_exists", "Check if a uuid exists", uuid_exists_function, EXISTS_SYNTAX); SWITCH_ADD_API(commands_api_interface, "uuid_fileman", "Manage session audio", uuid_fileman_function, FILEMAN_SYNTAX); @@ -6872,6 +6955,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load) switch_console_set_complete("add uuid_deflect ::console::list_uuid"); switch_console_set_complete("add uuid_displace ::console::list_uuid"); switch_console_set_complete("add uuid_display ::console::list_uuid"); + switch_console_set_complete("add uuid_drop_dtmf ::console::list_uuid"); switch_console_set_complete("add uuid_dump ::console::list_uuid"); switch_console_set_complete("add uuid_answer ::console::list_uuid"); switch_console_set_complete("add uuid_ring_ready ::console::list_uuid queued"); From 0a0b9262b47f9cfede3812a97224db4bb1b41b29 Mon Sep 17 00:00:00 2001 From: William King Date: Sat, 20 Dec 2014 14:46:21 -0800 Subject: [PATCH 75/95] Build fix for gcc 4.9 fixing a variable set but not used error --- src/mod/applications/mod_commands/mod_commands.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index 64f087969f..75d8625af2 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -2965,6 +2965,10 @@ SWITCH_STANDARD_API(uuid_drop_dtmf) dup = strdup(cmd); argc = switch_split(dup, ' ', argv); + if ( argc < 4 ) { + stream->write_function(stream, "-USAGE: %s\n", UUID_DROP_DTMF_SYNTAX); + goto end; + } if (argv[0]) { uuid = argv[0]; From 0200bc1a029070067c35dd6ee6821ed7c248f0a7 Mon Sep 17 00:00:00 2001 From: Brian West Date: Mon, 22 Dec 2014 11:30:01 -0600 Subject: [PATCH 76/95] FS-7083: fix divide by zero --- src/switch_core_media_bug.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/switch_core_media_bug.c b/src/switch_core_media_bug.c index a8af7d8f97..6dffffe06b 100644 --- a/src/switch_core_media_bug.c +++ b/src/switch_core_media_bug.c @@ -379,6 +379,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_read(switch_media_bug_t *b if (switch_test_flag(bug, SMBF_STEREO)) { frame->datalen *= 2; frame->channels = 2; + } else { + frame->channels = 1; } memcpy(bug->session->recur_buffer, frame->data, frame->datalen); From 9fabbabe9058d7fbba800931eb9cbc4ccafd9cd5 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 22 Dec 2014 19:06:12 -0600 Subject: [PATCH 77/95] disable hard-mute when a session has a media bug attached --- src/switch_core_media.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/switch_core_media.c b/src/switch_core_media.c index 4e50d2cc30..9fe886d047 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -7810,7 +7810,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_receive_message(switch_core_se case SWITCH_MESSAGE_INDICATE_HARD_MUTE: { - if (a_engine->rtp_session) { + if (session->bugs) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, + "%s has a media bug, hard mute not allowed.\n", switch_channel_get_name(session->channel)); + } else if (a_engine->rtp_session) { if (msg->numeric_arg) { switch_rtp_set_flag(a_engine->rtp_session, SWITCH_RTP_FLAG_MUTE); } else { From af6b23a12470cbc0dbe65ac2d83bdfd972f1ea34 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Mon, 22 Dec 2014 15:09:50 -0600 Subject: [PATCH 78/95] FS-7046 fix some additional warnings --- src/mod/endpoints/mod_verto/mcast/mcast_cpp.cpp | 2 +- src/mod/endpoints/mod_verto/mcast/mcast_cpp.h | 2 +- src/mod/endpoints/mod_verto/mod_verto.c | 10 ++++++---- src/mod/endpoints/mod_verto/ws.c | 3 ++- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/mod/endpoints/mod_verto/mcast/mcast_cpp.cpp b/src/mod/endpoints/mod_verto/mcast/mcast_cpp.cpp index 7bc6fc19f6..f087baf343 100644 --- a/src/mod/endpoints/mod_verto/mcast/mcast_cpp.cpp +++ b/src/mod/endpoints/mod_verto/mcast/mcast_cpp.cpp @@ -38,7 +38,7 @@ #include #endif -McastHandle::McastHandle(const char *host, int port, int flags) +McastHandle::McastHandle(const char *host, int16_t port, int flags) { mcast_socket_create(host, port, &handle, (mcast_flag_t) flags); } diff --git a/src/mod/endpoints/mod_verto/mcast/mcast_cpp.h b/src/mod/endpoints/mod_verto/mcast/mcast_cpp.h index bc9e85822d..0d289e755a 100644 --- a/src/mod/endpoints/mod_verto/mcast/mcast_cpp.h +++ b/src/mod/endpoints/mod_verto/mcast/mcast_cpp.h @@ -45,7 +45,7 @@ class McastHandle { private: mcast_handle_t handle; public: - McastHandle(const char *host, int port, int flags); + McastHandle(const char *host, int16_t port, int flags); virtual ~McastHandle(); int send(const char *data); char *recv(int ms = 0); diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index 612cc16117..6c23a1dcf6 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -104,7 +104,7 @@ static void json_cleanup(void) switch_mutex_lock(json_GLOBALS.store_mutex); top: - for (hi = switch_core_hash_first_iter(json_GLOBALS.store_hash, hi); hi; hi = switch_core_hash_next(&hi)) { + for (hi = switch_core_hash_first_iter(json_GLOBALS.store_hash, hi); hi;) { switch_core_hash_this(hi, &var, NULL, &val); json = (cJSON *) val; cJSON_Delete(json); @@ -315,7 +315,7 @@ static void unsub_all_jsock(void) top: head = NULL; - for (hi = switch_core_hash_first(globals.event_channel_hash); hi; hi = switch_core_hash_next(&hi)) { + for (hi = switch_core_hash_first(globals.event_channel_hash); hi;) { switch_core_hash_this(hi, NULL, NULL, &val); head = (jsock_sub_node_head_t *) val; jsock_unsub_head(NULL, head); @@ -3976,6 +3976,8 @@ static void parse_ip(char *host, uint16_t *port, in_addr_t *addr, char *input) strncpy(host, input, 255); + host[255] = 0; + if ((p = strchr(host, ':')) != NULL) { *p++ = '\0'; *port = (uint16_t)atoi(p); @@ -4983,7 +4985,7 @@ static switch_bool_t json_commit(cJSON *json, const char *name, switch_mutex_t * sql = switch_mprintf("insert into json_store (name,data) values('%q','%q')", name, ascii); - switch_snprintf(del_sql, sizeof(del_sql), "delete from json_store where name='%q'", name); + switch_snprintfv(del_sql, sizeof(del_sql), "delete from json_store where name='%q'", name); dbh = json_get_db_handle(); @@ -5038,7 +5040,7 @@ static switch_status_t json_hanguphook(switch_core_session_t *session) SWITCH_STANDARD_JSON_API(json_store_function) { - cJSON *JSON_STORE, *reply = NULL, *data = cJSON_GetObjectItem(json, "data"); + cJSON *JSON_STORE = NULL, *reply = NULL, *data = cJSON_GetObjectItem(json, "data"); switch_status_t status = SWITCH_STATUS_FALSE; const char *cmd_attr = cJSON_GetObjectCstr(data, "cmd"); const char *uuid = cJSON_GetObjectCstr(data, "uuid"); diff --git a/src/mod/endpoints/mod_verto/ws.c b/src/mod/endpoints/mod_verto/ws.c index 67646175d6..a572a89d07 100644 --- a/src/mod/endpoints/mod_verto/ws.c +++ b/src/mod/endpoints/mod_verto/ws.c @@ -309,7 +309,7 @@ int ws_handshake(wsh_t *wsh) "%s\r\n", b64, proto_buf); - + respond[511] = 0; ws_raw_write(wsh, respond, strlen(respond)); wsh->handshake = 1; @@ -322,6 +322,7 @@ int ws_handshake(wsh_t *wsh) snprintf(respond, sizeof(respond), "HTTP/1.1 400 Bad Request\r\n" "Sec-WebSocket-Version: 13\r\n\r\n"); + respond[511] = 0; ws_raw_write(wsh, respond, strlen(respond)); From 067cb0f0f20bd07b758822b6328693bfe855e7ef Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Mon, 22 Dec 2014 17:18:57 -0500 Subject: [PATCH 79/95] FS-7100: make buffer for sub contact big enough --- src/mod/endpoints/mod_sofia/sofia_presence.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index 69a86668d2..cfa900264b 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -3680,7 +3680,7 @@ void sofia_presence_handle_sip_i_subscribe(int status, int found_proto = 0; const char *use_to_tag; char to_tag[13] = ""; - char buf[80] = ""; + char buf[1025] = ""; char *orig_to_user = NULL; char *p; From 7798b2fd403126506cb3919dbee711d5e3fd3479 Mon Sep 17 00:00:00 2001 From: Seven Du Date: Wed, 24 Dec 2014 07:52:57 +0800 Subject: [PATCH 80/95] FS-6984 set some default video rate --- src/switch_core.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/switch_core.c b/src/switch_core.c index b23a35b542..59682df609 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -1852,6 +1852,10 @@ SWITCH_DECLARE(uint32_t) switch_default_rate(const char *name, uint32_t number) if (!strcasecmp(name, "opus")) { return 48000; + } else if (!strncasecmp(name, "h26", 3)) { // h26x + return 90000; + } else if (!strncasecmp(name, "vp", 2)) { // vp8, vp9 + return 90000; } return 8000; From 763e6aa962b40fde9afa1f62520c6cc0da860d20 Mon Sep 17 00:00:00 2001 From: Seven Du Date: Wed, 24 Dec 2014 08:08:04 +0800 Subject: [PATCH 81/95] FS-7046 fix warning introduced from b341ff7 --- src/mod/endpoints/mod_verto/mod_verto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index 6c23a1dcf6..d79d8d1191 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -1538,7 +1538,7 @@ new_req: while(bytes < request.content_length) { len = request.content_length - bytes; - if ((len = ws_raw_read(&jsock->ws, buffer + bytes, len, jsock->ws.block)) < 0) { + if ((switch_ssize_t)(len = ws_raw_read(&jsock->ws, buffer + bytes, len, jsock->ws.block)) < 0) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Read error %" SWITCH_SIZE_T_FMT"\n", len); goto done; } From 5ae9e6c988369e3b3fd3ae1fe18a86728c0ae1a5 Mon Sep 17 00:00:00 2001 From: Ken Rice Date: Wed, 24 Dec 2014 10:37:34 -0600 Subject: [PATCH 82/95] update URLs in this document --- docs/SubmittingPatches | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/SubmittingPatches b/docs/SubmittingPatches index b6d7648278..141319b82e 100644 --- a/docs/SubmittingPatches +++ b/docs/SubmittingPatches @@ -4,7 +4,7 @@ How to Contribute Patches to FreeSWITCH Download the Source Code ------------------------ - git clone https://stash.freeswitch.org/scm/fs/freeswitch.git + git clone https://freeswitch.org/stash/scm/fs/freeswitch.git cd freeswitch Ensure Git is Setup @@ -38,16 +38,16 @@ Create a Pull Request --------------------- # navigate to the FreeSWITCH JIRA - chromium https://jira.freeswitch.org/ + chromium https://freeswitch.org/jira # create an account in JIRA and create a new issue # navigate to FreeSWITCH Stash - chromium https://stash.freeswitch.org/ + chromium https://freeswitch.org/stash - # create an account in Stash; create a forked FS repository; read + # Using the saem credentials as Jira, login to Stash; create a forked FS repository; read # the details here: - chromium https://confluence.freeswitch.org/display/FREESWITCH/Pull+Requests + chromium https://freeswitch.org/confluence/display/FREESWITCH/Pull+Requests # add your repository as a remote (change to your username) git remote add stash ssh://git@stash.freeswitch.org:7999/~johndoe/freeswitch.git @@ -56,7 +56,7 @@ Create a Pull Request git push stash +HEAD:myfeature # create a pull request as described here: - chromium https://confluence.freeswitch.org/display/FREESWITCH/Pull+Requests + chromium https://freeswitch.org/confluence/display/FREESWITCH/Pull+Requests Guidelines for a Good Commit ---------------------------- From 3c8dd3e4df55e624845e74766bac7af149888b3d Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Thu, 25 Dec 2014 03:51:30 +0000 Subject: [PATCH 83/95] Handle missing `lsb_release` The lsb-release package isn't a stated dependency and isn't present on a minimal Debian install. --- debian/util.sh | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/debian/util.sh b/debian/util.sh index f024a8c9c0..052762b91c 100755 --- a/debian/util.sh +++ b/debian/util.sh @@ -386,18 +386,23 @@ build_all () { shift $(($OPTIND-1)) [ -n "$archs" ] || archs="amd64 i386" if [ -z "$distros" ]; then - case "$(lsb_release -is)" in - Debian) - distros="sid jessie wheezy" - ;; - Ubuntu) - distros="utopic trusty" - ;; - *) - echo "Unknown distribution" - exit -1 - ;; - esac + local default_distros="sid jessie wheezy" + if [ -z "$(which lsb_release)" ]; then + distros="$default_distros" + else + case "$(lsb_release -is)" in + Debian) + distros="$default_distros" + ;; + Ubuntu) + distros="utopic trusty" + ;; + *) + echo "Unknown distribution" + exit -1 + ;; + esac + fi fi ! $depinst || aptitude install -y \ rsync git less cowbuilder ccache \ From 505cd2947aa2ea553b6a9a1e19d8b4ee18bd8523 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Thu, 25 Dec 2014 03:58:49 +0000 Subject: [PATCH 84/95] Refactor distro detection and handling --- debian/util.sh | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/debian/util.sh b/debian/util.sh index 052762b91c..4a5214a9bb 100755 --- a/debian/util.sh +++ b/debian/util.sh @@ -357,6 +357,16 @@ build_debs () { echo ${dsc%.dsc}_${arch}.changes } +default_distros () { + local host_distro="Debian" + test -z "$(which lsb_release)" || host_distro="$(lsb_release -is)" + case "$host_distro" in + Debian) echo "sid jessie wheezy" ;; + Ubuntu) echo "utopic trusty" ;; + *) err "Unknown distribution" ;; + esac +} + build_all () { local OPTIND OPTARG local orig_opts="" dsc_opts="" deb_opts="" modlist="" @@ -385,25 +395,7 @@ build_all () { done shift $(($OPTIND-1)) [ -n "$archs" ] || archs="amd64 i386" - if [ -z "$distros" ]; then - local default_distros="sid jessie wheezy" - if [ -z "$(which lsb_release)" ]; then - distros="$default_distros" - else - case "$(lsb_release -is)" in - Debian) - distros="$default_distros" - ;; - Ubuntu) - distros="utopic trusty" - ;; - *) - echo "Unknown distribution" - exit -1 - ;; - esac - fi - fi + [ -n "$distros" ] || distros="$(default_distros)" ! $depinst || aptitude install -y \ rsync git less cowbuilder ccache \ devscripts equivs build-essential From 0330b6fa6ddb8b2fa6ab162061cf65922ffac113 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Thu, 25 Dec 2014 04:01:10 +0000 Subject: [PATCH 85/95] Adjust code style of recent changes --- debian/bootstrap.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index 1502bc9271..2267411cd3 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -9,7 +9,7 @@ fs_description="FreeSWITCH is a scalable open source cross-platform telephony pl mod_build_depends="." mod_depends="." mod_recommends="." mod_suggests="." supported_debian_distros="squeeze wheezy jessie sid" supported_ubuntu_distros="trusty utopic" -supported_distros=" $supported_debian_distros $supported_ubuntu_distros " +supported_distros="$supported_debian_distros $supported_ubuntu_distros" avoid_mods=( applications/mod_limit applications/mod_mongo @@ -285,9 +285,7 @@ list_freeswitch_all_dbg_replaces () { print_source_control () { local libtool_dep="libtool, libtool-bin" case "$codename" in - squeeze|wheezy|trusty) - libtool_dep="libtool" - ;; + squeeze|wheezy|trusty) libtool_dep="libtool" ;; esac cat < Date: Thu, 25 Dec 2014 04:18:27 +0000 Subject: [PATCH 86/95] Improve error message --- debian/util.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/util.sh b/debian/util.sh index 4a5214a9bb..67ff3b91ae 100755 --- a/debian/util.sh +++ b/debian/util.sh @@ -363,7 +363,7 @@ default_distros () { case "$host_distro" in Debian) echo "sid jessie wheezy" ;; Ubuntu) echo "utopic trusty" ;; - *) err "Unknown distribution" ;; + *) err "Unknown host distribution \"$host_distro\"" ;; esac } From d88bae1a62d44ef5e64b00c3fe6aad03d8f9faee Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Thu, 25 Dec 2014 06:42:14 +0000 Subject: [PATCH 87/95] Support optional debian parallel builds With this commit we allow getting `make -jN` behavior by setting `parallel=N` in `DEB_BUILD_OPTIONS`. Setting `parallel=` will result in `make -j` being run (i.e. no limit on the number of jobs). The default is to run one job at a time; this is still the safest bet when building all modules. Thanks to Peter Wu for suggesting a different way to do this. ref: https://www.debian.org/doc/debian-policy/ch-source.html#s-debianrules-options --- debian/rules | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/debian/rules b/debian/rules index cf6a7ed1ea..6bfd911f4d 100755 --- a/debian/rules +++ b/debian/rules @@ -20,6 +20,11 @@ export CFLAGS:=$(FS_CFLAGS) export CXXFLAGS:=$(FS_CXXFLAGS) export LDFLAGS:=$(FS_LDFLAGS) +NJOBS=1 +ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) + NJOBS=$(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) +endif + show_vars= \ echo; \ echo "Making target $@"; \ @@ -91,7 +96,7 @@ override_dh_auto_configure: .stamp-configure .stamp-build: .stamp-configure @$(call show_vars) - make + make -j$(NJOBS) touch $@ override_dh_auto_build: .stamp-build From 65e678ba1d47c9e23c6a75268d4499b8a18f08b6 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Thu, 25 Dec 2014 10:11:47 +0000 Subject: [PATCH 88/95] Fix mod_expr `clamp` function The clamp(v,a,b) function wraps v around the interval [a,b). However prior to this commit, `clamp` was ignoring the third argument and using the second argument again in its place. This resulted in a division by zero. Hence `clamp` didn't work at all. Even if the arguments were treated correctly, `clamp` incorrectly multiplied rather than added whenever v < a. This would have produced bogus results. (Thanks to Shona McNeill for pointing this out.) Note that as implemented, `clamp` is undefined for b >= a. These errors are present in the last upstream C version, v2.7. They've been corrected in the C++ version that upstream now maintains instead. Thanks-to: Shona McNeill FS-7070 #resolve --- src/mod/applications/mod_expr/exprilfs.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mod/applications/mod_expr/exprilfs.h b/src/mod/applications/mod_expr/exprilfs.h index ad2b5515e0..7efc281c16 100644 --- a/src/mod/applications/mod_expr/exprilfs.h +++ b/src/mod/applications/mod_expr/exprilfs.h @@ -763,7 +763,7 @@ case EXPR_NODEFUNC_CLAMP: err = exprEvalNode(obj, nodes->data.function.nodes, 1, &d1); if (!err) - err = exprEvalNode(obj, nodes->data.function.nodes, 1, &d2); + err = exprEvalNode(obj, nodes->data.function.nodes, 2, &d2); if (!err) { EXPR_RESET_ERR(); @@ -771,7 +771,7 @@ case EXPR_NODEFUNC_CLAMP: EXPR_CHECK_ERR(); if (tmp < 0.0) - *val = tmp * d2; + *val = tmp + d2; else *val = tmp + d1; } else From bca7216fdda92281a6d773431e2b7bceb7bc0e88 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Thu, 25 Dec 2014 10:38:10 +0000 Subject: [PATCH 89/95] Run dos2unix on mod_expr HTML files --- src/mod/applications/mod_expr/expreval.html | 2668 +++++++++---------- src/mod/applications/mod_expr/exprtmpl.html | 1656 ++++++------ 2 files changed, 2162 insertions(+), 2162 deletions(-) diff --git a/src/mod/applications/mod_expr/expreval.html b/src/mod/applications/mod_expr/expreval.html index f66d327c2d..d6cade26c2 100644 --- a/src/mod/applications/mod_expr/expreval.html +++ b/src/mod/applications/mod_expr/expreval.html @@ -1,1334 +1,1334 @@ - - -ExprEval Library - - - - -
-

ExprEval Library

-
-
- - - -
-

Introduction

-
-

ExprEval Help document. This document is probably full of - bugs and mispellings. I may get around to proofreading - it later.

-

ExprEval is a C based expression evaluation library. - It is entirely C based, but can be used in C++ programs - as well.. The source code is provided for the library - so that it can be recompiled for the specific system - or compiler.

-

ExprEval makes adding mathematical expression support to - an application easy. It takes an expression string and - parses it, and then it can evaluate it over and over. - This library also has support for functions, constants, - and variables. All of these items are stored in - seperate lists so they can be shared among expressions or - they can be private to a single expression or any mix and - match. It is up to the developer how to link them together. - You can also create your own custom functions.

-
-
- -
-

License

-
-

This library is licensed under the - ExprEval License. -

-
-
- -
-

Expression Syntax

-
-

Expressions have pretty much the same syntax as they - would have on paper, with the following exceptions: -

    -
  • Each expression must end with a semicolon. This - is because the expression string can actually - contain multiple expressions. The semicolon is - used to mark the end of the expression.
    - Examples: -
      -
    • 4*x+5;
    • -
    • y=5+2;g=4+6;
    • -
    • y=r*sin(a);x=r*cos(a);
    • -
    -
  • -
  • The asterisk '*' must be used to multiply.
    - Examples: -
      -
    • y=5*6; Valid
    • -
    • g=(x+1)*(x-1); Valid
    • -
    • g=(x+1)(x-1); Invalid
    • -
    -
  • -
-

-

More than one expression may be contained within an expression string. - As shown above, each expression must end with a semicolon, even if - only one expression is in the string. The value of an expression - string is the value of the last expression in the string.
- Examlples: -

    -
  • g=7; Value: 7
  • -
  • k=z+1; Value: z+1
  • -
  • r=4;k=6;o=9+r-k; Value: 9+r-k
  • -
-

-

Some functions may take reference parameters. These parameters are - references to other variables. You can mix reference parameters - with normal parameters. The order of the normal parameters must - remain the same and the order of the reference parameters must - remain the same.
- Examples: -

    -
  • min(1,2,3,4,&mval); &mval is a reference to a variable mval
  • -
  • min(1,2,&mval,3,4); You may mix them inside like this.
  • -
  • min(1,2,(&mval),3,4); You may not nest reference parameters in any way
  • -
-

-

Expressions may also be nested with parenthesis.
- Examples: -

    -
  • y=sin(x-cos(5+max(4,5,6*x)));
  • -
  • 6+(5-2*(x+y));
  • -
-

-

Expressions may also have whitespace characters and comments. - Whitespace characters such as newlines, linefeeds, carriage - returns, spaces, and tabs are ignored. Comments begin with - the pound sign '#' and end at the end of the line.
- Example: -

    -
    -#Set the x value
    -x = d * cos(r);
    -
    -#Set the y value
    -y = d * sin(r);
    -                
    -
-

-

If a variable is used in an expression, but that variable does not exist, - it is considered zero. If it does exist then its value is used instead. -

-
-
- -
-

Using ExprEval in an Application

-
-

Using ExprEval in an application can be a little difficult. - You generally follow these steps: -

    -
  • Create function, variable, and constant lists
  • -
  • Create the expression object
  • -
  • Parse the expression
  • -
  • Evaluate the expression as needed
  • -
  • Free the expression object
  • -
  • Free the function, variable, and constant lists
  • -
- You can manipulate the lists in any order after their creation. - However, functions are translated during the parse, so after - parsing an expression, manipulating the function list will make - no change to an expression. Variables and constants can be - manipulated after a parse to change the result of an expression. - However, you must add any constants to be used by an expression - to the constant list BEFORE parsing the expression, - otherwise it will be seen as a variable. Applications can change - both variables and constants, however the expression can only - change variables. Expressions may NOT assign to a constant - and expressions may NOT use constants as a reference parameter.

-

Function, variable, and constant list example: -

    -
    -exprFuncList *flist;
    -exprValList *vlist;
    -exprValList *clist;
    -exprObj *obj;
    -EXPRTYPE result;
    -int err;
    -
    -/* Create function list */
    -err = exprFuncListCreate(&flist);
    -if(err != EXPR_ERROR_NOERROR)
    -    {
    -    ...
    -    }
    -
    -/* Initialize internal functions */
    -err = exprFuncListInit(flist);
    -if(err != EXPR_ERROR_NOERROR)
    -    {
    -    ...
    -    }
    -
    -/* Create variable list */
    -err = exprValListCreate(&vlist);
    -if(err != EXPR_ERROR_NOERROR)
    -    {
    -    ...
    -    }
    -
    -/* Create the constant list */
    -err = exprValListCreate(&clist);
    -if(err != EXPR_ERROR_NOERROR)
    -    {
    -    ...
    -    }
    -
    -/* Initialize internal constants */
    -err = exprValListInit(clist);
    -if(err != EXPR_ERROR_NOERROR)
    -    {
    -    ...
    -    }
    -
    -/* Add any application defined functions, constants, or variables to the lists here or down below */
    -                
    -
-

-

Expression object example: -

    -
    -err = exprCreate(&obj, flist, vlist, clist, NULL, 0);
    -if(err != EXPR_ERROR_NOERROR)
    -    {
    -    ...
    -    }
    -
    -/* Add any application defined functions, constants, or variables to the lists here or down below.
    -   This is the last time you can for the functions or constants. */
    -                
    -
-

-

Expression parse example: -

    -
    -/* Functions and constants may be added or changed here */
    -
    -err = exprParse(obj, "2+sin(M_PI)+3*x;");
    -if(err != EXPR_ERROR_NOERROR)
    -    {
    -    ...
    -    }
    -
    -/* Changes to the function or constant lists do not change the expression now */
    -                
    -
-

-

Expression evaluation example: -

    -
    -/* Add or change any variables */
    -
    -err = exprEval(obj, &result);
    -if(err != EXPR_ERROR_NOERRO)
    -    {
    -    ...
    -    }
    -else
    -    {
    -    printf("Expression Result: %f\n", result);
    -    }
    -                
    -
-

-

Free the expression object and lists example: -

    -
    -exprFree(obj);
    -exprValListFree(vlist);
    -exprValListFree(clist);
    -exprFuncListFree(flist);
    -                
    -
-

-
-
- -
-

Fast Variable Access

-
-

A new feature in ExprEval is fast variable access. This - is simply a technique of quickly accessing variables - by directly accessing their memory locations instead - of using the value list functions. Fast variable access - is always used internally in ExprEval. You must - NOT clear a variable list until after all expressions - using it are completely finished evaluating. Then you - must reparse the expressions before using them again. - The reason is simple. When fast variable access is used, - the variable memory location is directly accessed If you - clear a variable list and then evaluate an expression, - it will access invalid memory.

-

You can also use fast variable access in you application - to dramatically speed up loops. This is accomplished as - follows: -

    -
  • Add the desired variable to the variable list
  • -
  • Get the address of the variable with exprValListGetAddress
  • -
  • In the loop(s), directly set/get the variable any time needed: *var = 0.0;
  • -
-

-
-
- -
-

Using the Internal Functions and Constants

-
-

To use the internal functions, they must first be initialized - into a function list with exprFuncListInit. To use the - internal constants, they must first be initialized into a - value list with exprValListInit. For a list of the - internal functions and constants, see the application - help template file: ExprTmpl.html - You may use this file in your own applications so you don't - have to write a detail on the functions in ExprEval. All - you have to do is add you own functions and constants to - the file if there are any. -

-
- -
-

Creating Custom Functions

-
-

Custom functions can be created for use by the library. - This is how a function should look -

    -
    -int custom_func(exprObj *obj, exprNode *nodes, int nodecount, EXPRTYPE **refs, int refcount, EXPRTYPE *val)
    -    {
    -    }
    -                
    -
- - obj is a pointer to the expression object that called - the function, nodes is a pointer to an array of nodes - that are the parameters of this function, nodecount is - the number of items in the array (the number of parameters), - refs is an array of pointers to referenced variables, - refcount is the number of referenced variables, - and val is a pointer to a variable to recieve the result - of the function. The function should return an error value - indicating the error status of the function. -

-

Solving a function typically goes as follows: -

    -
  • Verifiy the number of arguments, if needed
  • -
  • Evaluate the subnodes that you need. You do not have to - evaluate every subnode if you do not need it
  • -
  • Check for possible error conditions (division by zero)
  • -
  • Clear math errors (If function uses any math routines)
  • -
  • Calculate the result
  • -
  • Check for math errors (If the function uses any math routines)
  • -
  • return EXPR_ERROR_NOERROR
  • -
-

-

Example: -

    -
    -int custom_func(exprObj *obj, exprNode *nodes, int count, EXPRTYPE **refs, int refcount, EXPRTYPE *val)
    -    {
    -    int err;
    -    EXPRTYPE d1, d2;
    -
    -    /* Need 2 arguments */
    -    if(nodecount != 2)
    -        return EXPR_ERROR_BADNUMBERARGUMENTS;
    -
    -    /* Eval arg 1 */
    -    err = exprEvalNode(obj, nodes, 0, &d1);
    -    if(err != EXPR_ERROR_NOERROR)
    -        return err;
    -
    -    /* Eval arg 2 */
    -    err = exprEvalNode(obj, nodes, 1, &d2);
    -    if(err != EXPR_ERROR_NOERROR)
    -        return err;
    -
    -    /* Make sure arg 2 is not 0.0 */
    -    if(d2 == 0.0)
    -        {
    -        *val = 0.0;
    -        return EXPR_ERROR_NOERROR;
    -        }
    -
    -    /* Do math */
    -    *val = atan(d1 / d2); /* No need to worry about divide by zero */
    -
    -
    -    return EXPR_ERROR_NOERROR;
    -    }
    -                
    -
-

-

In order to use a custom function, it must be added to - a function list before the expression is parsed by using - exprFuncListAdd

-
-
- -
-

Reference

-
-

Headers: -

    -
  • expreval.h - Include file
  • -
-

-

Defines: -

    -
  • EXPR_MAXIDENTSIZE - Maximum identifier, constant, - or function name size
  • -
  • EXPR_ERROR_NOERROR - No error has occurred
  • -
  • EXPR_ERROR_MEMORY - A memory allocation error occured. - For function and value lists, the name may have been - invalid
  • -
  • EXPR_ERROR_NULLPOINTER - A null pointer was passed to - a function that needed a valid pointer.
  • -
  • EXPR_ERROR_NOTFOUND - An item was not found in the - function or value list
  • -
  • EXPR_ERROR_UNMATHEDCOMMENT - Comment is missing opening - or closing mark.
  • -
  • EXPR_ERROR_INVALIDCHAR - Invalid characters were found - in the expression
  • -
  • EXPR_ERROR_ALREADYEXISTS - An item already exists or created.
  • -
  • EXPR_ERROR_ALREADYPARSEDBAD - An expression was already - parsed into this object, but unsuccessfully. Free the - expression before creating and parsing again
  • -
  • EXPR_ERROR_ALREADYPARSEDGOOD - An expression was already - parsed into this object successfully. Free the expression - before creating and parsing again
  • -
  • EXPR_ERROR_EMPTYEXPR - An empty expression string was passed - to be parsed
  • -
  • EXPR_ERROR_UNMATHEDPAREN - Unmathed opening or closing - parenthesis were found
  • -
  • EXPR_ERROR_SYNTAX - A syntax error is in the expression
  • -
  • EXPR_ERROR_MISSINGSEMICOLON - An expression is missing a - semicolon
  • -
  • EXPR_ERROR_BADIDENTIFIER - A bad identifier was used in - the expression
  • -
  • EXPR_ERROR_NOSUCHFUNCTION - Function used in the expression - does not exist in the function list
  • -
  • EXPR_ERROR_BADNUMBERARGUMENTS - A bad number of arguments - was passed to the expression function
  • -
  • EXPR_ERROR_BADEXPR - Can not evaluate an expression because - it does not exist or has not been parsed successfully.
  • -
  • EXPR_ERROR_UNABLETOASSIGN - Unable to do an assignment because - a variable list has not been associated with the expression object
  • -
  • EXPR_ERROR_DIVBYZERO - An attemp to divide by zero has occured
  • -
  • EXPR_ERROR_NOVARLIST - No variable list for the expression
  • -
  • EXPR_ERROR_BREAK - The expression was broken by the break function
  • -
  • EXPR_ERROR_CONSTANTASSIGN - The expresion attempted to assign to a constant.
  • -
  • EXPR_ERROR_REFCONSTANT - The expression attempted to pass a constant as a - reference parameter.
  • -
  • EXPR_ERROR_OUTOFRANGE - A bad value was passed to a function.
  • -
  • EXPR_ERROR_USER - Custom error values need to be larger than this.
  • -
-

-

Objects: -

    -
  • exprObj - The expression object
  • -
  • exprFuncList - A function lists for the expresions
  • -
  • exprValList - A value list for constants or variables
  • -
  • exprNode - An individual node in a parsed expression tree
  • -
-

-

Types: -

    -
  • EXPRTYPE - Type for the value of an expression (double)
  • -
  • exprFuncType - Custom function type. Defined as:
    - typedef int (*exprFuncType)(exprObj *obj, exprNode *nodes, int nodecount, EXPRTYPE **refs, int refcount, EXPRTYPE *val);
  • -
  • exprBreakFuncType - Breaker function pointer to stop evaluation if the result is nonzero. - Defined as:
    - typedef int (*exprBreakFuncType)(exprObj *o);
  • -
-

-

Version information functions: -

    -
  • void exprGetVersion(int *major, int *mino);
    - Comments: -
      -
    • Gets the version of the ExprEval library
    • -
    - Parameters: -
      -
    • *major - Pointer to int to get major version number
    • -
    • *minor - Pointer to int to get minor version number
    • -
    - Returns: -
      -
    • Nothing
    • -
    -
  • -
-

-

Function list functions: -

    -
  • int exprFuncListCreate(exprFuncList **flist);
    - Comments: -
      -
    • Creates a function lists and updates a pointer to point to it
    • -
    - Parameters: -
      -
    • **flist - Pointer to a pointer to the function list
    • -
    - Returns -
      -
    • Error code of the function. On success, the pointer - passed by address will point to the new function list
    • -
    -

  • -
  • int exprFuncListAdd(exprFuncList *flist, exprFuncType ptr, char *name, int min, int max, int refmin, int refmax);
    - Comments: -
      -
    • Adds a function to the function list. Returns error if - the function already exists.
    • -
    - Parameters: -
      -
    • *flist - Pointer to an already created function list
    • -
    • ptr - Pointer to a custom function
    • -
    • *name - Name of the custom function
    • -
    • min - Minimum number of arguments for the function, negative for no minimum
    • -
    • max - Maximum number of arguments for the function, negative for no maximum
    • -
    • refmin - Minimum number of ref arguments
    • -
    • refmax - Maxmimum number of ref arguments
    • -
    - Returns: -
      -
    • Error code of the function
    • -
    -

  • -
  • int exprFuncListFree(exprFuncList *flist);
    - Comments: -
      -
    • Free the function list entirely
    • -
    - Parameters: -
      -
    • *flist - Pointer to the function list to free
    • -
    - Returns: -
      -
    • Error code of the function
    • -
    -

  • -
  • int exprFuncListClear(exprFuncList *flist);
    - Comments: -
      -
    • Clear the functions from the function list
    • -
    - Parameters: -
      -
    • *flist - Pointer to the function list to clear
    • -
    - Returns: -
      -
    • Error code of the function
    • -
    -

  • -
  • int exprFuncListInit(exprFuncList *flist);
    - Comments: -
      -
    • Initializes internal functions into the funtion list
    • -
    - Parameters: -
      -
    • *flist - Function list to initialize
    • -
    - Returns: -
      -
    • Error code of the function
    • -
    -
  • -
-

-

Value list functions: -

    -
  • int exprValListCreate(exprValList **vlist);
    - Comments: -
      -
    • Creates a value list for variables or constants
    • -
    - Parameters: -
      -
    • **vlist - Pointer to a pointer to the value list.
    • -
    - Returns: -
      -
    • Error code of the function. On success, the pointer will - be updated to point to the value list
    • -
    -

  • -
  • int exprValListAdd(exprValList *vlist, char *name, EXPRTYPE val);
    - Comments: -
      -
    • Add a value in a value list. Returns error if value - already exists.
    • -
    - Parameters: -
      -
    • *vlist - Value list to add a value to
    • -
    • *name - Name of the value to add
    • -
    • val - Value of the value to add
    • -
    - Returns: -
      -
    • Error code of the function
    • -
    -

  • -
  • int exprValListSet(exprValList *vlist, char *name, EXPRTYPE val);
    - Comments: -
      -
    • Set a value in a value list.
    • -
    - Parameters: -
      -
    • *vlist - Value list to set a value in
    • -
    • *name - Name of the value to set
    • -
    • val - Value of the value to set
    • -
    - Returns: -
      -
    • Error code of the function
    • -
    -

  • -
  • int exprValListGet(exprValList *vlist, char *name, EXPRTYPE *val)
    - Comment: -
      -
    • Get the value of a variable or constant in a value list
    • -
    - Parameters: -
      -
    • *vlist - Value list to use
    • -
    • *name - Name of the value to get
    • -
    • *val - Pointer to variable to get the value
    • -
    - Returns: -
      -
    • Error code of the function
    • -
    -

  • -
  • int exprValListAddAddress(exprValList *vlist, char *name, EXPRTYPE *addr)
    - Comment: -
      -
    • This function is used to add a named value to the value list, but - uses an outside variable such as a stack variable to store the - value. This outside variable is used to set/get the value instead - of the internal list value. You must ensure that this outside - variable exists as long as the expression is using it's address.
    • -
    - Parameters: -
      -
    • *vlist - Value list to use
    • -
    • *name - Name of the value to add
    • -
    • *addr - Address of the value being added
    • -
    - Returns: -
      -
    • Error code of the function
    • -
    -

  • -
  • int exprValListGetAddress(exprValList *vlist, char *name, EXPRTYPE **addr)
    - Comment: -
      -
    • Get the memory address of a variable in a value list
    • -
    - Parameters: -
      -
    • *vlist - Value list to use
    • -
    • *name - Name of the value to get
    • -
    • **addr - Pointer to a pointer to store the address of the value - This will be NULL if the name is not in the list.
    • -
    - Returns: -
      -
    • Error code of the function
    • -
    -

  • -
  • void *exprValListGetNext(exprValList *vlist, char **name, EXPRTYPE *value, EXPRTYPE** addr, void *cookie);
    - Comment: -
      -
    • This is used to enumerate the items in the value list. - Do NOT change the list while enumerating the items. Any - of the information items can be NULL if it is not needed.
    • -
    - Parameters: -
      -
    • *vlist - Value list to use
    • -
    • **name - Address of a pointer that will point to the - name. Do not edit the name.
    • -
    • *value - The current value of the item.
    • -
    • **addr - Address of a pointer to store the address of the value.
    • -
    • *cookie - NULL to find the first item, the return value to find - subsequent items.
    • -
    - Returns: -
      -
    • NULL if the item could not be found. Otherwise a cookie - to be used to find additional items.
    • -
    -

  • -
  • int exprValListFree(exprValList *vlist);
    - Comments: -
      -
    • Completely free the value list
    • -
    - Parameters: -
      -
    • *vlist - Value list to free
    • -
    - Returns: -
      -
    • Error code of the function
    • -
    -

  • -
  • int exprValListClear(exprValList *vlist);
    - Comments: -
      -
    • Set the values in the list to 0.0
    • -
    - Parameters: -
      -
    • *vlist - Value list to reset
    • -
    - Returns: -
      -
    • Error code of the function
    • -
    -

  • -
  • int exprValListInit(exprValList *vlist);
    - Comments: -
      -
    • Initialize internal constants into a value list
    • -
    - Paramters: -
      -
    • *vlist - Value list to initialize
    • -
    - Returns: -
      -
    • Error code of the function
    • -
    -
  • -
-

-

Expression functions: -

    -
  • int exprCreate(exprObj **obj, exprFuncList *flist, exprValList *vlist, exprValList *clist, exprBreakFuncType breaker, void *userdata);
    - Comments: -
      -
    • Create an expression object to use
    • -
    - Parameters: -
      -
    • **obj - Pointer to a pointer to an expression object
    • -
    • *flist - Function list to associate with the expression
    • -
    • *vlist - Variable value list to associate with the expression
    • -
    • *clist - Constant value list to associate with the expression
    • -
    • breaker - Breaker function callback to associate with the expression. - Used by functions that may be infinite loops (such as the for function)
    • -
    • userdata - User data to associate with the expression
    • -
    - Returns: -
      -
    • Error code of the function
    • -
    -

  • -
  • int exprFree(exprObj *obj);
    - Comments: -
      -
    • Completely free the expression object
    • -
    - Paramters: -
      -
    • *obj - Expression object to free
    • -
    - Returns: -
      -
    • Error code of the function
    • -
    -

  • -
  • int exprClear(exprObj *obj);
    - Comments: -
      -
    • Clear an expression, but keep list and callback associations. - You can then parse another expression without calling create
    • -
    - Parameters: -
      -
    • *obj - Expression object to clear
    • -
    - Returns: -
      -
    • Error code of the function
    • -
    -

  • -
  • int exprParse(exprObj *obj, char *expr);
    - Comments: -
      -
    • Parse an expression string into an expression object
    • -
    - Paramters: -
      -
    • *obj - Expression object to use
    • -
    • *expr - Expression string to parse
    • -
    - Returns: -
      -
    • Error code of the function
    • -
    -

  • -
  • int exprEval(exprObj *obj, EXPRTYPE *val);
    - Comments: -
      -
    • Evaluate a parsed expression. This function does not - reset the breaker count at each call, but instead accumulates - the count until the breaker function is called. Then the count - is reset to the value specified in exprSetBreakerCount.
    • -
    - Paramters: -
      -
    • *obj - Expression object to evaluate
    • -
    • *val = Pointer to variable to get result of evaluation. - This can be NULL if the result is not needed.
    • -
    - Returns: -
      -
    • Error code of the function
    • -
    -

  • -
  • int exprEvalNode(exprObj *obj, exprNode *nodes, int curnode, EXPRTYPE *val);
    - Comments: -
      -
    • Evaluate a node of an expression. - Used by custom functions
    • -
    - Parameters: -
      -
    • *obj - Expression object being used
    • -
    • *nodes - Pointer to a node or list of nodes
    • -
    • curnode - Index to the node to evaluate
    • -
    • *val - Pointer to variable to get evaluation result
    • -
    - Returns: -
      -
    • Error code of the function
    • -
    -

  • -
  • exprFuncList *exprGetFuncList(exprObj *obj);
    - Comments: -
      -
    • Gets the function list associated with an expression
    • -
    - Parameters: -
      -
    • *obj - expression object
    • -
    - Returns: -
      -
    • Pointer fo an exprFuncList object or NULL
    • -
    -

  • -
  • exprValList *exprGetVarList(exprObj *obj);
    - Comments: -
      -
    • Gets the variable list associated with an expression
    • -
    - Parameters: -
      -
    • *obj - expression object
    • -
    - Returns: -
      -
    • Pointer to an exprValList object or NULL
    • -
    -

  • -
  • exprValList *exprGetConstList(exprObj *obj);
    - Comments: -
      -
    • Gets the constant list associated with an expression
    • -
    - Parameters: -
      -
    • *obj - expression object
    • -
    - Returns: -
      -
    • Pointer to an exprValList object or NULL
    • -
    -

  • -
  • exprBreakFuncType exprGetBreakFunc(exprObj *obj);
    - Comments: -
      -
    • Gets the breaker callback of the expression
    • -
    - Parameters: -
      -
    • *obj - expression object
    • -
    - Returns: -
      -
    • Pointer to the callback function or NULL
    • -
    -

  • -
  • int exprGetBreakResult(exprObj *obj);
    - Comments: -
      -
    • Get the result of the breaker function
    • -
    - Parameters: -
      -
    • *obj - expression object
    • -
    - Returns: -
      -
    • zero to continue, nonzero to break
    • -
    -

  • -
  • void* exprGetUserData(exprObj *obj);
    - Comments: -
      -
    • Gets the user data associated with an expression
    • -
    - Parameters: -
      -
    • *obj - expression object
    • -
    - Returns: -
      -
    • User data
    • -
    -

  • -
  • void exprSetUserData(exprObj *obj, void *userdata);
    - Comments: -
      -
    • Sets the user data of an expression
    • -
    - Parameters: -
      -
    • *obj - expresion object
    • -
    • userdata - user data to set
    • -
    - Returns: -
      -
    • Nothing
    • -
    -

  • -
  • void exprSetBreakCount(exprObj *obj, int count);
    - Comments: -
      -
    • Set how often the breaker function is tested. - The default is 100000. This means the breaker - function is tested once every 100000 times the - exprEvalNode function is called for an expression. - A smaller value tests the breaker function more often - and a larger value tests the breaker function less. The - breaker value is NOT reset during each call to exprEval, - but is accumulated across calles to exprEval - until the breaker function is finally called.
    • -
    - Parameters: -
      -
    • *obj - expression object
    • -
    • count - how many times exprEvalNode gets called before the - breaker function is tested
    • -
    - Returns: -
      -
    • Nothing
    • -
    -

  • -
  • void exprGetErrorPosition(exprObj *obj, int *start, int *end);
    - Comments: -
      -
    • Gets the start and ending positions in the expression string - of the last parse error. The positions include any newline - characters that may be in the string.
    • -
    - Parameters: -
      -
    • *obj - expression object
    • -
    • *start - pointer to an integer to get the start error position, - -1 if unknown
    • -
    • *end - pointer to an integer to get the end error position, - -1 if unknown
    • -
    - Returns: -
      -
    • Nothing
    • -
    -
-

-

Some useful functions -

    -
  • int exprValidIdent(char *name);
    - Comments: -
      -
    • Determine if an identifier is valid
    • -
    - Parameters: -
      -
    • *name - identifier to check
    • -
    - Returns: -
      -
    • 0 on invalid. anything else on valid
    • -
    -

  • -
-

-
-
- -
-

Compiling the ExprEval library

-

Compiling the ExprEval library is pretty simple. Just - compile all of the source files (*.c) and link them into - a library. You need to keep "expreval.h" for the header file.

-

You may have to make some changes to the library. I've - tried to make doing so as simple as possible. If you - need to change the include files or some macros or whatnot, - edit the file "exprincl.h" This file includes any other files - needed. You should not have to change to much. I have - tried to stick as close to ANSI/ISO C as I can.

-
- -
-

Drawbacks/Problems

-

The following is a list of some basic drawbacks of this - library: -

    -
  • This library is an expression evaluator, and nothing - else. It does not simplify expressions and it - does not do advanced math such as calculating the - integrals and differentials of expression.
  • -
  • This library has no way of detecting overflows - except for those caused by the internal math - routines. Adding two very very large numbers - may cause an overflow to occur.
  • -
  • This library is not super easy to use in an application. - It has been designed to give much control to the - developer. Because of this, the function/value lists - are seperate from the expression objects, allowing - the developer to use them however they need.
  • -
  • There is no way to delete a single function, variable, - or constant from a list. This is because I see no - real need to do so because of the way the library - works. There is no need to delete function from - a function list or constants from a constant list. - There are are also no decent reasons to delete - variables from a variable list until you are completely - done and delete all of them.
  • -
-

-
- -
-

Problems and Solutions

- -
    -
  • Variables do not seem to change in a release/optimized build.
    - I have noticed a small problem with this. Rarely, a variable may not - appear to change in a release build. The reason is to do with compiler - optimizations. For example, look at the following code: -
    -
    -EXPRTYPE k;
    -
    -/* Add variable to the list */
    -exprValListAddAddress(list, "k", &k);
    -
    -k = 0.0;
    -
    -/* Evaluate expression */
    -for(int x = 0; x < 100; x++)
    -    {
    -    exprEval(expr, &result);
    -    
    -    doSomething(k);
    -    }
    -                
    -
    - Inside the loop, the variable 'k' does not appear to be changing, so - the compiler may optimize it by loading it into a register before the - loop and not accessing it from memory during the loop, even if - the expression does change it. One way to avoid this is to use the - 'volatile' keyword with the variable. Then the compiler must - accesss it from memory each time it is accessed. -
    -
    -volatile EXPRTYPE k;
    -
    -/* Add variable to the list */
    -exprValListAddAddress(list, "k", (EXPRTYPE*)&k);
    -
    -k = 0.0;
    -
    -/* Evaluate expression */
    -for(int x = 0; x < 100; x++)
    -    {
    -    exprEval(expr, &result);
    -    
    -    doSomething(k);
    -    }
    -                
    -
    -
  • - -
- -
-

Example Use with Fast Variable Access

- -

This is an example application of this library. It is a - graphics program that calculates the color value of a - pixel based on it's X,Y co-ordinate. It uses a made-up - image library called graphic-lib. It uses faster variable - access by using the exprValListGetAddress function.

-

Note that this codes has not actually been tested. See the - test applications (test and imagegen) for other examples.

- -
-
-/* Include files */
-#include <stdio.h>
-#include <stdlib.h>
-#include <setjmp.h>
-#include "graphiclib.h"
-#include "expreval.h"
-
-char *transerr(int err)
-    {
-    /* Translate error code into message */
-    }
-
-void gen_image(char *name, int w, int h, char *expr);
-    {
-    exprFuncList *f = NULL;
-    exprValList *v = NULL;
-    exprValList *c = NULL;
-    exprObj *o = NULL;
-    int x, y, err;
-    jmp_buf jumper;
-    int image;
-    EXPRTYPE *v_x, *v_y;
-    EXPRTYPE *v_r, *v_g, *v_b;
-    EXPRTYPE global_value;
-
-    /* Error handling */
-    err = setjmp(jumper);
-    if(err)
-        {
-        if(err != ID_IMAGENOERROR)
-            printf("Error %d occurred: %s\n", err, transerr(err));
-
-        exprFree(o);
-        exprFreeFuncList(f);
-        exprFreeValList(v);
-        exprFreeValList(c);
-
-        image_free(image);
-        return;
-        }
-
-    /* Set up lists */
-
-    /* Function list */
-    err = exprFuncListCreate(&f);
-    if(err != EXPR_ERROR_NOERROR)
-        longjmp(jumper, err);
-
-    err = exprFuncListInit(f);
-    if(err != EXPR_ERROR_NOERROR)
-        {
-        printf("Function list init error. Functions may not be available.\n");
-        }
-
-    /* Variable list */
-    err = exprValListCreate(&v);
-    if(err != EXPR_ERROR_NOERROR)
-        longjmp(jumper, err);
-
-    /* Constant list */
-    err = exprValListCreate(&c);
-    if(err != EXPR_ERROR_NOERROR)
-        {
-        printf("Constants not available\n");
-        }
-    else
-        {
-        err = exprValListInit(c);
-        if(err != EXPR_ERROR_NOERROR)
-            printf("Constant list init error. Constants may not be available.\n");
-        }
-
-    /* Create and parse the expression */
-
-    /* Create */
-    err = exprCreate(&o, f, v, c, NULL, 0);
-    if(err != EXPR_ERROR_NOERROR)
-        longjmp(jumper, err);
-
-    /* Parse expression */
-    err = exprParse(o, expr);
-    if(err != EXPR_ERROR_NOERROR)
-        longjmp(jumper, err);
-
-
-    /* Create the image */
-    image = image_create(w, h);
-    if(image == 0)
-        {
-        longjmp(jumper, ID_IMAGECREATEERROR);
-        }
-
-    /* Add width and height to variable list */
-    exprValListAdd(v, "w", (EXPRTYPE)w);
-    exprValListAdd(v, "h", (EXPRTYPE)h);
-
-    /* Add x and y to the list */
-    exprValListAdd(v, "x", 0.0);
-    exprValListAdd(v, "y", 0.0);
-
-    /* Add r, g, and b to the list */
-    exprValListAdd(v, "r", 0.0);
-    exprValListAdd(v, "g", 0.0);
-    exprValListAdd(b, "b", 0.0);
-
-    /* Get addresses.  Assume no error */
-    exprValListGetAddress(v, "x", &v_x);
-    exprValListGetAddress(v, "y", &v_y);
-
-    exprValListGetAddress(v, "r", &v_r);
-    exprValListGetAddress(v, "g", &v_g);
-    exprValListGetAddress(v, "g", &v_b);
-    
-    /* A way to add global variables that can be used by two different lists. */
-    exprValListAddAddress(v, "global", &global_value);
-    /* exprValListAddAddress(v2, "global", &global_value); */
-    
-    /* Also, exprValListAddAddress can be used to add variables directly.
-       Instead of:
-       
-       EXPRTYPE *a;
-       
-       exprValListAdd(v, "a", 0.0);
-       exprValListGetAddresss(v, "a", &a);
-       
-       You can do:
-       
-       EXPRTYPE a;
-       
-       exprValListAddAddresss(v, "a", &a);
-       
-       If you do this, you must ensure that the stack variable exists as long
-       as it is used by expression, otherwise it may cause a memory access
-       violation. */
-    
-
-    for(y = 0; y < h; y++)
-        {
-        for(x = 0; x < w; x++)
-            {
-            /* Directly set the x and y variables */
-            *v_x = (EXPRTYPE)x;
-            *v_y = (EXPRTYPE)y;
-
-            /* Eval expression, ignoring errors */
-            exprEval(o);
-
-            /* Set pixel, using variables directly */
-            image_setpixel(image, x, y, (int)(*v_r), (int)(*v_g), (int)(*v_b));
-            }
-        }
-
-    /* Save image */
-    image_save(image, name);
-
-    /* Done */
-    longjmp(jumper, ID_IMAGENOERROR);
-    }
-
-void main(void)
-    {
-    char name[MAXPATH]
-    char tmp[10];
-    char expr[4096];
-    int sx, sy;
-
-    printf("Image name to save: ");
-    gets(name);
-
-    printf("Image width: ");
-    gets(tmp);
-    sx = atoi(tmp);
-
-    printf("Image height: ");
-    gets(tmp);
-    sy = atoi(tmp);
-
-    printf("Color Expression (Use x, y, w, h Set r, g, b): ");
-    gets(expr);
-
-    gen_image(name, sx, sy, expr);
-    }
-
-        
-
-
- - - + + +ExprEval Library + + + + +
+

ExprEval Library

+
+
+ + + +
+

Introduction

+
+

ExprEval Help document. This document is probably full of + bugs and mispellings. I may get around to proofreading + it later.

+

ExprEval is a C based expression evaluation library. + It is entirely C based, but can be used in C++ programs + as well.. The source code is provided for the library + so that it can be recompiled for the specific system + or compiler.

+

ExprEval makes adding mathematical expression support to + an application easy. It takes an expression string and + parses it, and then it can evaluate it over and over. + This library also has support for functions, constants, + and variables. All of these items are stored in + seperate lists so they can be shared among expressions or + they can be private to a single expression or any mix and + match. It is up to the developer how to link them together. + You can also create your own custom functions.

+
+
+ +
+

License

+
+

This library is licensed under the + ExprEval License. +

+
+
+ +
+

Expression Syntax

+
+

Expressions have pretty much the same syntax as they + would have on paper, with the following exceptions: +

    +
  • Each expression must end with a semicolon. This + is because the expression string can actually + contain multiple expressions. The semicolon is + used to mark the end of the expression.
    + Examples: +
      +
    • 4*x+5;
    • +
    • y=5+2;g=4+6;
    • +
    • y=r*sin(a);x=r*cos(a);
    • +
    +
  • +
  • The asterisk '*' must be used to multiply.
    + Examples: +
      +
    • y=5*6; Valid
    • +
    • g=(x+1)*(x-1); Valid
    • +
    • g=(x+1)(x-1); Invalid
    • +
    +
  • +
+

+

More than one expression may be contained within an expression string. + As shown above, each expression must end with a semicolon, even if + only one expression is in the string. The value of an expression + string is the value of the last expression in the string.
+ Examlples: +

    +
  • g=7; Value: 7
  • +
  • k=z+1; Value: z+1
  • +
  • r=4;k=6;o=9+r-k; Value: 9+r-k
  • +
+

+

Some functions may take reference parameters. These parameters are + references to other variables. You can mix reference parameters + with normal parameters. The order of the normal parameters must + remain the same and the order of the reference parameters must + remain the same.
+ Examples: +

    +
  • min(1,2,3,4,&mval); &mval is a reference to a variable mval
  • +
  • min(1,2,&mval,3,4); You may mix them inside like this.
  • +
  • min(1,2,(&mval),3,4); You may not nest reference parameters in any way
  • +
+

+

Expressions may also be nested with parenthesis.
+ Examples: +

    +
  • y=sin(x-cos(5+max(4,5,6*x)));
  • +
  • 6+(5-2*(x+y));
  • +
+

+

Expressions may also have whitespace characters and comments. + Whitespace characters such as newlines, linefeeds, carriage + returns, spaces, and tabs are ignored. Comments begin with + the pound sign '#' and end at the end of the line.
+ Example: +

    +
    +#Set the x value
    +x = d * cos(r);
    +
    +#Set the y value
    +y = d * sin(r);
    +                
    +
+

+

If a variable is used in an expression, but that variable does not exist, + it is considered zero. If it does exist then its value is used instead. +

+
+
+ +
+

Using ExprEval in an Application

+
+

Using ExprEval in an application can be a little difficult. + You generally follow these steps: +

    +
  • Create function, variable, and constant lists
  • +
  • Create the expression object
  • +
  • Parse the expression
  • +
  • Evaluate the expression as needed
  • +
  • Free the expression object
  • +
  • Free the function, variable, and constant lists
  • +
+ You can manipulate the lists in any order after their creation. + However, functions are translated during the parse, so after + parsing an expression, manipulating the function list will make + no change to an expression. Variables and constants can be + manipulated after a parse to change the result of an expression. + However, you must add any constants to be used by an expression + to the constant list BEFORE parsing the expression, + otherwise it will be seen as a variable. Applications can change + both variables and constants, however the expression can only + change variables. Expressions may NOT assign to a constant + and expressions may NOT use constants as a reference parameter.

+

Function, variable, and constant list example: +

    +
    +exprFuncList *flist;
    +exprValList *vlist;
    +exprValList *clist;
    +exprObj *obj;
    +EXPRTYPE result;
    +int err;
    +
    +/* Create function list */
    +err = exprFuncListCreate(&flist);
    +if(err != EXPR_ERROR_NOERROR)
    +    {
    +    ...
    +    }
    +
    +/* Initialize internal functions */
    +err = exprFuncListInit(flist);
    +if(err != EXPR_ERROR_NOERROR)
    +    {
    +    ...
    +    }
    +
    +/* Create variable list */
    +err = exprValListCreate(&vlist);
    +if(err != EXPR_ERROR_NOERROR)
    +    {
    +    ...
    +    }
    +
    +/* Create the constant list */
    +err = exprValListCreate(&clist);
    +if(err != EXPR_ERROR_NOERROR)
    +    {
    +    ...
    +    }
    +
    +/* Initialize internal constants */
    +err = exprValListInit(clist);
    +if(err != EXPR_ERROR_NOERROR)
    +    {
    +    ...
    +    }
    +
    +/* Add any application defined functions, constants, or variables to the lists here or down below */
    +                
    +
+

+

Expression object example: +

    +
    +err = exprCreate(&obj, flist, vlist, clist, NULL, 0);
    +if(err != EXPR_ERROR_NOERROR)
    +    {
    +    ...
    +    }
    +
    +/* Add any application defined functions, constants, or variables to the lists here or down below.
    +   This is the last time you can for the functions or constants. */
    +                
    +
+

+

Expression parse example: +

    +
    +/* Functions and constants may be added or changed here */
    +
    +err = exprParse(obj, "2+sin(M_PI)+3*x;");
    +if(err != EXPR_ERROR_NOERROR)
    +    {
    +    ...
    +    }
    +
    +/* Changes to the function or constant lists do not change the expression now */
    +                
    +
+

+

Expression evaluation example: +

    +
    +/* Add or change any variables */
    +
    +err = exprEval(obj, &result);
    +if(err != EXPR_ERROR_NOERRO)
    +    {
    +    ...
    +    }
    +else
    +    {
    +    printf("Expression Result: %f\n", result);
    +    }
    +                
    +
+

+

Free the expression object and lists example: +

    +
    +exprFree(obj);
    +exprValListFree(vlist);
    +exprValListFree(clist);
    +exprFuncListFree(flist);
    +                
    +
+

+
+
+ +
+

Fast Variable Access

+
+

A new feature in ExprEval is fast variable access. This + is simply a technique of quickly accessing variables + by directly accessing their memory locations instead + of using the value list functions. Fast variable access + is always used internally in ExprEval. You must + NOT clear a variable list until after all expressions + using it are completely finished evaluating. Then you + must reparse the expressions before using them again. + The reason is simple. When fast variable access is used, + the variable memory location is directly accessed If you + clear a variable list and then evaluate an expression, + it will access invalid memory.

+

You can also use fast variable access in you application + to dramatically speed up loops. This is accomplished as + follows: +

    +
  • Add the desired variable to the variable list
  • +
  • Get the address of the variable with exprValListGetAddress
  • +
  • In the loop(s), directly set/get the variable any time needed: *var = 0.0;
  • +
+

+
+
+ +
+

Using the Internal Functions and Constants

+
+

To use the internal functions, they must first be initialized + into a function list with exprFuncListInit. To use the + internal constants, they must first be initialized into a + value list with exprValListInit. For a list of the + internal functions and constants, see the application + help template file: ExprTmpl.html + You may use this file in your own applications so you don't + have to write a detail on the functions in ExprEval. All + you have to do is add you own functions and constants to + the file if there are any. +

+
+ +
+

Creating Custom Functions

+
+

Custom functions can be created for use by the library. + This is how a function should look +

    +
    +int custom_func(exprObj *obj, exprNode *nodes, int nodecount, EXPRTYPE **refs, int refcount, EXPRTYPE *val)
    +    {
    +    }
    +                
    +
+ + obj is a pointer to the expression object that called + the function, nodes is a pointer to an array of nodes + that are the parameters of this function, nodecount is + the number of items in the array (the number of parameters), + refs is an array of pointers to referenced variables, + refcount is the number of referenced variables, + and val is a pointer to a variable to recieve the result + of the function. The function should return an error value + indicating the error status of the function. +

+

Solving a function typically goes as follows: +

    +
  • Verifiy the number of arguments, if needed
  • +
  • Evaluate the subnodes that you need. You do not have to + evaluate every subnode if you do not need it
  • +
  • Check for possible error conditions (division by zero)
  • +
  • Clear math errors (If function uses any math routines)
  • +
  • Calculate the result
  • +
  • Check for math errors (If the function uses any math routines)
  • +
  • return EXPR_ERROR_NOERROR
  • +
+

+

Example: +

    +
    +int custom_func(exprObj *obj, exprNode *nodes, int count, EXPRTYPE **refs, int refcount, EXPRTYPE *val)
    +    {
    +    int err;
    +    EXPRTYPE d1, d2;
    +
    +    /* Need 2 arguments */
    +    if(nodecount != 2)
    +        return EXPR_ERROR_BADNUMBERARGUMENTS;
    +
    +    /* Eval arg 1 */
    +    err = exprEvalNode(obj, nodes, 0, &d1);
    +    if(err != EXPR_ERROR_NOERROR)
    +        return err;
    +
    +    /* Eval arg 2 */
    +    err = exprEvalNode(obj, nodes, 1, &d2);
    +    if(err != EXPR_ERROR_NOERROR)
    +        return err;
    +
    +    /* Make sure arg 2 is not 0.0 */
    +    if(d2 == 0.0)
    +        {
    +        *val = 0.0;
    +        return EXPR_ERROR_NOERROR;
    +        }
    +
    +    /* Do math */
    +    *val = atan(d1 / d2); /* No need to worry about divide by zero */
    +
    +
    +    return EXPR_ERROR_NOERROR;
    +    }
    +                
    +
+

+

In order to use a custom function, it must be added to + a function list before the expression is parsed by using + exprFuncListAdd

+
+
+ +
+

Reference

+
+

Headers: +

    +
  • expreval.h - Include file
  • +
+

+

Defines: +

    +
  • EXPR_MAXIDENTSIZE - Maximum identifier, constant, + or function name size
  • +
  • EXPR_ERROR_NOERROR - No error has occurred
  • +
  • EXPR_ERROR_MEMORY - A memory allocation error occured. + For function and value lists, the name may have been + invalid
  • +
  • EXPR_ERROR_NULLPOINTER - A null pointer was passed to + a function that needed a valid pointer.
  • +
  • EXPR_ERROR_NOTFOUND - An item was not found in the + function or value list
  • +
  • EXPR_ERROR_UNMATHEDCOMMENT - Comment is missing opening + or closing mark.
  • +
  • EXPR_ERROR_INVALIDCHAR - Invalid characters were found + in the expression
  • +
  • EXPR_ERROR_ALREADYEXISTS - An item already exists or created.
  • +
  • EXPR_ERROR_ALREADYPARSEDBAD - An expression was already + parsed into this object, but unsuccessfully. Free the + expression before creating and parsing again
  • +
  • EXPR_ERROR_ALREADYPARSEDGOOD - An expression was already + parsed into this object successfully. Free the expression + before creating and parsing again
  • +
  • EXPR_ERROR_EMPTYEXPR - An empty expression string was passed + to be parsed
  • +
  • EXPR_ERROR_UNMATHEDPAREN - Unmathed opening or closing + parenthesis were found
  • +
  • EXPR_ERROR_SYNTAX - A syntax error is in the expression
  • +
  • EXPR_ERROR_MISSINGSEMICOLON - An expression is missing a + semicolon
  • +
  • EXPR_ERROR_BADIDENTIFIER - A bad identifier was used in + the expression
  • +
  • EXPR_ERROR_NOSUCHFUNCTION - Function used in the expression + does not exist in the function list
  • +
  • EXPR_ERROR_BADNUMBERARGUMENTS - A bad number of arguments + was passed to the expression function
  • +
  • EXPR_ERROR_BADEXPR - Can not evaluate an expression because + it does not exist or has not been parsed successfully.
  • +
  • EXPR_ERROR_UNABLETOASSIGN - Unable to do an assignment because + a variable list has not been associated with the expression object
  • +
  • EXPR_ERROR_DIVBYZERO - An attemp to divide by zero has occured
  • +
  • EXPR_ERROR_NOVARLIST - No variable list for the expression
  • +
  • EXPR_ERROR_BREAK - The expression was broken by the break function
  • +
  • EXPR_ERROR_CONSTANTASSIGN - The expresion attempted to assign to a constant.
  • +
  • EXPR_ERROR_REFCONSTANT - The expression attempted to pass a constant as a + reference parameter.
  • +
  • EXPR_ERROR_OUTOFRANGE - A bad value was passed to a function.
  • +
  • EXPR_ERROR_USER - Custom error values need to be larger than this.
  • +
+

+

Objects: +

    +
  • exprObj - The expression object
  • +
  • exprFuncList - A function lists for the expresions
  • +
  • exprValList - A value list for constants or variables
  • +
  • exprNode - An individual node in a parsed expression tree
  • +
+

+

Types: +

    +
  • EXPRTYPE - Type for the value of an expression (double)
  • +
  • exprFuncType - Custom function type. Defined as:
    + typedef int (*exprFuncType)(exprObj *obj, exprNode *nodes, int nodecount, EXPRTYPE **refs, int refcount, EXPRTYPE *val);
  • +
  • exprBreakFuncType - Breaker function pointer to stop evaluation if the result is nonzero. + Defined as:
    + typedef int (*exprBreakFuncType)(exprObj *o);
  • +
+

+

Version information functions: +

    +
  • void exprGetVersion(int *major, int *mino);
    + Comments: +
      +
    • Gets the version of the ExprEval library
    • +
    + Parameters: +
      +
    • *major - Pointer to int to get major version number
    • +
    • *minor - Pointer to int to get minor version number
    • +
    + Returns: +
      +
    • Nothing
    • +
    +
  • +
+

+

Function list functions: +

    +
  • int exprFuncListCreate(exprFuncList **flist);
    + Comments: +
      +
    • Creates a function lists and updates a pointer to point to it
    • +
    + Parameters: +
      +
    • **flist - Pointer to a pointer to the function list
    • +
    + Returns +
      +
    • Error code of the function. On success, the pointer + passed by address will point to the new function list
    • +
    +

  • +
  • int exprFuncListAdd(exprFuncList *flist, exprFuncType ptr, char *name, int min, int max, int refmin, int refmax);
    + Comments: +
      +
    • Adds a function to the function list. Returns error if + the function already exists.
    • +
    + Parameters: +
      +
    • *flist - Pointer to an already created function list
    • +
    • ptr - Pointer to a custom function
    • +
    • *name - Name of the custom function
    • +
    • min - Minimum number of arguments for the function, negative for no minimum
    • +
    • max - Maximum number of arguments for the function, negative for no maximum
    • +
    • refmin - Minimum number of ref arguments
    • +
    • refmax - Maxmimum number of ref arguments
    • +
    + Returns: +
      +
    • Error code of the function
    • +
    +

  • +
  • int exprFuncListFree(exprFuncList *flist);
    + Comments: +
      +
    • Free the function list entirely
    • +
    + Parameters: +
      +
    • *flist - Pointer to the function list to free
    • +
    + Returns: +
      +
    • Error code of the function
    • +
    +

  • +
  • int exprFuncListClear(exprFuncList *flist);
    + Comments: +
      +
    • Clear the functions from the function list
    • +
    + Parameters: +
      +
    • *flist - Pointer to the function list to clear
    • +
    + Returns: +
      +
    • Error code of the function
    • +
    +

  • +
  • int exprFuncListInit(exprFuncList *flist);
    + Comments: +
      +
    • Initializes internal functions into the funtion list
    • +
    + Parameters: +
      +
    • *flist - Function list to initialize
    • +
    + Returns: +
      +
    • Error code of the function
    • +
    +
  • +
+

+

Value list functions: +

    +
  • int exprValListCreate(exprValList **vlist);
    + Comments: +
      +
    • Creates a value list for variables or constants
    • +
    + Parameters: +
      +
    • **vlist - Pointer to a pointer to the value list.
    • +
    + Returns: +
      +
    • Error code of the function. On success, the pointer will + be updated to point to the value list
    • +
    +

  • +
  • int exprValListAdd(exprValList *vlist, char *name, EXPRTYPE val);
    + Comments: +
      +
    • Add a value in a value list. Returns error if value + already exists.
    • +
    + Parameters: +
      +
    • *vlist - Value list to add a value to
    • +
    • *name - Name of the value to add
    • +
    • val - Value of the value to add
    • +
    + Returns: +
      +
    • Error code of the function
    • +
    +

  • +
  • int exprValListSet(exprValList *vlist, char *name, EXPRTYPE val);
    + Comments: +
      +
    • Set a value in a value list.
    • +
    + Parameters: +
      +
    • *vlist - Value list to set a value in
    • +
    • *name - Name of the value to set
    • +
    • val - Value of the value to set
    • +
    + Returns: +
      +
    • Error code of the function
    • +
    +

  • +
  • int exprValListGet(exprValList *vlist, char *name, EXPRTYPE *val)
    + Comment: +
      +
    • Get the value of a variable or constant in a value list
    • +
    + Parameters: +
      +
    • *vlist - Value list to use
    • +
    • *name - Name of the value to get
    • +
    • *val - Pointer to variable to get the value
    • +
    + Returns: +
      +
    • Error code of the function
    • +
    +

  • +
  • int exprValListAddAddress(exprValList *vlist, char *name, EXPRTYPE *addr)
    + Comment: +
      +
    • This function is used to add a named value to the value list, but + uses an outside variable such as a stack variable to store the + value. This outside variable is used to set/get the value instead + of the internal list value. You must ensure that this outside + variable exists as long as the expression is using it's address.
    • +
    + Parameters: +
      +
    • *vlist - Value list to use
    • +
    • *name - Name of the value to add
    • +
    • *addr - Address of the value being added
    • +
    + Returns: +
      +
    • Error code of the function
    • +
    +

  • +
  • int exprValListGetAddress(exprValList *vlist, char *name, EXPRTYPE **addr)
    + Comment: +
      +
    • Get the memory address of a variable in a value list
    • +
    + Parameters: +
      +
    • *vlist - Value list to use
    • +
    • *name - Name of the value to get
    • +
    • **addr - Pointer to a pointer to store the address of the value + This will be NULL if the name is not in the list.
    • +
    + Returns: +
      +
    • Error code of the function
    • +
    +

  • +
  • void *exprValListGetNext(exprValList *vlist, char **name, EXPRTYPE *value, EXPRTYPE** addr, void *cookie);
    + Comment: +
      +
    • This is used to enumerate the items in the value list. + Do NOT change the list while enumerating the items. Any + of the information items can be NULL if it is not needed.
    • +
    + Parameters: +
      +
    • *vlist - Value list to use
    • +
    • **name - Address of a pointer that will point to the + name. Do not edit the name.
    • +
    • *value - The current value of the item.
    • +
    • **addr - Address of a pointer to store the address of the value.
    • +
    • *cookie - NULL to find the first item, the return value to find + subsequent items.
    • +
    + Returns: +
      +
    • NULL if the item could not be found. Otherwise a cookie + to be used to find additional items.
    • +
    +

  • +
  • int exprValListFree(exprValList *vlist);
    + Comments: +
      +
    • Completely free the value list
    • +
    + Parameters: +
      +
    • *vlist - Value list to free
    • +
    + Returns: +
      +
    • Error code of the function
    • +
    +

  • +
  • int exprValListClear(exprValList *vlist);
    + Comments: +
      +
    • Set the values in the list to 0.0
    • +
    + Parameters: +
      +
    • *vlist - Value list to reset
    • +
    + Returns: +
      +
    • Error code of the function
    • +
    +

  • +
  • int exprValListInit(exprValList *vlist);
    + Comments: +
      +
    • Initialize internal constants into a value list
    • +
    + Paramters: +
      +
    • *vlist - Value list to initialize
    • +
    + Returns: +
      +
    • Error code of the function
    • +
    +
  • +
+

+

Expression functions: +

    +
  • int exprCreate(exprObj **obj, exprFuncList *flist, exprValList *vlist, exprValList *clist, exprBreakFuncType breaker, void *userdata);
    + Comments: +
      +
    • Create an expression object to use
    • +
    + Parameters: +
      +
    • **obj - Pointer to a pointer to an expression object
    • +
    • *flist - Function list to associate with the expression
    • +
    • *vlist - Variable value list to associate with the expression
    • +
    • *clist - Constant value list to associate with the expression
    • +
    • breaker - Breaker function callback to associate with the expression. + Used by functions that may be infinite loops (such as the for function)
    • +
    • userdata - User data to associate with the expression
    • +
    + Returns: +
      +
    • Error code of the function
    • +
    +

  • +
  • int exprFree(exprObj *obj);
    + Comments: +
      +
    • Completely free the expression object
    • +
    + Paramters: +
      +
    • *obj - Expression object to free
    • +
    + Returns: +
      +
    • Error code of the function
    • +
    +

  • +
  • int exprClear(exprObj *obj);
    + Comments: +
      +
    • Clear an expression, but keep list and callback associations. + You can then parse another expression without calling create
    • +
    + Parameters: +
      +
    • *obj - Expression object to clear
    • +
    + Returns: +
      +
    • Error code of the function
    • +
    +

  • +
  • int exprParse(exprObj *obj, char *expr);
    + Comments: +
      +
    • Parse an expression string into an expression object
    • +
    + Paramters: +
      +
    • *obj - Expression object to use
    • +
    • *expr - Expression string to parse
    • +
    + Returns: +
      +
    • Error code of the function
    • +
    +

  • +
  • int exprEval(exprObj *obj, EXPRTYPE *val);
    + Comments: +
      +
    • Evaluate a parsed expression. This function does not + reset the breaker count at each call, but instead accumulates + the count until the breaker function is called. Then the count + is reset to the value specified in exprSetBreakerCount.
    • +
    + Paramters: +
      +
    • *obj - Expression object to evaluate
    • +
    • *val = Pointer to variable to get result of evaluation. + This can be NULL if the result is not needed.
    • +
    + Returns: +
      +
    • Error code of the function
    • +
    +

  • +
  • int exprEvalNode(exprObj *obj, exprNode *nodes, int curnode, EXPRTYPE *val);
    + Comments: +
      +
    • Evaluate a node of an expression. + Used by custom functions
    • +
    + Parameters: +
      +
    • *obj - Expression object being used
    • +
    • *nodes - Pointer to a node or list of nodes
    • +
    • curnode - Index to the node to evaluate
    • +
    • *val - Pointer to variable to get evaluation result
    • +
    + Returns: +
      +
    • Error code of the function
    • +
    +

  • +
  • exprFuncList *exprGetFuncList(exprObj *obj);
    + Comments: +
      +
    • Gets the function list associated with an expression
    • +
    + Parameters: +
      +
    • *obj - expression object
    • +
    + Returns: +
      +
    • Pointer fo an exprFuncList object or NULL
    • +
    +

  • +
  • exprValList *exprGetVarList(exprObj *obj);
    + Comments: +
      +
    • Gets the variable list associated with an expression
    • +
    + Parameters: +
      +
    • *obj - expression object
    • +
    + Returns: +
      +
    • Pointer to an exprValList object or NULL
    • +
    +

  • +
  • exprValList *exprGetConstList(exprObj *obj);
    + Comments: +
      +
    • Gets the constant list associated with an expression
    • +
    + Parameters: +
      +
    • *obj - expression object
    • +
    + Returns: +
      +
    • Pointer to an exprValList object or NULL
    • +
    +

  • +
  • exprBreakFuncType exprGetBreakFunc(exprObj *obj);
    + Comments: +
      +
    • Gets the breaker callback of the expression
    • +
    + Parameters: +
      +
    • *obj - expression object
    • +
    + Returns: +
      +
    • Pointer to the callback function or NULL
    • +
    +

  • +
  • int exprGetBreakResult(exprObj *obj);
    + Comments: +
      +
    • Get the result of the breaker function
    • +
    + Parameters: +
      +
    • *obj - expression object
    • +
    + Returns: +
      +
    • zero to continue, nonzero to break
    • +
    +

  • +
  • void* exprGetUserData(exprObj *obj);
    + Comments: +
      +
    • Gets the user data associated with an expression
    • +
    + Parameters: +
      +
    • *obj - expression object
    • +
    + Returns: +
      +
    • User data
    • +
    +

  • +
  • void exprSetUserData(exprObj *obj, void *userdata);
    + Comments: +
      +
    • Sets the user data of an expression
    • +
    + Parameters: +
      +
    • *obj - expresion object
    • +
    • userdata - user data to set
    • +
    + Returns: +
      +
    • Nothing
    • +
    +

  • +
  • void exprSetBreakCount(exprObj *obj, int count);
    + Comments: +
      +
    • Set how often the breaker function is tested. + The default is 100000. This means the breaker + function is tested once every 100000 times the + exprEvalNode function is called for an expression. + A smaller value tests the breaker function more often + and a larger value tests the breaker function less. The + breaker value is NOT reset during each call to exprEval, + but is accumulated across calles to exprEval + until the breaker function is finally called.
    • +
    + Parameters: +
      +
    • *obj - expression object
    • +
    • count - how many times exprEvalNode gets called before the + breaker function is tested
    • +
    + Returns: +
      +
    • Nothing
    • +
    +

  • +
  • void exprGetErrorPosition(exprObj *obj, int *start, int *end);
    + Comments: +
      +
    • Gets the start and ending positions in the expression string + of the last parse error. The positions include any newline + characters that may be in the string.
    • +
    + Parameters: +
      +
    • *obj - expression object
    • +
    • *start - pointer to an integer to get the start error position, + -1 if unknown
    • +
    • *end - pointer to an integer to get the end error position, + -1 if unknown
    • +
    + Returns: +
      +
    • Nothing
    • +
    +
+

+

Some useful functions +

    +
  • int exprValidIdent(char *name);
    + Comments: +
      +
    • Determine if an identifier is valid
    • +
    + Parameters: +
      +
    • *name - identifier to check
    • +
    + Returns: +
      +
    • 0 on invalid. anything else on valid
    • +
    +

  • +
+

+
+
+ +
+

Compiling the ExprEval library

+

Compiling the ExprEval library is pretty simple. Just + compile all of the source files (*.c) and link them into + a library. You need to keep "expreval.h" for the header file.

+

You may have to make some changes to the library. I've + tried to make doing so as simple as possible. If you + need to change the include files or some macros or whatnot, + edit the file "exprincl.h" This file includes any other files + needed. You should not have to change to much. I have + tried to stick as close to ANSI/ISO C as I can.

+
+ +
+

Drawbacks/Problems

+

The following is a list of some basic drawbacks of this + library: +

    +
  • This library is an expression evaluator, and nothing + else. It does not simplify expressions and it + does not do advanced math such as calculating the + integrals and differentials of expression.
  • +
  • This library has no way of detecting overflows + except for those caused by the internal math + routines. Adding two very very large numbers + may cause an overflow to occur.
  • +
  • This library is not super easy to use in an application. + It has been designed to give much control to the + developer. Because of this, the function/value lists + are seperate from the expression objects, allowing + the developer to use them however they need.
  • +
  • There is no way to delete a single function, variable, + or constant from a list. This is because I see no + real need to do so because of the way the library + works. There is no need to delete function from + a function list or constants from a constant list. + There are are also no decent reasons to delete + variables from a variable list until you are completely + done and delete all of them.
  • +
+

+
+ +
+

Problems and Solutions

+ +
    +
  • Variables do not seem to change in a release/optimized build.
    + I have noticed a small problem with this. Rarely, a variable may not + appear to change in a release build. The reason is to do with compiler + optimizations. For example, look at the following code: +
    +
    +EXPRTYPE k;
    +
    +/* Add variable to the list */
    +exprValListAddAddress(list, "k", &k);
    +
    +k = 0.0;
    +
    +/* Evaluate expression */
    +for(int x = 0; x < 100; x++)
    +    {
    +    exprEval(expr, &result);
    +    
    +    doSomething(k);
    +    }
    +                
    +
    + Inside the loop, the variable 'k' does not appear to be changing, so + the compiler may optimize it by loading it into a register before the + loop and not accessing it from memory during the loop, even if + the expression does change it. One way to avoid this is to use the + 'volatile' keyword with the variable. Then the compiler must + accesss it from memory each time it is accessed. +
    +
    +volatile EXPRTYPE k;
    +
    +/* Add variable to the list */
    +exprValListAddAddress(list, "k", (EXPRTYPE*)&k);
    +
    +k = 0.0;
    +
    +/* Evaluate expression */
    +for(int x = 0; x < 100; x++)
    +    {
    +    exprEval(expr, &result);
    +    
    +    doSomething(k);
    +    }
    +                
    +
    +
  • + +
+ +
+

Example Use with Fast Variable Access

+ +

This is an example application of this library. It is a + graphics program that calculates the color value of a + pixel based on it's X,Y co-ordinate. It uses a made-up + image library called graphic-lib. It uses faster variable + access by using the exprValListGetAddress function.

+

Note that this codes has not actually been tested. See the + test applications (test and imagegen) for other examples.

+ +
+
+/* Include files */
+#include <stdio.h>
+#include <stdlib.h>
+#include <setjmp.h>
+#include "graphiclib.h"
+#include "expreval.h"
+
+char *transerr(int err)
+    {
+    /* Translate error code into message */
+    }
+
+void gen_image(char *name, int w, int h, char *expr);
+    {
+    exprFuncList *f = NULL;
+    exprValList *v = NULL;
+    exprValList *c = NULL;
+    exprObj *o = NULL;
+    int x, y, err;
+    jmp_buf jumper;
+    int image;
+    EXPRTYPE *v_x, *v_y;
+    EXPRTYPE *v_r, *v_g, *v_b;
+    EXPRTYPE global_value;
+
+    /* Error handling */
+    err = setjmp(jumper);
+    if(err)
+        {
+        if(err != ID_IMAGENOERROR)
+            printf("Error %d occurred: %s\n", err, transerr(err));
+
+        exprFree(o);
+        exprFreeFuncList(f);
+        exprFreeValList(v);
+        exprFreeValList(c);
+
+        image_free(image);
+        return;
+        }
+
+    /* Set up lists */
+
+    /* Function list */
+    err = exprFuncListCreate(&f);
+    if(err != EXPR_ERROR_NOERROR)
+        longjmp(jumper, err);
+
+    err = exprFuncListInit(f);
+    if(err != EXPR_ERROR_NOERROR)
+        {
+        printf("Function list init error. Functions may not be available.\n");
+        }
+
+    /* Variable list */
+    err = exprValListCreate(&v);
+    if(err != EXPR_ERROR_NOERROR)
+        longjmp(jumper, err);
+
+    /* Constant list */
+    err = exprValListCreate(&c);
+    if(err != EXPR_ERROR_NOERROR)
+        {
+        printf("Constants not available\n");
+        }
+    else
+        {
+        err = exprValListInit(c);
+        if(err != EXPR_ERROR_NOERROR)
+            printf("Constant list init error. Constants may not be available.\n");
+        }
+
+    /* Create and parse the expression */
+
+    /* Create */
+    err = exprCreate(&o, f, v, c, NULL, 0);
+    if(err != EXPR_ERROR_NOERROR)
+        longjmp(jumper, err);
+
+    /* Parse expression */
+    err = exprParse(o, expr);
+    if(err != EXPR_ERROR_NOERROR)
+        longjmp(jumper, err);
+
+
+    /* Create the image */
+    image = image_create(w, h);
+    if(image == 0)
+        {
+        longjmp(jumper, ID_IMAGECREATEERROR);
+        }
+
+    /* Add width and height to variable list */
+    exprValListAdd(v, "w", (EXPRTYPE)w);
+    exprValListAdd(v, "h", (EXPRTYPE)h);
+
+    /* Add x and y to the list */
+    exprValListAdd(v, "x", 0.0);
+    exprValListAdd(v, "y", 0.0);
+
+    /* Add r, g, and b to the list */
+    exprValListAdd(v, "r", 0.0);
+    exprValListAdd(v, "g", 0.0);
+    exprValListAdd(b, "b", 0.0);
+
+    /* Get addresses.  Assume no error */
+    exprValListGetAddress(v, "x", &v_x);
+    exprValListGetAddress(v, "y", &v_y);
+
+    exprValListGetAddress(v, "r", &v_r);
+    exprValListGetAddress(v, "g", &v_g);
+    exprValListGetAddress(v, "g", &v_b);
+    
+    /* A way to add global variables that can be used by two different lists. */
+    exprValListAddAddress(v, "global", &global_value);
+    /* exprValListAddAddress(v2, "global", &global_value); */
+    
+    /* Also, exprValListAddAddress can be used to add variables directly.
+       Instead of:
+       
+       EXPRTYPE *a;
+       
+       exprValListAdd(v, "a", 0.0);
+       exprValListGetAddresss(v, "a", &a);
+       
+       You can do:
+       
+       EXPRTYPE a;
+       
+       exprValListAddAddresss(v, "a", &a);
+       
+       If you do this, you must ensure that the stack variable exists as long
+       as it is used by expression, otherwise it may cause a memory access
+       violation. */
+    
+
+    for(y = 0; y < h; y++)
+        {
+        for(x = 0; x < w; x++)
+            {
+            /* Directly set the x and y variables */
+            *v_x = (EXPRTYPE)x;
+            *v_y = (EXPRTYPE)y;
+
+            /* Eval expression, ignoring errors */
+            exprEval(o);
+
+            /* Set pixel, using variables directly */
+            image_setpixel(image, x, y, (int)(*v_r), (int)(*v_g), (int)(*v_b));
+            }
+        }
+
+    /* Save image */
+    image_save(image, name);
+
+    /* Done */
+    longjmp(jumper, ID_IMAGENOERROR);
+    }
+
+void main(void)
+    {
+    char name[MAXPATH]
+    char tmp[10];
+    char expr[4096];
+    int sx, sy;
+
+    printf("Image name to save: ");
+    gets(name);
+
+    printf("Image width: ");
+    gets(tmp);
+    sx = atoi(tmp);
+
+    printf("Image height: ");
+    gets(tmp);
+    sy = atoi(tmp);
+
+    printf("Color Expression (Use x, y, w, h Set r, g, b): ");
+    gets(expr);
+
+    gen_image(name, sx, sy, expr);
+    }
+
+        
+
+
+ + + diff --git a/src/mod/applications/mod_expr/exprtmpl.html b/src/mod/applications/mod_expr/exprtmpl.html index f4f6187c3c..6781baece0 100644 --- a/src/mod/applications/mod_expr/exprtmpl.html +++ b/src/mod/applications/mod_expr/exprtmpl.html @@ -1,828 +1,828 @@ - - - -Expression Help - - - - - -
-

Expression Help

-
-
- - - -
-

Expression Syntax

-
-

Expressions have pretty much the same syntax as they - would have on paper, with the following exceptions: -

    -
  • Each expression must end with a semicolon. This - is because the expression string can actually - contain multiple expressions. The semicolon is - used to mark the end of the expression.
    - Examples: -
      -
    • 4*x+5;
    • -
    • y=5+2;g=4+6;
    • -
    • y=r*sin(a);x=r*cos(a);
    • -
    -
  • -
  • The asterisk '*' must be used to multiply.
    - Examples: -
      -
    • y=5*6; Valid
    • -
    • g=(x+1)*(x-1); Valid
    • -
    • g=(x+1)(x-1); Invalid
    • -
    -
  • -
-

-

More than one expression may be contained within an expression string. - As shown above, each expression must end with a semicolon, even if - only one expression is in the string. The value of an expression - string is the value of the last expression in the string.
- Examlples: -

    -
  • g=7; Value: 7
  • -
  • k=z+1; Value: z+1
  • -
  • r=4;k=6;o=9+r-k; Value: 9+r-k
  • -
-

-

Some functions may take reference parameters. These parameters are - references to other variables. You can mix reference parameters - with normal parameters. The order of the normal parameters must - remain the same and the order of the reference parameters must - remain the same.
- Examples: -

    -
  • min(1,2,3,4,&mval); &mval is a reference to a variable mval
  • -
  • min(1,2,&mval,3,4); You may mix them inside like this.
  • -
  • min(1,2,(&mval),3,4); You may not nest reference parameters in any way
  • -
-

-

Expressions may also be nested with parenthesis.
- Examples: -

    -
  • y=sin(x-cos(5+max(4,5,6*x)));
  • -
  • 6+(5-2*(x+y));
  • -
-

-

Expressions may also have whitespace characters and comments. - Whitespace characters such as newlines, linefeeds, carriage - returns, spaces, and tabs are ignored. Comments begin with - the pound sign '#' and end at the end of the line.
- Example: -

    -
    -#Set the x value
    -x = d * cos(r);
    -
    -#Set the y value
    -y = d * sin(r);
    -                
    -
-

-

If a variable is used in an expression, but that variable does not exist, - it is considered zero. If it does exist then its value is used instead. -

-

Notice: An expression can NOT assign to a constant and an - expression can NOT use a constant as a reference parameter. -

-
-
- -
-

Order of operators.

-
-

The order of operators are processed correctly in ExprEval. - The parameters to functions may be evaluated out of order, depending - on the function itself.

- - The following illustrates the order of operators: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
OperatorDirectionExample
Functions and ParenthesisN/A(x + 5) * sin(d);
NegationRight to Lefty = -2;
ExponentsLeft to Righty = x ^ 2;
Multiplication and DivisionLeft to Rightx * 5 / y;
Addition and SubtractionLeft to Right4 + 5 - 3;
AssignmentRight to Leftx = y = z = 0;
- -
-
- -
-

ExprEval Internal Functions

-
- The following functions are provided with ExprEval: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FunctionMin. ArgsMax. ArgsMin. Ref ArgsMax. Ref ArgsResult/Comment
abs(v)1100Absolute value of v.
- abs(-4.3) returns 4.3
mod(v,d)2200Remainder of v/d.
- mod(5.2,2.5) return 0.2
ipart(v)1100The integer part of v.
- ipart(3.2) returns 3
fpart(v)1100The fractional part of v.
- fpart(3.2) returns 0.2
min(v,...)1None00The minimum number passed.
- min(3,2,-5,-2,7) returns -5
max(v,...)1None00The maximum number passed.
- max(3,2,-5,-2,7) returns 7
pow(a,b)2200The value a raised to the power b.
- pow(3.2,1.7) returns 3.21.7
sqrt(a)1100The square root of a.
- sqrt(16) returns 4
sin(a)1100The sine of a radians.
- sin(1.5) returns around 0.997
sinh(a)1100The hyperbolic sine of a.
- sinh(1.5) returns around 2.129
asin(a)1100The arc-sine of a in radians.
- asin(0.5) returns around 0.524
cos(a)1100The cosine of a radians.
- cos(1.5) returns around 0.0707
cosh(a)1100The hyperbolic cosine of a.
- cosh(1.5) returns around 2.352
acos(a)1100The arc-cosine of a in radians.
- acos(0.5) returns around 1.047
tan(a)1100The tangent of a radians.
- tan(1.5) returns around 14.101
tanh(a)1100The hyperbolic tangent of a.
- tanh(1.5) returns around 0.905
atan(a)1100The arc-tangent of a in radians.
- atan(0.3) returns about 0.291
atan2(y,x)2200The arc-tangent of y/x, with quadrant correction.
- atan2(4,3) returns about 0.927
log(a)1100The base 10 logarithm of a.
- log(100) returns 2
pow10(a)110010 raised to the power of a.
- pow10(2) returns 100
ln(a)1100The base e logarithm of a.
- ln(2.8) returns around 1.030
exp(a)1100e raised to the power of a.
- exp(2) returns around 7.389
logn(a,b)2200The base b logarithm of a.
- logn(16,2) returns 4
ceil(a)1100Rounds a up to the nearest integer.
- ceil(3.2) returns 4
floor(a)1100Rounds a down to the nearest integer.
- floor(3.2) returns 3
rand(&seed)0011Returns a number between 0 up to but not including 1.
random(a,b,&seed)2211Returns a number between a up to and including b.
randomize(&seed)0011Seed the random number generator with a value - based on the current time.
- Return value is unknown
deg(a)1100Returns a radians converted to degrees.
- deg(3.14) returns around 179.909
rad(a)1100Returns a degrees converted to radians.
- rad(180) returns around 3.142
recttopolr(x,y)2200Returns the polar radius of the rectangular co-ordinates.
- recttopolr(2,3) returns around 3.606
recttopola(x,y)2200Returns the polar angle (0...2PI) in radians of the rectangular co-ordinates.
- recttopola(2,3) returns around 0.588
poltorectx(r,a)2200Returns the x rectangular co-ordinate of the polar - co-ordinates.
- poltorectx(3,1.5) returns around 0.212
poltorecty(r,a)2200Returns the y rectangular co-ordinate of the polar - co-ordinates.
- poltorecty(3,1.5) returns around 2.992
if(c,t,f)3300Evaluates and returns t if c is not 0.0. - Else evaluates and returns f.
- if(0.1,2.1,3.9) returns 2.1
select(c,n,z[,p])3400Returns n if c is less than 0.0. Returns z - if c is 0.0. If c is greater than 0.0 and only - three arguments were passed, returns z. If c - is greater than 0.0 and four arguments were passed, - return p.
- select(3,1,4,5) returns 5
equal(a,b)2200Returns 1.0 if a is equal to b. Else returns 0.0
- equal(3,2) returns 0.0
above(a,b)2200Returns 1.0 if a is above b. Else returns 0.0
- above(3,2) returns 1.0
below(a,b)2200Returns 1.0 if a is below b. Else returns 0.0
- below(3,2) returns 0.0
avg(a,...)1None00Returns the average of the values passed.
- avg(3,3,6) returns 4
clip(v,min,max)3300Clips v to the range from min to max. If v is less - than min, it returns min. If v is greater than - max it returns max. Otherwise it returns v.
- clip(3,1,2) returns 2
clamp(v,min,max)3300Clamps v to the range from min to max, looping - if needed.
- clamp(8.2,1.3,4.7) returns 1.4
pntchange(side1old, side2old, side1new, side2new, oldpnt)5500This is used to translate points from different - scale. It works no matter the orientation as long - as the sides are lined up correctly.
- pntchange(-1,1,0,480,-0.5) returns 120 (x example)
- pntchange(-1,1,480,0,-0.5) returns 360 (y example)
poly(x,c1,...)2None00This function calculates the polynomial. x is the value - to use in the polynomial. c1 and on are the coefficients.
- poly(4,6,9,3,1,4) returns 2168
- same as 6*44 + 9*43 + 3*42 + 1*41 + 4*40
and(a,b)2200Returns 0.0 if either a or b are 0.0 Else returns 1.0
- and(2.1,0.0) returns 0.0
or(a,b)2200Returns 0.0 if both a and b are 0.0 Else returns 1.0
- or(2.1,0.0) returns 1.0
not(a)1100Returns 1.0 if a is 0.0 Else returns 0.0
- not(0.3) returns 0.0
for(init,test,inc,a1,...)4None00This function acts like a for loop in C. First init is - evaluated. Then test is evaluated. As long as the - test is not 0.0, the action statements (a1 to an) are - evaluated, the inc statement is evaluated, and the test - is evaluated again. The result is the result of the - final action statement.
- for(x=0,below(x,11),x=x+1,y=y+x) returns 55.0 (if y was - initially 0.0)
many(expr,...)1None00This function treats many subexpressions as a single object - (function). It is mainly for the 'for' function.
- for(many(j=5,k=1),above(j*k,0.001),many(j=j+5,k=k/2),0)
- -
-
- -
-

ExprEval Internal Constants

-
- The following constants are provided with ExprEval: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ConstantMath FormValue
M_Ee2.7182818284590452354
M_LOG2Elog2(e)1.4426950408889634074
M_LOG10Elog10(e)0.43429448190325182765
M_LN2ln(2)0.69314718055994530942
M_LN10ln(10)2.30258509299404568402
M_PIπ3.14159265358979323846
M_PI_2π/21.57079632679489661923
M_PI_4π/40.78539816339744830962
M_1_PI1/π0.31830988618379067154
M_2_PI2/π0.63661977236758134308
M_1_SQRTPI1/√(π)0.56418958354776
M_2_SQRTPI2/√(π)1.12837916709551257390
M_SQRT2√(2)1.41421356237309504880
M_1_SQRT21/√(2)0.70710678118654752440
-
-
- -
-

Application Internal Functions

-
- Application defined expression functions go here. - - - - - - - - - - - - - - - - - -
FunctionMin. ArgsMax. ArgsMin. Ref ArgsMax. Ref ArgsResult/Comment
-
-
- -
-

Application Internal Constants

-
- Application defined expression constants go here. - - - - - - - - - - - -
ConstantMath FormValue
-
-
- -
-

Application Internal Variables

-
- Application defined expression variables go here. - - - - - - - - - - - -
VariableMath FormValue
-
-
- - - - - - + + + +Expression Help + + + + + +
+

Expression Help

+
+
+ + + +
+

Expression Syntax

+
+

Expressions have pretty much the same syntax as they + would have on paper, with the following exceptions: +

    +
  • Each expression must end with a semicolon. This + is because the expression string can actually + contain multiple expressions. The semicolon is + used to mark the end of the expression.
    + Examples: +
      +
    • 4*x+5;
    • +
    • y=5+2;g=4+6;
    • +
    • y=r*sin(a);x=r*cos(a);
    • +
    +
  • +
  • The asterisk '*' must be used to multiply.
    + Examples: +
      +
    • y=5*6; Valid
    • +
    • g=(x+1)*(x-1); Valid
    • +
    • g=(x+1)(x-1); Invalid
    • +
    +
  • +
+

+

More than one expression may be contained within an expression string. + As shown above, each expression must end with a semicolon, even if + only one expression is in the string. The value of an expression + string is the value of the last expression in the string.
+ Examlples: +

    +
  • g=7; Value: 7
  • +
  • k=z+1; Value: z+1
  • +
  • r=4;k=6;o=9+r-k; Value: 9+r-k
  • +
+

+

Some functions may take reference parameters. These parameters are + references to other variables. You can mix reference parameters + with normal parameters. The order of the normal parameters must + remain the same and the order of the reference parameters must + remain the same.
+ Examples: +

    +
  • min(1,2,3,4,&mval); &mval is a reference to a variable mval
  • +
  • min(1,2,&mval,3,4); You may mix them inside like this.
  • +
  • min(1,2,(&mval),3,4); You may not nest reference parameters in any way
  • +
+

+

Expressions may also be nested with parenthesis.
+ Examples: +

    +
  • y=sin(x-cos(5+max(4,5,6*x)));
  • +
  • 6+(5-2*(x+y));
  • +
+

+

Expressions may also have whitespace characters and comments. + Whitespace characters such as newlines, linefeeds, carriage + returns, spaces, and tabs are ignored. Comments begin with + the pound sign '#' and end at the end of the line.
+ Example: +

    +
    +#Set the x value
    +x = d * cos(r);
    +
    +#Set the y value
    +y = d * sin(r);
    +                
    +
+

+

If a variable is used in an expression, but that variable does not exist, + it is considered zero. If it does exist then its value is used instead. +

+

Notice: An expression can NOT assign to a constant and an + expression can NOT use a constant as a reference parameter. +

+
+
+ +
+

Order of operators.

+
+

The order of operators are processed correctly in ExprEval. + The parameters to functions may be evaluated out of order, depending + on the function itself.

+ + The following illustrates the order of operators: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
OperatorDirectionExample
Functions and ParenthesisN/A(x + 5) * sin(d);
NegationRight to Lefty = -2;
ExponentsLeft to Righty = x ^ 2;
Multiplication and DivisionLeft to Rightx * 5 / y;
Addition and SubtractionLeft to Right4 + 5 - 3;
AssignmentRight to Leftx = y = z = 0;
+ +
+
+ +
+

ExprEval Internal Functions

+
+ The following functions are provided with ExprEval: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FunctionMin. ArgsMax. ArgsMin. Ref ArgsMax. Ref ArgsResult/Comment
abs(v)1100Absolute value of v.
+ abs(-4.3) returns 4.3
mod(v,d)2200Remainder of v/d.
+ mod(5.2,2.5) return 0.2
ipart(v)1100The integer part of v.
+ ipart(3.2) returns 3
fpart(v)1100The fractional part of v.
+ fpart(3.2) returns 0.2
min(v,...)1None00The minimum number passed.
+ min(3,2,-5,-2,7) returns -5
max(v,...)1None00The maximum number passed.
+ max(3,2,-5,-2,7) returns 7
pow(a,b)2200The value a raised to the power b.
+ pow(3.2,1.7) returns 3.21.7
sqrt(a)1100The square root of a.
+ sqrt(16) returns 4
sin(a)1100The sine of a radians.
+ sin(1.5) returns around 0.997
sinh(a)1100The hyperbolic sine of a.
+ sinh(1.5) returns around 2.129
asin(a)1100The arc-sine of a in radians.
+ asin(0.5) returns around 0.524
cos(a)1100The cosine of a radians.
+ cos(1.5) returns around 0.0707
cosh(a)1100The hyperbolic cosine of a.
+ cosh(1.5) returns around 2.352
acos(a)1100The arc-cosine of a in radians.
+ acos(0.5) returns around 1.047
tan(a)1100The tangent of a radians.
+ tan(1.5) returns around 14.101
tanh(a)1100The hyperbolic tangent of a.
+ tanh(1.5) returns around 0.905
atan(a)1100The arc-tangent of a in radians.
+ atan(0.3) returns about 0.291
atan2(y,x)2200The arc-tangent of y/x, with quadrant correction.
+ atan2(4,3) returns about 0.927
log(a)1100The base 10 logarithm of a.
+ log(100) returns 2
pow10(a)110010 raised to the power of a.
+ pow10(2) returns 100
ln(a)1100The base e logarithm of a.
+ ln(2.8) returns around 1.030
exp(a)1100e raised to the power of a.
+ exp(2) returns around 7.389
logn(a,b)2200The base b logarithm of a.
+ logn(16,2) returns 4
ceil(a)1100Rounds a up to the nearest integer.
+ ceil(3.2) returns 4
floor(a)1100Rounds a down to the nearest integer.
+ floor(3.2) returns 3
rand(&seed)0011Returns a number between 0 up to but not including 1.
random(a,b,&seed)2211Returns a number between a up to and including b.
randomize(&seed)0011Seed the random number generator with a value + based on the current time.
+ Return value is unknown
deg(a)1100Returns a radians converted to degrees.
+ deg(3.14) returns around 179.909
rad(a)1100Returns a degrees converted to radians.
+ rad(180) returns around 3.142
recttopolr(x,y)2200Returns the polar radius of the rectangular co-ordinates.
+ recttopolr(2,3) returns around 3.606
recttopola(x,y)2200Returns the polar angle (0...2PI) in radians of the rectangular co-ordinates.
+ recttopola(2,3) returns around 0.588
poltorectx(r,a)2200Returns the x rectangular co-ordinate of the polar + co-ordinates.
+ poltorectx(3,1.5) returns around 0.212
poltorecty(r,a)2200Returns the y rectangular co-ordinate of the polar + co-ordinates.
+ poltorecty(3,1.5) returns around 2.992
if(c,t,f)3300Evaluates and returns t if c is not 0.0. + Else evaluates and returns f.
+ if(0.1,2.1,3.9) returns 2.1
select(c,n,z[,p])3400Returns n if c is less than 0.0. Returns z + if c is 0.0. If c is greater than 0.0 and only + three arguments were passed, returns z. If c + is greater than 0.0 and four arguments were passed, + return p.
+ select(3,1,4,5) returns 5
equal(a,b)2200Returns 1.0 if a is equal to b. Else returns 0.0
+ equal(3,2) returns 0.0
above(a,b)2200Returns 1.0 if a is above b. Else returns 0.0
+ above(3,2) returns 1.0
below(a,b)2200Returns 1.0 if a is below b. Else returns 0.0
+ below(3,2) returns 0.0
avg(a,...)1None00Returns the average of the values passed.
+ avg(3,3,6) returns 4
clip(v,min,max)3300Clips v to the range from min to max. If v is less + than min, it returns min. If v is greater than + max it returns max. Otherwise it returns v.
+ clip(3,1,2) returns 2
clamp(v,min,max)3300Clamps v to the range from min to max, looping + if needed.
+ clamp(8.2,1.3,4.7) returns 1.4
pntchange(side1old, side2old, side1new, side2new, oldpnt)5500This is used to translate points from different + scale. It works no matter the orientation as long + as the sides are lined up correctly.
+ pntchange(-1,1,0,480,-0.5) returns 120 (x example)
+ pntchange(-1,1,480,0,-0.5) returns 360 (y example)
poly(x,c1,...)2None00This function calculates the polynomial. x is the value + to use in the polynomial. c1 and on are the coefficients.
+ poly(4,6,9,3,1,4) returns 2168
+ same as 6*44 + 9*43 + 3*42 + 1*41 + 4*40
and(a,b)2200Returns 0.0 if either a or b are 0.0 Else returns 1.0
+ and(2.1,0.0) returns 0.0
or(a,b)2200Returns 0.0 if both a and b are 0.0 Else returns 1.0
+ or(2.1,0.0) returns 1.0
not(a)1100Returns 1.0 if a is 0.0 Else returns 0.0
+ not(0.3) returns 0.0
for(init,test,inc,a1,...)4None00This function acts like a for loop in C. First init is + evaluated. Then test is evaluated. As long as the + test is not 0.0, the action statements (a1 to an) are + evaluated, the inc statement is evaluated, and the test + is evaluated again. The result is the result of the + final action statement.
+ for(x=0,below(x,11),x=x+1,y=y+x) returns 55.0 (if y was + initially 0.0)
many(expr,...)1None00This function treats many subexpressions as a single object + (function). It is mainly for the 'for' function.
+ for(many(j=5,k=1),above(j*k,0.001),many(j=j+5,k=k/2),0)
+ +
+
+ +
+

ExprEval Internal Constants

+
+ The following constants are provided with ExprEval: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ConstantMath FormValue
M_Ee2.7182818284590452354
M_LOG2Elog2(e)1.4426950408889634074
M_LOG10Elog10(e)0.43429448190325182765
M_LN2ln(2)0.69314718055994530942
M_LN10ln(10)2.30258509299404568402
M_PIπ3.14159265358979323846
M_PI_2π/21.57079632679489661923
M_PI_4π/40.78539816339744830962
M_1_PI1/π0.31830988618379067154
M_2_PI2/π0.63661977236758134308
M_1_SQRTPI1/√(π)0.56418958354776
M_2_SQRTPI2/√(π)1.12837916709551257390
M_SQRT2√(2)1.41421356237309504880
M_1_SQRT21/√(2)0.70710678118654752440
+
+
+ +
+

Application Internal Functions

+
+ Application defined expression functions go here. + + + + + + + + + + + + + + + + + +
FunctionMin. ArgsMax. ArgsMin. Ref ArgsMax. Ref ArgsResult/Comment
+
+
+ +
+

Application Internal Constants

+
+ Application defined expression constants go here. + + + + + + + + + + + +
ConstantMath FormValue
+
+
+ +
+

Application Internal Variables

+
+ Application defined expression variables go here. + + + + + + + + + + + +
VariableMath FormValue
+
+
+ + + + + + From 0a66db6f12031f84f1ef8399d67924c307a11a93 Mon Sep 17 00:00:00 2001 From: Seven Du Date: Fri, 26 Dec 2014 13:27:43 +0800 Subject: [PATCH 90/95] FS-7111 #resolve please review --- src/switch_ivr_originate.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index 2429de2e5c..00eebd1cc1 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -1789,7 +1789,7 @@ static void *SWITCH_THREAD_FUNC early_thread_run(switch_thread_t *thread, void * switch_core_session_set_read_codec(session, &read_codecs[i]); } status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0); - if (SWITCH_READ_ACCEPTABLE(status)) { + if (SWITCH_READ_ACCEPTABLE(status) && !switch_test_flag(read_frame, SFF_CNG)) { data = (int16_t *) read_frame->data; if (datalen < read_frame->datalen) { datalen = read_frame->datalen; @@ -1802,7 +1802,7 @@ static void *SWITCH_THREAD_FUNC early_thread_run(switch_thread_t *thread, void * } } else { status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0); - if (SWITCH_READ_ACCEPTABLE(status)) { + if (SWITCH_READ_ACCEPTABLE(status) && !switch_test_flag(read_frame, SFF_CNG)) { datalen = read_frame->datalen; } break; @@ -3239,7 +3239,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess silence = 600; } - if ((ringback.fh || silence || ringback.audio_buffer || oglobals.bridge_early_media > -1) && write_frame.codec && write_frame.datalen) { + if ((ringback.fh || silence || ringback.audio_buffer || oglobals.bridge_early_media > -1) && write_frame.codec && write_frame.codec->implementation && write_frame.datalen) { if (silence) { write_frame.datalen = read_impl.decoded_bytes_per_packet; switch_generate_sln_silence((int16_t *) write_frame.data, write_frame.datalen / 2, write_frame.codec->implementation->number_of_channels, silence); From ffef746dcb61bf42c6d9562c870bd16091e3926b Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Fri, 26 Dec 2014 17:22:20 +0000 Subject: [PATCH 91/95] Add .clang-format rules ClangFormat is an attempt to build something like gofmt for C. ref: http://clang.llvm.org/docs/ClangFormat.html ref: http://clang.llvm.org/docs/ClangFormatStyleOptions.html --- .clang-format | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 .clang-format diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000000..6e2327ef41 --- /dev/null +++ b/.clang-format @@ -0,0 +1,61 @@ +# http://clang.llvm.org/docs/ClangFormatStyleOptions.html +--- +Language: Cpp +AccessModifierOffset: 0 +AlignAfterOpenBracket: true +AlignEscapedNewlinesLeft: false +AlignOperands: true +AlignTrailingComments: true +AllowAllParametersOfDeclarationOnNextLine: true +AllowShortBlocksOnASingleLine: true +AllowShortCaseLabelsOnASingleLine: false +AllowShortFunctionsOnASingleLine: All +AllowShortIfStatementsOnASingleLine: true +AllowShortLoopsOnASingleLine: true +AlwaysBreakAfterDefinitionReturnType: false +AlwaysBreakBeforeMultilineStrings: false +AlwaysBreakTemplateDeclarations: false +BinPackArguments: true +BinPackParameters: true +BreakBeforeBinaryOperators: None +BreakBeforeBraces: Linux +BreakBeforeTernaryOperators: true +BreakConstructorInitializersBeforeComma: false +ColumnLimit: 120 +CommentPragmas: '^ IWYU pragma:' +ConstructorInitializerAllOnOneLineOrOnePerLine: false +ConstructorInitializerIndentWidth: 4 +ContinuationIndentWidth: 4 +Cpp11BracedListStyle: true +DerivePointerAlignment: false +DisableFormat: false +ExperimentalAutoDetectBinPacking: false +ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ] +IndentCaseLabels: false +IndentFunctionDeclarationAfterType: false +IndentWidth: 4 +IndentWrappedFunctionNames: false +KeepEmptyLinesAtTheStartOfBlocks: true +MaxEmptyLinesToKeep: 1 +NamespaceIndentation: None +PenaltyBreakBeforeFirstCallParameter: 19 +PenaltyBreakComment: 300 +PenaltyBreakFirstLessLess: 120 +PenaltyBreakString: 1000 +PenaltyExcessCharacter: 1000000 +PenaltyReturnTypeOnItsOwnLine: 60 +PointerAlignment: Right +SpaceAfterCStyleCast: false +SpaceBeforeAssignmentOperators: true +SpaceBeforeParens: ControlStatements +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 1 +SpacesInAngles: false +SpacesInCStyleCastParentheses: false +SpacesInContainerLiterals: true +SpacesInParentheses: false +SpacesInSquareBrackets: false +Standard: Cpp11 +TabWidth: 4 +UseTab: Always +... From 750b1dd807bf5ca4e3b752fdf7ba48d8b10b5366 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Sun, 28 Dec 2014 00:36:06 +0000 Subject: [PATCH 92/95] Allow streaming binary data from mod_memcache Previously data returned from `memcache get` would be truncated at the first NULL byte. By using raw_write_function here to stream the returned memcache value, we allow mod_memcache to be used for audio and other arbitrary binary data. Dave has a format module planned that relies on this. Thanks-to: Dave Olszewski FS-7114 #resolve --- src/mod/applications/mod_memcache/mod_memcache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/applications/mod_memcache/mod_memcache.c b/src/mod/applications/mod_memcache/mod_memcache.c index 81c509719a..a5a5324e93 100644 --- a/src/mod/applications/mod_memcache/mod_memcache.c +++ b/src/mod/applications/mod_memcache/mod_memcache.c @@ -283,7 +283,7 @@ SWITCH_STANDARD_API(memcache_function) val = memcached_get(memcached, key, strlen(key), &string_length, &flags, &rc); if (rc == MEMCACHED_SUCCESS) { - stream->write_function(stream, "%.*s", (int) string_length, val); + stream->raw_write_function(stream, (uint8_t*)val, (int)string_length); } else { switch_safe_free(val); switch_goto_status(SWITCH_STATUS_SUCCESS, mcache_error); From b368a75593e4a8ee1fa42af7cd584339d632653b Mon Sep 17 00:00:00 2001 From: William King Date: Sat, 27 Dec 2014 18:49:55 -0800 Subject: [PATCH 93/95] Fixing a typo, and updating the weekly conference call link in the SubmittingPatches doc --- docs/SubmittingPatches | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/SubmittingPatches b/docs/SubmittingPatches index 141319b82e..7e9b89e64c 100644 --- a/docs/SubmittingPatches +++ b/docs/SubmittingPatches @@ -45,7 +45,7 @@ Create a Pull Request # navigate to FreeSWITCH Stash chromium https://freeswitch.org/stash - # Using the saem credentials as Jira, login to Stash; create a forked FS repository; read + # Using the same credentials as Jira, login to Stash; create a forked FS repository; read # the details here: chromium https://freeswitch.org/confluence/display/FREESWITCH/Pull+Requests @@ -214,4 +214,4 @@ Finally, feel free to join us in our weekly conference call. Many of the core developers are often on the call and you'll have an opportunity at the beginning or end of the call to ask your questions: -> https://wiki.freeswitch.org/wiki/Weekly_Conference_Call +> https://freeswitch.org/confluence/display/FREESWITCH/ClueCon+Weekly+Conference+call From 65631ed36b04566654410b7b22fc5cf8aa48a566 Mon Sep 17 00:00:00 2001 From: Brian West Date: Mon, 29 Dec 2014 10:02:31 -0600 Subject: [PATCH 94/95] Revert FS-7004 pending updated fixed for that issue from the original author. --- src/mod/formats/mod_sndfile/mod_sndfile.c | 25 +++-------------------- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/src/mod/formats/mod_sndfile/mod_sndfile.c b/src/mod/formats/mod_sndfile/mod_sndfile.c index 4b6e9112a6..5d8d0865b5 100644 --- a/src/mod/formats/mod_sndfile/mod_sndfile.c +++ b/src/mod/formats/mod_sndfile/mod_sndfile.c @@ -54,13 +54,10 @@ struct sndfile_context { typedef struct sndfile_context sndfile_context; -static switch_status_t sndfile_perform_open(sndfile_context *context, const char *path, const char *mask, int mode); - static switch_status_t sndfile_file_open(switch_file_handle_t *handle, const char *path) { sndfile_context *context; int mode = 0; - const char *mask = "rb"; char *ext; struct format_map *map = NULL; switch_status_t status = SWITCH_STATUS_SUCCESS; @@ -87,10 +84,8 @@ static switch_status_t sndfile_file_open(switch_file_handle_t *handle, const cha if (switch_test_flag(handle, SWITCH_FILE_FLAG_WRITE)) { if (switch_test_flag(handle, SWITCH_FILE_WRITE_APPEND) || switch_test_flag(handle, SWITCH_FILE_WRITE_OVER) || handle->offset_pos) { - mask = "ab+"; mode += SFM_RDWR; } else { - mask = "wb+"; mode += SFM_WRITE; } } @@ -186,7 +181,7 @@ static switch_status_t sndfile_file_open(switch_file_handle_t *handle, const cha ldup = strdup(last); switch_assert(ldup); switch_snprintf(last, alt_len - (last - alt_path), "%d%s%s", handle->samplerate, SWITCH_PATH_SEPARATOR, ldup); - if (sndfile_perform_open(context, alt_path, mask, mode) == SWITCH_STATUS_SUCCESS) { + if ((context->handle = sf_open(alt_path, mode, &context->sfinfo))) { path = alt_path; } else { /* Try to find the file at the highest rate possible if we can't find one that matches the exact rate. @@ -194,7 +189,7 @@ static switch_status_t sndfile_file_open(switch_file_handle_t *handle, const cha */ for (i = 3; i >= 0; i--) { switch_snprintf(last, alt_len - (last - alt_path), "%d%s%s", rates[i], SWITCH_PATH_SEPARATOR, ldup); - if (sndfile_perform_open(context, alt_path, mask, mode) == SWITCH_STATUS_SUCCESS) { + if ((context->handle = sf_open(alt_path, mode, &context->sfinfo))) { path = alt_path; break; } @@ -203,7 +198,7 @@ static switch_status_t sndfile_file_open(switch_file_handle_t *handle, const cha } if (!context->handle) { - if (sndfile_perform_open(context, path, mask, mode) != SWITCH_STATUS_SUCCESS) { + if ((context->handle = sf_open(path, mode, &context->sfinfo)) == 0) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening File [%s] [%s]\n", path, sf_strerror(context->handle)); status = SWITCH_STATUS_GENERR; goto end; @@ -241,20 +236,6 @@ static switch_status_t sndfile_file_open(switch_file_handle_t *handle, const cha return status; } -static switch_status_t sndfile_perform_open(sndfile_context *context, const char *path, const char *mask, int mode) -{ - FILE *fd = NULL; - fd = fopen(path, mask); - if (!fd) { - return SWITCH_STATUS_FALSE; - } - if ((context->handle = sf_open_fd(fileno(fd), mode, &context->sfinfo, SWITCH_TRUE)) == 0) { - fclose(fd); - return SWITCH_STATUS_FALSE; - } - return SWITCH_STATUS_SUCCESS; -} - static switch_status_t sndfile_file_truncate(switch_file_handle_t *handle, int64_t offset) { sndfile_context *context = handle->private_info; From a067a49b3917b8be50b2ed461457a944dd644a6f Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Mon, 29 Dec 2014 13:49:42 -0500 Subject: [PATCH 95/95] FS-7046 fix warning introduced from b341ff7 properly --- src/mod/endpoints/mod_verto/mod_verto.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index d79d8d1191..ae9d9a9e2f 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -1518,7 +1518,7 @@ new_req: !strncmp(request.content_type, "application/x-www-form-urlencoded", 33)) { char *buffer = NULL; - switch_size_t len = 0, bytes = 0; + switch_ssize_t len = 0, bytes = 0; if (request.content_length > 2 * 1024 * 1024 - 1) { char *data = "HTTP/1.1 413 Request Entity Too Large\r\n" @@ -1538,8 +1538,8 @@ new_req: while(bytes < request.content_length) { len = request.content_length - bytes; - if ((switch_ssize_t)(len = ws_raw_read(&jsock->ws, buffer + bytes, len, jsock->ws.block)) < 0) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Read error %" SWITCH_SIZE_T_FMT"\n", len); + if ((len = ws_raw_read(&jsock->ws, buffer + bytes, len, jsock->ws.block)) < 0) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Read error %" SWITCH_SSIZE_T_FMT"\n", len); goto done; }