fix merge conflicts

This commit is contained in:
Ken Rice 2013-01-04 15:42:05 +00:00
commit 25f5992367
58 changed files with 2648 additions and 494 deletions

View File

@ -119,13 +119,21 @@
<!-- Note, be sure to pass in the full path to the file or else!! -->
<action function="play-file" data="$1"/>
<action function="sleep" data="500"/>
<action function="play-file" data="ivr/ivr-accept_reject_voicemail.wav"/>
<action function="play-file" data="ivr/ivr-to_accept_press_one.wav"/>
<action function="sleep" data="500"/>
<action function="play-file" data="ivr/ivr-to_reject.wav"/>
<action function="sleep" data="50"/>
<action function="play-file" data="ivr/ivr-hang_up.wav"/>
<action function="sleep" data="1500"/>
<action function="play-file" data="ivr/ivr-call_from.wav"/>
<action function="sleep" data="250"/>
<action function="play-file" data="$1"/>
<action function="sleep" data="500"/>
<action function="play-file" data="ivr/ivr-accept_reject_voicemail.wav"/>
<action function="play-file" data="ivr/ivr-to_accept_press_one.wav"/>
<action function="sleep" data="500"/>
<action function="play-file" data="ivr/ivr-to_reject.wav"/>
<action function="sleep" data="50"/>
<action function="play-file" data="ivr/ivr-hang_up.wav"/>
<action function="sleep" data="1500"/>
</match>
</input>

View File

@ -3,7 +3,7 @@
# Must change all of the below together
# For a release, set revision for that tagged release as well and uncomment
AC_INIT([freeswitch], [1.2.5.3], BUG-REPORT-ADDRESS)
AC_INIT([freeswitch], [1.2.5.3], bugs@freeswitch.org)
AC_SUBST(SWITCH_VERSION_MAJOR, [1])
AC_SUBST(SWITCH_VERSION_MINOR, [2])
AC_SUBST(SWITCH_VERSION_MICRO, [5.3])

2
debian/bootstrap.sh vendored
View File

@ -174,7 +174,7 @@ Build-Depends:
libc6-dev (>= 2.11.3), make (>= 3.81),
wget, pkg-config,
# configure options
libssl-dev, unixodbc-dev,
libssl-dev, unixodbc-dev, libpq-dev,
libncurses5-dev, libjpeg62-dev | libjpeg8-dev,
python-dev, erlang-dev,
# documentation

1153
debian/copyright vendored

File diff suppressed because it is too large Load Diff

View File

@ -18,7 +18,9 @@ NAME=freeswitch
DAEMON=/usr/bin/freeswitch
DAEMON_ARGS="-u freeswitch -g freeswitch -rp -nc -nonat"
USER=freeswitch
PIDFILE=/var/run/$NAME/$NAME.pid
GROUP=freeswitch
RUNDIR=/var/run/$NAME
PIDFILE=$RUNDIR/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
WORKDIR=/var/lib/$NAME
@ -28,6 +30,11 @@ WORKDIR=/var/lib/$NAME
. /lib/lsb/init-functions
do_start() {
# Directory in /var/run may disappear on reboot (e.g. when tmpfs used for /var/run).
mkdir -p $RUNDIR
chown -R $USER:$GROUP $RUNDIR
chmod -R ug=rwX,o= $RUNDIR
start-stop-daemon --start --quiet \
--pidfile $PIDFILE --exec $DAEMON --name $NAME --user $USER \
--test > /dev/null \

290
debian/license-reconcile.yml vendored Normal file
View File

@ -0,0 +1,290 @@
Rules:
rules:
-
Glob: libs/ldns/*
Matches: NLnet\s*Labs,?\s*(20\d\d(|\s*-\s*20\d\d)|All\sright\sreserved)
Copyright: 2004-2010, NLnet Labs
-
Glob: libs/win32/ldns/ldns-lib/util.h
Matches: NLnet\s*Labs,?\s*(20\d\d(|\s*-\s*20\d\d)|All\sright\sreserved)
Copyright: 2004-2010, NLnet Labs
-
Glob: libs/miniupnpc/*
Matches: Thomas\sBERNARD
Copyright: Thomas Bernard
-
Glob: libs/miniupnpc/bsdqueue.h
Matches: The\sRegents\sof\sthe\sUniversity\sof\sCalifornia.\s+All\srights\sreserved.
Copyright: The Regents of the University of California.
-
Glob: libs/sofia-sip/libsofia-sip-ua/su/poll.c
Matches: Free\sSoftware\sFoundation,\sInc.
Copyright: Free Software Foundation, Inc.
Copyright: Nokia Corporation.
-
Glob: libs/sofia-sip/libsofia-sip-ua/su/strtoull.c
Copyright: Sun Microsystems, Inc.
-
Glob: libs/sofia-sip/libsofia-sip-ua/su/su_md5.c
Copyright: Nokia Corporation
License: LGPL-2.1+
-
Glob: libs/speex/include/speex/speex_types.h
Copyright: Xiph.Org Foundation
-
Glob: libs/speex/libspeex/lsp.c
Copyright: Jean-Marc Valin
-
Glob: libs/speex/libspeex/smallft.[ch]
Copyright: the XIPHOPHORUS Company
-
Glob: libs/speex/src/getopt1.c
Matches: Copyright\s\(C\)\s1987,88,89,90,91,92,93,94,96,97,98
Copyright: 1987-1998 Free Software Foundation, Inc.
-
Glob: libs/speex/src/getopt.c
Matches: Copyright\s\(C\)\s1987,\s88,\s89,\s90,\s91,\s92,\s93,\s94,\s95,\s96,\s97,\s98,\s99
Copyright: 1987-1999 Free Software Foundation, Inc.
-
Glob: libs/speex/src/getopt_win.h
Matches: Copyright\s\(C\)\s1989,90,91,92,93,94,96,97,98\sFree\sSoftware\sFoundation,\sInc.
Copyright: 1989-1998 Free Software Foundation, Inc.
-
Glob: libs/srtp/update.sh
Copyright: Ingate Systems AB
-
Glob: libs/libzrtp/third_party/bnlib/test/md5.c
Matches: This\scode\sis\sin\sthe\spublic\sdomain;\sdo\swith\sit\swhat\syou\swish.
Copyright: 1995 Abandoned Colin Plumb
License: public-domain
-
Glob: src/g711.c
Matches: Copyright\s\(C\)\s2006\sSteve\sUnderwood
Matches: \spublic\sdomain\sfor\sthe\sbenefit\sof\sall\smankind
Copyright: 2006 Abandoned Steve Underwood
License: public-domain
-
Glob: src/include/g711.h
Matches: Copyright\s\(C\)\s2001\sSteve\sUnderwood
Matches: \spublic\sdomain\sfor\sthe\sbenefit\sof\sall\smankind
Copyright: 2001 Abandoned Steve Underwood
License: public-domain
-
Glob: src/switch_mprintf.c
Matches: the\spublic\sdomain.
License: public-domain
-
Glob: src/switch_xml.c
Matches: without\slimitation\sthe\srights\sto\suse,\scopy,\smodify,\smerge,\spublish,
License: MPL-1.1 or BSD-like
-
Glob: src/include/switch_xml.h
Matches: without\slimitation\sthe\srights\sto\suse,\scopy,\smodify,\smerge,\spublish,
License: MPL-1.1 or BSD-like
-
Glob: src/include/switch_cpp.h
Matches: Author[:]\sYossi\sNeiman\s<freeswitch@cartissolutions.com>,\s\(C\)\s2007////\sCopyright[:]
Copyright: 2007 Yossi Neiman <freeswitch@cartissolutions.com>
-
Glob: libs/libzrtp/*
Matches: For\slicensing\sand\sother\slegal\sdetails,\ssee\sthe\sfile\szrtp_legal.c.
License: AGPL-3 or MPL-1.1
-
Glob: libs/libzrtp/third_party/bnlib/*
Matches: For\slicensing\sand\sother\slegal\sdetails,\ssee\sthe\sfile\slegal.c.
License: GPL-2 or GPL-3 or MPL-1.1
-
Glob: libs/libzrtp/src/zrtp_legal.c
Matches: As\sa\sspecial\sexception,\syou\smay\scombine\sthis\slibrary\swith\sthe\scode
Matches: License\sVersion\s1.1\s\(MPLv1.1\).
License: AGPL-3 or MPL-1.1
-
Glob: libs/libzrtp/third_party/bnlib/legal.c
Matches: As\sa\sspecial\sexception,\syou\smay\scombine\sthis\slibrary\swith\sthe\scode
Matches: License\sVersion\s1.1\s\(MPLv1.1\).
License: GPL-2 or GPL-3 or MPL-1.1
-
Glob: libs/libzrtp/projects/symbian/DelayRuner.h
Matches: Copyright\s+:\sCopyright\s\(c\)\s2010\sSoft\sIndustry
Copyright: 2010 Soft Industry
-
Glob: libs/sqlite/*
Matches: The\sauthor\sdisclaims\scopyright\sto\sthis\ssource\scode.
Copyright: 2006 Abandoned D. Richard Hipp <drh@hwaci.com>
License: public-domain
-
Glob: libs/win32/sqlite/*.[ch]
Matches: The\sauthor\sdisclaims\scopyright\sto\sthis\ssource\scode.
Copyright: 2006 Abandoned D. Richard Hipp <drh@hwaci.com>
License: public-domain
-
Glob: libs/sqlite/src/test_md5.c
Matches: written\sby\sColin\sPlumb\sin\s1993,\sno\scopyright\sis\sclaimed.
Matches: This\scode\sis\sin\sthe\spublic\sdomain;\sdo\swith\sit\swhat\syou\swish.
Copyright: 1993 Abandoned Colin Plumb
License: public-domain
-
Glob: libs/sqlite/src/printf.c
Matches: The\s\"printf\"\scode\sthat\sfollows\sdates\sfrom\sthe\s1980\'s.\s\sIt\sis\sin
Matches: the\spublic\sdomain.
License: public-domain
-
Glob: libs/sqlite/src/test_md5.c
Matches: This\scode\sis\sin\sthe\spublic\sdomain;\sdo\swith\sit\swhat\syou\swish.
License: public-domain
-
Glob: libs/libtpl-1.5/src/tpl.[ch]
Matches: Copyright\s\(c\)\s2005-2010,\sTroy\sD.\sHanson\s+http://tpl.sourceforge.net
Copyright: 2005-2010, Troy D. Hanson
-
Glob: libs/win32/sqlite/parse.c
Matches: The\sauthor\sdisclaims\scopyright\sto\sthis\ssource\scode.
License: public-domain
-
Glob: libs/apr-util/crypto/apr_md5.c
Matches: Licensed\sunder\sthe\sApache\sLicense,\sVersion\s2.0
Matches: THE\sBEER-WARE\sLICENSE
License: RSA and Apache-2.0 and Beerware
Copyright: 1991-1992, RSA Data Security, Inc.
Copyright: 2000-2005 The Apache Software Foundation or its licensors
Copyright: phk@login.dknet.dk
-
Glob: libs/apr-util/*/apr_md[45].[ch]
Matches: Copyright\s\(C\)\s1991-2,\sRSA\sData\sSecurity,\sInc.
Copyright: 1991-1992, RSA Data Security, Inc.
-
Glob: libs/apr/file_io/unix/mktemp.c
Matches: The\sASF\slicenses\sthis\sfile\sto\sYou\sunder\sthe\sApache\sLicense,\sVersion\s2.0
Matches: Copyright\s\(c\)\s1987,\s1993
Matches: The\sRegents\sof\sthe\sUniversity\sof\sCalifornia.\s+All\srights\sreserved.
Copyright: 1987, 1993 The Regents of the University of California
License: Apache-2.0 or BSD-4-clause
-
Glob: libs/apr/strings/apr_strings.c
Matches: The\sASF\slicenses\sthis\sfile\sto\sYou\sunder\sthe\sApache\sLicense,\sVersion\s2.0
Matches: Copyright\s\(c\)\s1987,\s1993
Matches: The\sRegents\sof\sthe\sUniversity\sof\sCalifornia.\s+All\srights\sreserved.
Copyright: 1990, 1993 The Regents of the University of California
License: Apache-2.0 or BSD-4-clause
-
Glob: libs/apr/dso/aix/dso.c
Matches: Copyright\s\(c\)\s1992,1993,1995,1996,1997,1988
Matches: Jens-Uwe\sMager,\sHelios\sSoftware\sGmbH,\sHannover,\sGermany.
Copyright: 1992-1998 Jens-Uwe Mager, Helios Software GmbH, Hannover, Germany.
-
Glob: libs/apr/build/NWGNUtail.inc
Matches: NLM_COPYRIGHT\s=\sLicensed\sto\sthe\sApache\sSoftware\sFoundation\s\(ASF\)\sunder\sone\sor\smore
Copyright: The Apache Software Foundation or its licensors
-
Glob: libs/apr/include/apr_fnmatch.h
Matches: Copyright\s\(c\)\s1992,\s1993
Matches: The\sRegents\sof\sthe\sUniversity\sof\sCalifornia.
Copyright: 1992, 1993 The Regents of the University of California.
-
Glob: libs/apr-util/ldap/apr_ldap_url.c
Matches: Copyright\s2000-2005\sThe\sApache\sSoftware\sFoundation\sor\sits\slicensors
Copyright: 2000-2005 The Apache Software Foundation or its licensors
Matches: Copyright\s1998-2002\sThe\sOpenLDAP\sFoundation
Copyright: 1998-2002 The OpenLDAP Foundation
Matches: Copyright\s\(c\)\s1992-1996\sRegents\sof\sthe\sUniversity\sof\sMichigan.
Copyright: 1992-1996 Regents of the University of Michigan.
Matches: http://www.OpenLDAP.org/license.html\sor\sin\sfile\sLICENSE\sin\sthe
License: Apache-2.0 and OpenLDAP and BSD-like
Justification: silly hack to shut up the 'by' problem
-
Glob: libs/js/*
Matches: Version:\sMPL\s1.1/GPL\s2.0/LGPL\s2.1
Matches: Portions\screated\sby\sthe\sInitial\sDeveloper\sare\sCopyright\s\(C\)\s(1998-|)2000
Matches: GNU\sGeneral\sPublic\sLicense\sVersion\s2\sor\slater
Matches: GNU\sLesser\sGeneral\sPublic\sLicense\sVersion\s2.1\sor\slater
Matches: the\sterms\sof\sany\sone\sof\sthe\sMPL,\sthe\sGPL\sor\sthe\sLGPL.
License: MPL-1.1 or GPL-2+ or LGPL-2.1+
Copyright: 1998-2000 Netscape Communications Corporation.
-
Glob: libs/js/*
Matches: Version:\sMPL\s1.1/GPL\s2.0/LGPL\s2.1
Matches: Portions\screated\sby\sthe\sInitial\sDeveloper\sare\sCopyright\s\(C\)\s(1998-|)2000
License: MPL-1.1 or GPL-2 or LGPL-2.1
Copyright: 1998-2000 Netscape Communications Corporation.
-
Glob: libs/js/*
Matches: the\sLicense\sat\shttp://www.mozilla.org/MPL/
Matches: GNU\sGeneral\sPublic\sLicense\sVersion\s2\sor\slater
License: MPL-1.1 or GPL-2+
-
Glob: libs/spandsp/tests/g726_tests.c
Matches: Copyright\s(C)\s2006\sSteve\sUnderwood
Matches: specification.\sThese\sare\scopyright\smaterial,\sand\sso\scannot\sbe\sdistributed\swith\sthis\stest\ssoftware.
Copyright: 2006 Steve Underwood
-
Glob: libs/spandsp/*/g722.[ch]
Matches: Copyright\s\(c\)\sCMU\s+1993
Copyright: 1993 CMU
-
Glob: libs/libwebsockets/win32port/zlib/inftrees.c
Matches: Copyright\s1995-2010\sMark\sAdler\s.;
Copyright: 1995-2010 Mark Adler
-
Glob: libs/libwebsockets/lib/sha-1.c
Matches: Copyright\s\(C\)\s1995,\s1996,\s1997,\sand\s1998\sWIDE\sProject.
Copyright: 1995-1998 WIDE Project.
-
Glob: libs/libsndfile/programs/common.h
Matches: Copyright\s\(C\)\s1999-2009\sErik\sde\sCastro\sLopo\s<erikd@mega-nerd.com>
Matches: const\schar\s\*\scopyright\s;
Copyright: 1999-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
Justification: prevent false-psitive copyright detection
-
Glob: libs/tiff-4.0.2/libtiff/tif_tile.c
Matches: Copyright\s(c)\s1991-1997\sSam\sLeffler
Matches: copyright\snotices\sand\sthis\spermission\snotice\sappear\sin
Copyright: 1991-1997 Sam Leffler
-
Glob: libs/tiff-4.0.2/*
Matches: Additions\s\(c\)\sRichard\sNolde\s2006-2010
Matches: copyright\snotices\sand\sthis\spermission\snotice\sappear\sin
Copyright: 2006-2010 Richard Nolde
-
Glob: libs/tiff-4.0.2/libtiff/tiffvers.h
Matches: 1988-1996\sSam\sLeffler..Copyright\s\(c\)\s1991-1996\sSilicon\sGraphics,\sInc.
Copyright: 1991-1996 Sam Leffler
Copyright: 1991-1996 Silicon Graphics, Inc
-
Glob: src/mod/endpoints/mod_khomp/*
Matches: The\scontents\sof\sthis\sfile\sare\ssubject\sto\sthe\sMozilla\sPublic\sLicense\sVersion\s1.1
Matches: Alternatively,\sthe\scontents\sof\sthis\sfile\smay\sbe\sused\sunder\sthe\sterms\sof\sthe
Matches: GNU\sLesser\sGeneral\sPublic\sLicense\s2\.1.\slicense\s\(the\s.LGPL.\sLicense\),\sin\swhich
Matches: version\s2\.1\sof\sthe\sLicense,\sor\s\(at\syour\soption\)\sany\slater\sversion.
License: MPL-1.1 or LGPL-2.1+
-
Glob: src/mod/endpoints/mod_khomp/commons/base/atomic.hpp
Matches: Original\scopyright\sfollows[:]
Matches: Copyright\s\(c\)\s1998\sDoug\sRabson
Copyright: 1998 Doug Rabson
-
Glob: libs/esl/getopt/getopt_long.c
Matches: This\scode\sis\sderived\sfrom\ssoftware\scontributed\sto\sThe\sNetBSD\sFoundation
License: BSD-2-clause
-
Glob: libs/curl/lib/md5.c
Matches: Copyright\s\(C\)\s1991-2,\sRSA\sData\sSecurity,\sInc.\sCreated\s1991.
Copyright: 1991-1992, RSA Data Security, Inc.
-
Glob: libs/silk/*
Matches: Copyright\s\(c\)\s2006-2011,\sSkype\sLimited.
Matches: THIS\sSOFTWARE\sIS\sPROVIDED\sBY\sTHE\sCOPYRIGHT\sHOLDERS\sAND
Copyright: 2006-2011, Skype Limited.
-
Glob: libs/openzap/src/ozmod/ozmod_wanpipe/wanpipe_tdm_api_iface.h
Matches: Copyright\s\(c\)\s2007\s-\s08,\sSangoma\sTechnologies
Copyright: 2007-2008, Sangoma Technologies
-
Glob: libs/openzap/src/testm3ua.c
Matches: Created\sby\sShane\sBurrell\son\s4/8/08.
Matches: Copyright\s2008\s__MyCompanyName__.
Copyright: 2008, Shane Burrell
Justification: I presume that __MyCompanyName__ is nonsense, which is why I'm crediting Shane Burrell
-
Glob: debian/*
Copyright: 2012 Travis Cross <tc@traviscross.com>
License: MPL-1.1 or GPL-2+

1
debian/rules vendored
View File

@ -64,6 +64,7 @@ override_dh_auto_clean:
--host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \
--with-gnu-ld --with-python --with-erlang --with-openssl \
--enable-core-odbc-support --enable-zrtp \
--enable-core-pgsql-support \
--prefix=/usr --localstatedir=/var \
--sysconfdir=/etc/freeswitch \
--with-modinstdir=/usr/lib/freeswitch/mod \

View File

@ -591,6 +591,18 @@
<prompt phrase="For other options, press..." filename="ivr-for_other_options.wav"/>
<!-- The following phrases still need to be recorded -->
<prompt phrase="Thank you." filename="ivr-thank_you.wav"/>
<prompt phrase="Plus." filename="43.wav"/>
<prompt phrase="Your caller I.D. information is..." filename="ivr-your_caller_id_information_is.wav"/>
<prompt phrase="Call screening has been enabled." filename="ivr-call_screening_enabled.wav"/>
<prompt phrase="Call screening has been disabled." filename="ivr-call_screening_disabled.wav"/>
<prompt phrase="" filename=""/>
<prompt phrase="" filename=""/>
<prompt phrase="" filename=""/>
<prompt phrase="" filename=""/>
<prompt phrase="" filename=""/>
<prompt phrase="" filename=""/>
<prompt phrase="" filename=""/>
<prompt phrase="" filename=""/>
<prompt phrase="" filename=""/>
</ivr>

1
libs/.gitignore vendored
View File

@ -352,6 +352,7 @@ opal
/libwebsockets/m4/ltversion.m4
/libwebsockets/m4/lt~obsolete.m4
/libwebsockets/stamp-h1
/libwebsockets/compile
/libwebsockets/test-server/Makefile
/libwebsockets/test-server/Makefile.in
/mongo-cxx-driver-v*/

View File

@ -1567,6 +1567,7 @@ static int on_stream_component(ldl_handle_t *handle, int type, iks *node)
}
globals.logger(DL_LOG_DEBUG, "XMPP authenticated\n");
ldl_set_flag_locked(handle, LDL_FLAG_AUTHORIZED);
ldl_set_flag_locked(handle, LDL_FLAG_CONNECTED);
handle->fail_count = 0;
}
} else {
@ -1966,8 +1967,9 @@ static void xmpp_connect(ldl_handle_t *handle, char *jabber_id, char *pass)
ldl_flush_queue(handle, 0);
}
handle->counter--;
if (!ldl_test_flag(handle, LDL_FLAG_CONNECTED)) {
handle->counter--;
if (IKS_NET_TLSFAIL == e) {
globals.logger(DL_LOG_CRIT, "tls handshake failed\n");
microsleep(500);

View File

@ -1 +1 @@
Tue Nov 13 15:22:19 CST 2012
Fri Dec 7 08:42:32 CST 2012

View File

@ -1190,7 +1190,7 @@ nua_stack_init_transport(nua_t *nua, tagi_t const *tags)
TPTAG_PUBLIC(tport_type_stun), /* use stun */
TPTAG_CERTIFICATE(certificate_dir),
TAG_NEXT(nua->nua_args)) < 0) {
SU_DEBUG_0(("nua: error initializing STUN transport\n"));
SU_DEBUG_0(("nua: error initializing STUN transport\n" VA_NONE));
}
#endif
}

