diff --git a/build/config/ax_compiler_vendor.m4 b/build/config/ax_compiler_vendor.m4 index a24a58da0f..b506b78aae 100644 --- a/build/config/ax_compiler_vendor.m4 +++ b/build/config/ax_compiler_vendor.m4 @@ -3,7 +3,7 @@ AC_DEFUN([AX_COMPILER_VENDOR], AC_CACHE_CHECK([for _AC_LANG compiler vendor], ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor, [ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor=unknown # note: don't check for gcc first since some other compilers define __GNUC__ - for ventest in intel:__ICC,__ECC,__INTEL_COMPILER ibm:__xlc__,__xlC__,__IBMC__,__IBMCPP__ gnu:__GNUC__ sun:__SUNPRO_C,__SUNPRO_CC hp:__HP_cc,__HP_aCC dec:__DECC,__DECCXX,__DECC_VER,__DECCXX_VER borland:__BORLANDC__,__TURBOC__ comeau:__COMO__ cray:_CRAYC kai:__KCC lcc:__LCC__ metrowerks:__MWERKS__ sgi:__sgi,sgi microsoft:_MSC_VER watcom:__WATCOMC__ portland:__PGI; do + for ventest in intel:__ICC,__ECC,__INTEL_COMPILER ibm:__xlc__,__xlC__,__IBMC__,__IBMCPP__ clang:__clang__ gnu:__GNUC__ sun:__SUNPRO_C,__SUNPRO_CC hp:__HP_cc,__HP_aCC dec:__DECC,__DECCXX,__DECC_VER,__DECCXX_VER borland:__BORLANDC__,__TURBOC__ comeau:__COMO__ cray:_CRAYC kai:__KCC lcc:__LCC__ metrowerks:__MWERKS__ sgi:__sgi,sgi microsoft:_MSC_VER watcom:__WATCOMC__ portland:__PGI; do vencpp="defined("`echo $ventest | cut -d: -f2 | sed 's/,/) || defined(/g'`")" AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[ #if !($vencpp) diff --git a/configure.in b/configure.in index 278243b6d4..36584fb262 100644 --- a/configure.in +++ b/configure.in @@ -172,11 +172,19 @@ SWITCH_AM_LDFLAGS="-lm" #set SOLINK variable based on compiler and host if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then SOLINK="-Bdynamic -dy -G" -elif test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then +elif test "x${ax_cv_c_compiler_vendor}" = "xclang" ; then case "$host" in - *darwin12.*|*darwin11.*|*darwin10.*) + *darwin*) SOLINK="-dynamic -force-flat-namespace" ;; + *) + AC_ERROR([Please update configure.in with SOLINK values for your compiler]) + ;; + + esac +elif test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then + case "$host" in +# older Xcode test for darwin, Xcode 4/5 use clang above *darwin*) SOLINK="-dynamic -bundle -force-flat-namespace" ;; @@ -190,7 +198,6 @@ elif test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then else AC_ERROR([Please update configure.in with SOLINK values for your compiler]) fi - # set DYNAMIC_LIB_EXTEN # we should really be using libtool so we don't need to do this case "$host" in @@ -727,6 +734,17 @@ if test x"$ac_cv_gcc_declaration_after_statement" = xyes; then fi CFLAGS="$saved_CFLAGS" +if test "x${ax_cv_c_compiler_vendor}" = "xclang" ; then + # Next check added for Xcode 5 and systems with clang 5 llvm 3.3 or above, extended offset must be off + AC_CACHE_CHECK([whether compiler supports -Wextended-offsetof], [ac_cv_clang_extended_offsetof], [ + AC_TRY_COMPILE([],[return 0;],[ac_cv_clang_extended_offsetof=yes],[ac_cv_clang_extended_offsetof=no]) + ]) + AC_MSG_RESULT($ac_cv_clang_extended_offsetof) + if test x"$ac_cv_clang_extended_offsetof" = xyes; then + APR_ADDTO(CFLAGS, -Wno-extended-offsetof) + fi +fi + # Tested and fixed lot of modules, but some are untested. Will be added back when the core team decide it ready # Untested modules : mod_osp mod_soundtouch mod_sangoma_codec mod_dingaling mod_opal mod_skypopen mod_h323 mod_khomp # mod_unimrcp mod_cepstral mod_erlang_event mod_snmp mod_perl mod_java mod_managed diff --git a/debian/.gitignore b/debian/.gitignore index 81fc750bf9..896d998162 100644 --- a/debian/.gitignore +++ b/debian/.gitignore @@ -5,6 +5,7 @@ /files /modules.conf /modules_.conf +/freeswitch-all.* /freeswitch-autotools.install /freeswitch-mod-*.install /freeswitch-conf-*.install diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index 5843872904..b9776f14ac 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -6,7 +6,7 @@ mod_dir="../src/mod" 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_build_depends="." mod_depends="." mod_recommends="." mod_suggests="." supported_distros="squeeze wheezy jessie sid" avoid_mods=( applications/mod_limit @@ -204,6 +204,32 @@ EOF print_core_control () { cat <= 1.0.8), + freeswitch-sounds-en-us-callie (>= 1.0.25) | freeswitch-sounds, + $(debian_wrap "${mod_depends}") +Recommends: + $(debian_wrap "${mod_recommends}") +Suggests: freeswitch-all-dbg, + $(debian_wrap "${mod_suggests}") +Description: Cross-Platform Scalable Multi-Protocol Soft Switch + $(debian_wrap "${fs_description}") + . + This package contains FreeSWITCH and all modules and extras. + Package: freeswitch Architecture: any Depends: \${shlibs:Depends}, \${perl:Depends}, \${misc:Depends}, @@ -616,6 +642,16 @@ Description: Cross-Platform Scalable Multi-Protocol Soft Switch This is a metapackage which depends on all mod_say languages for FreeSWITCH. +Package: freeswitch-all-dbg +Section: debug +Priority: extra +Architecture: any +Depends: \${misc:Depends}, freeswitch (= \${binary:Version}) +Description: debugging symbols for FreeSWITCH + $(debian_wrap "${fs_description}") + . + This package contains debugging symbols for FreeSWITCH. + Package: freeswitch-dbg Section: debug Priority: extra @@ -890,6 +926,7 @@ gencontrol_per_cat () { geninstall_per_mod () { local f=freeswitch-${module_name//_/-}.install (print_edit_warning; print_mod_install "$module_name") > $f + print_mod_install "$module_name" >> freeswitch-all.install test -f $f.tmpl && cat $f.tmpl >> $f } @@ -912,6 +949,7 @@ genconf () { local p=freeswitch-conf-${conf//_/-} local f=$p.install (print_edit_warning; print_conf_install) > $f + print_conf_install >> freeswitch-all.install test -f $f.tmpl && cat $f.tmpl >> $f local f=$p.lintian-overrides (print_edit_warning; print_conf_overrides "$p") > $f @@ -923,26 +961,50 @@ genlang () { local p=freeswitch-lang-${lang//_/-} local f=$p.install (print_edit_warning; print_lang_install) > $f + print_lang_install >> freeswitch-all.install test -f $f.tmpl && cat $f.tmpl >> $f local f=$p.lintian-overrides (print_edit_warning; print_lang_overrides "$p") > $f test -f $f.tmpl && cat $f.tmpl >> $f } -accumulate_build_depends () { +accumulate_mod_deps () { local x="" + # build-depends if [ -n "$(eval echo \$build_depends_$codename)" ]; then x="$(eval echo \$build_depends_$codename)" - else - x="${build_depends}" - fi + else x="${build_depends}"; fi if [ -n "$x" ]; then if [ ! "$mod_build_depends" = "." ]; then mod_build_depends="${mod_build_depends}, ${x}" - else - mod_build_depends="${x}" - fi - fi + else mod_build_depends="${x}"; fi; fi + # depends + if [ -n "$(eval echo \$depends_$codename)" ]; then + x="$(eval echo \$depends_$codename)" + else x="${depends}"; fi + x="$(echo "$x" | sed 's/, \?/\n/g' | grep -v '^freeswitch' | tr '\n' ',' | sed -e 's/,$//' -e 's/,/, /g')" + if [ -n "$x" ]; then + if [ ! "$mod_depends" = "." ]; then + mod_depends="${mod_depends}, ${x}" + else mod_depends="${x}"; fi; fi + # recommends + if [ -n "$(eval echo \$recommends_$codename)" ]; then + x="$(eval echo \$recommends_$codename)" + else x="${recommends}"; fi + x="$(echo "$x" | sed 's/, \?/\n/g' | grep -v '^freeswitch' | tr '\n' ',' | sed -e 's/,$//' -e 's/,/, /g')" + if [ -n "$x" ]; then + if [ ! "$mod_recommends" = "." ]; then + mod_recommends="${mod_recommends}, ${x}" + else mod_recommends="${x}"; fi; fi + # suggests + if [ -n "$(eval echo \$suggests_$codename)" ]; then + x="$(eval echo \$suggests_$codename)" + else x="${suggests}"; fi + x="$(echo "$x" | sed 's/, \?/\n/g' | grep -v '^freeswitch' | tr '\n' ',' | sed -e 's/,$//' -e 's/,/, /g')" + if [ -n "$x" ]; then + if [ ! "$mod_suggests" = "." ]; then + mod_suggests="${mod_suggests}, ${x}" + else mod_suggests="${x}"; fi; fi } genmodctl_new_mod () { @@ -1108,10 +1170,13 @@ echo "Generating control-modules.gen as sanity check..." >&2 map_modules ':' 'genmodctl_cat' 'genmodctl_mod' \ ) > control-modules.gen -echo "Accumulating build dependencies from modules..." >&2 -map_modules 'mod_filter' '' 'accumulate_build_depends' +echo "Accumulating dependencies from modules..." >&2 +map_modules 'mod_filter' '' 'accumulate_mod_deps' echo "Generating debian/..." >&2 > control +> freeswitch-all.install +(print_edit_warning; print_mod_overrides "freeswitch-all") \ + > freeswitch-all.lintian-overrides (print_edit_warning; print_source_control; print_core_control) >> control echo "Generating debian/ (conf)..." >&2 (echo "### conf"; echo) >> control @@ -1125,6 +1190,25 @@ print_edit_warning > modules_.conf map_modules "mod_filter" \ "gencontrol_per_cat genmodules_per_cat" \ "gencontrol_per_mod geninstall_per_mod genoverrides_per_mod genmodules_per_mod" +echo "Generating debian/ (-all package)..." >&2 +grep -e '^Package:' control | grep -v '^freeswitch-all$' | while xread l; do + m="${l#*: }" + f=$m.install + if [ -s $f ]; then + grep -v '^##\|^$' $f | while xread x; do + if ! grep -e "$x" freeswitch-all.install >/dev/null; then + printf '%s\n' "$x" >> freeswitch-all.install + fi + done + fi +done +for x in postinst postrm preinst prerm; do + cp -a freeswitch.$x freeswitch-all.$x +done +cp -a freeswitch-doc.docs freeswitch-all.docs +#cp -a freeswitch-systemd.freeswitch.service freeswitch-all.freeswitch.service +cp -a freeswitch-sysvinit.freeswitch.default freeswitch-all.freeswitch.default +cp -a freeswitch-sysvinit.freeswitch.init freeswitch-all.freeswitch.init echo "Generating additional lintian overrides..." >&2 grep -e '^Package:' control | while xread l; do diff --git a/debian/control-modules b/debian/control-modules index 61f0b33a80..cd7acb2c73 100644 --- a/debian/control-modules +++ b/debian/control-modules @@ -478,6 +478,10 @@ Module: event_handlers/mod_event_zmq Description: mod_event_zmq Adds mod_event_zmq. +Module: event_handlers/mod_format_cdr +Description: mod_format_cdr + Adds mod_format_cdr. + Module: event_handlers/mod_json_cdr Description: mod_json_cdr Adds mod_json_cdr. diff --git a/debian/freeswitch-mod-perl.install.tmpl b/debian/freeswitch-mod-perl.install.tmpl new file mode 100644 index 0000000000..5b2fe712f3 --- /dev/null +++ b/debian/freeswitch-mod-perl.install.tmpl @@ -0,0 +1,2 @@ +debian/tmp/usr/perl/freeswitch.pm /usr/lib/perl5 +debian/tmp/usr/perl/freeswitch.so /usr/lib/perl5/auto/freeswitch diff --git a/debian/rules b/debian/rules index 7da66a8eaa..7d7d50fd71 100755 --- a/debian/rules +++ b/debian/rules @@ -104,6 +104,7 @@ override_dh_auto_install: override_dh_installinit: dh_installinit -pfreeswitch-sysvinit --name=freeswitch + dh_installinit -pfreeswitch-all --name=freeswitch debian-bootstrap: debian/.stamp-bootstrap debian/.stamp-bootstrap: diff --git a/libs/apr-util/xml/expat/buildconf.sh b/libs/apr-util/xml/expat/buildconf.sh index 1f5789dc07..9050a0282a 100755 --- a/libs/apr-util/xml/expat/buildconf.sh +++ b/libs/apr-util/xml/expat/buildconf.sh @@ -28,26 +28,34 @@ rm -rf aclocal.m4 libtool.m4 ltsugar.m4 autom4te*.cache $libtoolize --copy --automake # -# Build aclocal.m4 from libtool's libtool.m4 +# find libtool.m4 # -if [ -f libtool.m4 ]; then - ltfile=libtool.m4 -else +if [ ! -f libtool.m4 ]; then ltpath=`dirname $libtoolize` ltfile=${LIBTOOL_M4-`cd $ltpath/../share/aclocal ; pwd`/libtool.m4} + if [ -f $ltfile ]; then + echo "libtool.m4 found at $ltfile" + cp $ltfile libtool.m4 + else + echo "libtool.m4 not found - aborting!" + exit 1 + fi fi -echo "Incorporating $ltfile into aclocal.m4 ..." + +# +# Build aclocal.m4 from libtool's m4 files +# echo "dnl THIS FILE IS AUTOMATICALLY GENERATED BY buildconf.sh" > aclocal.m4 echo "dnl edits here will be lost" >> aclocal.m4 -cat $ltfile >> aclocal.m4 -if [ -f ltsugar.m4 ]; then - echo "Incorporating ltsugar.m4 into aclocal.m4 ..." - cat ltsugar.m4 >> aclocal.m4 -fi - -# Clean up again -rm -f libtool.m4 ltsugar.m4 +for m4file in libtool.m4 ltsugar.m4 ltoptions.m4 ltversion.m4 lt~obsolete.m4 +do + if [ -f $m4file ]; then + echo "Incorporating $m4file into aclocal.m4 ..." + cat $m4file >> aclocal.m4 + rm -f $m4file + fi +done cross_compile_warning="warning: AC_TRY_RUN called without default to allow cross compiling" diff --git a/libs/apr-util/xml/expat/configure.in b/libs/apr-util/xml/expat/configure.in index 478d8d5313..f808df4cce 100644 --- a/libs/apr-util/xml/expat/configure.in +++ b/libs/apr-util/xml/expat/configure.in @@ -12,6 +12,7 @@ dnl AC_INIT(Makefile.in) AC_CONFIG_AUX_DIR(conftools) +AC_CONFIG_MACRO_DIR(.) dnl dnl Follow the GNU/Linux convention of odd number minor version for diff --git a/libs/broadvoice/src/bitpack16.c b/libs/broadvoice/src/bitpack16.c index 703db648e7..4e134baf33 100644 --- a/libs/broadvoice/src/bitpack16.c +++ b/libs/broadvoice/src/bitpack16.c @@ -20,8 +20,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: bitpack16.c,v 1.1.1.1 2009/11/19 12:10:48 steveu Exp $ */ /*! \file */ @@ -80,12 +78,12 @@ void bv16_bitunpack(const uint8_t *PackedStream, struct BV16_Bit_Stream *BitStru stream = PackedStream; bitstream_init(&bs); - BitStruct->lspidx[0] = bitstream_get(&bs, &stream, 7); - BitStruct->lspidx[1] = bitstream_get(&bs, &stream, 7); - BitStruct->ppidx = bitstream_get(&bs, &stream, 7); - BitStruct->bqidx = bitstream_get(&bs, &stream, 5); - BitStruct->gidx = bitstream_get(&bs, &stream, 4); + BitStruct->lspidx[0] = (int16_t) bitstream_get(&bs, &stream, 7); + BitStruct->lspidx[1] = (int16_t) bitstream_get(&bs, &stream, 7); + BitStruct->ppidx = (int16_t) bitstream_get(&bs, &stream, 7); + BitStruct->bqidx = (int16_t) bitstream_get(&bs, &stream, 5); + BitStruct->gidx = (int16_t) bitstream_get(&bs, &stream, 4); for (i = 0; i < 10; i++) - BitStruct->qvidx[i] = bitstream_get(&bs, &stream, 5); + BitStruct->qvidx[i] = (int16_t) bitstream_get(&bs, &stream, 5); } diff --git a/libs/broadvoice/src/bitpack32.c b/libs/broadvoice/src/bitpack32.c index eafc53306b..2d3596b22f 100644 --- a/libs/broadvoice/src/bitpack32.c +++ b/libs/broadvoice/src/bitpack32.c @@ -20,8 +20,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: bitpack32.c,v 1.1.1.1 2009/11/19 12:10:48 steveu Exp $ */ /*! \file */ @@ -82,15 +80,15 @@ void bv32_bitunpack(const uint8_t *PackedStream, struct BV32_Bit_Stream *BitStru stream = PackedStream; bitstream_init(&bs); - BitStruct->lspidx[0] = bitstream_get(&bs, &stream, 7); - BitStruct->lspidx[1] = bitstream_get(&bs, &stream, 5); - BitStruct->lspidx[2] = bitstream_get(&bs, &stream, 5); + BitStruct->lspidx[0] = (int16_t) bitstream_get(&bs, &stream, 7); + BitStruct->lspidx[1] = (int16_t) bitstream_get(&bs, &stream, 5); + BitStruct->lspidx[2] = (int16_t) bitstream_get(&bs, &stream, 5); - BitStruct->ppidx = bitstream_get(&bs, &stream, 8); - BitStruct->bqidx = bitstream_get(&bs, &stream, 5); - BitStruct->gidx[0] = bitstream_get(&bs, &stream, 5); - BitStruct->gidx[1] = bitstream_get(&bs, &stream, 5); + BitStruct->ppidx = (int16_t) bitstream_get(&bs, &stream, 8); + BitStruct->bqidx = (int16_t) bitstream_get(&bs, &stream, 5); + BitStruct->gidx[0] = (int16_t) bitstream_get(&bs, &stream, 5); + BitStruct->gidx[1] = (int16_t) bitstream_get(&bs, &stream, 5); for (i = 0; i < 20; i++) - BitStruct->qvidx[i] = bitstream_get(&bs, &stream, 6); + BitStruct->qvidx[i] = (int16_t) bitstream_get(&bs, &stream, 6); } diff --git a/libs/broadvoice/src/floating/bv16/bv16encoder.c b/libs/broadvoice/src/floating/bv16/bv16encoder.c index 2eccf7124c..a57cfc5733 100644 --- a/libs/broadvoice/src/floating/bv16/bv16encoder.c +++ b/libs/broadvoice/src/floating/bv16/bv16encoder.c @@ -20,8 +20,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: bv16encoder.c,v 1.1.1.1 2009/11/19 12:10:48 steveu Exp $ */ /*! \file */ @@ -169,10 +167,10 @@ BV_DECLARE(int) bv16_encode(bv16_encode_state_t *cs, /* Refine the pitch period in the neighborhood of coarse pitch period also calculate the pitch predictor tap for single-tap predictor */ pp = refinepitch(dq, cpp, &ppt); - bs.ppidx = pp - MINPP; + bs.ppidx = (int16_t) (pp - MINPP); /* Vector quantize 3 pitch predictor taps with minimum residual energy */ - bs.bqidx = pitchtapquan(dq, pp, bq, &lg); + bs.bqidx = (int16_t) pitchtapquan(dq, pp, bq, &lg); /* Get coefficients of long-term noise feedback filter */ if (ppt > 1.0) @@ -184,7 +182,7 @@ BV_DECLARE(int) bv16_encode(bv16_encode_state_t *cs, /* Gain quantization */ lg = (lg < FRSZ) ? 0 : log(lg/FRSZ)/log(2.0); - bs.gidx = gainquan(&gainq, lg, cs->lgpm, cs->prevlg, cs->level); + bs.gidx = (int16_t) gainquan(&gainq, lg, cs->lgpm, cs->prevlg, cs->level); /* Level estimation */ dummy = estl_alpha; diff --git a/libs/broadvoice/src/floating/bv16/bv16excquan.c b/libs/broadvoice/src/floating/bv16/bv16excquan.c index 2004b229cc..1fbc6d9ef4 100644 --- a/libs/broadvoice/src/floating/bv16/bv16excquan.c +++ b/libs/broadvoice/src/floating/bv16/bv16excquan.c @@ -22,8 +22,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: bv16excquan.c,v 1.1.1.1 2009/11/19 12:10:48 steveu Exp $ */ /*! \file */ @@ -241,9 +239,9 @@ void excquan(int16_t *idx, /* quantizer codebook index for uq[] vector */ /* The best codevector has been found; assign vq codebook index */ if (sign == 1.0F) - idx[iv++] = jmin; + idx[iv++] = (int16_t) jmin; else - idx[iv++] = jmin + CBSZ; /* MSB of index is sign bit */ + idx[iv++] = (int16_t) (jmin + CBSZ); /* MSB of index is sign bit */ fp3 = &cb[jmin*VDIM]; /* fp3 points to start of best codevector */ for (n = 0; n < VDIM; n++) diff --git a/libs/broadvoice/src/floating/bv16/bv16lspquan.c b/libs/broadvoice/src/floating/bv16/bv16lspquan.c index 73904fe192..7246099641 100644 --- a/libs/broadvoice/src/floating/bv16/bv16lspquan.c +++ b/libs/broadvoice/src/floating/bv16/bv16lspquan.c @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: bv16lspquan.c,v 1.1.1.1 2009/11/19 12:10:48 steveu Exp $ */ /*! \file */ @@ -36,30 +34,26 @@ #include "bv16externs.h" #include "bvcommon.h" -void vqmse( - Float *xq, - int16_t *idx, - Float *x, - const Float *cb, - int vdim, - int cbsz); +void vqmse(Float *xq, + int16_t *idx, + Float *x, + const Float *cb, + int vdim, + int cbsz); -void svqwmse( - Float *xq, - int16_t *idx, - Float *x, - Float *xa, - Float *w, - const Float *cb, - int vdim, - int cbsz); +void svqwmse(Float *xq, + int16_t *idx, + Float *x, + Float *xa, + Float *w, + const Float *cb, + int vdim, + int cbsz); -void lspquan( - Float *lspq, - int16_t *lspidx, - Float *lsp, - Float *lsppm -) +void lspquan(Float *lspq, + int16_t *lspidx, + Float *lsp, + Float *lsppm) { Float d[LPCO]; Float w[LPCO]; @@ -75,7 +69,7 @@ void lspquan( int i; int k; - /* calculate the weights for weighted mean-square error distortion */ + /* Calculate the weights for weighted mean-square error distortion */ for (i = 0; i < LPCO - 1; i++) d[i] = lsp[i + 1] - lsp[i]; /* LSP difference vector */ w[0] = 1.0F/d[0]; @@ -119,7 +113,7 @@ void lspquan( for (i = 0; i < LPCO; i++) lspe[i] = lspeq1[i] + lspeq2[i]; - /* update lsp ma predictor memory */ + /* Update lsp ma predictor memory */ i = LPCO * LSPPORDER - 1; fp1 = &lsppm[i]; fp2 = &lsppm[i - 1]; @@ -131,20 +125,20 @@ void lspquan( fp2--; } - /* calculate quantized lsp */ + /* Calculate quantized lsp */ for (i = 0; i < LPCO; i++) lspq[i] = lspa[i] + lspeq2[i]; - /* ensure correct ordering of lsp to guarantee lpc filter stability */ + /* Ensure correct ordering of lsp to guarantee lpc filter stability */ stblz_lsp(lspq, LPCO); } -void vqmse(Float *xq, /* VQ output vector (quantized version of input vector) */ - int16_t *idx, /* VQ codebook index for the nearest neighbor */ - Float *x, /* input vector */ - const Float *cb, /* VQ codebook */ - int vdim, /* vector dimension */ - int cbsz) /* codebook size (number of codevectors) */ +void vqmse(Float *xq, /* VQ output vector (quantized version of input vector) */ + int16_t *idx, /* VQ codebook index for the nearest neighbor */ + Float *x, /* input vector */ + const Float *cb, /* VQ codebook */ + int vdim, /* vector dimension */ + int cbsz) /* codebook size (number of codevectors) */ { const Float *fp1; Float dmin; @@ -166,7 +160,7 @@ void vqmse(Float *xq, /* VQ output vector (quantized version of input vector) if (d < dmin) { dmin = d; - *idx = j; + *idx = (int16_t) j; } } @@ -176,23 +170,24 @@ void vqmse(Float *xq, /* VQ output vector (quantized version of input vector) } /* Signed WMSE VQ */ -void svqwmse( - Float *xq, /* VQ output vector (quantized version of input vector) */ - int16_t *idx, /* VQ codebook index for the nearest neighbor */ - Float *x, /* input vector */ - Float *xa, /* approximation prior to current stage */ - Float *w, /* weights for weighted Mean-Square Error */ - const Float *cb, /* VQ codebook */ - int vdim, /* vector dimension */ - int cbsz /* codebook size (number of codevectors) */ -) +void svqwmse(Float *xq, /* VQ output vector (quantized version of input vector) */ + int16_t *idx, /* VQ codebook index for the nearest neighbor */ + Float *x, /* input vector */ + Float *xa, /* approximation prior to current stage */ + Float *w, /* weights for weighted Mean-Square Error */ + const Float *cb, /* VQ codebook */ + int vdim, /* vector dimension */ + int cbsz) /* codebook size (number of codevectors) */ { const Float *fp1; const Float *fp2; Float dmin; Float d; Float xqc[STBLDIM]; - int j, k, stbl, sign=1; + int j; + int k; + int stbl; + int sign = 1; Float e; fp1 = cb; @@ -211,17 +206,17 @@ void svqwmse( d += w[k]*e*e; } - /* check candidate - negative sign */ + /* Check candidate - negative sign */ if (d < dmin) { for (k = 0; k < STBLDIM; k++) xqc[k] = xa[k] - *fp2++; - /* check stability - negative sign */ + /* Check stability - negative sign */ stbl = stblchck(xqc, STBLDIM); if (stbl > 0) { dmin = d; - *idx = j; + *idx = (int16_t) j; sign = -1; } } @@ -237,18 +232,18 @@ void svqwmse( d += w[k]*e*e; } - /* check candidate - positive sign */ + /* Check candidate - positive sign */ if (d < dmin) { for (k = 0; k < STBLDIM; k++) xqc[k] = xa[k] + *fp2++; - /* check stability - positive sign */ + /* Check stability - positive sign */ stbl = stblchck(xqc, STBLDIM); if (stbl > 0) { dmin = d; - *idx = j; + *idx = (int16_t) j; sign = +1; } } diff --git a/libs/broadvoice/src/floating/bv32/bv32encoder.c b/libs/broadvoice/src/floating/bv32/bv32encoder.c index d6ec9b7306..5cd56509b8 100644 --- a/libs/broadvoice/src/floating/bv32/bv32encoder.c +++ b/libs/broadvoice/src/floating/bv32/bv32encoder.c @@ -20,8 +20,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: bv32encoder.c,v 1.1.1.1 2009/11/19 12:10:48 steveu Exp $ */ /*! \file */ @@ -161,10 +159,10 @@ BV_DECLARE(int) bv32_encode(bv32_encode_state_t *cs, /* Refine the pitch period in the neighborhood of coarse pitch period also calculate the pitch predictor tap for single-tap predictor */ pp = bv32_refinepitch(dq, cpp, &ppt); - bs.ppidx = pp - MINPP; + bs.ppidx = (int16_t) (pp - MINPP); /* vq 3 pitch predictor taps with minimum residual energy */ - bs.bqidx = bv32_pitchtapquan(dq, pp, bq); + bs.bqidx = (int16_t) bv32_pitchtapquan(dq, pp, bq); /* get coefficients for long-term noise feedback filter */ if (ppt > 1.0) @@ -190,9 +188,9 @@ BV_DECLARE(int) bv32_encode(bv32_encode_state_t *cs, /* Log-gain quantization within each sub-frame */ lg = (ee < TMinE) ? MinE : log(ee/SFRSZ)/log(2.0); - bs.gidx[issf] = bv32_gainquan(gainq + issf, lg, cs->lgpm, cs->prevlg, cs->level); + bs.gidx[issf] = (int16_t) bv32_gainquan(gainq + issf, lg, cs->lgpm, cs->prevlg, cs->level); - /* Level estimation */ + /* Level Estimation */ bv32_estlevel(cs->prevlg[0], &cs->level, &cs->lmax, &cs->lmin, &cs->lmean, &cs->x1); /* Scale the excitation codebook */ diff --git a/libs/broadvoice/src/floating/bv32/bv32excquan.c b/libs/broadvoice/src/floating/bv32/bv32excquan.c index 6f25831bf2..2ea6dbf958 100644 --- a/libs/broadvoice/src/floating/bv32/bv32excquan.c +++ b/libs/broadvoice/src/floating/bv32/bv32excquan.c @@ -20,8 +20,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: bv32excquan.c,v 1.1.1.1 2009/11/19 12:10:48 steveu Exp $ */ /*! \file */ @@ -186,9 +184,9 @@ void bv32_excquan(Float *qv, /* output quantized excitation signal vector */ /* THE BEST CODEVECTOR HAS BEEN FOUND; ASSIGN VQ CODEBOOK INDEX */ if (sign == 1.0F) - idx[iv++] = jmin; + idx[iv++] = (int16_t) jmin; else - idx[iv++] = jmin + CBSZ; /* MSB of index is sign bit */ + idx[iv++] = (int16_t) (jmin + CBSZ); /* MSB of index is sign bit */ /* BORROW zbuf[] TO STORE FINAL VQ OUTPUT VECTOR WITH CORRECT SIGN */ fp3 = &cb[jmin*VDIM]; /* fp3 points to start of best codevector */ diff --git a/libs/broadvoice/src/floating/bv32/bv32lspquan.c b/libs/broadvoice/src/floating/bv32/bv32lspquan.c index 72727e7579..7e78f77715 100644 --- a/libs/broadvoice/src/floating/bv32/bv32lspquan.c +++ b/libs/broadvoice/src/floating/bv32/bv32lspquan.c @@ -20,8 +20,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: bv32lspquan.c,v 1.1.1.1 2009/11/19 12:10:48 steveu Exp $ */ /*! \file */ @@ -153,7 +151,7 @@ static void vqmse(Float *xq, /* VQ output vector (quantized version of input if (d < dmin) { dmin = d; - *idx = j; + *idx = (int16_t) j; } } @@ -211,7 +209,7 @@ static void vqwmse_stbl(Float *xq, /* VQ output vector (quantized version of if (d < dmin) { dmin = d; - *idx = j; + *idx = (int16_t) j; } } } @@ -256,7 +254,7 @@ static void vqwmse(Float *xq, /* VQ output vector (quantized version of inp if (d < dmin) { dmin = d; - *idx = j; + *idx = (int16_t) j; } } diff --git a/libs/libg722_1/src/decoderf.c b/libs/libg722_1/src/decoderf.c index e0e8e61743..1fcb2ff78d 100644 --- a/libs/libg722_1/src/decoderf.c +++ b/libs/libg722_1/src/decoderf.c @@ -263,7 +263,6 @@ static void decode_vector_quantized_mlt_indices(g722_1_decode_state_t *s, int signs_index; int bit; int num_sign_bits; - int num_bits; int ran_out_of_bits_flag; int random_word; const int16_t *decoder_table_ptr; @@ -282,7 +281,6 @@ static void decode_vector_quantized_mlt_indices(g722_1_decode_state_t *s, for (n = 0; n < num_vecs; n++) { - num_bits = 0; index = 0; do { @@ -450,7 +448,7 @@ static void decode_vector_quantized_mlt_indices(g722_1_decode_state_t *s, if (category == NUM_CATEGORIES - 1) { - noifillpos = standard_deviation*0.70711; + noifillpos = standard_deviation*0.70711f; noifillneg = -noifillpos; /* This assumes region_size = 20 */ diff --git a/libs/libg722_1/src/tables.c b/libs/libg722_1/src/tables.c index a0eed803bf..cf15bd3f73 100644 --- a/libs/libg722_1/src/tables.c +++ b/libs/libg722_1/src/tables.c @@ -63,70 +63,70 @@ const int16_t int_region_standard_deviation_table[REGION_POWER_TABLE_SIZE] = #else const float region_standard_deviation_table[REGION_POWER_TABLE_SIZE] = { - 2.441406247570224e-04, - 3.452669826719395e-04, - 4.882812495545411e-04, - 6.905339654011486e-04, - 9.765624991900746e-04, - 1.381067930916839e-03, - 1.953124998542134e-03, - 2.762135862062757e-03, - 3.906249997408239e-03, - 5.524271724583683e-03, - 7.812499995464418e-03, - 1.104854345008369e-02, - 1.562499999222472e-02, - 2.209708690200003e-02, - 3.124999998704119e-02, - 4.419417380766535e-02, - 6.249999997926591e-02, - 8.838834762266132e-02, - 1.249999999688989e-01, - 1.767766952599839e-01, - 2.499999999585318e-01, - 3.535533905492901e-01, - 4.999999999585318e-01, - 7.071067811572251e-01, - 1.000000000000000e+00, - 1.414213562431740e+00, - 2.000000000165873e+00, - 2.828427125098059e+00, - 4.000000000663491e+00, - 5.656854250665278e+00, - 8.000000001990472e+00, - 1.131370850226887e+01, - 1.600000000530792e+01, - 2.262741700641438e+01, - 3.200000001326981e+01, - 4.525483401658204e+01, - 6.400000003184756e+01, - 9.050966804067060e+01, - 1.280000000743110e+02, - 1.810193360963542e+02, - 2.560000001698536e+02, - 3.620386722227349e+02, - 5.120000003821707e+02, - 7.240773445055215e+02, - 1.024000000849268e+03, - 1.448154689131149e+03, - 2.048000001868390e+03, - 2.896309378502505e+03, - 4.096000004076487e+03, - 5.792618757485434e+03, - 8.192000008832390e+03, - 1.158523751593169e+04, - 1.638400001902361e+04, - 2.317047503378509e+04, - 3.276800004076484e+04, - 4.634095007141347e+04, - 6.553600008696507e+04, - 9.268190015051374e+04, - 1.310720001848009e+05, - 1.853638003164007e+05, - 2.621440003913428e+05, - 3.707276006635486e+05, - 5.242880008261676e+05, - 7.414552013885899e+05 + 2.441406247570224e-04f, + 3.452669826719395e-04f, + 4.882812495545411e-04f, + 6.905339654011486e-04f, + 9.765624991900746e-04f, + 1.381067930916839e-03f, + 1.953124998542134e-03f, + 2.762135862062757e-03f, + 3.906249997408239e-03f, + 5.524271724583683e-03f, + 7.812499995464418e-03f, + 1.104854345008369e-02f, + 1.562499999222472e-02f, + 2.209708690200003e-02f, + 3.124999998704119e-02f, + 4.419417380766535e-02f, + 6.249999997926591e-02f, + 8.838834762266132e-02f, + 1.249999999688989e-01f, + 1.767766952599839e-01f, + 2.499999999585318e-01f, + 3.535533905492901e-01f, + 4.999999999585318e-01f, + 7.071067811572251e-01f, + 1.000000000000000e+00f, + 1.414213562431740e+00f, + 2.000000000165873e+00f, + 2.828427125098059e+00f, + 4.000000000663491e+00f, + 5.656854250665278e+00f, + 8.000000001990472e+00f, + 1.131370850226887e+01f, + 1.600000000530792e+01f, + 2.262741700641438e+01f, + 3.200000001326981e+01f, + 4.525483401658204e+01f, + 6.400000003184756e+01f, + 9.050966804067060e+01f, + 1.280000000743110e+02f, + 1.810193360963542e+02f, + 2.560000001698536e+02f, + 3.620386722227349e+02f, + 5.120000003821707e+02f, + 7.240773445055215e+02f, + 1.024000000849268e+03f, + 1.448154689131149e+03f, + 2.048000001868390e+03f, + 2.896309378502505e+03f, + 4.096000004076487e+03f, + 5.792618757485434e+03f, + 8.192000008832390e+03f, + 1.158523751593169e+04f, + 1.638400001902361e+04f, + 2.317047503378509e+04f, + 3.276800004076484e+04f, + 4.634095007141347e+04f, + 6.553600008696507e+04f, + 9.268190015051374e+04f, + 1.310720001848009e+05f, + 1.853638003164007e+05f, + 2.621440003913428e+05f, + 3.707276006635486e+05f, + 5.242880008261676e+05f, + 7.414552013885899e+05f }; #endif @@ -144,70 +144,70 @@ const int16_t standard_deviation_inverse_table[REGION_POWER_TABLE_SIZE] = #else const float standard_deviation_inverse_table[REGION_POWER_TABLE_SIZE] = { - 4.096000004076488e+03, - 2.896309378502504e+03, - 2.048000001868390e+03, - 1.448154689131149e+03, - 1.024000000849268e+03, - 7.240773445055215e+02, - 5.120000003821708e+02, - 3.620386722227349e+02, - 2.560000001698537e+02, - 1.810193360963542e+02, - 1.280000000743110e+02, - 9.050966804067060e+01, - 6.400000003184756e+01, - 4.525483401658203e+01, - 3.200000001326982e+01, - 2.262741700641438e+01, - 1.600000000530793e+01, - 1.131370850226887e+01, - 8.000000001990474e+00, - 5.656854250665277e+00, - 4.000000000663491e+00, - 2.828427125098059e+00, - 2.000000000165873e+00, - 1.414213562431740e+00, - 1.000000000000000e+00, - 7.071067811572251e-01, - 4.999999999585318e-01, - 3.535533905492901e-01, - 2.499999999585318e-01, - 1.767766952599838e-01, - 1.249999999688989e-01, - 8.838834762266132e-02, - 6.249999997926592e-02, - 4.419417380766535e-02, - 3.124999998704120e-02, - 2.209708690200002e-02, - 1.562499999222472e-02, - 1.104854345008369e-02, - 7.812499995464418e-03, - 5.524271724583683e-03, - 3.906249997408239e-03, - 2.762135862062757e-03, - 1.953124998542134e-03, - 1.381067930916839e-03, - 9.765624991900747e-04, - 6.905339654011486e-04, - 4.882812495545411e-04, - 3.452669826719394e-04, - 2.441406247570224e-04, - 1.726334913216520e-04, - 1.220703123683871e-04, - 8.631674565366727e-05, - 6.103515617913153e-05, - 4.315837282325419e-05, - 3.051757808703478e-05, - 2.157918640983742e-05, - 1.525878904225187e-05, - 1.078959320402385e-05, - 7.629394520493171e-06, - 5.394796601564505e-06, - 3.814697259930213e-06, - 2.697398300558537e-06, - 1.907348629806920e-06, - 1.348699150167414e-06 + 4.096000004076488e+03f, + 2.896309378502504e+03f, + 2.048000001868390e+03f, + 1.448154689131149e+03f, + 1.024000000849268e+03f, + 7.240773445055215e+02f, + 5.120000003821708e+02f, + 3.620386722227349e+02f, + 2.560000001698537e+02f, + 1.810193360963542e+02f, + 1.280000000743110e+02f, + 9.050966804067060e+01f, + 6.400000003184756e+01f, + 4.525483401658203e+01f, + 3.200000001326982e+01f, + 2.262741700641438e+01f, + 1.600000000530793e+01f, + 1.131370850226887e+01f, + 8.000000001990474e+00f, + 5.656854250665277e+00f, + 4.000000000663491e+00f, + 2.828427125098059e+00f, + 2.000000000165873e+00f, + 1.414213562431740e+00f, + 1.000000000000000e+00f, + 7.071067811572251e-01f, + 4.999999999585318e-01f, + 3.535533905492901e-01f, + 2.499999999585318e-01f, + 1.767766952599838e-01f, + 1.249999999688989e-01f, + 8.838834762266132e-02f, + 6.249999997926592e-02f, + 4.419417380766535e-02f, + 3.124999998704120e-02f, + 2.209708690200002e-02f, + 1.562499999222472e-02f, + 1.104854345008369e-02f, + 7.812499995464418e-03f, + 5.524271724583683e-03f, + 3.906249997408239e-03f, + 2.762135862062757e-03f, + 1.953124998542134e-03f, + 1.381067930916839e-03f, + 9.765624991900747e-04f, + 6.905339654011486e-04f, + 4.882812495545411e-04f, + 3.452669826719394e-04f, + 2.441406247570224e-04f, + 1.726334913216520e-04f, + 1.220703123683871e-04f, + 8.631674565366727e-05f, + 6.103515617913153e-05f, + 4.315837282325419e-05f, + 3.051757808703478e-05f, + 2.157918640983742e-05f, + 1.525878904225187e-05f, + 1.078959320402385e-05f, + 7.629394520493171e-06f, + 5.394796601564505e-06f, + 3.814697259930213e-06f, + 2.697398300558537e-06f, + 1.907348629806920e-06f, + 1.348699150167414e-06f }; #endif @@ -239,14 +239,14 @@ const float step_size[NUM_CATEGORIES] = const float step_size_inverse_table[NUM_CATEGORIES] = { - 2.82805443e+00, - 2.00000000e+00, - 1.41422713e+00, - 1.00000000e+00, - 7.07113564e-01, - 5.00000000e-01, - 3.53556782e-01, - 3.53556782e-01 + 2.82805443e+00f, + 2.00000000e+00f, + 1.41422713e+00f, + 1.00000000e+00f, + 7.07113564e-01f, + 5.00000000e-01f, + 3.53556782e-01f, + 3.53556782e-01f }; #endif @@ -277,137 +277,137 @@ const float dead_zone[NUM_CATEGORIES] = #if !defined(G722_1_USE_FIXED_POINT) const float region_power_table[REGION_POWER_TABLE_SIZE] = { - 5.96046448e-08, - 1.19209290e-07, - 2.38418579e-07, - 4.76837158e-07, - 9.53674316e-07, - 1.90734863e-06, - 3.81469727e-06, - 7.62939453e-06, - 1.52587891e-05, - 3.05175781e-05, - 6.10351562e-05, - 1.22070312e-04, - 2.44140625e-04, - 4.88281250e-04, - 9.76562500e-04, - 1.95312500e-03, - 3.90625000e-03, - 7.81250000e-03, - 1.56250000e-02, - 3.12500000e-02, - 6.25000000e-02, - 1.25000000e-01, - 2.50000000e-01, - 5.00000000e-01, - 1.00000000e+00, - 2.00000000e+00, - 4.00000000e+00, - 8.00000000e+00, - 1.60000000e+01, - 3.20000000e+01, - 6.40000000e+01, - 1.28000000e+02, - 2.56000000e+02, - 5.12000000e+02, - 1.02400000e+03, - 2.04800000e+03, - 4.09600000e+03, - 8.19200000e+03, - 1.63840000e+04, - 3.27680000e+04, - 6.55360000e+04, - 1.31072000e+05, - 2.62144000e+05, - 5.24288000e+05, - 1.04857600e+06, - 2.09715200e+06, - 4.19430400e+06, - 8.38860800e+06, - 1.67772160e+07, - 3.35544320e+07, - 6.71088640e+07, - 1.34217728e+08, - 2.68435456e+08, - 5.36870912e+08, - 1.07374182e+09, - 2.14748365e+09, - 4.29496730e+09, - 8.58993459e+09, - 1.71798692e+10, - 3.43597384e+10, - 6.87194767e+10, - 1.37438953e+11, - 2.74877907e+11, - 5.49755814e+11 + 5.96046448e-08f, + 1.19209290e-07f, + 2.38418579e-07f, + 4.76837158e-07f, + 9.53674316e-07f, + 1.90734863e-06f, + 3.81469727e-06f, + 7.62939453e-06f, + 1.52587891e-05f, + 3.05175781e-05f, + 6.10351562e-05f, + 1.22070312e-04f, + 2.44140625e-04f, + 4.88281250e-04f, + 9.76562500e-04f, + 1.95312500e-03f, + 3.90625000e-03f, + 7.81250000e-03f, + 1.56250000e-02f, + 3.12500000e-02f, + 6.25000000e-02f, + 1.25000000e-01f, + 2.50000000e-01f, + 5.00000000e-01f, + 1.00000000e+00f, + 2.00000000e+00f, + 4.00000000e+00f, + 8.00000000e+00f, + 1.60000000e+01f, + 3.20000000e+01f, + 6.40000000e+01f, + 1.28000000e+02f, + 2.56000000e+02f, + 5.12000000e+02f, + 1.02400000e+03f, + 2.04800000e+03f, + 4.09600000e+03f, + 8.19200000e+03f, + 1.63840000e+04f, + 3.27680000e+04f, + 6.55360000e+04f, + 1.31072000e+05f, + 2.62144000e+05f, + 5.24288000e+05f, + 1.04857600e+06f, + 2.09715200e+06f, + 4.19430400e+06f, + 8.38860800e+06f, + 1.67772160e+07f, + 3.35544320e+07f, + 6.71088640e+07f, + 1.34217728e+08f, + 2.68435456e+08f, + 5.36870912e+08f, + 1.07374182e+09f, + 2.14748365e+09f, + 4.29496730e+09f, + 8.58993459e+09f, + 1.71798692e+10f, + 3.43597384e+10f, + 6.87194767e+10f, + 1.37438953e+11f, + 2.74877907e+11f, + 5.49755814e+11f }; const float region_power_table_boundary[REGION_POWER_TABLE_SIZE - 1] = { - 8.42936956e-08, - 1.68587391e-07, - 3.37174782e-07, - 6.74349565e-07, - 1.34869913e-06, - 2.69739826e-06, - 5.39479652e-06, - 1.07895930e-05, - 2.15791861e-05, - 4.31583721e-05, - 8.63167443e-05, - 1.72633489e-04, - 3.45266977e-04, - 6.90533954e-04, - 1.38106791e-03, - 2.76213582e-03, - 5.52427163e-03, - 1.10485433e-02, - 2.20970865e-02, - 4.41941731e-02, - 8.83883461e-02, - 1.76776692e-01, - 3.53553385e-01, - 7.07106769e-01, - 1.41421354e+00, - 2.82842708e+00, - 5.65685415e+00, - 1.13137083e+01, - 2.26274166e+01, - 4.52548332e+01, - 9.05096664e+01, - 1.81019333e+02, - 3.62038666e+02, - 7.24077332e+02, - 1.44815466e+03, - 2.89630933e+03, - 5.79261865e+03, - 1.15852373e+04, - 2.31704746e+04, - 4.63409492e+04, - 9.26818984e+04, - 1.85363797e+05, - 3.70727594e+05, - 7.41455188e+05, - 1.48291038e+06, - 2.96582075e+06, - 5.93164150e+06, - 1.18632830e+07, - 2.37265660e+07, - 4.74531320e+07, - 9.49062640e+07, - 1.89812528e+08, - 3.79625056e+08, - 7.59250112e+08, - 1.51850022e+09, - 3.03700045e+09, - 6.07400090e+09, - 1.21480018e+10, - 2.42960036e+10, - 4.85920072e+10, - 9.71840143e+10, - 1.94368029e+11, - 3.88736057e+11 + 8.42936956e-08f, + 1.68587391e-07f, + 3.37174782e-07f, + 6.74349565e-07f, + 1.34869913e-06f, + 2.69739826e-06f, + 5.39479652e-06f, + 1.07895930e-05f, + 2.15791861e-05f, + 4.31583721e-05f, + 8.63167443e-05f, + 1.72633489e-04f, + 3.45266977e-04f, + 6.90533954e-04f, + 1.38106791e-03f, + 2.76213582e-03f, + 5.52427163e-03f, + 1.10485433e-02f, + 2.20970865e-02f, + 4.41941731e-02f, + 8.83883461e-02f, + 1.76776692e-01f, + 3.53553385e-01f, + 7.07106769e-01f, + 1.41421354e+00f, + 2.82842708e+00f, + 5.65685415e+00f, + 1.13137083e+01f, + 2.26274166e+01f, + 4.52548332e+01f, + 9.05096664e+01f, + 1.81019333e+02f, + 3.62038666e+02f, + 7.24077332e+02f, + 1.44815466e+03f, + 2.89630933e+03f, + 5.79261865e+03f, + 1.15852373e+04f, + 2.31704746e+04f, + 4.63409492e+04f, + 9.26818984e+04f, + 1.85363797e+05f, + 3.70727594e+05f, + 7.41455188e+05f, + 1.48291038e+06f, + 2.96582075e+06f, + 5.93164150e+06f, + 1.18632830e+07f, + 2.37265660e+07f, + 4.74531320e+07f, + 9.49062640e+07f, + 1.89812528e+08f, + 3.79625056e+08f, + 7.59250112e+08f, + 1.51850022e+09f, + 3.03700045e+09f, + 6.07400090e+09f, + 1.21480018e+10f, + 2.42960036e+10f, + 4.85920072e+10f, + 9.71840143e+10f, + 1.94368029e+11f, + 3.88736057e+11f }; #endif diff --git a/libs/openzap/configure.ac b/libs/openzap/configure.ac index d2c23c1091..9b41d26953 100644 --- a/libs/openzap/configure.ac +++ b/libs/openzap/configure.ac @@ -80,6 +80,15 @@ esac #set SOLINK variable based on compiler and host if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then SOLINK="-Bdynamic -dy -G" +elif test "x${ax_cv_c_compiler_vendor}" = "xclang" ; then + case "$host" in + *darwin*) + SOLINK="-dynamic -bundle -force-flat-namespace" + ;; + *) + AC_ERROR([Please update configure.in with SOLINK values for your compiler]) + ;; + esac elif test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then case "$host" in *darwin*) diff --git a/libs/sofia-sip/.update b/libs/sofia-sip/.update index 36fa387d65..241cdefa22 100644 --- a/libs/sofia-sip/.update +++ b/libs/sofia-sip/.update @@ -1 +1 @@ -Tue Oct 8 12:10:32 CDT 2013 +Mon Oct 21 20:11:13 CDT 2013 diff --git a/libs/sofia-sip/libsofia-sip-ua/tport/ws.c b/libs/sofia-sip/libsofia-sip-ua/tport/ws.c index a8d056c895..41df93fdcf 100644 --- a/libs/sofia-sip/libsofia-sip-ua/tport/ws.c +++ b/libs/sofia-sip/libsofia-sip-ua/tport/ws.c @@ -334,8 +334,7 @@ ssize_t ws_raw_read(wsh_t *wsh, void *data, size_t bytes) #else if (x++) Sleep(10); #endif - } while (r == -1 && (errno == EAGAIN || errno == EINTR || errno == EWOULDBLOCK || - errno == 35 || errno == 730035 || errno == 2 || errno == 60) && x < 100); + } while (r == -1 && xp_is_blocking(xp_errno()) && x < 100); if (x >= 100) { r = -1; @@ -364,7 +363,7 @@ ssize_t ws_raw_write(wsh_t *wsh, void *data, size_t bytes) do { r = send(wsh->sock, data, bytes, 0); - } while (r == -1 && (errno == EAGAIN || errno == EINTR)); + } while (r == -1 && xp_is_blocking(xp_errno())); //if (r<0) { //printf("wRITE FAIL: %s\n", strerror(errno)); @@ -789,4 +788,28 @@ ssize_t ws_write_frame(wsh_t *wsh, ws_opcode_t oc, void *data, size_t bytes) return bytes; } +#ifdef _MSC_VER +int xp_errno(void) +{ + return WSAGetLastError(); +} + +int xp_is_blocking(int errcode) +{ + return errcode == WSAEWOULDBLOCK || errcode == WSAEINPROGRESS; +} + +#else + +int xp_errno(void) +{ + return errno; +} + +int xp_is_blocking(int errcode) +{ + return errcode == EAGAIN || errcode == EWOULDBLOCK || errcode == EINPROGRESS || errcode == EINTR; +} + +#endif diff --git a/libs/sofia-sip/libsofia-sip-ua/tport/ws.h b/libs/sofia-sip/libsofia-sip-ua/tport/ws.h index 11e6b93068..992998be48 100644 --- a/libs/sofia-sip/libsofia-sip-ua/tport/ws.h +++ b/libs/sofia-sip/libsofia-sip-ua/tport/ws.h @@ -13,7 +13,6 @@ #include #else #pragma warning(disable:4996) -#include #endif #include #include @@ -27,7 +26,14 @@ #include #ifdef _MSC_VER -typedef intptr_t ssize_t; +#ifdef _WIN64 +#define WS_SSIZE_T __int64 +#elif _MSC_VER >= 1400 +#define WS_SSIZE_T __int32 __w64 +#else +#define WS_SSIZE_T __int32 +#endif +typedef WS_SSIZE_T ssize_t #endif @@ -90,6 +96,9 @@ ssize_t ws_close(wsh_t *wsh, int16_t reason); void ws_destroy(wsh_t *wsh); void init_ssl(void); void deinit_ssl(void); +int xp_errno(void); +int xp_is_blocking(int errcode); + #ifndef _MSC_VER diff --git a/libs/spandsp/src/libspandsp.2012.sln b/libs/spandsp/src/libspandsp.2012.sln new file mode 100644 index 0000000000..c0cc75f4e3 --- /dev/null +++ b/libs/spandsp/src/libspandsp.2012.sln @@ -0,0 +1,318 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Express 2012 for Windows Desktop +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_at_dictionary", "msvc\make_at_dictionary.2012.vcxproj", "{DEE932AB-5911-4700-9EEB-8C7090A0A330}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_modem_filter", "msvc\make_modem_filter.2012.vcxproj", "{329A6FA0-0FCC-4435-A950-E670AEFA9838}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_t43_gray_code_tables", "msvc\make_t43_gray_code_tables.2012.vcxproj", "{EDDB8AB9-C53E-44C0-A620-0E86C2CBD5D5}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_cielab_luts", "msvc\make_cielab_luts.2012.vcxproj", "{85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_math_fixed_tables", "msvc\make_math_fixed_tables.2012.vcxproj", "{2386B892-35F5-46CF-A0F0-10394D2FBF9B}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libspandsp", "libspandsp.2012.vcxproj", "{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}" + ProjectSection(ProjectDependencies) = postProject + {329A6FA0-0FCC-4435-A950-E670AEFA9838} = {329A6FA0-0FCC-4435-A950-E670AEFA9838} + {DEE932AB-5911-4700-9EEB-8C7090A0A330} = {DEE932AB-5911-4700-9EEB-8C7090A0A330} + {401A40CD-5DB4-4E34-AC68-FA99E9FAC014} = {401A40CD-5DB4-4E34-AC68-FA99E9FAC014} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_line_models", "..\spandsp-sim\msvc\make_line_models.2012.vcxproj", "{F290BADE-82DE-4037-B49D-D563E43169DA}" + ProjectSection(ProjectDependencies) = postProject + {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5} = {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libspandsp_sim", "..\spandsp-sim\libspandsp_sim.2012.vcxproj", "{502F1E51-F0A0-4607-AB7F-05BAB530AAE1}" + ProjectSection(ProjectDependencies) = postProject + {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5} = {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "download libjpeg", "msvc\download_libjpeg.2012.vcxproj", "{652AD5F7-8488-489F-AAD0-7FBE064703B6}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "download libtiff", "msvc\download_libtiff.2012.vcxproj", "{2B8A45C9-FEB4-4734-AB37-8DB9DB899917}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libjpeg", "msvc\libjpeg.2012.vcxproj", "{019DBD2A-273D-4BA4-BF86-B5EFE2ED76B1}" + ProjectSection(ProjectDependencies) = postProject + {652AD5F7-8488-489F-AAD0-7FBE064703B6} = {652AD5F7-8488-489F-AAD0-7FBE064703B6} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libtiff", "msvc\libtiff.2012.vcxproj", "{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}" + ProjectSection(ProjectDependencies) = postProject + {019DBD2A-273D-4BA4-BF86-B5EFE2ED76B1} = {019DBD2A-273D-4BA4-BF86-B5EFE2ED76B1} + {652AD5F7-8488-489F-AAD0-7FBE064703B6} = {652AD5F7-8488-489F-AAD0-7FBE064703B6} + {2B8A45C9-FEB4-4734-AB37-8DB9DB899917} = {2B8A45C9-FEB4-4734-AB37-8DB9DB899917} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "t38_core_tests", "..\tests\msvc\t38_core_tests.2012.vcxproj", "{A34A9D0E-A7E2-4A04-B044-7BB2FE709EF3}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "t38_non_ecm_buffer_tests", "..\tests\msvc\t38_non_ecm_buffer_tests.2012.vcxproj", "{80A3D9D9-3846-4DA5-8676-F940D725EA62}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vector_int_tests", "..\tests\msvc\vector_int_tests.2012.vcxproj", "{80A60464-29E8-4EE8-BAFA-8708B7C08CC3}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vector_float_tests", "..\tests\msvc\vector_float_tests.2012.vcxproj", "{EA745FF7-9E4B-4C13-BA19-2EE8165A6245}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "complex_tests", "..\tests\msvc\complex_tests.2012.vcxproj", "{A349379F-0FEA-49C8-9535-05F39663337B}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "complex_vector_float_tests", "..\tests\msvc\complex_vector_float_tests.2012.vcxproj", "{2B0D705C-1CF2-401C-BFBC-A43FB806908C}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "complex_vector_int_tests", "..\tests\msvc\complex_vector_int_tests.2012.vcxproj", "{C2E8B4D1-A398-4D57-94F8-B61F20C7D514}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "queue_tests", "..\tests\msvc\queue_tests.2012.vcxproj", "{D9C0F575-83E7-4C15-BF71-D7A0D44A26BF}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dtmf_tx_tests", "..\tests\msvc\dtmf_tx_tests.2012.vcxproj", "{1577F41D-9A06-45DD-87D4-9ADCC9CCDAD5}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dtmf_rx_tests", "..\tests\msvc\dtmf_rx_tests.2012.vcxproj", "{24E7EF80-7854-4A21-80FB-31C4E71109DE}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "v29_tests", "..\tests\msvc\v29_tests.2012.vcxproj", "{323BD962-4581-4561-8105-8C166A9FA933}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "v80_tests", "..\tests\msvc\v80_tests.2012.vcxproj", "{10263F04-37DD-4E4A-AE4F-0641B018B714}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "v22bis_tests", "..\tests\msvc\v22bis_tests.2012.vcxproj", "{DA4DB99F-E5BA-48BD-BB6B-3595CE24CBAE}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "v8_tests", "..\tests\msvc\v8_tests.2012.vcxproj", "{0C69B8C2-0CE1-4CD4-870C-1C13FB3F9B34}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{C84E437E-9D4C-46C8-9724-DF301C849E61}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + All|Win32 = All|Win32 + All|x64 = All|x64 + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {DEE932AB-5911-4700-9EEB-8C7090A0A330}.All|Win32.ActiveCfg = All|Win32 + {DEE932AB-5911-4700-9EEB-8C7090A0A330}.All|Win32.Build.0 = All|Win32 + {DEE932AB-5911-4700-9EEB-8C7090A0A330}.All|x64.ActiveCfg = All|Win32 + {DEE932AB-5911-4700-9EEB-8C7090A0A330}.Debug|Win32.ActiveCfg = All|Win32 + {DEE932AB-5911-4700-9EEB-8C7090A0A330}.Debug|Win32.Build.0 = All|Win32 + {DEE932AB-5911-4700-9EEB-8C7090A0A330}.Debug|x64.ActiveCfg = All|Win32 + {DEE932AB-5911-4700-9EEB-8C7090A0A330}.Release|Win32.ActiveCfg = All|Win32 + {DEE932AB-5911-4700-9EEB-8C7090A0A330}.Release|x64.ActiveCfg = All|Win32 + {329A6FA0-0FCC-4435-A950-E670AEFA9838}.All|Win32.ActiveCfg = All|Win32 + {329A6FA0-0FCC-4435-A950-E670AEFA9838}.All|Win32.Build.0 = All|Win32 + {329A6FA0-0FCC-4435-A950-E670AEFA9838}.All|x64.ActiveCfg = All|Win32 + {329A6FA0-0FCC-4435-A950-E670AEFA9838}.Debug|Win32.ActiveCfg = All|Win32 + {329A6FA0-0FCC-4435-A950-E670AEFA9838}.Debug|Win32.Build.0 = All|Win32 + {329A6FA0-0FCC-4435-A950-E670AEFA9838}.Debug|x64.ActiveCfg = All|Win32 + {329A6FA0-0FCC-4435-A950-E670AEFA9838}.Release|Win32.ActiveCfg = All|Win32 + {329A6FA0-0FCC-4435-A950-E670AEFA9838}.Release|x64.ActiveCfg = All|Win32 + {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.All|Win32.ActiveCfg = Release|x64 + {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.All|x64.ActiveCfg = Release|x64 + {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.All|x64.Build.0 = Release|x64 + {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Debug|Win32.ActiveCfg = Debug|Win32 + {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Debug|Win32.Build.0 = Debug|Win32 + {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Debug|x64.ActiveCfg = Debug|x64 + {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Debug|x64.Build.0 = Debug|x64 + {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Release|Win32.ActiveCfg = Release|Win32 + {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Release|Win32.Build.0 = Release|Win32 + {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Release|x64.ActiveCfg = Release|x64 + {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Release|x64.Build.0 = Release|x64 + {F290BADE-82DE-4037-B49D-D563E43169DA}.All|Win32.ActiveCfg = All|Win32 + {F290BADE-82DE-4037-B49D-D563E43169DA}.All|Win32.Build.0 = All|Win32 + {F290BADE-82DE-4037-B49D-D563E43169DA}.All|x64.ActiveCfg = All|Win32 + {F290BADE-82DE-4037-B49D-D563E43169DA}.Debug|Win32.ActiveCfg = All|Win32 + {F290BADE-82DE-4037-B49D-D563E43169DA}.Debug|Win32.Build.0 = All|Win32 + {F290BADE-82DE-4037-B49D-D563E43169DA}.Debug|x64.ActiveCfg = All|Win32 + {F290BADE-82DE-4037-B49D-D563E43169DA}.Release|Win32.ActiveCfg = All|Win32 + {F290BADE-82DE-4037-B49D-D563E43169DA}.Release|Win32.Build.0 = All|Win32 + {F290BADE-82DE-4037-B49D-D563E43169DA}.Release|x64.ActiveCfg = All|Win32 + {502F1E51-F0A0-4607-AB7F-05BAB530AAE1}.All|Win32.ActiveCfg = Release|Win32 + {502F1E51-F0A0-4607-AB7F-05BAB530AAE1}.All|Win32.Build.0 = Release|Win32 + {502F1E51-F0A0-4607-AB7F-05BAB530AAE1}.All|x64.ActiveCfg = Release|Win32 + {502F1E51-F0A0-4607-AB7F-05BAB530AAE1}.Debug|Win32.ActiveCfg = Debug|Win32 + {502F1E51-F0A0-4607-AB7F-05BAB530AAE1}.Debug|Win32.Build.0 = Debug|Win32 + {502F1E51-F0A0-4607-AB7F-05BAB530AAE1}.Debug|x64.ActiveCfg = Debug|Win32 + {502F1E51-F0A0-4607-AB7F-05BAB530AAE1}.Release|Win32.ActiveCfg = Release|Win32 + {502F1E51-F0A0-4607-AB7F-05BAB530AAE1}.Release|Win32.Build.0 = Release|Win32 + {502F1E51-F0A0-4607-AB7F-05BAB530AAE1}.Release|x64.ActiveCfg = Release|Win32 + {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.All|Win32.ActiveCfg = Release|x64 + {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.All|x64.ActiveCfg = Release|x64 + {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.All|x64.Build.0 = Release|x64 + {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Debug|Win32.ActiveCfg = Debug|Win32 + {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Debug|Win32.Build.0 = Debug|Win32 + {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Debug|x64.ActiveCfg = Debug|x64 + {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Debug|x64.Build.0 = Debug|x64 + {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Release|Win32.ActiveCfg = Release|Win32 + {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Release|Win32.Build.0 = Release|Win32 + {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Release|x64.ActiveCfg = Release|x64 + {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Release|x64.Build.0 = Release|x64 + {652AD5F7-8488-489F-AAD0-7FBE064703B6}.All|Win32.ActiveCfg = All|Win32 + {652AD5F7-8488-489F-AAD0-7FBE064703B6}.All|Win32.Build.0 = All|Win32 + {652AD5F7-8488-489F-AAD0-7FBE064703B6}.All|x64.ActiveCfg = All|Win32 + {652AD5F7-8488-489F-AAD0-7FBE064703B6}.Debug|Win32.ActiveCfg = All|Win32 + {652AD5F7-8488-489F-AAD0-7FBE064703B6}.Debug|Win32.Build.0 = All|Win32 + {652AD5F7-8488-489F-AAD0-7FBE064703B6}.Debug|x64.ActiveCfg = All|Win32 + {652AD5F7-8488-489F-AAD0-7FBE064703B6}.Release|Win32.ActiveCfg = All|Win32 + {652AD5F7-8488-489F-AAD0-7FBE064703B6}.Release|Win32.Build.0 = All|Win32 + {652AD5F7-8488-489F-AAD0-7FBE064703B6}.Release|x64.ActiveCfg = All|Win32 + {2B8A45C9-FEB4-4734-AB37-8DB9DB899917}.All|Win32.ActiveCfg = All|Win32 + {2B8A45C9-FEB4-4734-AB37-8DB9DB899917}.All|Win32.Build.0 = All|Win32 + {2B8A45C9-FEB4-4734-AB37-8DB9DB899917}.All|x64.ActiveCfg = All|Win32 + {2B8A45C9-FEB4-4734-AB37-8DB9DB899917}.Debug|Win32.ActiveCfg = All|Win32 + {2B8A45C9-FEB4-4734-AB37-8DB9DB899917}.Debug|Win32.Build.0 = All|Win32 + {2B8A45C9-FEB4-4734-AB37-8DB9DB899917}.Debug|x64.ActiveCfg = All|Win32 + {2B8A45C9-FEB4-4734-AB37-8DB9DB899917}.Release|Win32.ActiveCfg = All|Win32 + {2B8A45C9-FEB4-4734-AB37-8DB9DB899917}.Release|Win32.Build.0 = All|Win32 + {2B8A45C9-FEB4-4734-AB37-8DB9DB899917}.Release|x64.ActiveCfg = All|Win32 + {A34A9D0E-A7E2-4A04-B044-7BB2FE709EF3}.All|Win32.ActiveCfg = Release|Win32 + {A34A9D0E-A7E2-4A04-B044-7BB2FE709EF3}.All|Win32.Build.0 = Release|Win32 + {A34A9D0E-A7E2-4A04-B044-7BB2FE709EF3}.All|x64.ActiveCfg = Release|Win32 + {A34A9D0E-A7E2-4A04-B044-7BB2FE709EF3}.Debug|Win32.ActiveCfg = Debug|Win32 + {A34A9D0E-A7E2-4A04-B044-7BB2FE709EF3}.Debug|Win32.Build.0 = Debug|Win32 + {A34A9D0E-A7E2-4A04-B044-7BB2FE709EF3}.Debug|x64.ActiveCfg = Debug|Win32 + {A34A9D0E-A7E2-4A04-B044-7BB2FE709EF3}.Release|Win32.ActiveCfg = Release|Win32 + {A34A9D0E-A7E2-4A04-B044-7BB2FE709EF3}.Release|Win32.Build.0 = Release|Win32 + {A34A9D0E-A7E2-4A04-B044-7BB2FE709EF3}.Release|x64.ActiveCfg = Release|Win32 + {80A3D9D9-3846-4DA5-8676-F940D725EA62}.All|Win32.ActiveCfg = Release|Win32 + {80A3D9D9-3846-4DA5-8676-F940D725EA62}.All|Win32.Build.0 = Release|Win32 + {80A3D9D9-3846-4DA5-8676-F940D725EA62}.All|x64.ActiveCfg = Release|Win32 + {80A3D9D9-3846-4DA5-8676-F940D725EA62}.Debug|Win32.ActiveCfg = Debug|Win32 + {80A3D9D9-3846-4DA5-8676-F940D725EA62}.Debug|Win32.Build.0 = Debug|Win32 + {80A3D9D9-3846-4DA5-8676-F940D725EA62}.Debug|x64.ActiveCfg = Debug|Win32 + {80A3D9D9-3846-4DA5-8676-F940D725EA62}.Release|Win32.ActiveCfg = Release|Win32 + {80A3D9D9-3846-4DA5-8676-F940D725EA62}.Release|Win32.Build.0 = Release|Win32 + {80A3D9D9-3846-4DA5-8676-F940D725EA62}.Release|x64.ActiveCfg = Release|Win32 + {80A60464-29E8-4EE8-BAFA-8708B7C08CC3}.All|Win32.ActiveCfg = Release|Win32 + {80A60464-29E8-4EE8-BAFA-8708B7C08CC3}.All|Win32.Build.0 = Release|Win32 + {80A60464-29E8-4EE8-BAFA-8708B7C08CC3}.All|x64.ActiveCfg = Release|Win32 + {80A60464-29E8-4EE8-BAFA-8708B7C08CC3}.Debug|Win32.ActiveCfg = Debug|Win32 + {80A60464-29E8-4EE8-BAFA-8708B7C08CC3}.Debug|Win32.Build.0 = Debug|Win32 + {80A60464-29E8-4EE8-BAFA-8708B7C08CC3}.Debug|x64.ActiveCfg = Debug|Win32 + {80A60464-29E8-4EE8-BAFA-8708B7C08CC3}.Release|Win32.ActiveCfg = Release|Win32 + {80A60464-29E8-4EE8-BAFA-8708B7C08CC3}.Release|Win32.Build.0 = Release|Win32 + {80A60464-29E8-4EE8-BAFA-8708B7C08CC3}.Release|x64.ActiveCfg = Release|Win32 + {EA745FF7-9E4B-4C13-BA19-2EE8165A6245}.All|Win32.ActiveCfg = Release|Win32 + {EA745FF7-9E4B-4C13-BA19-2EE8165A6245}.All|Win32.Build.0 = Release|Win32 + {EA745FF7-9E4B-4C13-BA19-2EE8165A6245}.All|x64.ActiveCfg = Release|Win32 + {EA745FF7-9E4B-4C13-BA19-2EE8165A6245}.Debug|Win32.ActiveCfg = Debug|Win32 + {EA745FF7-9E4B-4C13-BA19-2EE8165A6245}.Debug|Win32.Build.0 = Debug|Win32 + {EA745FF7-9E4B-4C13-BA19-2EE8165A6245}.Debug|x64.ActiveCfg = Debug|Win32 + {EA745FF7-9E4B-4C13-BA19-2EE8165A6245}.Release|Win32.ActiveCfg = Release|Win32 + {EA745FF7-9E4B-4C13-BA19-2EE8165A6245}.Release|Win32.Build.0 = Release|Win32 + {EA745FF7-9E4B-4C13-BA19-2EE8165A6245}.Release|x64.ActiveCfg = Release|Win32 + {A349379F-0FEA-49C8-9535-05F39663337B}.All|Win32.ActiveCfg = Release|Win32 + {A349379F-0FEA-49C8-9535-05F39663337B}.All|Win32.Build.0 = Release|Win32 + {A349379F-0FEA-49C8-9535-05F39663337B}.All|x64.ActiveCfg = Release|Win32 + {A349379F-0FEA-49C8-9535-05F39663337B}.Debug|Win32.ActiveCfg = Debug|Win32 + {A349379F-0FEA-49C8-9535-05F39663337B}.Debug|Win32.Build.0 = Debug|Win32 + {A349379F-0FEA-49C8-9535-05F39663337B}.Debug|x64.ActiveCfg = Debug|Win32 + {A349379F-0FEA-49C8-9535-05F39663337B}.Release|Win32.ActiveCfg = Release|Win32 + {A349379F-0FEA-49C8-9535-05F39663337B}.Release|Win32.Build.0 = Release|Win32 + {A349379F-0FEA-49C8-9535-05F39663337B}.Release|x64.ActiveCfg = Release|Win32 + {2B0D705C-1CF2-401C-BFBC-A43FB806908C}.All|Win32.ActiveCfg = Release|Win32 + {2B0D705C-1CF2-401C-BFBC-A43FB806908C}.All|Win32.Build.0 = Release|Win32 + {2B0D705C-1CF2-401C-BFBC-A43FB806908C}.All|x64.ActiveCfg = Release|Win32 + {2B0D705C-1CF2-401C-BFBC-A43FB806908C}.Debug|Win32.ActiveCfg = Debug|Win32 + {2B0D705C-1CF2-401C-BFBC-A43FB806908C}.Debug|Win32.Build.0 = Debug|Win32 + {2B0D705C-1CF2-401C-BFBC-A43FB806908C}.Debug|x64.ActiveCfg = Debug|Win32 + {2B0D705C-1CF2-401C-BFBC-A43FB806908C}.Release|Win32.ActiveCfg = Release|Win32 + {2B0D705C-1CF2-401C-BFBC-A43FB806908C}.Release|Win32.Build.0 = Release|Win32 + {2B0D705C-1CF2-401C-BFBC-A43FB806908C}.Release|x64.ActiveCfg = Release|Win32 + {C2E8B4D1-A398-4D57-94F8-B61F20C7D514}.All|Win32.ActiveCfg = Release|Win32 + {C2E8B4D1-A398-4D57-94F8-B61F20C7D514}.All|Win32.Build.0 = Release|Win32 + {C2E8B4D1-A398-4D57-94F8-B61F20C7D514}.All|x64.ActiveCfg = Release|Win32 + {C2E8B4D1-A398-4D57-94F8-B61F20C7D514}.Debug|Win32.ActiveCfg = Debug|Win32 + {C2E8B4D1-A398-4D57-94F8-B61F20C7D514}.Debug|Win32.Build.0 = Debug|Win32 + {C2E8B4D1-A398-4D57-94F8-B61F20C7D514}.Debug|x64.ActiveCfg = Debug|Win32 + {C2E8B4D1-A398-4D57-94F8-B61F20C7D514}.Release|Win32.ActiveCfg = Release|Win32 + {C2E8B4D1-A398-4D57-94F8-B61F20C7D514}.Release|Win32.Build.0 = Release|Win32 + {C2E8B4D1-A398-4D57-94F8-B61F20C7D514}.Release|x64.ActiveCfg = Release|Win32 + {EDDB8AB9-C53E-44C0-A620-0E86C2CBD5D5}.All|Win32.ActiveCfg = All|Win32 + {EDDB8AB9-C53E-44C0-A620-0E86C2CBD5D5}.All|Win32.Build.0 = All|Win32 + {EDDB8AB9-C53E-44C0-A620-0E86C2CBD5D5}.All|x64.ActiveCfg = All|Win32 + {EDDB8AB9-C53E-44C0-A620-0E86C2CBD5D5}.Debug|Win32.ActiveCfg = All|Win32 + {EDDB8AB9-C53E-44C0-A620-0E86C2CBD5D5}.Debug|Win32.Build.0 = All|Win32 + {EDDB8AB9-C53E-44C0-A620-0E86C2CBD5D5}.Debug|x64.ActiveCfg = All|Win32 + {EDDB8AB9-C53E-44C0-A620-0E86C2CBD5D5}.Release|Win32.ActiveCfg = All|Win32 + {EDDB8AB9-C53E-44C0-A620-0E86C2CBD5D5}.Release|Win32.Build.0 = All|Win32 + {EDDB8AB9-C53E-44C0-A620-0E86C2CBD5D5}.Release|x64.ActiveCfg = All|Win32 + {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.All|Win32.ActiveCfg = All|Win32 + {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.All|Win32.Build.0 = All|Win32 + {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.All|x64.ActiveCfg = All|Win32 + {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Debug|Win32.ActiveCfg = All|Win32 + {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Debug|Win32.Build.0 = All|Win32 + {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Debug|x64.ActiveCfg = All|Win32 + {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Release|Win32.ActiveCfg = All|Win32 + {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Release|Win32.Build.0 = All|Win32 + {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Release|x64.ActiveCfg = All|Win32 + {2386B892-35F5-46CF-A0F0-10394D2FBF9B}.All|Win32.ActiveCfg = All|Win32 + {2386B892-35F5-46CF-A0F0-10394D2FBF9B}.All|Win32.Build.0 = All|Win32 + {2386B892-35F5-46CF-A0F0-10394D2FBF9B}.All|x64.ActiveCfg = All|Win32 + {2386B892-35F5-46CF-A0F0-10394D2FBF9B}.Debug|Win32.ActiveCfg = All|Win32 + {2386B892-35F5-46CF-A0F0-10394D2FBF9B}.Debug|Win32.Build.0 = All|Win32 + {2386B892-35F5-46CF-A0F0-10394D2FBF9B}.Debug|x64.ActiveCfg = All|Win32 + {2386B892-35F5-46CF-A0F0-10394D2FBF9B}.Release|Win32.ActiveCfg = All|Win32 + {2386B892-35F5-46CF-A0F0-10394D2FBF9B}.Release|Win32.Build.0 = All|Win32 + {2386B892-35F5-46CF-A0F0-10394D2FBF9B}.Release|x64.ActiveCfg = All|Win32 + {D9C0F575-83E7-4C15-BF71-D7A0D44A26BF}.All|Win32.ActiveCfg = Release|Win32 + {D9C0F575-83E7-4C15-BF71-D7A0D44A26BF}.All|Win32.Build.0 = Release|Win32 + {D9C0F575-83E7-4C15-BF71-D7A0D44A26BF}.All|x64.ActiveCfg = Release|Win32 + {D9C0F575-83E7-4C15-BF71-D7A0D44A26BF}.Debug|Win32.ActiveCfg = Debug|Win32 + {D9C0F575-83E7-4C15-BF71-D7A0D44A26BF}.Debug|Win32.Build.0 = Debug|Win32 + {D9C0F575-83E7-4C15-BF71-D7A0D44A26BF}.Debug|x64.ActiveCfg = Debug|Win32 + {D9C0F575-83E7-4C15-BF71-D7A0D44A26BF}.Release|Win32.ActiveCfg = Release|Win32 + {D9C0F575-83E7-4C15-BF71-D7A0D44A26BF}.Release|Win32.Build.0 = Release|Win32 + {D9C0F575-83E7-4C15-BF71-D7A0D44A26BF}.Release|x64.ActiveCfg = Release|Win32 + {1577F41D-9A06-45DD-87D4-9ADCC9CCDAD5}.All|Win32.ActiveCfg = Release|Win32 + {1577F41D-9A06-45DD-87D4-9ADCC9CCDAD5}.All|Win32.Build.0 = Release|Win32 + {1577F41D-9A06-45DD-87D4-9ADCC9CCDAD5}.All|x64.ActiveCfg = Release|Win32 + {1577F41D-9A06-45DD-87D4-9ADCC9CCDAD5}.Debug|Win32.ActiveCfg = Debug|Win32 + {1577F41D-9A06-45DD-87D4-9ADCC9CCDAD5}.Debug|Win32.Build.0 = Debug|Win32 + {1577F41D-9A06-45DD-87D4-9ADCC9CCDAD5}.Debug|x64.ActiveCfg = Debug|Win32 + {1577F41D-9A06-45DD-87D4-9ADCC9CCDAD5}.Release|Win32.ActiveCfg = Release|Win32 + {1577F41D-9A06-45DD-87D4-9ADCC9CCDAD5}.Release|Win32.Build.0 = Release|Win32 + {1577F41D-9A06-45DD-87D4-9ADCC9CCDAD5}.Release|x64.ActiveCfg = Release|Win32 + {24E7EF80-7854-4A21-80FB-31C4E71109DE}.All|Win32.ActiveCfg = Release|Win32 + {24E7EF80-7854-4A21-80FB-31C4E71109DE}.All|Win32.Build.0 = Release|Win32 + {24E7EF80-7854-4A21-80FB-31C4E71109DE}.All|x64.ActiveCfg = Release|Win32 + {24E7EF80-7854-4A21-80FB-31C4E71109DE}.Debug|Win32.ActiveCfg = Debug|Win32 + {24E7EF80-7854-4A21-80FB-31C4E71109DE}.Debug|Win32.Build.0 = Debug|Win32 + {24E7EF80-7854-4A21-80FB-31C4E71109DE}.Debug|x64.ActiveCfg = Debug|Win32 + {24E7EF80-7854-4A21-80FB-31C4E71109DE}.Release|Win32.ActiveCfg = Release|Win32 + {24E7EF80-7854-4A21-80FB-31C4E71109DE}.Release|Win32.Build.0 = Release|Win32 + {24E7EF80-7854-4A21-80FB-31C4E71109DE}.Release|x64.ActiveCfg = Release|Win32 + {323BD962-4581-4561-8105-8C166A9FA933}.All|Win32.ActiveCfg = Release|Win32 + {323BD962-4581-4561-8105-8C166A9FA933}.All|Win32.Build.0 = Release|Win32 + {323BD962-4581-4561-8105-8C166A9FA933}.All|x64.ActiveCfg = Release|Win32 + {323BD962-4581-4561-8105-8C166A9FA933}.Debug|Win32.ActiveCfg = Debug|Win32 + {323BD962-4581-4561-8105-8C166A9FA933}.Debug|Win32.Build.0 = Debug|Win32 + {323BD962-4581-4561-8105-8C166A9FA933}.Debug|x64.ActiveCfg = Debug|Win32 + {323BD962-4581-4561-8105-8C166A9FA933}.Release|Win32.ActiveCfg = Release|Win32 + {323BD962-4581-4561-8105-8C166A9FA933}.Release|Win32.Build.0 = Release|Win32 + {323BD962-4581-4561-8105-8C166A9FA933}.Release|x64.ActiveCfg = Release|Win32 + {10263F04-37DD-4E4A-AE4F-0641B018B714}.All|Win32.ActiveCfg = Release|Win32 + {10263F04-37DD-4E4A-AE4F-0641B018B714}.All|Win32.Build.0 = Release|Win32 + {10263F04-37DD-4E4A-AE4F-0641B018B714}.All|x64.ActiveCfg = Release|Win32 + {10263F04-37DD-4E4A-AE4F-0641B018B714}.Debug|Win32.ActiveCfg = Debug|Win32 + {10263F04-37DD-4E4A-AE4F-0641B018B714}.Debug|Win32.Build.0 = Debug|Win32 + {10263F04-37DD-4E4A-AE4F-0641B018B714}.Debug|x64.ActiveCfg = Debug|Win32 + {10263F04-37DD-4E4A-AE4F-0641B018B714}.Release|Win32.ActiveCfg = Release|Win32 + {10263F04-37DD-4E4A-AE4F-0641B018B714}.Release|Win32.Build.0 = Release|Win32 + {10263F04-37DD-4E4A-AE4F-0641B018B714}.Release|x64.ActiveCfg = Release|Win32 + {DA4DB99F-E5BA-48BD-BB6B-3595CE24CBAE}.All|Win32.ActiveCfg = Release|Win32 + {DA4DB99F-E5BA-48BD-BB6B-3595CE24CBAE}.All|Win32.Build.0 = Release|Win32 + {DA4DB99F-E5BA-48BD-BB6B-3595CE24CBAE}.All|x64.ActiveCfg = Release|Win32 + {DA4DB99F-E5BA-48BD-BB6B-3595CE24CBAE}.Debug|Win32.ActiveCfg = Debug|Win32 + {DA4DB99F-E5BA-48BD-BB6B-3595CE24CBAE}.Debug|Win32.Build.0 = Debug|Win32 + {DA4DB99F-E5BA-48BD-BB6B-3595CE24CBAE}.Debug|x64.ActiveCfg = Debug|Win32 + {DA4DB99F-E5BA-48BD-BB6B-3595CE24CBAE}.Release|Win32.ActiveCfg = Release|Win32 + {DA4DB99F-E5BA-48BD-BB6B-3595CE24CBAE}.Release|Win32.Build.0 = Release|Win32 + {DA4DB99F-E5BA-48BD-BB6B-3595CE24CBAE}.Release|x64.ActiveCfg = Release|Win32 + {0C69B8C2-0CE1-4CD4-870C-1C13FB3F9B34}.All|Win32.ActiveCfg = Release|Win32 + {0C69B8C2-0CE1-4CD4-870C-1C13FB3F9B34}.All|Win32.Build.0 = Release|Win32 + {0C69B8C2-0CE1-4CD4-870C-1C13FB3F9B34}.All|x64.ActiveCfg = Release|Win32 + {0C69B8C2-0CE1-4CD4-870C-1C13FB3F9B34}.Debug|Win32.ActiveCfg = Debug|Win32 + {0C69B8C2-0CE1-4CD4-870C-1C13FB3F9B34}.Debug|Win32.Build.0 = Debug|Win32 + {0C69B8C2-0CE1-4CD4-870C-1C13FB3F9B34}.Debug|x64.ActiveCfg = Debug|Win32 + {0C69B8C2-0CE1-4CD4-870C-1C13FB3F9B34}.Release|Win32.ActiveCfg = Release|Win32 + {0C69B8C2-0CE1-4CD4-870C-1C13FB3F9B34}.Release|Win32.Build.0 = Release|Win32 + {0C69B8C2-0CE1-4CD4-870C-1C13FB3F9B34}.Release|x64.ActiveCfg = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/libs/spandsp/src/libspandsp.2012.vcxproj.filters b/libs/spandsp/src/libspandsp.2012.vcxproj.filters index dea495c328..bc694efb84 100644 --- a/libs/spandsp/src/libspandsp.2012.vcxproj.filters +++ b/libs/spandsp/src/libspandsp.2012.vcxproj.filters @@ -696,8 +696,12 @@ Header Files - - + + Header Files + + + Header Files + Header Files diff --git a/libs/spandsp/src/make_cielab_luts.c b/libs/spandsp/src/make_cielab_luts.c index b143817d85..dc5172817d 100644 --- a/libs/spandsp/src/make_cielab_luts.c +++ b/libs/spandsp/src/make_cielab_luts.c @@ -72,7 +72,7 @@ int main(int argc, char *argv[]) r = floorf(r*256.0f); - srgb = (r < 0) ? 0 : (r <= 255) ? r : 255; + srgb = (uint8_t) ((r < 0) ? 0 : (r <= 255) ? r : 255); printf((i < 4095) ? " %d,\n" : " %d\n", srgb); } diff --git a/libs/spandsp/src/make_math_fixed_tables.c b/libs/spandsp/src/make_math_fixed_tables.c index 075cb15bd2..8e290b44ce 100644 --- a/libs/spandsp/src/make_math_fixed_tables.c +++ b/libs/spandsp/src/make_math_fixed_tables.c @@ -42,7 +42,7 @@ int main(int argc, char *argv[]) for (i = 0; i < 129; i++) { val = 32768.0*128.0/(128 + i) + 0.5; - ival = val; + ival = (int) val; if (i < 128) printf(" %6d,\n", ival); else @@ -54,7 +54,7 @@ int main(int argc, char *argv[]) printf("{\n"); for (i = 64; i <= 256; i++) { - ival = sqrt(i/256.0)*65536.0 + 0.5; + ival = (int) (sqrt(i/256.0)*65536.0 + 0.5); if (ival > 65535) ival = 65535; if (i < 256) @@ -68,7 +68,7 @@ int main(int argc, char *argv[]) printf("{\n"); for (i = 128; i <= 256; i++) { - ival = log10(i/256.0)*32768.0 - 0.5; + ival = (int) (log10(i/256.0)*32768.0 - 0.5); if (i <= 255) printf(" %6d,\n", ival); else @@ -81,7 +81,7 @@ int main(int argc, char *argv[]) for (i = 0; i <= 256; i++) { val = sin(i*3.1415926535/512.0)*32768.0; - ival = val + 0.5; + ival = (int) (val + 0.5); if (ival > 32767) ival = 32767; if (i <= 255) @@ -96,7 +96,7 @@ int main(int argc, char *argv[]) for (i = 0; i <= 256; i++) { val = atan(i/256.0)*65536.0/(2.0*3.1415926535); - ival = val + 0.5; + ival = (int) (val + 0.5); /* Nudge the result away from zero, so things sit consistently on the correct side of the axes. */ if (ival == 0) diff --git a/libs/spandsp/src/t38_gateway.c b/libs/spandsp/src/t38_gateway.c index c41df87c75..d89e21e0c4 100644 --- a/libs/spandsp/src/t38_gateway.c +++ b/libs/spandsp/src/t38_gateway.c @@ -258,7 +258,6 @@ static int set_next_tx_type(t38_gateway_state_t *s) int indicator; fax_modems_state_t *t; t38_gateway_hdlc_state_t *u; - int bit_rate; int short_train; int use_hdlc; @@ -348,20 +347,18 @@ static int set_next_tx_type(t38_gateway_state_t *s) break; case T38_IND_V27TER_2400_TRAINING: case T38_IND_V27TER_4800_TRAINING: - bit_rate = t->tx_bit_rate = (indicator == T38_IND_V27TER_4800_TRAINING) ? 4800 : 2400; silence_gen_alter(&t->silence_gen, ms_to_samples(75)); - fax_modems_start_fast_modem(t, FAX_MODEM_V27TER_TX, bit_rate, s->core.short_train, use_hdlc); + fax_modems_start_fast_modem(t, FAX_MODEM_V27TER_TX, t->tx_bit_rate, s->core.short_train, use_hdlc); fax_modems_set_tx_handler(t, (span_tx_handler_t) &silence_gen, &t->silence_gen); fax_modems_set_next_tx_handler(t, (span_tx_handler_t) &v27ter_tx, &t->fast_modems.v27ter_tx); fax_modems_set_rx_active(t, true); break; case T38_IND_V29_7200_TRAINING: case T38_IND_V29_9600_TRAINING: - bit_rate = t->tx_bit_rate = (indicator == T38_IND_V29_9600_TRAINING) ? 9600 : 7200; silence_gen_alter(&t->silence_gen, ms_to_samples(75)); - fax_modems_start_fast_modem(t, FAX_MODEM_V29_TX, bit_rate, s->core.short_train, use_hdlc); + fax_modems_start_fast_modem(t, FAX_MODEM_V29_TX, t->tx_bit_rate, s->core.short_train, use_hdlc); fax_modems_set_tx_handler(t, (span_tx_handler_t) &silence_gen, &t->silence_gen); fax_modems_set_next_tx_handler(t, (span_tx_handler_t) &v29_tx, &t->fast_modems.v29_tx); fax_modems_set_rx_active(t, true); @@ -379,37 +376,36 @@ static int set_next_tx_type(t38_gateway_state_t *s) { case T38_IND_V17_7200_SHORT_TRAINING: short_train = true; - bit_rate = 7200; + t->tx_bit_rate = 7200; break; case T38_IND_V17_7200_LONG_TRAINING: - bit_rate = 7200; + t->tx_bit_rate = 7200; break; case T38_IND_V17_9600_SHORT_TRAINING: short_train = true; - bit_rate = 9600; + t->tx_bit_rate = 9600; break; case T38_IND_V17_9600_LONG_TRAINING: - bit_rate = 9600; + t->tx_bit_rate = 9600; break; case T38_IND_V17_12000_SHORT_TRAINING: short_train = true; - bit_rate = 12000; + t->tx_bit_rate = 12000; break; case T38_IND_V17_12000_LONG_TRAINING: - bit_rate = 12000; + t->tx_bit_rate = 12000; break; case T38_IND_V17_14400_SHORT_TRAINING: short_train = true; - bit_rate = 14400; + t->tx_bit_rate = 14400; break; case T38_IND_V17_14400_LONG_TRAINING: - bit_rate = 14400; + t->tx_bit_rate = 14400; break; } /*endswitch*/ - t->tx_bit_rate = bit_rate; silence_gen_alter(&t->silence_gen, ms_to_samples(75)); - fax_modems_start_fast_modem(t, FAX_MODEM_V17_TX, bit_rate, short_train, use_hdlc); + fax_modems_start_fast_modem(t, FAX_MODEM_V17_TX, t->tx_bit_rate, short_train, use_hdlc); fax_modems_set_tx_handler(t, (span_tx_handler_t) &silence_gen, &t->silence_gen); fax_modems_set_next_tx_handler(t, (span_tx_handler_t) &v17_tx, &t->fast_modems.v17_tx); fax_modems_set_rx_active(t, true); diff --git a/libs/spandsp/src/t43.c b/libs/spandsp/src/t43.c index ec7e67ea3a..b4d8b2b86b 100644 --- a/libs/spandsp/src/t43.c +++ b/libs/spandsp/src/t43.c @@ -763,6 +763,7 @@ SPAN_DECLARE(int) t43_decode_put(t43_decode_state_t *s, const uint8_t data[], si /* Now deal the bit-planes, one after another. */ total_len = 0; + result = 0; while (s->current_bit_plane < s->t85.bit_planes) { j = s->current_bit_plane; diff --git a/libs/spandsp/src/t4_rx.c b/libs/spandsp/src/t4_rx.c index 69a98193a1..f14521b5f0 100644 --- a/libs/spandsp/src/t4_rx.c +++ b/libs/spandsp/src/t4_rx.c @@ -219,6 +219,7 @@ static int set_tiff_directory_info(t4_rx_state_t *s) bits_per_sample = 1; samples_per_pixel = 1; photometric = PHOTOMETRIC_MINISWHITE; + output_t4_options = 0; switch (t->compression) { case T4_COMPRESSION_T4_1D: diff --git a/libs/spandsp/src/t4_tx.c b/libs/spandsp/src/t4_tx.c index 0d66d5690a..49bcd90915 100644 --- a/libs/spandsp/src/t4_tx.c +++ b/libs/spandsp/src/t4_tx.c @@ -762,10 +762,7 @@ static int tiff_row_read_handler(void *user_data, uint8_t buf[], size_t len) if (s->tiff.row >= s->tiff.image_length) return 0; if (s->tiff.image_buffer == NULL) - { - exit(2); return 0; - } memcpy(buf, &s->tiff.image_buffer[s->tiff.row*len], len); s->tiff.row++; @@ -1158,7 +1155,6 @@ static int read_tiff_image(t4_tx_state_t *s) { int total_len; int i; - int len; int alter_image; uint8_t *t; @@ -1204,7 +1200,7 @@ static int read_tiff_image(t4_tx_state_t *s) { if (alter_image) { - if ((len = read_tiff_t43_image(s)) < 0) + if ( read_tiff_t43_image(s) < 0) return -1; s->pack_buf = s->tiff.image_buffer; } diff --git a/libs/spandsp/tests/msvc/adsi_tests.vcproj b/libs/spandsp/tests/msvc/adsi_tests.vcproj deleted file mode 100644 index b76e06ecbf..0000000000 --- a/libs/spandsp/tests/msvc/adsi_tests.vcproj +++ /dev/null @@ -1,208 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/spandsp/tests/msvc/complex_tests.2012.vcxproj b/libs/spandsp/tests/msvc/complex_tests.2012.vcxproj new file mode 100644 index 0000000000..edbd29ebae --- /dev/null +++ b/libs/spandsp/tests/msvc/complex_tests.2012.vcxproj @@ -0,0 +1,109 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {A349379F-0FEA-49C8-9535-05F39663337B} + complex_tests + Win32Proj + + + + Application + v110 + Unicode + true + + + Application + v110 + Unicode + + + + + + + + + + + + + <_ProjectFileVersion>11.0.60610.1 + + + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + + + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + + + + Disabled + .;..\..\src\spandsp;..\..\src;..\..\src\msvc;..;..\..\tiff-4.0.3\tiff-4.0.3\libtiff;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + Level3 + + + ..\..\src\Win32\Debug\libspandsp.lib;%(AdditionalDependencies) + true + Console + MachineX86 + + + + + MaxSpeed + .;..\..\src\spandsp;..\..\src;..\..\src\msvc;..;..\..\tiff-4.0.3\tiff-4.0.3\libtiff;%(AdditionalIncludeDirectories) + true + WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H;%(PreprocessorDefinitions) + MultiThreadedDLL + true + + Level3 + ProgramDatabase + + + ..\..\src\Win32\Debug\libspandsp.lib;%(AdditionalDependencies) + true + Console + true + true + MachineX86 + + + + + + + + + + + + + {1cbb0077-18c5-455f-801c-0a0ce7b0bbf5} + false + + + + + + \ No newline at end of file diff --git a/libs/spandsp/tests/msvc/complex_tests.2012.vcxproj.filters b/libs/spandsp/tests/msvc/complex_tests.2012.vcxproj.filters new file mode 100644 index 0000000000..c985311d03 --- /dev/null +++ b/libs/spandsp/tests/msvc/complex_tests.2012.vcxproj.filters @@ -0,0 +1,33 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + \ No newline at end of file diff --git a/libs/spandsp/tests/msvc/complex_tests.vcproj b/libs/spandsp/tests/msvc/complex_tests.vcproj deleted file mode 100644 index c7145da4f9..0000000000 --- a/libs/spandsp/tests/msvc/complex_tests.vcproj +++ /dev/null @@ -1,208 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/spandsp/tests/msvc/complex_vector_float_tests.2012.vcxproj b/libs/spandsp/tests/msvc/complex_vector_float_tests.2012.vcxproj new file mode 100644 index 0000000000..1a2d8178fa --- /dev/null +++ b/libs/spandsp/tests/msvc/complex_vector_float_tests.2012.vcxproj @@ -0,0 +1,109 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {2B0D705C-1CF2-401C-BFBC-A43FB806908C} + complex_vector_float_tests + Win32Proj + + + + Application + v110 + Unicode + true + + + Application + v110 + Unicode + + + + + + + + + + + + + <_ProjectFileVersion>11.0.60610.1 + + + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + + + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + + + + Disabled + .;..\..\src\spandsp;..\..\src;..\..\src\msvc;..;..\..\tiff-4.0.3\tiff-4.0.3\libtiff;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + Level3 + + + ..\..\src\Win32\Debug\libspandsp.lib;%(AdditionalDependencies) + true + Console + MachineX86 + + + + + MaxSpeed + .;..\..\src\spandsp;..\..\src;..\..\src\msvc;..;..\..\tiff-4.0.3\tiff-4.0.3\libtiff;%(AdditionalIncludeDirectories) + true + WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H;%(PreprocessorDefinitions) + MultiThreadedDLL + true + + Level3 + ProgramDatabase + + + ..\..\src\Win32\Debug\libspandsp.lib;%(AdditionalDependencies) + true + Console + true + true + MachineX86 + + + + + + + + + + + + + {1cbb0077-18c5-455f-801c-0a0ce7b0bbf5} + false + + + + + + \ No newline at end of file diff --git a/libs/spandsp/tests/msvc/complex_vector_float_tests.2012.vcxproj.filters b/libs/spandsp/tests/msvc/complex_vector_float_tests.2012.vcxproj.filters new file mode 100644 index 0000000000..97213f0053 --- /dev/null +++ b/libs/spandsp/tests/msvc/complex_vector_float_tests.2012.vcxproj.filters @@ -0,0 +1,33 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + \ No newline at end of file diff --git a/libs/spandsp/tests/msvc/complex_vector_float_tests.vcproj b/libs/spandsp/tests/msvc/complex_vector_float_tests.vcproj deleted file mode 100644 index caa57adb96..0000000000 --- a/libs/spandsp/tests/msvc/complex_vector_float_tests.vcproj +++ /dev/null @@ -1,208 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/spandsp/tests/msvc/complex_vector_int_tests.2012.vcxproj b/libs/spandsp/tests/msvc/complex_vector_int_tests.2012.vcxproj new file mode 100644 index 0000000000..6b3e33ca93 --- /dev/null +++ b/libs/spandsp/tests/msvc/complex_vector_int_tests.2012.vcxproj @@ -0,0 +1,109 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {C2E8B4D1-A398-4D57-94F8-B61F20C7D514} + complex_vector_int_tests + Win32Proj + + + + Application + v110 + Unicode + true + + + Application + v110 + Unicode + + + + + + + + + + + + + <_ProjectFileVersion>11.0.60610.1 + + + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + + + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + + + + Disabled + .;..\..\src\spandsp;..\..\src;..\..\src\msvc;..;..\..\tiff-4.0.3\tiff-4.0.3\libtiff;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + Level3 + + + ..\..\src\Win32\Debug\libspandsp.lib;%(AdditionalDependencies) + true + Console + MachineX86 + + + + + MaxSpeed + .;..\..\src\spandsp;..\..\src;..\..\src\msvc;..;..\..\tiff-4.0.3\tiff-4.0.3\libtiff;%(AdditionalIncludeDirectories) + true + WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H;%(PreprocessorDefinitions) + MultiThreadedDLL + true + + Level3 + ProgramDatabase + + + ..\..\src\Win32\Debug\libspandsp.lib;%(AdditionalDependencies) + true + Console + true + true + MachineX86 + + + + + + + + + + + + + {1cbb0077-18c5-455f-801c-0a0ce7b0bbf5} + false + + + + + + \ No newline at end of file diff --git a/libs/spandsp/tests/msvc/complex_vector_int_tests.2012.vcxproj.filters b/libs/spandsp/tests/msvc/complex_vector_int_tests.2012.vcxproj.filters new file mode 100644 index 0000000000..c7fd99f9aa --- /dev/null +++ b/libs/spandsp/tests/msvc/complex_vector_int_tests.2012.vcxproj.filters @@ -0,0 +1,33 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + \ No newline at end of file diff --git a/libs/spandsp/tests/msvc/complex_vector_int_tests.vcproj b/libs/spandsp/tests/msvc/complex_vector_int_tests.vcproj deleted file mode 100644 index 5b16b33ce7..0000000000 --- a/libs/spandsp/tests/msvc/complex_vector_int_tests.vcproj +++ /dev/null @@ -1,208 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/spandsp/tests/msvc/dtmf_rx_tests.2012.vcxproj b/libs/spandsp/tests/msvc/dtmf_rx_tests.2012.vcxproj new file mode 100644 index 0000000000..4f17b6be84 --- /dev/null +++ b/libs/spandsp/tests/msvc/dtmf_rx_tests.2012.vcxproj @@ -0,0 +1,103 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {24E7EF80-7854-4A21-80FB-31C4E71109DE} + dtmf_rx_tests + Win32Proj + + + + Application + v110 + Unicode + true + + + Application + v110 + Unicode + + + + + + + + + + + + + <_ProjectFileVersion>11.0.60610.1 + + + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + + + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + + + + Disabled + .;..\..\src\spandsp;..\..\src;..\..\src\msvc;..;..\..\tiff-4.0.3\tiff-4.0.3\libtiff;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + Level3 + + + ..\..\src\Win32\Debug\libspandsp.lib;%(AdditionalDependencies) + true + Console + MachineX86 + + + + + MaxSpeed + .;..\..\src\spandsp;..\..\src;..\..\src\msvc;..;..\..\tiff-4.0.3\tiff-4.0.3\libtiff;%(AdditionalIncludeDirectories) + true + WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H;%(PreprocessorDefinitions) + MultiThreadedDLL + true + + Level3 + ProgramDatabase + + + ..\..\src\Win32\Debug\libspandsp.lib;%(AdditionalDependencies) + true + Console + true + true + MachineX86 + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libs/spandsp/tests/msvc/dtmf_rx_tests.2012.vcxproj.filters b/libs/spandsp/tests/msvc/dtmf_rx_tests.2012.vcxproj.filters new file mode 100644 index 0000000000..dd8f8cc2d1 --- /dev/null +++ b/libs/spandsp/tests/msvc/dtmf_rx_tests.2012.vcxproj.filters @@ -0,0 +1,33 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + \ No newline at end of file diff --git a/libs/spandsp/tests/msvc/dtmf_rx_tests.vcproj b/libs/spandsp/tests/msvc/dtmf_rx_tests.vcproj deleted file mode 100644 index 3b1df8cd86..0000000000 --- a/libs/spandsp/tests/msvc/dtmf_rx_tests.vcproj +++ /dev/null @@ -1,208 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/spandsp/tests/msvc/dtmf_tx_tests.2012.vcxproj b/libs/spandsp/tests/msvc/dtmf_tx_tests.2012.vcxproj new file mode 100644 index 0000000000..4419ec5829 --- /dev/null +++ b/libs/spandsp/tests/msvc/dtmf_tx_tests.2012.vcxproj @@ -0,0 +1,103 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {1577F41D-9A06-45DD-87D4-9ADCC9CCDAD5} + dtmf_tx_tests + Win32Proj + + + + Application + v110 + Unicode + true + + + Application + v110 + Unicode + + + + + + + + + + + + + <_ProjectFileVersion>11.0.60610.1 + + + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + + + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + + + + Disabled + .;..\..\src\spandsp;..\..\src;..\..\src\msvc;..;..\..\tiff-4.0.3\tiff-4.0.3\libtiff;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + Level3 + + + ..\..\src\Win32\Debug\libspandsp.lib;%(AdditionalDependencies) + true + Console + MachineX86 + + + + + MaxSpeed + .;..\..\src\spandsp;..\..\src;..\..\src\msvc;..;..\..\tiff-4.0.3\tiff-4.0.3\libtiff;%(AdditionalIncludeDirectories) + true + WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H;%(PreprocessorDefinitions) + MultiThreadedDLL + true + + Level3 + ProgramDatabase + + + ..\..\src\Win32\Debug\libspandsp.lib;%(AdditionalDependencies) + true + Console + true + true + MachineX86 + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libs/spandsp/tests/msvc/dtmf_tx_tests.2012.vcxproj.filters b/libs/spandsp/tests/msvc/dtmf_tx_tests.2012.vcxproj.filters new file mode 100644 index 0000000000..e2ac03f95e --- /dev/null +++ b/libs/spandsp/tests/msvc/dtmf_tx_tests.2012.vcxproj.filters @@ -0,0 +1,33 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + \ No newline at end of file diff --git a/libs/spandsp/tests/msvc/dtmf_tx_tests.vcproj b/libs/spandsp/tests/msvc/dtmf_tx_tests.vcproj deleted file mode 100644 index 64e420dd58..0000000000 --- a/libs/spandsp/tests/msvc/dtmf_tx_tests.vcproj +++ /dev/null @@ -1,208 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/spandsp/tests/msvc/queue_tests.2012.vcxproj b/libs/spandsp/tests/msvc/queue_tests.2012.vcxproj new file mode 100644 index 0000000000..468f0b7d98 --- /dev/null +++ b/libs/spandsp/tests/msvc/queue_tests.2012.vcxproj @@ -0,0 +1,103 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {D9C0F575-83E7-4C15-BF71-D7A0D44A26BF} + queue_tests + Win32Proj + + + + Application + v110 + Unicode + true + + + Application + v110 + Unicode + + + + + + + + + + + + + <_ProjectFileVersion>11.0.60610.1 + + + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + + + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + + + + Disabled + .;..\..\src\spandsp;..\..\src;..\..\src\msvc;..;..\..\tiff-4.0.3\tiff-4.0.3\libtiff;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + Level3 + + + ..\..\src\Win32\Debug\libspandsp.lib;%(AdditionalDependencies) + true + Console + MachineX86 + + + + + MaxSpeed + .;..\..\src\spandsp;..\..\src;..\..\src\msvc;..;..\..\tiff-4.0.3\tiff-4.0.3\libtiff;%(AdditionalIncludeDirectories) + true + WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H;%(PreprocessorDefinitions) + MultiThreadedDLL + true + + Level3 + ProgramDatabase + + + ..\..\src\Win32\Debug\libspandsp.lib;%(AdditionalDependencies) + true + Console + true + true + MachineX86 + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libs/spandsp/tests/msvc/queue_tests.2012.vcxproj.filters b/libs/spandsp/tests/msvc/queue_tests.2012.vcxproj.filters new file mode 100644 index 0000000000..49ddb6a0e6 --- /dev/null +++ b/libs/spandsp/tests/msvc/queue_tests.2012.vcxproj.filters @@ -0,0 +1,33 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + \ No newline at end of file diff --git a/libs/spandsp/tests/msvc/queue_tests.vcproj b/libs/spandsp/tests/msvc/queue_tests.vcproj deleted file mode 100644 index d9f6d26169..0000000000 --- a/libs/spandsp/tests/msvc/queue_tests.vcproj +++ /dev/null @@ -1,208 +0,0 @@ -tiff-4.0.2 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/spandsp/tests/msvc/t38_core_tests.2012.vcxproj b/libs/spandsp/tests/msvc/t38_core_tests.2012.vcxproj new file mode 100644 index 0000000000..d21b895f02 --- /dev/null +++ b/libs/spandsp/tests/msvc/t38_core_tests.2012.vcxproj @@ -0,0 +1,109 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {A34A9D0E-A7E2-4A04-B044-7BB2FE709EF3} + t38_core_tests + Win32Proj + + + + Application + v110 + Unicode + true + + + Application + v110 + Unicode + + + + + + + + + + + + + <_ProjectFileVersion>11.0.60610.1 + + + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + + + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + + + + Disabled + .;..\..\src\spandsp;..\..\src;..\..\src\msvc;..;..\..\tiff-4.0.3\tiff-4.0.3\libtiff;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + Level3 + + + ..\..\src\Win32\Debug\libspandsp.lib;%(AdditionalDependencies) + true + Console + MachineX86 + + + + + MaxSpeed + .;..\..\src\spandsp;..\..\src;..\..\src\msvc;..;..\..\tiff-4.0.3\tiff-4.0.3\libtiff;%(AdditionalIncludeDirectories) + true + WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H;%(PreprocessorDefinitions) + MultiThreadedDLL + true + + Level3 + ProgramDatabase + + + ..\..\src\Win32\Debug\libspandsp.lib;%(AdditionalDependencies) + true + Console + true + true + MachineX86 + + + + + + + + + + + + + {1cbb0077-18c5-455f-801c-0a0ce7b0bbf5} + false + + + + + + \ No newline at end of file diff --git a/libs/spandsp/tests/msvc/t38_core_tests.2012.vcxproj.filters b/libs/spandsp/tests/msvc/t38_core_tests.2012.vcxproj.filters new file mode 100644 index 0000000000..8a9d19c5b7 --- /dev/null +++ b/libs/spandsp/tests/msvc/t38_core_tests.2012.vcxproj.filters @@ -0,0 +1,33 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + \ No newline at end of file diff --git a/libs/spandsp/tests/msvc/t38_core_tests.vcproj b/libs/spandsp/tests/msvc/t38_core_tests.vcproj deleted file mode 100644 index bb4c9a16ee..0000000000 --- a/libs/spandsp/tests/msvc/t38_core_tests.vcproj +++ /dev/null @@ -1,208 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/spandsp/tests/msvc/t38_non_ecm_buffer_tests.2012.vcxproj b/libs/spandsp/tests/msvc/t38_non_ecm_buffer_tests.2012.vcxproj new file mode 100644 index 0000000000..40d4ff728b --- /dev/null +++ b/libs/spandsp/tests/msvc/t38_non_ecm_buffer_tests.2012.vcxproj @@ -0,0 +1,109 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {80A3D9D9-3846-4DA5-8676-F940D725EA62} + t38_non_ecm_buffer_tests + Win32Proj + + + + Application + v110 + Unicode + true + + + Application + v110 + Unicode + + + + + + + + + + + + + <_ProjectFileVersion>11.0.60610.1 + + + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + + + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + + + + Disabled + .;..\..\src\spandsp;..\..\src;..\..\src\msvc;..;..\..\tiff-4.0.3\tiff-4.0.3\libtiff;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + Level3 + + + ..\..\src\Win32\Debug\libspandsp.lib;%(AdditionalDependencies) + true + Console + MachineX86 + + + + + MaxSpeed + .;..\..\src\spandsp;..\..\src;..\..\src\msvc;..;..\..\tiff-4.0.3\tiff-4.0.3\libtiff;%(AdditionalIncludeDirectories) + true + WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H;%(PreprocessorDefinitions) + MultiThreadedDLL + true + + Level3 + ProgramDatabase + + + ..\..\src\Win32\Debug\libspandsp.lib;%(AdditionalDependencies) + true + Console + true + true + MachineX86 + + + + + + + + + + + + + {1cbb0077-18c5-455f-801c-0a0ce7b0bbf5} + false + + + + + + \ No newline at end of file diff --git a/libs/spandsp/tests/msvc/t38_non_ecm_buffer_tests.2012.vcxproj.filters b/libs/spandsp/tests/msvc/t38_non_ecm_buffer_tests.2012.vcxproj.filters new file mode 100644 index 0000000000..fde53cb0c3 --- /dev/null +++ b/libs/spandsp/tests/msvc/t38_non_ecm_buffer_tests.2012.vcxproj.filters @@ -0,0 +1,33 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + \ No newline at end of file diff --git a/libs/spandsp/tests/msvc/t38_non_ecm_buffer_tests.vcproj b/libs/spandsp/tests/msvc/t38_non_ecm_buffer_tests.vcproj deleted file mode 100644 index 45f264ec1c..0000000000 --- a/libs/spandsp/tests/msvc/t38_non_ecm_buffer_tests.vcproj +++ /dev/null @@ -1,208 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/spandsp/tests/msvc/v22bis_tests.2012.vcxproj b/libs/spandsp/tests/msvc/v22bis_tests.2012.vcxproj new file mode 100644 index 0000000000..88bf6b1fdc --- /dev/null +++ b/libs/spandsp/tests/msvc/v22bis_tests.2012.vcxproj @@ -0,0 +1,103 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {DA4DB99F-E5BA-48BD-BB6B-3595CE24CBAE} + v22bis_tests + Win32Proj + + + + Application + v110 + Unicode + true + + + Application + v110 + Unicode + + + + + + + + + + + + + <_ProjectFileVersion>11.0.60610.1 + + + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + + + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + + + + Disabled + .;..\..\src\spandsp;..\..\src;..\..\src\msvc;..;..\..\tiff-4.0.3\tiff-4.0.3\libtiff;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + Level3 + + + ..\..\src\Win32\Debug\libspandsp.lib;%(AdditionalDependencies) + true + Console + MachineX86 + + + + + MaxSpeed + .;..\..\src\spandsp;..\..\src;..\..\src\msvc;..;..\..\tiff-4.0.3\tiff-4.0.3\libtiff;%(AdditionalIncludeDirectories) + true + WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H;%(PreprocessorDefinitions) + MultiThreadedDLL + true + + Level3 + ProgramDatabase + + + ..\..\src\Win32\Debug\libspandsp.lib;%(AdditionalDependencies) + true + Console + true + true + MachineX86 + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libs/spandsp/tests/msvc/v22bis_tests.2012.vcxproj.filters b/libs/spandsp/tests/msvc/v22bis_tests.2012.vcxproj.filters new file mode 100644 index 0000000000..f588cc67d4 --- /dev/null +++ b/libs/spandsp/tests/msvc/v22bis_tests.2012.vcxproj.filters @@ -0,0 +1,33 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + \ No newline at end of file diff --git a/libs/spandsp/tests/msvc/v22bis_tests.vcproj b/libs/spandsp/tests/msvc/v22bis_tests.vcproj deleted file mode 100644 index fc69b38d46..0000000000 --- a/libs/spandsp/tests/msvc/v22bis_tests.vcproj +++ /dev/null @@ -1,208 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/spandsp/tests/msvc/v29_tests.2012.vcxproj b/libs/spandsp/tests/msvc/v29_tests.2012.vcxproj new file mode 100644 index 0000000000..672a62c1fb --- /dev/null +++ b/libs/spandsp/tests/msvc/v29_tests.2012.vcxproj @@ -0,0 +1,103 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {323BD962-4581-4561-8105-8C166A9FA933} + v29_tests + Win32Proj + + + + Application + v110 + Unicode + true + + + Application + v110 + Unicode + + + + + + + + + + + + + <_ProjectFileVersion>11.0.60610.1 + + + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + + + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + + + + Disabled + .;..\..\src\spandsp;..\..\src;..\..\src\msvc;..;..\..\tiff-4.0.3\tiff-4.0.3\libtiff;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + Level3 + + + ..\..\src\Win32\Debug\libspandsp.lib;%(AdditionalDependencies) + true + Console + MachineX86 + + + + + MaxSpeed + .;..\..\src\spandsp;..\..\src;..\..\src\msvc;..;..\..\tiff-4.0.3\tiff-4.0.3\libtiff;%(AdditionalIncludeDirectories) + true + WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H;%(PreprocessorDefinitions) + MultiThreadedDLL + true + + Level3 + ProgramDatabase + + + ..\..\src\Win32\Debug\libspandsp.lib;%(AdditionalDependencies) + true + Console + true + true + MachineX86 + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libs/spandsp/tests/msvc/v29_tests.2012.vcxproj.filters b/libs/spandsp/tests/msvc/v29_tests.2012.vcxproj.filters new file mode 100644 index 0000000000..8e030a1801 --- /dev/null +++ b/libs/spandsp/tests/msvc/v29_tests.2012.vcxproj.filters @@ -0,0 +1,33 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + \ No newline at end of file diff --git a/libs/spandsp/tests/msvc/v29_tests.vcproj b/libs/spandsp/tests/msvc/v29_tests.vcproj deleted file mode 100644 index 6cfe9d9bc2..0000000000 --- a/libs/spandsp/tests/msvc/v29_tests.vcproj +++ /dev/null @@ -1,208 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/spandsp/tests/msvc/v80_tests.2012.vcxproj b/libs/spandsp/tests/msvc/v80_tests.2012.vcxproj new file mode 100644 index 0000000000..3b59f30708 --- /dev/null +++ b/libs/spandsp/tests/msvc/v80_tests.2012.vcxproj @@ -0,0 +1,103 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {10263F04-37DD-4E4A-AE4F-0641B018B714} + v80_tests + Win32Proj + + + + Application + v110 + Unicode + true + + + Application + v110 + Unicode + + + + + + + + + + + + + <_ProjectFileVersion>11.0.60610.1 + + + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + + + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + + + + Disabled + .;..\..\src\spandsp;..\..\src;..\..\src\msvc;..;..\..\tiff-4.0.3\tiff-4.0.3\libtiff;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + Level3 + + + ..\..\src\Win32\Debug\libspandsp.lib;%(AdditionalDependencies) + true + Console + MachineX86 + + + + + MaxSpeed + .;..\..\src\spandsp;..\..\src;..\..\src\msvc;..;..\..\tiff-4.0.3\tiff-4.0.3\libtiff;%(AdditionalIncludeDirectories) + true + WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H;%(PreprocessorDefinitions) + MultiThreadedDLL + true + + Level3 + ProgramDatabase + + + ..\..\src\Win32\Debug\libspandsp.lib;%(AdditionalDependencies) + true + Console + true + true + MachineX86 + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libs/spandsp/tests/msvc/v80_tests.2012.vcxproj.filters b/libs/spandsp/tests/msvc/v80_tests.2012.vcxproj.filters new file mode 100644 index 0000000000..454b800c13 --- /dev/null +++ b/libs/spandsp/tests/msvc/v80_tests.2012.vcxproj.filters @@ -0,0 +1,33 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + \ No newline at end of file diff --git a/libs/spandsp/tests/msvc/v80_tests.vcproj b/libs/spandsp/tests/msvc/v80_tests.vcproj deleted file mode 100644 index ae05e597c1..0000000000 --- a/libs/spandsp/tests/msvc/v80_tests.vcproj +++ /dev/null @@ -1,208 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/spandsp/tests/msvc/v8_tests.2012.vcxproj b/libs/spandsp/tests/msvc/v8_tests.2012.vcxproj new file mode 100644 index 0000000000..03fe38e66c --- /dev/null +++ b/libs/spandsp/tests/msvc/v8_tests.2012.vcxproj @@ -0,0 +1,103 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {0C69B8C2-0CE1-4CD4-870C-1C13FB3F9B34} + v8_tests + Win32Proj + + + + Application + v110 + Unicode + true + + + Application + v110 + Unicode + + + + + + + + + + + + + <_ProjectFileVersion>11.0.60610.1 + + + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + + + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + + + + Disabled + .;..\..\src\spandsp;..\..\src;..\..\src\msvc;..;..\..\tiff-4.0.3\tiff-4.0.3\libtiff;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + Level3 + + + ..\..\src\Win32\Debug\libspandsp.lib;%(AdditionalDependencies) + true + Console + MachineX86 + + + + + MaxSpeed + .;..\..\src\spandsp;..\..\src;..\..\src\msvc;..;..\..\tiff-4.0.3\tiff-4.0.3\libtiff;%(AdditionalIncludeDirectories) + true + WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H;%(PreprocessorDefinitions) + MultiThreadedDLL + true + + Level3 + ProgramDatabase + + + ..\..\src\Win32\Debug\libspandsp.lib;%(AdditionalDependencies) + true + Console + true + true + MachineX86 + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libs/spandsp/tests/msvc/v8_tests.2012.vcxproj.filters b/libs/spandsp/tests/msvc/v8_tests.2012.vcxproj.filters new file mode 100644 index 0000000000..a5737ede86 --- /dev/null +++ b/libs/spandsp/tests/msvc/v8_tests.2012.vcxproj.filters @@ -0,0 +1,33 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + \ No newline at end of file diff --git a/libs/spandsp/tests/msvc/v8_tests.vcproj b/libs/spandsp/tests/msvc/v8_tests.vcproj deleted file mode 100644 index 11d3e57d02..0000000000 --- a/libs/spandsp/tests/msvc/v8_tests.vcproj +++ /dev/null @@ -1,208 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/spandsp/tests/msvc/vector_float_tests.2012.vcxproj b/libs/spandsp/tests/msvc/vector_float_tests.2012.vcxproj new file mode 100644 index 0000000000..ec6a2c3c7b --- /dev/null +++ b/libs/spandsp/tests/msvc/vector_float_tests.2012.vcxproj @@ -0,0 +1,109 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {EA745FF7-9E4B-4C13-BA19-2EE8165A6245} + vector_float_tests + Win32Proj + + + + Application + v110 + Unicode + true + + + Application + v110 + Unicode + + + + + + + + + + + + + <_ProjectFileVersion>11.0.60610.1 + + + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + + + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + + + + Disabled + .;..\..\src\spandsp;..\..\src;..\..\src\msvc;..;..\..\tiff-4.0.3\tiff-4.0.3\libtiff;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + Level3 + + + ..\..\src\Win32\Debug\libspandsp.lib;%(AdditionalDependencies) + true + Console + MachineX86 + + + + + MaxSpeed + .;..\..\src\spandsp;..\..\src;..\..\src\msvc;..;..\..\tiff-4.0.3\tiff-4.0.3\libtiff;%(AdditionalIncludeDirectories) + true + WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H;%(PreprocessorDefinitions) + MultiThreadedDLL + true + + Level3 + ProgramDatabase + + + ..\..\src\Win32\Debug\libspandsp.lib;%(AdditionalDependencies) + true + Console + true + true + MachineX86 + + + + + + + + + + + + + {1cbb0077-18c5-455f-801c-0a0ce7b0bbf5} + false + + + + + + \ No newline at end of file diff --git a/libs/spandsp/tests/msvc/vector_float_tests.2012.vcxproj.filters b/libs/spandsp/tests/msvc/vector_float_tests.2012.vcxproj.filters new file mode 100644 index 0000000000..58d1fe1968 --- /dev/null +++ b/libs/spandsp/tests/msvc/vector_float_tests.2012.vcxproj.filters @@ -0,0 +1,33 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + \ No newline at end of file diff --git a/libs/spandsp/tests/msvc/vector_float_tests.vcproj b/libs/spandsp/tests/msvc/vector_float_tests.vcproj deleted file mode 100644 index f97b0e7d6e..0000000000 --- a/libs/spandsp/tests/msvc/vector_float_tests.vcproj +++ /dev/null @@ -1,208 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/spandsp/tests/msvc/vector_int_tests.2012.vcxproj b/libs/spandsp/tests/msvc/vector_int_tests.2012.vcxproj new file mode 100644 index 0000000000..41ca9c3fe0 --- /dev/null +++ b/libs/spandsp/tests/msvc/vector_int_tests.2012.vcxproj @@ -0,0 +1,109 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {80A60464-29E8-4EE8-BAFA-8708B7C08CC3} + vector_int_tests + Win32Proj + + + + Application + v110 + Unicode + true + + + Application + v110 + Unicode + + + + + + + + + + + + + <_ProjectFileVersion>11.0.60610.1 + + + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + + + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + + + + Disabled + .;..\..\src\spandsp;..\..\src;..\..\src\msvc;..;..\..\tiff-4.0.3\tiff-4.0.3\libtiff;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + Level3 + + + ..\..\src\Win32\Debug\libspandsp.lib;%(AdditionalDependencies) + true + Console + MachineX86 + + + + + MaxSpeed + .;..\..\src\spandsp;..\..\src;..\..\src\msvc;..;..\..\tiff-4.0.3\tiff-4.0.3\libtiff;%(AdditionalIncludeDirectories) + true + WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H;%(PreprocessorDefinitions) + MultiThreadedDLL + true + + Level3 + ProgramDatabase + + + ..\..\src\Win32\Debug\libspandsp.lib;%(AdditionalDependencies) + true + Console + true + true + MachineX86 + + + + + + + + + + + + + {1cbb0077-18c5-455f-801c-0a0ce7b0bbf5} + false + + + + + + \ No newline at end of file diff --git a/libs/spandsp/tests/msvc/vector_int_tests.2012.vcxproj.filters b/libs/spandsp/tests/msvc/vector_int_tests.2012.vcxproj.filters new file mode 100644 index 0000000000..e933bb2770 --- /dev/null +++ b/libs/spandsp/tests/msvc/vector_int_tests.2012.vcxproj.filters @@ -0,0 +1,33 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + \ No newline at end of file diff --git a/libs/spandsp/tests/msvc/vector_int_tests.vcproj b/libs/spandsp/tests/msvc/vector_int_tests.vcproj deleted file mode 100644 index 78fc5a10b0..0000000000 --- a/libs/spandsp/tests/msvc/vector_int_tests.vcproj +++ /dev/null @@ -1,208 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/include/private/switch_core_pvt.h b/src/include/private/switch_core_pvt.h index f6d3474386..bff9b72a78 100644 --- a/src/include/private/switch_core_pvt.h +++ b/src/include/private/switch_core_pvt.h @@ -144,7 +144,7 @@ struct switch_core_session { int stream_count; char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1]; - void *private_info; + void *private_info[SWITCH_CORE_SESSION_MAX_PRIVATES]; switch_queue_t *event_queue; switch_queue_t *message_queue; switch_queue_t *signal_data_queue; diff --git a/src/include/switch_channel.h b/src/include/switch_channel.h index 2e53ef6107..234b692114 100644 --- a/src/include/switch_channel.h +++ b/src/include/switch_channel.h @@ -633,6 +633,8 @@ SWITCH_DECLARE(int) switch_channel_test_app_flag_key(const char *app, switch_cha SWITCH_DECLARE(void) switch_channel_set_bridge_time(switch_channel_t *channel); SWITCH_DECLARE(void) switch_channel_set_hangup_time(switch_channel_t *channel); SWITCH_DECLARE(switch_call_direction_t) switch_channel_direction(switch_channel_t *channel); +SWITCH_DECLARE(void) switch_channel_set_direction(switch_channel_t *channel, switch_call_direction_t direction); + SWITCH_DECLARE(switch_core_session_t *) switch_channel_get_session(switch_channel_t *channel); SWITCH_DECLARE(char *) switch_channel_get_flag_string(switch_channel_t *channel); SWITCH_DECLARE(char *) switch_channel_get_cap_string(switch_channel_t *channel); diff --git a/src/include/switch_core.h b/src/include/switch_core.h index 064ab56324..11340c211c 100644 --- a/src/include/switch_core.h +++ b/src/include/switch_core.h @@ -1070,7 +1070,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_receive_event(_In_ switch_co \param session the session to retrieve from \return a pointer to the private data */ -SWITCH_DECLARE(void *) switch_core_session_get_private(_In_ switch_core_session_t *session); +SWITCH_DECLARE(void *) switch_core_session_get_private_class(_In_ switch_core_session_t *session, _In_ switch_pvt_class_t index); +#define switch_core_session_get_private(_s) switch_core_session_get_private_class(_s, SWITCH_PVT_PRIMARY) /*! \brief Add private user data to a session @@ -1078,7 +1079,8 @@ SWITCH_DECLARE(void *) switch_core_session_get_private(_In_ switch_core_session_ \param private_info the used data to add \return SWITCH_STATUS_SUCCESS if data is added */ -SWITCH_DECLARE(switch_status_t) switch_core_session_set_private(_In_ switch_core_session_t *session, _In_ void *private_info); +SWITCH_DECLARE(switch_status_t) switch_core_session_set_private_class(_In_ switch_core_session_t *session, _In_ void *private_info, _In_ switch_pvt_class_t index); +#define switch_core_session_set_private(_s, _p) switch_core_session_set_private_class(_s, _p, SWITCH_PVT_PRIMARY) /*! \brief Add a logical stream to a session @@ -2575,6 +2577,7 @@ SWITCH_DECLARE(int) switch_system(const char *cmd, switch_bool_t wait); SWITCH_DECLARE(int) switch_stream_system_fork(const char *cmd, switch_stream_handle_t *stream); SWITCH_DECLARE(int) switch_stream_system(const char *cmd, switch_stream_handle_t *stream); +SWITCH_DECLARE(switch_call_direction_t) switch_ice_direction(switch_core_session_t *session); SWITCH_END_EXTERN_C #endif diff --git a/src/include/switch_core_media.h b/src/include/switch_core_media.h index 122f9f2b65..9641718f07 100644 --- a/src/include/switch_core_media.h +++ b/src/include/switch_core_media.h @@ -207,6 +207,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_write_frame(switch_core_sessio SWITCH_DECLARE(int) switch_core_media_check_nat(switch_media_handle_t *smh, const char *network_ip); SWITCH_DECLARE(switch_status_t) switch_core_media_choose_port(switch_core_session_t *session, switch_media_type_t type, int force); +SWITCH_DECLARE(switch_status_t) switch_core_media_choose_ports(switch_core_session_t *session, switch_bool_t audio, switch_bool_t video); SWITCH_DECLARE(void) switch_core_media_check_dtmf_type(switch_core_session_t *session); SWITCH_DECLARE(void) switch_core_media_absorb_sdp(switch_core_session_t *session); SWITCH_DECLARE(switch_status_t) switch_core_media_proxy_remote_addr(switch_core_session_t *session, const char *sdp_str); @@ -219,6 +220,7 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess SWITCH_DECLARE(void)switch_core_media_set_local_sdp(switch_core_session_t *session, const char *sdp_str, switch_bool_t dup); SWITCH_DECLARE(void) switch_core_media_patch_sdp(switch_core_session_t *session); SWITCH_DECLARE(void) switch_core_media_set_udptl_image_sdp(switch_core_session_t *session, switch_t38_options_t *t38_options, int insist); +SWITCH_DECLARE(switch_core_media_params_t *) switch_core_media_get_mparams(switch_media_handle_t *smh); SWITCH_DECLARE(void) switch_core_media_prepare_codecs(switch_core_session_t *session, switch_bool_t force); SWITCH_DECLARE(void) switch_core_media_start_udptl(switch_core_session_t *session, switch_t38_options_t *t38_options); SWITCH_DECLARE(switch_status_t) switch_core_media_receive_message(switch_core_session_t *session, switch_core_session_message_t *msg); @@ -254,6 +256,7 @@ SWITCH_DECLARE(void) switch_core_media_init(void); SWITCH_DECLARE(void) switch_core_media_deinit(void); SWITCH_DECLARE(void) switch_core_media_set_stats(switch_core_session_t *session); SWITCH_DECLARE(void) switch_core_session_wake_video_thread(switch_core_session_t *session); +SWITCH_DECLARE(void) switch_core_session_clear_crypto(switch_core_session_t *session); SWITCH_END_EXTERN_C #endif diff --git a/src/include/switch_event.h b/src/include/switch_event.h index 48c942dfaa..28e805658f 100644 --- a/src/include/switch_event.h +++ b/src/include/switch_event.h @@ -309,10 +309,11 @@ SWITCH_DECLARE(switch_status_t) switch_event_free_subclass_detailed(const char * \return SWITCH_STATUS_SUCCESS if the operation was successful \note you must free the resulting string when you are finished with it */ -SWITCH_DECLARE(switch_status_t) switch_event_binary_deserialize(switch_event_t **eventp, void **data, switch_size_t len, switch_bool_t destroy); +SWITCH_DECLARE(switch_status_t) switch_event_binary_deserialize(switch_event_t **eventp, void **data, switch_size_t len, switch_bool_t duplicate); SWITCH_DECLARE(switch_status_t) switch_event_binary_serialize(switch_event_t *event, void **data, switch_size_t *len); SWITCH_DECLARE(switch_status_t) switch_event_serialize(switch_event_t *event, char **str, switch_bool_t encode); SWITCH_DECLARE(switch_status_t) switch_event_serialize_json(switch_event_t *event, char **str); +SWITCH_DECLARE(switch_status_t) switch_event_serialize_json_obj(switch_event_t *event, cJSON **json); SWITCH_DECLARE(switch_status_t) switch_event_create_json(switch_event_t **event, const char *json); SWITCH_DECLARE(switch_status_t) switch_event_create_brackets(char *data, char a, char b, char c, switch_event_t **event, char **new_data, switch_bool_t dup); SWITCH_DECLARE(switch_status_t) switch_event_create_array_pair(switch_event_t **event, char **names, char **vals, int len); @@ -420,8 +421,42 @@ SWITCH_DECLARE(void) switch_event_deliver(switch_event_t **event); SWITCH_DECLARE(char *) switch_event_build_param_string(switch_event_t *event, const char *prefix, switch_hash_t *vars_map); SWITCH_DECLARE(int) switch_event_check_permission_list(switch_event_t *list, const char *name); SWITCH_DECLARE(void) switch_event_add_presence_data_cols(switch_channel_t *channel, switch_event_t *event, const char *prefix); +SWITCH_DECLARE(void) switch_json_add_presence_data_cols(switch_event_t *event, cJSON *json, const char *prefix); + SWITCH_DECLARE(void) switch_event_launch_dispatch_threads(uint32_t max); +SWITCH_DECLARE(uint32_t) switch_event_channel_broadcast(const char *event_channel, cJSON **json, const char *key, switch_event_channel_id_t id); +SWITCH_DECLARE(uint32_t) switch_event_channel_unbind(const char *event_channel, switch_event_channel_func_t func); +SWITCH_DECLARE(switch_status_t) switch_event_channel_bind(const char *event_channel, switch_event_channel_func_t func, switch_event_channel_id_t *id); + + +typedef void (*switch_live_array_command_handler_t)(switch_live_array_t *la, const char *cmd, const char *sessid, cJSON *jla, void *user_data); + +#define NO_EVENT_CHANNEL_ID 0 +#define SWITCH_EVENT_CHANNEL_GLOBAL "__global__" + +SWITCH_DECLARE(switch_status_t) switch_live_array_clear(switch_live_array_t *la); +SWITCH_DECLARE(switch_status_t) switch_live_array_bootstrap(switch_live_array_t *la, const char *sessid, switch_event_channel_id_t channel_id); +SWITCH_DECLARE(switch_status_t) switch_live_array_destroy(switch_live_array_t **live_arrayP); +SWITCH_DECLARE(switch_status_t) switch_live_array_create(const char *event_channel, const char *name, + switch_event_channel_id_t channel_id, switch_live_array_t **live_arrayP); +SWITCH_DECLARE(cJSON *) switch_live_array_get(switch_live_array_t *la, const char *name); +SWITCH_DECLARE(cJSON *) switch_live_array_get_idx(switch_live_array_t *la, int idx); +SWITCH_DECLARE(switch_status_t) switch_live_array_del(switch_live_array_t *la, const char *name); +SWITCH_DECLARE(switch_status_t) switch_live_array_add(switch_live_array_t *la, const char *name, int index, cJSON **obj, switch_bool_t destroy); +SWITCH_DECLARE(switch_status_t) switch_live_array_visible(switch_live_array_t *la, switch_bool_t visible, switch_bool_t force); +SWITCH_DECLARE(switch_bool_t) switch_live_array_isnew(switch_live_array_t *la); +SWITCH_DECLARE(void) switch_live_array_lock(switch_live_array_t *la); +SWITCH_DECLARE(void) switch_live_array_unlock(switch_live_array_t *la); +SWITCH_DECLARE(void) switch_live_array_set_user_data(switch_live_array_t *la, void *user_data); +SWITCH_DECLARE(void) switch_live_array_set_command_handler(switch_live_array_t *la, switch_live_array_command_handler_t command_handler); +SWITCH_DECLARE(void) switch_live_array_parse_json(cJSON *json, switch_event_channel_id_t channel_id); +SWITCH_DECLARE(switch_bool_t) switch_live_array_add_alias(switch_live_array_t *la, const char *event_channel, const char *name); +SWITCH_DECLARE(switch_bool_t) switch_live_array_clear_alias(switch_live_array_t *la, const char *event_channel, const char *name); +SWITCH_DECLARE(switch_bool_t) switch_event_channel_permission_verify(const char *cookie, const char *event_channel); +SWITCH_DECLARE(void) switch_event_channel_permission_modify(const char *cookie, const char *event_channel, switch_bool_t set); +SWITCH_DECLARE(void) switch_event_channel_permission_clear(const char *cookie); + ///\} SWITCH_END_EXTERN_C diff --git a/src/include/switch_json.h b/src/include/switch_json.h index 00f4e23df4..e1d7f1e51b 100755 --- a/src/include/switch_json.h +++ b/src/include/switch_json.h @@ -76,7 +76,8 @@ SWITCH_DECLARE(int) cJSON_GetArraySize(cJSON *array); /* Retrieve item number "item" from array "array". Returns NULL if unsuccessful. */ SWITCH_DECLARE(cJSON *)cJSON_GetArrayItem(cJSON *array,int item); /* Get item "string" from object. Case insensitive. */ -SWITCH_DECLARE(cJSON *)cJSON_GetObjectItem(cJSON *object,const char *string); +SWITCH_DECLARE(cJSON *)cJSON_GetObjectItem(const cJSON *object,const char *string); +SWITCH_DECLARE(const char *)cJSON_GetObjectCstr(const cJSON *object, const char *string); /* For analysing failed parses. This returns a pointer to the parse error. You'll probably need to look a few chars back to make sense of it. Defined when cJSON_Parse() returns 0. 0 when cJSON_Parse() succeeds. */ SWITCH_DECLARE(const char *)cJSON_GetErrorPtr(void); @@ -127,6 +128,55 @@ SWITCH_DECLARE(cJSON *) cJSON_Duplicate(cJSON *item,int recurse); #define cJSON_AddNumberToObject(object,name,n) cJSON_AddItemToObject(object, name, cJSON_CreateNumber(n)) #define cJSON_AddStringToObject(object,name,s) cJSON_AddItemToObject(object, name, cJSON_CreateString(s)) +SWITCH_DECLARE(cJSON *) cJSON_CreateStringPrintf(const char *fmt, ...); + +static inline cJSON *json_add_child_obj(cJSON *json, const char *name, cJSON *obj) +{ + cJSON *new_json = NULL; + + switch_assert(json); + + if (obj) { + new_json = obj; + } else { + new_json = cJSON_CreateObject(); + } + + switch_assert(new_json); + + cJSON_AddItemToObject(json, name, new_json); + + return new_json; +} + +static inline cJSON *json_add_child_array(cJSON *json, const char *name) +{ + cJSON *new_json = NULL; + + switch_assert(json); + + new_json = cJSON_CreateArray(); + switch_assert(new_json); + + cJSON_AddItemToObject(json, name, new_json); + + return new_json; +} + +static inline cJSON *json_add_child_string(cJSON *json, const char *name, const char *val) +{ + cJSON *new_json = NULL; + + switch_assert(json); + + new_json = cJSON_CreateString(val); + switch_assert(new_json); + + cJSON_AddItemToObject(json, name, new_json); + + return new_json; +} + #ifdef __cplusplus } #endif diff --git a/src/include/switch_loadable_module.h b/src/include/switch_loadable_module.h index 43e692c05b..e76e0e5ab1 100644 --- a/src/include/switch_loadable_module.h +++ b/src/include/switch_loadable_module.h @@ -69,6 +69,8 @@ SWITCH_BEGIN_EXTERN_C switch_chat_application_interface_t *chat_application_interface; /*! the table of api functions the module has implemented */ switch_api_interface_t *api_interface; + /*! the table of json api functions the module has implemented */ + switch_json_api_interface_t *json_api_interface; /*! the table of file formats the module has implemented */ switch_file_interface_t *file_interface; /*! the table of speech interfaces the module has implemented */ @@ -189,6 +191,13 @@ SWITCH_DECLARE(switch_status_t) switch_core_execute_chat_app(switch_event_t *mes */ SWITCH_DECLARE(switch_api_interface_t *) switch_loadable_module_get_api_interface(const char *name); +/*! + \brief Retrieve the JSON API interface by it's registered name + \param name the name of the API + \return the desired API interface + */ +SWITCH_DECLARE(switch_json_api_interface_t *) switch_loadable_module_get_json_api_interface(const char *name); + /*! \brief Retrieve the file format interface by it's registered name \param name the name of the file format @@ -275,6 +284,16 @@ SWITCH_DECLARE(int) switch_loadable_module_get_codecs_sorted(const switch_codec_ */ SWITCH_DECLARE(switch_status_t) switch_api_execute(const char *cmd, const char *arg, switch_core_session_t *session, switch_stream_handle_t *stream); +/*! + \brief Execute a registered JSON API command + \param json the name of the JSON API command to execute + \param arg the optional arguement to the command + \param session an optional session + \param stream stream for output + \return the status returned by the API call +*/ +SWITCH_DECLARE(switch_status_t) switch_json_api_execute(cJSON *json, switch_core_session_t *session, cJSON **retval); + /*! \brief Load a module \param dir the directory where the module resides @@ -328,6 +347,16 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_shutdown(void); break; \ } +#define SWITCH_ADD_JSON_API(json_api_int, int_name, descript, funcptr, syntax_string) \ + for (;;) { \ + json_api_int = (switch_json_api_interface_t *)switch_loadable_module_create_interface(*module_interface, SWITCH_JSON_API_INTERFACE); \ + json_api_int->interface_name = int_name; \ + json_api_int->desc = descript; \ + json_api_int->function = funcptr; \ + json_api_int->syntax = syntax_string; \ + break; \ + } + #define SWITCH_ADD_CHAT(chat_int, int_name, funcptr) \ for (;;) { \ chat_int = (switch_chat_interface_t *)switch_loadable_module_create_interface(*module_interface, SWITCH_CHAT_INTERFACE); \ @@ -510,8 +539,9 @@ static inline switch_bool_t switch_core_codec_ready(switch_codec_t *codec) } - - +SWITCH_DECLARE(switch_core_recover_callback_t) switch_core_get_secondary_recover_callback(const char *key); +SWITCH_DECLARE(switch_status_t) switch_core_register_secondary_recover_callback(const char *key, switch_core_recover_callback_t cb); +SWITCH_DECLARE(void) switch_core_unregister_secondary_recover_callback(const char *key); SWITCH_END_EXTERN_C #endif diff --git a/src/include/switch_module_interfaces.h b/src/include/switch_module_interfaces.h index b6f4f11554..ad6b4aefd4 100644 --- a/src/include/switch_module_interfaces.h +++ b/src/include/switch_module_interfaces.h @@ -743,6 +743,24 @@ struct switch_api_interface { struct switch_api_interface *next; }; + +/*! \brief A module interface to implement a json api function */ +struct switch_json_api_interface { + /*! the name of the interface */ + const char *interface_name; + /*! a description of the api function */ + const char *desc; + /*! function the api call uses */ + switch_json_api_function_t function; + /*! an example of the api syntax */ + const char *syntax; + switch_thread_rwlock_t *rwlock; + int refs; + switch_mutex_t *reflock; + switch_loadable_module_interface_t *parent; + struct switch_json_api_interface *next; +}; + #define PROTECT_INTERFACE(_it) if (_it) {switch_mutex_lock(_it->reflock); switch_thread_rwlock_rdlock(_it->parent->rwlock); switch_thread_rwlock_rdlock(_it->rwlock); _it->refs++; _it->parent->refs++; switch_mutex_unlock(_it->reflock);} //if (!strcmp(_it->interface_name, "user")) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "+++++++++++LOCK %s %d/%d\n", _it->interface_name, _it->refs, _it->parent->refs); #define UNPROTECT_INTERFACE(_it) if (_it) {switch_mutex_lock(_it->reflock); switch_thread_rwlock_unlock(_it->rwlock); switch_thread_rwlock_unlock(_it->parent->rwlock); _it->refs--; _it->parent->refs--; switch_mutex_unlock(_it->reflock);} //if (!strcmp(_it->interface_name, "user")) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "---------UNLOCK %s %d/%d\n", _it->interface_name, _it->refs, _it->parent->refs); diff --git a/src/include/switch_rtp.h b/src/include/switch_rtp.h index f704d943d1..bd509cc29a 100644 --- a/src/include/switch_rtp.h +++ b/src/include/switch_rtp.h @@ -508,6 +508,7 @@ SWITCH_DECLARE(switch_byte_t) switch_rtp_check_auto_adj(switch_rtp_t *rtp_sessio SWITCH_DECLARE(void) switch_rtp_set_interdigit_delay(switch_rtp_t *rtp_session, uint32_t delay); SWITCH_DECLARE(switch_status_t) switch_rtp_add_dtls(switch_rtp_t *rtp_session, dtls_fingerprint_t *local_fp, dtls_fingerprint_t *remote_fp, dtls_type_t type); +SWITCH_DECLARE(switch_status_t) switch_rtp_del_dtls(switch_rtp_t *rtp_session, dtls_type_t type); SWITCH_DECLARE(int) switch_rtp_has_dtls(void); SWITCH_DECLARE(void) switch_rtp_video_refresh(switch_rtp_t *rtp_session); diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 27a88dcc73..7c90161d3a 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -38,6 +38,7 @@ #define SWITCH_TYPES_H #include +#include SWITCH_BEGIN_EXTERN_C #define SWITCH_ENT_ORIGINATE_DELIM ":_:" @@ -223,8 +224,16 @@ SWITCH_BEGIN_EXTERN_C #define SWITCH_DEFAULT_FILE_BUFFER_LEN 65536 #define SWITCH_DTMF_LOG_LEN 1000 #define SWITCH_MAX_TRANS 2000 +#define SWITCH_CORE_SESSION_MAX_PRIVATES 2 + typedef uint8_t switch_byte_t; +typedef enum { + SWITCH_PVT_PRIMARY = 0, + SWITCH_PVT_SECONDARY +} switch_pvt_class_t; + + /*! \enum switch_dtmf_source_t \brief DTMF sources @@ -290,9 +299,11 @@ typedef enum { SOF_NONE = 0, SOF_NOBLOCK = (1 << 0), SOF_FORKED_DIAL = (1 << 1), - SOF_NO_EFFECTIVE_CID_NUM = (1 << 2), - SOF_NO_EFFECTIVE_CID_NAME = (1 << 3), - SOF_NO_LIMITS = (1 << 4) + SOF_NO_EFFECTIVE_ANI = (1 << 2), + SOF_NO_EFFECTIVE_ANIII = (1 << 3), + SOF_NO_EFFECTIVE_CID_NUM = (1 << 4), + SOF_NO_EFFECTIVE_CID_NAME = (1 << 5), + SOF_NO_LIMITS = (1 << 6) } switch_originate_flag_enum_t; typedef uint32_t switch_originate_flag_t; @@ -357,7 +368,8 @@ typedef enum { SWITCH_ASR_INTERFACE, SWITCH_MANAGEMENT_INTERFACE, SWITCH_LIMIT_INTERFACE, - SWITCH_CHAT_APPLICATION_INTERFACE + SWITCH_CHAT_APPLICATION_INTERFACE, + SWITCH_JSON_API_INTERFACE, } switch_module_interface_name_t; typedef enum { @@ -653,6 +665,7 @@ typedef enum { SWITCH_RTP_FLAG_ENABLE_RTCP, SWITCH_RTP_FLAG_RTCP_MUX, SWITCH_RTP_FLAG_KILL_JB, + SWITCH_RTP_FLAG_VIDEO_BREAK, SWITCH_RTP_FLAG_INVALID } switch_rtp_flag_t; @@ -1309,6 +1322,7 @@ typedef enum { CF_CONFIRM_BLIND_TRANSFER, CF_NO_PRESENCE, CF_CONFERENCE, + CF_CONFERENCE_ADV, CF_RECOVERING, CF_RECOVERING_BRIDGE, CF_TRACKED, @@ -2000,6 +2014,7 @@ typedef struct switch_codec_interface switch_codec_interface_t; typedef struct switch_application_interface switch_application_interface_t; typedef struct switch_chat_application_interface switch_chat_application_interface_t; typedef struct switch_api_interface switch_api_interface_t; +typedef struct switch_json_api_interface switch_json_api_interface_t; typedef struct switch_file_interface switch_file_interface_t; typedef struct switch_speech_interface switch_speech_interface_t; typedef struct switch_asr_interface switch_asr_interface_t; @@ -2083,6 +2098,12 @@ typedef switch_status_t (*switch_api_function_t) (_In_opt_z_ const char *cmd, _I #define SWITCH_STANDARD_API(name) static switch_status_t name (_In_opt_z_ const char *cmd, _In_opt_ switch_core_session_t *session, _In_ switch_stream_handle_t *stream) + +typedef switch_status_t (*switch_json_api_function_t) (const cJSON *json, _In_opt_ switch_core_session_t *session, cJSON **json_reply); + + +#define SWITCH_STANDARD_JSON_API(name) static switch_status_t name (const cJSON *json, _In_opt_ switch_core_session_t *session, cJSON **json_reply) + typedef switch_status_t (*switch_input_callback_function_t) (switch_core_session_t *session, void *input, switch_input_type_t input_type, void *buf, unsigned int buflen); typedef switch_status_t (*switch_read_frame_callback_function_t) (switch_core_session_t *session, switch_frame_t *frame, void *user_data); @@ -2236,6 +2257,13 @@ struct sql_queue_manager; struct switch_media_handle_s; typedef struct switch_media_handle_s switch_media_handle_t; +typedef uint32_t switch_event_channel_id_t; +typedef void (*switch_event_channel_func_t)(const char *event_channel, cJSON *json, const char *key, switch_event_channel_id_t id); + +struct switch_live_array_s; +typedef struct switch_live_array_s switch_live_array_t; + + SWITCH_END_EXTERN_C #endif diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index 97ec23f9c9..3f561ba386 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -1321,11 +1321,11 @@ SWITCH_STANDARD_API(echo_function) SWITCH_STANDARD_API(stun_function) { char *stun_ip = NULL; + char *src_ip = NULL; switch_port_t stun_port = (switch_port_t) SWITCH_STUN_DEFAULT_PORT; char *p; char ip_buf[256] = ""; char *ip = NULL; - char *pip = NULL; switch_port_t port = 0; switch_memory_pool_t *pool = NULL; char *error = ""; @@ -1346,7 +1346,7 @@ SWITCH_STANDARD_API(stun_function) switch_assert(stun_ip); - port = argv[1] ? atoi(argv[1]) : 0; + src_ip = argv[1]; if ((p = strchr(stun_ip, ':'))) { int iport; @@ -1359,12 +1359,19 @@ SWITCH_STANDARD_API(stun_function) p = stun_ip; } - if (p && (pip = strchr(p, ' '))) { - *pip++ = '\0'; + if (!zstr(src_ip) && (p = strchr(src_ip, ':'))) { + int iport; + *p++ = '\0'; + iport = atoi(p); + if (iport > 0 && iport < 0xFFFF) { + port = (switch_port_t) iport; + } + } else if (!zstr(src_ip)) { + ip = src_ip; } - if (pip) { - switch_copy_string(ip_buf, pip, sizeof(ip_buf)); + if ( !zstr(src_ip) ) { + switch_copy_string(ip_buf, src_ip, sizeof(ip_buf)); } else { switch_find_local_ip(ip_buf, sizeof(ip_buf), NULL, AF_INET); } @@ -6150,7 +6157,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load) SWITCH_ADD_API(commands_api_interface, "sql_escape", "Escape a string to prevent sql injection", sql_escape, SQL_ESCAPE_SYNTAX); SWITCH_ADD_API(commands_api_interface, "status", "Show current status", status_function, ""); SWITCH_ADD_API(commands_api_interface, "strftime_tz", "Display formatted time of timezone", strftime_tz_api_function, " [|][format string]"); - SWITCH_ADD_API(commands_api_interface, "stun", "Execute STUN lookup", stun_function, "[:port]"); + SWITCH_ADD_API(commands_api_interface, "stun", "Execute STUN lookup", stun_function, "[:port] [[: [count]"); SWITCH_ADD_API(commands_api_interface, "timer_test", "Exercise FS timer", timer_test_function, TIMER_TEST_SYNTAX); diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index db38e5c7eb..a847fb4ea2 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -1599,7 +1599,7 @@ static switch_status_t conference_add_member(conference_obj_t *conference, confe static void conference_set_video_floor_holder(conference_obj_t *conference, conference_member_t *member, switch_bool_t force) { switch_event_t *event; - conference_member_t *old_member = NULL; + conference_member_t *old_member = NULL, *imember = NULL; int old_id = 0; if (!member) { @@ -1623,8 +1623,6 @@ static void conference_set_video_floor_holder(conference_obj_t *conference, conf switch_mutex_lock(conference->mutex); if (!member) { - conference_member_t *imember; - for (imember = conference->members; imember; imember = imember->next) { if (imember != conference->video_floor_holder && imember->channel && switch_channel_test_flag(imember->channel, CF_VIDEO)) { member = imember; @@ -1648,6 +1646,23 @@ static void conference_set_video_floor_holder(conference_obj_t *conference, conf //switch_channel_clear_flag(old_member->channel, CF_VIDEO_PASSIVE); } + for (imember = conference->members; imember; imember = imember->next) { + if (!imember->channel || !switch_channel_test_flag(imember->channel, CF_VIDEO)) { + continue; + } + switch_channel_clear_flag(imember->channel, CF_VIDEO_ECHO); + + if (imember == conference->video_floor_holder) { + switch_channel_set_flag(imember->channel, CF_VIDEO_PASSIVE); + } else { + switch_channel_clear_flag(imember->channel, CF_VIDEO_PASSIVE); + } + + switch_channel_set_flag(imember->channel, CF_VIDEO_BREAK); + switch_core_session_kill_channel(imember->session, SWITCH_SIG_BREAK); + switch_core_session_refresh_video(imember->session); + } + switch_set_flag(conference, CFLAG_FLOOR_CHANGE); switch_mutex_unlock(conference->mutex); @@ -7505,6 +7520,7 @@ SWITCH_STANDARD_APP(conference_function) switch_channel_set_flag(channel, CF_CONFERENCE); switch_channel_set_flag(channel, CF_VIDEO_PASSIVE); + if (switch_channel_answer(channel) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Channel answer failed.\n"); goto end; diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index 5fe2c57e5b..8d7b5c6f37 100755 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -287,7 +287,7 @@ SWITCH_STANDARD_APP(clear_digit_action_function) char *target_str; switch_digit_action_target_t target = DIGIT_TARGET_SELF; - if (zstr(realm)) { + if (zstr((char *)data)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "clear_digit_action called with no args"); return; } diff --git a/src/mod/applications/mod_spandsp/udptl.c b/src/mod/applications/mod_spandsp/udptl.c index 9de1a915cc..45fa6b6ffc 100644 --- a/src/mod/applications/mod_spandsp/udptl.c +++ b/src/mod/applications/mod_spandsp/udptl.c @@ -205,7 +205,8 @@ int udptl_rx_packet(udptl_state_t *s, const uint8_t buf[], int len) /* Save the new packet. Pure redundancy mode won't use this, but some systems will switch into FEC mode after sending some redundant packets. */ x = seq_no & UDPTL_BUF_MASK; - memcpy(s->rx[x].buf, msg, msg_len); + if (msg_len > 0) + memcpy(s->rx[x].buf, msg, msg_len); s->rx[x].buf_len = msg_len; s->rx[x].fec_len[0] = 0; s->rx[x].fec_span = 0; @@ -288,7 +289,8 @@ int udptl_rx_packet(udptl_state_t *s, const uint8_t buf[], int len) return -1; /* Save the new FEC data */ - memcpy(s->rx[x].fec[i], data, s->rx[x].fec_len[i]); + if (s->rx[x].fec_len[i]) + memcpy(s->rx[x].fec[i], data, s->rx[x].fec_len[i]); #if 0 switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FEC: "); for (j = 0; j < s->rx[x].fec_len[i]; j++) diff --git a/src/mod/asr_tts/mod_flite/Makefile b/src/mod/asr_tts/mod_flite/Makefile index c93b48c1ca..360eb611e1 100644 --- a/src/mod/asr_tts/mod_flite/Makefile +++ b/src/mod/asr_tts/mod_flite/Makefile @@ -21,12 +21,12 @@ $(MODNAME).lo: $(FLITE_A) $(FLITE_DIR): $(GETLIB) $(FLITE)-current.tar.bz2 -$(FLITE_BUILDDIR)/Makefile: $(FLITE_DIR) +$(FLITE_BUILDDIR)/.stamp-configure: $(FLITE_DIR) mkdir -p $(FLITE_BUILDDIR) cd $(FLITE_BUILDDIR) && $(DEFAULT_VARS) $(FLITE_DIR)/configure $(DEFAULT_ARGS) --srcdir=$(FLITE_DIR) --with-audio=none --with-pic --disable-shared - $(TOUCH_TARGET) + test -f Makefile && touch $@ -$(FLITE_A): $(FLITE_DIR) $(FLITE_BUILDDIR)/Makefile +$(FLITE_A): $(FLITE_DIR) $(FLITE_BUILDDIR)/.stamp-configure cd $(FLITE_BUILDDIR) && $(MAKE) -j1 test -d $(FLITE_LIBDIR) || mkdir $(FLITE_LIBDIR) TARGET_OS=`grep TARGET_OS $(FLITE_BUILDDIR)/config/config | sed "s/^.*= //"` ;\ diff --git a/src/mod/endpoints/mod_alsa/mod_alsa.c b/src/mod/endpoints/mod_alsa/mod_alsa.c index dcdf215fe4..55f4ca4ba3 100644 --- a/src/mod/endpoints/mod_alsa/mod_alsa.c +++ b/src/mod/endpoints/mod_alsa/mod_alsa.c @@ -297,9 +297,6 @@ static switch_status_t channel_on_init(switch_core_session_t *session) switch_set_flag_locked(tech_pvt, TFLAG_IO); - /* Move channel's state machine to ROUTING */ - switch_channel_set_state(channel, CS_ROUTING); - return SWITCH_STATUS_SUCCESS; } diff --git a/src/mod/endpoints/mod_dingaling/mod_dingaling.c b/src/mod/endpoints/mod_dingaling/mod_dingaling.c index 5fe5d89000..e7ecaaf949 100644 --- a/src/mod/endpoints/mod_dingaling/mod_dingaling.c +++ b/src/mod/endpoints/mod_dingaling/mod_dingaling.c @@ -1916,6 +1916,7 @@ static switch_status_t channel_on_init(switch_core_session_t *session) { switch_channel_t *channel = switch_core_session_get_channel(session); struct private_object *tech_pvt = NULL; + switch_status_t status = SWITCH_STATUS_SUCCESS; tech_pvt = switch_core_session_get_private(session); switch_assert(tech_pvt != NULL); @@ -1928,11 +1929,10 @@ static switch_status_t channel_on_init(switch_core_session_t *session) if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) { switch_channel_mark_answered(channel); } - /* Move channel's state machine to ROUTING */ - switch_channel_set_state(channel, CS_ROUTING); + status = SWITCH_STATUS_SUCCESS; } - return SWITCH_STATUS_SUCCESS; + return status; } static switch_status_t channel_on_routing(switch_core_session_t *session) diff --git a/src/mod/endpoints/mod_gsmopen/alsa_nogsmlib_nocplusplus/mod_gsmopen/mod_gsmopen.c b/src/mod/endpoints/mod_gsmopen/alsa_nogsmlib_nocplusplus/mod_gsmopen/mod_gsmopen.c index 9f25ee1d96..f6c9605cb2 100644 --- a/src/mod/endpoints/mod_gsmopen/alsa_nogsmlib_nocplusplus/mod_gsmopen/mod_gsmopen.c +++ b/src/mod/endpoints/mod_gsmopen/alsa_nogsmlib_nocplusplus/mod_gsmopen/mod_gsmopen.c @@ -586,11 +586,6 @@ static switch_status_t channel_on_init(switch_core_session_t *session) //ERRORA("%s CHANNEL INIT\n", GSMOPEN_P_LOG, tech_pvt->name); switch_set_flag(tech_pvt, TFLAG_IO); - /* Move channel's state machine to ROUTING. This means the call is trying - to get from the initial start where the call because, to the point - where a destination has been identified. If the channel is simply - left in the initial state, nothing will happen. */ - switch_channel_set_state(channel, CS_ROUTING); switch_mutex_lock(globals.mutex); globals.calls++; diff --git a/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp b/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp index 9e78b8f55b..b3b3c1546c 100644 --- a/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp +++ b/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp @@ -416,11 +416,6 @@ static switch_status_t channel_on_init(switch_core_session_t *session) switch_set_flag(tech_pvt, TFLAG_IO); switch_mutex_unlock(tech_pvt->flag_mutex); - /* Move channel's state machine to ROUTING. This means the call is trying - to get from the initial start where the call because, to the point - where a destination has been identified. If the channel is simply - left in the initial state, nothing will happen. */ - switch_channel_set_state(channel, CS_ROUTING); switch_mutex_lock(globals.mutex); globals.calls++; diff --git a/src/mod/endpoints/mod_h323/mod_h323.cpp b/src/mod/endpoints/mod_h323/mod_h323.cpp index 17619129cf..adaf38deb1 100644 --- a/src/mod/endpoints/mod_h323/mod_h323.cpp +++ b/src/mod/endpoints/mod_h323/mod_h323.cpp @@ -1655,7 +1655,6 @@ switch_status_t FSH323Connection::on_init() } switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"Started routing for connection [%p]\n",this); - switch_channel_set_state(channel, CS_ROUTING); return SWITCH_STATUS_SUCCESS; } diff --git a/src/mod/endpoints/mod_loopback/mod_loopback.c b/src/mod/endpoints/mod_loopback/mod_loopback.c index 41f5849655..ee354ad90b 100644 --- a/src/mod/endpoints/mod_loopback/mod_loopback.c +++ b/src/mod/endpoints/mod_loopback/mod_loopback.c @@ -231,6 +231,7 @@ static switch_status_t channel_on_init(switch_core_session_t *session) switch_caller_profile_t *caller_profile; switch_event_t *vars = NULL; const char *var; + switch_status_t status = SWITCH_STATUS_FALSE; tech_pvt = switch_core_session_get_private(session); switch_assert(tech_pvt != NULL); @@ -354,11 +355,12 @@ static switch_status_t channel_on_init(switch_core_session_t *session) } switch_channel_set_variable(channel, "loopback_leg", switch_test_flag(tech_pvt, TFLAG_BLEG) ? "B" : "A"); + status = SWITCH_STATUS_SUCCESS; switch_channel_set_state(channel, CS_ROUTING); end: - return SWITCH_STATUS_SUCCESS; + return status; } static void do_reset(loopback_private_t *tech_pvt) @@ -709,6 +711,10 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch } tech_pvt->write_frame = (switch_frame_t *) pop; + + switch_clear_flag(tech_pvt->write_frame, SFF_RAW_RTP); + tech_pvt->write_frame->timestamp = 0; + tech_pvt->write_frame->codec = &tech_pvt->read_codec; *frame = tech_pvt->write_frame; tech_pvt->packet_count++; diff --git a/src/mod/endpoints/mod_opal/mod_opal.cpp b/src/mod/endpoints/mod_opal/mod_opal.cpp index 633bcdbd3a..6f0fb3addd 100644 --- a/src/mod/endpoints/mod_opal/mod_opal.cpp +++ b/src/mod/endpoints/mod_opal/mod_opal.cpp @@ -853,7 +853,7 @@ switch_status_t FSConnection::on_init() return SWITCH_STATUS_FALSE; PTRACE(4, "mod_opal\tStarted routing for connection " << *this); - switch_channel_set_state(m_fsChannel, CS_ROUTING); + return SWITCH_STATUS_SUCCESS; } diff --git a/src/mod/endpoints/mod_portaudio/mod_portaudio.c b/src/mod/endpoints/mod_portaudio/mod_portaudio.c index 9ce6730d9e..7f66558c61 100644 --- a/src/mod/endpoints/mod_portaudio/mod_portaudio.c +++ b/src/mod/endpoints/mod_portaudio/mod_portaudio.c @@ -282,11 +282,6 @@ SWITCH_STANDARD_API(pa_cmd); */ static switch_status_t channel_on_init(switch_core_session_t *session) { - switch_channel_t *channel = switch_core_session_get_channel(session); - - /* Move channel's state machine to ROUTING */ - switch_channel_set_state(channel, CS_ROUTING); - return SWITCH_STATUS_SUCCESS; } diff --git a/src/mod/endpoints/mod_reference/mod_reference.c b/src/mod/endpoints/mod_reference/mod_reference.c index 08c27da0eb..ece46f8d63 100644 --- a/src/mod/endpoints/mod_reference/mod_reference.c +++ b/src/mod/endpoints/mod_reference/mod_reference.c @@ -141,11 +141,6 @@ static switch_status_t channel_on_init(switch_core_session_t *session) assert(channel != NULL); switch_set_flag_locked(tech_pvt, TFLAG_IO); - /* Move channel's state machine to ROUTING. This means the call is trying - to get from the initial start where the call because, to the point - where a destination has been identified. If the channel is simply - left in the initial state, nothing will happen. */ - switch_channel_set_state(channel, CS_ROUTING); switch_mutex_lock(globals.mutex); globals.calls++; switch_mutex_unlock(globals.mutex); diff --git a/src/mod/endpoints/mod_rtmp/mod_rtmp.c b/src/mod/endpoints/mod_rtmp/mod_rtmp.c index 339ce81873..e25f38b861 100644 --- a/src/mod/endpoints/mod_rtmp/mod_rtmp.c +++ b/src/mod/endpoints/mod_rtmp/mod_rtmp.c @@ -163,13 +163,6 @@ switch_status_t rtmp_on_init(switch_core_session_t *session) switch_set_flag_locked(tech_pvt, TFLAG_IO); - /* Move channel's state machine to ROUTING. This means the call is trying - to get from the initial start where the call because, to the point - where a destination has been identified. If the channel is simply - left in the initial state, nothing will happen. */ - switch_channel_set_state(channel, CS_ROUTING); - - switch_mutex_lock(rsession->profile->mutex); rsession->profile->calls++; switch_mutex_unlock(rsession->profile->mutex); diff --git a/src/mod/endpoints/mod_skinny/mod_skinny.c b/src/mod/endpoints/mod_skinny/mod_skinny.c index cc94f1129f..0e1e700264 100644 --- a/src/mod/endpoints/mod_skinny/mod_skinny.c +++ b/src/mod/endpoints/mod_skinny/mod_skinny.c @@ -648,7 +648,8 @@ switch_status_t channel_on_init(switch_core_session_t *session) switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s CHANNEL INIT\n", switch_channel_get_name(channel)); - return SWITCH_STATUS_SUCCESS; + /* This does not set the state to routing like most modules do, this now happens in the default state handeler so return FALSE TO BLOCK IT*/ + return SWITCH_STATUS_FALSE; } struct channel_on_routing_helper { diff --git a/src/mod/endpoints/mod_skypopen/mod_skypopen.c b/src/mod/endpoints/mod_skypopen/mod_skypopen.c index 024942e00e..b586bd0489 100644 --- a/src/mod/endpoints/mod_skypopen/mod_skypopen.c +++ b/src/mod/endpoints/mod_skypopen/mod_skypopen.c @@ -457,11 +457,6 @@ static switch_status_t channel_on_init(switch_core_session_t *session) switch_set_flag(tech_pvt, TFLAG_IO); switch_mutex_unlock(tech_pvt->flag_mutex); - /* Move channel's state machine to ROUTING. This means the call is trying - to get from the initial start where the call because, to the point - where a destination has been identified. If the channel is simply - left in the initial state, nothing will happen. */ - switch_channel_set_state(channel, CS_ROUTING); DEBUGA_SKYPE("%s CHANNEL INIT %s\n", SKYPOPEN_P_LOG, tech_pvt->name, switch_core_session_get_uuid(session)); switch_copy_string(tech_pvt->session_uuid_str, switch_core_session_get_uuid(session), sizeof(tech_pvt->session_uuid_str)); @@ -670,11 +665,11 @@ static switch_status_t channel_on_hangup(switch_core_session_t *session) static switch_status_t channel_on_routing(switch_core_session_t *session) { - switch_channel_t *channel = NULL; + //switch_channel_t *channel = NULL; private_t *tech_pvt = NULL; - channel = switch_core_session_get_channel(session); - switch_assert(channel != NULL); + //channel = switch_core_session_get_channel(session); + //switch_assert(channel != NULL); tech_pvt = switch_core_session_get_private(session); switch_assert(tech_pvt != NULL); diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index a4c8913ee5..7286c5de16 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -102,20 +102,6 @@ static switch_status_t sofia_on_init(switch_core_session_t *session) } } - - - if (switch_channel_test_flag(tech_pvt->channel, CF_RECOVERING_BRIDGE)) { - switch_channel_set_state(channel, CS_RESET); - } else { - if (switch_channel_test_flag(tech_pvt->channel, CF_RECOVERING)) { - switch_channel_set_state(channel, CS_EXECUTE); - } else { - /* Move channel's state machine to ROUTING */ - switch_channel_set_state(channel, CS_ROUTING); - assert(switch_channel_get_state(channel) != CS_INIT); - } - } - end: switch_mutex_unlock(tech_pvt->sofia_mutex); @@ -156,43 +142,6 @@ static switch_status_t sofia_on_reset(switch_core_session_t *session) switch_channel_get_name(switch_core_session_get_channel(session))); - if (switch_channel_test_flag(tech_pvt->channel, CF_RECOVERING_BRIDGE)) { - switch_core_session_t *other_session = NULL; - const char *uuid = switch_core_session_get_uuid(session); - - if (switch_channel_test_flag(channel, CF_BRIDGE_ORIGINATOR)) { - const char *other_uuid = switch_channel_get_partner_uuid(channel); - int x = 0; - - if (other_uuid) { - for (x = 0; other_session == NULL && x < 20; x++) { - if (!switch_channel_up(channel)) { - break; - } - other_session = switch_core_session_locate(other_uuid); - switch_yield(100000); - } - } - - if (other_session) { - switch_channel_t *other_channel = switch_core_session_get_channel(other_session); - switch_channel_clear_flag(channel, CF_BRIDGE_ORIGINATOR); - switch_channel_wait_for_state_timeout(other_channel, CS_RESET, 5000); - switch_channel_wait_for_flag(other_channel, CF_MEDIA_ACK, SWITCH_TRUE, 2000, NULL); - - if (switch_channel_test_flag(channel, CF_PROXY_MODE) && switch_channel_test_flag(other_channel, CF_PROXY_MODE)) { - switch_ivr_signal_bridge(session, other_session); - } else { - switch_ivr_uuid_bridge(uuid, other_uuid); - } - switch_core_session_rwunlock(other_session); - } - } - - switch_channel_clear_flag(tech_pvt->channel, CF_RECOVERING_BRIDGE); - } - - return SWITCH_STATUS_SUCCESS; } @@ -221,12 +170,11 @@ static switch_status_t sofia_on_execute(switch_core_session_t *session) switch_channel_t *channel = switch_core_session_get_channel(session); switch_assert(tech_pvt != NULL); - switch_channel_clear_flag(tech_pvt->channel, CF_RECOVERING); - if (!sofia_test_flag(tech_pvt, TFLAG_HOLD_LOCK)) { sofia_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD); switch_channel_clear_flag(channel, CF_LEG_HOLDING); } + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s SOFIA EXECUTE\n", switch_channel_get_name(switch_core_session_get_channel(session))); @@ -873,8 +821,6 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session) tech_pvt->session_refresher = nua_no_refresher; } - - if (sofia_use_soa(tech_pvt)) { nua_respond(tech_pvt->nh, SIP_200_OK, NUTAG_AUTOANSWER(0), @@ -4611,6 +4557,9 @@ static int notify_csta_callback(void *pArg, int argc, char **argv, char **column char *ct = argv[i++]; char *id = NULL; char *contact; + sip_cseq_t *cseq = NULL; + uint32_t callsequence; + uint32_t now = (uint32_t) switch_epoch_time_now(NULL); sofia_destination_t *dst = NULL; char *route_uri = NULL; @@ -4635,14 +4584,22 @@ static int notify_csta_callback(void *pArg, int argc, char **argv, char **column route_uri = sofia_glue_strip_uri(dst->route_uri); } + switch_mutex_lock(profile->ireg_mutex); + if (!profile->cseq_base) { + profile->cseq_base = (now - 1312693200) * 10; + } + callsequence = ++profile->cseq_base; + switch_mutex_unlock(profile->ireg_mutex); + //nh = nua_handle(profile->nua, NULL, NUTAG_URL(dst->contact), SIPTAG_FROM_STR(id), SIPTAG_TO_STR(id), SIPTAG_CONTACT_STR(profile->url), TAG_END()); - nh = nua_handle(profile->nua, NULL, NUTAG_URL(dst->contact), SIPTAG_FROM_STR(full_from), SIPTAG_TO_STR(full_to), SIPTAG_CONTACT_STR(profile->url), TAG_END()); + nh = nua_handle(profile->nua, NULL, NUTAG_URL(dst->contact), SIPTAG_FROM_STR(full_to), SIPTAG_TO_STR(full_from), SIPTAG_CONTACT_STR(profile->url), TAG_END()); + cseq = sip_cseq_create(nh->nh_home, callsequence, SIP_METHOD_NOTIFY); nua_handle_bind(nh, &mod_sofia_globals.destroy_private); nua_notify(nh, NUTAG_NEWSUB(1), TAG_IF(dst->route_uri, NUTAG_PROXY(route_uri)), TAG_IF(dst->route, SIPTAG_ROUTE_STR(dst->route)), TAG_IF(call_id, SIPTAG_CALL_ID_STR(call_id)), - SIPTAG_EVENT_STR("as-feature-event"), SIPTAG_CONTENT_TYPE_STR(ct), TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)), TAG_IF(!zstr(body), SIPTAG_PAYLOAD_STR(body)), TAG_END()); + SIPTAG_EVENT_STR("as-feature-event"), SIPTAG_CONTENT_TYPE_STR(ct), TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)), TAG_IF(!zstr(body), SIPTAG_PAYLOAD_STR(body)), SIPTAG_CSEQ(cseq), TAG_END()); @@ -4926,7 +4883,7 @@ static void general_event_handler(switch_event_t *event) SWITCH_STANDARD_STREAM(fwdi_stream); write_csta_xml_chunk(event, fwdi_stream, "ForwardingEvent", "forwardImmediate"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[%s] is %d bytes long\n", (char *)fwdi_stream.data, (int)strlen(fwdi_stream.data)); - stream.write_function(&stream, "--%s\nContent-Type: application/x-as-feature-event+xml\nContent-Length:%d\nContent-ID:<%s@%s>\n\n%s", boundary_string, strlen(fwdi_stream.data), user, host, fwdi_stream.data); + stream.write_function(&stream, "--%s\r\nContent-Type: application/x-as-feature-event+xml\r\nContent-Length: %d\r\nContent-ID: <%si@%s>\r\n\r\n%s", boundary_string, strlen(fwdi_stream.data), user, host, fwdi_stream.data); switch_safe_free(fwdi_stream.data); } if ((header_name = switch_event_get_header(event, "forward_busy"))) { @@ -4934,7 +4891,7 @@ static void general_event_handler(switch_event_t *event) SWITCH_STANDARD_STREAM(fwdb_stream); write_csta_xml_chunk(event, fwdb_stream, "ForwardingEvent", "forwardBusy"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[%s] is %d bytes long\n", (char *)fwdb_stream.data, (int)strlen(fwdb_stream.data)); - stream.write_function(&stream, "--%s\nContent-Type: application/x-as-feature-event+xml\nContent-Length:%d\nContent-ID:<%s@%s>\n\n%s", boundary_string, strlen(fwdb_stream.data), user, host, fwdb_stream.data); + stream.write_function(&stream, "--%s\r\nContent-Type: application/x-as-feature-event+xml\r\nContent-Length: %d\r\nContent-ID: <%sb@%s>\r\n\r\n%s", boundary_string, strlen(fwdb_stream.data), user, host, fwdb_stream.data); switch_safe_free(fwdb_stream.data); } if ((header_name = switch_event_get_header(event, "forward_no_answer"))) { @@ -4942,17 +4899,17 @@ static void general_event_handler(switch_event_t *event) SWITCH_STANDARD_STREAM(fwdna_stream); write_csta_xml_chunk(event, fwdna_stream, "ForwardingEvent", "forwardNoAns"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[%s] is %d bytes long\n", (char *)fwdna_stream.data, (int)strlen(fwdna_stream.data)); - stream.write_function(&stream, "--%s\nContent-Type: application/x-as-feature-event+xml\nContent-Length:%d\nContent-ID:<%s@%s>\n\n%s", boundary_string, strlen(fwdna_stream.data), user, host, fwdna_stream.data); + stream.write_function(&stream, "--%s\r\nContent-Type: application/x-as-feature-event+xml\r\nContent-Length: %d\r\nContent-ID: <%sn@%s>\r\n\r\n%s", boundary_string, strlen(fwdna_stream.data), user, host, fwdna_stream.data); switch_safe_free(fwdna_stream.data); } SWITCH_STANDARD_STREAM(dnd_stream); write_csta_xml_chunk(event, dnd_stream, "DoNotDisturbEvent", NULL); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[%s] is %d bytes long\n", (char *)dnd_stream.data, (int)strlen(dnd_stream.data)); - stream.write_function(&stream, "--%s\nContent-Type:application/x-as-feature-event+xml\nContent-Length:%d\nContent-ID:<%s@%s>\n\n%s", boundary_string, strlen(dnd_stream.data), user, host, dnd_stream.data); + stream.write_function(&stream, "--%s\r\nContent-Type: application/x-as-feature-event+xml\r\nContent-Length: %d\r\nContent-ID: <%sd@%s>\r\n\r\n%s", boundary_string, strlen(dnd_stream.data), user, host, dnd_stream.data); switch_safe_free(dnd_stream.data); - stream.write_function(&stream, "--%s--\n", boundary_string); + stream.write_function(&stream, "--%s--\r\n", boundary_string); ct = switch_mprintf("multipart/mixed; boundary=\"%s\"", boundary_string); } else { diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index c27fcb55a3..952fce2f9f 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -171,6 +171,8 @@ struct sofia_private { char *network_ip; char *network_port; char *key; + char *user; + char *realm; int destroy_nh; int destroy_me; int is_call; diff --git a/src/mod/endpoints/mod_sofia/rtp.c b/src/mod/endpoints/mod_sofia/rtp.c index ea4921052e..953ea6d8f0 100644 --- a/src/mod/endpoints/mod_sofia/rtp.c +++ b/src/mod/endpoints/mod_sofia/rtp.c @@ -300,7 +300,7 @@ static switch_status_t channel_on_init(switch_core_session_t *session) switch_channel_set_state(channel, CS_CONSUME_MEDIA); - return SWITCH_STATUS_SUCCESS; + return SWITCH_STATUS_FALSE; } static switch_status_t channel_on_destroy(switch_core_session_t *session) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index fcd9c5870f..9000ec96b3 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -1454,6 +1454,7 @@ static void our_sofia_event_callback(nua_event_t event, if (sofia_private && sofia_private->call_id && sofia_private->network_ip && sofia_private->network_port) { char *sql; + switch_event_t *event = NULL; sql = switch_mprintf("delete from sip_registrations where call_id='%q' and network_ip='%q' and network_port='%q'", sofia_private->call_id, sofia_private->network_ip, sofia_private->network_port); @@ -1461,6 +1462,34 @@ static void our_sofia_event_callback(nua_event_t event, sofia_private->call_id, sofia_private->network_ip, sofia_private->network_port); sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE); + switch_core_del_registration(sofia_private->user, sofia_private->realm, sofia_private->call_id); + + + + if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) { + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", SOFIA_CHAT_PROTO); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "rpid", "unknown"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", profile->url); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "user-agent", + (sip && sip->sip_user_agent) ? sip->sip_user_agent->g_string : "unknown"); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s@%s", sofia_private->user, sofia_private->realm); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "status", "Unregistered"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "presence-source", "register"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "event_type", "presence"); + switch_event_fire(&event); + } + + + if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, MY_EVENT_UNREGISTER) == SWITCH_STATUS_SUCCESS) { + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "profile-name", profile->name); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from-user", sofia_private->user); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from-host", sofia_private->realm); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "call-id", sofia_private->call_id); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "rpid", "unknown"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "reason", "socket-disconnection"); + switch_event_fire(&event); + } + sofia_reg_check_socket(profile, sofia_private->call_id, sofia_private->network_ip, sofia_private->network_port); } diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index f569a12dd2..833a725d44 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -1907,9 +1907,6 @@ int sofia_recover_callback(switch_core_session_t *session) switch_channel_get_name(channel), use_uuid); } } - - switch_core_media_recover_session(session); - } r++; diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index 11228355bf..ef998c9c88 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -644,15 +644,31 @@ static void actual_sofia_presence_mwi_event_handler(switch_event_t *event) static int sofia_presence_dialog_callback(void *pArg, int argc, char **argv, char **columnNames) { struct dialog_helper *helper = (struct dialog_helper *) pArg; + switch_core_session_t *session = NULL; + switch_channel_t *channel = NULL; + int done = 0; if (argc >= 4) { if (argc == 5 && !zstr(argv[4])) { - if (!switch_ivr_uuid_exists(argv[4])) { + if ((session = switch_core_session_locate(argv[4]))) { + channel = switch_core_session_get_channel(session); + + if (!switch_channel_test_flag(channel, CF_ANSWERED) && + switch_true(switch_channel_get_variable_dup(channel, "presence_disable_early", SWITCH_FALSE, -1))) { + done++; + } + + switch_core_session_rwunlock(session); + } else { return 0; } } + if (done) { + return 0; + } + if (mod_sofia_globals.debug_presence > 0) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "CHECK DIALOG state[%s] status[%s] rpid[%s] pres[%s] uuid[%s]\n", argv[0], argv[1], argv[2], argv[3], argv[4]); diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index 1514d4be4f..821a086880 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -1758,6 +1758,9 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand sofia_private->network_ip = su_strdup(nh->nh_home, network_ip); sofia_private->network_port = su_strdup(nh->nh_home, network_port_c); sofia_private->key = su_strdup(nh->nh_home, key); + sofia_private->user = su_strdup(nh->nh_home, to_user); + sofia_private->realm = su_strdup(nh->nh_home, reg_host); + sofia_private->is_static++; *sofia_private_p = sofia_private; nua_handle_bind(nh, sofia_private); diff --git a/src/mod/endpoints/mod_unicall/mod_unicall.c b/src/mod/endpoints/mod_unicall/mod_unicall.c index 18cd5d11d5..35c3cde286 100644 --- a/src/mod/endpoints/mod_unicall/mod_unicall.c +++ b/src/mod/endpoints/mod_unicall/mod_unicall.c @@ -850,11 +850,6 @@ static switch_status_t unicall_on_init(switch_core_session_t *session) switch_set_flag_locked(tech_pvt, TFLAG_IO); - /* Move channel's state machine to ROUTING. This means the call is trying - to get from the initial state to the point where a destination has been - identified. If the channel is simply left in the initial state, nothing - will happen. */ - switch_channel_set_state(channel, CS_ROUTING); switch_mutex_lock(globals.mutex); globals.calls++; switch_mutex_unlock(globals.mutex); diff --git a/src/mod/event_handlers/mod_rayo/mod_rayo.c b/src/mod/event_handlers/mod_rayo/mod_rayo.c index 92257aa2f6..6dd58d29c6 100644 --- a/src/mod/event_handlers/mod_rayo/mod_rayo.c +++ b/src/mod/event_handlers/mod_rayo/mod_rayo.c @@ -941,10 +941,11 @@ static void rayo_call_cleanup(struct rayo_actor *actor) /* lost the race: pending join failed... send IQ result to client now. */ if (call->pending_join_request) { - iks *result = iks_new_error_detailed(call->pending_join_request, STANZA_ERROR_ITEM_NOT_FOUND, "call ended"); - RAYO_SEND_REPLY(call, iks_find_attrib_soft(call->pending_join_request, "from"), result); - iks_delete(call->pending_join_request); + iks *request = call->pending_join_request; + iks *result = iks_new_error_detailed(request, STANZA_ERROR_ITEM_NOT_FOUND, "call ended"); call->pending_join_request = NULL; + RAYO_SEND_REPLY(call, iks_find_attrib_soft(request, "from"), result); + iks_delete(call->pending_join_request); } iks_delete(revent); @@ -1765,9 +1766,11 @@ static iks *join_call(struct rayo_call *call, switch_core_session_t *session, st } 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) { - response = iks_new_error_detailed(node, STANZA_ERROR_INTERNAL_SERVER_ERROR, "failed to bridge call"); - iks_delete(call->pending_join_request); + iks *request = call->pending_join_request; + iks *result = iks_new_error_detailed(request, STANZA_ERROR_ITEM_NOT_FOUND, "failed to bridge call"); call->pending_join_request = NULL; + RAYO_SEND_REPLY(call, iks_find_attrib_soft(request, "from"), result); + iks_delete(call->pending_join_request); } RAYO_UNLOCK(b_call); } @@ -1776,14 +1779,66 @@ static iks *join_call(struct rayo_call *call, switch_core_session_t *session, st /** * Execute command on session's conference + * @param session to execute conference API on + * @param conf_name of conference + * @param command to send to conference + * @param node IQ request + * @return response on failure */ -static void exec_conference_api(switch_core_session_t *session, const char *conf_name, const char *command) +static iks *exec_conference_api(switch_core_session_t *session, const char *conf_name, const char *command, iks *node) { + iks *response = NULL; switch_stream_handle_t stream = { 0 }; const char *conf_member_id = switch_channel_get_variable(switch_core_session_get_channel(session), "conference_member_id"); SWITCH_STANDARD_STREAM(stream); switch_api_execute("conference", switch_core_session_sprintf(session, "%s %s %s", conf_name, command, conf_member_id), NULL, &stream); + if (!zstr(stream.data) && strncmp("OK", stream.data, 2)) { + response = iks_new_error_detailed_printf(node, STANZA_ERROR_SERVICE_UNAVAILABLE, "%s", stream.data); + } switch_safe_free(stream.data); + return response; +} + +/** + * Execute conference app on session + * @param session to execute conference API on + * @param command to send to conference (conference name, member flags, etc) + * @param node IQ request + * @return response on failure + */ +static iks *exec_conference_app(switch_core_session_t *session, const char *command, iks *node) +{ + iks *response = NULL; + switch_event_t *execute_event = NULL; + switch_channel_t *channel = switch_core_session_get_channel(session); + + /* conference requires local media on channel */ + if (!switch_channel_media_ready(channel) && switch_channel_pre_answer(channel) != SWITCH_STATUS_SUCCESS) { + /* shit */ + response = iks_new_error_detailed(node, STANZA_ERROR_INTERNAL_SERVER_ERROR, "failed to start media"); + return response; + } + + /* send execute conference event to session */ + if (switch_event_create(&execute_event, SWITCH_EVENT_COMMAND) == SWITCH_STATUS_SUCCESS) { + switch_event_add_header_string(execute_event, SWITCH_STACK_BOTTOM, "call-command", "execute"); + switch_event_add_header_string(execute_event, SWITCH_STACK_BOTTOM, "execute-app-name", "conference"); + switch_event_add_header_string(execute_event, SWITCH_STACK_BOTTOM, "execute-app-arg", command); + //switch_event_add_header_string(execute_event, SWITCH_STACK_BOTTOM, "event_uuid", uuid); + switch_event_add_header_string(execute_event, SWITCH_STACK_BOTTOM, "event-lock", "true"); + if (!switch_channel_test_flag(channel, CF_PROXY_MODE)) { + switch_channel_set_flag(channel, CF_BLOCK_BROADCAST_UNTIL_MEDIA); + } + + if (switch_core_session_queue_private_event(session, &execute_event, SWITCH_FALSE) != SWITCH_STATUS_SUCCESS) { + response = iks_new_error_detailed(node, STANZA_ERROR_INTERNAL_SERVER_ERROR, "failed to join mixer (queue event failed)"); + if (execute_event) { + switch_event_destroy(&execute_event); + } + return response; + } + } + return response; } /** @@ -1803,14 +1858,20 @@ static iks *join_mixer(struct rayo_call *call, switch_core_session_t *session, s if (call->joined_id) { /* adjust join conference params */ if (!strcmp("duplex", direction)) { - exec_conference_api(session, mixer_name, "unmute"); - exec_conference_api(session, mixer_name, "undeaf"); + if ((response = exec_conference_api(session, mixer_name, "unmute", node)) || + (response = exec_conference_api(session, mixer_name, "undeaf", node))) { + return response; + } } else if (!strcmp("recv", direction)) { - exec_conference_api(session, mixer_name, "mute"); - exec_conference_api(session, mixer_name, "undeaf"); + if ((response = exec_conference_api(session, mixer_name, "mute", node)) || + (response = exec_conference_api(session, mixer_name, "undeaf", node))) { + return response; + } } else { - exec_conference_api(session, mixer_name, "unmute"); - exec_conference_api(session, mixer_name, "deaf"); + if ((response = exec_conference_api(session, mixer_name, "unmute", node)) || + (response = exec_conference_api(session, mixer_name, "deaf", node))) { + return response; + } } response = iks_new_iq_result(node); } else { @@ -1821,10 +1882,12 @@ static iks *join_mixer(struct rayo_call *call, switch_core_session_t *session, s } else if (!strcmp("recv", direction)) { conf_args = switch_core_session_sprintf(session, "%s+flags{mute}", conf_args); } - if (switch_core_session_execute_application_async(session, "conference", conf_args) == SWITCH_STATUS_SUCCESS) { - response = iks_new_iq_result(node); - } else { - response = iks_new_error_detailed(node, STANZA_ERROR_INTERNAL_SERVER_ERROR, "failed execute conference app"); + + call->pending_join_request = iks_copy(node); + response = exec_conference_app(session, conf_args, node); + if (response) { + iks_delete(call->pending_join_request); + call->pending_join_request = NULL; } } return response; @@ -1909,11 +1972,8 @@ static iks *unjoin_call(struct rayo_call *call, switch_core_session_t *session, { iks *node = msg->payload; iks *response = NULL; - const char *bleg_uuid = switch_channel_get_variable(switch_core_session_get_channel(session), SWITCH_BRIDGE_UUID_VARIABLE); - const char *bleg_uri = switch_core_session_sprintf(session, "xmpp:%s@%s", bleg_uuid ? bleg_uuid : "", RAYO_JID(globals.server)); - /* bleg must match call_uri */ - if (!zstr(bleg_uri) && !strcmp(bleg_uri, call_uri)) { + if (!strcmp(call_uri, call->joined_id)) { /* unbridge call */ call->pending_join_request = iks_copy(node); switch_ivr_park_session(session); @@ -1951,11 +2011,12 @@ static iks *unjoin_mixer(struct rayo_call *call, switch_core_session_t *session, goto done; } - /* ack command */ - response = iks_new_iq_result(node); - /* kick the member */ - exec_conference_api(session, mixer_name, "hup"); + response = exec_conference_api(session, mixer_name, "hup", node); + if (!response) { + /* ack command */ + response = iks_new_iq_result(node); + } done: @@ -1983,7 +2044,13 @@ static iks *on_rayo_unjoin(struct rayo_actor *call, struct rayo_message *msg, vo response = iks_new_error_detailed(msg->payload, STANZA_ERROR_UNEXPECTED_REQUEST, "(un)join request is pending"); } else if (!RAYO_CALL(call)->joined) { /* not joined to anything */ - response = iks_new_error(msg->payload, STANZA_ERROR_SERVICE_UNAVAILABLE); + response = iks_new_error_detailed(msg->payload, STANZA_ERROR_SERVICE_UNAVAILABLE, "not joined to anything"); + } else if (RAYO_CALL(call)->joined == JOINED_MIXER && !zstr(call_uri)) { + /* joined to mixer, not call */ + response = iks_new_error_detailed(msg->payload, STANZA_ERROR_SERVICE_UNAVAILABLE, "not joined to call"); + } else if (RAYO_CALL(call)->joined == JOINED_CALL && !zstr(mixer_name)) { + /* joined to call, not mixer */ + response = iks_new_error_detailed(msg->payload, STANZA_ERROR_SERVICE_UNAVAILABLE, "not joined to mixer"); } else if (!zstr(call_uri)) { response = unjoin_call(RAYO_CALL(call), session, msg, call_uri); } else if (!zstr(mixer_name)) { @@ -2538,6 +2605,15 @@ static void on_mixer_add_member_event(struct rayo_mixer *mixer, switch_event_t * call->joined = JOINED_MIXER; call->joined_id = switch_core_strdup(RAYO_POOL(call), rayo_mixer_get_name(mixer)); + /* send IQ result to client now. */ + if (call->pending_join_request) { + iks *request = call->pending_join_request; + iks *result = iks_new_iq_result(request); + call->pending_join_request = NULL; + RAYO_SEND_REPLY(call, iks_find_attrib_soft(request, "from"), result); + iks_delete(request); + } + /* send mixer joined event to member DCP */ add_member_event = iks_new_presence("joined", RAYO_NS, RAYO_JID(call), call->dcp_jid); x = iks_find(add_member_event, "joined"); @@ -2702,17 +2778,39 @@ static void on_call_bridge_event(struct rayo_client *rclient, switch_event_t *ev iks *joined; call->joined = JOINED_CALL; - call->joined_id = switch_core_strdup(RAYO_POOL(call), b_uuid); + call->joined_id = switch_core_sprintf(RAYO_POOL(call), "xmpp:%s@%s", b_uuid, RAYO_JID(globals.server)); /* send IQ result to client now. */ - switch_mutex_lock(RAYO_ACTOR(call)->mutex); if (call->pending_join_request) { - iks *result = iks_new_iq_result(call->pending_join_request); - RAYO_SEND_REPLY(call, iks_find_attrib_soft(call->pending_join_request, "from"), result); - iks_delete(call->pending_join_request); + iks *request = call->pending_join_request; + iks *result = iks_new_iq_result(request); call->pending_join_request = NULL; + RAYO_SEND_REPLY(call, iks_find_attrib_soft(request, "from"), result); + iks_delete(request); + } + + b_call = RAYO_CALL_LOCATE_BY_ID(b_uuid); + if (b_call) { + b_call->joined = JOINED_CALL; + b_call->joined_id = switch_core_sprintf(RAYO_POOL(b_call), "xmpp:%s@s", a_uuid, RAYO_JID(globals.server)); + + /* send IQ result to client now. */ + if (b_call->pending_join_request) { + iks *request = b_call->pending_join_request; + iks *result = iks_new_iq_result(request); + b_call->pending_join_request = NULL; + RAYO_SEND_REPLY(call, iks_find_attrib_soft(request, "from"), result); + iks_delete(request); + } + + /* send B-leg event */ + revent = iks_new_presence("joined", RAYO_NS, RAYO_JID(b_call), rayo_call_get_dcp_jid(b_call)); + joined = iks_find(revent, "joined"); + iks_insert_attrib_printf(joined, "call-uri", "xmpp:%s@%s", a_uuid, RAYO_JID(globals.server)); + + RAYO_SEND_MESSAGE(b_call, rayo_call_get_dcp_jid(b_call), revent); + RAYO_UNLOCK(b_call); } - switch_mutex_unlock(RAYO_ACTOR(call)->mutex); /* send A-leg event */ revent = iks_new_presence("joined", RAYO_NS, @@ -2723,19 +2821,6 @@ static void on_call_bridge_event(struct rayo_client *rclient, switch_event_t *ev RAYO_SEND_MESSAGE(call, RAYO_JID(rclient), revent); - /* send B-leg event */ - b_call = RAYO_CALL_LOCATE_BY_ID(b_uuid); - if (b_call) { - revent = iks_new_presence("joined", RAYO_NS, RAYO_JID(b_call), rayo_call_get_dcp_jid(b_call)); - joined = iks_find(revent, "joined"); - iks_insert_attrib_printf(joined, "call-uri", "xmpp:%s@%s", a_uuid, RAYO_JID(globals.server)); - - b_call->joined = JOINED_CALL; - b_call->joined_id = switch_core_strdup(RAYO_POOL(b_call), a_uuid); - - RAYO_SEND_MESSAGE(b_call, rayo_call_get_dcp_jid(b_call), revent); - RAYO_UNLOCK(b_call); - } RAYO_UNLOCK(call); } } @@ -2760,14 +2845,35 @@ static void on_call_unbridge_event(struct rayo_client *rclient, switch_event_t * call->joined_id = NULL; /* send IQ result to client now. */ - switch_mutex_lock(RAYO_ACTOR(call)->mutex); if (call->pending_join_request) { - iks *result = iks_new_iq_result(call->pending_join_request); - RAYO_SEND_REPLY(call, iks_find_attrib_soft(call->pending_join_request, "from"), result); - iks_delete(call->pending_join_request); + iks *request = call->pending_join_request; + iks *result = iks_new_iq_result(request); call->pending_join_request = NULL; + RAYO_SEND_REPLY(call, iks_find_attrib_soft(request, "from"), result); + iks_delete(request); + } + + b_call = RAYO_CALL_LOCATE_BY_ID(b_uuid); + if (b_call) { + b_call->joined = 0; + b_call->joined_id = NULL; + + /* send IQ result to client now. */ + if (b_call->pending_join_request) { + iks *request = b_call->pending_join_request; + iks *result = iks_new_iq_result(request); + b_call->pending_join_request = NULL; + RAYO_SEND_REPLY(b_call, iks_find_attrib_soft(request, "from"), result); + iks_delete(request); + } + + /* send B-leg event */ + revent = iks_new_presence("unjoined", RAYO_NS, RAYO_JID(b_call), rayo_call_get_dcp_jid(b_call)); + joined = iks_find(revent, "unjoined"); + iks_insert_attrib_printf(joined, "call-uri", "xmpp:%s@%s", a_uuid, RAYO_JID(globals.server)); + RAYO_SEND_MESSAGE(b_call, rayo_call_get_dcp_jid(b_call), revent); + RAYO_UNLOCK(b_call); } - switch_mutex_unlock(RAYO_ACTOR(call)->mutex); /* send A-leg event */ revent = iks_new_presence("unjoined", RAYO_NS, @@ -2777,22 +2883,40 @@ static void on_call_unbridge_event(struct rayo_client *rclient, switch_event_t * iks_insert_attrib_printf(joined, "call-uri", "xmpp:%s@%s", b_uuid, RAYO_JID(globals.server)); RAYO_SEND_MESSAGE(call, RAYO_JID(rclient), revent); - /* send B-leg event */ - b_call = RAYO_CALL_LOCATE_BY_ID(b_uuid); - if (b_call) { - revent = iks_new_presence("unjoined", RAYO_NS, RAYO_JID(b_call), rayo_call_get_dcp_jid(b_call)); - joined = iks_find(revent, "unjoined"); - iks_insert_attrib_printf(joined, "call-uri", "xmpp:%s@%s", a_uuid, RAYO_JID(globals.server)); - RAYO_SEND_MESSAGE(b_call, rayo_call_get_dcp_jid(b_call), revent); - - b_call->joined = 0; - b_call->joined_id = NULL; - RAYO_UNLOCK(b_call); - } RAYO_UNLOCK(call); } } +/** + * Handle call execute application event + * @param rclient the Rayo client + * @param event the execute event + */ +static void on_call_execute_event(struct rayo_client *rclient, switch_event_t *event) +{ + struct rayo_call *call = RAYO_CALL_LOCATE_BY_ID(switch_event_get_header(event, "Unique-ID")); + if (call) { + switch_log_printf(SWITCH_CHANNEL_UUID_LOG(RAYO_ID(call)), SWITCH_LOG_DEBUG, "Application %s execute\n", switch_event_get_header(event, "Application")); + RAYO_UNLOCK(call); + } +} + +/** + * Handle call execute application complete event + * @param rclient the Rayo client + * @param event the execute complete event + */ +static void on_call_execute_complete_event(struct rayo_client *rclient, switch_event_t *event) +{ + struct rayo_call *call = RAYO_CALL_LOCATE_BY_ID(switch_event_get_header(event, "Unique-ID")); + if (call) { + const char *app = switch_event_get_header(event, "Application"); + switch_log_printf(SWITCH_CHANNEL_UUID_LOG(RAYO_ID(call)), SWITCH_LOG_DEBUG, "Application %s execute complete: %s \n", + app, + switch_event_get_header(event, "Application-Response")); + RAYO_UNLOCK(call); + } +} /** * Handle events to deliver to client connection @@ -2819,6 +2943,12 @@ static void rayo_client_handle_event(struct rayo_client *rclient, switch_event_t case SWITCH_EVENT_CHANNEL_UNBRIDGE: on_call_unbridge_event(rclient, event); break; + case SWITCH_EVENT_CHANNEL_EXECUTE: + on_call_execute_event(rclient, event); + break; + case SWITCH_EVENT_CHANNEL_EXECUTE_COMPLETE: + on_call_execute_complete_event(rclient, event); + break; default: /* don't care */ break; @@ -2944,7 +3074,9 @@ static switch_status_t rayo_call_on_read_frame(switch_core_session_t *session, s switch_time_t idle_start = call->idle_start_time; int idle_duration_ms = (now - idle_start) / 1000; /* detect idle session (rayo-client has stopped controlling call) and terminate call */ - if (!rayo_call_is_joined(call) && idle_duration_ms > globals.max_idle_ms) { + if (rayo_call_is_joined(call)) { + call->idle_start_time = now; + } else if (idle_duration_ms > globals.max_idle_ms) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Ending abandoned call. idle_duration_ms = %i ms\n", idle_duration_ms); switch_channel_hangup(channel, RAYO_CAUSE_HANGUP); } @@ -3037,8 +3169,9 @@ done: if (ok) { switch_channel_set_variable(channel, "hangup_after_bridge", "false"); - switch_channel_set_variable(channel, "transfer_after_bridge", "false"); + switch_channel_set_variable(channel, "transfer_after_bridge", ""); switch_channel_set_variable(channel, "park_after_bridge", "true"); + switch_channel_set_variable(channel, "hold_hangup_xfer_exten", "foo"); /* Icky hack to prevent unjoin of call on hold from hanging up b-leg. park_after_bridge will take precedence over the transfer_after_bridge variable that gets set by this var */ 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) { @@ -3891,6 +4024,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_rayo_load) switch_event_bind(modname, SWITCH_EVENT_CHANNEL_ANSWER, NULL, route_call_event, NULL); switch_event_bind(modname, SWITCH_EVENT_CHANNEL_BRIDGE, NULL, route_call_event, NULL); switch_event_bind(modname, SWITCH_EVENT_CHANNEL_UNBRIDGE, NULL, route_call_event, NULL); + switch_event_bind(modname, SWITCH_EVENT_CHANNEL_EXECUTE, NULL, route_call_event, NULL); + switch_event_bind(modname, SWITCH_EVENT_CHANNEL_EXECUTE_COMPLETE, NULL, route_call_event, NULL); switch_event_bind(modname, SWITCH_EVENT_CHANNEL_DESTROY, NULL, on_call_end_event, NULL); diff --git a/src/mod/formats/mod_ssml/mod_ssml.c b/src/mod/formats/mod_ssml/mod_ssml.c index cb29c5e79d..8b172721c7 100644 --- a/src/mod/formats/mod_ssml/mod_ssml.c +++ b/src/mod/formats/mod_ssml/mod_ssml.c @@ -692,11 +692,14 @@ static int get_file_from_macro(struct ssml_parser *parsed_data, char *to_say) static int get_file_from_voice(struct ssml_parser *parsed_data, char *to_say) { struct ssml_node *cur_node = parsed_data->cur_node; - char *file = switch_core_sprintf(parsed_data->pool, "%s%s", cur_node->tts_voice->prefix, to_say); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Adding <%s>: \"%s\"\n", cur_node->tag_name, file); - parsed_data->files[parsed_data->num_files].name = file; - parsed_data->files[parsed_data->num_files++].prefix = NULL; - return 1; + if (cur_node->tts_voice) { + char *file = switch_core_sprintf(parsed_data->pool, "%s%s", cur_node->tts_voice->prefix, to_say); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Adding <%s>: \"%s\"\n", cur_node->tag_name, file); + parsed_data->files[parsed_data->num_files].name = file; + parsed_data->files[parsed_data->num_files++].prefix = NULL; + return 1; + } + return 0; } /** @@ -708,7 +711,7 @@ static int process_cdata_tts(struct ssml_parser *parsed_data, char *data, size_t if (!len) { return IKS_OK; } - if (cur_node && cur_node->tts_voice && parsed_data->num_files < parsed_data->max_files) { + if (cur_node && parsed_data->num_files < parsed_data->max_files) { int i = 0; int empty = 1; char *to_say; @@ -728,7 +731,9 @@ static int process_cdata_tts(struct ssml_parser *parsed_data, char *data, size_t to_say[len] = '\0'; if (!cur_node->say_macro || !get_file_from_macro(parsed_data, to_say)) { /* use voice instead */ - get_file_from_voice(parsed_data, to_say); + if (!get_file_from_voice(parsed_data, to_say)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "No TTS voices available to render text!\n"); + } } free(to_say); return IKS_OK; diff --git a/src/mod/languages/mod_java/src/org/freeswitch/swig/API.java b/src/mod/languages/mod_java/src/org/freeswitch/swig/API.java index 283518f1d6..5fd3da9bb0 100644 --- a/src/mod/languages/mod_java/src/org/freeswitch/swig/API.java +++ b/src/mod/languages/mod_java/src/org/freeswitch/swig/API.java @@ -33,8 +33,8 @@ public class API { swigCPtr = 0; } - public API() { - this(freeswitchJNI.new_API(), true); + public API(CoreSession s) { + this(freeswitchJNI.new_API(CoreSession.getCPtr(s), s), true); } public String execute(String command, String data) { diff --git a/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitchJNI.java b/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitchJNI.java index 8069552b94..111f128863 100644 --- a/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitchJNI.java +++ b/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitchJNI.java @@ -19,7 +19,7 @@ class freeswitchJNI { public final static native void delete_IVRMenu(long jarg1); public final static native void IVRMenu_bindAction(long jarg1, IVRMenu jarg1_, String jarg2, String jarg3, String jarg4); public final static native void IVRMenu_execute(long jarg1, IVRMenu jarg1_, long jarg2, CoreSession jarg2_, String jarg3); - public final static native long new_API(); + public final static native long new_API(long jarg1, CoreSession jarg1_); public final static native void delete_API(long jarg1); public final static native String API_execute(long jarg1, API jarg1_, String jarg2, String jarg3); public final static native String API_executeString(long jarg1, API jarg1_, String jarg2); diff --git a/src/mod/languages/mod_java/switch_swig_wrap.cpp b/src/mod/languages/mod_java/switch_swig_wrap.cpp index eaf160ba9c..76de068715 100644 --- a/src/mod/languages/mod_java/switch_swig_wrap.cpp +++ b/src/mod/languages/mod_java/switch_swig_wrap.cpp @@ -521,13 +521,16 @@ SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_IVRMenu_1execute( } -SWIGEXPORT jlong JNICALL Java_org_freeswitch_swig_freeswitchJNI_new_1API(JNIEnv *jenv, jclass jcls) { +SWIGEXPORT jlong JNICALL Java_org_freeswitch_swig_freeswitchJNI_new_1API(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { jlong jresult = 0 ; + CoreSession *arg1 = (CoreSession *) NULL ; API *result = 0 ; (void)jenv; (void)jcls; - result = (API *)new API(); + (void)jarg1_; + arg1 = *(CoreSession **)&jarg1; + result = (API *)new API(arg1); *(API **)&jresult = result; return jresult; } diff --git a/src/mod/languages/mod_lua/mod_lua_wrap.cpp b/src/mod/languages/mod_lua/mod_lua_wrap.cpp index 130eab949a..591cef641a 100644 --- a/src/mod/languages/mod_lua/mod_lua_wrap.cpp +++ b/src/mod/languages/mod_lua/mod_lua_wrap.cpp @@ -1877,10 +1877,17 @@ static swig_lua_class _wrap_class_IVRMenu = { "IVRMenu", &SWIGTYPE_p_IVRMenu,_wr static int _wrap_new_API(lua_State* L) { int SWIG_arg = -1; + CoreSession *arg1 = (CoreSession *) NULL ; API *result = 0 ; - SWIG_check_num_args("API",0,0) - result = (API *)new API(); + SWIG_check_num_args("API",0,1) + if(lua_gettop(L)>=1 && !SWIG_isptrtype(L,1)) SWIG_fail_arg("API",1,"CoreSession *"); + if(lua_gettop(L)>=1){ + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("new_API",1,SWIGTYPE_p_CoreSession); + } + } + result = (API *)new API(arg1); SWIG_arg=0; SWIG_NewPointerObj(L,result,SWIGTYPE_p_API,1); SWIG_arg++; return SWIG_arg; diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.cxx index 756259d4d2..2c57e207a4 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.cxx @@ -2081,6 +2081,17 @@ SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_MAX_TRANS_get() { } +SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_CORE_SESSION_MAX_PRIVATES_get() { + int jresult ; + int result; + + result = (int) 2; + + jresult = result; + return jresult; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_dtmf_t_digit_set(void * jarg1, char jarg2) { switch_dtmf_t *arg1 = (switch_dtmf_t *) 0 ; char arg2 ; @@ -10217,27 +10228,31 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_receive_event(void * jarg1 } -SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_session_get_private(void * jarg1) { +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_session_get_private_class(void * jarg1, int jarg2) { void * jresult ; switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + switch_pvt_class_t arg2 ; void *result = 0 ; arg1 = (switch_core_session_t *)jarg1; - result = (void *)switch_core_session_get_private(arg1); + arg2 = (switch_pvt_class_t)jarg2; + result = (void *)switch_core_session_get_private_class(arg1,arg2); jresult = (void *)result; return jresult; } -SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_set_private(void * jarg1, void * jarg2) { +SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_set_private_class(void * jarg1, void * jarg2, int jarg3) { int jresult ; switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; void *arg2 = (void *) 0 ; + switch_pvt_class_t arg3 ; switch_status_t result; arg1 = (switch_core_session_t *)jarg1; arg2 = (void *)jarg2; - result = (switch_status_t)switch_core_session_set_private(arg1,arg2); + arg3 = (switch_pvt_class_t)jarg3; + result = (switch_status_t)switch_core_session_set_private_class(arg1,arg2,arg3); jresult = result; return jresult; } @@ -11486,14 +11501,14 @@ SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_db_test_reactive(void * jarg1, ch } -SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_perform_file_open(char * jarg1, char * jarg2, int jarg3, void * jarg4, char * jarg5, unsigned char jarg6, unsigned long jarg7, unsigned int jarg8, void * jarg9) { +SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_perform_file_open(char * jarg1, char * jarg2, int jarg3, void * jarg4, char * jarg5, unsigned long jarg6, unsigned long jarg7, unsigned int jarg8, void * jarg9) { int jresult ; char *arg1 = (char *) 0 ; char *arg2 = (char *) 0 ; int arg3 ; switch_file_handle_t *arg4 = (switch_file_handle_t *) 0 ; char *arg5 = (char *) 0 ; - uint8_t arg6 ; + uint32_t arg6 ; uint32_t arg7 ; unsigned int arg8 ; switch_memory_pool_t *arg9 = (switch_memory_pool_t *) 0 ; @@ -11504,7 +11519,7 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_perform_file_open(char * jarg1, ch arg3 = (int)jarg3; arg4 = (switch_file_handle_t *)jarg4; arg5 = (char *)jarg5; - arg6 = (uint8_t)jarg6; + arg6 = (uint32_t)jarg6; arg7 = (uint32_t)jarg7; arg8 = (unsigned int)jarg8; arg9 = (switch_memory_pool_t *)jarg9; @@ -14032,6 +14047,18 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_stream_system_fork(char * jarg1, void * } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_ice_direction(void * jarg1) { + int jresult ; + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + switch_call_direction_t result; + + arg1 = (switch_core_session_t *)jarg1; + result = (switch_call_direction_t)switch_ice_direction(arg1); + jresult = result; + return jresult; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_loadable_module_interface_module_name_set(void * jarg1, char * jarg2) { switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; char *arg2 = (char *) 0 ; @@ -14222,6 +14249,29 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_interface_api_interf } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_loadable_module_interface_json_api_interface_set(void * jarg1, void * jarg2) { + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + switch_json_api_interface_t *arg2 = (switch_json_api_interface_t *) 0 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + arg2 = (switch_json_api_interface_t *)jarg2; + if (arg1) (arg1)->json_api_interface = arg2; + +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_interface_json_api_interface_get(void * jarg1) { + void * jresult ; + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + switch_json_api_interface_t *result = 0 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + result = (switch_json_api_interface_t *) ((arg1)->json_api_interface); + jresult = (void *)result; + return jresult; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_loadable_module_interface_file_interface_set(void * jarg1, void * jarg2) { switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; switch_file_interface_t *arg2 = (switch_file_interface_t *) 0 ; @@ -14679,6 +14729,18 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_get_api_interface(ch } +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_get_json_api_interface(char * jarg1) { + void * jresult ; + char *arg1 = (char *) 0 ; + switch_json_api_interface_t *result = 0 ; + + arg1 = (char *)jarg1; + result = (switch_json_api_interface_t *)switch_loadable_module_get_json_api_interface((char const *)arg1); + jresult = (void *)result; + return jresult; +} + + SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_get_file_interface(char * jarg1) { void * jresult ; char *arg1 = (char *) 0 ; @@ -14825,6 +14887,22 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_api_execute(char * jarg1, char * jarg2, } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_json_api_execute(void * jarg1, void * jarg2, void * jarg3) { + int jresult ; + cJSON *arg1 = (cJSON *) 0 ; + switch_core_session_t *arg2 = (switch_core_session_t *) 0 ; + cJSON **arg3 = (cJSON **) 0 ; + switch_status_t result; + + arg1 = (cJSON *)jarg1; + arg2 = (switch_core_session_t *)jarg2; + arg3 = (cJSON **)jarg3; + result = (switch_status_t)switch_json_api_execute(arg1,arg2,arg3); + jresult = result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_switch_loadable_module_load_module(char * jarg1, char * jarg2, int jarg3, void * jarg4) { int jresult ; char *arg1 = (char *) 0 ; @@ -14953,6 +15031,40 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_codec_ready(void * jarg1) { } +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_get_secondary_recover_callback(char * jarg1) { + void * jresult ; + char *arg1 = (char *) 0 ; + switch_core_recover_callback_t result; + + arg1 = (char *)jarg1; + result = (switch_core_recover_callback_t)switch_core_get_secondary_recover_callback((char const *)arg1); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_register_secondary_recover_callback(char * jarg1, void * jarg2) { + int jresult ; + char *arg1 = (char *) 0 ; + switch_core_recover_callback_t arg2 = (switch_core_recover_callback_t) 0 ; + switch_status_t result; + + arg1 = (char *)jarg1; + arg2 = (switch_core_recover_callback_t)jarg2; + result = (switch_status_t)switch_core_register_secondary_recover_callback((char const *)arg1,arg2); + jresult = result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_unregister_secondary_recover_callback(char * jarg1) { + char *arg1 = (char *) 0 ; + + arg1 = (char *)jarg1; + switch_core_unregister_secondary_recover_callback((char const *)arg1); +} + + SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_CMD_CHUNK_LEN_get() { int jresult ; int result; @@ -21457,25 +21569,25 @@ SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_file_handle_native_rate_get(v } -SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_channels_set(void * jarg1, unsigned char jarg2) { +SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_channels_set(void * jarg1, unsigned long jarg2) { switch_file_handle *arg1 = (switch_file_handle *) 0 ; - uint8_t arg2 ; + uint32_t arg2 ; arg1 = (switch_file_handle *)jarg1; - arg2 = (uint8_t)jarg2; + arg2 = (uint32_t)jarg2; if (arg1) (arg1)->channels = arg2; } -SWIGEXPORT unsigned char SWIGSTDCALL CSharp_switch_file_handle_channels_get(void * jarg1) { - unsigned char jresult ; +SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_file_handle_channels_get(void * jarg1) { + unsigned long jresult ; switch_file_handle *arg1 = (switch_file_handle *) 0 ; - uint8_t result; + uint32_t result; arg1 = (switch_file_handle *)jarg1; - result = (uint8_t) ((arg1)->channels); - jresult = result; + result = (uint32_t) ((arg1)->channels); + jresult = (unsigned long)result; return jresult; } @@ -22331,6 +22443,52 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_switch_file_handle_params_get(void * jarg1) } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_cur_channels_set(void * jarg1, unsigned long jarg2) { + switch_file_handle *arg1 = (switch_file_handle *) 0 ; + uint32_t arg2 ; + + arg1 = (switch_file_handle *)jarg1; + arg2 = (uint32_t)jarg2; + if (arg1) (arg1)->cur_channels = arg2; + +} + + +SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_file_handle_cur_channels_get(void * jarg1) { + unsigned long jresult ; + switch_file_handle *arg1 = (switch_file_handle *) 0 ; + uint32_t result; + + arg1 = (switch_file_handle *)jarg1; + result = (uint32_t) ((arg1)->cur_channels); + jresult = (unsigned long)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_cur_samplerate_set(void * jarg1, unsigned long jarg2) { + switch_file_handle *arg1 = (switch_file_handle *) 0 ; + uint32_t arg2 ; + + arg1 = (switch_file_handle *)jarg1; + arg2 = (uint32_t)jarg2; + if (arg1) (arg1)->cur_samplerate = arg2; + +} + + +SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_file_handle_cur_samplerate_get(void * jarg1) { + unsigned long jresult ; + switch_file_handle *arg1 = (switch_file_handle *) 0 ; + uint32_t result; + + arg1 = (switch_file_handle *)jarg1; + result = (uint32_t) ((arg1)->cur_samplerate); + jresult = (unsigned long)result; + return jresult; +} + + SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_file_handle() { void * jresult ; switch_file_handle *result = 0 ; @@ -27405,6 +27563,250 @@ SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_api_interface(void * jarg1) { } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_json_api_interface_interface_name_set(void * jarg1, char * jarg2) { + switch_json_api_interface *arg1 = (switch_json_api_interface *) 0 ; + char *arg2 = (char *) 0 ; + + arg1 = (switch_json_api_interface *)jarg1; + arg2 = (char *)jarg2; + { + if (arg2) { + arg1->interface_name = (char const *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->interface_name, (const char *)arg2); + } else { + arg1->interface_name = 0; + } + } +} + + +SWIGEXPORT char * SWIGSTDCALL CSharp_switch_json_api_interface_interface_name_get(void * jarg1) { + char * jresult ; + switch_json_api_interface *arg1 = (switch_json_api_interface *) 0 ; + char *result = 0 ; + + arg1 = (switch_json_api_interface *)jarg1; + result = (char *) ((arg1)->interface_name); + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_json_api_interface_desc_set(void * jarg1, char * jarg2) { + switch_json_api_interface *arg1 = (switch_json_api_interface *) 0 ; + char *arg2 = (char *) 0 ; + + arg1 = (switch_json_api_interface *)jarg1; + arg2 = (char *)jarg2; + { + if (arg2) { + arg1->desc = (char const *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->desc, (const char *)arg2); + } else { + arg1->desc = 0; + } + } +} + + +SWIGEXPORT char * SWIGSTDCALL CSharp_switch_json_api_interface_desc_get(void * jarg1) { + char * jresult ; + switch_json_api_interface *arg1 = (switch_json_api_interface *) 0 ; + char *result = 0 ; + + arg1 = (switch_json_api_interface *)jarg1; + result = (char *) ((arg1)->desc); + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_json_api_interface_function_set(void * jarg1, void * jarg2) { + switch_json_api_interface *arg1 = (switch_json_api_interface *) 0 ; + switch_json_api_function_t arg2 = (switch_json_api_function_t) 0 ; + + arg1 = (switch_json_api_interface *)jarg1; + arg2 = (switch_json_api_function_t)jarg2; + if (arg1) (arg1)->function = arg2; + +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_json_api_interface_function_get(void * jarg1) { + void * jresult ; + switch_json_api_interface *arg1 = (switch_json_api_interface *) 0 ; + switch_json_api_function_t result; + + arg1 = (switch_json_api_interface *)jarg1; + result = (switch_json_api_function_t) ((arg1)->function); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_json_api_interface_syntax_set(void * jarg1, char * jarg2) { + switch_json_api_interface *arg1 = (switch_json_api_interface *) 0 ; + char *arg2 = (char *) 0 ; + + arg1 = (switch_json_api_interface *)jarg1; + arg2 = (char *)jarg2; + { + if (arg2) { + arg1->syntax = (char const *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->syntax, (const char *)arg2); + } else { + arg1->syntax = 0; + } + } +} + + +SWIGEXPORT char * SWIGSTDCALL CSharp_switch_json_api_interface_syntax_get(void * jarg1) { + char * jresult ; + switch_json_api_interface *arg1 = (switch_json_api_interface *) 0 ; + char *result = 0 ; + + arg1 = (switch_json_api_interface *)jarg1; + result = (char *) ((arg1)->syntax); + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_json_api_interface_rwlock_set(void * jarg1, void * jarg2) { + switch_json_api_interface *arg1 = (switch_json_api_interface *) 0 ; + switch_thread_rwlock_t *arg2 = (switch_thread_rwlock_t *) 0 ; + + arg1 = (switch_json_api_interface *)jarg1; + arg2 = (switch_thread_rwlock_t *)jarg2; + if (arg1) (arg1)->rwlock = arg2; + +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_json_api_interface_rwlock_get(void * jarg1) { + void * jresult ; + switch_json_api_interface *arg1 = (switch_json_api_interface *) 0 ; + switch_thread_rwlock_t *result = 0 ; + + arg1 = (switch_json_api_interface *)jarg1; + result = (switch_thread_rwlock_t *) ((arg1)->rwlock); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_json_api_interface_refs_set(void * jarg1, int jarg2) { + switch_json_api_interface *arg1 = (switch_json_api_interface *) 0 ; + int arg2 ; + + arg1 = (switch_json_api_interface *)jarg1; + arg2 = (int)jarg2; + if (arg1) (arg1)->refs = arg2; + +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_json_api_interface_refs_get(void * jarg1) { + int jresult ; + switch_json_api_interface *arg1 = (switch_json_api_interface *) 0 ; + int result; + + arg1 = (switch_json_api_interface *)jarg1; + result = (int) ((arg1)->refs); + jresult = result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_json_api_interface_reflock_set(void * jarg1, void * jarg2) { + switch_json_api_interface *arg1 = (switch_json_api_interface *) 0 ; + switch_mutex_t *arg2 = (switch_mutex_t *) 0 ; + + arg1 = (switch_json_api_interface *)jarg1; + arg2 = (switch_mutex_t *)jarg2; + if (arg1) (arg1)->reflock = arg2; + +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_json_api_interface_reflock_get(void * jarg1) { + void * jresult ; + switch_json_api_interface *arg1 = (switch_json_api_interface *) 0 ; + switch_mutex_t *result = 0 ; + + arg1 = (switch_json_api_interface *)jarg1; + result = (switch_mutex_t *) ((arg1)->reflock); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_json_api_interface_parent_set(void * jarg1, void * jarg2) { + switch_json_api_interface *arg1 = (switch_json_api_interface *) 0 ; + switch_loadable_module_interface_t *arg2 = (switch_loadable_module_interface_t *) 0 ; + + arg1 = (switch_json_api_interface *)jarg1; + arg2 = (switch_loadable_module_interface_t *)jarg2; + if (arg1) (arg1)->parent = arg2; + +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_json_api_interface_parent_get(void * jarg1) { + void * jresult ; + switch_json_api_interface *arg1 = (switch_json_api_interface *) 0 ; + switch_loadable_module_interface_t *result = 0 ; + + arg1 = (switch_json_api_interface *)jarg1; + result = (switch_loadable_module_interface_t *) ((arg1)->parent); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_json_api_interface_next_set(void * jarg1, void * jarg2) { + switch_json_api_interface *arg1 = (switch_json_api_interface *) 0 ; + switch_json_api_interface *arg2 = (switch_json_api_interface *) 0 ; + + arg1 = (switch_json_api_interface *)jarg1; + arg2 = (switch_json_api_interface *)jarg2; + if (arg1) (arg1)->next = arg2; + +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_json_api_interface_next_get(void * jarg1) { + void * jresult ; + switch_json_api_interface *arg1 = (switch_json_api_interface *) 0 ; + switch_json_api_interface *result = 0 ; + + arg1 = (switch_json_api_interface *)jarg1; + result = (switch_json_api_interface *) ((arg1)->next); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_json_api_interface() { + void * jresult ; + switch_json_api_interface *result = 0 ; + + result = (switch_json_api_interface *)new switch_json_api_interface(); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_json_api_interface(void * jarg1) { + switch_json_api_interface *arg1 = (switch_json_api_interface *) 0 ; + + arg1 = (switch_json_api_interface *)jarg1; + delete arg1; + +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_slin_data_session_set(void * jarg1, void * jarg2) { switch_slin_data *arg1 = (switch_slin_data *) 0 ; switch_core_session_t *arg2 = (switch_core_session_t *) 0 ; @@ -29422,6 +29824,16 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_direction(void * jarg1) { } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_set_direction(void * jarg1, int jarg2) { + switch_channel_t *arg1 = (switch_channel_t *) 0 ; + switch_call_direction_t arg2 ; + + arg1 = (switch_channel_t *)jarg1; + arg2 = (switch_call_direction_t)jarg2; + switch_channel_set_direction(arg1,arg2); +} + + SWIGEXPORT void * SWIGSTDCALL CSharp_switch_channel_get_session(void * jarg1) { void * jresult ; switch_channel_t *arg1 = (switch_channel_t *) 0 ; @@ -31255,6 +31667,20 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_serialize_json(void * jarg1, void } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_serialize_json_obj(void * jarg1, void * jarg2) { + int jresult ; + switch_event_t *arg1 = (switch_event_t *) 0 ; + cJSON **arg2 = (cJSON **) 0 ; + switch_status_t result; + + arg1 = (switch_event_t *)jarg1; + arg2 = (cJSON **)jarg2; + result = (switch_status_t)switch_event_serialize_json_obj(arg1,arg2); + jresult = result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_create_json(void * jarg1, char * jarg2) { int jresult ; switch_event_t **arg1 = (switch_event_t **) 0 ; @@ -31459,6 +31885,18 @@ SWIGEXPORT void SWIGSTDCALL CSharp_switch_event_add_presence_data_cols(void * ja } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_json_add_presence_data_cols(void * jarg1, void * jarg2, char * jarg3) { + switch_event_t *arg1 = (switch_event_t *) 0 ; + cJSON *arg2 = (cJSON *) 0 ; + char *arg3 = (char *) 0 ; + + arg1 = (switch_event_t *)jarg1; + arg2 = (cJSON *)jarg2; + arg3 = (char *)jarg3; + switch_json_add_presence_data_cols(arg1,arg2,(char const *)arg3); +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_event_launch_dispatch_threads(unsigned long jarg1) { uint32_t arg1 ; @@ -31467,6 +31905,270 @@ SWIGEXPORT void SWIGSTDCALL CSharp_switch_event_launch_dispatch_threads(unsigned } +SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_event_channel_broadcast(char * jarg1, void * jarg2, char * jarg3, unsigned long jarg4) { + unsigned long jresult ; + char *arg1 = (char *) 0 ; + cJSON **arg2 = (cJSON **) 0 ; + char *arg3 = (char *) 0 ; + switch_event_channel_id_t arg4 ; + uint32_t result; + + arg1 = (char *)jarg1; + arg2 = (cJSON **)jarg2; + arg3 = (char *)jarg3; + arg4 = (switch_event_channel_id_t)jarg4; + result = (uint32_t)switch_event_channel_broadcast((char const *)arg1,arg2,(char const *)arg3,arg4); + jresult = (unsigned long)result; + return jresult; +} + + +SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_event_channel_unbind(char * jarg1, void * jarg2) { + unsigned long jresult ; + char *arg1 = (char *) 0 ; + switch_event_channel_func_t arg2 = (switch_event_channel_func_t) 0 ; + uint32_t result; + + arg1 = (char *)jarg1; + arg2 = (switch_event_channel_func_t)jarg2; + result = (uint32_t)switch_event_channel_unbind((char const *)arg1,arg2); + jresult = (unsigned long)result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_channel_bind(char * jarg1, void * jarg2, void * jarg3) { + int jresult ; + char *arg1 = (char *) 0 ; + switch_event_channel_func_t arg2 = (switch_event_channel_func_t) 0 ; + switch_event_channel_id_t *arg3 = (switch_event_channel_id_t *) 0 ; + switch_status_t result; + + arg1 = (char *)jarg1; + arg2 = (switch_event_channel_func_t)jarg2; + arg3 = (switch_event_channel_id_t *)jarg3; + result = (switch_status_t)switch_event_channel_bind((char const *)arg1,arg2,arg3); + jresult = result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_NO_EVENT_CHANNEL_ID_get() { + int jresult ; + int result; + + result = (int) 0; + + jresult = result; + return jresult; +} + + +SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_EVENT_CHANNEL_GLOBAL_get() { + char * jresult ; + char *result = 0 ; + + result = (char *) "__global__"; + + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_live_array_clear(void * jarg1) { + int jresult ; + switch_live_array_t *arg1 = (switch_live_array_t *) 0 ; + switch_status_t result; + + arg1 = (switch_live_array_t *)jarg1; + result = (switch_status_t)switch_live_array_clear(arg1); + jresult = result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_live_array_bootstrap(void * jarg1, char * jarg2, unsigned long jarg3) { + int jresult ; + switch_live_array_t *arg1 = (switch_live_array_t *) 0 ; + char *arg2 = (char *) 0 ; + switch_event_channel_id_t arg3 ; + switch_status_t result; + + arg1 = (switch_live_array_t *)jarg1; + arg2 = (char *)jarg2; + arg3 = (switch_event_channel_id_t)jarg3; + result = (switch_status_t)switch_live_array_bootstrap(arg1,(char const *)arg2,arg3); + jresult = result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_live_array_destroy(void * jarg1) { + int jresult ; + switch_live_array_t **arg1 = (switch_live_array_t **) 0 ; + switch_status_t result; + + arg1 = (switch_live_array_t **)jarg1; + result = (switch_status_t)switch_live_array_destroy(arg1); + jresult = result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_live_array_create(char * jarg1, char * jarg2, unsigned long jarg3, void * jarg4) { + int jresult ; + char *arg1 = (char *) 0 ; + char *arg2 = (char *) 0 ; + switch_event_channel_id_t arg3 ; + switch_live_array_t **arg4 = (switch_live_array_t **) 0 ; + switch_status_t result; + + arg1 = (char *)jarg1; + arg2 = (char *)jarg2; + arg3 = (switch_event_channel_id_t)jarg3; + arg4 = (switch_live_array_t **)jarg4; + result = (switch_status_t)switch_live_array_create((char const *)arg1,(char const *)arg2,arg3,arg4); + jresult = result; + return jresult; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_live_array_get(void * jarg1, char * jarg2) { + void * jresult ; + switch_live_array_t *arg1 = (switch_live_array_t *) 0 ; + char *arg2 = (char *) 0 ; + cJSON *result = 0 ; + + arg1 = (switch_live_array_t *)jarg1; + arg2 = (char *)jarg2; + result = (cJSON *)switch_live_array_get(arg1,(char const *)arg2); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_live_array_get_idx(void * jarg1, int jarg2) { + void * jresult ; + switch_live_array_t *arg1 = (switch_live_array_t *) 0 ; + int arg2 ; + cJSON *result = 0 ; + + arg1 = (switch_live_array_t *)jarg1; + arg2 = (int)jarg2; + result = (cJSON *)switch_live_array_get_idx(arg1,arg2); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_live_array_del(void * jarg1, char * jarg2) { + int jresult ; + switch_live_array_t *arg1 = (switch_live_array_t *) 0 ; + char *arg2 = (char *) 0 ; + switch_status_t result; + + arg1 = (switch_live_array_t *)jarg1; + arg2 = (char *)jarg2; + result = (switch_status_t)switch_live_array_del(arg1,(char const *)arg2); + jresult = result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_live_array_add(void * jarg1, char * jarg2, int jarg3, void * jarg4, int jarg5) { + int jresult ; + switch_live_array_t *arg1 = (switch_live_array_t *) 0 ; + char *arg2 = (char *) 0 ; + int arg3 ; + cJSON **arg4 = (cJSON **) 0 ; + switch_bool_t arg5 ; + switch_status_t result; + + arg1 = (switch_live_array_t *)jarg1; + arg2 = (char *)jarg2; + arg3 = (int)jarg3; + arg4 = (cJSON **)jarg4; + arg5 = (switch_bool_t)jarg5; + result = (switch_status_t)switch_live_array_add(arg1,(char const *)arg2,arg3,arg4,arg5); + jresult = result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_live_array_visible(void * jarg1, int jarg2, int jarg3) { + int jresult ; + switch_live_array_t *arg1 = (switch_live_array_t *) 0 ; + switch_bool_t arg2 ; + switch_bool_t arg3 ; + switch_status_t result; + + arg1 = (switch_live_array_t *)jarg1; + arg2 = (switch_bool_t)jarg2; + arg3 = (switch_bool_t)jarg3; + result = (switch_status_t)switch_live_array_visible(arg1,arg2,arg3); + jresult = result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_live_array_isnew(void * jarg1) { + int jresult ; + switch_live_array_t *arg1 = (switch_live_array_t *) 0 ; + switch_bool_t result; + + arg1 = (switch_live_array_t *)jarg1; + result = (switch_bool_t)switch_live_array_isnew(arg1); + jresult = result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_live_array_lock(void * jarg1) { + switch_live_array_t *arg1 = (switch_live_array_t *) 0 ; + + arg1 = (switch_live_array_t *)jarg1; + switch_live_array_lock(arg1); +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_live_array_unlock(void * jarg1) { + switch_live_array_t *arg1 = (switch_live_array_t *) 0 ; + + arg1 = (switch_live_array_t *)jarg1; + switch_live_array_unlock(arg1); +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_live_array_set_user_data(void * jarg1, void * jarg2) { + switch_live_array_t *arg1 = (switch_live_array_t *) 0 ; + void *arg2 = (void *) 0 ; + + arg1 = (switch_live_array_t *)jarg1; + arg2 = (void *)jarg2; + switch_live_array_set_user_data(arg1,arg2); +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_live_array_set_command_handler(void * jarg1, void * jarg2) { + switch_live_array_t *arg1 = (switch_live_array_t *) 0 ; + switch_live_array_command_handler_t arg2 = (switch_live_array_command_handler_t) 0 ; + + arg1 = (switch_live_array_t *)jarg1; + arg2 = (switch_live_array_command_handler_t)jarg2; + switch_live_array_set_command_handler(arg1,arg2); +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_live_array_parse_json(void * jarg1, unsigned long jarg2) { + cJSON *arg1 = (cJSON *) 0 ; + switch_event_channel_id_t arg2 ; + + arg1 = (cJSON *)jarg1; + arg2 = (switch_event_channel_id_t)jarg2; + switch_live_array_parse_json(arg1,arg2); +} + + SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_RESAMPLE_QUALITY_get() { int jresult ; int result; @@ -36317,6 +37019,20 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_add_dtls(void * jarg1, void * jarg2 } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_del_dtls(void * jarg1, int jarg2) { + int jresult ; + switch_rtp_t *arg1 = (switch_rtp_t *) 0 ; + dtls_type_t arg2 ; + switch_status_t result; + + arg1 = (switch_rtp_t *)jarg1; + arg2 = (dtls_type_t)jarg2; + result = (switch_status_t)switch_rtp_del_dtls(arg1,arg2); + jresult = result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_has_dtls() { int jresult ; int result; diff --git a/src/mod/languages/mod_managed/managed/swig.cs b/src/mod/languages/mod_managed/managed/swig.cs index f260022a00..50ac5a3245 100644 --- a/src/mod/languages/mod_managed/managed/swig.cs +++ b/src/mod/languages/mod_managed/managed/swig.cs @@ -1901,14 +1901,14 @@ public class freeswitch { return ret; } - public static SWIGTYPE_p_void switch_core_session_get_private(SWIGTYPE_p_switch_core_session session) { - IntPtr cPtr = freeswitchPINVOKE.switch_core_session_get_private(SWIGTYPE_p_switch_core_session.getCPtr(session)); + public static SWIGTYPE_p_void switch_core_session_get_private_class(SWIGTYPE_p_switch_core_session session, switch_pvt_class_t index) { + IntPtr cPtr = freeswitchPINVOKE.switch_core_session_get_private_class(SWIGTYPE_p_switch_core_session.getCPtr(session), (int)index); SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false); return ret; } - public static switch_status_t switch_core_session_set_private(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_void private_info) { - switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_set_private(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_void.getCPtr(private_info)); + public static switch_status_t switch_core_session_set_private_class(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_void private_info, switch_pvt_class_t index) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_set_private_class(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_void.getCPtr(private_info), (int)index); return ret; } @@ -2348,7 +2348,7 @@ public class freeswitch { freeswitchPINVOKE.switch_core_db_test_reactive(SWIGTYPE_p_sqlite3.getCPtr(db), test_sql, drop_sql, reactive_sql); } - public static switch_status_t switch_core_perform_file_open(string file, string func, int line, switch_file_handle fh, string file_path, byte channels, uint rate, uint flags, SWIGTYPE_p_apr_pool_t pool) { + public static switch_status_t switch_core_perform_file_open(string file, string func, int line, switch_file_handle fh, string file_path, uint channels, uint rate, uint flags, SWIGTYPE_p_apr_pool_t pool) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_perform_file_open(file, func, line, switch_file_handle.getCPtr(fh), file_path, channels, rate, flags, SWIGTYPE_p_apr_pool_t.getCPtr(pool)); return ret; } @@ -3141,6 +3141,11 @@ public class freeswitch { return ret; } + public static switch_call_direction_t switch_ice_direction(SWIGTYPE_p_switch_core_session session) { + switch_call_direction_t ret = (switch_call_direction_t)freeswitchPINVOKE.switch_ice_direction(SWIGTYPE_p_switch_core_session.getCPtr(session)); + return ret; + } + public static switch_status_t switch_loadable_module_init(switch_bool_t autoload) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_loadable_module_init((int)autoload); return ret; @@ -3217,6 +3222,12 @@ public class freeswitch { return ret; } + public static switch_json_api_interface switch_loadable_module_get_json_api_interface(string name) { + IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_get_json_api_interface(name); + switch_json_api_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_json_api_interface(cPtr, false); + return ret; + } + public static switch_file_interface switch_loadable_module_get_file_interface(string name) { IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_get_file_interface(name); switch_file_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_file_interface(cPtr, false); @@ -3280,6 +3291,11 @@ public class freeswitch { return ret; } + public static switch_status_t switch_json_api_execute(SWIGTYPE_p_cJSON json, SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_p_cJSON retval) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_json_api_execute(SWIGTYPE_p_cJSON.getCPtr(json), SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_p_cJSON.getCPtr(retval)); + return ret; + } + public static switch_status_t switch_loadable_module_load_module(string dir, string fname, switch_bool_t runtime, ref string err) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_loadable_module_load_module(dir, fname, (int)runtime, ref err); return ret; @@ -3314,6 +3330,21 @@ public class freeswitch { return ret; } + public static SWIGTYPE_p_f_p_switch_core_session__int switch_core_get_secondary_recover_callback(string key) { + IntPtr cPtr = freeswitchPINVOKE.switch_core_get_secondary_recover_callback(key); + SWIGTYPE_p_f_p_switch_core_session__int ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session__int(cPtr, false); + return ret; + } + + public static switch_status_t switch_core_register_secondary_recover_callback(string key, SWIGTYPE_p_f_p_switch_core_session__int cb) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_register_secondary_recover_callback(key, SWIGTYPE_p_f_p_switch_core_session__int.getCPtr(cb)); + return ret; + } + + public static void switch_core_unregister_secondary_recover_callback(string key) { + freeswitchPINVOKE.switch_core_unregister_secondary_recover_callback(key); + } + public static void switch_console_loop() { freeswitchPINVOKE.switch_console_loop(); } @@ -4550,6 +4581,10 @@ public class freeswitch { return ret; } + public static void switch_channel_set_direction(SWIGTYPE_p_switch_channel channel, switch_call_direction_t direction) { + freeswitchPINVOKE.switch_channel_set_direction(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)direction); + } + public static SWIGTYPE_p_switch_core_session switch_channel_get_session(SWIGTYPE_p_switch_channel channel) { IntPtr cPtr = freeswitchPINVOKE.switch_channel_get_session(SWIGTYPE_p_switch_channel.getCPtr(channel)); SWIGTYPE_p_switch_core_session ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_core_session(cPtr, false); @@ -4915,8 +4950,8 @@ public class freeswitch { return ret; } - public static switch_status_t switch_event_binary_deserialize(SWIGTYPE_p_p_switch_event eventp, SWIGTYPE_p_p_void data, SWIGTYPE_p_switch_size_t len, switch_bool_t destroy) { - switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_event_binary_deserialize(SWIGTYPE_p_p_switch_event.getCPtr(eventp), SWIGTYPE_p_p_void.getCPtr(data), SWIGTYPE_p_switch_size_t.getCPtr(len), (int)destroy); + public static switch_status_t switch_event_binary_deserialize(SWIGTYPE_p_p_switch_event eventp, SWIGTYPE_p_p_void data, SWIGTYPE_p_switch_size_t len, switch_bool_t duplicate) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_event_binary_deserialize(SWIGTYPE_p_p_switch_event.getCPtr(eventp), SWIGTYPE_p_p_void.getCPtr(data), SWIGTYPE_p_switch_size_t.getCPtr(len), (int)duplicate); if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve(); return ret; } @@ -4936,6 +4971,11 @@ public class freeswitch { return ret; } + public static switch_status_t switch_event_serialize_json_obj(switch_event arg0, SWIGTYPE_p_p_cJSON json) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_event_serialize_json_obj(switch_event.getCPtr(arg0), SWIGTYPE_p_p_cJSON.getCPtr(json)); + return ret; + } + public static switch_status_t switch_event_create_json(SWIGTYPE_p_p_switch_event arg0, string json) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_event_create_json(SWIGTYPE_p_p_switch_event.getCPtr(arg0), json); return ret; @@ -4994,10 +5034,101 @@ public class freeswitch { freeswitchPINVOKE.switch_event_add_presence_data_cols(SWIGTYPE_p_switch_channel.getCPtr(channel), switch_event.getCPtr(arg1), prefix); } + public static void switch_json_add_presence_data_cols(switch_event arg0, SWIGTYPE_p_cJSON json, string prefix) { + freeswitchPINVOKE.switch_json_add_presence_data_cols(switch_event.getCPtr(arg0), SWIGTYPE_p_cJSON.getCPtr(json), prefix); + } + public static void switch_event_launch_dispatch_threads(uint max) { freeswitchPINVOKE.switch_event_launch_dispatch_threads(max); } + public static uint switch_event_channel_broadcast(string event_channel, SWIGTYPE_p_p_cJSON json, string key, uint id) { + uint ret = freeswitchPINVOKE.switch_event_channel_broadcast(event_channel, SWIGTYPE_p_p_cJSON.getCPtr(json), key, id); + return ret; + } + + public static uint switch_event_channel_unbind(string event_channel, SWIGTYPE_p_f_p_q_const__char_p_cJSON_p_q_const__char_unsigned_long__void func) { + uint ret = freeswitchPINVOKE.switch_event_channel_unbind(event_channel, SWIGTYPE_p_f_p_q_const__char_p_cJSON_p_q_const__char_unsigned_long__void.getCPtr(func)); + return ret; + } + + public static switch_status_t switch_event_channel_bind(string event_channel, SWIGTYPE_p_f_p_q_const__char_p_cJSON_p_q_const__char_unsigned_long__void func, SWIGTYPE_p_unsigned_long id) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_event_channel_bind(event_channel, SWIGTYPE_p_f_p_q_const__char_p_cJSON_p_q_const__char_unsigned_long__void.getCPtr(func), SWIGTYPE_p_unsigned_long.getCPtr(id)); + return ret; + } + + public static switch_status_t switch_live_array_clear(SWIGTYPE_p_switch_live_array_s la) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_live_array_clear(SWIGTYPE_p_switch_live_array_s.getCPtr(la)); + return ret; + } + + public static switch_status_t switch_live_array_bootstrap(SWIGTYPE_p_switch_live_array_s la, string sessid, uint channel_id) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_live_array_bootstrap(SWIGTYPE_p_switch_live_array_s.getCPtr(la), sessid, channel_id); + return ret; + } + + public static switch_status_t switch_live_array_destroy(SWIGTYPE_p_p_switch_live_array_s live_arrayP) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_live_array_destroy(SWIGTYPE_p_p_switch_live_array_s.getCPtr(live_arrayP)); + return ret; + } + + public static switch_status_t switch_live_array_create(string event_channel, string name, uint channel_id, SWIGTYPE_p_p_switch_live_array_s live_arrayP) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_live_array_create(event_channel, name, channel_id, SWIGTYPE_p_p_switch_live_array_s.getCPtr(live_arrayP)); + return ret; + } + + public static SWIGTYPE_p_cJSON switch_live_array_get(SWIGTYPE_p_switch_live_array_s la, string name) { + IntPtr cPtr = freeswitchPINVOKE.switch_live_array_get(SWIGTYPE_p_switch_live_array_s.getCPtr(la), name); + SWIGTYPE_p_cJSON ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_cJSON(cPtr, false); + return ret; + } + + public static SWIGTYPE_p_cJSON switch_live_array_get_idx(SWIGTYPE_p_switch_live_array_s la, int idx) { + IntPtr cPtr = freeswitchPINVOKE.switch_live_array_get_idx(SWIGTYPE_p_switch_live_array_s.getCPtr(la), idx); + SWIGTYPE_p_cJSON ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_cJSON(cPtr, false); + return ret; + } + + public static switch_status_t switch_live_array_del(SWIGTYPE_p_switch_live_array_s la, string name) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_live_array_del(SWIGTYPE_p_switch_live_array_s.getCPtr(la), name); + return ret; + } + + public static switch_status_t switch_live_array_add(SWIGTYPE_p_switch_live_array_s la, string name, int index, SWIGTYPE_p_p_cJSON obj, switch_bool_t destroy) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_live_array_add(SWIGTYPE_p_switch_live_array_s.getCPtr(la), name, index, SWIGTYPE_p_p_cJSON.getCPtr(obj), (int)destroy); + return ret; + } + + public static switch_status_t switch_live_array_visible(SWIGTYPE_p_switch_live_array_s la, switch_bool_t visible, switch_bool_t force) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_live_array_visible(SWIGTYPE_p_switch_live_array_s.getCPtr(la), (int)visible, (int)force); + return ret; + } + + public static switch_bool_t switch_live_array_isnew(SWIGTYPE_p_switch_live_array_s la) { + switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_live_array_isnew(SWIGTYPE_p_switch_live_array_s.getCPtr(la)); + return ret; + } + + public static void switch_live_array_lock(SWIGTYPE_p_switch_live_array_s la) { + freeswitchPINVOKE.switch_live_array_lock(SWIGTYPE_p_switch_live_array_s.getCPtr(la)); + } + + public static void switch_live_array_unlock(SWIGTYPE_p_switch_live_array_s la) { + freeswitchPINVOKE.switch_live_array_unlock(SWIGTYPE_p_switch_live_array_s.getCPtr(la)); + } + + public static void switch_live_array_set_user_data(SWIGTYPE_p_switch_live_array_s la, SWIGTYPE_p_void user_data) { + freeswitchPINVOKE.switch_live_array_set_user_data(SWIGTYPE_p_switch_live_array_s.getCPtr(la), SWIGTYPE_p_void.getCPtr(user_data)); + } + + public static void switch_live_array_set_command_handler(SWIGTYPE_p_switch_live_array_s la, SWIGTYPE_p_f_p_switch_live_array_s_p_q_const__char_p_q_const__char_p_cJSON_p_void__void command_handler) { + freeswitchPINVOKE.switch_live_array_set_command_handler(SWIGTYPE_p_switch_live_array_s.getCPtr(la), SWIGTYPE_p_f_p_switch_live_array_s_p_q_const__char_p_q_const__char_p_cJSON_p_void__void.getCPtr(command_handler)); + } + + public static void switch_live_array_parse_json(SWIGTYPE_p_cJSON json, uint channel_id) { + freeswitchPINVOKE.switch_live_array_parse_json(SWIGTYPE_p_cJSON.getCPtr(json), channel_id); + } + public static switch_status_t switch_resample_perform_create(SWIGTYPE_p_p_switch_audio_resampler_t new_resampler, uint from_rate, uint to_rate, uint to_size, int quality, uint channels, string file, string func, int line) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_resample_perform_create(SWIGTYPE_p_p_switch_audio_resampler_t.getCPtr(new_resampler), from_rate, to_rate, to_size, quality, channels, file, func, line); return ret; @@ -6104,6 +6235,11 @@ public class freeswitch { return ret; } + public static switch_status_t switch_rtp_del_dtls(SWIGTYPE_p_switch_rtp rtp_session, dtls_type_t type) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_del_dtls(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), (int)type); + return ret; + } + public static int switch_rtp_has_dtls() { int ret = freeswitchPINVOKE.switch_rtp_has_dtls(); return ret; @@ -6818,6 +6954,7 @@ public class freeswitch { public static readonly int SWITCH_DEFAULT_FILE_BUFFER_LEN = freeswitchPINVOKE.SWITCH_DEFAULT_FILE_BUFFER_LEN_get(); public static readonly int SWITCH_DTMF_LOG_LEN = freeswitchPINVOKE.SWITCH_DTMF_LOG_LEN_get(); public static readonly int SWITCH_MAX_TRANS = freeswitchPINVOKE.SWITCH_MAX_TRANS_get(); + public static readonly int SWITCH_CORE_SESSION_MAX_PRIVATES = freeswitchPINVOKE.SWITCH_CORE_SESSION_MAX_PRIVATES_get(); public static readonly int SWITCH_MAX_STACKS = freeswitchPINVOKE.SWITCH_MAX_STACKS_get(); public static readonly int SWITCH_THREAD_STACKSIZE = freeswitchPINVOKE.SWITCH_THREAD_STACKSIZE_get(); public static readonly int SWITCH_SYSTEM_THREAD_STACKSIZE = freeswitchPINVOKE.SWITCH_SYSTEM_THREAD_STACKSIZE_get(); @@ -6874,6 +7011,8 @@ public class freeswitch { public static readonly int SWITCH_CMD_CHUNK_LEN = freeswitchPINVOKE.SWITCH_CMD_CHUNK_LEN_get(); public static readonly int SWITCH_SMAX = freeswitchPINVOKE.SWITCH_SMAX_get(); public static readonly int SWITCH_SMIN = freeswitchPINVOKE.SWITCH_SMIN_get(); + public static readonly int NO_EVENT_CHANNEL_ID = freeswitchPINVOKE.NO_EVENT_CHANNEL_ID_get(); + public static readonly string SWITCH_EVENT_CHANNEL_GLOBAL = freeswitchPINVOKE.SWITCH_EVENT_CHANNEL_GLOBAL_get(); public static readonly int SWITCH_RESAMPLE_QUALITY = freeswitchPINVOKE.SWITCH_RESAMPLE_QUALITY_get(); public static readonly int SWITCH_RTP_MAX_BUF_LEN = freeswitchPINVOKE.SWITCH_RTP_MAX_BUF_LEN_get(); public static readonly int SWITCH_RTCP_MAX_BUF_LEN = freeswitchPINVOKE.SWITCH_RTCP_MAX_BUF_LEN_get(); @@ -7561,6 +7700,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_MAX_TRANS_get")] public static extern int SWITCH_MAX_TRANS_get(); + [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CORE_SESSION_MAX_PRIVATES_get")] + public static extern int SWITCH_CORE_SESSION_MAX_PRIVATES_get(); + [DllImport("mod_managed", EntryPoint="CSharp_switch_dtmf_t_digit_set")] public static extern void switch_dtmf_t_digit_set(HandleRef jarg1, char jarg2); @@ -9532,11 +9674,11 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_receive_event")] public static extern int switch_core_session_receive_event(HandleRef jarg1, HandleRef jarg2); - [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_get_private")] - public static extern IntPtr switch_core_session_get_private(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_get_private_class")] + public static extern IntPtr switch_core_session_get_private_class(HandleRef jarg1, int jarg2); - [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_set_private")] - public static extern int switch_core_session_set_private(HandleRef jarg1, HandleRef jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_set_private_class")] + public static extern int switch_core_session_set_private_class(HandleRef jarg1, HandleRef jarg2, int jarg3); [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_add_stream")] public static extern int switch_core_session_add_stream(HandleRef jarg1, HandleRef jarg2); @@ -9800,7 +9942,7 @@ class freeswitchPINVOKE { public static extern void switch_core_db_test_reactive(HandleRef jarg1, string jarg2, string jarg3, string jarg4); [DllImport("mod_managed", EntryPoint="CSharp_switch_core_perform_file_open")] - public static extern int switch_core_perform_file_open(string jarg1, string jarg2, int jarg3, HandleRef jarg4, string jarg5, byte jarg6, uint jarg7, uint jarg8, HandleRef jarg9); + public static extern int switch_core_perform_file_open(string jarg1, string jarg2, int jarg3, HandleRef jarg4, string jarg5, uint jarg6, uint jarg7, uint jarg8, HandleRef jarg9); [DllImport("mod_managed", EntryPoint="CSharp_switch_core_file_read")] public static extern int switch_core_file_read(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3); @@ -10393,6 +10535,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_stream_system_fork")] public static extern int switch_stream_system_fork(string jarg1, HandleRef jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_ice_direction")] + public static extern int switch_ice_direction(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_module_name_set")] public static extern void switch_loadable_module_interface_module_name_set(HandleRef jarg1, string jarg2); @@ -10441,6 +10586,12 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_api_interface_get")] public static extern IntPtr switch_loadable_module_interface_api_interface_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_json_api_interface_set")] + public static extern void switch_loadable_module_interface_json_api_interface_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_json_api_interface_get")] + public static extern IntPtr switch_loadable_module_interface_json_api_interface_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_file_interface_set")] public static extern void switch_loadable_module_interface_file_interface_set(HandleRef jarg1, HandleRef jarg2); @@ -10555,6 +10706,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_get_api_interface")] public static extern IntPtr switch_loadable_module_get_api_interface(string jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_get_json_api_interface")] + public static extern IntPtr switch_loadable_module_get_json_api_interface(string jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_get_file_interface")] public static extern IntPtr switch_loadable_module_get_file_interface(string jarg1); @@ -10588,6 +10742,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_api_execute")] public static extern int switch_api_execute(string jarg1, string jarg2, HandleRef jarg3, HandleRef jarg4); + [DllImport("mod_managed", EntryPoint="CSharp_switch_json_api_execute")] + public static extern int switch_json_api_execute(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3); + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_load_module")] public static extern int switch_loadable_module_load_module(string jarg1, string jarg2, int jarg3, ref string jarg4); @@ -10609,6 +10766,15 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_core_codec_ready")] public static extern int switch_core_codec_ready(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_get_secondary_recover_callback")] + public static extern IntPtr switch_core_get_secondary_recover_callback(string jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_register_secondary_recover_callback")] + public static extern int switch_core_register_secondary_recover_callback(string jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_unregister_secondary_recover_callback")] + public static extern void switch_core_unregister_secondary_recover_callback(string jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CMD_CHUNK_LEN_get")] public static extern int SWITCH_CMD_CHUNK_LEN_get(); @@ -12134,10 +12300,10 @@ class freeswitchPINVOKE { public static extern uint switch_file_handle_native_rate_get(HandleRef jarg1); [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_channels_set")] - public static extern void switch_file_handle_channels_set(HandleRef jarg1, byte jarg2); + public static extern void switch_file_handle_channels_set(HandleRef jarg1, uint jarg2); [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_channels_get")] - public static extern byte switch_file_handle_channels_get(HandleRef jarg1); + public static extern uint switch_file_handle_channels_get(HandleRef jarg1); [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_format_set")] public static extern void switch_file_handle_format_set(HandleRef jarg1, uint jarg2); @@ -12343,6 +12509,18 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_params_get")] public static extern IntPtr switch_file_handle_params_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_cur_channels_set")] + public static extern void switch_file_handle_cur_channels_set(HandleRef jarg1, uint jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_cur_channels_get")] + public static extern uint switch_file_handle_cur_channels_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_cur_samplerate_set")] + public static extern void switch_file_handle_cur_samplerate_set(HandleRef jarg1, uint jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_cur_samplerate_get")] + public static extern uint switch_file_handle_cur_samplerate_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_new_switch_file_handle")] public static extern IntPtr new_switch_file_handle(); @@ -13633,6 +13811,66 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_api_interface")] public static extern void delete_switch_api_interface(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_json_api_interface_interface_name_set")] + public static extern void switch_json_api_interface_interface_name_set(HandleRef jarg1, string jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_json_api_interface_interface_name_get")] + public static extern string switch_json_api_interface_interface_name_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_json_api_interface_desc_set")] + public static extern void switch_json_api_interface_desc_set(HandleRef jarg1, string jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_json_api_interface_desc_get")] + public static extern string switch_json_api_interface_desc_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_json_api_interface_function_set")] + public static extern void switch_json_api_interface_function_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_json_api_interface_function_get")] + public static extern IntPtr switch_json_api_interface_function_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_json_api_interface_syntax_set")] + public static extern void switch_json_api_interface_syntax_set(HandleRef jarg1, string jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_json_api_interface_syntax_get")] + public static extern string switch_json_api_interface_syntax_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_json_api_interface_rwlock_set")] + public static extern void switch_json_api_interface_rwlock_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_json_api_interface_rwlock_get")] + public static extern IntPtr switch_json_api_interface_rwlock_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_json_api_interface_refs_set")] + public static extern void switch_json_api_interface_refs_set(HandleRef jarg1, int jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_json_api_interface_refs_get")] + public static extern int switch_json_api_interface_refs_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_json_api_interface_reflock_set")] + public static extern void switch_json_api_interface_reflock_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_json_api_interface_reflock_get")] + public static extern IntPtr switch_json_api_interface_reflock_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_json_api_interface_parent_set")] + public static extern void switch_json_api_interface_parent_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_json_api_interface_parent_get")] + public static extern IntPtr switch_json_api_interface_parent_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_json_api_interface_next_set")] + public static extern void switch_json_api_interface_next_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_json_api_interface_next_get")] + public static extern IntPtr switch_json_api_interface_next_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_new_switch_json_api_interface")] + public static extern IntPtr new_switch_json_api_interface(); + + [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_json_api_interface")] + public static extern void delete_switch_json_api_interface(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_slin_data_session_set")] public static extern void switch_slin_data_session_set(HandleRef jarg1, HandleRef jarg2); @@ -14089,6 +14327,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_direction")] public static extern int switch_channel_direction(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_direction")] + public static extern void switch_channel_set_direction(HandleRef jarg1, int jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_get_session")] public static extern IntPtr switch_channel_get_session(HandleRef jarg1); @@ -14503,6 +14744,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_event_serialize_json")] public static extern int switch_event_serialize_json(HandleRef jarg1, ref string jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_event_serialize_json_obj")] + public static extern int switch_event_serialize_json_obj(HandleRef jarg1, HandleRef jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_event_create_json")] public static extern int switch_event_create_json(HandleRef jarg1, string jarg2); @@ -14539,9 +14783,72 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_event_add_presence_data_cols")] public static extern void switch_event_add_presence_data_cols(HandleRef jarg1, HandleRef jarg2, string jarg3); + [DllImport("mod_managed", EntryPoint="CSharp_switch_json_add_presence_data_cols")] + public static extern void switch_json_add_presence_data_cols(HandleRef jarg1, HandleRef jarg2, string jarg3); + [DllImport("mod_managed", EntryPoint="CSharp_switch_event_launch_dispatch_threads")] public static extern void switch_event_launch_dispatch_threads(uint jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_event_channel_broadcast")] + public static extern uint switch_event_channel_broadcast(string jarg1, HandleRef jarg2, string jarg3, uint jarg4); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_event_channel_unbind")] + public static extern uint switch_event_channel_unbind(string jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_event_channel_bind")] + public static extern int switch_event_channel_bind(string jarg1, HandleRef jarg2, HandleRef jarg3); + + [DllImport("mod_managed", EntryPoint="CSharp_NO_EVENT_CHANNEL_ID_get")] + public static extern int NO_EVENT_CHANNEL_ID_get(); + + [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_EVENT_CHANNEL_GLOBAL_get")] + public static extern string SWITCH_EVENT_CHANNEL_GLOBAL_get(); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_live_array_clear")] + public static extern int switch_live_array_clear(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_live_array_bootstrap")] + public static extern int switch_live_array_bootstrap(HandleRef jarg1, string jarg2, uint jarg3); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_live_array_destroy")] + public static extern int switch_live_array_destroy(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_live_array_create")] + public static extern int switch_live_array_create(string jarg1, string jarg2, uint jarg3, HandleRef jarg4); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_live_array_get")] + public static extern IntPtr switch_live_array_get(HandleRef jarg1, string jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_live_array_get_idx")] + public static extern IntPtr switch_live_array_get_idx(HandleRef jarg1, int jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_live_array_del")] + public static extern int switch_live_array_del(HandleRef jarg1, string jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_live_array_add")] + public static extern int switch_live_array_add(HandleRef jarg1, string jarg2, int jarg3, HandleRef jarg4, int jarg5); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_live_array_visible")] + public static extern int switch_live_array_visible(HandleRef jarg1, int jarg2, int jarg3); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_live_array_isnew")] + public static extern int switch_live_array_isnew(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_live_array_lock")] + public static extern void switch_live_array_lock(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_live_array_unlock")] + public static extern void switch_live_array_unlock(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_live_array_set_user_data")] + public static extern void switch_live_array_set_user_data(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_live_array_set_command_handler")] + public static extern void switch_live_array_set_command_handler(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_live_array_parse_json")] + public static extern void switch_live_array_parse_json(HandleRef jarg1, uint jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_RESAMPLE_QUALITY_get")] public static extern int SWITCH_RESAMPLE_QUALITY_get(); @@ -15553,6 +15860,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_add_dtls")] public static extern int switch_rtp_add_dtls(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3, int jarg4); + [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_del_dtls")] + public static extern int switch_rtp_del_dtls(HandleRef jarg1, int jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_has_dtls")] public static extern int switch_rtp_has_dtls(); @@ -17632,6 +17942,36 @@ namespace FreeSWITCH.Native { using System; using System.Runtime.InteropServices; +public class SWIGTYPE_p_cJSON { + private HandleRef swigCPtr; + + internal SWIGTYPE_p_cJSON(IntPtr cPtr, bool futureUse) { + swigCPtr = new HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_cJSON() { + swigCPtr = new HandleRef(null, IntPtr.Zero); + } + + internal static HandleRef getCPtr(SWIGTYPE_p_cJSON obj) { + return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; + } +} + +} +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 1.3.35 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace FreeSWITCH.Native { + +using System; +using System.Runtime.InteropServices; + public class SWIGTYPE_p_FILE { private HandleRef swigCPtr; @@ -17752,6 +18092,36 @@ namespace FreeSWITCH.Native { using System; using System.Runtime.InteropServices; +public class SWIGTYPE_p_f_p_q_const__char_p_cJSON_p_q_const__char_unsigned_long__void { + private HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_q_const__char_p_cJSON_p_q_const__char_unsigned_long__void(IntPtr cPtr, bool futureUse) { + swigCPtr = new HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_q_const__char_p_cJSON_p_q_const__char_unsigned_long__void() { + swigCPtr = new HandleRef(null, IntPtr.Zero); + } + + internal static HandleRef getCPtr(SWIGTYPE_p_f_p_q_const__char_p_cJSON_p_q_const__char_unsigned_long__void obj) { + return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; + } +} + +} +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 1.3.35 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace FreeSWITCH.Native { + +using System; +using System.Runtime.InteropServices; + public class SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_p_switch_console_callback_match__switch_status_t { private HandleRef swigCPtr; @@ -17962,6 +18332,36 @@ namespace FreeSWITCH.Native { using System; using System.Runtime.InteropServices; +public class SWIGTYPE_p_f_p_q_const__cJSON_p_switch_core_session_p_p_cJSON__switch_status_t { + private HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_q_const__cJSON_p_switch_core_session_p_p_cJSON__switch_status_t(IntPtr cPtr, bool futureUse) { + swigCPtr = new HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_q_const__cJSON_p_switch_core_session_p_p_cJSON__switch_status_t() { + swigCPtr = new HandleRef(null, IntPtr.Zero); + } + + internal static HandleRef getCPtr(SWIGTYPE_p_f_p_q_const__cJSON_p_switch_core_session_p_p_cJSON__switch_status_t obj) { + return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; + } +} + +} +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 1.3.35 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace FreeSWITCH.Native { + +using System; +using System.Runtime.InteropServices; + public class SWIGTYPE_p_f_p_q_const__switch_log_node_t_enum_switch_log_level_t__switch_status_t { private HandleRef swigCPtr; @@ -19612,6 +20012,36 @@ namespace FreeSWITCH.Native { using System; using System.Runtime.InteropServices; +public class SWIGTYPE_p_f_p_switch_live_array_s_p_q_const__char_p_q_const__char_p_cJSON_p_void__void { + private HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_live_array_s_p_q_const__char_p_q_const__char_p_cJSON_p_void__void(IntPtr cPtr, bool futureUse) { + swigCPtr = new HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_live_array_s_p_q_const__char_p_q_const__char_p_cJSON_p_void__void() { + swigCPtr = new HandleRef(null, IntPtr.Zero); + } + + internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_live_array_s_p_q_const__char_p_q_const__char_p_cJSON_p_void__void obj) { + return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; + } +} + +} +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 1.3.35 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace FreeSWITCH.Native { + +using System; +using System.Runtime.InteropServices; + public class SWIGTYPE_p_f_p_switch_media_bug_p_void_enum_switch_abc_type_t__switch_bool_t { private HandleRef swigCPtr; @@ -21322,6 +21752,36 @@ namespace FreeSWITCH.Native { using System; using System.Runtime.InteropServices; +public class SWIGTYPE_p_p_switch_live_array_s { + private HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_live_array_s(IntPtr cPtr, bool futureUse) { + swigCPtr = new HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_live_array_s() { + swigCPtr = new HandleRef(null, IntPtr.Zero); + } + + internal static HandleRef getCPtr(SWIGTYPE_p_p_switch_live_array_s obj) { + return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; + } +} + +} +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 1.3.35 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace FreeSWITCH.Native { + +using System; +using System.Runtime.InteropServices; + public class SWIGTYPE_p_p_switch_log_node_t { private HandleRef swigCPtr; @@ -22402,6 +22862,36 @@ namespace FreeSWITCH.Native { using System; using System.Runtime.InteropServices; +public class SWIGTYPE_p_switch_live_array_s { + private HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_live_array_s(IntPtr cPtr, bool futureUse) { + swigCPtr = new HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_live_array_s() { + swigCPtr = new HandleRef(null, IntPtr.Zero); + } + + internal static HandleRef getCPtr(SWIGTYPE_p_switch_live_array_s obj) { + return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; + } +} + +} +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 1.3.35 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace FreeSWITCH.Native { + +using System; +using System.Runtime.InteropServices; + public class SWIGTYPE_p_switch_media_bug { private HandleRef swigCPtr; @@ -29838,7 +30328,8 @@ namespace FreeSWITCH.Native { SWITCH_FILE_BUFFER_DONE = (1 << 14), SWITCH_FILE_WRITE_APPEND = (1 << 15), SWITCH_FILE_WRITE_OVER = (1 << 16), - SWITCH_FILE_NOMUX = (1 << 17) + SWITCH_FILE_NOMUX = (1 << 17), + SWITCH_FILE_BREAK_ON_CHANGE = (1 << 18) } } @@ -29945,12 +30436,12 @@ public class switch_file_handle : IDisposable { } } - public byte channels { + public uint channels { set { freeswitchPINVOKE.switch_file_handle_channels_set(swigCPtr, value); } get { - byte ret = freeswitchPINVOKE.switch_file_handle_channels_get(swigCPtr); + uint ret = freeswitchPINVOKE.switch_file_handle_channels_get(swigCPtr); return ret; } } @@ -30315,6 +30806,26 @@ public class switch_file_handle : IDisposable { } } + public uint cur_channels { + set { + freeswitchPINVOKE.switch_file_handle_cur_channels_set(swigCPtr, value); + } + get { + uint ret = freeswitchPINVOKE.switch_file_handle_cur_channels_get(swigCPtr); + return ret; + } + } + + public uint cur_samplerate { + set { + freeswitchPINVOKE.switch_file_handle_cur_samplerate_set(swigCPtr, value); + } + get { + uint ret = freeswitchPINVOKE.switch_file_handle_cur_samplerate_get(swigCPtr); + return ret; + } + } + public switch_file_handle() : this(freeswitchPINVOKE.new_switch_file_handle(), true) { } @@ -32511,6 +33022,148 @@ namespace FreeSWITCH.Native { using System; using System.Runtime.InteropServices; +public class switch_json_api_interface : IDisposable { + private HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal switch_json_api_interface(IntPtr cPtr, bool cMemoryOwn) { + swigCMemOwn = cMemoryOwn; + swigCPtr = new HandleRef(this, cPtr); + } + + internal static HandleRef getCPtr(switch_json_api_interface obj) { + return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; + } + + ~switch_json_api_interface() { + Dispose(); + } + + public virtual void Dispose() { + lock(this) { + if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) { + swigCMemOwn = false; + freeswitchPINVOKE.delete_switch_json_api_interface(swigCPtr); + } + swigCPtr = new HandleRef(null, IntPtr.Zero); + GC.SuppressFinalize(this); + } + } + + public string interface_name { + set { + freeswitchPINVOKE.switch_json_api_interface_interface_name_set(swigCPtr, value); + } + get { + string ret = freeswitchPINVOKE.switch_json_api_interface_interface_name_get(swigCPtr); + return ret; + } + } + + public string desc { + set { + freeswitchPINVOKE.switch_json_api_interface_desc_set(swigCPtr, value); + } + get { + string ret = freeswitchPINVOKE.switch_json_api_interface_desc_get(swigCPtr); + return ret; + } + } + + public SWIGTYPE_p_f_p_q_const__cJSON_p_switch_core_session_p_p_cJSON__switch_status_t function { + set { + freeswitchPINVOKE.switch_json_api_interface_function_set(swigCPtr, SWIGTYPE_p_f_p_q_const__cJSON_p_switch_core_session_p_p_cJSON__switch_status_t.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_json_api_interface_function_get(swigCPtr); + SWIGTYPE_p_f_p_q_const__cJSON_p_switch_core_session_p_p_cJSON__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_q_const__cJSON_p_switch_core_session_p_p_cJSON__switch_status_t(cPtr, false); + return ret; + } + } + + public string syntax { + set { + freeswitchPINVOKE.switch_json_api_interface_syntax_set(swigCPtr, value); + } + get { + string ret = freeswitchPINVOKE.switch_json_api_interface_syntax_get(swigCPtr); + return ret; + } + } + + public SWIGTYPE_p_switch_thread_rwlock_t rwlock { + set { + freeswitchPINVOKE.switch_json_api_interface_rwlock_set(swigCPtr, SWIGTYPE_p_switch_thread_rwlock_t.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_json_api_interface_rwlock_get(swigCPtr); + SWIGTYPE_p_switch_thread_rwlock_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_thread_rwlock_t(cPtr, false); + return ret; + } + } + + public int refs { + set { + freeswitchPINVOKE.switch_json_api_interface_refs_set(swigCPtr, value); + } + get { + int ret = freeswitchPINVOKE.switch_json_api_interface_refs_get(swigCPtr); + return ret; + } + } + + public SWIGTYPE_p_switch_mutex_t reflock { + set { + freeswitchPINVOKE.switch_json_api_interface_reflock_set(swigCPtr, SWIGTYPE_p_switch_mutex_t.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_json_api_interface_reflock_get(swigCPtr); + SWIGTYPE_p_switch_mutex_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_mutex_t(cPtr, false); + return ret; + } + } + + public switch_loadable_module_interface parent { + set { + freeswitchPINVOKE.switch_json_api_interface_parent_set(swigCPtr, switch_loadable_module_interface.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_json_api_interface_parent_get(swigCPtr); + switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_loadable_module_interface(cPtr, false); + return ret; + } + } + + public switch_json_api_interface next { + set { + freeswitchPINVOKE.switch_json_api_interface_next_set(swigCPtr, switch_json_api_interface.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_json_api_interface_next_get(swigCPtr); + switch_json_api_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_json_api_interface(cPtr, false); + return ret; + } + } + + public switch_json_api_interface() : this(freeswitchPINVOKE.new_switch_json_api_interface(), true) { + } + +} + +} +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 1.3.35 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace FreeSWITCH.Native { + +using System; +using System.Runtime.InteropServices; + public class switch_limit_interface : IDisposable { private HandleRef swigCPtr; protected bool swigCMemOwn; @@ -32903,6 +33556,17 @@ public class switch_loadable_module_interface : IDisposable { } } + public switch_json_api_interface json_api_interface { + set { + freeswitchPINVOKE.switch_loadable_module_interface_json_api_interface_set(swigCPtr, switch_json_api_interface.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_interface_json_api_interface_get(swigCPtr); + switch_json_api_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_json_api_interface(cPtr, false); + return ret; + } + } + public switch_file_interface file_interface { set { freeswitchPINVOKE.switch_loadable_module_interface_file_interface_set(swigCPtr, switch_file_interface.getCPtr(value)); @@ -33464,7 +34128,8 @@ public enum switch_module_interface_name_t { SWITCH_ASR_INTERFACE, SWITCH_MANAGEMENT_INTERFACE, SWITCH_LIMIT_INTERFACE, - SWITCH_CHAT_APPLICATION_INTERFACE + SWITCH_CHAT_APPLICATION_INTERFACE, + SWITCH_JSON_API_INTERFACE } } @@ -33532,6 +34197,22 @@ public enum switch_priority_t { namespace FreeSWITCH.Native { +public enum switch_pvt_class_t { + SWITCH_PVT_PRIMARY = 0, + SWITCH_PVT_SECONDARY +} + +} +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 1.3.35 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace FreeSWITCH.Native { + public enum switch_ring_ready_t { SWITCH_RING_READY_NONE, SWITCH_RING_READY_RINGING, @@ -33923,6 +34604,7 @@ public enum switch_rtp_flag_t { SWITCH_RTP_FLAG_ENABLE_RTCP, SWITCH_RTP_FLAG_RTCP_MUX, SWITCH_RTP_FLAG_KILL_JB, + SWITCH_RTP_FLAG_VIDEO_BREAK, SWITCH_RTP_FLAG_INVALID } @@ -35919,7 +36601,9 @@ public enum switch_status_t { SWITCH_STATUS_FOUND, SWITCH_STATUS_CONTINUE, SWITCH_STATUS_TERM, - SWITCH_STATUS_NOT_INITALIZED + SWITCH_STATUS_NOT_INITALIZED, + SWITCH_STATUS_XBREAK = 35, + SWITCH_STATUS_WINBREAK = 730035 } } diff --git a/src/mod/languages/mod_perl/mod_perl_wrap.cpp b/src/mod/languages/mod_perl/mod_perl_wrap.cpp index 6f1b81cabe..0757fcd85c 100644 --- a/src/mod/languages/mod_perl/mod_perl_wrap.cpp +++ b/src/mod/languages/mod_perl/mod_perl_wrap.cpp @@ -2510,17 +2510,29 @@ XS(_wrap_IVRMenu_execute) { XS(_wrap_new_API) { { + CoreSession *arg1 = (CoreSession *) NULL ; API *result = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; int argvi = 0; dXSARGS; - if ((items < 0) || (items > 0)) { - SWIG_croak("Usage: new_API();"); + if ((items < 0) || (items > 1)) { + SWIG_croak("Usage: new_API(s);"); } - result = (API *)new API(); + if (items > 0) { + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_API" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + } + result = (API *)new API(arg1); ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_API, SWIG_OWNER | SWIG_SHADOW); argvi++ ; + XSRETURN(argvi); fail: + SWIG_croak_null(); } } diff --git a/src/mod/languages/mod_python/mod_python_wrap.cpp b/src/mod/languages/mod_python/mod_python_wrap.cpp index caecd70d5b..b7379edb7d 100644 --- a/src/mod/languages/mod_python/mod_python_wrap.cpp +++ b/src/mod/languages/mod_python/mod_python_wrap.cpp @@ -3579,10 +3579,21 @@ SWIGINTERN PyObject *IVRMenu_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObje SWIGINTERN PyObject *_wrap_new_API(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) NULL ; API *result = 0 ; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; - if (!PyArg_ParseTuple(args,(char *)":new_API")) SWIG_fail; - result = (API *)new API(); + if (!PyArg_ParseTuple(args,(char *)"|O:new_API",&obj0)) SWIG_fail; + if (obj0) { + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_API" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + } + result = (API *)new API(arg1); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_API, SWIG_POINTER_NEW | 0 ); return resultobj; fail: diff --git a/src/switch_caller.c b/src/switch_caller.c index 02de5575aa..fdd41a4dd7 100644 --- a/src/switch_caller.c +++ b/src/switch_caller.c @@ -66,6 +66,11 @@ SWITCH_DECLARE(switch_caller_profile_t *) switch_caller_profile_new(switch_memor caller_id_number = SWITCH_DEFAULT_CLID_NUMBER; } + /* ANI defaults to Caller ID Number when not specified */ + if (zstr(ani)) { + ani = caller_id_number; + } + profile_dup_clean(username, profile->username, pool); profile_dup_clean(dialplan, profile->dialplan, pool); profile_dup_clean(caller_id_name, profile->caller_id_name, pool); diff --git a/src/switch_channel.c b/src/switch_channel.c index ae94061c26..4bc93573a6 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -385,6 +385,13 @@ SWITCH_DECLARE(switch_channel_timetable_t *) switch_channel_get_timetable(switch return times; } +SWITCH_DECLARE(void) switch_channel_set_direction(switch_channel_t *channel, switch_call_direction_t direction) +{ + if (!switch_core_session_in_thread(channel->session)) { + channel->direction = direction; + } +} + SWITCH_DECLARE(switch_call_direction_t) switch_channel_direction(switch_channel_t *channel) { return channel->direction; @@ -491,6 +498,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_queue_dtmf(switch_channel_t *chan switch_zmalloc(dt, sizeof(*dt)); *dt = new_dtmf; + while (switch_queue_trypush(channel->dtmf_queue, dt) != SWITCH_STATUS_SUCCESS) { if (switch_queue_trypop(channel->dtmf_queue, &pop) == SWITCH_STATUS_SUCCESS) { free(pop); @@ -509,6 +517,8 @@ SWITCH_DECLARE(switch_status_t) switch_channel_queue_dtmf(switch_channel_t *chan switch_mutex_unlock(channel->dtmf_mutex); + switch_core_media_break(channel->session, SWITCH_MEDIA_TYPE_AUDIO); + return status; } @@ -1894,6 +1904,7 @@ SWITCH_DECLARE(void) switch_channel_clear_state_flag(switch_channel_t *channel, SWITCH_DECLARE(void) switch_channel_clear_flag(switch_channel_t *channel, switch_channel_flag_t flag) { int ACTIVE = 0; + int CLEAR = 0; switch_assert(channel != NULL); switch_assert(channel->flag_mutex); @@ -1902,6 +1913,11 @@ SWITCH_DECLARE(void) switch_channel_clear_flag(switch_channel_t *channel, switch if (flag == CF_LEG_HOLDING && channel->flags[flag] && channel->flags[CF_ANSWERED]) { ACTIVE = 1; } + + if (flag == CF_VIDEO_PASSIVE && channel->flags[flag]) { + CLEAR = 1; + } + channel->flags[flag] = 0; switch_mutex_unlock(channel->flag_mutex); @@ -1927,7 +1943,7 @@ SWITCH_DECLARE(void) switch_channel_clear_flag(switch_channel_t *channel, switch switch_channel_set_variable(channel, "recovered", NULL); } - if (flag == CF_VIDEO_PASSIVE) { + if (flag == CF_VIDEO_PASSIVE && CLEAR) { switch_core_session_wake_video_thread(channel->session); } @@ -2951,19 +2967,33 @@ SWITCH_DECLARE(void) switch_channel_invert_cid(switch_channel_t *channel) SWITCH_DECLARE(void) switch_channel_flip_cid(switch_channel_t *channel) { switch_event_t *event; + const char *tmp = NULL; switch_mutex_lock(channel->profile_mutex); if (channel->caller_profile->callee_id_name) { + tmp = channel->caller_profile->caller_id_name; switch_channel_set_variable(channel, "pre_transfer_caller_id_name", channel->caller_profile->caller_id_name); channel->caller_profile->caller_id_name = switch_core_strdup(channel->caller_profile->pool, channel->caller_profile->callee_id_name); } - channel->caller_profile->callee_id_name = SWITCH_BLANK_STRING; + + if (switch_channel_test_flag(channel, CF_BRIDGED)) { + channel->caller_profile->callee_id_name = SWITCH_BLANK_STRING; + } else if (tmp) { + channel->caller_profile->callee_id_name = tmp; + } if (channel->caller_profile->callee_id_number) { + tmp = channel->caller_profile->caller_id_number; switch_channel_set_variable(channel, "pre_transfer_caller_id_number", channel->caller_profile->caller_id_number); channel->caller_profile->caller_id_number = switch_core_strdup(channel->caller_profile->pool, channel->caller_profile->callee_id_number); } - channel->caller_profile->callee_id_number = SWITCH_BLANK_STRING; + + if (switch_channel_test_flag(channel, CF_BRIDGED)) { + channel->caller_profile->callee_id_number = SWITCH_BLANK_STRING; + } else if (tmp) { + channel->caller_profile->callee_id_number = tmp; + } + switch_mutex_unlock(channel->profile_mutex); @@ -3260,7 +3290,7 @@ static void check_secure(switch_channel_t *channel) { const char *var, *sec; - if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_INBOUND) { + if (!switch_channel_media_ready(channel) && switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_INBOUND) { if ((sec = switch_channel_get_variable(channel, "rtp_secure_media")) && switch_true(sec)) { if (!(var = switch_channel_get_variable(channel, "rtp_has_crypto"))) { switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_WARNING, "rtp_secure_media invalid in this context.\n"); diff --git a/src/switch_core_cert.c b/src/switch_core_cert.c index 41446c600d..ffba06ade5 100644 --- a/src/switch_core_cert.c +++ b/src/switch_core_cert.c @@ -97,6 +97,7 @@ static const EVP_MD *get_evp_by_name(const char *name) { if (!strcasecmp(name, "md5")) return EVP_md5(); if (!strcasecmp(name, "sha1")) return EVP_sha1(); + if (!strcasecmp(name, "sha-1")) return EVP_sha1(); if (!strcasecmp(name, "sha-256")) return EVP_sha256(); if (!strcasecmp(name, "sha-512")) return EVP_sha512(); diff --git a/src/switch_core_codec.c b/src/switch_core_codec.c index 0c27fdcb46..bd3b521a98 100644 --- a/src/switch_core_codec.c +++ b/src/switch_core_codec.c @@ -171,8 +171,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_set_real_read_codec(switch_c } switch_channel_set_variable(channel, "read_codec", session->read_impl.iananame); + switch_channel_set_variable(channel, "original_read_codec", session->read_impl.iananame); switch_snprintf(tmp, sizeof(tmp), "%d", session->read_impl.actual_samples_per_second); switch_channel_set_variable(channel, "read_rate", tmp); + switch_channel_set_variable(channel, "original_read_rate", tmp); session->raw_read_frame.codec = session->read_codec; session->raw_write_frame.codec = session->read_codec; diff --git a/src/switch_core_io.c b/src/switch_core_io.c index aad6192ece..47f6289a73 100644 --- a/src/switch_core_io.c +++ b/src/switch_core_io.c @@ -638,8 +638,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Codec init error!\n"); goto done; default: - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Codec %s decoder error!\n", - session->read_codec->codec_interface->interface_name); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Codec %s decoder error! [%d]\n", + session->read_codec->codec_interface->interface_name, status); goto done; } } diff --git a/src/switch_core_media.c b/src/switch_core_media.c index d8553d0766..322d4a63da 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -509,6 +509,31 @@ SWITCH_DECLARE(const char *)switch_core_media_get_codec_string(switch_core_sessi return !zstr(preferred) ? preferred : fallback; } +SWITCH_DECLARE(void) switch_core_session_clear_crypto(switch_core_session_t *session) +{ + int i; + switch_media_handle_t *smh; + + const char *vars[] = { "rtp_last_audio_local_crypto_key", + "srtp_remote_audio_crypto_key", + "srtp_remote_audio_crypto_tag", + "srtp_remote_video_crypto_key", + "srtp_remote_video_crypto_tag", + "rtp_secure_media", + NULL}; + + for(i = 0; vars[i] ;i++) { + switch_channel_set_variable(session->channel, vars[i], NULL); + } + + if (!(smh = session->media_handle)) { + return; + } + + memset(&smh->engines[SWITCH_MEDIA_TYPE_AUDIO].ssec, 0, sizeof(smh->engines[SWITCH_MEDIA_TYPE_AUDIO].ssec)); + memset(&smh->engines[SWITCH_MEDIA_TYPE_VIDEO].ssec, 0, sizeof(smh->engines[SWITCH_MEDIA_TYPE_VIDEO].ssec)); + +} SWITCH_DECLARE(const char *) switch_core_session_local_crypto_key(switch_core_session_t *session, switch_media_type_t type) { @@ -1036,15 +1061,23 @@ SWITCH_DECLARE(switch_status_t) switch_media_handle_create(switch_media_handle_t *smhp = NULL; + if (zstr(params->sdp_username)) { + params->sdp_username = "FreeSWITCH"; + } + + if ((session->media_handle = switch_core_session_alloc(session, (sizeof(*smh))))) { session->media_handle->session = session; *smhp = session->media_handle; switch_set_flag(session->media_handle, SMF_INIT); session->media_handle->media_flags[SCMF_RUNNING] = 1; session->media_handle->engines[SWITCH_MEDIA_TYPE_AUDIO].read_frame.buflen = SWITCH_RTP_MAX_BUF_LEN; + session->media_handle->engines[SWITCH_MEDIA_TYPE_AUDIO].type = SWITCH_MEDIA_TYPE_AUDIO; session->media_handle->engines[SWITCH_MEDIA_TYPE_VIDEO].read_frame.buflen = SWITCH_RTP_MAX_BUF_LEN; + session->media_handle->engines[SWITCH_MEDIA_TYPE_VIDEO].type = SWITCH_MEDIA_TYPE_VIDEO; session->media_handle->mparams = params; + switch_mutex_init(&session->media_handle->mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session)); session->media_handle->engines[SWITCH_MEDIA_TYPE_AUDIO].ssrc = @@ -1098,18 +1131,18 @@ SWITCH_DECLARE(int32_t) switch_media_handle_test_media_flag(switch_media_handle_ SWITCH_DECLARE(switch_status_t) switch_core_session_media_handle_ready(switch_core_session_t *session) { - if (session->media_handle && switch_test_flag(session->media_handle, SMF_INIT)) { return SWITCH_STATUS_SUCCESS; } - + return SWITCH_STATUS_FALSE; } + SWITCH_DECLARE(switch_media_handle_t *) switch_core_session_get_media_handle(switch_core_session_t *session) { - if (switch_core_session_media_handle_ready(session)) { + if (switch_core_session_media_handle_ready(session) == SWITCH_STATUS_SUCCESS) { return session->media_handle; } @@ -1125,6 +1158,11 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_clear_media_handle(switch_co return SWITCH_STATUS_SUCCESS; } +SWITCH_DECLARE(switch_core_media_params_t *) switch_core_media_get_mparams(switch_media_handle_t *smh) +{ + switch_assert(smh); + return smh->mparams; +} SWITCH_DECLARE(void) switch_core_media_prepare_codecs(switch_core_session_t *session, switch_bool_t force) { @@ -1753,8 +1791,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_set_video_codec(switch_core_se switch_core_session_set_video_write_codec(session, &v_engine->write_codec); - switch_channel_set_variable_printf(session->channel, "rtp_last_video_codec_string", "%s@%dh@%di", - v_engine->codec_params.iananame, v_engine->codec_params.rm_rate, v_engine->codec_params.codec_ms); + switch_channel_set_variable_printf(session->channel, "rtp_last_video_codec_string", "%s@%dh", + v_engine->codec_params.rm_encoding, v_engine->codec_params.rm_rate); if (switch_rtp_ready(v_engine->rtp_session)) { @@ -2000,7 +2038,11 @@ static void generate_local_fingerprint(switch_media_handle_t *smh, switch_media_ switch_rtp_engine_t *engine = &smh->engines[type]; if (!engine->local_dtls_fingerprint.len) { - engine->local_dtls_fingerprint.type = "sha-256"; + if (engine->remote_dtls_fingerprint.type) { + engine->local_dtls_fingerprint.type = engine->remote_dtls_fingerprint.type; + } else { + engine->local_dtls_fingerprint.type = "sha-256"; + } switch_core_cert_gen_fingerprint(DTLS_SRTP_FNAME, &engine->local_dtls_fingerprint); } } @@ -2018,12 +2060,26 @@ static int dtls_ok(switch_core_session_t *session) #pragma warning(disable:4702) #endif +//? +SWITCH_DECLARE(switch_call_direction_t) switch_ice_direction(switch_core_session_t *session) +{ + switch_call_direction_t r = switch_channel_direction(session->channel); + + if ((switch_channel_test_flag(session->channel, CF_REINVITE) || switch_channel_test_flag(session->channel, CF_RECOVERING)) + && switch_channel_test_flag(session->channel, CF_WEBRTC)) { + r = SWITCH_CALL_DIRECTION_OUTBOUND; + } + + return r; +} + //? static void check_ice(switch_media_handle_t *smh, switch_media_type_t type, sdp_session_t *sdp, sdp_media_t *m) { switch_rtp_engine_t *engine = &smh->engines[type]; sdp_attribute_t *attr; int i = 0, got_rtcp_mux = 0; + const char *val; if (engine->ice_in.chosen[0] && engine->ice_in.chosen[1] && !switch_channel_test_flag(smh->session->channel, CF_REINVITE)) { return; @@ -2066,18 +2122,24 @@ static void check_ice(switch_media_handle_t *smh, switch_media_type_t type, sdp_ switch_set_string(engine->local_dtls_fingerprint.str, p); } - if (strcasecmp(engine->remote_dtls_fingerprint.type, "sha-256")) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(smh->session), SWITCH_LOG_WARNING, "Unsupported fingerprint type.\n"); - engine->local_dtls_fingerprint.type = NULL; - engine->remote_dtls_fingerprint.type = NULL; - } + //if (strcasecmp(engine->remote_dtls_fingerprint.type, "sha-256")) { + // switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(smh->session), SWITCH_LOG_WARNING, "Unsupported fingerprint type.\n"); + //engine->local_dtls_fingerprint.type = NULL; + //engine->remote_dtls_fingerprint.type = NULL; + //} generate_local_fingerprint(smh, type); switch_channel_set_flag(smh->session->channel, CF_DTLS); - + } else if (!engine->remote_ssrc && !strcasecmp(attr->a_name, "ssrc") && attr->a_value) { engine->remote_ssrc = (uint32_t) atol(attr->a_value); + + if (engine->rtp_session && engine->remote_ssrc) { + switch_rtp_set_remote_ssrc(engine->rtp_session, engine->remote_ssrc); + } + + #ifdef RTCP_MUX } else if (!strcasecmp(attr->a_name, "rtcp-mux")) { engine->rtcp_mux = SWITCH_TRUE; @@ -2139,7 +2201,8 @@ static void check_ice(switch_media_handle_t *smh, switch_media_type_t type, sdp_ engine->ice_in.cands[engine->ice_in.cand_idx][cid].priority = atol(fields[3]); engine->ice_in.cands[engine->ice_in.cand_idx][cid].con_addr = switch_core_session_strdup(smh->session, fields[4]); engine->ice_in.cands[engine->ice_in.cand_idx][cid].con_port = (switch_port_t)atoi(fields[5]); - + + j = 6; while(j < argc && fields[j+1]) { @@ -2155,6 +2218,7 @@ static void check_ice(switch_media_handle_t *smh, switch_media_type_t type, sdp_ j += 2; } + if (engine->ice_in.chosen[cid]) { engine->ice_in.cands[engine->ice_in.chosen[cid]][cid].ready++; @@ -2206,6 +2270,19 @@ static void check_ice(switch_media_handle_t *smh, switch_media_type_t type, sdp_ } } + /* Got RTP but not RTCP, probably mux */ + if (engine->ice_in.chosen[0] && !engine->ice_in.chosen[1] && got_rtcp_mux) { + engine->ice_in.chosen[1] = engine->ice_in.chosen[0]; + + memcpy(&engine->ice_in.cands[engine->ice_in.chosen[1]][1], &engine->ice_in.cands[engine->ice_in.chosen[0]][0], + sizeof(engine->ice_in.cands[engine->ice_in.chosen[0]][0])); + engine->ice_in.cands[engine->ice_in.chosen[1]][1].ready++; + + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(smh->session), SWITCH_LOG_NOTICE, + "No %s RTCP candidate found; defaulting to the same as RTP [%s:%d]\n", type2str(type), + engine->ice_in.cands[engine->ice_in.chosen[1]][1].con_addr, engine->ice_in.cands[engine->ice_in.chosen[1]][1].con_port); + } + /* look for any candidates and hope for auto-adjust */ if (!engine->ice_in.chosen[0] || !engine->ice_in.chosen[1]) { for (i = 0; i <= engine->ice_in.cand_idx && (!engine->ice_in.chosen[0] || !engine->ice_in.chosen[1]); i++) { @@ -2246,7 +2323,9 @@ static void check_ice(switch_media_handle_t *smh, switch_media_type_t type, sdp_ engine->codec_params.remote_sdp_ip = switch_core_session_strdup(smh->session, (char *) engine->ice_in.cands[engine->ice_in.chosen[0]][0].con_addr); engine->codec_params.remote_sdp_port = (switch_port_t) engine->ice_in.cands[engine->ice_in.chosen[0]][0].con_port; - + if (engine->remote_rtcp_port) { + engine->remote_rtcp_port = engine->codec_params.remote_sdp_port; + } switch_snprintf(tmp, sizeof(tmp), "%d", engine->codec_params.remote_sdp_port); switch_channel_set_variable(smh->session->channel, SWITCH_REMOTE_MEDIA_IP_VARIABLE, engine->codec_params.remote_sdp_ip); @@ -2271,6 +2350,7 @@ static void check_ice(switch_media_handle_t *smh, switch_media_type_t type, sdp_ if (switch_channel_test_flag(smh->session->channel, CF_REINVITE)) { + if (switch_rtp_ready(engine->rtp_session) && engine->ice_in.cands[engine->ice_in.chosen[0]][0].ready) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(smh->session), SWITCH_LOG_INFO, "RE-Activating %s ICE\n", type2str(type)); @@ -2284,7 +2364,7 @@ static void check_ice(switch_media_handle_t *smh, switch_media_type_t type, sdp_ ICE_GOOGLE_JINGLE, NULL #else - switch_channel_direction(smh->session->channel) == + switch_ice_direction(smh->session) == SWITCH_CALL_DIRECTION_OUTBOUND ? ICE_VANILLA : (ICE_VANILLA | ICE_CONTROLLED), &engine->ice_in #endif @@ -2295,7 +2375,37 @@ static void check_ice(switch_media_handle_t *smh, switch_media_type_t type, sdp_ } + if (engine->rtp_session && ((val = switch_channel_get_variable(smh->session->channel, + type == SWITCH_MEDIA_TYPE_VIDEO ? + "rtcp_video_interval_msec" : "rtcp_audio_interval_msec")) + || (val = type == SWITCH_MEDIA_TYPE_VIDEO ? + smh->mparams->rtcp_video_interval_msec : smh->mparams->rtcp_audio_interval_msec))) { + + const char *rport = switch_channel_get_variable(smh->session->channel, + type == SWITCH_MEDIA_TYPE_VIDEO ? "rtp_remote_video_rtcp_port" : "rtp_remote_audio_rtcp_port"); + switch_port_t remote_rtcp_port = engine->remote_rtcp_port; + if (!remote_rtcp_port && rport) { + remote_rtcp_port = (switch_port_t)atoi(rport); + } + + if (!strcasecmp(val, "passthru")) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(smh->session), SWITCH_LOG_INFO, "Activating %s RTCP PASSTHRU PORT %d\n", + type2str(type), remote_rtcp_port); + switch_rtp_activate_rtcp(engine->rtp_session, -1, remote_rtcp_port, engine->rtcp_mux > 0); + } else { + int interval = atoi(val); + if (interval < 100 || interval > 500000) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(smh->session), SWITCH_LOG_ERROR, + "Invalid rtcp interval spec [%d] must be between 100 and 500000\n", interval); + interval = 10000; + } + + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(smh->session), SWITCH_LOG_INFO, "Activating %s RTCP PORT %d\n", type2str(type), remote_rtcp_port); + switch_rtp_activate_rtcp(engine->rtp_session, interval, remote_rtcp_port, engine->rtcp_mux > 0); + } + } + if (engine->ice_in.cands[engine->ice_in.chosen[1]][1].ready) { if (!strcmp(engine->ice_in.cands[engine->ice_in.chosen[1]][1].con_addr, engine->ice_in.cands[engine->ice_in.chosen[0]][0].con_addr) && engine->ice_in.cands[engine->ice_in.chosen[1]][1].con_port == engine->ice_in.cands[engine->ice_in.chosen[0]][0].con_port) { @@ -2313,7 +2423,7 @@ static void check_ice(switch_media_handle_t *smh, switch_media_type_t type, sdp_ ICE_GOOGLE_JINGLE, NULL #else - switch_channel_direction(smh->session->channel) == + switch_ice_direction(smh->session) == SWITCH_CALL_DIRECTION_OUTBOUND ? ICE_VANILLA : (ICE_VANILLA | ICE_CONTROLLED), &engine->ice_in #endif @@ -3350,6 +3460,116 @@ SWITCH_DECLARE(int) switch_core_media_toggle_hold(switch_core_session_t *session return changed; } +static void *SWITCH_THREAD_FUNC video_helper_thread(switch_thread_t *thread, void *obj) +{ + struct media_helper *mh = obj; + switch_core_session_t *session = mh->session; + switch_channel_t *channel = switch_core_session_get_channel(session); + switch_status_t status; + switch_frame_t *read_frame; + switch_media_handle_t *smh; + + if (!(smh = session->media_handle)) { + return NULL; + } + + switch_core_session_read_lock(session); + + mh->up = 1; + switch_mutex_lock(mh->cond_mutex); + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Video thread started. Echo is %s\n", + switch_channel_get_name(session->channel), switch_channel_test_flag(channel, CF_VIDEO_ECHO) ? "on" : "off"); + switch_core_session_refresh_video(session); + + while (switch_channel_up_nosig(channel)) { + + if (switch_channel_test_flag(channel, CF_VIDEO_PASSIVE)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Video thread paused. Echo is %s\n", + switch_channel_get_name(session->channel), switch_channel_test_flag(channel, CF_VIDEO_ECHO) ? "on" : "off"); + switch_thread_cond_wait(mh->cond, mh->cond_mutex); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Video thread resumed Echo is %s\n", + switch_channel_get_name(session->channel), switch_channel_test_flag(channel, CF_VIDEO_ECHO) ? "on" : "off"); + switch_core_session_refresh_video(session); + } + + if (switch_channel_test_flag(channel, CF_VIDEO_PASSIVE)) { + continue; + } + + if (!switch_channel_media_up(session->channel)) { + switch_yield(10000); + continue; + } + + + status = switch_core_session_read_video_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0); + + if (!SWITCH_READ_ACCEPTABLE(status)) { + switch_cond_next(); + continue; + } + + + if (switch_channel_test_flag(channel, CF_VIDEO_REFRESH_REQ)) { + switch_core_session_refresh_video(session); + switch_channel_clear_flag(channel, CF_VIDEO_REFRESH_REQ); + } + + if (switch_test_flag(read_frame, SFF_CNG)) { + continue; + } + + if (switch_channel_test_flag(channel, CF_VIDEO_ECHO)) { + switch_core_session_write_video_frame(session, read_frame, SWITCH_IO_FLAG_NONE, 0); + } + + } + + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Video thread ended\n", switch_channel_get_name(session->channel)); + + switch_mutex_unlock(mh->cond_mutex); + switch_core_session_rwunlock(session); + + mh->up = 0; + return NULL; +} + + +static switch_status_t start_video_thread(switch_core_session_t *session) +{ + switch_threadattr_t *thd_attr = NULL; + switch_memory_pool_t *pool = switch_core_session_get_pool(session); + switch_rtp_engine_t *v_engine = NULL; + switch_media_handle_t *smh; + + if (!(smh = session->media_handle)) { + return SWITCH_STATUS_FALSE; + } + + v_engine = &smh->engines[SWITCH_MEDIA_TYPE_VIDEO]; + + if (v_engine->media_thread) { + return SWITCH_STATUS_FALSE; + } + + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "%s Starting Video thread\n", switch_core_session_get_name(session)); + + switch_rtp_set_default_payload(v_engine->rtp_session, v_engine->codec_params.agreed_pt); + v_engine->mh.session = session; + switch_threadattr_create(&thd_attr, pool); + switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE); + + switch_thread_cond_create(&v_engine->mh.cond, pool); + switch_mutex_init(&v_engine->mh.cond_mutex, SWITCH_MUTEX_NESTED, pool); + switch_mutex_init(&v_engine->read_mutex, SWITCH_MUTEX_NESTED, pool); + switch_thread_create(&v_engine->media_thread, thd_attr, video_helper_thread, &v_engine->mh, switch_core_session_get_pool(session)); + + return SWITCH_STATUS_SUCCESS; +} + + //? #define RA_PTR_LEN 512 @@ -3470,7 +3690,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_proxy_remote_addr(switch_core_ } } - + if (switch_rtp_set_remote_address(v_engine->rtp_session, v_engine->codec_params.remote_sdp_ip, v_engine->codec_params.remote_sdp_port, remote_rtcp_port, SWITCH_TRUE, &err) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "VIDEO RTP REPORTS ERROR: [%s]\n", err); @@ -3482,6 +3702,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_proxy_remote_addr(switch_core_ !switch_channel_test_flag(session->channel, CF_WEBRTC)) { /* Reactivate the NAT buster flag. */ switch_rtp_set_flag(v_engine->rtp_session, SWITCH_RTP_FLAG_AUTOADJ); + start_video_thread(session); + } if (switch_media_handle_test_media_flag(smh, SCMF_AUTOFIX_TIMING) || switch_media_handle_test_media_flag(smh, SCMF_AUTOFIX_PT)) { v_engine->check_frames = 0; @@ -3735,6 +3957,24 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_choose_port(switch_core_sessio return SWITCH_STATUS_SUCCESS; } +SWITCH_DECLARE(switch_status_t) switch_core_media_choose_ports(switch_core_session_t *session, switch_bool_t audio, switch_bool_t video) +{ + switch_status_t status = SWITCH_STATUS_SUCCESS; + + if (audio && (status = switch_core_media_choose_port(session, SWITCH_MEDIA_TYPE_AUDIO, 0)) == SWITCH_STATUS_SUCCESS) { + if (video) { + switch_core_media_check_video_codecs(session); + if (switch_channel_test_flag(session->channel, CF_VIDEO_POSSIBLE)) { + switch_core_media_choose_port(session, SWITCH_MEDIA_TYPE_VIDEO, 0); + } + } + } + + return status; +} + + + //? SWITCH_DECLARE(void) switch_core_media_deactivate_rtp(switch_core_session_t *session) { @@ -3882,85 +4122,28 @@ SWITCH_DECLARE(void) switch_core_session_wake_video_thread(switch_core_session_t } } -static void *SWITCH_THREAD_FUNC video_helper_thread(switch_thread_t *thread, void *obj) +static void check_dtls_reinvite(switch_core_session_t *session, switch_rtp_engine_t *engine) { - struct media_helper *mh = obj; - switch_core_session_t *session = mh->session; - switch_channel_t *channel = switch_core_session_get_channel(session); - switch_status_t status; - switch_frame_t *read_frame; - switch_media_handle_t *smh; + if (switch_channel_test_flag(session->channel, CF_REINVITE)) { - if (!(smh = session->media_handle)) { - return NULL; + if (!zstr(engine->local_dtls_fingerprint.str) && switch_rtp_has_dtls() && dtls_ok(session)) { + dtls_type_t xtype, dtype = switch_ice_direction(session) == SWITCH_CALL_DIRECTION_INBOUND ? DTLS_TYPE_CLIENT : DTLS_TYPE_SERVER; + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "RE-SETTING %s DTLS\n", type2str(engine->type)); + + xtype = DTLS_TYPE_RTP; + if (engine->rtcp_mux > 0) xtype |= DTLS_TYPE_RTCP; + + switch_rtp_add_dtls(engine->rtp_session, &engine->local_dtls_fingerprint, &engine->remote_dtls_fingerprint, dtype | xtype); + + if (engine->rtcp_mux < 1) { + xtype = DTLS_TYPE_RTCP; + switch_rtp_add_dtls(engine->rtp_session, &engine->local_dtls_fingerprint, &engine->remote_dtls_fingerprint, dtype | xtype); + } + + } } - - switch_core_session_read_lock(session); - - mh->up = 1; - switch_mutex_lock(mh->cond_mutex); - - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Video thread started. Echo is %s\n", - switch_channel_get_name(session->channel), switch_channel_test_flag(channel, CF_VIDEO_ECHO) ? "on" : "off"); - switch_core_session_refresh_video(session); - - while (switch_channel_up_nosig(channel)) { - - if (switch_channel_test_flag(channel, CF_VIDEO_PASSIVE)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Video thread paused. Echo is %s\n", - switch_channel_get_name(session->channel), switch_channel_test_flag(channel, CF_VIDEO_ECHO) ? "on" : "off"); - switch_thread_cond_wait(mh->cond, mh->cond_mutex); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Video thread resumed Echo is %s\n", - switch_channel_get_name(session->channel), switch_channel_test_flag(channel, CF_VIDEO_ECHO) ? "on" : "off"); - switch_core_session_refresh_video(session); - } - - if (switch_channel_test_flag(channel, CF_VIDEO_PASSIVE)) { - continue; - } - - if (!switch_channel_media_up(session->channel)) { - switch_yield(10000); - continue; - } - - - status = switch_core_session_read_video_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0); - - if (!SWITCH_READ_ACCEPTABLE(status)) { - switch_cond_next(); - continue; - } - - - if (switch_channel_test_flag(channel, CF_VIDEO_REFRESH_REQ)) { - switch_core_session_refresh_video(session); - switch_channel_clear_flag(channel, CF_VIDEO_REFRESH_REQ); - } - - if (switch_test_flag(read_frame, SFF_CNG)) { - continue; - } - - if (switch_channel_test_flag(channel, CF_VIDEO_ECHO)) { - switch_core_session_write_video_frame(session, read_frame, SWITCH_IO_FLAG_NONE, 0); - } - - } - - - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Video thread ended\n", switch_channel_get_name(session->channel)); - - switch_mutex_unlock(mh->cond_mutex); - switch_core_session_rwunlock(session); - - mh->up = 0; - return NULL; } - - - //? SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_session_t *session) @@ -4151,6 +4334,11 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi switch_rtp_set_flag(a_engine->rtp_session, SWITCH_RTP_FLAG_AUTOADJ); } } + + if (session && a_engine) { + check_dtls_reinvite(session, a_engine); + } + goto video; } @@ -4278,7 +4466,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi ICE_GOOGLE_JINGLE, NULL #else - switch_channel_direction(session->channel) == + switch_ice_direction(session) == SWITCH_CALL_DIRECTION_OUTBOUND ? ICE_VANILLA : (ICE_VANILLA | ICE_CONTROLLED), &a_engine->ice_in #endif @@ -4331,7 +4519,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi ICE_GOOGLE_JINGLE, NULL #else - switch_channel_direction(session->channel) == + switch_ice_direction(session) == SWITCH_CALL_DIRECTION_OUTBOUND ? ICE_VANILLA : (ICE_VANILLA | ICE_CONTROLLED), &a_engine->ice_in #endif @@ -4373,6 +4561,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi } } + if (jb_msec < 0 && jb_msec > -10) { + jb_msec = (a_engine->read_codec.implementation->microseconds_per_packet / 1000) * abs(jb_msec); + } + if (jb_msec < 20 || 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); @@ -4535,7 +4727,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi v_engine->codec_params.remote_sdp_port, v_engine->codec_params.agreed_pt, a_engine->read_impl.microseconds_per_packet / 1000); - + start_video_thread(session); switch_rtp_set_default_payload(v_engine->rtp_session, v_engine->codec_params.agreed_pt); } } @@ -4549,7 +4741,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi const char *rport = NULL; switch_port_t remote_rtcp_port = v_engine->remote_rtcp_port; - switch_channel_clear_flag(session->channel, CF_REINVITE); + //switch_channel_clear_flag(session->channel, CF_REINVITE); if (!remote_rtcp_port) { if ((rport = switch_channel_get_variable(session->channel, "rtp_remote_video_rtcp_port"))) { @@ -4568,6 +4760,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi !((val = switch_channel_get_variable(session->channel, "disable_rtp_auto_adjust")) && switch_true(val))) { /* Reactivate the NAT buster flag. */ switch_rtp_set_flag(v_engine->rtp_session, SWITCH_RTP_FLAG_AUTOADJ); + start_video_thread(session); } } @@ -4655,18 +4848,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi if (switch_rtp_ready(v_engine->rtp_session)) { - switch_threadattr_t *thd_attr = NULL; - switch_memory_pool_t *pool = switch_core_session_get_pool(session); - - switch_rtp_set_default_payload(v_engine->rtp_session, v_engine->codec_params.agreed_pt); - v_engine->mh.session = session; - switch_threadattr_create(&thd_attr, pool); - switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE); - - switch_thread_cond_create(&v_engine->mh.cond, pool); - switch_mutex_init(&v_engine->mh.cond_mutex, SWITCH_MUTEX_NESTED, pool); - switch_mutex_init(&v_engine->read_mutex, SWITCH_MUTEX_NESTED, pool); - switch_thread_create(&v_engine->media_thread, thd_attr, video_helper_thread, &v_engine->mh, switch_core_session_get_pool(session)); + start_video_thread(session); } if (switch_rtp_ready(v_engine->rtp_session)) { @@ -4700,7 +4882,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi ICE_GOOGLE_JINGLE, NULL #else - switch_channel_direction(session->channel) == + switch_ice_direction(session) == SWITCH_CALL_DIRECTION_OUTBOUND ? ICE_VANILLA : (ICE_VANILLA | ICE_CONTROLLED), &v_engine->ice_in #endif @@ -4750,7 +4932,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi ICE_GOOGLE_JINGLE, NULL #else - switch_channel_direction(session->channel) == + switch_ice_direction(session) == SWITCH_CALL_DIRECTION_OUTBOUND ? ICE_VANILLA : (ICE_VANILLA | ICE_CONTROLLED), &v_engine->ice_in @@ -4819,6 +5001,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi video_up: + if (session && v_engine) { + check_dtls_reinvite(session, v_engine); + } + status = SWITCH_STATUS_SUCCESS; end: @@ -5275,7 +5461,7 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess switch_channel_clear_flag(smh->session->channel, CF_DTLS); } - if (switch_channel_direction(session->channel) == SWITCH_CALL_DIRECTION_OUTBOUND) { + if (switch_channel_direction(session->channel) == SWITCH_CALL_DIRECTION_OUTBOUND || switch_channel_test_flag(session->channel, CF_RECOVERING)) { if (!switch_channel_test_flag(session->channel, CF_WEBRTC) && switch_true(switch_channel_get_variable(session->channel, "media_webrtc"))) { switch_channel_set_flag(session->channel, CF_WEBRTC); @@ -5460,6 +5646,10 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess rate = a_engine->codec_params.rm_rate; + //if (!strcasecmp(a_engine->codec_params.rm_encoding, "opus")) { + // a_engine->codec_params.adv_channels = 2; + //} + if (a_engine->codec_params.adv_channels > 1) { switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=rtpmap:%d %s/%d/%d\n", a_engine->codec_params.agreed_pt, a_engine->codec_params.rm_encoding, rate, a_engine->codec_params.adv_channels); @@ -5577,7 +5767,8 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess } - if (a_engine->rtcp_mux < 1 || switch_channel_direction(session->channel) == SWITCH_CALL_DIRECTION_OUTBOUND) { + if (a_engine->rtcp_mux < 1 || switch_channel_direction(session->channel) == SWITCH_CALL_DIRECTION_OUTBOUND || + switch_channel_test_flag(session->channel, CF_RECOVERING)) { switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=candidate:%s 2 %s %u %s %d typ host generation 0\n", tmp1, ice_out->cands[0][0].transport, c2, @@ -5765,7 +5956,7 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess if (v_engine->codec_params.rm_encoding) { const char *of; - + if (!strcasecmp(v_engine->codec_params.rm_encoding, "VP8")) { vp8 = v_engine->codec_params.pt; } @@ -5866,7 +6057,8 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess } - if (switch_channel_direction(session->channel) == SWITCH_CALL_DIRECTION_OUTBOUND && switch_channel_test_flag(smh->session->channel, CF_DTLS)) { + if ((switch_channel_direction(session->channel) == SWITCH_CALL_DIRECTION_OUTBOUND || switch_channel_test_flag(session->channel, CF_RECOVERING)) + && switch_channel_test_flag(smh->session->channel, CF_DTLS)) { generate_local_fingerprint(smh, SWITCH_MEDIA_TYPE_VIDEO); } @@ -5949,7 +6141,8 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess } - if (v_engine->rtcp_mux < 1 || switch_channel_direction(session->channel) == SWITCH_CALL_DIRECTION_OUTBOUND) { + if (v_engine->rtcp_mux < 1 || switch_channel_direction(session->channel) == SWITCH_CALL_DIRECTION_OUTBOUND || + switch_channel_test_flag(session->channel, CF_RECOVERING)) { switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=candidate:%s 2 %s %u %s %d typ host generation 0\n", tmp1, ice_out->cands[0][0].transport, c2, @@ -7607,8 +7800,6 @@ SWITCH_DECLARE (void) switch_core_media_recover_session(switch_core_session_t *s ip = switch_channel_get_variable(session->channel, SWITCH_LOCAL_MEDIA_IP_VARIABLE); port = switch_channel_get_variable(session->channel, SWITCH_LOCAL_MEDIA_PORT_VARIABLE); - switch_channel_set_flag(session->channel, CF_RECOVERING); - if (switch_channel_test_flag(session->channel, CF_PROXY_MODE) || !(ip && port)) { return; } else { @@ -7728,7 +7919,7 @@ SWITCH_DECLARE (void) switch_core_media_recover_session(switch_core_session_t *s switch_core_session_get_recovery_crypto_key(session, SWITCH_MEDIA_TYPE_VIDEO); - if ((tmp = switch_channel_get_variable(session->channel, "rtp_last_audio_local_crypto_key"))) { + if ((tmp = switch_channel_get_variable(session->channel, "rtp_last_audio_local_crypto_key")) && a_engine->ssec.remote_crypto_key) { int idx = atoi(tmp); a_engine->ssec.local_crypto_key = switch_core_session_strdup(session, tmp); diff --git a/src/switch_core_session.c b/src/switch_core_session.c index 430b20d013..a08b548fee 100644 --- a/src/switch_core_session.c +++ b/src/switch_core_session.c @@ -445,17 +445,26 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_event_send(const char *uuid_ } -SWITCH_DECLARE(void *) switch_core_session_get_private(switch_core_session_t *session) +SWITCH_DECLARE(void *) switch_core_session_get_private_class(switch_core_session_t *session, switch_pvt_class_t index) { + if (index >= SWITCH_CORE_SESSION_MAX_PRIVATES) { + return NULL; + } + switch_assert(session != NULL); - return session->private_info; + return session->private_info[index]; } -SWITCH_DECLARE(switch_status_t) switch_core_session_set_private(switch_core_session_t *session, void *private_info) +SWITCH_DECLARE(switch_status_t) switch_core_session_set_private_class(switch_core_session_t *session, void *private_info, switch_pvt_class_t index) { switch_assert(session != NULL); - session->private_info = private_info; + + if (index >= SWITCH_CORE_SESSION_MAX_PRIVATES) { + return SWITCH_STATUS_FALSE; + } + + session->private_info[index] = private_info; return SWITCH_STATUS_SUCCESS; } @@ -516,8 +525,17 @@ SWITCH_DECLARE(switch_call_cause_t) switch_core_session_outgoing_channel(switch_ } if (caller_profile) { + const char *eani = NULL, *eaniii = NULL; const char *ecaller_id_name = NULL, *ecaller_id_number = NULL; + if (!(flags & SOF_NO_EFFECTIVE_ANI)) { + eani = switch_channel_get_variable(channel, "effective_ani"); + } + + if (!(flags & SOF_NO_EFFECTIVE_ANIII)) { + eaniii = switch_channel_get_variable(channel, "effective_aniii"); + } + if (!(flags & SOF_NO_EFFECTIVE_CID_NAME)) { ecaller_id_name = switch_channel_get_variable(channel, "effective_caller_id_name"); } @@ -526,9 +544,15 @@ SWITCH_DECLARE(switch_call_cause_t) switch_core_session_outgoing_channel(switch_ ecaller_id_number = switch_channel_get_variable(channel, "effective_caller_id_number"); } - if (ecaller_id_name || ecaller_id_number) { + if (eani || eaniii || ecaller_id_name || ecaller_id_number) { outgoing_profile = switch_caller_profile_clone(session, caller_profile); + if (eani) { + outgoing_profile->ani = eani; + } + if (eaniii) { + outgoing_profile->aniii = eaniii; + } if (ecaller_id_name) { outgoing_profile->caller_id_name = ecaller_id_name; } diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index a9c8d22fbc..7dd02df818 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -2717,14 +2717,35 @@ static int recover_callback(void *pArg, int argc, char **argv, char **columnName if (ep->recover_callback) { switch_caller_extension_t *extension = NULL; + switch_channel_t *channel = switch_core_session_get_channel(session); + int r = 0; + if ((r = ep->recover_callback(session)) > 0) { + const char *cbname; - if (ep->recover_callback(session) > 0) { - switch_channel_t *channel = switch_core_session_get_channel(session); + switch_channel_set_flag(session->channel, CF_RECOVERING); + if (switch_channel_get_partner_uuid(channel)) { switch_channel_set_flag(channel, CF_RECOVERING_BRIDGE); - } else { + } + + switch_core_media_recover_session(session); + + if ((cbname = switch_channel_get_variable(channel, "secondary_recovery_module"))) { + switch_core_recover_callback_t recover_callback; + + if ((recover_callback = switch_core_get_secondary_recover_callback(cbname))) { + r = recover_callback(session); + } + } + + + } + + if (r > 0) { + + if (!switch_channel_test_flag(channel, CF_RECOVERING_BRIDGE)) { switch_xml_t callflow, param, x_extension; if ((extension = switch_caller_extension_new(session, "recovery", "recovery")) == 0) { abort(); diff --git a/src/switch_core_state_machine.c b/src/switch_core_state_machine.c index 5926e52586..6de6b9798e 100644 --- a/src/switch_core_state_machine.c +++ b/src/switch_core_state_machine.c @@ -38,6 +38,16 @@ static void switch_core_standard_on_init(switch_core_session_t *session) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Standard INIT\n", switch_channel_get_name(session->channel)); + + if (switch_channel_test_flag(session->channel, CF_RECOVERING_BRIDGE)) { + switch_channel_set_state(session->channel, CS_RESET); + } else { + if (switch_channel_test_flag(session->channel, CF_RECOVERING)) { + switch_channel_set_state(session->channel, CS_EXECUTE); + } else { + switch_channel_set_state(session->channel, CS_ROUTING); + } + } } static void switch_core_standard_on_hangup(switch_core_session_t *session) @@ -104,6 +114,43 @@ static void switch_core_standard_on_reset(switch_core_session_t *session) switch_channel_set_variable(session->channel, "call_uuid", switch_core_session_get_uuid(session)); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Standard RESET\n", switch_channel_get_name(session->channel)); + + if (switch_channel_test_flag(session->channel, CF_RECOVERING_BRIDGE)) { + switch_core_session_t *other_session = NULL; + const char *uuid = switch_core_session_get_uuid(session); + + if (switch_channel_test_flag(session->channel, CF_BRIDGE_ORIGINATOR)) { + const char *other_uuid = switch_channel_get_partner_uuid(session->channel); + int x = 0; + + if (other_uuid) { + for (x = 0; other_session == NULL && x < 20; x++) { + if (!switch_channel_up(session->channel)) { + break; + } + other_session = switch_core_session_locate(other_uuid); + switch_yield(100000); + } + } + + if (other_session) { + switch_channel_t *other_channel = switch_core_session_get_channel(other_session); + switch_channel_clear_flag(session->channel, CF_BRIDGE_ORIGINATOR); + switch_channel_wait_for_state_timeout(other_channel, CS_RESET, 5000); + switch_channel_wait_for_flag(other_channel, CF_MEDIA_ACK, SWITCH_TRUE, 2000, NULL); + + if (switch_channel_test_flag(session->channel, CF_PROXY_MODE) && switch_channel_test_flag(other_channel, CF_PROXY_MODE)) { + switch_ivr_signal_bridge(session, other_session); + } else { + switch_ivr_uuid_bridge(uuid, other_uuid); + } + switch_core_session_rwunlock(other_session); + } + } + + switch_channel_clear_flag(session->channel, CF_RECOVERING_BRIDGE); + } + } static void switch_core_standard_on_routing(switch_core_session_t *session) @@ -208,6 +255,8 @@ static void switch_core_standard_on_execute(switch_core_session_t *session) switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Standard EXECUTE\n", switch_channel_get_name(session->channel)); + switch_channel_clear_flag(session->channel, CF_RECOVERING); + switch_channel_set_variable(session->channel, "call_uuid", switch_core_session_get_uuid(session)); if (switch_channel_get_variable(session->channel, "recovered") && !switch_channel_test_flag(session->channel, CF_RECOVERED)) { diff --git a/src/switch_event.c b/src/switch_event.c index 080a331dcd..0a0a532628 100644 --- a/src/switch_event.c +++ b/src/switch_event.c @@ -67,6 +67,16 @@ struct switch_event_subclass { int bind; }; + +static struct { + switch_event_channel_id_t ID; + switch_thread_rwlock_t *rwlock; + switch_hash_t *hash; + switch_hash_t *perm_hash; + switch_hash_t *lahash; + switch_mutex_t *lamutex; +} event_channel_manager; + #define MAX_DISPATCH_VAL 64 static unsigned int MAX_DISPATCH = MAX_DISPATCH_VAL; static unsigned int SOFT_MAX_DISPATCH = 0; @@ -81,10 +91,12 @@ static switch_memory_pool_t *THRUNTIME_POOL = NULL; static switch_thread_t *EVENT_DISPATCH_QUEUE_THREADS[MAX_DISPATCH_VAL] = { 0 }; static uint8_t EVENT_DISPATCH_QUEUE_RUNNING[MAX_DISPATCH_VAL] = { 0 }; static switch_queue_t *EVENT_DISPATCH_QUEUE = NULL; +static switch_queue_t *EVENT_CHANNEL_DISPATCH_QUEUE = NULL; static switch_mutex_t *EVENT_QUEUE_MUTEX = NULL; static switch_hash_t *CUSTOM_HASH = NULL; static int THREAD_COUNT = 0; static int DISPATCH_THREAD_COUNT = 0; +static int EVENT_CHANNEL_DISPATCH_THREAD_COUNT = 0; static int SYSTEM_RUNNING = 0; static uint64_t EVENT_SEQUENCE_NR = 0; #ifdef SWITCH_EVENT_RECYCLE @@ -92,6 +104,8 @@ static switch_queue_t *EVENT_RECYCLE_QUEUE = NULL; static switch_queue_t *EVENT_HEADER_RECYCLE_QUEUE = NULL; #endif +static void unsub_all_switch_event_channel(void); + static char *my_dup(const char *s) { size_t len = strlen(s) + 1; @@ -518,6 +532,13 @@ SWITCH_DECLARE(switch_status_t) switch_event_shutdown(void) SYSTEM_RUNNING = 0; switch_mutex_unlock(EVENT_QUEUE_MUTEX); + unsub_all_switch_event_channel(); + + if (EVENT_CHANNEL_DISPATCH_QUEUE) { + switch_queue_trypush(EVENT_CHANNEL_DISPATCH_QUEUE, NULL); + switch_queue_interrupt_all(EVENT_CHANNEL_DISPATCH_QUEUE); + } + if (runtime.events_use_dispatch) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Stopping dispatch queues\n"); @@ -565,6 +586,10 @@ SWITCH_DECLARE(switch_status_t) switch_event_shutdown(void) } } + switch_core_hash_destroy(&event_channel_manager.lahash); + switch_core_hash_destroy(&event_channel_manager.hash); + switch_core_hash_destroy(&event_channel_manager.perm_hash); + switch_core_hash_destroy(&CUSTOM_HASH); switch_core_memory_reclaim_events(); @@ -633,14 +658,6 @@ SWITCH_DECLARE(void) switch_event_launch_dispatch_threads(uint32_t max) SWITCH_DECLARE(switch_status_t) switch_event_init(switch_memory_pool_t *pool) { - //switch_threadattr_t *thd_attr; - - /* - This statement doesn't do anything commenting it out for now. - - switch_assert(switch_arraylen(EVENT_NAMES) == SWITCH_EVENT_ALL + 1); - */ - /* don't need any more dispatch threads than we have CPU's*/ MAX_DISPATCH = (switch_core_cpu_count() / 2) + 1; if (MAX_DISPATCH < 2) { @@ -656,6 +673,14 @@ SWITCH_DECLARE(switch_status_t) switch_event_init(switch_memory_pool_t *pool) switch_mutex_init(&EVENT_QUEUE_MUTEX, SWITCH_MUTEX_NESTED, RUNTIME_POOL); switch_core_hash_init(&CUSTOM_HASH, RUNTIME_POOL); + switch_core_hash_init(&event_channel_manager.lahash, RUNTIME_POOL); + switch_mutex_init(&event_channel_manager.lamutex, SWITCH_MUTEX_NESTED, RUNTIME_POOL); + + switch_thread_rwlock_create(&event_channel_manager.rwlock, RUNTIME_POOL); + switch_core_hash_init(&event_channel_manager.hash, RUNTIME_POOL); + switch_core_hash_init(&event_channel_manager.perm_hash, RUNTIME_POOL); + event_channel_manager.ID = 1; + switch_mutex_lock(EVENT_QUEUE_MUTEX); SYSTEM_RUNNING = -1; switch_mutex_unlock(EVENT_QUEUE_MUTEX); @@ -1733,13 +1758,11 @@ SWITCH_DECLARE(switch_status_t) switch_event_create_json(switch_event_t **event, return SWITCH_STATUS_SUCCESS; } -SWITCH_DECLARE(switch_status_t) switch_event_serialize_json(switch_event_t *event, char **str) +SWITCH_DECLARE(switch_status_t) switch_event_serialize_json_obj(switch_event_t *event, cJSON **json) { switch_event_header_t *hp; cJSON *cj; - *str = NULL; - cj = cJSON_CreateObject(); for (hp = event->headers; hp; hp = hp->next) { @@ -1768,12 +1791,27 @@ SWITCH_DECLARE(switch_status_t) switch_event_serialize_json(switch_event_t *even cJSON_AddItemToObject(cj, "_body", cJSON_CreateString(event->body)); } - *str = cJSON_Print(cj); - cJSON_Delete(cj); + *json = cj; return SWITCH_STATUS_SUCCESS; } +SWITCH_DECLARE(switch_status_t) switch_event_serialize_json(switch_event_t *event, char **str) +{ + + cJSON *cj; + *str = NULL; + + if (switch_event_serialize_json_obj(event, &cj) == SWITCH_STATUS_SUCCESS) { + *str = cJSON_PrintUnformatted(cj); + cJSON_Delete(cj); + + return SWITCH_STATUS_SUCCESS; + } + + return SWITCH_STATUS_FALSE; +} + static switch_xml_t add_xml_header(switch_xml_t xml, char *name, char *value, int offset) { switch_xml_t header = switch_xml_add_child_d(xml, name, offset); @@ -2528,6 +2566,36 @@ SWITCH_DECLARE(int) switch_event_check_permission_list(switch_event_t *list, con return r; } +SWITCH_DECLARE(void) switch_json_add_presence_data_cols(switch_event_t *event, cJSON *json, const char *prefix) +{ + const char *data; + + if (!prefix) prefix = ""; + + if ((data = switch_event_get_header(event, "presence_data_cols"))) { + char *cols[128] = { 0 }; + char header_name[128] = ""; + int col_count = 0, i = 0; + char *data_copy = NULL; + + data_copy = strdup(data); + + col_count = switch_split(data_copy, ':', cols); + + for (i = 0; i < col_count; i++) { + const char *val = NULL; + switch_snprintf(header_name, sizeof(header_name), "%s%s", prefix, cols[i]); + + val = switch_event_get_header(event, cols[i]); + json_add_child_string(json, header_name, val); + } + + switch_safe_free(data_copy); + } + +} + + SWITCH_DECLARE(void) switch_event_add_presence_data_cols(switch_channel_t *channel, switch_event_t *event, const char *prefix) { const char *data; @@ -2557,6 +2625,954 @@ SWITCH_DECLARE(void) switch_event_add_presence_data_cols(switch_channel_t *chann } +struct switch_event_channel_sub_node_head_s; + +typedef struct switch_event_channel_sub_node_s { + switch_event_channel_func_t func; + switch_event_channel_id_t id; + struct switch_event_channel_sub_node_head_s *head; + struct switch_event_channel_sub_node_s *next; +} switch_event_channel_sub_node_t; + +typedef struct switch_event_channel_sub_node_head_s { + switch_event_channel_sub_node_t *node; + switch_event_channel_sub_node_t *tail; + char *event_channel; +} switch_event_channel_sub_node_head_t; + +static uint32_t switch_event_channel_unsub_head(switch_event_channel_func_t func, switch_event_channel_sub_node_head_t *head) +{ + uint32_t x = 0; + + switch_event_channel_sub_node_t *thisnp = NULL, *np, *last = NULL; + + np = head->tail = head->node; + + while (np) { + + thisnp = np; + np = np->next; + + if (!func || thisnp->func == func) { + x++; + + if (last) { + last->next = np; + } else { + head->node = np; + } + + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "UNSUBBING %p [%s]\n", (void *)(intptr_t)thisnp->func, thisnp->head->event_channel); + + + thisnp->func = NULL; + free(thisnp); + } else { + last = thisnp; + head->tail = last; + } + } + + return x; +} + +static void unsub_all_switch_event_channel(void) +{ + switch_hash_index_t *hi; + const void *var; + void *val; + switch_event_channel_sub_node_head_t *head; + + switch_thread_rwlock_wrlock(event_channel_manager.rwlock); + + while ((hi = switch_hash_first(NULL, event_channel_manager.perm_hash))) { + switch_event_t *vals = NULL; + switch_hash_this(hi, &var, NULL, &val); + vals = (switch_event_t *) val; + switch_core_hash_delete(event_channel_manager.perm_hash, var); + switch_event_destroy(&vals); + } + + while ((hi = switch_hash_first(NULL, event_channel_manager.hash))) { + switch_hash_this(hi, NULL, NULL, &val); + head = (switch_event_channel_sub_node_head_t *) val; + switch_event_channel_unsub_head(NULL, head); + switch_core_hash_delete(event_channel_manager.hash, head->event_channel); + free(head->event_channel); + free(head); + } + + switch_thread_rwlock_unlock(event_channel_manager.rwlock); +} + +static uint32_t switch_event_channel_unsub_channel(switch_event_channel_func_t func, const char *event_channel) +{ + switch_event_channel_sub_node_head_t *head; + uint32_t x = 0; + + switch_thread_rwlock_wrlock(event_channel_manager.rwlock); + + if (!event_channel) { + switch_hash_index_t *hi; + void *val; + + for (hi = switch_hash_first(NULL, event_channel_manager.hash); hi; hi = switch_hash_next(hi)) { + switch_hash_this(hi, NULL, NULL, &val); + + if (val) { + head = (switch_event_channel_sub_node_head_t *) val; + x += switch_event_channel_unsub_head(func, head); + } + } + + } else { + if ((head = switch_core_hash_find(event_channel_manager.hash, event_channel))) { + x += switch_event_channel_unsub_head(func, head); + } + } + + switch_thread_rwlock_unlock(event_channel_manager.rwlock); + + return x; +} + +static switch_status_t switch_event_channel_sub_channel(const char *event_channel, switch_event_channel_func_t func, switch_event_channel_id_t id) + +{ + switch_event_channel_sub_node_t *node, *np; + switch_event_channel_sub_node_head_t *head; + switch_status_t status = SWITCH_STATUS_FALSE; + + switch_thread_rwlock_wrlock(event_channel_manager.rwlock); + + if (!(head = switch_core_hash_find(event_channel_manager.hash, event_channel))) { + switch_zmalloc(head, sizeof(*head)); + head->event_channel = strdup(event_channel); + switch_core_hash_insert(event_channel_manager.hash, event_channel, head); + + switch_zmalloc(node, sizeof(*node)); + node->func = func; + node->id = id; + + node->head = head; + head->node = node; + head->tail = node; + status = SWITCH_STATUS_SUCCESS; + } else { + int exist = 0; + + for (np = head->node; np; np = np->next) { + if (np->func == func) { + exist = 1; + break; + } + } + + if (!exist) { + switch_zmalloc(node, sizeof(*node)); + + node->func = func; + node->id = id; + node->head = head; + + + if (!head->node) { + head->node = node; + head->tail = node; + } else { + head->tail->next = node; + head->tail = head->tail->next; + } + status = SWITCH_STATUS_SUCCESS; + } + } + + switch_thread_rwlock_unlock(event_channel_manager.rwlock); + + return status; +} + +typedef struct { + char *event_channel; + cJSON *json; + char *key; + switch_event_channel_id_t id; +} event_channel_data_t; + + + +static uint32_t _switch_event_channel_broadcast(const char *event_channel, const char *broadcast_channel, + cJSON *json, const char *key, switch_event_channel_id_t id) +{ + switch_event_channel_sub_node_t *np; + switch_event_channel_sub_node_head_t *head; + uint32_t x = 0; + + switch_thread_rwlock_rdlock(event_channel_manager.rwlock); + if ((head = switch_core_hash_find(event_channel_manager.hash, event_channel))) { + for (np = head->node; np; np = np->next) { + if (np->id == id) { + continue; + } + np->func(broadcast_channel, json, key, id); + x++; + } + } + switch_thread_rwlock_unlock(event_channel_manager.rwlock); + + return x; +} + +static void destroy_ecd(event_channel_data_t **ecdP) +{ + event_channel_data_t *ecd = *ecdP; + *ecdP = NULL; + + switch_safe_free(ecd->event_channel); + switch_safe_free(ecd->key); + if (ecd->json) { + cJSON_Delete(ecd->json); + ecd->json = NULL; + } + + free(ecd); +} + +static void ecd_deliver(event_channel_data_t **ecdP) +{ + event_channel_data_t *ecd = *ecdP; + char *p; + + *ecdP = NULL; + + _switch_event_channel_broadcast(ecd->event_channel, ecd->event_channel, ecd->json, ecd->key, ecd->id); + + if ((p = strchr(ecd->event_channel, '.'))) { + char *main_channel = strdup(ecd->event_channel); + p = strchr(main_channel, '.'); + *p = '\0'; + _switch_event_channel_broadcast(main_channel, ecd->event_channel, ecd->json, ecd->key, ecd->id); + free(main_channel); + } + _switch_event_channel_broadcast(SWITCH_EVENT_CHANNEL_GLOBAL, ecd->event_channel, ecd->json, ecd->key, ecd->id); + + destroy_ecd(&ecd); +} + +static void *SWITCH_THREAD_FUNC switch_event_channel_deliver_thread(switch_thread_t *thread, void *obj) +{ + switch_queue_t *queue = (switch_queue_t *) obj; + void *pop = NULL; + event_channel_data_t *ecd = NULL; + + switch_mutex_lock(EVENT_QUEUE_MUTEX); + THREAD_COUNT++; + EVENT_CHANNEL_DISPATCH_THREAD_COUNT++; + switch_mutex_unlock(EVENT_QUEUE_MUTEX); + + while(SYSTEM_RUNNING) { + + if (switch_queue_pop(queue, &pop) != SWITCH_STATUS_SUCCESS) { + continue; + } + + if (!pop) { + break; + } + + ecd = (event_channel_data_t *) pop; + ecd_deliver(&ecd); + switch_os_yield(); + } + + while (switch_queue_trypop(queue, &pop) == SWITCH_STATUS_SUCCESS) { + ecd = (event_channel_data_t *) pop; + destroy_ecd(&ecd); + } + + switch_mutex_lock(EVENT_QUEUE_MUTEX); + THREAD_COUNT--; + EVENT_CHANNEL_DISPATCH_THREAD_COUNT--; + switch_mutex_unlock(EVENT_QUEUE_MUTEX); + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Event Channel Dispatch Thread Ended.\n"); + return NULL; +} + +SWITCH_DECLARE(switch_status_t) switch_event_channel_broadcast(const char *event_channel, cJSON **json, const char *key, switch_event_channel_id_t id) +{ + event_channel_data_t *ecd = NULL; + switch_status_t status = SWITCH_STATUS_SUCCESS; + + if (!SYSTEM_RUNNING) { + cJSON_Delete(*json); + *json = NULL; + return SWITCH_STATUS_FALSE; + } + + switch_zmalloc(ecd, sizeof(*ecd)); + + ecd->event_channel = strdup(event_channel); + ecd->json = *json; + ecd->key = strdup(key); + ecd->id = id; + + *json = NULL; + + if (!EVENT_CHANNEL_DISPATCH_THREAD_COUNT && SYSTEM_RUNNING) { + switch_thread_data_t *td; + + if (!EVENT_CHANNEL_DISPATCH_QUEUE) { + switch_queue_create(&EVENT_CHANNEL_DISPATCH_QUEUE, DISPATCH_QUEUE_LEN * MAX_DISPATCH, THRUNTIME_POOL); + } + + td = malloc(sizeof(*td)); + switch_assert(td); + + td->alloc = 1; + td->func = switch_event_channel_deliver_thread; + td->obj = EVENT_CHANNEL_DISPATCH_QUEUE; + td->pool = NULL; + + switch_thread_pool_launch_thread(&td); + } + + if ((status = switch_queue_trypush(EVENT_CHANNEL_DISPATCH_QUEUE, ecd) != SWITCH_STATUS_SUCCESS)) { + cJSON_Delete(ecd->json); + ecd->json = NULL; + destroy_ecd(&ecd); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Event Channel Queue failure for channel %s\n", event_channel); + } else { + ecd = NULL; + } + + return status; +} + +SWITCH_DECLARE(uint32_t) switch_event_channel_unbind(const char *event_channel, switch_event_channel_func_t func) +{ + return switch_event_channel_unsub_channel(func, event_channel); +} + +SWITCH_DECLARE(switch_status_t) switch_event_channel_bind(const char *event_channel, switch_event_channel_func_t func, switch_event_channel_id_t *id) + +{ + switch_status_t status = SWITCH_STATUS_SUCCESS; + + switch_assert(id); + + if (!*id) { + switch_thread_rwlock_wrlock(event_channel_manager.rwlock); + *id = event_channel_manager.ID++; + switch_thread_rwlock_unlock(event_channel_manager.rwlock); + } + + status = switch_event_channel_sub_channel(event_channel, func, *id); + + return status; +} + +SWITCH_DECLARE(switch_bool_t) switch_event_channel_permission_verify(const char *cookie, const char *event_channel) +{ + switch_event_t *vals; + switch_bool_t r = SWITCH_FALSE; + + switch_thread_rwlock_rdlock(event_channel_manager.rwlock); + if ((vals = switch_core_hash_find(event_channel_manager.perm_hash, cookie))) { + r = switch_true(switch_event_get_header(vals, event_channel)); + } + switch_thread_rwlock_unlock(event_channel_manager.rwlock); + + return r; +} + +SWITCH_DECLARE(void) switch_event_channel_permission_modify(const char *cookie, const char *event_channel, switch_bool_t set) +{ + switch_event_t *vals; + + switch_thread_rwlock_wrlock(event_channel_manager.rwlock); + if (!(vals = switch_core_hash_find(event_channel_manager.perm_hash, cookie))) { + if (!set) goto end; + + switch_event_create_plain(&vals, SWITCH_EVENT_CHANNEL_DATA); + switch_core_hash_insert(event_channel_manager.perm_hash, cookie, vals); + } + + if (set) { + switch_event_add_header_string(vals, SWITCH_STACK_BOTTOM, event_channel, "true"); + } else { + switch_event_del_header(vals, event_channel); + } + + + end: + + switch_thread_rwlock_unlock(event_channel_manager.rwlock); +} + +SWITCH_DECLARE(void) switch_event_channel_permission_clear(const char *cookie) +{ + switch_event_t *vals; + + switch_thread_rwlock_wrlock(event_channel_manager.rwlock); + if ((vals = switch_core_hash_find(event_channel_manager.perm_hash, cookie))) { + switch_core_hash_delete(event_channel_manager.perm_hash, cookie); + switch_event_destroy(&vals); + } + switch_thread_rwlock_unlock(event_channel_manager.rwlock); +} + + +typedef struct alias_node_s { + char *event_channel; + char *name; + char *key; + struct alias_node_s *next; +} alias_node_t; + +typedef struct la_node_s { + char *name; + cJSON *obj; + struct la_node_s *next; + int pos; +} la_node_t; + +struct switch_live_array_s { + char *event_channel; + char *name; + char *key; + la_node_t *head; + la_node_t *tail; + switch_memory_pool_t *pool; + switch_hash_t *hash; + switch_mutex_t *mutex; + uint32_t serno; + int pos; + switch_bool_t visible; + switch_bool_t new; + switch_event_channel_id_t channel_id; + switch_live_array_command_handler_t command_handler; + void *user_data; + alias_node_t *aliases; +}; + +static switch_status_t la_broadcast(switch_live_array_t *la, cJSON **json) +{ + alias_node_t *np; + + if (la->aliases) { + switch_mutex_lock(la->mutex); + for (np = la->aliases; np; np = np->next) { + cJSON *dup = cJSON_Duplicate(*json, 1); + cJSON *data = cJSON_GetObjectItem(dup, "data"); + + cJSON_ReplaceItemInObject(dup, "eventChannel", cJSON_CreateString(np->event_channel)); + cJSON_ReplaceItemInObject(data, "name", cJSON_CreateString(np->name)); + + switch_event_channel_broadcast(np->event_channel, &dup, __FILE__, la->channel_id); + } + switch_mutex_unlock(la->mutex); + } + + return switch_event_channel_broadcast(la->event_channel, json, __FILE__, la->channel_id); + +} + + +SWITCH_DECLARE(switch_status_t) switch_live_array_visible(switch_live_array_t *la, switch_bool_t visible, switch_bool_t force) +{ + switch_status_t status = SWITCH_STATUS_FALSE; + + switch_mutex_lock(la->mutex); + if (la->visible != visible || force) { + cJSON *msg, *data; + + msg = cJSON_CreateObject(); + data = json_add_child_obj(msg, "data", NULL); + + cJSON_AddItemToObject(msg, "eventChannel", cJSON_CreateString(la->event_channel)); + cJSON_AddItemToObject(data, "action", cJSON_CreateString(visible ? "hide" : "show")); + cJSON_AddItemToObject(data, "wireSerno", cJSON_CreateNumber(la->serno++)); + + la_broadcast(la, &msg); + + la->visible = visible; + } + switch_mutex_unlock(la->mutex); + + return status; +} + +SWITCH_DECLARE(switch_status_t) switch_live_array_clear(switch_live_array_t *la) +{ + la_node_t *cur, *np; + cJSON *msg, *data; + + switch_mutex_lock(la->mutex); + np = la->head; + + msg = cJSON_CreateObject(); + data = json_add_child_obj(msg, "data", NULL); + + cJSON_AddItemToObject(msg, "eventChannel", cJSON_CreateString(la->event_channel)); + cJSON_AddItemToObject(data, "action", cJSON_CreateString("clear")); + cJSON_AddItemToObject(data, "name", cJSON_CreateString(la->name)); + cJSON_AddItemToObject(data, "wireSerno", cJSON_CreateNumber(-1)); + cJSON_AddItemToObject(data, "data", cJSON_CreateObject()); + + la_broadcast(la, &msg); + + while(np) { + cur = np; + np = np->next; + cJSON_Delete(cur->obj); + free(cur->name); + free(cur); + } + + la->head = la->tail = NULL; + + switch_mutex_unlock(la->mutex); + + return SWITCH_STATUS_SUCCESS; +} + +SWITCH_DECLARE(switch_status_t) switch_live_array_bootstrap(switch_live_array_t *la, const char *sessid, switch_event_channel_id_t channel_id) +{ + la_node_t *np; + cJSON *msg, *data; + + switch_mutex_lock(la->mutex); + +#if OLD_WAY + msg = cJSON_CreateObject(); + data = json_add_child_obj(msg, "data", NULL); + + cJSON_AddItemToObject(msg, "eventChannel", cJSON_CreateString(la->event_channel)); + cJSON_AddItemToObject(data, "action", cJSON_CreateString("clear")); + cJSON_AddItemToObject(data, "name", cJSON_CreateString(la->name)); + cJSON_AddItemToObject(data, "wireSerno", cJSON_CreateNumber(-1)); + cJSON_AddItemToObject(data, "data", cJSON_CreateObject()); + + switch_event_channel_broadcast(la->event_channel, &msg, __FILE__, channel_id); + + for (np = la->head; np; np = np->next) { + msg = cJSON_CreateObject(); + data = json_add_child_obj(msg, "data", NULL); + + cJSON_AddItemToObject(msg, "eventChannel", cJSON_CreateString(la->event_channel)); + cJSON_AddItemToObject(data, "action", cJSON_CreateString("add")); + cJSON_AddItemToObject(data, "name", cJSON_CreateString(la->name)); + cJSON_AddItemToObject(data, "hashKey", cJSON_CreateString(np->name)); + cJSON_AddItemToObject(data, "wireSerno", cJSON_CreateNumber(la->serno++)); + cJSON_AddItemToObject(data, "data", cJSON_Duplicate(np->obj, 1)); + if (sessid) { + cJSON_AddItemToObject(msg, "sessid", cJSON_CreateString(sessid)); + } + switch_event_channel_broadcast(la->event_channel, &msg, __FILE__, channel_id); + } +#else + + + msg = cJSON_CreateObject(); + data = json_add_child_obj(msg, "data", NULL); + + cJSON_AddItemToObject(msg, "eventChannel", cJSON_CreateString(la->event_channel)); + cJSON_AddItemToObject(data, "action", cJSON_CreateString("bootObj")); + cJSON_AddItemToObject(data, "name", cJSON_CreateString(la->name)); + cJSON_AddItemToObject(data, "wireSerno", cJSON_CreateNumber(la->serno++)); + + if (sessid) { + cJSON_AddItemToObject(msg, "sessid", cJSON_CreateString(sessid)); + } + + data = json_add_child_array(data, "data"); + + for (np = la->head; np; np = np->next) { + cJSON *row = cJSON_CreateArray(); + cJSON_AddItemToArray(row, cJSON_CreateString(np->name)); + cJSON_AddItemToArray(row, cJSON_Duplicate(np->obj, 1)); + cJSON_AddItemToArray(data, row); + } + + switch_event_channel_broadcast(la->event_channel, &msg, __FILE__, channel_id); + + +#endif + + if (!la->visible) { + switch_live_array_visible(la, SWITCH_FALSE, SWITCH_TRUE); + } + + switch_mutex_unlock(la->mutex); + + return SWITCH_STATUS_SUCCESS; +} + +SWITCH_DECLARE(switch_status_t) switch_live_array_destroy(switch_live_array_t **live_arrayP) +{ + switch_live_array_t *la = *live_arrayP; + switch_memory_pool_t *pool; + alias_node_t *np; + + *live_arrayP = NULL; + + pool = la->pool; + + switch_live_array_clear(la); + + switch_core_hash_destroy(&la->hash); + + switch_mutex_lock(event_channel_manager.lamutex); + switch_core_hash_delete(event_channel_manager.lahash, la->key); + for (np = la->aliases; np; np = np->next) { + switch_core_hash_delete(event_channel_manager.lahash, np->key); + } + switch_mutex_unlock(event_channel_manager.lamutex); + + switch_core_destroy_memory_pool(&pool); + + return SWITCH_STATUS_SUCCESS; +} + +SWITCH_DECLARE(switch_bool_t) switch_live_array_isnew(switch_live_array_t *la) +{ + return la->new; +} + +SWITCH_DECLARE(switch_bool_t) switch_live_array_clear_alias(switch_live_array_t *la, const char *event_channel, const char *name) +{ + alias_node_t *np, *last = NULL, *del = NULL; + switch_bool_t r = SWITCH_FALSE; + + switch_mutex_lock(la->mutex); + for (np = la->aliases; np; np = np->next) { + if (!strcmp(np->event_channel, event_channel) && !strcmp(np->name, name)) { + r = SWITCH_TRUE; + del = np; + + if (last) { + last->next = np->next; + } else { + la->aliases = np->next; + } + } else { + last = np; + } + } + switch_mutex_unlock(la->mutex); + + if (r) { + switch_mutex_lock(event_channel_manager.lamutex); + switch_core_hash_delete(event_channel_manager.lahash, del->key); + switch_mutex_unlock(event_channel_manager.lamutex); + } + + + return r; +} + +SWITCH_DECLARE(switch_bool_t) switch_live_array_add_alias(switch_live_array_t *la, const char *event_channel, const char *name) +{ + alias_node_t *node = 0, *np; + switch_bool_t exist = SWITCH_FALSE; + + switch_mutex_lock(la->mutex); + for (np = la->aliases; np && np->next; np = np->next) { + if (!strcmp(np->event_channel, event_channel) && !strcmp(np->name, name)) { + exist = SWITCH_TRUE; + break; + } + } + + if (!exist) { + node = switch_core_alloc(la->pool, sizeof(*node)); + node->event_channel = switch_core_strdup(la->pool, event_channel); + node->name = switch_core_strdup(la->pool, name); + node->key = switch_core_sprintf(la->pool, "%s.%s", event_channel, name); + + if (np) { + np->next = node; + } else { + la->aliases = node; + } + } + + switch_mutex_unlock(la->mutex); + + if (!exist) { + switch_mutex_lock(event_channel_manager.lamutex); + switch_core_hash_insert(event_channel_manager.lahash, node->key, la); + switch_mutex_unlock(event_channel_manager.lamutex); + } + + + return !exist; +} + + +SWITCH_DECLARE(switch_status_t) switch_live_array_create(const char *event_channel, const char *name, + switch_event_channel_id_t channel_id, switch_live_array_t **live_arrayP) +{ + switch_live_array_t *la = NULL; + switch_memory_pool_t *pool; + char *key = NULL; + + switch_core_new_memory_pool(&pool); + key = switch_core_sprintf(pool, "%s.%s", event_channel, name); + + switch_mutex_lock(event_channel_manager.lamutex); + la = switch_core_hash_find(event_channel_manager.lahash, key); + switch_mutex_unlock(event_channel_manager.lamutex); + + if (la) { + la->new = SWITCH_FALSE; + } else { + la = switch_core_alloc(pool, sizeof(*la)); + la->pool = pool; + la->serno = 1; + la->visible = SWITCH_TRUE; + la->event_channel = switch_core_strdup(la->pool, event_channel); + la->name = switch_core_strdup(la->pool, name); + la->key = key; + la->new = SWITCH_TRUE; + la->channel_id = channel_id; + switch_core_hash_init(&la->hash, la->pool); + switch_mutex_init(&la->mutex, SWITCH_MUTEX_NESTED, la->pool); + + switch_mutex_lock(event_channel_manager.lamutex); + switch_core_hash_insert(event_channel_manager.lahash, la->key, la); + switch_mutex_unlock(event_channel_manager.lamutex); + } + + *live_arrayP = la; + + return SWITCH_STATUS_SUCCESS; +} + +SWITCH_DECLARE(cJSON *) switch_live_array_get(switch_live_array_t *la, const char *name) +{ + la_node_t *node; + cJSON *dup = NULL; + + switch_mutex_lock(la->mutex); + if ((node = switch_core_hash_find(la->hash, name))) { + dup = cJSON_Duplicate(node->obj, 1); + } + switch_mutex_unlock(la->mutex); + + return dup; +} + +SWITCH_DECLARE(cJSON *) switch_live_array_get_idx(switch_live_array_t *la, int idx) +{ + la_node_t *node; + cJSON *dup = NULL; + + switch_mutex_lock(la->mutex); + for (node = la->head; node; node = node->next) { + if (node->pos == idx) { + dup = cJSON_Duplicate(node->obj, 1); + break; + } + } + switch_mutex_unlock(la->mutex); + + return dup; +} + +SWITCH_DECLARE(void) switch_live_array_lock(switch_live_array_t *la) +{ + switch_mutex_lock(la->mutex); +} + +SWITCH_DECLARE(void) switch_live_array_unlock(switch_live_array_t *la) +{ + switch_mutex_unlock(la->mutex); +} + +SWITCH_DECLARE(switch_status_t) switch_live_array_del(switch_live_array_t *la, const char *name) +{ + switch_status_t status = SWITCH_STATUS_FALSE; + la_node_t *node, *cur, *np, *last = NULL; + cJSON *msg, *data = NULL; + + switch_mutex_lock(la->mutex); + if ((node = switch_core_hash_find(la->hash, name))) { + np = la->head; + + while(np) { + cur = np; + np = np->next; + + if (cur == node) { + if (last) { + last->next = cur->next; + } else { + la->head = cur->next; + } + switch_core_hash_delete(la->hash, name); + + msg = cJSON_CreateObject(); + data = json_add_child_obj(msg, "data", NULL); + + cJSON_AddItemToObject(msg, "eventChannel", cJSON_CreateString(la->event_channel)); + cJSON_AddItemToObject(data, "name", cJSON_CreateString(la->name)); + cJSON_AddItemToObject(data, "action", cJSON_CreateString("del")); + cJSON_AddItemToObject(data, "hashKey", cJSON_CreateString(cur->name)); + cJSON_AddItemToObject(data, "wireSerno", cJSON_CreateNumber(la->serno++)); + cJSON_AddItemToObject(data, "data", cur->obj); + cur->obj = NULL; + + la_broadcast(la, &msg); + free(cur->name); + free(cur); + } else { + cur->pos = la->pos++; + la->tail = cur; + last = cur; + } + } + } + switch_mutex_unlock(la->mutex); + + return status; +} + +SWITCH_DECLARE(switch_status_t) switch_live_array_add(switch_live_array_t *la, const char *name, int index, cJSON **obj, switch_bool_t duplicate) +{ + la_node_t *node; + switch_status_t status = SWITCH_STATUS_SUCCESS; + const char *action = "add"; + cJSON *msg = NULL, *data = NULL; + + switch_mutex_lock(la->mutex); + + if ((node = switch_core_hash_find(la->hash, name))) { + + action = "modify"; + + if (node->obj) { + if (duplicate) { + cJSON_Delete(node->obj); + node->obj = NULL; + } + } + } else { + switch_zmalloc(node, sizeof(*node)); + + node->name = strdup(name); + switch_core_hash_insert(la->hash, name, node); + + if (index > -1 && index < la->pos && la->head) { + la_node_t *np, *last = NULL; + int i = 0; + + for(np = la->head; np; np = np->next) { + + if (i == index) { + if (last) { + node->next = last->next; + last->next = node; + np = node; + } else { + node->next = la->head; + la->head = node; + np = node; + } + } + + np->pos = i; + la->tail = np; + last = np; + i++; + } + + + } else { + + node->pos = la->pos++; + index = node->pos; + + if (!la->head) { + la->head = node; + } else { + la->tail->next = node; + } + + la->tail = node; + } + } + + if (duplicate) { + node->obj = cJSON_Duplicate(*obj, 1); + } else { + node->obj = *obj; + } + + msg = cJSON_CreateObject(); + data = json_add_child_obj(msg, "data", NULL); + + cJSON_AddItemToObject(msg, "eventChannel", cJSON_CreateString(la->event_channel)); + cJSON_AddItemToObject(data, "action", cJSON_CreateString(action)); + + if (index > -1) { + cJSON_AddItemToObject(data, "arrIndex", cJSON_CreateNumber(index)); + } + + cJSON_AddItemToObject(data, "name", cJSON_CreateString(la->name)); + cJSON_AddItemToObject(data, "hashKey", cJSON_CreateString(node->name)); + cJSON_AddItemToObject(data, "wireSerno", cJSON_CreateNumber(la->serno++)); + cJSON_AddItemToObject(data, "data", cJSON_Duplicate(node->obj, 1)); + + la_broadcast(la, &msg); + + switch_mutex_unlock(la->mutex); + + return status; +} + +SWITCH_DECLARE(void) switch_live_array_set_user_data(switch_live_array_t *la, void *user_data) +{ + switch_assert(la); + la->user_data = user_data; +} + +SWITCH_DECLARE(void) switch_live_array_set_command_handler(switch_live_array_t *la, switch_live_array_command_handler_t command_handler) +{ + switch_assert(la); + la->command_handler = command_handler; +} + + +SWITCH_DECLARE(void) switch_live_array_parse_json(cJSON *json, switch_event_channel_id_t channel_id) +{ + const char *context = NULL, *name = NULL; + switch_live_array_t *la = NULL; + cJSON *jla = NULL; + + if ((jla = cJSON_GetObjectItem(json, "data")) && (jla = cJSON_GetObjectItem(jla, "liveArray"))) { + + if ((context = cJSON_GetObjectCstr(jla, "context")) && (name = cJSON_GetObjectCstr(jla, "name"))) { + const char *command = cJSON_GetObjectCstr(jla, "command"); + const char *sessid = cJSON_GetObjectCstr(json, "sessid"); + + if (command) { + switch_live_array_create(context, name, channel_id, &la); + + if (!strcasecmp(command, "bootstrap")) { + switch_live_array_bootstrap(la, sessid, channel_id); + } else { + if (la->command_handler) { + la->command_handler(la, command, sessid, jla, la->user_data); + } + } + } + } + } + +} /* For Emacs: * Local Variables: diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index 52ef822cad..b30df42a98 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -1487,16 +1487,24 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_enterprise_originate(switch_core_sess } if (channel) { - const char *cid; + const char *tmp_var = NULL; switch_channel_process_export(channel, NULL, var_event, SWITCH_EXPORT_VARS_VARIABLE); - if ((cid = switch_channel_get_variable(channel, "effective_caller_id_name"))) { - switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, "origination_caller_id_name", cid); + if ((tmp_var = switch_channel_get_variable(channel, "effective_ani"))) { + switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, "origination_ani", tmp_var); } - if ((cid = switch_channel_get_variable(channel, "effective_caller_id_number"))) { - switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, "origination_caller_id_number", cid); + if ((tmp_var = switch_channel_get_variable(channel, "effective_aniii"))) { + switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, "origination_aniii", tmp_var); + } + + if ((tmp_var = switch_channel_get_variable(channel, "effective_caller_id_name"))) { + switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, "origination_caller_id_name", tmp_var); + } + + if ((tmp_var = switch_channel_get_variable(channel, "effective_caller_id_number"))) { + switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, "origination_caller_id_number", tmp_var); } } @@ -1891,6 +1899,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess int read_packet = 0; int check_reject = 1; switch_codec_implementation_t read_impl = { 0 }; + const char *ani_override = NULL; + const char *aniii_override = NULL; if (session) { switch_channel_set_variable(switch_core_session_get_channel(session), "originated_legs", NULL); @@ -2342,6 +2352,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess } } + /* variable to force ANI / ANIII */ + ani_override = switch_event_get_header(var_event, "origination_ani"); + aniii_override = switch_event_get_header(var_event, "origination_aniii"); + if ((cid_tmp = switch_event_get_header(var_event, "origination_caller_id_name"))) { cid_name_override = cid_tmp; } @@ -2370,6 +2384,14 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess dftflags |= SOF_NO_LIMITS; } + if (ani_override) { + dftflags |= SOF_NO_EFFECTIVE_ANI; + } + + if (aniii_override) { + dftflags |= SOF_NO_EFFECTIVE_ANIII; + } + if (cid_num_override) { dftflags |= SOF_NO_EFFECTIVE_CID_NUM; } @@ -2542,13 +2564,19 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess new_profile = switch_caller_profile_new(oglobals.pool, NULL, NULL, - cid_name_override, cid_num_override, NULL, NULL, NULL, NULL, __FILE__, NULL, chan_data); + cid_name_override, cid_num_override, NULL, ani_override, aniii_override, NULL, __FILE__, NULL, chan_data); } new_profile->uuid = SWITCH_BLANK_STRING; new_profile->chan_name = SWITCH_BLANK_STRING; new_profile->destination_number = switch_core_strdup(new_profile->pool, chan_data); + if (ani_override) { + new_profile->ani = switch_core_strdup(new_profile->pool, ani_override); + } + if (aniii_override) { + new_profile->aniii = switch_core_strdup(new_profile->pool, aniii_override); + } if (cid_name_override) { new_profile->caller_id_name = switch_core_strdup(new_profile->pool, cid_name_override); } @@ -2572,7 +2600,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess new_profile = switch_caller_profile_new(oglobals.pool, NULL, NULL, - cid_name_override, cid_num_override, NULL, NULL, NULL, NULL, __FILE__, NULL, chan_data); + cid_name_override, cid_num_override, NULL, ani_override, aniii_override, NULL, __FILE__, NULL, chan_data); } } @@ -2615,6 +2643,16 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess switch_event_merge(originate_var_event, local_var_event); } + if ((current_variable = switch_event_get_header(originate_var_event, "origination_ani"))) { + new_profile->ani = switch_core_strdup(new_profile->pool, current_variable); + myflags |= SOF_NO_EFFECTIVE_ANI; + } + + if ((current_variable = switch_event_get_header(originate_var_event, "origination_aniii"))) { + new_profile->aniii = switch_core_strdup(new_profile->pool, current_variable); + myflags |= SOF_NO_EFFECTIVE_ANIII; + } + if ((current_variable = switch_event_get_header(originate_var_event, "origination_caller_id_number"))) { new_profile->caller_id_number = switch_core_strdup(new_profile->pool, current_variable); myflags |= SOF_NO_EFFECTIVE_CID_NUM; diff --git a/src/switch_json.c b/src/switch_json.c index 3819cda2d2..4467692dba 100644 --- a/src/switch_json.c +++ b/src/switch_json.c @@ -487,7 +487,20 @@ static char *print_object(cJSON *item,int depth,int fmt) /* Get Array size/item / object item. */ SWITCH_DECLARE(int) cJSON_GetArraySize(cJSON *array) {cJSON *c=array->child;int i=0;while(c)i++,c=c->next;return i;} SWITCH_DECLARE(cJSON *)cJSON_GetArrayItem(cJSON *array,int item) {cJSON *c=array->child; while (c && item>0) item--,c=c->next; return c;} -SWITCH_DECLARE(cJSON *)cJSON_GetObjectItem(cJSON *object,const char *string) {cJSON *c=object->child; while (c && cJSON_strcasecmp(c->string,string)) c=c->next; return c;} +SWITCH_DECLARE(cJSON *)cJSON_GetObjectItem(const cJSON *object,const char *string) {cJSON *c=object->child; while (c && cJSON_strcasecmp(c->string,string)) c=c->next; return c;} + + +SWITCH_DECLARE(const char *)cJSON_GetObjectCstr(const cJSON *object, const char *string) +{ + cJSON *cj = cJSON_GetObjectItem(object, string); + + if (!cj || cj->type != cJSON_String || !cj->valuestring) return NULL; + + return cj->valuestring; +} + + + /* Utility for array list handling. */ static void suffix_object(cJSON *prev,cJSON *item) {prev->next=item;item->prev=prev;} @@ -554,3 +567,27 @@ SWITCH_DECLARE(cJSON *) cJSON_Duplicate(cJSON *item,int recurse) } return newitem; } + + +SWITCH_DECLARE(cJSON *) cJSON_CreateStringPrintf(const char *fmt, ...) +{ + va_list ap; + char *str; + cJSON *item; + + va_start(ap, fmt); + str = switch_vmprintf(fmt, ap); + va_end(ap); + + if (!str) return NULL; + + if ((item = cJSON_New_Item())) { + item->type=cJSON_String; + item->valuestring = str; + } else { + free(str); + } + + return item; +} + diff --git a/src/switch_loadable_module.c b/src/switch_loadable_module.c index 8ffe90ea11..c9fdda1da7 100644 --- a/src/switch_loadable_module.c +++ b/src/switch_loadable_module.c @@ -65,6 +65,7 @@ struct switch_loadable_module_container { switch_hash_t *application_hash; switch_hash_t *chat_application_hash; switch_hash_t *api_hash; + switch_hash_t *json_api_hash; switch_hash_t *file_hash; switch_hash_t *speech_hash; switch_hash_t *asr_hash; @@ -73,6 +74,7 @@ struct switch_loadable_module_container { switch_hash_t *say_hash; switch_hash_t *management_hash; switch_hash_t *limit_hash; + switch_hash_t *secondary_recover_hash; switch_mutex_t *mutex; switch_memory_pool_t *pool; }; @@ -318,6 +320,29 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable } } + if (new_module->module_interface->json_api_interface) { + const switch_json_api_interface_t *ptr; + + for (ptr = new_module->module_interface->json_api_interface; ptr; ptr = ptr->next) { + if (!ptr->interface_name) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Failed to load JSON api interface from %s due to no interface name.\n", key); + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding JSON API Function '%s'\n", ptr->interface_name); + if (switch_event_create(&event, SWITCH_EVENT_MODULE_LOAD) == SWITCH_STATUS_SUCCESS) { + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "type", "json_api"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "name", ptr->interface_name); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "description", switch_str_nil(ptr->desc)); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "syntax", switch_str_nil(ptr->syntax)); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "key", new_module->key); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "filename", new_module->filename); + switch_event_fire(&event); + added++; + } + switch_core_hash_insert(loadable_modules.json_api_hash, ptr->interface_name, (const void *) ptr); + } + } + } + if (new_module->module_interface->file_interface) { const switch_file_interface_t *ptr; @@ -1047,6 +1072,36 @@ static switch_status_t switch_loadable_module_unprocess(switch_loadable_module_t } } + if (old_module->module_interface->json_api_interface) { + const switch_json_api_interface_t *ptr; + + for (ptr = old_module->module_interface->json_api_interface; ptr; ptr = ptr->next) { + if (ptr->interface_name) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Deleting API Function '%s'\n", ptr->interface_name); + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Write lock interface '%s' to wait for existing references.\n", + ptr->interface_name); + + if (switch_thread_rwlock_trywrlock_timeout(ptr->rwlock, 10) == SWITCH_STATUS_SUCCESS) { + switch_thread_rwlock_unlock(ptr->rwlock); + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Giving up on '%s' waiting for existing references.\n", ptr->interface_name); + } + + + if (switch_event_create(&event, SWITCH_EVENT_MODULE_UNLOAD) == SWITCH_STATUS_SUCCESS) { + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "type", "api"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "name", ptr->interface_name); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "description", switch_str_nil(ptr->desc)); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "syntax", switch_str_nil(ptr->syntax)); + switch_event_fire(&event); + removed++; + } + switch_core_hash_delete(loadable_modules.json_api_hash, ptr->interface_name); + } + } + } + if (old_module->module_interface->file_interface) { const switch_file_interface_t *ptr; @@ -1721,6 +1776,7 @@ SWITCH_DECLARE(switch_status_t) switch_loadable_module_init(switch_bool_t autolo switch_core_hash_init_nocase(&loadable_modules.application_hash, loadable_modules.pool); switch_core_hash_init_nocase(&loadable_modules.chat_application_hash, loadable_modules.pool); switch_core_hash_init_nocase(&loadable_modules.api_hash, loadable_modules.pool); + switch_core_hash_init_nocase(&loadable_modules.json_api_hash, loadable_modules.pool); switch_core_hash_init(&loadable_modules.file_hash, loadable_modules.pool); switch_core_hash_init_nocase(&loadable_modules.speech_hash, loadable_modules.pool); switch_core_hash_init_nocase(&loadable_modules.asr_hash, loadable_modules.pool); @@ -1730,6 +1786,7 @@ SWITCH_DECLARE(switch_status_t) switch_loadable_module_init(switch_bool_t autolo switch_core_hash_init_nocase(&loadable_modules.management_hash, loadable_modules.pool); switch_core_hash_init_nocase(&loadable_modules.limit_hash, loadable_modules.pool); switch_core_hash_init_nocase(&loadable_modules.dialplan_hash, loadable_modules.pool); + switch_core_hash_init(&loadable_modules.secondary_recover_hash, loadable_modules.pool); switch_mutex_init(&loadable_modules.mutex, SWITCH_MUTEX_NESTED, loadable_modules.pool); if (!autoload) return SWITCH_STATUS_SUCCESS; @@ -1945,6 +2002,7 @@ SWITCH_DECLARE(void) switch_loadable_module_shutdown(void) switch_core_hash_destroy(&loadable_modules.application_hash); switch_core_hash_destroy(&loadable_modules.chat_application_hash); switch_core_hash_destroy(&loadable_modules.api_hash); + switch_core_hash_destroy(&loadable_modules.json_api_hash); switch_core_hash_destroy(&loadable_modules.file_hash); switch_core_hash_destroy(&loadable_modules.speech_hash); switch_core_hash_destroy(&loadable_modules.asr_hash); @@ -2014,6 +2072,7 @@ HASH_FUNC(timer) HASH_FUNC(application) HASH_FUNC(chat_application) HASH_FUNC(api) +HASH_FUNC(json_api) HASH_FUNC(file) HASH_FUNC(speech) HASH_FUNC(asr) @@ -2369,6 +2428,46 @@ SWITCH_DECLARE(switch_status_t) switch_api_execute(const char *cmd, const char * return status; } +SWITCH_DECLARE(switch_status_t) switch_json_api_execute(cJSON *json, switch_core_session_t *session, cJSON **retval) +{ + switch_json_api_interface_t *json_api; + switch_status_t status; + cJSON *function, *json_reply = NULL; + + switch_assert(json); + + function = cJSON_GetObjectItem(json, "command"); + + if (function && function->valuestring + && cJSON_GetObjectItem(json, "data") && (json_api = switch_loadable_module_get_json_api_interface(function->valuestring)) != 0) { + if ((status = json_api->function(json, session, &json_reply)) != SWITCH_STATUS_SUCCESS) { + cJSON_AddItemToObject(json, "status", cJSON_CreateString("error")); + cJSON_AddItemToObject(json, "message", cJSON_CreateString("The command returned an error")); + } else { + cJSON_AddItemToObject(json, "status", cJSON_CreateString("success")); + } + + if (!json_reply) { + json_reply = cJSON_CreateNull(); + } + + if (retval) { + *retval = json_reply; + } else { + cJSON_AddItemToObject(json, "response", json_reply); + } + + UNPROTECT_INTERFACE(json_api); + } else { + status = SWITCH_STATUS_FALSE; + cJSON_AddItemToObject(json, "status", cJSON_CreateString("error")); + cJSON_AddItemToObject(json, "message", cJSON_CreateString("Invalid request or non-existant command")); + cJSON_AddItemToObject(json, "response", cJSON_CreateNull()); + } + + return status; +} + SWITCH_DECLARE(switch_loadable_module_interface_t *) switch_loadable_module_create_module_interface(switch_memory_pool_t *pool, const char *name) { @@ -2425,6 +2524,9 @@ SWITCH_DECLARE(void *) switch_loadable_module_create_interface(switch_loadable_m case SWITCH_API_INTERFACE: ALLOC_INTERFACE(api) + case SWITCH_JSON_API_INTERFACE: + ALLOC_INTERFACE(json_api) + case SWITCH_FILE_INTERFACE: ALLOC_INTERFACE(file) @@ -2549,7 +2651,42 @@ SWITCH_DECLARE(void) switch_say_file(switch_say_file_handle_t *sh, const char *f va_end(ap); } +SWITCH_DECLARE(switch_core_recover_callback_t) switch_core_get_secondary_recover_callback(const char *key) +{ + switch_core_recover_callback_t cb; + switch_mutex_lock(loadable_modules.mutex); + cb = (switch_core_recover_callback_t) (intptr_t) switch_core_hash_find(loadable_modules.secondary_recover_hash, key); + switch_mutex_unlock(loadable_modules.mutex); + + return cb; +} + + +SWITCH_DECLARE(switch_status_t) switch_core_register_secondary_recover_callback(const char *key, switch_core_recover_callback_t cb) +{ + switch_status_t status = SWITCH_STATUS_SUCCESS; + + switch_assert(cb); + + switch_mutex_lock(loadable_modules.mutex); + if (switch_core_hash_find(loadable_modules.secondary_recover_hash, key)) { + status = SWITCH_STATUS_FALSE; + } else { + switch_core_hash_insert(loadable_modules.secondary_recover_hash, key, (void *)(intptr_t) cb); + } + switch_mutex_unlock(loadable_modules.mutex); + + return status; +} + + +SWITCH_DECLARE(void) switch_core_unregister_secondary_recover_callback(const char *key) +{ + switch_mutex_lock(loadable_modules.mutex); + switch_core_hash_delete(loadable_modules.secondary_recover_hash, key); + switch_mutex_unlock(loadable_modules.mutex); +} /* For Emacs: diff --git a/src/switch_rtp.c b/src/switch_rtp.c index c7f15f01f1..ff621e1826 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -54,14 +54,14 @@ #include #include -#define FIR_COUNTDOWN 50 +#define FIR_COUNTDOWN 25 #define READ_INC(rtp_session) switch_mutex_lock(rtp_session->read_mutex); rtp_session->reading++ #define READ_DEC(rtp_session) switch_mutex_unlock(rtp_session->read_mutex); rtp_session->reading-- #define WRITE_INC(rtp_session) switch_mutex_lock(rtp_session->write_mutex); rtp_session->writing++ #define WRITE_DEC(rtp_session) switch_mutex_unlock(rtp_session->write_mutex); rtp_session->writing-- -#define RTP_STUN_FREQ 2000000 +#define RTP_STUN_FREQ 1000000 #define rtp_header_len 12 #define RTP_START_PORT 16384 #define RTP_END_PORT 32768 @@ -713,7 +713,7 @@ static switch_status_t ice_out(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice) elapsed = (unsigned int) ((switch_micro_time_now() - rtp_session->last_stun) / 1000); if (elapsed > 30000) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_ERROR, "No stun for a long time!\n"); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_ERROR, "No %s stun for a long time!\n", rtp_type(rtp_session)); rtp_session->last_stun = switch_micro_time_now(); //status = SWITCH_STATUS_GENERR; //goto end; @@ -911,9 +911,6 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d switch_port_t port = 0; char *host = NULL; - ice->missed_count++; - //switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_CRIT, "missed %d\n", ice->missed_count); - if (elapsed > 20000 && pri) { int i, j; uint32_t old; @@ -924,6 +921,11 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d char adj_port[6]; switch_channel_t *channel = NULL; + + ice->missed_count++; + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_WARNING, "missed %d\n", ice->missed_count); + + if (rtp_session->session) { channel = switch_core_session_get_channel(rtp_session->session); } @@ -991,6 +993,8 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d } if (ice->missed_count > 5) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_WARNING, "missed too many: %d, looking for new ICE dest.\n", + ice->missed_count); ice->rready = 0; ok = 1; } @@ -1039,6 +1043,7 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d char buf[80] = ""; char buf2[80] = ""; const char *err = ""; + int i = 0; ice->missed_count = 0; ice->rready = 1; @@ -1049,6 +1054,21 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d host2 = switch_get_addr(buf2, sizeof(buf2), ice->addr); port2 = switch_sockaddr_get_port(ice->addr); + for (i = 0; i <= ice->ice_params->cand_idx; i++) { + 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")) { + + 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", + host2, port2, + host, port); + + goto end; + } + } + } + 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, @@ -1056,7 +1076,8 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d 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]) { @@ -1369,7 +1390,7 @@ static void send_fir(switch_rtp_t *rtp_session) fir->ssrc = htonl(rtp_session->remote_ssrc); fir->seq = ++rtp_session->fir_seq; fir->r1 = fir->r2 = fir->r3 = 0; - + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG1, "Sending RTCP FIR %d\n", rtp_session->fir_seq); rtcp_bytes = sizeof(switch_rtcp_ext_hdr_t) + sizeof(rtcp_fir_t); @@ -1527,6 +1548,20 @@ static int check_rtcp_and_ice(switch_rtp_t *rtp_session) int rtcp_ok = 1; switch_time_t now = switch_micro_time_now(); + + if (rtp_session->fir_countdown) { + if (rtp_session->fir_countdown == FIR_COUNTDOWN) { + do_flush(rtp_session, SWITCH_TRUE); + } + + if (rtp_session->fir_countdown == FIR_COUNTDOWN || rtp_session->fir_countdown == 1) { + send_fir(rtp_session); + //send_pli(rtp_session); + } + + rtp_session->fir_countdown--; + } + if (rtp_session->flags[SWITCH_RTP_FLAG_AUTO_CNG] && rtp_session->send_msg.header.ts && rtp_session->timer.samplecount >= (rtp_session->last_write_samplecount + (rtp_session->samples_per_interval * 60))) { uint8_t data[10] = { 0 }; @@ -2363,6 +2398,26 @@ static int dtls_state_handshake(switch_rtp_t *rtp_session, switch_dtls_t *dtls) return 0; } +static void free_dtls(switch_dtls_t **dtlsp) +{ + switch_dtls_t *dtls; + + if (!dtlsp) { + return; + } + + dtls = *dtlsp; + *dtlsp = NULL; + + if (dtls->ssl) { + SSL_free(dtls->ssl); + } + + if (dtls->ssl_ctx) { + SSL_CTX_free(dtls->ssl_ctx); + } +} + static int do_dtls(switch_rtp_t *rtp_session, switch_dtls_t *dtls) { int r = 0, ret = 0, len; @@ -2370,16 +2425,17 @@ static int do_dtls(switch_rtp_t *rtp_session, switch_dtls_t *dtls) switch_size_t bytes; if (dtls->bytes) { + + //if (dtls->state == DS_READY) { + // + //} + if ((ret = BIO_write(dtls->read_bio, dtls->data, dtls->bytes)) != (int)dtls->bytes) { ret = SSL_get_error(dtls->ssl, ret); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_ERROR, "%s DTLS packet read err %d\n", rtp_type(rtp_session), ret); dtls_set_state(dtls, DS_FAIL); return -1; } - - if (dtls->state == DS_READY) { - dtls_set_state(dtls, DS_HANDSHAKE); - } } if (SSL_read(dtls->ssl, dtls->data, dtls->bytes) == (int)dtls->bytes) { @@ -2439,6 +2495,30 @@ SWITCH_DECLARE(int) switch_rtp_has_dtls(void) { #endif } +SWITCH_DECLARE(switch_status_t) switch_rtp_del_dtls(switch_rtp_t *rtp_session, dtls_type_t type) +{ + + if (!rtp_session->dtls && !rtp_session->rtcp_dtls) { + return SWITCH_STATUS_FALSE; + } + + if ((type & DTLS_TYPE_RTP)) { + if (rtp_session->dtls && rtp_session->dtls == rtp_session->rtcp_dtls) { + rtp_session->rtcp_dtls = NULL; + } + + if (rtp_session->dtls) { + free_dtls(&rtp_session->dtls); + } + } + + if ((type & DTLS_TYPE_RTCP) && rtp_session->rtcp_dtls) { + free_dtls(&rtp_session->rtcp_dtls); + } + + return SWITCH_STATUS_SUCCESS; +} + SWITCH_DECLARE(switch_status_t) switch_rtp_add_dtls(switch_rtp_t *rtp_session, dtls_fingerprint_t *local_fp, dtls_fingerprint_t *remote_fp, dtls_type_t type) { switch_dtls_t *dtls; @@ -2457,6 +2537,8 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_dtls(switch_rtp_t *rtp_session, d switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_CRIT, "INVALID TYPE!\n"); } + switch_rtp_del_dtls(rtp_session, type); + if ((type & DTLS_TYPE_RTP) && (type & DTLS_TYPE_RTCP)) { kind = "RTP/RTCP"; } else if ((type & DTLS_TYPE_RTP)) { @@ -2473,8 +2555,6 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_dtls(switch_rtp_t *rtp_session, d return SWITCH_STATUS_FALSE; } - - dtls = switch_core_alloc(rtp_session->pool, sizeof(*dtls)); @@ -2565,6 +2645,8 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_dtls(switch_rtp_t *rtp_session, d SSL_set_connect_state(dtls->ssl); } + rtp_session->flags[SWITCH_RTP_FLAG_VIDEO_BREAK] = 1; + switch_rtp_break(rtp_session); return SWITCH_STATUS_SUCCESS; @@ -3314,6 +3396,12 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_activate_ice(switch_rtp_t *rtp_sessio rtp_session->rtp_bugs |= RTP_BUG_ACCEPT_ANY_PACKETS; + + if (rtp_session->flags[SWITCH_RTP_FLAG_VIDEO]) { + rtp_session->flags[SWITCH_RTP_FLAG_VIDEO_BREAK] = 1; + switch_rtp_break(rtp_session); + } + return SWITCH_STATUS_SUCCESS; } @@ -3346,7 +3434,10 @@ SWITCH_DECLARE(void) switch_rtp_break(switch_rtp_t *rtp_session) if (rtp_session->flags[SWITCH_RTP_FLAG_VIDEO]) { int ret = 1; - if (rtp_session->session) { + if (rtp_session->flags[SWITCH_RTP_FLAG_VIDEO_BREAK]) { + rtp_session->flags[SWITCH_RTP_FLAG_VIDEO_BREAK] = 0; + ret = 0; + } else if (rtp_session->session) { switch_channel_t *channel = switch_core_session_get_channel(rtp_session->session); if (switch_channel_test_flag(channel, CF_VIDEO_BREAK)) { switch_channel_clear_flag(channel, CF_VIDEO_BREAK); @@ -3355,6 +3446,8 @@ SWITCH_DECLARE(void) switch_rtp_break(switch_rtp_t *rtp_session) } if (ret) return; + + switch_rtp_video_refresh(rtp_session); } switch_mutex_lock(rtp_session->flag_mutex); @@ -3415,27 +3508,6 @@ SWITCH_DECLARE(uint8_t) switch_rtp_ready(switch_rtp_t *rtp_session) return ret; } -static void free_dtls(switch_dtls_t **dtlsp) -{ - switch_dtls_t *dtls; - - if (!dtlsp) { - return; - } - - dtls = *dtlsp; - *dtlsp = NULL; - - if (dtls->ssl) { - SSL_free(dtls->ssl); - } - - if (dtls->ssl_ctx) { - SSL_CTX_free(dtls->ssl_ctx); - } -} - - SWITCH_DECLARE(void) switch_rtp_destroy(switch_rtp_t **rtp_session) { void *pop; @@ -3809,7 +3881,7 @@ static void do_2833(switch_rtp_t *rtp_session) rtp_session->dtmf_data.out_digit_dur = rdigit->duration; rtp_session->dtmf_data.out_digit = rdigit->digit; rtp_session->dtmf_data.out_digit_packet[0] = (unsigned char) switch_char_to_rfc2833(rdigit->digit); - rtp_session->dtmf_data.out_digit_packet[1] = 7; + rtp_session->dtmf_data.out_digit_packet[1] = 13; rtp_session->dtmf_data.out_digit_packet[2] = (unsigned char) (rtp_session->dtmf_data.out_digit_sub_sofar >> 8); rtp_session->dtmf_data.out_digit_packet[3] = (unsigned char) rtp_session->dtmf_data.out_digit_sub_sofar; @@ -4621,8 +4693,10 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ pt = 100000; } - poll_status = switch_poll(rtp_session->read_pollfd, 1, &fdr, pt); + poll_status = switch_poll(rtp_session->read_pollfd, 1, &fdr, pt); + + if (rtp_session->dtmf_data.out_digit_dur > 0) { return_cng_frame(); } @@ -4635,10 +4709,12 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ } + if (poll_status == SWITCH_STATUS_SUCCESS) { if (read_pretriggered) { read_pretriggered = 0; } else { + status = read_rtp_packet(rtp_session, &bytes, flags, SWITCH_TRUE); if (status == SWITCH_STATUS_GENERR) { @@ -5282,15 +5358,6 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_zerocopy_read_frame(switch_rtp_t *rtp return SWITCH_STATUS_FALSE; } - if (rtp_session->fir_countdown) { - rtp_session->fir_countdown--; - - if (rtp_session->fir_countdown == FIR_COUNTDOWN / 2 || rtp_session->fir_countdown == 0) { - send_fir(rtp_session); - //send_pli(rtp_session); - } - } - bytes = rtp_common_read(rtp_session, &frame->payload, &frame->flags, io_flags); frame->data = RTP_BODY(rtp_session); @@ -5524,7 +5591,7 @@ static int rtp_common_write(switch_rtp_t *rtp_session, rtp_session->ts_norm.delta_percent = (double)((double)rtp_session->ts_norm.delta / (double)rtp_session->ts_norm.delta_avg) * 100.0f; - if (rtp_session->ts_norm.delta_ct > 50 && rtp_session->ts_norm.delta_percent > 125.0) { + if (rtp_session->ts_norm.delta_ct > 50 && rtp_session->ts_norm.delta_percent > 150.0) { //printf("%s diff %d %d (%.2f)\n", switch_core_session_get_name(rtp_session->session), //rtp_session->ts_norm.delta, rtp_session->ts_norm.delta_avg, rtp_session->ts_norm.delta_percent); switch_rtp_video_refresh(rtp_session);