Commit e99bcfd0 authored by Tristan Matthews's avatar Tristan Matthews
Browse files

Merge branch 'master' into presence_sip_dev

Conflicts:
	daemon/src/managerimpl.cpp
	daemon/src/sip/sipaccount.h
parents 0ba34215 0bde5fde
...@@ -55,6 +55,7 @@ doc/*.html ...@@ -55,6 +55,7 @@ doc/*.html
*x86_64-unknown-* *x86_64-unknown-*
sip_autoconf.h sip_autoconf.h
os-auto.mak os-auto.mak
cc-auto.mak
build.mak build.mak
config.log config.log
config.status config.status
...@@ -69,6 +70,13 @@ config_auto.h ...@@ -69,6 +70,13 @@ config_auto.h
# Cscope/Ctags files # Cscope/Ctags files
cscope.* cscope.*
tags tags
TAGS.LST
ID
# IDE stuffs # IDE stuffs
nbproject nbproject
# JNI generated files
*_wrap.cpp
*_wrap.h
*_loader.c
...@@ -13,6 +13,7 @@ break-blocks # Pad empty lines around header blocks (e.g. 'if', 'while'.. ...@@ -13,6 +13,7 @@ break-blocks # Pad empty lines around header blocks (e.g. 'if', 'while'..
brackets=linux brackets=linux
unpad-paren # Remove unwanted space around parentheses unpad-paren # Remove unwanted space around parentheses
pad-header # Insert space padding after paren headers only (e.g. 'if', 'for', 'while'...) pad-header # Insert space padding after paren headers only (e.g. 'if', 'for', 'while'...)
pad-oper # Insert space padding around operator
formatted # only display files that have changed formatted # only display files that have changed
recursive # recursively enter subdirs recursive # recursively enter subdirs
suffix=none # don't create backup files (that's what version control is for) suffix=none # don't create backup files (that's what version control is for)
This diff is collapsed.
aclocal.m4 aclocal.m4
build-aux
configure configure
src/dbus/org.sflphone.SFLphone.service src/client/dbus/org.sflphone.SFLphone.service
src/sflphoned src/sflphoned
# Ignore sub-modules stuff # Ignore sub-modules stuff
......
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>daemon</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<triggers>clean,full,incremental,</triggers>
<arguments>
<dictionary>
<key>?name?</key>
<value></value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.append_environment</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.autoBuildTarget</key>
<value>all</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildArguments</key>
<value>-j</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildCommand</key>
<value>make</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildLocation</key>
<value>${workspace_loc:/daemon}</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
<value>clean</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.contents</key>
<value>org.eclipse.cdt.make.core.activeConfigSettings</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableAutoBuild</key>
<value>false</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableCleanBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableFullBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.fullBuildTarget</key>
<value>all</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.stopOnError</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
<value>true</value>
</dictionary>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.cdt.core.cnature</nature>
<nature>org.eclipse.cdt.core.ccnature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
</natures>
</projectDescription>
./configure --without-dbus --without-alsa --without-pulse --without-tls --without-iax2 --without-zrtp --without-sdes --without-speexdsp --without-speex
...@@ -35,6 +35,9 @@ LT_INIT ...@@ -35,6 +35,9 @@ LT_INIT
dnl Define C++ as default language dnl Define C++ as default language
AC_LANG(C++) AC_LANG(C++)
dnl Check for C++11 support
AX_CXX_COMPILE_STDCXX_11
dnl Check for header files dnl Check for header files
AC_FUNC_ALLOCA AC_FUNC_ALLOCA
AC_HEADER_STDC AC_HEADER_STDC
...@@ -74,7 +77,16 @@ PKG_CHECK_MODULES(LIBCRYPTO, libcrypto >= ${LIBCRYPTO_MIN_VERSION}, HAVE_LIBCRYP ...@@ -74,7 +77,16 @@ PKG_CHECK_MODULES(LIBCRYPTO, libcrypto >= ${LIBCRYPTO_MIN_VERSION}, HAVE_LIBCRYP
dnl Check for alsa development package - name: libasound2-dev dnl Check for alsa development package - name: libasound2-dev
ALSA_MIN_VERSION=1.0 ALSA_MIN_VERSION=1.0
PKG_CHECK_MODULES(ALSA, alsa >= ${ALSA_MIN_VERSION},, AC_MSG_ERROR([Missing alsa development package: libasound2-dev or alsa-lib-devel])) AC_ARG_WITH([alsa],
[ AS_HELP_STRING([--without-alsa], [disable support for alsa]) ],
[],
[with_alsa=yes])
AS_IF([test "x$with_alsa" = "xyes"], [
PKG_CHECK_MODULES(ALSA, alsa >= ${ALSA_MIN_VERSION},, AC_MSG_ERROR([Missing alsa development files]))
]);
AC_DEFINE_UNQUOTED([HAVE_ALSA], `if test "x$with_alsa" = "xyes"; then echo 1; else echo 0; fi`, [Define if you have alsa])
AM_CONDITIONAL(BUILD_ALSA, test "x$with_alsa" = "xyes")
dnl Check for pulseaudio development package - name: libpulse-dev dnl Check for pulseaudio development package - name: libpulse-dev
...@@ -85,15 +97,18 @@ AC_ARG_WITH([pulse], ...@@ -85,15 +97,18 @@ AC_ARG_WITH([pulse],
[with_pulse=yes]) [with_pulse=yes])
AS_IF([test "x$with_pulse" = "xyes"], [ AS_IF([test "x$with_pulse" = "xyes"], [
PKG_CHECK_MODULES(PULSEAUDIO, libpulse >= ${LIBPULSE_MIN_VERSION},, AC_MSG_ERROR([Missing pulseaudio development package: libpulse-dev])) PKG_CHECK_MODULES(PULSEAUDIO, libpulse >= ${LIBPULSE_MIN_VERSION},, AC_MSG_ERROR([Missing pulseaudio development files]))
]); ]);
AC_DEFINE_UNQUOTED([HAVE_PULSE], `if test "x$with_pulse" = "xyes"; then echo 1; else echo 0; fi`, [Define if you have pulseaudio]) AC_DEFINE_UNQUOTED([HAVE_PULSE], `if test "x$with_pulse" = "xyes"; then echo 1; else echo 0; fi`, [Define if you have pulseaudio])
AM_CONDITIONAL(BUILD_PULSE, test "x$with_pulse" = "xyes" ) AM_CONDITIONAL(BUILD_PULSE, test "x$with_pulse" = "xyes")
dnl Check for the samplerate development package - name: libsamplerate0-dev dnl Check for the samplerate development package - name: libsamplerate0-dev
LIBSAMPLERATE_MIN_VERSION=0.1.2 LIBSAMPLERATE_MIN_VERSION=0.1.2
PKG_CHECK_MODULES(SAMPLERATE, samplerate >= ${LIBSAMPLERATE_MIN_VERSION},, AC_MSG_ERROR([Missing libsamplerate development package: libsamplerate0-dev])) PKG_CHECK_MODULES(SAMPLERATE, samplerate >= ${LIBSAMPLERATE_MIN_VERSION},, AC_MSG_ERROR([Missing libsamplerate development files]))
dnl Check for the sndfile development package - name: libsndfile-dev
PKG_CHECK_MODULES(SNDFILE, sndfile,, AC_MSG_ERROR([Missing sndfile development files]))
dnl Coverage is default-disabled dnl Coverage is default-disabled
AC_ARG_ENABLE([coverage], AS_HELP_STRING([--enable-coverage], [Enable coverage])) AC_ARG_ENABLE([coverage], AS_HELP_STRING([--enable-coverage], [Enable coverage]))
...@@ -112,22 +127,22 @@ AS_IF([test "x$enable_video" = "xyes"], ...@@ -112,22 +127,22 @@ AS_IF([test "x$enable_video" = "xyes"],
dnl The libav versions correspond to the last libav release: 0.7 dnl The libav versions correspond to the last libav release: 0.7
dnl Check for libavcodec development package - name: libavcodec-dev dnl Check for libavcodec development package - name: libavcodec-dev
PKG_CHECK_MODULES(LIBAVCODEC, libavcodec >= 53.5.0,, AC_MSG_ERROR([Missing libavcodec package: libavcodec-dev])) PKG_CHECK_MODULES(LIBAVCODEC, libavcodec >= 53.5.0,, AC_MSG_ERROR([Missing libavcodec development files]))
LIBAVCODEC_CFLAGS="${LIBAVCODEC_CFLAGS} -D__STDC_CONSTANT_MACROS" LIBAVCODEC_CFLAGS="${LIBAVCODEC_CFLAGS} -D__STDC_CONSTANT_MACROS"
dnl Check for libavformat development package - name: libavformat-dev dnl Check for libavformat development package - name: libavformat-dev
PKG_CHECK_MODULES(LIBAVFORMAT, libavformat >= 53.2.0,, AC_MSG_ERROR([Missing libavformat package: libavformat-dev])) PKG_CHECK_MODULES(LIBAVFORMAT, libavformat >= 53.2.0,, AC_MSG_ERROR([Missing libavformat development files]))
dnl Check for libswscale development package - name: libswcale-dev dnl Check for libswscale development package - name: libswcale-dev
PKG_CHECK_MODULES(LIBSWSCALE, libswscale >= 1.1.0,, AC_MSG_ERROR([Missing libswscale package: libswscale-dev])) PKG_CHECK_MODULES(LIBSWSCALE, libswscale >= 1.1.0,, AC_MSG_ERROR([Missing libswscale development files]))
dnl Check for libavdevice development package - name: libavdevice-dev dnl Check for libavdevice development package - name: libavdevice-dev
PKG_CHECK_MODULES(LIBAVDEVICE, libavdevice >= 53.0.0,, AC_MSG_ERROR([Missing libavdevice package: libavdevice-dev])) PKG_CHECK_MODULES(LIBAVDEVICE, libavdevice >= 53.0.0,, AC_MSG_ERROR([Missing libavdevice development files]))
dnl Check for libavutil development package - name: libavutil-dev dnl Check for libavutil development package - name: libavutil-dev
PKG_CHECK_MODULES(LIBAVUTIL, libavutil >= 51.7.0,, AC_MSG_ERROR([Missing libavutil package: libavutil-dev])) PKG_CHECK_MODULES(LIBAVUTIL, libavutil >= 51.7.0,, AC_MSG_ERROR([Missing libavutil development files]))
PKG_CHECK_MODULES(UDEV, libudev,, AC_MSG_ERROR([Missing libudev package: libudev-dev])) PKG_CHECK_MODULES(UDEV, libudev,, AC_MSG_ERROR([Missing libudev development files]))
], ],
[AM_CONDITIONAL(SFL_VIDEO, false)]); [AM_CONDITIONAL(SFL_VIDEO, false)]);
...@@ -135,12 +150,12 @@ AS_IF([test "x$enable_video" = "xyes"], ...@@ -135,12 +150,12 @@ AS_IF([test "x$enable_video" = "xyes"],
LIBCCGNU2_MIN_VERSION=1.3.1 LIBCCGNU2_MIN_VERSION=1.3.1
PKG_CHECK_MODULES([CCGNU2], [commoncpp] >= ${LIBCCGNU2_MIN_VERSION}, AC_DEFINE_UNQUOTED([COMMONCPP_PREFIX], [1], [Use commoncpp include prefix]), [ PKG_CHECK_MODULES([CCGNU2], [commoncpp] >= ${LIBCCGNU2_MIN_VERSION}, AC_DEFINE_UNQUOTED([COMMONCPP_PREFIX], [1], [Use commoncpp include prefix]), [
PKG_CHECK_MODULES([CCGNU2], [libccgnu2] >= ${LIBCCGNU2_MIN_VERSION}, AC_DEFINE_UNQUOTED([CCPP_PREFIX], [1], [Use cc++ include prefix]), PKG_CHECK_MODULES([CCGNU2], [libccgnu2] >= ${LIBCCGNU2_MIN_VERSION}, AC_DEFINE_UNQUOTED([CCPP_PREFIX], [1], [Use cc++ include prefix]),
AC_MSG_ERROR([Missing common cpp development package: libcommoncpp2-dev])) AC_MSG_ERROR([Missing commoncpp development files]))
]) ])
LIBCCRTP_MIN_VERSION=1.3.0 LIBCCRTP_MIN_VERSION=1.3.0
PKG_CHECK_MODULES([CCRTP], [libccrtp] >= ${LIBCCRTP_MIN_VERSION},, [ PKG_CHECK_MODULES([CCRTP], [libccrtp] >= ${LIBCCRTP_MIN_VERSION},, [
PKG_CHECK_MODULES([CCRTP], [libccrtp1] >= ${LIBCCRTP_MIN_VERSION},, AC_MSG_ERROR([Missing ccrtp development package: libccrtp-dev])) PKG_CHECK_MODULES([CCRTP], [libccrtp1] >= ${LIBCCRTP_MIN_VERSION},, AC_MSG_ERROR([Missing ccrtp development files]))
]) ])
...@@ -152,7 +167,7 @@ AC_ARG_WITH([tls], ...@@ -152,7 +167,7 @@ AC_ARG_WITH([tls],
[], [],
[with_tls=yes]) [with_tls=yes])
AS_IF([test "x$with_tls" = "xyes"], [ AS_IF([test "x$with_tls" = "xyes"], [
PKG_CHECK_MODULES([libssl], libssl,, AC_MSG_ERROR([Missing ssl development package: libssl-dev])) PKG_CHECK_MODULES([libssl], libssl,, AC_MSG_ERROR([Missing ssl development files]))
]); ]);
AC_DEFINE_UNQUOTED([HAVE_TLS], `if test "x$with_tls" = "xyes"; then echo 1; else echo 0; fi`, [Define if you have tls support]) AC_DEFINE_UNQUOTED([HAVE_TLS], `if test "x$with_tls" = "xyes"; then echo 1; else echo 0; fi`, [Define if you have tls support])
...@@ -168,22 +183,23 @@ AC_ARG_WITH([zrtp], ...@@ -168,22 +183,23 @@ AC_ARG_WITH([zrtp],
[], [],
[with_zrtp=yes]) [with_zrtp=yes])
AS_IF([test "x$with_zrtp" = "xyes"], [ AS_IF([test "x$with_zrtp" = "xyes"], [
PKG_CHECK_MODULES([ZRTPCPP], libzrtpcpp >= ${LIBZRTPCPP_MIN_VERSION},, AC_MSG_ERROR([Missing zrtp development package: libzrtpcpp-dev])) PKG_CHECK_MODULES([ZRTPCPP], libzrtpcpp >= ${LIBZRTPCPP_MIN_VERSION},, AC_MSG_ERROR([Missing zrtp development files]))
]); ]);
AC_DEFINE_UNQUOTED([HAVE_ZRTP], `if test "x$with_zrtp" = "xyes"; then echo 1; else echo 0; fi`, [Define if you have zrtp support]) AC_DEFINE_UNQUOTED([HAVE_ZRTP], `if test "x$with_zrtp" = "xyes"; then echo 1; else echo 0; fi`, [Define if you have zrtp support])
AM_CONDITIONAL(BUILD_ZRTP, test "x$with_zrtp" = "xyes" ) AM_CONDITIONAL(BUILD_ZRTP, test "x$with_zrtp" = "xyes" )
# DBUSCPP
dnl Check for dbuscpp, the C++ bindings for D-Bus
AC_ARG_WITH([dbus],
[AS_HELP_STRING([--without-dbus], [disable support for dbus])],
[],
[with_dbus=yes])
AS_IF([test "x$with_dbus" = "xyes"], [
PKG_CHECK_MODULES(DBUSCPP, dbus-c++-1,, AC_MSG_WARN([Missing dbus development files]))
]);
# DBUS AC_DEFINE_UNQUOTED([HAVE_DBUS], `if test "x$with_dbus" = "xyes"; then echo 1; else echo 0; fi`, [Define if you have dbus support])
# required dependency(ies): libdbus-c++
dnl DBus-C++ detection
dnl pkg-config doesn't like 0.6.0-pre1 version number, it assumes that it is
dnl more recent than (unreleased) 0.6.0
DBUS_CPP_REQUIRED_VERSION=0.6.0-pre1
PKG_CHECK_MODULES(DBUSCPP, dbus-c++-1,,
AC_MSG_ERROR([You need the DBus-c++ libraries (version $DBUS_CPP_REQUIRED_VERSION or better)]))
# Instant Messaging # Instant Messaging
# required dependency(ies): libxpat # required dependency(ies): libxpat
...@@ -193,7 +209,7 @@ AC_ARG_WITH([instant_messaging], ...@@ -193,7 +209,7 @@ AC_ARG_WITH([instant_messaging],
[with_instant_messaging=yes]) [with_instant_messaging=yes])
AS_IF([test "x$with_instant_messaging" = "xyes"], [ AS_IF([test "x$with_instant_messaging" = "xyes"], [
AX_LIB_EXPAT([1.95.0]) AX_LIB_EXPAT([1.95.0])
AS_IF([test "$HAVE_EXPAT" != "yes"], [AC_MSG_ERROR([libexpat could not be found, which is required to build this package.])], []) AS_IF([test "$HAVE_EXPAT" != "yes"], [AC_MSG_ERROR([Missing libexpat development files])], [])
]); ]);
AC_DEFINE_UNQUOTED([HAVE_INSTANT_MESSAGING], `if test "x$with_instant_messaging" = "xyes"; then echo 1; else echo 0; fi`, [Define if you have instant messaging support]) AC_DEFINE_UNQUOTED([HAVE_INSTANT_MESSAGING], `if test "x$with_instant_messaging" = "xyes"; then echo 1; else echo 0; fi`, [Define if you have instant messaging support])
...@@ -253,7 +269,7 @@ AC_ARG_WITH([speex], ...@@ -253,7 +269,7 @@ AC_ARG_WITH([speex],
[with_speex=yes]) [with_speex=yes])
AS_IF([test "x$with_speex" != xno], AS_IF([test "x$with_speex" != xno],
[AC_CHECK_HEADER([speex/speex.h], , AC_MSG_FAILURE([Unable to find the libspeex headers (you may need to install the dev package). You may use --without-speex to compile without speex codec support.]))] [AC_CHECK_HEADER([speex/speex.h], , AC_MSG_FAILURE([Missing speex development files. You may use --without-speex to compile without speex codec support.]))]
[AC_CHECK_LIB([speex], [speex_decode_int], [AC_CHECK_LIB([speex], [speex_decode_int],
[], [],
[AC_MSG_FAILURE([libspeex link test failed. You may use --without-speex to compile without speex codec support.])]) [AC_MSG_FAILURE([libspeex link test failed. You may use --without-speex to compile without speex codec support.])])
...@@ -273,7 +289,7 @@ AC_ARG_WITH([speexdsp], ...@@ -273,7 +289,7 @@ AC_ARG_WITH([speexdsp],
[with_speexdsp=yes]) [with_speexdsp=yes])
AS_IF([test "x$with_speexdsp" != xno], AS_IF([test "x$with_speexdsp" != xno],
AC_CHECK_HEADER([speex/speex_preprocess.h], , AC_MSG_FAILURE([Unable to find the libspeexdsp headers (you may need to install the libspeexdsp-dev package) used for Noise Suppression and Automatic Gain Control.])) AC_CHECK_HEADER([speex/speex_preprocess.h], , AC_MSG_FAILURE([Missing libspeexdsp development files used for Noise Suppression and Automatic Gain Control.]))
AC_SEARCH_LIBS([speex_preprocess_run], [speexdsp], [], [AC_MSG_ERROR([Unable to find speexdsp development files])]) AC_SEARCH_LIBS([speex_preprocess_run], [speexdsp], [], [AC_MSG_ERROR([Unable to find speexdsp development files])])
) )
...@@ -365,7 +381,8 @@ AC_CONFIG_FILES([Makefile \ ...@@ -365,7 +381,8 @@ AC_CONFIG_FILES([Makefile \
src/audio/sound/Makefile \ src/audio/sound/Makefile \
src/audio/codecs/Makefile \ src/audio/codecs/Makefile \
src/config/Makefile \ src/config/Makefile \
src/dbus/Makefile \ src/client/Makefile \
src/client/dbus/Makefile \
src/hooks/Makefile \ src/hooks/Makefile \
src/history/Makefile \ src/history/Makefile \
src/video/Makefile \ src/video/Makefile \
......
...@@ -25,6 +25,12 @@ else ...@@ -25,6 +25,12 @@ else
SPEEXCODEC= SPEEXCODEC=
endif endif
if BUILD_OPUS
OPUSCODEC=-DHAVE_OPUS
else
OPUSCODEC=
endif
if BUILD_GSM if BUILD_GSM
GSMCODEC=-DHAVE_GSM_CODEC GSMCODEC=-DHAVE_GSM_CODEC
else else
...@@ -46,8 +52,9 @@ AM_CPPFLAGS = \ ...@@ -46,8 +52,9 @@ AM_CPPFLAGS = \
-DCODECS_DIR=\""$(sflcodecdir)"\" \ -DCODECS_DIR=\""$(sflcodecdir)"\" \
-DPLUGINS_DIR=\""$(sflplugindir)"\" \ -DPLUGINS_DIR=\""$(sflplugindir)"\" \
-DENABLE_TRACE \ -DENABLE_TRACE \
$(SPEEXCODEC) \ $(SPEEXCODEC) \
$(GSMCODEC) $(GSMCODEC) \
$(OPUSCODEC)
indent: indent:
......
...@@ -564,7 +564,7 @@ static int calc_timestamp(struct iax_session *session, unsigned int ts, struct a ...@@ -564,7 +564,7 @@ static int calc_timestamp(struct iax_session *session, unsigned int ts, struct a
special cases. */ special cases. */
if (ts) if (ts)
{ {
if ( f && session ) if ( f )
session->lastsent = ts; session->lastsent = ts;
return ts; return ts;
} }
...@@ -842,12 +842,14 @@ static int iax_reliable_xmit(struct iax_frame *f) ...@@ -842,12 +842,14 @@ static int iax_reliable_xmit(struct iax_frame *f)
if (!fc->data || !fc->datalen) { if (!fc->data || !fc->datalen) {
IAXERROR "No frame data?"); IAXERROR "No frame data?");
DEBU(G "No frame data?\n"); DEBU(G "No frame data?\n");
free(fc);
return -1; return -1;
} else { } else {
fc->data = (char *)malloc(fc->datalen); fc->data = (char *)malloc(fc->datalen);
if (!fc->data) { if (!fc->data) {
DEBU(G "Out of memory\n"); DEBU(G "Out of memory\n");
IAXERROR "Out of memory\n"); IAXERROR "Out of memory\n");
free(fc);
return -1; return -1;
} }
memcpy(fc->data, f->data, f->datalen); memcpy(fc->data, f->data, f->datalen);
...@@ -876,7 +878,7 @@ int iax_init(int preferredportno) ...@@ -876,7 +878,7 @@ int iax_init(int preferredportno)
if (iax_recvfrom == (iax_recvfrom_t)recvfrom) if (iax_recvfrom == (iax_recvfrom_t)recvfrom)
{ {
struct sockaddr_in sin; struct sockaddr_in sin = {};
socklen_t sinlen; socklen_t sinlen;
int flags; int flags;
int bufsize = 256 * 1024; int bufsize = 256 * 1024;
...@@ -1198,7 +1200,7 @@ static int iax_send(struct iax_session *pvt, struct ast_frame *f, unsigned int t ...@@ -1198,7 +1200,7 @@ static int iax_send(struct iax_session *pvt, struct ast_frame *f, unsigned int t
res = iax_xmit_frame(fr); res = iax_xmit_frame(fr);
} }
} }
if( !now && fr!=NULL ) if( !now )
iax_frame_free( fr ); iax_frame_free( fr );
return res; return res;
} }
...@@ -1989,6 +1991,7 @@ void iax_pref_codec_del(struct iax_session *session, unsigned int format) ...@@ -1989,6 +1991,7 @@ void iax_pref_codec_del(struct iax_session *session, unsigned int format)
char remove = which_bit(format) + diff; char remove = which_bit(format) + diff;
strncpy(old, session->codec_order, sizeof(old)); strncpy(old, session->codec_order, sizeof(old));
old[sizeof(old) - 1] = '\0';
session->codec_order_len = 0; session->codec_order_len = 0;
for (x = 0; x < (int) strlen(old); x++) { for (x = 0; x < (int) strlen(old); x++) {
...@@ -2644,6 +2647,7 @@ static struct iax_event *iax_header_to_event(struct iax_session *session, struct ...@@ -2644,6 +2647,7 @@ static struct iax_event *iax_header_to_event(struct iax_session *session, struct
strncpy(session->codec_order, strncpy(session->codec_order,
e->ies.codec_prefs, e->ies.codec_prefs,
sizeof(session->codec_order)); sizeof(session->codec_order));
session->codec_order[sizeof(session->codec_order) - 1] = '\0';
session->codec_order_len = session->codec_order_len =
(int)strlen(session->codec_order); (int)strlen(session->codec_order);
} }
...@@ -3128,7 +3132,7 @@ struct iax_event *iax_net_process(unsigned char *buf, int len, struct sockaddr_i ...@@ -3128,7 +3132,7 @@ struct iax_event *iax_net_process(unsigned char *buf, int len, struct sockaddr_i
static struct iax_sched *iax_get_sched(struct timeval tv) static struct iax_sched *iax_get_sched(struct timeval tv)
{ {
struct iax_sched *cur, *prev=NULL; struct iax_sched *cur;
cur = schedq; cur = schedq;
/* Check the event schedule first. */ /* Check the event schedule first. */
while(cur) { while(cur) {
...@@ -3136,11 +3140,7 @@ static struct iax_sched *iax_get_sched(struct timeval tv) ...@@ -3136,11 +3140,7 @@ static struct iax_sched *iax_get_sched(struct timeval tv)
((tv.tv_sec == cur->when.tv_sec) && ((tv.tv_sec == cur->when.tv_sec) &&
(tv.tv_usec >= cur->when.tv_usec))) { (tv.tv_usec >= cur->when.tv_usec))) {
/* Take it out of the event queue */ /* Take it out of the event queue */
if (prev) { schedq = cur->next;
prev->next = cur->next;
} else {
schedq = cur->next;
}
return cur; return cur;
} }
cur = cur->next; cur = cur->next;
......
...@@ -369,7 +369,7 @@ void iax_showframe(struct iax_frame *f, struct ast_iax2_full_hdr *fhi, int rx, s ...@@ -369,7 +369,7 @@ void iax_showframe(struct iax_frame *f, struct ast_iax2_full_hdr *fhi, int rx, s
/* Don't mess with mini-frames */ /* Don't mess with mini-frames */
return; return;
} }
if (fh->type > (int)sizeof(frames)/(int)sizeof(char *)) { if (fh->type >= (int)sizeof(frames)/(int)sizeof(char *)) {
snprintf(class2, (int)sizeof(class2), "(%d?)", fh->type); snprintf(class2, (int)sizeof(class2), "(%d?)", fh->type);
clas = class2; clas = class2;
} else { } else {
...@@ -386,7 +386,7 @@ void iax_showframe(struct iax_frame *f, struct ast_iax2_full_hdr *fhi, int rx, s ...@@ -386,7 +386,7 @@ void iax_showframe(struct iax_frame *f, struct ast_iax2_full_hdr *fhi, int rx, s
subclass = iaxs[(int)fh->csub]; subclass = iaxs[(int)fh->csub];
} }
} else if (fh->type == AST_FRAME_CONTROL) { } else if (fh->type == AST_FRAME_CONTROL) {
if (fh->csub > (int)sizeof(cmds)/(int)sizeof(char *)) { if (fh->csub >= (int)sizeof(cmds)/(int)sizeof(char *)) {
snprintf(subclass2, (int)sizeof(subclass2), "(%d?)", fh->csub); snprintf(subclass2, (int)sizeof(subclass2), "(%d?)", fh->csub);
subclass = subclass2; subclass = subclass2;
} else { } else {
......
...@@ -237,8 +237,10 @@ static void history_calc_maxbuf(jitterbuf *jb) ...@@ -237,8 +237,10 @@ static void history_calc_maxbuf(jitterbuf *jb)
for (j=0;j<JB_HISTORY_MAXBUF_SZ;j++) { for (j=0;j<JB_HISTORY_MAXBUF_SZ;j++) {
/* found where it fits */ /* found where it fits */
if (toins > jb->hist_maxbuf[j]) { if (toins > jb->hist_maxbuf[j]) {
/* move over */ /* move over if there's space */
memmove(jb->hist_maxbuf + j + 1, jb->hist_maxbuf + j, (JB_HISTORY_MAXBUF_SZ - (j + 1)) * sizeof(jb->hist_maxbuf[0])); const size_t slide = (JB_HISTORY_MAXBUF_SZ - (j + 1)) * sizeof(jb->hist_maxbuf[0]);
if (j < (JB_HISTORY_MAXBUF_SZ - 1))
memmove(jb->hist_maxbuf + j + 1, jb->hist_maxbuf + j, slide);
/* insert */ /* insert */
jb->hist_maxbuf[j] = toins; jb->hist_maxbuf[j] = toins;
...@@ -254,8 +256,10 @@ static void history_calc_maxbuf(jitterbuf *jb) ...@@ -254,8 +256,10 @@ static void history_calc_maxbuf(jitterbuf *jb)
for (j=0;j<JB_HISTORY_MAXBUF_SZ;j++) { for (j=0;j<JB_HISTORY_MAXBUF_SZ;j++) {
/* found where it fits */ /* found where it fits */
if (toins < jb->hist_minbuf[j]) { if (toins < jb->hist_minbuf[j]) {
/* move over */ /* move over if there's space */
memmove(jb->hist_minbuf + j + 1, jb->hist_minbuf + j, (JB_HISTORY_MAXBUF_SZ - (j + 1)) * sizeof(jb->hist_minbuf[0])); const size_t slide = (JB_HISTORY_MAXBUF_SZ - (j + 1)) * sizeof(jb->hist_minbuf[0]);
if (j < (JB_HISTORY_MAXBUF_SZ - 1))
memmove(jb->hist_minbuf + j + 1, jb->hist_minbuf + j, slide);
/* insert */ /* insert */
jb->hist_minbuf[j] = toins; jb->hist_minbuf[j] = toins;
...@@ -263,18 +267,6 @@ static void history_calc_maxbuf(jitterbuf *jb) ...@@ -263,18 +267,6 @@ static void history_calc_maxbuf(jitterbuf *jb)
} }
} }
} }
if (0) {
int k;
fprintf(stderr, "toins = %ld\n", toins);
fprintf(stderr, "maxbuf =");
for (k=0;k<JB_HISTORY_MAXBUF_SZ;k++)
fprintf(stderr, "%ld ", jb->hist_maxbuf[k]);
fprintf(stderr, "\nminbuf =");
for (k=0;k<JB_HISTORY_MAXBUF_SZ;k++)
fprintf(stderr, "%ld ", jb->hist_minbuf[k]);
fprintf(stderr, "\n");
}
} }
jb->hist_maxbuf_valid = 1; jb->hist_maxbuf_valid = 1;
......
...@@ -116,7 +116,7 @@ void IAX_MD5Update(struct IAX_MD5Context *ctx, uint8_t const *buf, unsigned int ...@@ -116,7 +116,7 @@ void IAX_MD5Update(struct IAX_MD5Context *ctx, uint8_t const *buf, unsigned int
} }