View File

@ -552,7 +552,7 @@ int stun_obtain_shared_secret(stun_handle_t *sh,
ta_list ta;
ta_start(ta, tag, value);
SU_DEBUG_5(("Delaying STUN shared-secret req. for DNS-SRV query.\n"));
SU_DEBUG_5(("Delaying STUN shared-secret req. for DNS-SRV query.\n" VA_NONE));
err = priv_dns_queue_action(sh, stun_action_tls_query, sdf, magic, ta_tags(ta));
ta_end(ta);
@ -565,7 +565,7 @@ int stun_obtain_shared_secret(stun_handle_t *sh,
SU_DEBUG_3(("%s: Obtaining shared secret.\n", __func__));
}
else {
SU_DEBUG_3(("No message integrity enabled.\n"));
SU_DEBUG_3(("No message integrity enabled.\n" VA_NONE));
return errno = EFAULT, -1;
}
@ -928,12 +928,12 @@ static void priv_lookup_cb(stun_dns_lookup_t *self,
break;
default:
SU_DEBUG_5(("Warning: unknown pending STUN DNS-SRV action.\n"));
SU_DEBUG_5(("Warning: unknown pending STUN DNS-SRV action.\n" VA_NONE));
}
}
else {
/* DNS lookup failed */
SU_DEBUG_5(("Warning: STUN DNS-SRV lookup failed.\n"));
SU_DEBUG_5(("Warning: STUN DNS-SRV lookup failed.\n" VA_NONE));
if (sh->sh_dns_pend_cb) {
sh->sh_dns_pend_cb(sh->sh_dns_pend_ctx, sh, NULL,
sh->sh_dns_pend_action, stun_error);
@ -1045,7 +1045,7 @@ int stun_bind(stun_handle_t *sh,
int err;
ta_list ta;
ta_start(ta, tag, value);
SU_DEBUG_5(("Delaying STUN bind for DNS-SRV query.\n"));
SU_DEBUG_5(("Delaying STUN bind for DNS-SRV query.\n" VA_NONE));
err = priv_dns_queue_action(sh, stun_action_binding_request, sdf, magic, ta_tags(ta));
ta_end(ta);
return err;
@ -1201,7 +1201,7 @@ int stun_test_nattype(stun_handle_t *sh,
ta_list ta;
ta_start(ta, tag, value);
SU_DEBUG_5(("Delaying STUN get-nat-type req. for DNS-SRV query.\n"));
SU_DEBUG_5(("Delaying STUN get-nat-type req. for DNS-SRV query.\n" VA_NONE));
err = priv_dns_queue_action(sh, stun_action_test_nattype, sdf, magic, ta_tags(ta));
ta_end(ta);
@ -1453,7 +1453,7 @@ int stun_tls_callback(su_root_magic_t *m, su_wait_t *w, su_wakeup_arg_t *arg)
su_root_eventmask(self->sh_root, sd->sd_index,
sd->sd_socket, events);
SU_DEBUG_5(("Shared Secret Request sent to server:\n"));
SU_DEBUG_5(("Shared Secret Request sent to server:\n" VA_NONE));
debug_print(&msg_req->enc_buf);
z = SSL_read(ssl, buf, sizeof(buf));
@ -1472,7 +1472,7 @@ int stun_tls_callback(su_root_magic_t *m, su_wait_t *w, su_wakeup_arg_t *arg)
resp->enc_buf.size = z;
resp->enc_buf.data = malloc(z);
memcpy(resp->enc_buf.data, buf, z);
SU_DEBUG_5(("Shared Secret Response received from server:\n"));
SU_DEBUG_5(("Shared Secret Response received from server:\n" VA_NONE));
debug_print(&resp->enc_buf);
/* closed TLS connection */
@ -1505,7 +1505,7 @@ int stun_tls_callback(su_root_magic_t *m, su_wait_t *w, su_wakeup_arg_t *arg)
case SHARED_SECRET_ERROR_RESPONSE:
if (stun_process_error_response(resp) < 0) {
SU_DEBUG_5(("Error in Shared Secret Error Response.\n"));
SU_DEBUG_5(("Error in Shared Secret Error Response.\n" VA_NONE));
}
stun_free_buffer(&resp->enc_buf);
return -1;
@ -1755,7 +1755,7 @@ static int do_action(stun_handle_t *sh, stun_msg_t *msg)
id = msg->stun_hdr.tran_id;
req = find_request(sh, id);
if (!req) {
SU_DEBUG_7(("warning: unable to find matching TID for response\n"));
SU_DEBUG_7(("warning: unable to find matching TID for response\n" VA_NONE));
return 0;
}
@ -2205,7 +2205,7 @@ static int action_determine_nattype(stun_request_t *req, stun_msg_t *binding_res
if (err < 0) {
SU_DEBUG_0(("WARNING: Failure in performing STUN Test-IV check. "
"The results related to mapping characteristics may be incorrect."));
"The results related to mapping characteristics may be incorrect." VA_NONE));
stun_free_message(req->sr_msg);
sd->sd_fourth = -1;
/* call function again, sd_fourth stops the recursion */
@ -2696,7 +2696,7 @@ int stun_test_lifetime(stun_handle_t *sh,
ta_list ta;
ta_start(ta, tag, value);
SU_DEBUG_5(("Delaying STUN get-lifetime req. for DNS-SRV query.\n"));
SU_DEBUG_5(("Delaying STUN get-lifetime req. for DNS-SRV query.\n" VA_NONE));
err = priv_dns_queue_action(sh, stun_action_test_lifetime, sdf, magic, ta_tags(ta));
ta_end(ta);

View File

@ -558,9 +558,9 @@ void debug_print(stun_buffer_t *buf) {
*(buf->data + i*4 +2),
*(buf->data + i*4 +3)));
if (i == 4)
SU_DEBUG_9(("---------------------\n"));
SU_DEBUG_9(("---------------------\n" VA_NONE));
}
SU_DEBUG_9(("\n"));
SU_DEBUG_9(("\n" VA_NONE));
}
int stun_init_message(stun_msg_t *msg) {

View File

@ -183,26 +183,23 @@ SPAN_DECLARE_NONSTD(void) async_rx_put_bit(void *user_data, int bit)
s->put_byte(s->user_data, s->byte_in_progress);
s->bitpos = 0;
}
else if (s->use_v14)
{
/* This is actually the start bit for the next character, and
the stop bit has been dropped from the stream. This is the
rate adaption specified in V.14 */
/* Align the received value */
if (s->data_bits < 8)
s->byte_in_progress = (s->byte_in_progress & 0xFF) >> (8 - s->data_bits);
s->put_byte(s->user_data, s->byte_in_progress);
s->bitpos = 1;
s->parity_bit = 0;
s->byte_in_progress = 0;
}
else
{
if (s->use_v14)
{
/* This is actually the start bit for the next character, and
the stop bit has been dropped from the stream. This is the
rate adaption specified in V.14 */
/* Align the received value */
if (s->data_bits < 8)
s->byte_in_progress = (s->byte_in_progress & 0xFF) >> (8 - s->data_bits);
s->put_byte(s->user_data, s->byte_in_progress);
s->bitpos = 1;
s->parity_bit = 0;
s->byte_in_progress = 0;
}
else
{
s->framing_errors++;
s->bitpos = 0;
}
s->framing_errors++;
s->bitpos = 0;
}
}
}

View File

@ -128,6 +128,68 @@ static const char *at_response_codes[] =
"+FRH:3"
};
SPAN_DECLARE(const char *) at_call_state_to_str(int state)
{
switch (state)
{
case AT_CALL_EVENT_ALERTING:
return "Alerting";
case AT_CALL_EVENT_CONNECTED:
return "Connected";
case AT_CALL_EVENT_ANSWERED:
return "Answered";
case AT_CALL_EVENT_BUSY:
return "Busy";
case AT_CALL_EVENT_NO_DIALTONE:
return "No dialtone";
case AT_CALL_EVENT_NO_ANSWER:
return "No answer";
case AT_CALL_EVENT_HANGUP:
return "Hangup";
}
/*endswitch*/
return "???";
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(const char *) at_modem_control_to_str(int state)
{
switch (state)
{
case AT_MODEM_CONTROL_CALL:
return "Call";
case AT_MODEM_CONTROL_ANSWER:
return "Answer";
case AT_MODEM_CONTROL_HANGUP:
return "Hangup";
case AT_MODEM_CONTROL_OFFHOOK:
return "Off hook";
case AT_MODEM_CONTROL_ONHOOK:
return "On hook";
case AT_MODEM_CONTROL_DTR:
return "DTR";
case AT_MODEM_CONTROL_RTS:
return "RTS";
case AT_MODEM_CONTROL_CTS:
return "CTS";
case AT_MODEM_CONTROL_CAR:
return "CAR";
case AT_MODEM_CONTROL_RNG:
return "RNG";
case AT_MODEM_CONTROL_DSR:
return "DSR";
case AT_MODEM_CONTROL_SETID:
return "Set ID";
case AT_MODEM_CONTROL_RESTART:
return "Restart";
case AT_MODEM_CONTROL_DTE_TIMEOUT:
return "DTE timeout";
}
/*endswitch*/
return "???";
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(void) at_set_at_rx_mode(at_state_t *s, int new_mode)
{
/* The use of a DTE timeout is mode dependent. Set the timeout appropriately in
@ -363,8 +425,8 @@ SPAN_DECLARE(void) at_display_call_info(at_state_t *s)
snprintf(buf,
sizeof(buf),
"%s=%s",
call_id->id ? call_id->id : "NULL",
call_id->value ? call_id->value : "<NONE>");
(call_id->id) ? call_id->id : "NULL",
(call_id->value) ? call_id->value : "<NONE>");
at_put_response(s, buf);
call_id = call_id->next;
}

View File

@ -560,8 +560,7 @@ static void quantization_and_coding(int16_t LAR[8])
#undef STEP
#define STEP(A,B,MAC,MIC) \
temp = saturated_mul16(A, *LAR); \
temp = saturated_add16(temp, B); \
temp = saturated_add16(temp, 256); \
temp = saturated_add16(temp, (B + 256)); \
temp >>= 9; \
*LAR = (int16_t) ((temp > MAC) \
? \

View File

@ -201,10 +201,9 @@ static int image_gray8_to_colour16_row(uint16_t colour16[], uint8_t gray8[], int
for (i = pixels - 1; i >= 0; i--)
{
/* TODO: need to balance the colours */
colour16[3*i] = gray8[i] << 8;
colour16[3*i + 1] = gray8[i] << 8;
colour16[3*i + 2] = gray8[i] << 8;
colour16[3*i] = saturateu16((gray8[i]*36532U) >> 7);
colour16[3*i + 1] = saturateu16((gray8[i]*37216U) >> 8);
colour16[3*i + 2] = saturateu16((gray8[i]*47900U) >> 6);
}
return pixels;
}
@ -216,10 +215,9 @@ static int image_gray8_to_colour8_row(uint8_t colour8[], uint8_t gray8[], int pi
for (i = pixels - 1; i >= 0; i--)
{
/* TODO: need to balance the colours */
colour8[3*i] = gray8[i];
colour8[3*i + 1] = gray8[i];
colour8[3*i + 2] = gray8[i];
colour8[3*i] = saturateu8((gray8[i]*36532U) >> 15);
colour8[3*i + 1] = saturateu8((gray8[i]*37216U) >> 16);
colour8[3*i + 2] = saturateu8((gray8[i]*47900U) >> 14);
}
return pixels;
}

View File

@ -376,18 +376,18 @@ void lpc10_voicing(lpc10_encode_state_t *s,
/* ----- ----- */
/* 0 0 0 0 */
/* 0 0 0* 1 (If there is an onset there) */
/* 0 0 1* 0* (Based on 2F and discriminant distance) */
/* 0 0 1* 0* (Based on 2F and discriminant distance) */
/* 0 0 1 1 */
/* 0 1* 0 0 (Always) */
/* 0 1* 0* 1 (Based on discriminant distance) */
/* 0* 1 1 0* (Based on past, 2F, and discriminant distance) */
/* 0* 1 1 0* (Based on past, 2F, and discriminant distance) */
/* 0 1* 1 1 (If there is an onset there) */
/* 1 0* 0 0 (If there is an onset there) */
/* 1 0 0 1 */
/* 1 0* 1* 0 (Based on discriminant distance) */
/* 1 0* 1 1 (Always) */
/* 1 1 0 0 */
/* 1 1 0* 1* (Based on 2F and discriminant distance) */
/* 1 1 0* 1* (Based on 2F and discriminant distance) */
/* 1 1 1* 0 (If there is an onset there) */
/* 1 1 1 1 */
@ -433,7 +433,7 @@ void lpc10_voicing(lpc10_encode_state_t *s,
s->voibuf[1][1] = 1;
break;
case 11:
if (s->voice[1][9] < -s->voice[0][1])
if (s->voice[1][0] < -s->voice[0][1])
s->voibuf[2][0] = 0;
else
s->voibuf[1][1] = 1;

View File

@ -486,7 +486,7 @@ SPAN_DECLARE_NONSTD(int) modem_connect_tones_rx(modem_connect_tones_rx_state_t *
if (s->tone_present != MODEM_CONNECT_TONES_FAX_CNG)
{
if (++s->tone_cycle_duration >= ms_to_samples(415))
report_tone_state(s, MODEM_CONNECT_TONES_FAX_CNG, lfastrintf(log10f(s->channel_level/32768.0f)*20.0f + DBM0_MAX_POWER + 0.8f));
report_tone_state(s, MODEM_CONNECT_TONES_FAX_CNG, lfastrintf(((s->channel_level == 0) ? (-96.329f + DBM0_MAX_POWER) : log10f(s->channel_level/32768.0f)*20.0f) + DBM0_MAX_POWER + 0.8f));
}
}
else
@ -565,7 +565,7 @@ SPAN_DECLARE_NONSTD(int) modem_connect_tones_rx(modem_connect_tones_rx_state_t *
{
report_tone_state(s,
(s->am_level*15/256 > s->channel_level) ? MODEM_CONNECT_TONES_ANSAM_PR : MODEM_CONNECT_TONES_ANS_PR,
lfastrintf(log10f(s->channel_level/32768.0f)*20.0f + DBM0_MAX_POWER + 0.8f));
lfastrintf(((s->channel_level == 0) ? (-96.329f + DBM0_MAX_POWER) : log10f(s->channel_level/32768.0f)*20.0f) + DBM0_MAX_POWER + 0.8f));
}
}
else
@ -583,7 +583,7 @@ SPAN_DECLARE_NONSTD(int) modem_connect_tones_rx(modem_connect_tones_rx_state_t *
{
report_tone_state(s,
(s->am_level*15/256 > s->channel_level) ? MODEM_CONNECT_TONES_ANSAM : MODEM_CONNECT_TONES_ANS,
lfastrintf(log10f(s->channel_level/32768.0f)*20.0f + DBM0_MAX_POWER + 0.8f));
lfastrintf(((s->channel_level == 0) ? (-96.329f + DBM0_MAX_POWER) : log10f(s->channel_level/32768.0f)*20.0f) + DBM0_MAX_POWER + 0.8f));
}
s->good_cycles = 0;
s->tone_cycle_duration = ms_to_samples(450 + 100);
@ -637,7 +637,7 @@ SPAN_DECLARE_NONSTD(int) modem_connect_tones_rx(modem_connect_tones_rx_state_t *
if (s->tone_present != MODEM_CONNECT_TONES_BELL_ANS)
{
if (++s->tone_cycle_duration >= ms_to_samples(415))
report_tone_state(s, MODEM_CONNECT_TONES_BELL_ANS, lfastrintf(log10f(s->channel_level/32768.0f)*20.0f + DBM0_MAX_POWER + 0.8f));
report_tone_state(s, MODEM_CONNECT_TONES_BELL_ANS, lfastrintf(((s->channel_level == 0) ? (-96.329f + DBM0_MAX_POWER) : log10f(s->channel_level/32768.0f)*20.0f) + DBM0_MAX_POWER + 0.8f));
}
}
else
@ -675,7 +675,7 @@ SPAN_DECLARE_NONSTD(int) modem_connect_tones_rx(modem_connect_tones_rx_state_t *
if (s->tone_present != MODEM_CONNECT_TONES_CALLING_TONE)
{
if (++s->tone_cycle_duration >= ms_to_samples(415))
report_tone_state(s, MODEM_CONNECT_TONES_CALLING_TONE, lfastrintf(log10f(s->channel_level/32768.0f)*20.0f + DBM0_MAX_POWER + 0.8f));
report_tone_state(s, MODEM_CONNECT_TONES_CALLING_TONE, lfastrintf(((s->channel_level == 0) ? (-96.329f + DBM0_MAX_POWER) : log10f(s->channel_level/32768.0f)*20.0f) + DBM0_MAX_POWER + 0.8f));
}
}
else

View File

@ -136,6 +136,10 @@ extern "C"
{
#endif
SPAN_DECLARE(const char *) at_call_state_to_str(int state);
SPAN_DECLARE(const char *) at_modem_control_to_str(int state);
SPAN_DECLARE(void) at_set_at_rx_mode(at_state_t *s, int new_mode);
SPAN_DECLARE(void) at_put_response(at_state_t *s, const char *t);

View File

@ -63,8 +63,8 @@ typedef struct
{
/*! \brief Internet Aware FAX mode bit mask. */
int iaf;
/*! \brief Required time between T.38 transmissions, in ms. */
int ms_per_tx_chunk;
/*! \brief Required time between T.38 transmissions, in us. */
int us_per_tx_chunk;
/*! \brief Bit fields controlling the way data is packed into chunked for transmission. */
int chunking_modes;
@ -125,6 +125,8 @@ typedef struct
int32_t samples;
/*! \brief The value for samples at the next transmission point. */
int32_t next_tx_samples;
/*! \brief The current transmit timeout. */
int32_t timeout_tx_samples;
/*! \brief The current receive timeout. */
int32_t timeout_rx_samples;
} t31_t38_front_end_state_t;

View File

@ -45,68 +45,123 @@ extern "C"
/* This is the same as saturate16(), but is here for historic reasons */
static __inline__ int16_t saturate(int32_t amp)
{
int16_t amp16;
#if defined(__GNUC__) && (defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_7A__))
int16_t z;
__asm__ __volatile__(
" ssat %[z],#16,%[amp];\n"
: [z] "=r" (z)
: [amp] "r" (amp)
);
return z;
#else
int16_t z;
/* Hopefully this is optimised for the common case - not clipping */
amp16 = (int16_t) amp;
if (amp == amp16)
return amp16;
z = (int16_t) amp;
if (amp == z)
return z;
if (amp > INT16_MAX)
return INT16_MAX;
return INT16_MIN;
#endif
}
/*- End of function --------------------------------------------------------*/
static __inline__ int16_t saturate16(int32_t amp)
{
int16_t amp16;
#if defined(__GNUC__) && (defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_7A__))
int16_t z;
__asm__ __volatile__(
" ssat %[z],#16,%[amp];\n"
: [z] "=r" (z)
: [amp] "r" (amp)
);
return z;
#else
int16_t z;
/* Hopefully this is optimised for the common case - not clipping */
amp16 = (int16_t) amp;
if (amp == amp16)
return amp16;
z = (int16_t) amp;
if (amp == z)
return z;
if (amp > INT16_MAX)
return INT16_MAX;
return INT16_MIN;
#endif
}
/*- End of function --------------------------------------------------------*/
/*! Saturate to 15 bits, rather than the usual 16 bits. This is often a useful function. */
static __inline__ int16_t saturate15(int32_t amp)
{
#if defined(__GNUC__) && (defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_7A__))
int16_t z;
__asm__ __volatile__(
" ssat %[z],#15,%[amp];\n"
: [z] "=r" (z)
: [amp] "r" (amp)
);
return z;
#else
if (amp > 16383)
return 16383;
if (amp < -16384)
return -16384;
return (int16_t) amp;
#endif
}
/*- End of function --------------------------------------------------------*/
static __inline__ uint16_t saturateu16(int32_t amp)
{
uint16_t amp16;
#if defined(__GNUC__) && (defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_7A__))
uint16_t z;
__asm__ __volatile__(
" usat %[z],#16,%[amp];\n"
: [z] "=r" (z)
: [amp] "r" (amp)
);
return z;
#else
uint16_t z;
/* Hopefully this is optimised for the common case - not clipping */
amp16 = (uint16_t) amp;
if (amp == amp16)
return amp16;
z = (uint16_t) amp;
if (amp == z)
return z;
if (amp > UINT16_MAX)
return UINT16_MAX;
return 0;
#endif
}
/*- End of function --------------------------------------------------------*/
static __inline__ uint8_t saturateu8(int32_t amp)
{
uint8_t amp8;
#if defined(__GNUC__) && (defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_7A__))
uint8_t z;
__asm__ __volatile__(
" usat %[z],#8,%[amp];\n"
: [z] "=r" (z)
: [amp] "r" (amp)
);
return z;
#else
uint8_t z;
/* Hopefully this is optimised for the common case - not clipping */
amp8 = (uint8_t) amp;
if (amp == amp8)
return amp8;
z = (uint8_t) amp;
if (amp == z)
return z;
if (amp > UINT8_MAX)
return UINT8_MAX;
return 0;
#endif
}
/*- End of function --------------------------------------------------------*/
@ -188,15 +243,15 @@ static __inline__ int16_t saturated_add16(int16_t a, int16_t b)
: "cc"
);
return a;
#elif defined(__GNUC__) && defined(__arm5__)
int16_t result;
#elif defined(__GNUC__) && (defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_7A__))
int16_t z;
__asm__ __volatile__(
" sadd16 %0,%1,%2;\n"
: "=r" (result)
: "0" (a), "ir" (b)
" qsub16 %[z],%[a],%[b];\n"
: [z] "=r" (z)
: [a] "r" (a), [b] "r" (b)
);
return result;
return z;
#else
return saturate((int32_t) a + (int32_t) b);
#endif
@ -217,25 +272,25 @@ static __inline__ int32_t saturated_add32(int32_t a, int32_t b)
: "cc"
);
return a;
#elif defined(__GNUC__) && defined(__arm5__)
int32_t result;
#elif defined(__GNUC__) && (defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_7A__))
int32_t z;
__asm__ __volatile__(
" qadd %0,%1,%2;\n"
: "=r" (result)
: "0" (a), "ir" (b)
" qadd %[z],%[a],%[b];\n"
: [z] "=r" (z)
: [a] "r" (a), [b] "r" (b)
);
return result;
return z;
#else
int32_t sum;
int32_t z;
sum = a + b;
z = a + b;
if ((a ^ b) >= 0)
{
if ((sum ^ a) < 0)
sum = (a < 0) ? INT32_MIN : INT32_MAX;
if ((z ^ a) < 0)
z = (a < 0) ? INT32_MIN : INT32_MAX;
}
return sum;
return z;
#endif
}
/*- End of function --------------------------------------------------------*/
@ -254,15 +309,15 @@ static __inline__ int16_t saturated_sub16(int16_t a, int16_t b)
: "cc"
);
return a;
#elif defined(__GNUC__) && defined(__arm5__)
int16_t result;
#elif defined(__GNUC__) && (defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_7A__))
int16_t z;
__asm__ __volatile__(
" ssub16 %0,%1,%2;\n"
: "=r" (result)
: "0" (a), "ir" (b)
" qsub16 %[z],%[a],%[b];\n"
: [z] "=r" (z)
: [a] "r" (a), [b] "r" (b)
);
return result;
return z;
#else
return saturate((int32_t) a - (int32_t) b);
#endif
@ -283,25 +338,25 @@ static __inline__ int32_t saturated_sub32(int32_t a, int32_t b)
: "cc"
);
return a;
#elif defined(__GNUC__) && defined(__arm5__)
int32_t result;
#elif defined(__GNUC__) && (defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_7A__))
int32_t z;
__asm__ __volatile__(
" qsub %0,%1,%2;\n"
: "=r" (result)
: "0" (a), "ir" (b)
" qsub %[z],%[a],%[b];\n"
: [z] "=r" (z)
: [a] "r" (a), [b] "r" (b)
);
return result;
return z;
#else
int32_t diff;
int32_t z;
diff = a - b;
z = a - b;
if ((a ^ b) < 0)
{
if ((diff ^ a) & INT32_MIN)
diff = (a < 0L) ? INT32_MIN : INT32_MAX;
if ((z ^ a) & INT32_MIN)
z = (a < 0L) ? INT32_MIN : INT32_MAX;
}
return diff;
return z;
#endif
}
/*- End of function --------------------------------------------------------*/

View File

@ -240,6 +240,7 @@ SPAN_DECLARE(const char *) t30_completion_code_to_str(int result)
case T30_ERR_CSA_UNACCEPTABLE:
return "Called subscriber internet address not accepted";
}
/*endswitch*/
return "???";
}
/*- End of function --------------------------------------------------------*/
@ -411,6 +412,7 @@ SPAN_DECLARE(const char *) t30_frametype(uint8_t x)
case T4_RCP:
return "RCP";
}
/*endswitch*/
return "???";
}
/*- End of function --------------------------------------------------------*/
@ -436,6 +438,7 @@ static void octet_reserved_bit(logging_state_t *log,
s[7 - bit_no + ((bit_no < 4) ? 1 : 0)] = (uint8_t) (bit + '0');
span_log(log, SPAN_LOG_FLOW, " %s= Unexpected state for reserved bit: %d\n", s, bit);
}
/*endif*/
}
/*- End of function --------------------------------------------------------*/

File diff suppressed because it is too large Load Diff

View File

@ -230,6 +230,7 @@ static int process_rx_indicator(t38_core_state_t *t, void *user_data, int indica
/* Protect against T.38 stuff arriving after we've actually finished. */
if (fe->current_rx_type == T30_MODEM_DONE)
return 0;
/*endif*/
if (t->current_rx_indicator == indicator)
{
@ -333,6 +334,7 @@ static int process_rx_data(t38_core_state_t *t, void *user_data, int data_type,
/* Protect against T.38 stuff arriving after we've actually finished. */
if (fe->current_rx_type == T30_MODEM_DONE)
return 0;
/*endif*/
/* In termination mode we don't care very much what the data type is apart from a couple of
special cases. */
@ -608,6 +610,7 @@ static void send_hdlc(void *user_data, const uint8_t *msg, int len)
{
if (s->t38_fe.us_per_tx_chunk)
s->t38_fe.hdlc_tx.extra_bits = extra_bits_in_stuffed_frame(msg, len);
/*endif*/
bit_reverse(s->t38_fe.hdlc_tx.buf, msg, len);
s->t38_fe.hdlc_tx.len = len;
s->t38_fe.hdlc_tx.ptr = 0;
@ -774,6 +777,7 @@ static int stream_non_ecm(t38_terminal_state_t *s)
fe->timed_step = T38_TIMED_STEP_NON_ECM_MODEM_5;
if (front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE) < 0)
return -1;
/*endif*/
break;
}
/*endif*/
@ -805,6 +809,7 @@ static int stream_non_ecm(t38_terminal_state_t *s)
/*endif*/
if (front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE) < 0)
return -1;
/*endif*/
break;
}
/*endif*/
@ -825,6 +830,10 @@ static int stream_non_ecm(t38_terminal_state_t *s)
fe->timed_step = fe->queued_timed_step;
fe->queued_timed_step = T38_TIMED_STEP_NONE;
}
else
{
fe->timed_step = T38_TIMED_STEP_NONE;
}
/*endif*/
return delay;
}
@ -910,6 +919,7 @@ static int stream_hdlc(t38_terminal_state_t *s)
fe->hdlc_tx.len = 0;
if (front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE) < 0)
return -1;
/*endif*/
/* The above step should have got the next HDLC step ready - either another frame, or an instruction to stop transmission. */
if (fe->hdlc_tx.len >= 0)
{
@ -941,6 +951,7 @@ static int stream_hdlc(t38_terminal_state_t *s)
/*endif*/
if (front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE) < 0)
return -1;
/*endif*/
}
/*endif*/
break;
@ -971,6 +982,7 @@ static int stream_hdlc(t38_terminal_state_t *s)
fe->hdlc_tx.len = 0;
if (front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE) < 0)
return -1;
/*endif*/
/* The above step should have got the next HDLC step ready - either another frame, or an instruction to stop transmission. */
if (fe->hdlc_tx.len >= 0)
{
@ -1006,6 +1018,7 @@ static int stream_hdlc(t38_terminal_state_t *s)
/*endif*/
if (front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE) < 0)
return -1;
/*endif*/
}
/*endif*/
break;
@ -1018,6 +1031,10 @@ static int stream_hdlc(t38_terminal_state_t *s)
fe->timed_step = fe->queued_timed_step;
fe->queued_timed_step = T38_TIMED_STEP_NONE;
}
else
{
fe->timed_step = T38_TIMED_STEP_NONE;
}
/*endif*/
return delay;
}
@ -1063,6 +1080,7 @@ static int stream_ced(t38_terminal_state_t *s)
fe->timed_step = fe->queued_timed_step;
if (front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE) < 0)
return -1;
/*endif*/
return 0;
}
/*endswitch*/

View File

@ -358,7 +358,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_stop_inband_dtmf_generate_session(swi
\brief - NEEDDESC -
\param session the session to act on
*/
SWITCH_DECLARE(void) switch_ivr_session_echo(switch_core_session_t *session, switch_input_args_t *args);
SWITCH_DECLARE(switch_status_t) switch_ivr_session_echo(switch_core_session_t *session, switch_input_args_t *args);
/*!
\brief Stop looking for TONES

View File

@ -265,6 +265,11 @@ typedef intptr_t switch_ssize_t;
#endif
#endif
#if UINTPTR_MAX == 0xffffffffffffffff
#define FS_64BIT 1
#endif
#endif
#define SWITCH_TIME_T_FMT SWITCH_INT64_T_FMT

View File

@ -42,6 +42,7 @@
SWITCH_BEGIN_EXTERN_C
#define SWITCH_RTP_MAX_BUF_LEN 16384
#define SWITCH_RTCP_MAX_BUF_LEN 16384
#define SWITCH_RTP_MAX_BUF_LEN_WORDS 4094 /* (max / 4) - 2 */
#define SWITCH_RTP_MAX_CRYPTO_LEN 64
#define SWITCH_RTP_KEY_LEN 30
#define SWITCH_RTP_CRYPTO_KEY_32 "AES_CM_128_HMAC_SHA1_32"

View File

@ -736,13 +736,18 @@ typedef enum {
*/
RTP_BUG_CHANGE_SSRC_ON_MARKER = (1 << 9)
RTP_BUG_CHANGE_SSRC_ON_MARKER = (1 << 9),
/*
By default FS will change the SSRC when the marker is set and it detects a timestamp reset.
If this setting is enabled it will NOT do this (old behaviour).
*/
RTP_BUG_FLUSH_JB_ON_DTMF = (1 << 10)
/* FLUSH JITTERBUFFER When getting RFC2833 to reduce bleed through */
} switch_rtp_bug_flag_t;
#ifdef _MSC_VER
@ -762,6 +767,11 @@ typedef struct {
unsigned ssrc:32; /* synchronization source */
} switch_rtp_hdr_t;
typedef struct {
unsigned length:16; /* length */
unsigned profile:16; /* defined by profile */
} switch_rtp_hdr_ext_t;
#else /* BIG_ENDIAN */
typedef struct {
@ -776,6 +786,11 @@ typedef struct {
unsigned ssrc:32; /* synchronization source */
} switch_rtp_hdr_t;
typedef struct {
unsigned profile:16; /* defined by profile */
unsigned length:16; /* length */
} switch_rtp_hdr_ext_t;
#endif
#ifdef _MSC_VER
@ -1972,6 +1987,19 @@ struct switch_ivr_dmachine_match {
typedef struct switch_ivr_dmachine_match switch_ivr_dmachine_match_t;
typedef switch_status_t (*switch_ivr_dmachine_callback_t) (switch_ivr_dmachine_match_t *match);
#define MAX_ARG_RECURSION 25
#define arg_recursion_check_start(_args) if (_args) { \
if (_args->loops >= MAX_ARG_RECURSION) { \
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, \
"RECURSION ERROR! It's not the best idea to call things that collect input recursively from an input callback.\n"); \
return SWITCH_STATUS_GENERR; \
} else {_args->loops++;} \
}
#define arg_recursion_check_stop(_args) if (_args) _args->loops--
typedef struct {
switch_input_callback_function_t input_callback;
void *buf;
@ -1979,6 +2007,7 @@ typedef struct {
switch_read_frame_callback_function_t read_frame_callback;
void *user_data;
switch_ivr_dmachine_t *dmachine;
int loops;
} switch_input_args_t;

View File

@ -40,7 +40,80 @@
#include <switch.h>
SWITCH_BEGIN_EXTERN_C SWITCH_DECLARE(int) switch_toupper(int c);
SWITCH_BEGIN_EXTERN_C
/* https://code.google.com/p/stringencoders/wiki/PerformanceAscii */
static inline uint32_t switch_toupper(uint32_t eax)
{
uint32_t ebx = (0x7f7f7f7ful & eax) + 0x05050505ul;
ebx = (0x7f7f7f7ful & ebx) + 0x1a1a1a1aul;
ebx = ((ebx & ~eax) >> 2 ) & 0x20202020ul;
return eax - ebx;
}
#ifdef FS_64BIT
static inline void switch_toupper_max(char *s)
{
uint64_t *b,*p;
char *c;
size_t l;
l = strlen(s);
p = (uint64_t *) s;
while (l > 8) {
b = p;
*b = (uint32_t) switch_toupper(*b);
b++;
p++;
l -= 8;
}
c = (char *)p;
while(l > 0) {
*c = (char) switch_toupper(*c);
c++;
l--;
}
}
#else
static inline void switch_toupper_max(char *s)
{
uint32_t *b,*p;
char *c;
size_t l;
l = strlen(s);
p = (uint32_t *) s;
while (l > 4) {
b = p;
*b = (uint32_t) switch_toupper(*b);
b++;
p++;
l -= 4;
}
c = (char *)p;
while(l > 0) {
*c = (char) switch_toupper(*c);
c++;
l--;
}
}
#endif
SWITCH_DECLARE(int) old_switch_toupper(int c);
SWITCH_DECLARE(int) switch_tolower(int c);
SWITCH_DECLARE(int) switch_isalnum(int c);
SWITCH_DECLARE(int) switch_isalpha(int c);

View File

@ -3680,7 +3680,6 @@ static void conference_loop_output(conference_member_t *member)
member_add_file_data(member, write_frame.data, write_frame.datalen);
}
if (switch_core_session_write_frame(member->session, &write_frame, SWITCH_IO_FLAG_NONE, 0) != SWITCH_STATUS_SUCCESS) {
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
switch_mutex_unlock(member->audio_out_mutex);
break;
}
@ -5233,10 +5232,16 @@ static switch_status_t conf_api_sub_enforce_floor(conference_member_t *member, s
static switch_xml_t add_x_tag(switch_xml_t x_member, const char *name, const char *value, int off)
{
switch_size_t dlen = strlen(value) * 3 + 1;
switch_size_t dlen;
char *data;
switch_xml_t x_tag;
if (!value) {
return 0;
}
dlen = strlen(value) * 3 + 1;
x_tag = switch_xml_add_child_d(x_member, name, off);
switch_assert(x_tag);

View File

@ -24,7 +24,7 @@
* Contributor(s):
*
* Anthony Minessale II <anthm@freeswitch.org>
* Ken Rice <krice at suspicious dot org
* Ken Rice <krice@freeswitch.org>
* Mathieu Rene <mathieu.rene@gmail.com>
* Bret McDanel <trixter AT 0xdecafbad.com>
* Rupa Schomaker <rupa@rupa.com>

View File

@ -20,13 +20,13 @@
* Anthony Minessale II <anthm@freeswitch.org>
*
* The Initial Developer of this module is
* Ken Rice <krice at rmktek dot com>
* Ken Rice <krice@freeswitch.org>
*
* Portions created by the Initial Developer are Copyright (C)
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Ken Rice <krice at rmktek dot com>
* Ken Rice <krice@freeswitch.org>
*
* mod_easyroute.c -- EasyRoute
* Take Incoming DIDs and Lookup where to send them as well as retrieve

View File

@ -2217,7 +2217,7 @@ SWITCH_STANDARD_APP(fifo_track_call_function)
sql = switch_mprintf("update fifo_outbound set stop_time=0,start_time=%ld,outbound_fail_count=0,use_count=use_count+1,%s=%s+1,%s=%s+1 where uuid='%q'",
(long) switch_epoch_time_now(NULL), col1, col1, col2, col2, data);
fifo_execute_sql_queued(&sql, SWITCH_TRUE, SWITCH_TRUE);
fifo_execute_sql_queued(&sql, SWITCH_TRUE, SWITCH_FALSE);
if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_INBOUND) {

View File

@ -56,8 +56,8 @@ struct modem_state {
static struct modem_state MODEM_STATE[] = {
{MODEM_STATE_INIT, "INIT"},
{MODEM_STATE_ONHOOK, "ONHOOK"},
{MODEM_STATE_OFFHOOK, "OFFHOOK"},
{MODEM_STATE_ONHOOK, "ONHOOK"},
{MODEM_STATE_OFFHOOK, "OFFHOOK"},
{MODEM_STATE_ACQUIRED, "ACQUIRED"},
{MODEM_STATE_RINGING, "RINGING"},
{MODEM_STATE_ANSWERED, "ANSWERED"},
@ -214,9 +214,10 @@ switch_status_t modem_init(modem_t *modem, modem_control_handler_t control_handl
{
switch_status_t status = SWITCH_STATUS_SUCCESS;
#ifdef WIN32
COMMTIMEOUTS timeouts={0};
COMMTIMEOUTS timeouts = {0};
#endif
logging_state_t *logging;
memset(modem, 0, sizeof(*modem));
modem->master = -1;
@ -229,17 +230,15 @@ switch_status_t modem_init(modem_t *modem, modem_control_handler_t control_handl
#if USE_OPENPTY
if (openpty(&modem->master, &modem->slave, NULL, NULL, NULL)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Fatal error: failed to initialize pty\n");
status = SWITCH_STATUS_FALSE;
goto end;
}
if (modem->master < 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Fatal error: failed to initialize pty\n");
status = SWITCH_STATUS_FALSE;
goto end;
}
modem->stty = ttyname(modem->slave);
}
modem->stty = ttyname(modem->slave);
#else
#if WIN32
#ifdef WIN32
modem->slot = 4+globals.NEXT_ID++; /* need work here we start at COM4 for now*/
snprintf(modem->devlink, sizeof(modem->devlink), "COM%d", modem->slot);
@ -250,9 +249,9 @@ switch_status_t modem_init(modem_t *modem, modem_control_handler_t control_handl
OPEN_EXISTING,
FILE_FLAG_OVERLAPPED,
0);
if(modem->master==INVALID_HANDLE_VALUE) {
if (modem->master == INVALID_HANDLE_VALUE) {
status = SWITCH_STATUS_FALSE;
if(GetLastError()==ERROR_FILE_NOT_FOUND) {
if (GetLastError() == ERROR_FILE_NOT_FOUND) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Fatal error: Serial port does not exist\n");
goto end;
}
@ -321,16 +320,16 @@ switch_status_t modem_init(modem_t *modem, modem_control_handler_t control_handl
goto end;
}
#else
timeouts.ReadIntervalTimeout=50;
timeouts.ReadTotalTimeoutConstant=50;
timeouts.ReadTotalTimeoutMultiplier=10;
timeouts.ReadIntervalTimeout = 50;
timeouts.ReadTotalTimeoutConstant = 50;
timeouts.ReadTotalTimeoutMultiplier = 10;
timeouts.WriteTotalTimeoutConstant=50;
timeouts.WriteTotalTimeoutMultiplier=10;
timeouts.WriteTotalTimeoutConstant = 50;
timeouts.WriteTotalTimeoutMultiplier = 10;
SetCommMask(modem->master, EV_RXCHAR);
if(!SetCommTimeouts(modem->master, &timeouts)){
if (!SetCommTimeouts(modem->master, &timeouts)){
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot set up non-blocking read on %s\n", modem->devlink);
modem_close(modem);
status = SWITCH_STATUS_FALSE;
@ -347,15 +346,21 @@ switch_status_t modem_init(modem_t *modem, modem_control_handler_t control_handl
}
if (spandsp_globals.modem_verbose) {
span_log_set_message_handler(&modem->t31_state->logging, spanfax_log_message, NULL);
span_log_set_message_handler(&modem->t31_state->audio.modems.fast_modems.v17_rx.logging, spanfax_log_message, NULL);
span_log_set_message_handler(&modem->t31_state->audio.modems.fast_modems.v29_rx.logging, spanfax_log_message, NULL);
span_log_set_message_handler(&modem->t31_state->audio.modems.fast_modems.v27ter_rx.logging, spanfax_log_message, NULL);
logging = t31_get_logging_state(modem->t31_state);
span_log_set_message_handler(logging, spanfax_log_message, NULL);
span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW);
modem->t31_state->logging.level = SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW;
modem->t31_state->audio.modems.fast_modems.v17_rx.logging.level = SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW;
modem->t31_state->audio.modems.fast_modems.v29_rx.logging.level = SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW;
modem->t31_state->audio.modems.fast_modems.v27ter_rx.logging.level = SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW;
logging = v17_rx_get_logging_state(&modem->t31_state->audio.modems.fast_modems.v17_rx);
span_log_set_message_handler(logging, spanfax_log_message, NULL);
span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW);
logging = v29_rx_get_logging_state(&modem->t31_state->audio.modems.fast_modems.v29_rx);
span_log_set_message_handler(logging, spanfax_log_message, NULL);
span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW);
logging = v27ter_rx_get_logging_state(&modem->t31_state->audio.modems.fast_modems.v27ter_rx);
span_log_set_message_handler(logging, spanfax_log_message, NULL);
span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW);
}
modem->control_handler = control_handler;
@ -1311,8 +1316,8 @@ static void *SWITCH_THREAD_FUNC modem_thread(switch_thread_t *thread, void *obj)
if (!strncasecmp(buf, "AT", 2)) {
int x;
strncpy(tmp, buf, r);
for(x = 0; x < r; x++) {
if(tmp[x] == '\r' || tmp[x] == '\n') {
for (x = 0; x < r; x++) {
if (tmp[x] == '\r' || tmp[x] == '\n') {
tmp[x] = '\0';
}
}

View File

@ -1,6 +1,6 @@
BASE=../../../..
OPUS=opus-1.0.1
OPUS=opus-1.0.2
OPUS_DIR=$(switch_srcdir)/libs/$(OPUS)
OPUS_BUILDDIR=$(switch_builddir)/libs/$(OPUS)

View File

@ -79,6 +79,9 @@ static switch_status_t exec_app(switch_core_session_t *session, const char *app,
return status;
}
#define MAX_RECUR 100
#define RECUR_SPACE 4
#define MAX_RECUR_SPACE 100 * RECUR_SPACE
#define check_tz() tzoff = switch_channel_get_variable(channel, "tod_tz_offset"); \
tzname = switch_channel_get_variable(channel, "timezone"); \
@ -91,24 +94,70 @@ static switch_status_t exec_app(switch_core_session_t *session, const char *app,
break; \
} while(tzoff)
static int parse_exten(switch_core_session_t *session, switch_caller_profile_t *caller_profile, switch_xml_t xexten, switch_caller_extension_t **extension)
static int parse_exten(switch_core_session_t *session, switch_caller_profile_t *caller_profile, switch_xml_t xexten,
switch_caller_extension_t **extension, const char *exten_name, int recur)
{
switch_xml_t xcond, xaction, xexpression, xregex;
switch_channel_t *channel = switch_core_session_get_channel(session);
char *exten_name = (char *) switch_xml_attr(xexten, "name");
int proceed = 0, save_proceed = 0;
char *expression_expanded = NULL, *field_expanded = NULL;
switch_regex_t *re = NULL, *save_re = NULL;
int offset = 0;
const char *tzoff = NULL, *tzname = NULL;
const char *tmp, *tzoff = NULL, *tzname = NULL, *req_nesta = NULL;
char nbuf[128] = "";
int req_nest = 1;
char space[MAX_RECUR_SPACE] = "";
const char *orig_exten_name = exten_name;
check_tz();
if (!exten_name) {
exten_name = "_anon_";
}
if (!orig_exten_name) {
orig_exten_name = "_anon_";
}
if (recur) {
int i, j = 0, k = 0;
if (recur > MAX_RECUR) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Recursion LIMIT!\n");
return 0;
}
switch_snprintf(nbuf, sizeof(nbuf), "%s_recur_%d", exten_name, recur);
exten_name = nbuf;
space[j++] = '|';
for (i = 0; i < recur; i++) {
for (k = 0; k < RECUR_SPACE; k++) {
if (i == recur-1 && k == RECUR_SPACE-1) {
space[j++] = ' ';
} else {
space[j++] = '-';
}
}
}
if ((req_nesta = switch_xml_attr(xexten, "require-nested"))) {
req_nest = switch_true(req_nesta);
}
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(session), SWITCH_LOG_DEBUG,
"%sDialplan: Processing recursive conditions level:%d [%s] require-nested=%s\n", space,
recur, exten_name, req_nest ? "TRUE" : "FALSE");
} else {
if ((tmp = switch_xml_attr(xexten, "name"))) {
exten_name = tmp;
}
}
for (xcond = switch_xml_child(xexten, "condition"); xcond; xcond = xcond->next) {
char *field = NULL;
char *do_break_a = NULL;
@ -123,16 +172,9 @@ static int parse_exten(switch_core_session_t *session, switch_caller_profile_t *
check_tz();
time_match = switch_xml_std_datetime_check(xcond, tzoff ? &offset : NULL, tzname);
switch_safe_free(field_expanded);
switch_safe_free(expression_expanded);
if (switch_xml_child(xcond, "condition")) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Nested conditions are not allowed!\n");
proceed = 1;
goto done;
}
field = (char *) switch_xml_attr(xcond, "field");
@ -150,15 +192,25 @@ static int parse_exten(switch_core_session_t *session, switch_caller_profile_t *
}
}
if (switch_xml_child(xcond, "condition")) {
if (!(proceed = parse_exten(session, caller_profile, xcond, extension, orig_exten_name, recur + 1))) {
if (do_break_i == BREAK_NEVER) {
continue;
}
goto done;
}
}
if (time_match == 1) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(session), SWITCH_LOG_DEBUG,
"Dialplan: %s Date/Time Match (PASS) [%s] break=%s\n",
"%sDialplan: %s Date/Time Match (PASS) [%s] break=%s\n", space,
switch_channel_get_name(channel), exten_name, do_break_a ? do_break_a : "on-false");
anti_action = SWITCH_FALSE;
proceed = 1;
} else if (time_match == 0) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(session), SWITCH_LOG_DEBUG,
"Dialplan: %s Date/TimeMatch (FAIL) [%s] break=%s\n",
"%sDialplan: %s Date/TimeMatch (FAIL) [%s] break=%s\n", space,
switch_channel_get_name(channel), exten_name, do_break_a ? do_break_a : "on-false");
}
@ -178,12 +230,12 @@ static int parse_exten(switch_core_session_t *session, switch_caller_profile_t *
if (time_match == 1) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(session), SWITCH_LOG_DEBUG,
"Dialplan: %s Date/Time Match (PASS) [%s]\n",
"%sDialplan: %s Date/Time Match (PASS) [%s]\n", space,
switch_channel_get_name(channel), exten_name);
anti_action = SWITCH_FALSE;
} else if (time_match == 0) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(session), SWITCH_LOG_DEBUG,
"Dialplan: %s Date/TimeMatch (FAIL) [%s]\n",
"%sDialplan: %s Date/TimeMatch (FAIL) [%s]\n", space,
switch_channel_get_name(channel), exten_name);
}
@ -221,20 +273,21 @@ static int parse_exten(switch_core_session_t *session, switch_caller_profile_t *
if ((proceed = switch_regex_perform(field_data, expression, &re, ovector, sizeof(ovector) / sizeof(ovector[0])))) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(session), SWITCH_LOG_DEBUG,
"Dialplan: %s Regex (PASS) [%s] %s(%s) =~ /%s/ match=%s\n",
"%sDialplan: %s Regex (PASS) [%s] %s(%s) =~ /%s/ match=%s\n", space,
switch_channel_get_name(channel), exten_name, field, field_data, expression, all ? "all" : "any");
pass++;
if (!all && !xor) break;
} else {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(session), SWITCH_LOG_DEBUG,
"Dialplan: %s Regex (FAIL) [%s] %s(%s) =~ /%s/ match=%s\n",
"%sDialplan: %s Regex (FAIL) [%s] %s(%s) =~ /%s/ match=%s\n", space,
switch_channel_get_name(channel), exten_name, field, field_data, expression, all ? "all" : "any");
fail++;
if (all && !xor) break;
}
} else if (time_match == -1) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(session), SWITCH_LOG_DEBUG,
"Dialplan: %s Absolute Condition [%s] match=%s\n", switch_channel_get_name(channel), exten_name, all ? "all" : "any");
"%sDialplan: %s Absolute Condition [%s] match=%s\n", space,
switch_channel_get_name(channel), exten_name, all ? "all" : "any");
pass++;
proceed = 1;
if (!all && !xor) break;
@ -314,17 +367,18 @@ static int parse_exten(switch_core_session_t *session, switch_caller_profile_t *
if ((proceed = switch_regex_perform(field_data, expression, &re, ovector, sizeof(ovector) / sizeof(ovector[0])))) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(session), SWITCH_LOG_DEBUG,
"Dialplan: %s Regex (PASS) [%s] %s(%s) =~ /%s/ break=%s\n",
"%sDialplan: %s Regex (PASS) [%s] %s(%s) =~ /%s/ break=%s\n", space,
switch_channel_get_name(channel), exten_name, field, field_data, expression, do_break_a ? do_break_a : "on-false");
anti_action = SWITCH_FALSE;
} else {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(session), SWITCH_LOG_DEBUG,
"Dialplan: %s Regex (FAIL) [%s] %s(%s) =~ /%s/ break=%s\n",
"%sDialplan: %s Regex (FAIL) [%s] %s(%s) =~ /%s/ break=%s\n", space,
switch_channel_get_name(channel), exten_name, field, field_data, expression, do_break_a ? do_break_a : "on-false");
}
} else if (time_match == -1) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(session), SWITCH_LOG_DEBUG,
"Dialplan: %s Absolute Condition [%s]\n", switch_channel_get_name(channel), exten_name);
"%sDialplan: %s Absolute Condition [%s]\n", space,
switch_channel_get_name(channel), exten_name);
anti_action = SWITCH_FALSE;
proceed = 1;
}
@ -373,7 +427,8 @@ static int parse_exten(switch_core_session_t *session, switch_caller_profile_t *
for (;loop_count > 0; loop_count--) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(session), SWITCH_LOG_DEBUG,
"Dialplan: %s ANTI-Action %s(%s) %s\n", switch_channel_get_name(channel), application, data, xinline ? "INLINE" : "");
"%sDialplan: %s ANTI-Action %s(%s) %s\n", space,
switch_channel_get_name(channel), application, data, xinline ? "INLINE" : "");
if (xinline) {
exec_app(session, application, data);
@ -433,7 +488,8 @@ static int parse_exten(switch_core_session_t *session, switch_caller_profile_t *
}
for (;loop_count > 0; loop_count--) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(session), SWITCH_LOG_DEBUG,
"Dialplan: %s Action %s(%s) %s\n", switch_channel_get_name(channel), application, app_data, xinline ? "INLINE" : "");
"%sDialplan: %s Action %s(%s) %s\n", space,
switch_channel_get_name(channel), application, app_data, xinline ? "INLINE" : "");
if (xinline) {
exec_app(session, application, app_data);
@ -456,6 +512,9 @@ static int parse_exten(switch_core_session_t *session, switch_caller_profile_t *
switch_regex_safe_free(re);
switch_safe_free(field_expanded);
switch_safe_free(expression_expanded);
if (!req_nest) proceed = 1;
return proceed;
}
@ -551,7 +610,7 @@ SWITCH_STANDARD_DIALPLAN(dialplan_hunt)
"Dialplan: %s parsing [%s->%s] continue=%s\n",
switch_channel_get_name(channel), caller_profile->context, exten_name, cont ? cont : "false");
proceed = parse_exten(session, caller_profile, xexten, &extension);
proceed = parse_exten(session, caller_profile, xexten, &extension, exten_name, 0);
if (proceed && !switch_true(cont)) {
break;

View File

@ -1871,16 +1871,16 @@ static switch_status_t negotiate_media(switch_core_session_t *session)
}
if (switch_channel_down(channel) || switch_test_flag(tech_pvt, TFLAG_BYE)) {
goto out;
goto done;
}
if (!activate_rtp(tech_pvt)) {
goto out;
goto done;
}
if (switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) {
if (!do_candidates(tech_pvt, 0)) {
goto out;
goto done;
}
if (switch_test_flag(tech_pvt, TFLAG_TRANSPORT_ACCEPT)) {
switch_channel_answer(channel);

View File

@ -1567,15 +1567,8 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
de->session = session;
}
if (de->data->e_event == nua_i_cancel || de->data->e_event == nua_i_bye) {
sofia_set_flag(tech_pvt, TFLAG_SIGDEAD);
}
sofia_process_dispatch_event(&de);
if (!sofia_test_flag(tech_pvt, TFLAG_SIGDEAD) && (switch_channel_media_up(channel) || switch_channel_get_state(channel) > CS_ROUTING)) {
sofia_queue_message(de);
} else {
sofia_process_dispatch_event(&de);
}
switch_mutex_unlock(tech_pvt->sofia_mutex);
goto end;

View File

@ -353,7 +353,6 @@ typedef enum {
TFLAG_PASS_ACK,
TFLAG_CRYPTO_RECOVER,
TFLAG_DROP_DTMF,
TFLAG_SIGDEAD,
/* No new flags below this line */
TFLAG_MAX
} TFLAGS;

View File

@ -2481,6 +2481,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void
for (via = vias; via; via = via->v_next) {
if (sofia_test_pflag(profile, PFLAG_AUTO_ASSIGN_PORT) && !strcmp(via->v_protocol, "SIP/2.0/UDP")) {
profile->sip_port = atoi(via->v_port);
if (!profile->extsipport) profile->extsipport = profile->sip_port;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Found auto sip port %d for %s\n", profile->sip_port, profile->name);
}
@ -3212,14 +3213,14 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
gateway->register_contact = switch_core_sprintf(gateway->pool, format, extension,
sipip,
sofia_glue_transport_has_tls(gateway->register_transport) ?
profile->tls_sip_port : profile->sip_port, params, str_rfc_5626);
profile->tls_sip_port : profile->extsipport, params, str_rfc_5626);
} else {
format = strchr(sipip, ':') ? "<sip:%s@[%s]:%d%s>" : "<sip:%s@%s:%d%s>";
gateway->register_contact = switch_core_sprintf(gateway->pool, format, extension,
sipip,
sofia_glue_transport_has_tls(gateway->register_transport) ?
profile->tls_sip_port : profile->sip_port, params);
profile->tls_sip_port : profile->extsipport, params);
}
} else {
if (rfc_5626) {
@ -3227,14 +3228,14 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
gateway->register_contact = switch_core_sprintf(gateway->pool, format, gateway->name,
sipip,
sofia_glue_transport_has_tls(gateway->register_transport) ?
profile->tls_sip_port : profile->sip_port, params, str_rfc_5626);
profile->tls_sip_port : profile->extsipport, params, str_rfc_5626);
} else {
format = strchr(sipip, ':') ? "<sip:gw+%s@[%s]:%d%s>" : "<sip:gw+%s@%s:%d%s>";
gateway->register_contact = switch_core_sprintf(gateway->pool, format, gateway->name,
sipip,
sofia_glue_transport_has_tls(gateway->register_transport) ?
profile->tls_sip_port : profile->sip_port, params);
profile->tls_sip_port : profile->extsipport, params);
}
}
@ -3301,14 +3302,14 @@ static void config_sofia_profile_urls(sofia_profile_t * profile)
profile->public_url = switch_core_sprintf(profile->pool,
"sip:%s@%s%s%s:%d",
profile->contact_user,
ipv6 ? "[" : "", profile->extsipip, ipv6 ? "]" : "", profile->sip_port);
ipv6 ? "[" : "", profile->extsipip, ipv6 ? "]" : "", profile->extsipport);
}
if (profile->extsipip && !sofia_test_pflag(profile, PFLAG_AUTO_NAT)) {
char *ipv6 = strchr(profile->extsipip, ':');
profile->url = switch_core_sprintf(profile->pool,
"sip:%s@%s%s%s:%d",
profile->contact_user, ipv6 ? "[" : "", profile->extsipip, ipv6 ? "]" : "", profile->sip_port);
profile->contact_user, ipv6 ? "[" : "", profile->extsipip, ipv6 ? "]" : "", profile->extsipport);
profile->bindurl = switch_core_sprintf(profile->pool, "%s;maddr=%s", profile->url, profile->sipip);
} else {
char *ipv6 = strchr(profile->sipip, ':');
@ -3922,6 +3923,7 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name)
sofia_set_pflag(profile, PFLAG_AUTO_ASSIGN_PORT);
} else {
profile->sip_port = (switch_port_t) atoi(val);
if (!profile->extsipport) profile->extsipport = profile->sip_port;
}
} else if (!strcasecmp(var, "vad")) {
if (!strcasecmp(val, "in")) {
@ -4000,10 +4002,6 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name)
} else if (!strcasecmp(val, "auto-nat")) {
ip = NULL;
} else if (strcasecmp(val, "auto")) {
if (!profile->extsipport) {
profile->extsipport = profile->sip_port;
}
if (sofia_glue_ext_address_lookup(profile, NULL, &myip, &profile->extsipport, val, profile->pool) == SWITCH_STATUS_SUCCESS) {
ip = myip;
sofia_clear_pflag(profile, PFLAG_AUTO_NAT);
@ -4547,6 +4545,7 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name)
if (!profile->sip_port && !sofia_test_pflag(profile, PFLAG_AUTO_ASSIGN_PORT)) {
profile->sip_port = (switch_port_t) atoi(SOFIA_DEFAULT_PORT);
if (!profile->extsipport) profile->extsipport = profile->sip_port;
}
if (!profile->dialplan) {
@ -4667,10 +4666,7 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name)
}
if (profile->sipip) {
if (!profile->extsipport) {
profile->extsipport = profile->sip_port;
}
if (!profile->extsipport) profile->extsipport = profile->sip_port;
launch_sofia_profile_thread(profile);
if (profile->odbc_dsn) {
@ -7999,7 +7995,7 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia
if (sip->sip_contact->m_url->url_port) {
port = atoi(sip->sip_contact->m_url->url_port);
} else {
port = sofia_glue_transport_has_tls(transport) ? profile->tls_sip_port : profile->sip_port;
port = sofia_glue_transport_has_tls(transport) ? profile->tls_sip_port : profile->extsipport;
}
ipv6 = strchr(host, ':');

View File

@ -2318,7 +2318,7 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
ipv6 ? "[" : "", ip_addr, ipv6 ? "]" : "", tech_pvt->profile->tls_sip_port);
} else {
tech_pvt->invite_contact = switch_core_session_sprintf(session, "sip:%s@%s%s%s:%d", contact,
ipv6 ? "[" : "", ip_addr, ipv6 ? "]" : "", tech_pvt->profile->sip_port);
ipv6 ? "[" : "", ip_addr, ipv6 ? "]" : "", tech_pvt->profile->extsipport);
}
} else {
if (sofia_glue_transport_has_tls(tech_pvt->transport)) {
@ -3254,12 +3254,15 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f
}
if (!sofia_test_flag(tech_pvt, TFLAG_REINVITE) && !sofia_test_flag(tech_pvt, TFLAG_SDP) && switch_rtp_ready(tech_pvt->rtp_session)) {
if (sofia_test_flag(tech_pvt, TFLAG_VIDEO) && !switch_rtp_ready(tech_pvt->video_rtp_session)) {
goto video;
} else {
if (!sofia_test_flag(tech_pvt, TFLAG_REINVITE)) {
if (switch_rtp_ready(tech_pvt->rtp_session)) {
if (sofia_test_flag(tech_pvt, TFLAG_VIDEO) && !switch_rtp_ready(tech_pvt->video_rtp_session)) {
goto video;
}
status = SWITCH_STATUS_SUCCESS;
goto end;
}
}
}
if ((status = sofia_glue_tech_set_codec(tech_pvt, 0)) != SWITCH_STATUS_SUCCESS) {
@ -4391,7 +4394,7 @@ static switch_t38_options_t *tech_process_udptl(private_object_t *tech_pvt, sdp_
// set some default value
t38_options->T38FaxVersion = 0;
t38_options->T38MaxBitRate = 9600;
t38_options->T38MaxBitRate = 14400;
t38_options->T38FaxRateManagement = switch_core_session_strdup(tech_pvt->session, "transferredTCF");
t38_options->T38FaxUdpEC = switch_core_session_strdup(tech_pvt->session, "t38UDPRedundancy");
t38_options->T38FaxMaxBuffer = 500;
@ -6972,6 +6975,14 @@ void sofia_glue_parse_rtp_bugs(switch_rtp_bug_flag_t *flag_pole, const char *str
if (switch_stristr("~CHANGE_SSRC_ON_MARKER", str)) {
*flag_pole &= ~RTP_BUG_CHANGE_SSRC_ON_MARKER;
}
if (switch_stristr("FLUSH_JB_ON_DTMF", str)) {
*flag_pole |= RTP_BUG_FLUSH_JB_ON_DTMF;
}
if (switch_stristr("~FLUSH_JB_ON_DTMF", str)) {
*flag_pole &= ~RTP_BUG_FLUSH_JB_ON_DTMF;
}
}
char *sofia_glue_gen_contact_str(sofia_profile_t *profile, sip_t const *sip, nua_handle_t *nh, sofia_dispatch_event_t *de, sofia_nat_parse_t *np)

View File

@ -312,6 +312,8 @@ void sofia_reg_check_gateway(sofia_profile_t *profile, time_t now)
if (gateway_ptr->ib_vars) {
switch_event_destroy(&gateway_ptr->ib_vars);
}
} else {
last = gateway_ptr;
}
} else {
last = gateway_ptr;
@ -1612,12 +1614,12 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
agent, from_user, guess_ip4, profile->name, mod_sofia_globals.hostname, network_ip, network_port_c, username, realm,
mwi_user, mwi_host, guess_ip4, mod_sofia_globals.hostname, sub_host);
} else {
sql = switch_mprintf("update sip_registrations set "
sql = switch_mprintf("update sip_registrations set call_id='%q',"
"sub_host='%q', network_ip='%q',network_port='%q',"
"presence_hosts='%q', server_host='%q', orig_server_host='%q',"
"hostname='%q', orig_hostname='%q',"
"hostname='%q', orig_hostname='%q',"
"expires = %ld where sip_user='%q' and sip_username='%q' and sip_host='%q' and contact='%q'",
sub_host, network_ip, network_port_c,
call_id, sub_host, network_ip, network_port_c,
profile->presence_hosts ? profile->presence_hosts : "", guess_ip4, guess_ip4,
mod_sofia_globals.hostname, mod_sofia_globals.hostname,
(long) reg_time + (long) exptime + 60,

View File

@ -1050,13 +1050,7 @@ SWITCH_DECLARE(unsigned int) switch_queue_size(switch_queue_t *queue)
SWITCH_DECLARE(switch_status_t) switch_queue_pop(switch_queue_t *queue, void **data)
{
apr_status_t s;
do {
s = apr_queue_pop(queue, data);
} while (s == APR_EINTR);
return s;
return apr_queue_pop(queue, data);
}
SWITCH_DECLARE(switch_status_t) switch_queue_pop_timeout(switch_queue_t *queue, void **data, switch_interval_time_t timeout)
@ -1078,14 +1072,7 @@ SWITCH_DECLARE(switch_status_t) switch_queue_push(switch_queue_t *queue, void *d
SWITCH_DECLARE(switch_status_t) switch_queue_trypop(switch_queue_t *queue, void **data)
{
apr_status_t s;
do {
s = apr_queue_trypop(queue, data);
} while (s == APR_EINTR);
return s;
return apr_queue_trypop(queue, data);
}
SWITCH_DECLARE(switch_status_t) switch_queue_interrupt_all(switch_queue_t *queue)

View File

@ -756,8 +756,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_decode(switch_codec_t *codec,
switch_assert(decoded_data != NULL);
if (!codec->implementation || !switch_core_codec_ready(codec)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Codec is not initialized!\n");
abort();
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Decode Codec is not initialized!\n");
return SWITCH_STATUS_NOT_INITALIZED;
}

View File

@ -151,10 +151,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
for(i = 0; i < 2; i++) {
if (session->dmachine[i] && !switch_channel_test_flag(session->channel, CF_BROADCAST)) {
if (switch_channel_try_dtmf_lock(session->channel) == SWITCH_STATUS_SUCCESS) {
switch_ivr_dmachine_ping(session->dmachine[i], NULL);
switch_channel_dtmf_unlock(session->channel);
}
switch_ivr_dmachine_ping(session->dmachine[i], NULL);
}
}
@ -354,12 +351,19 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
goto done;
}
if (!switch_core_codec_ready(&session->bug_codec)) {
if (!switch_core_codec_ready(&session->bug_codec) && switch_core_codec_ready(read_frame->codec)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Setting BUG Codec %s:%d\n",
read_frame->codec->implementation->iananame, read_frame->codec->implementation->ianacode);
read_frame->codec->implementation->iananame, read_frame->codec->implementation->ianacode);
switch_core_codec_copy(read_frame->codec, &session->bug_codec, NULL);
if (!switch_core_codec_ready(&session->bug_codec)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "%s Error setting BUG codec %s!\n",
switch_core_session_get_name(session), read_frame->codec->implementation->iananame);
}
}
if (switch_core_codec_ready(&session->bug_codec)) {
use_codec = &session->bug_codec;
}
use_codec = &session->bug_codec;
switch_thread_rwlock_unlock(session->bug_rwlock);
switch_thread_rwlock_wrlock(session->bug_rwlock);
@ -376,7 +380,12 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
memset(session->raw_read_frame.data, 255, session->raw_read_frame.datalen);
status = SWITCH_STATUS_SUCCESS;
} else {
switch_codec_t *codec = use_codec->implementation?use_codec:read_frame->codec;
switch_codec_t *codec = use_codec;
if (!switch_core_codec_ready(codec)) {
codec = read_frame->codec;
}
switch_thread_rwlock_rdlock(session->bug_rwlock);
codec->cur_frame = read_frame;
session->read_codec->cur_frame = read_frame;

View File

@ -1667,16 +1667,7 @@ static void *SWITCH_THREAD_FUNC switch_core_session_thread_pool_manager(switch_t
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10,
"Thread pool: running:%d busy:%d popping:%d\n", session_manager.running, session_manager.busy, session_manager.popping);
if (session_manager.popping) {
int i = 0;
switch_mutex_lock(session_manager.mutex);
for (i = 0; i < session_manager.popping; i++) {
switch_queue_trypush(session_manager.thread_queue, NULL);
}
switch_mutex_unlock(session_manager.mutex);
}
switch_queue_interrupt_all(session_manager.thread_queue);
x--;
@ -1690,7 +1681,7 @@ static void *SWITCH_THREAD_FUNC switch_core_session_thread_pool_manager(switch_t
}
while(session_manager.running) {
switch_queue_trypush(session_manager.thread_queue, NULL);
switch_queue_interrupt_all(session_manager.thread_queue);
switch_yield(20000);
}

View File

@ -1261,6 +1261,7 @@ struct switch_sql_queue_manager {
char *inner_post_trans_execute;
switch_memory_pool_t *pool;
uint32_t max_trans;
uint32_t confirm;
};
static int qm_wake(switch_sql_queue_manager_t *qm)
@ -1431,6 +1432,7 @@ SWITCH_DECLARE(switch_status_t) switch_sql_queue_manager_push_confirm(switch_sql
}
switch_mutex_lock(qm->mutex);
qm->confirm++;
switch_queue_push(qm->sql_queue[pos], dup ? strdup(sql) : (char *)sql);
written = qm->pre_written[pos];
size = switch_sql_queue_manager_size(qm, pos);
@ -1451,6 +1453,10 @@ SWITCH_DECLARE(switch_status_t) switch_sql_queue_manager_push_confirm(switch_sql
}
}
switch_mutex_lock(qm->mutex);
qm->confirm--;
switch_mutex_unlock(qm->mutex);
return SWITCH_STATUS_SUCCESS;
}
@ -1733,11 +1739,13 @@ static void *SWITCH_THREAD_FUNC switch_user_sql_thread(switch_thread_t *thread,
switch_thread_cond_wait(qm->cond, qm->cond_mutex);
}
i = 4;
i = 40;
while (--i > 0 && (lc = qm_ttl(qm)) < qm->max_trans / 4) {
switch_yield(50000);
while (--i > 0 && (lc = qm_ttl(qm)) < qm->max_trans / 4 && !qm->confirm) {
switch_yield(5000);
}
}
switch_mutex_unlock(qm->cond_mutex);

View File

@ -766,13 +766,13 @@ SWITCH_DECLARE(switch_status_t) switch_event_del_header_val(switch_event_t *even
unsigned long hash = 0;
tp = event->headers;
hash = switch_ci_hashfunc_default(header_name, &hlen);
while (tp) {
hp = tp;
tp = tp->next;
x++;
switch_assert(x < 1000000);
hash = switch_ci_hashfunc_default(header_name, &hlen);
if ((!hp->hash || hash == hp->hash) && !strcasecmp(header_name, hp->name) && (zstr(val) || !strcmp(hp->value, val))) {
if (lp) {

View File

@ -141,6 +141,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_sleep(switch_core_session_t *session,
int sval = 0;
const char *var;
arg_recursion_check_start(args);
/*
if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_INBOUND && !switch_channel_test_flag(channel, CF_PROXY_MODE) &&
!switch_channel_media_ready(channel) && !switch_channel_test_flag(channel, CF_SERVICE)) {
@ -156,12 +158,12 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_sleep(switch_core_session_t *session,
for (elapsed=0; switch_channel_up(channel) && elapsed<(ms/20); elapsed++) {
if (switch_channel_test_flag(channel, CF_BREAK)) {
switch_channel_clear_flag(channel, CF_BREAK);
return SWITCH_STATUS_BREAK;
switch_goto_status(SWITCH_STATUS_BREAK, end);
}
switch_yield(20 * 1000);
}
return SWITCH_STATUS_SUCCESS;
switch_goto_status(SWITCH_STATUS_SUCCESS, end);
}
var = switch_channel_get_variable(channel, SWITCH_SEND_SILENCE_WHEN_IDLE_VARIABLE);
@ -183,7 +185,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_sleep(switch_core_session_t *session,
switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Codec Error L16@%uhz %u channels %dms\n",
imp.samples_per_second, imp.number_of_channels, imp.microseconds_per_packet / 1000);
return SWITCH_STATUS_FALSE;
switch_goto_status(SWITCH_STATUS_FALSE, end);
}
@ -213,7 +215,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_sleep(switch_core_session_t *session,
}
if (!ms) {
return SWITCH_STATUS_SUCCESS;
switch_goto_status(SWITCH_STATUS_SUCCESS, end);
}
for (;;) {
@ -303,6 +305,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_sleep(switch_core_session_t *session,
}
}
end:
arg_recursion_check_stop(args);
if (write_frame.codec) {
switch_core_codec_destroy(&codec);
}
@ -874,6 +881,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_park(switch_core_session_t *session,
unsigned char *abuf = NULL;
switch_codec_implementation_t imp = { 0 };
if (switch_channel_test_flag(channel, CF_RECOVERED) && switch_channel_test_flag(channel, CF_CONTROLLED)) {
switch_channel_clear_flag(channel, CF_CONTROLLED);
}
@ -887,6 +896,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_park(switch_core_session_t *session,
return SWITCH_STATUS_FALSE;
}
arg_recursion_check_start(args);
if ((to = switch_channel_get_variable(channel, "park_timeout"))) {
char *cause_str;
@ -931,7 +942,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_park(switch_core_session_t *session,
switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Codec Error L16@%uhz %u channels %dms\n",
imp.samples_per_second, imp.number_of_channels, imp.microseconds_per_packet / 1000);
return SWITCH_STATUS_FALSE;
switch_goto_status(SWITCH_STATUS_FALSE, end);
}
@ -982,7 +993,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_park(switch_core_session_t *session,
if (switch_channel_test_flag(channel, CF_UNICAST)) {
if (!switch_channel_media_ready(channel)) {
if (switch_channel_pre_answer(channel) != SWITCH_STATUS_SUCCESS) {
return SWITCH_STATUS_FALSE;
switch_goto_status(SWITCH_STATUS_FALSE, end);
}
}
@ -1100,6 +1111,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_park(switch_core_session_t *session,
}
end:
arg_recursion_check_stop(args);
if (write_frame.codec) {
switch_core_codec_destroy(&codec);
}
@ -1133,12 +1148,15 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_collect_digits_callback(switch_core_s
return SWITCH_STATUS_GENERR;
}
arg_recursion_check_start(args);
if (abs_timeout) {
abs_started = switch_micro_time_now();
}
if (digit_timeout) {
digit_started = switch_micro_time_now();
}
while (switch_channel_ready(channel)) {
switch_frame_t *read_frame = NULL;
switch_event_t *event;
@ -1224,6 +1242,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_collect_digits_callback(switch_core_s
}
}
arg_recursion_check_stop(args);
return status;
}
@ -2890,6 +2910,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_say(switch_core_session_t *session,
channel = switch_core_session_get_channel(session);
switch_assert(channel);
arg_recursion_check_start(args);
if (zstr(module_name)) {
module_name = "en";
}
@ -2971,6 +2994,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_say(switch_core_session_t *session,
done:
arg_recursion_check_stop(args);
if (hint_data) {
switch_event_destroy(&hint_data);
}

View File

@ -426,7 +426,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_ping(switch_ivr_dmachine_t *
is_timeout++;
}
switch_mutex_lock(dmachine->mutex);
if (switch_mutex_trylock(dmachine->mutex) != SWITCH_STATUS_SUCCESS) {
return SWITCH_STATUS_SUCCESS;
}
if (zstr(dmachine->digits) && !is_timeout) {
r = SWITCH_STATUS_SUCCESS;
@ -614,7 +616,7 @@ static void *SWITCH_THREAD_FUNC echo_video_thread(switch_thread_t *thread, void
}
#endif
SWITCH_DECLARE(void) switch_ivr_session_echo(switch_core_session_t *session, switch_input_args_t *args)
SWITCH_DECLARE(switch_status_t) switch_ivr_session_echo(switch_core_session_t *session, switch_input_args_t *args)
{
switch_status_t status;
switch_frame_t *read_frame;
@ -628,9 +630,11 @@ SWITCH_DECLARE(void) switch_ivr_session_echo(switch_core_session_t *session, swi
#endif
if (switch_channel_pre_answer(channel) != SWITCH_STATUS_SUCCESS) {
return;
return SWITCH_STATUS_FALSE;
}
arg_recursion_check_start(args);
restart:
#ifdef SWITCH_VIDEO_IN_THREADS
@ -723,6 +727,7 @@ SWITCH_DECLARE(void) switch_ivr_session_echo(switch_core_session_t *session, swi
}
#endif
return SWITCH_STATUS_SUCCESS;
}
typedef struct {
@ -3411,6 +3416,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_and_detect_speech(switch_core_se
play_and_detect_speech_state_t state = { 0, "" };
switch_channel_t *channel = switch_core_session_get_channel(session);
arg_recursion_check_start(args);
if (result == NULL) {
goto done;
}
@ -3472,6 +3479,8 @@ done:
status = SWITCH_STATUS_FALSE;
}
arg_recursion_check_stop(args);
return status;;
}

View File

@ -585,9 +585,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_execute(switch_core_session_t *s
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "IVR menu '%s' no input detected\n", menu->name);
}
errs++;
if (status == SWITCH_STATUS_SUCCESS) {
status = switch_ivr_sleep(session, 1000, SWITCH_FALSE, NULL);
}
/* breaks are ok too */
if (SWITCH_STATUS_IS_BREAK(status)) {
status = SWITCH_STATUS_SUCCESS;

View File

@ -3073,6 +3073,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
}
}
write_frame.datalen = (uint32_t) (ringback.asis ? olen : olen * 2);
write_frame.samples = (uint32_t) olen;
} else if (ringback.audio_buffer) {
if ((write_frame.datalen = (uint32_t) switch_buffer_read_loop(ringback.audio_buffer,
write_frame.data,

View File

@ -54,11 +54,14 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_phrase_macro_event(switch_core_sessio
switch_bool_t sound_prefix_enforced = switch_true(switch_channel_get_variable(channel, "sound_prefix_enforced"));
switch_bool_t local_sound_prefix_enforced = SWITCH_FALSE;
if (!macro_name) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No phrase macro specified.\n");
return status;
}
arg_recursion_check_start(args);
if (!lang) {
chan_lang = switch_channel_get_variable(channel, "default_language");
if (!chan_lang) {
@ -331,6 +334,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_phrase_macro_event(switch_core_sessio
done:
arg_recursion_check_stop(args);
if (hint_data) {
switch_event_destroy(&hint_data);
}
@ -379,6 +384,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se
int restart_limit_on_dtmf = 0;
const char *prefix, *var;
prefix = switch_channel_get_variable(channel, "sound_prefix");
if (!prefix) {
@ -404,6 +410,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se
return SWITCH_STATUS_FALSE;
}
arg_recursion_check_start(args);
if (!fh) {
fh = &lfh;
}
@ -467,6 +475,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se
write_frame.samples = write_frame.datalen / 2;
write_frame.codec = &write_codec;
} else {
arg_recursion_check_stop(args);
return SWITCH_STATUS_FALSE;
}
}
@ -519,6 +528,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se
if (switch_core_file_open(fh, file, fh->channels, read_impl.actual_samples_per_second, file_flags, NULL) != SWITCH_STATUS_SUCCESS) {
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
switch_core_session_reset(session, SWITCH_TRUE, SWITCH_TRUE);
arg_recursion_check_stop(args);
return SWITCH_STATUS_GENERR;
}
@ -590,6 +600,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se
fh->channels, read_impl.microseconds_per_packet / 1000);
switch_core_file_close(fh);
switch_core_session_reset(session, SWITCH_TRUE, SWITCH_TRUE);
arg_recursion_check_stop(args);
return SWITCH_STATUS_GENERR;
}
}
@ -796,6 +807,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se
}
switch_core_session_reset(session, SWITCH_TRUE, SWITCH_TRUE);
arg_recursion_check_stop(args);
return status;
}
@ -841,6 +854,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_gentones(switch_core_session_t *sessi
return SWITCH_STATUS_FALSE;
}
arg_recursion_check_start(args);
memset(&ts, 0, sizeof(ts));
write_frame.codec = &write_codec;
write_frame.data = data;
@ -946,6 +962,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_gentones(switch_core_session_t *sessi
switch_buffer_destroy(&audio_buffer);
teletone_destroy_session(&ts);
arg_recursion_check_stop(args);
return SWITCH_STATUS_SUCCESS;
}
@ -1084,6 +1102,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
return SWITCH_STATUS_FALSE;
}
arg_recursion_check_start(args);
if (!strcasecmp(read_impl.iananame, "l16")) {
l16++;
}
@ -1136,6 +1156,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
*arg++ = '\0';
}
if ((status = switch_ivr_phrase_macro(session, dup, arg, lang, args)) != SWITCH_STATUS_SUCCESS) {
arg_recursion_check_stop(args);
return status;
}
continue;
@ -1160,6 +1181,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
if (!zstr(engine) && !zstr(voice) && !zstr(text)) {
if ((status = switch_ivr_speak_text(session, engine, voice, text, args)) != SWITCH_STATUS_SUCCESS) {
arg_recursion_check_stop(args);
return status;
}
} else {
@ -1168,6 +1190,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
voice = (char *) switch_channel_get_variable(channel, "tts_voice");
if (engine && text) {
if ((status = switch_ivr_speak_text(session, engine, voice, text, args)) != SWITCH_STATUS_SUCCESS) {
arg_recursion_check_stop(args);
return status;
}
} else {
@ -1727,6 +1750,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
switch_safe_free(abuf);
switch_core_session_reset(session, SWITCH_FALSE, SWITCH_FALSE);
arg_recursion_check_stop(args);
return status;
}
@ -2119,6 +2145,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text_handle(switch_core_session
return SWITCH_STATUS_FALSE;
}
arg_recursion_check_start(args);
write_frame.data = abuf;
write_frame.buflen = sizeof(abuf);
@ -2149,6 +2177,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text_handle(switch_core_session
switch_size_t mylen = strlen(text) + extra + 1;
tmp = malloc(mylen);
if (!tmp) {
arg_recursion_check_stop(args);
return SWITCH_STATUS_MEMERR;
}
memset(tmp, 0, mylen);
@ -2369,6 +2398,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text_handle(switch_core_session
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "done speaking text\n");
flags = 0;
switch_core_speech_flush_tts(sh);
arg_recursion_check_stop(args);
return status;
}
@ -2426,6 +2457,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text(switch_core_session_t *ses
return SWITCH_STATUS_FALSE;
}
arg_recursion_check_start(args);
sh = &lsh;
codec = &lcodec;
timer = &ltimer;
@ -2466,6 +2499,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text(switch_core_session_t *ses
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Invalid TTS module!\n");
switch_core_session_reset(session, SWITCH_TRUE, SWITCH_TRUE);
switch_ivr_clear_speech_cache(session);
arg_recursion_check_stop(args);
return status;
}
} else if (cache_obj && strcasecmp(cache_obj->voice_name, voice_name)) {
@ -2476,6 +2510,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text(switch_core_session_t *ses
if (switch_channel_pre_answer(channel) != SWITCH_STATUS_SUCCESS) {
flags = 0;
switch_core_speech_close(sh, &flags);
arg_recursion_check_stop(args);
return SWITCH_STATUS_FALSE;
}
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "OPEN TTS %s\n", tts_name);
@ -2495,6 +2530,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text(switch_core_session_t *ses
switch_core_speech_close(sh, &flags);
switch_core_session_reset(session, SWITCH_TRUE, SWITCH_TRUE);
switch_ivr_clear_speech_cache(session);
arg_recursion_check_stop(args);
return SWITCH_STATUS_GENERR;
}
}
@ -2510,6 +2546,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text(switch_core_session_t *ses
switch_core_speech_close(sh, &flags);
switch_core_session_reset(session, SWITCH_TRUE, SWITCH_TRUE);
switch_ivr_clear_speech_cache(session);
arg_recursion_check_stop(args);
return SWITCH_STATUS_GENERR;
}
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Setup timer success %u bytes per %d ms!\n", sh->samples * 2,
@ -2539,6 +2576,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text(switch_core_session_t *ses
}
switch_core_session_reset(session, SWITCH_FALSE, SWITCH_TRUE);
arg_recursion_check_stop(args);
return status;
}

View File

@ -133,6 +133,8 @@ SWITCH_DECLARE(switch_say_type_t) switch_ivr_get_say_type_by_name(const char *na
SWITCH_DECLARE(switch_status_t) switch_ivr_say_spell(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args)
{
char *p;
arg_recursion_check_start(args);
for (p = tosay; p && *p; p++) {
int a = tolower((int) *p);
@ -147,6 +149,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_say_spell(switch_core_session_t *sess
}
}
arg_recursion_check_stop(args);
return SWITCH_STATUS_SUCCESS;
}
@ -172,24 +176,28 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_say_ip(switch_core_session_t *session
switch_input_args_t *args)
{
char *a, *b, *c, *d;
switch_status_t status = SWITCH_STATUS_SUCCESS;
arg_recursion_check_start(args);
if (!(a = switch_core_session_strdup(session, tosay))) {
return SWITCH_STATUS_FALSE;
switch_goto_status(SWITCH_STATUS_FALSE, end);
}
if (!(b = strchr(a, '.'))) {
return SWITCH_STATUS_FALSE;
switch_goto_status(SWITCH_STATUS_FALSE, end);
}
*b++ = '\0';
if (!(c = strchr(b, '.'))) {
return SWITCH_STATUS_FALSE;
switch_goto_status(SWITCH_STATUS_FALSE, end);
}
*c++ = '\0';
if (!(d = strchr(c, '.'))) {
return SWITCH_STATUS_FALSE;
switch_goto_status(SWITCH_STATUS_FALSE, end);
}
*d++ = '\0';
@ -202,7 +210,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_say_ip(switch_core_session_t *session
say_file("digits/dot.wav");
say_num(atoi(d), say_args->method);
return SWITCH_STATUS_SUCCESS;
end:
arg_recursion_check_stop(args);
return status;
}

View File

@ -97,13 +97,18 @@ static switch_hash_t *alloc_hash = NULL;
typedef struct {
srtp_hdr_t header;
char body[SWITCH_RTP_MAX_BUF_LEN];
switch_rtp_hdr_ext_t *ext;
char *ebody;
} rtp_msg_t;
#define RTP_BODY(_s) (char *) (_s->recv_msg.ebody ? _s->recv_msg.ebody : _s->recv_msg.body)
typedef struct {
switch_rtcp_hdr_t header;
char body[SWITCH_RTCP_MAX_BUF_LEN];
} rtcp_msg_t;
typedef enum {
VAD_FIRE_TALK = (1 << 0),
VAD_FIRE_NOT_TALK = (1 << 1)
@ -345,7 +350,7 @@ static handle_rfc2833_result_t handle_rfc2833(switch_rtp_t *rtp_session, switch_
#ifdef DEBUG_2833
if (rtp_session->dtmf_data.in_digit_sanity && !(rtp_session->dtmf_data.in_digit_sanity % 100)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "sanity %d\n", rtp_session->dtmf_data.in_digit_sanity);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "sanity %d %ld\n", rtp_session->dtmf_data.in_digit_sanity, bytes);
}
#endif
@ -364,7 +369,7 @@ static handle_rfc2833_result_t handle_rfc2833(switch_rtp_t *rtp_session, switch_
if (bytes > rtp_header_len && !switch_test_flag(rtp_session, SWITCH_RTP_FLAG_PROXY_MEDIA) &&
!switch_test_flag(rtp_session, SWITCH_RTP_FLAG_PASS_RFC2833) && rtp_session->recv_te && rtp_session->recv_msg.header.pt == rtp_session->recv_te) {
switch_size_t len = bytes - rtp_header_len;
unsigned char *packet = (unsigned char *) rtp_session->recv_msg.body;
unsigned char *packet = (unsigned char *) RTP_BODY(rtp_session);
int end;
uint16_t duration;
char key;
@ -372,6 +377,7 @@ static handle_rfc2833_result_t handle_rfc2833(switch_rtp_t *rtp_session, switch_
uint32_t ts;
if (!(packet[0] || packet[1] || packet[2] || packet[3]) && len >= 8) {
switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session");
packet += 4;
len -= 4;
@ -398,7 +404,7 @@ static handle_rfc2833_result_t handle_rfc2833(switch_rtp_t *rtp_session, switch_
}
}
#ifdef DEBUG_2833
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "packet[%d]: %02x %02x %02x %02x\n", (int) len, (unsigned) packet[0], (unsigned) packet[1], (unsigned) packet[2], (unsigned) packet[3]);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "packet[%d]: %02x %02x %02x %02x\n", (int) len, (unsigned char) packet[0], (unsigned char) packet[1], (unsigned char) packet[2], (unsigned char) packet[3]);
#endif
if (in_digit_seq > rtp_session->dtmf_data.in_digit_seq) {
@ -407,18 +413,24 @@ static handle_rfc2833_result_t handle_rfc2833(switch_rtp_t *rtp_session, switch_
#ifdef DEBUG_2833
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "read: %c %u %u %u %u %d %d %s\n",
key, in_digit_seq, rtp_session->dtmf_data.in_digit_seq,
key, in_digit_seq, rtp_session->dtmf_data.in_digit_seq,
ts, duration, rtp_session->recv_msg.header.m, end, end && !rtp_session->dtmf_data.in_digit_ts ? "ignored" : "");
#endif
if (!rtp_session->dtmf_data.in_digit_queued && (rtp_session->rtp_bugs & RTP_BUG_IGNORE_DTMF_DURATION) &&
rtp_session->dtmf_data.in_digit_ts) {
switch_dtmf_t dtmf = { key, switch_core_min_dtmf_duration(0), 0, SWITCH_DTMF_RTP };
if (!rtp_session->dtmf_data.in_digit_queued && rtp_session->dtmf_data.in_digit_ts) {
if ((rtp_session->rtp_bugs & RTP_BUG_IGNORE_DTMF_DURATION)) {
switch_dtmf_t dtmf = { key, switch_core_min_dtmf_duration(0), 0, SWITCH_DTMF_RTP };
#ifdef DEBUG_2833
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Early Queuing digit %c:%d\n", dtmf.digit, dtmf.duration / 8);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Early Queuing digit %c:%d\n", dtmf.digit, dtmf.duration / 8);
#endif
switch_rtp_queue_rfc2833_in(rtp_session, &dtmf);
rtp_session->dtmf_data.in_digit_queued = 1;
switch_rtp_queue_rfc2833_in(rtp_session, &dtmf);
rtp_session->dtmf_data.in_digit_queued = 1;
}
if (rtp_session->jb && (rtp_session->rtp_bugs & RTP_BUG_FLUSH_JB_ON_DTMF)) {
stfu_n_reset(rtp_session->jb);
}
}
/* only set sanity if we do NOT ignore the packet */
@ -482,7 +494,7 @@ static handle_rfc2833_result_t handle_rfc2833(switch_rtp_t *rtp_session, switch_
} else if (!rtp_session->dtmf_data.in_digit_ts) {
#ifdef DEBUG_2833
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "start %d\n", ts);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "start %d [%c]\n", ts, key);
#endif
rtp_session->dtmf_data.in_digit_ts = ts;
rtp_session->dtmf_data.last_in_digit_ts = ts;
@ -972,7 +984,7 @@ static int check_srtp_and_ice(switch_rtp_t *rtp_session)
int ret = 0;
if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_AUTO_CNG) &&
if (switch_test_flag(rtp_session, 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 * 50))) {
uint8_t data[10] = { 0 };
switch_frame_flag_t frame_flags = SFF_NONE;
@ -2758,23 +2770,26 @@ static void do_2833(switch_rtp_t *rtp_session, switch_core_session_t *session)
SWITCH_DECLARE(void) rtp_flush_read_buffer(switch_rtp_t *rtp_session, switch_rtp_flush_t flush)
{
if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_PROXY_MEDIA) ||
switch_test_flag(rtp_session, SWITCH_RTP_FLAG_VIDEO) ||
switch_test_flag(rtp_session, SWITCH_RTP_FLAG_UDPTL)) {
return;
}
if (switch_rtp_ready(rtp_session)) {
rtp_session->last_write_ts = RTP_TS_RESET;
if (!switch_test_flag(rtp_session, SWITCH_RTP_FLAG_PROXY_MEDIA) &&
!switch_test_flag(rtp_session, SWITCH_RTP_FLAG_VIDEO)) {
switch_set_flag(rtp_session, SWITCH_RTP_FLAG_FLUSH);
switch_set_flag(rtp_session, SWITCH_RTP_FLAG_FLUSH);
switch (flush) {
case SWITCH_RTP_FLUSH_STICK:
switch_set_flag_locked(rtp_session, SWITCH_RTP_FLAG_STICKY_FLUSH);
switch (flush) {
case SWITCH_RTP_FLUSH_STICK:
switch_set_flag_locked(rtp_session, SWITCH_RTP_FLAG_STICKY_FLUSH);
break;
case SWITCH_RTP_FLUSH_UNSTICK:
switch_clear_flag_locked(rtp_session, SWITCH_RTP_FLAG_STICKY_FLUSH);
break;
default:
break;
case SWITCH_RTP_FLUSH_UNSTICK:
switch_clear_flag_locked(rtp_session, SWITCH_RTP_FLAG_STICKY_FLUSH);
break;
default:
break;
}
}
}
}
@ -2866,14 +2881,30 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
switch_assert(bytes);
more:
*bytes = sizeof(rtp_msg_t);
status = switch_socket_recvfrom(rtp_session->from_addr, rtp_session->sock_input, 0, (void *) &rtp_session->recv_msg, bytes);
ts = ntohl(rtp_session->recv_msg.header.ts);
rtp_session->recv_msg.ebody = NULL;
if (*bytes) {
uint16_t seq = ntohs((uint16_t) rtp_session->recv_msg.header.seq);
if (!switch_test_flag(rtp_session, SWITCH_RTP_FLAG_PROXY_MEDIA) && !switch_test_flag(rtp_session, SWITCH_RTP_FLAG_UDPTL) &&
rtp_session->recv_msg.header.version == 2 && rtp_session->recv_msg.header.x) { /* header extensions */
rtp_session->recv_msg.ext = (switch_rtp_hdr_ext_t *) rtp_session->recv_msg.body;
rtp_session->recv_msg.ext->length = ntohs((uint16_t)rtp_session->recv_msg.ext->length);
rtp_session->recv_msg.ext->profile = ntohs((uint16_t)rtp_session->recv_msg.ext->profile);
if (rtp_session->recv_msg.ext->length < SWITCH_RTP_MAX_BUF_LEN_WORDS) {
rtp_session->recv_msg.ebody = rtp_session->recv_msg.body + (rtp_session->recv_msg.ext->length * 4) + 4;
}
}
#ifdef DEBUG_MISSED_SEQ
if (rtp_session->last_seq && rtp_session->last_seq+1 != seq) {
#ifdef DEBUG_MISSED_SEQ
//2012-11-28 18:33:11.799070 [ERR] switch_rtp.c:2883 Missed -65536 RTP frames from sequence [65536] to [-1] (missed). Time since last read [20021]
switch_size_t flushed_packets_diff = rtp_session->stats.inbound.flush_packet_count - rtp_session->last_flush_packet_count;
switch_size_t num_missed = (switch_size_t)seq - (rtp_session->last_seq+1);
@ -2907,8 +2938,9 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
flushed_packets_diff, rtp_session->last_read_time ? switch_micro_time_now()-rtp_session->last_read_time : 0);
}
}
#endif
}
#endif
rtp_session->last_seq = seq;
}
@ -3020,7 +3052,7 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_BYTESWAP) && rtp_session->recv_msg.header.pt == rtp_session->rpayload) {
switch_swap_linear((int16_t *)rtp_session->recv_msg.body, (int) *bytes - rtp_header_len);
switch_swap_linear((int16_t *)RTP_BODY(rtp_session), (int) *bytes - rtp_header_len);
}
if (rtp_session->jb && !rtp_session->pause_jb && rtp_session->recv_msg.header.version == 2 && *bytes) {
@ -3036,7 +3068,7 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
if (stfu_n_eat(rtp_session->jb, rtp_session->last_read_ts,
ntohs((uint16_t) rtp_session->recv_msg.header.seq),
rtp_session->recv_msg.header.pt,
rtp_session->recv_msg.body, *bytes - rtp_header_len, rtp_session->timer.samplecount) == STFU_ITS_TOO_LATE) {
RTP_BODY(rtp_session), *bytes - rtp_header_len, rtp_session->timer.samplecount) == STFU_ITS_TOO_LATE) {
goto more;
}
@ -3050,7 +3082,7 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
if (rtp_session->jb && !rtp_session->pause_jb) {
if ((jb_frame = stfu_n_read_a_frame(rtp_session->jb))) {
memcpy(rtp_session->recv_msg.body, jb_frame->data, jb_frame->dlen);
memcpy(RTP_BODY(rtp_session), jb_frame->data, jb_frame->dlen);
if (jb_frame->plc) {
(*flags) |= SFF_PLC;
@ -3236,6 +3268,9 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_USE_TIMER)) {
if ((switch_test_flag(rtp_session, SWITCH_RTP_FLAG_AUTOFLUSH) || switch_test_flag(rtp_session, SWITCH_RTP_FLAG_STICKY_FLUSH)) &&
!switch_test_flag(rtp_session, SWITCH_RTP_FLAG_PROXY_MEDIA) &&
!switch_test_flag(rtp_session, SWITCH_RTP_FLAG_VIDEO) &&
!switch_test_flag(rtp_session, SWITCH_RTP_FLAG_UDPTL) &&
rtp_session->read_pollfd) {
if (switch_poll(rtp_session->read_pollfd, 1, &fdr, 0) == SWITCH_STATUS_SUCCESS) {
status = read_rtp_packet(rtp_session, &bytes, flags, SWITCH_FALSE);
@ -3638,11 +3673,19 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
*flags |= SFF_PROXY_PACKET;
if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_UDPTL)) {
#if 0
if (rtp_session->recv_msg.header.version == 2 && rtp_session->recv_msg.header.pt == rtp_session->rpayload) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING,
"Ignoring udptl packet of size of %ld bytes that looks strikingly like a RTP packet.\n", (long)bytes);
bytes = 0;
goto do_continue;
}
#endif
*flags |= SFF_UDPTL_PACKET;
} else {
check_srtp_and_ice(rtp_session);
}
check_srtp_and_ice(rtp_session);
ret = (int) bytes;
goto end;
}
@ -3673,7 +3716,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
}
if (bytes && rtp_session->recv_msg.header.version != 2) {
uint8_t *data = (uint8_t *) rtp_session->recv_msg.body;
uint8_t *data = (uint8_t *) RTP_BODY(rtp_session);
if (rtp_session->recv_msg.header.version == 0) {
if (rtp_session->ice.ice_user) {
@ -3718,7 +3761,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
timer_check:
if (do_cng) {
uint8_t *data = (uint8_t *) rtp_session->recv_msg.body;
uint8_t *data = (uint8_t *) RTP_BODY(rtp_session);
do_2833(rtp_session, session);
@ -3909,7 +3952,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_read(switch_rtp_t *rtp_session, void
*datalen = bytes;
memcpy(data, rtp_session->recv_msg.body, bytes);
memcpy(data, RTP_BODY(rtp_session), bytes);
return SWITCH_STATUS_SUCCESS;
}
@ -3973,7 +4016,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_zerocopy_read_frame(switch_rtp_t *rtp
bytes = rtp_common_read(rtp_session, &frame->payload, &frame->flags, io_flags);
frame->data = rtp_session->recv_msg.body;
frame->data = RTP_BODY(rtp_session);
frame->packet = &rtp_session->recv_msg;
frame->packetlen = bytes;
frame->source = __FILE__;
@ -4061,7 +4104,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_zerocopy_read(switch_rtp_t *rtp_sessi
}
bytes = rtp_common_read(rtp_session, payload_type, flags, io_flags);
*data = rtp_session->recv_msg.body;
*data = RTP_BODY(rtp_session);
if (bytes < 0) {
*datalen = 0;
@ -4546,7 +4589,6 @@ SWITCH_DECLARE(int) switch_rtp_write_frame(switch_rtp_t *rtp_session, switch_fra
bytes = frame->packetlen;
//tx_host = switch_get_addr(bufa, sizeof(bufa), rtp_session->remote_addr);
send_msg = frame->packet;
if (!switch_test_flag(rtp_session, SWITCH_RTP_FLAG_UDPTL) && !switch_test_flag(frame, SFF_UDPTL_PACKET)) {

View File

@ -2609,7 +2609,7 @@ const short _switch_C_toupper_[1 + SWITCH_CTYPE_NUM_CHARS] = {
const short *_switch_toupper_tab_ = _switch_C_toupper_;
SWITCH_DECLARE(int) switch_toupper(int c)
SWITCH_DECLARE(int) old_switch_toupper(int c)
{
if ((unsigned int) c > 255)
return (c);