Merge branch 'signalwire:master' into ss
This commit is contained in:
commit
7f29c65b35
|
@ -1 +1 @@
|
|||
1.10.10-dev
|
||||
1.10.11-dev
|
||||
|
|
|
@ -9,11 +9,11 @@
|
|||
|
||||
Before you start to modify this default please visit this wiki page:
|
||||
|
||||
http://wiki.freeswitch.org/wiki/Getting_Started_Guide#Some_stuff_to_try_out.21
|
||||
https://developer.signalwire.com/freeswitch/FreeSWITCH-Explained/Configuration/Default-Configuration_6587388/#6-configuration-files
|
||||
|
||||
If all else fails you can read our FAQ located at:
|
||||
|
||||
http://wiki.freeswitch.org/wiki/FreeSwitch_FAQ
|
||||
https://developer.signalwire.com/freeswitch/FreeSWITCH-Explained/Miscellaneous/FAQ/
|
||||
|
||||
NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE
|
||||
-->
|
||||
|
|
56
configure.ac
56
configure.ac
|
@ -3,10 +3,10 @@
|
|||
|
||||
# Must change all of the below together
|
||||
# For a release, set revision for that tagged release as well and uncomment
|
||||
AC_INIT([freeswitch], [1.10.10-dev], bugs@freeswitch.org)
|
||||
AC_INIT([freeswitch], [1.10.11-dev], bugs@freeswitch.org)
|
||||
AC_SUBST(SWITCH_VERSION_MAJOR, [1])
|
||||
AC_SUBST(SWITCH_VERSION_MINOR, [10])
|
||||
AC_SUBST(SWITCH_VERSION_MICRO, [10-dev])
|
||||
AC_SUBST(SWITCH_VERSION_MICRO, [11-dev])
|
||||
AC_SUBST(SWITCH_VERSION_REVISION, [])
|
||||
AC_SUBST(SWITCH_VERSION_REVISION_HUMAN, [])
|
||||
|
||||
|
@ -582,7 +582,7 @@ AC_SUBST(SYS_XMLRPC_CFLAGS)
|
|||
AC_SUBST(SYS_XMLRPC_LDFLAGS)
|
||||
AM_CONDITIONAL([SYSTEM_XMLRPCC],[test "${enable_xmlrpcc}" = "yes"])
|
||||
|
||||
for luaversion in luajit lua5.2 lua-5.2 lua52 lua5.1 lua-5.1 lua; do
|
||||
for luaversion in luajit lua5.3 lua-5.3 lua53 lua5.2 lua-5.2 lua52 lua5.1 lua-5.1 lua; do
|
||||
PKG_CHECK_MODULES([LUA],[${luaversion}],[have_lua=yes],[have_lua=no])
|
||||
if test ${have_lua} = yes; then
|
||||
break
|
||||
|
@ -1352,7 +1352,21 @@ PKG_CHECK_MODULES([MPG123], [libmpg123 >= 1.16.0],[
|
|||
AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_MPG123],[false])])
|
||||
|
||||
PKG_CHECK_MODULES([SHOUT], [shout >= 2.2.2],[
|
||||
AM_CONDITIONAL([HAVE_SHOUT],[true])],[
|
||||
AM_CONDITIONAL([HAVE_SHOUT],[true])
|
||||
SHOUT_VERSION="`$PKG_CONFIG --modversion shout`"
|
||||
SHOUT_MAJOR_VERSION="`echo $SHOUT_VERSION | cut -d. -f1`"
|
||||
SHOUT_MINOR_VERSION="`echo $SHOUT_VERSION | cut -d. -f2`"
|
||||
SHOUT_PATCH_VERSION="`echo $SHOUT_VERSION | cut -d. -f3`"
|
||||
test -n "$SHOUT_PATCH_VERSION" || SHOUT_PATCH_VERSION=0
|
||||
AC_MSG_NOTICE([SHOUT version: $SHOUT_VERSION])
|
||||
AC_MSG_NOTICE([SHOUT major version: $SHOUT_MAJOR_VERSION])
|
||||
AC_MSG_NOTICE([SHOUT minor version: $SHOUT_MINOR_VERSION])
|
||||
AC_MSG_NOTICE([SHOUT patch version: $SHOUT_PATCH_VERSION])
|
||||
AC_SUBST([SHOUT_VERSION])
|
||||
AC_SUBST([SHOUT_MAJOR_VERSION])
|
||||
AC_SUBST([SHOUT_MINOR_VERSION])
|
||||
AC_SUBST([SHOUT_PATCH_VERSION])
|
||||
],[
|
||||
AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_SHOUT],[false])])
|
||||
|
||||
mp3lame=false
|
||||
|
@ -1518,26 +1532,32 @@ PKG_CHECK_MODULES([V8FS_STATIC], [v8-6.1_static >= 6.1.298],[
|
|||
])
|
||||
])
|
||||
|
||||
PKG_CHECK_MODULES([KS], [libks >= 1.8.2],[
|
||||
PKG_CHECK_MODULES([KS], [libks2 >= 2.0.0],[
|
||||
AM_CONDITIONAL([HAVE_KS],[true])],[
|
||||
if module_enabled mod_verto; then
|
||||
AC_MSG_ERROR([You need to either install libks or disable mod_verto in modules.conf])
|
||||
else
|
||||
if module_enabled mod_signalwire; then
|
||||
AC_MSG_ERROR([You need to either install libks or disable mod_signalwire in modules.conf])
|
||||
PKG_CHECK_MODULES([KS], [libks >= 1.8.2],[
|
||||
AM_CONDITIONAL([HAVE_KS],[true])],[
|
||||
if module_enabled mod_verto; then
|
||||
AC_MSG_ERROR([You need to either install libks2 or libks or disable mod_verto in modules.conf])
|
||||
else
|
||||
AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_KS],[false])
|
||||
if module_enabled mod_signalwire; then
|
||||
AC_MSG_ERROR([You need to either install libks2 or libks or disable mod_signalwire in modules.conf])
|
||||
else
|
||||
AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_KS],[false])
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
])
|
||||
])
|
||||
|
||||
PKG_CHECK_MODULES([SIGNALWIRE_CLIENT], [signalwire_client >= 1.0.0],[
|
||||
PKG_CHECK_MODULES([SIGNALWIRE_CLIENT], [signalwire_client2 >= 2.0.0],[
|
||||
AM_CONDITIONAL([HAVE_SIGNALWIRE_CLIENT],[true])],[
|
||||
if module_enabled mod_signalwire; then
|
||||
AC_MSG_ERROR([You need to either install signalwire-client-c or disable mod_signalwire in modules.conf])
|
||||
else
|
||||
AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_SIGNALWIRE_CLIENT],[false])
|
||||
fi
|
||||
PKG_CHECK_MODULES([SIGNALWIRE_CLIENT], [signalwire_client >= 1.0.0],[
|
||||
AM_CONDITIONAL([HAVE_SIGNALWIRE_CLIENT],[true])],[
|
||||
if module_enabled mod_signalwire; then
|
||||
AC_MSG_ERROR([You need to either install signalwire-client-c2 or signalwire-client-c or disable mod_signalwire in modules.conf])
|
||||
else
|
||||
AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_SIGNALWIRE_CLIENT],[false])
|
||||
fi
|
||||
])
|
||||
])
|
||||
|
||||
PKG_CHECK_MODULES([AMQP], [librabbitmq >= 0.5.2],[
|
||||
|
|
|
@ -29,7 +29,7 @@ conf_dir="../conf"
|
|||
lang_dir="../conf/vanilla/lang"
|
||||
fs_description="FreeSWITCH is a scalable open source cross-platform telephony platform designed to route and interconnect popular communication protocols using audio, video, text or any other form of media."
|
||||
mod_build_depends="." mod_depends="." mod_recommends="." mod_suggests="."
|
||||
supported_debian_distros="wheezy jessie stretch buster bullseye sid"
|
||||
supported_debian_distros="wheezy jessie stretch buster bullseye bookworm sid"
|
||||
supported_ubuntu_distros="trusty utopic xenial"
|
||||
supported_distros="$supported_debian_distros $supported_ubuntu_distros"
|
||||
avoid_mods=(
|
||||
|
@ -71,6 +71,9 @@ avoid_mods_sid=(
|
|||
avoid_mods_jessie=(
|
||||
directories/mod_ldap
|
||||
)
|
||||
avoid_mods_bookworm=(
|
||||
languages/mod_python
|
||||
)
|
||||
avoid_mods_wheezy=(
|
||||
event_handlers/mod_amqp
|
||||
languages/mod_java
|
||||
|
@ -325,7 +328,7 @@ Build-Depends:
|
|||
# configure options
|
||||
libssl1.0-dev | libssl-dev, unixodbc-dev, libpq-dev,
|
||||
libncurses5-dev, libjpeg62-turbo-dev | libjpeg-turbo8-dev | libjpeg62-dev | libjpeg8-dev,
|
||||
python-dev | python-dev-is-python2, python3-dev, python-all-dev, python-support (>= 0.90) | dh-python, erlang-dev, libtpl-dev (>= 1.5),
|
||||
python-dev | python-dev-is-python2 | python-dev-is-python3, python3-dev, python-all-dev | python3-all-dev, python-support (>= 0.90) | dh-python, erlang-dev, libtpl-dev (>= 1.5),
|
||||
# documentation
|
||||
doxygen,
|
||||
# for APR (not essential for build)
|
||||
|
|
|
@ -12,6 +12,7 @@ Module: applications/mod_av
|
|||
Description: mod_av
|
||||
Adds mod_av.
|
||||
Build-Depends: libavformat-dev, libswscale-dev, libavresample-dev
|
||||
Build-Depends-Bookworm: libavformat-dev, libswscale-dev, libswresample-dev
|
||||
|
||||
Module: applications/mod_avmd
|
||||
Description: Advanced voicemail detection
|
||||
|
@ -209,7 +210,7 @@ Description: Adds mod_skel
|
|||
Module: applications/mod_signalwire
|
||||
Description: mod_signalwire
|
||||
Adds mod_signalwire.
|
||||
Build-Depends: libks, signalwire-client-c
|
||||
Build-Depends: libks2, signalwire-client-c2
|
||||
|
||||
Module: applications/mod_sms
|
||||
Description: Astract SMS
|
||||
|
@ -485,6 +486,7 @@ Description: Adds mod_verto.
|
|||
Build-Depends: libperl-dev
|
||||
Build-Depends-Buster: libperl-dev, libgdbm-compat-dev
|
||||
Build-Depends-Bullseye: libperl-dev, libgdbm-compat-dev
|
||||
Build-Depends-Bookworm: libperl-dev, libgdbm-compat-dev
|
||||
|
||||
## mod/event_handlers
|
||||
|
||||
|
@ -647,6 +649,7 @@ Module: languages/mod_lua
|
|||
Description: mod_lua
|
||||
Adds mod_lua.
|
||||
Build-Depends: liblua5.2-dev | liblua5.1-dev
|
||||
Build-Depends-Bookworm: liblua5.3-dev | liblua5.2-dev | liblua5.1-dev
|
||||
|
||||
Module: languages/mod_managed
|
||||
Description: mod_managed
|
||||
|
@ -659,6 +662,7 @@ Description: mod_perl
|
|||
Build-Depends: libperl-dev
|
||||
Build-Depends-Buster: libperl-dev, libgdbm-compat-dev
|
||||
Build-Depends-Bullseye: libperl-dev, libgdbm-compat-dev
|
||||
Build-Depends-Bookworm: libperl-dev, libgdbm-compat-dev
|
||||
|
||||
Module: languages/mod_python
|
||||
Description: mod_python
|
||||
|
@ -669,6 +673,7 @@ Module: languages/mod_python3
|
|||
Description: mod_python3
|
||||
Adds mod_python3.
|
||||
Build-Depends: python3-dev
|
||||
Build-Depends-Bookworm: python3-dev, python3-setuptools
|
||||
|
||||
Module: languages/mod_v8
|
||||
Description: mod_v8
|
||||
|
|
|
@ -46,6 +46,7 @@ find_distro () {
|
|||
case "$1" in
|
||||
experimental) echo "sid";;
|
||||
unstable) echo "sid";;
|
||||
experimental) echo "bookworm";;
|
||||
testing) echo "bullseye";;
|
||||
stable) echo "buster";;
|
||||
oldstable) echo "stretch";;
|
||||
|
@ -56,6 +57,7 @@ find_distro () {
|
|||
find_suite () {
|
||||
case "$1" in
|
||||
sid) echo "unstable";;
|
||||
bookworm) echo "experimental";;
|
||||
bullseye) echo "testing";;
|
||||
buster) echo "stable";;
|
||||
stretch) echo "oldstable";;
|
||||
|
|
|
@ -497,7 +497,7 @@ the entries aloud via a TTS engine
|
|||
Summary: FreeSWITCH mod_signalwire
|
||||
Group: System/Libraries
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
BuildRequires: libks signalwire-client-c
|
||||
BuildRequires: libks2 signalwire-client-c2
|
||||
|
||||
%description application-signalwire
|
||||
Provides FreeSWITCH mod_signalwire
|
||||
|
|
|
@ -582,7 +582,7 @@ typedef void (*ARGBBlendRow)(const uint8_t* src_argb0,
|
|||
|
||||
// Get function to Alpha Blend ARGB pixels and store to destination.
|
||||
LIBYUV_API
|
||||
ARGBBlendRow GetARGBBlend();
|
||||
ARGBBlendRow GetARGBBlend(void);
|
||||
|
||||
// Alpha Blend ARGB images and store to destination.
|
||||
// Source is pre-multiplied by alpha using ARGBAttenuate.
|
||||
|
|
|
@ -1185,7 +1185,7 @@ int ARGBMirror(const uint8_t* src_argb,
|
|||
// As there are 6 blenders to choose from, the caller should try to use
|
||||
// the same blend function for all pixels if possible.
|
||||
LIBYUV_API
|
||||
ARGBBlendRow GetARGBBlend() {
|
||||
ARGBBlendRow GetARGBBlend(void) {
|
||||
void (*ARGBBlendRow)(const uint8_t* src_argb, const uint8_t* src_argb1,
|
||||
uint8_t* dst_argb, int width) = ARGBBlendRow_C;
|
||||
#if defined(HAS_ARGBBLENDROW_SSSE3)
|
||||
|
|
|
@ -679,7 +679,6 @@ UPNP_GetValidIGD(struct UPNPDev * devlist,
|
|||
char * descXML;
|
||||
int descXMLsize = 0;
|
||||
struct UPNPDev * dev;
|
||||
int ndev = 0;
|
||||
int state; /* state 1 : IGD connected. State 2 : IGD. State 3 : anything */
|
||||
if(!devlist)
|
||||
{
|
||||
|
@ -698,7 +697,6 @@ UPNP_GetValidIGD(struct UPNPDev * devlist,
|
|||
lanaddr, lanaddrlen);
|
||||
if(descXML)
|
||||
{
|
||||
ndev++;
|
||||
memset(data, 0, sizeof(struct IGDdatas));
|
||||
memset(urls, 0, sizeof(struct UPNPUrls));
|
||||
parserootdesc(descXML, descXMLsize, data);
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -3,7 +3,12 @@
|
|||
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <strings.h>
|
||||
#else
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
#include "xmlrpc_config.h"
|
||||
#include "c_util.h"
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
/* Copyright information is at end of file */
|
||||
|
||||
#define _XOPEN_SOURCE 600 /* Make sure strdup() is in <string.h> */
|
||||
#ifdef __APPLE__
|
||||
#define _DARWIN_C_SOURCE
|
||||
#endif
|
||||
#define _BSD_SOURCE /* Make sure setgroups()is in <grp.h> */
|
||||
#ifndef _DEFAULT_SOURCE
|
||||
#define _DEFAULT_SOURCE
|
||||
|
|
|
@ -3,7 +3,11 @@
|
|||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#ifdef __APPLE__
|
||||
#include <sys/wait.h>
|
||||
#else
|
||||
#include <wait.h>
|
||||
#endif
|
||||
#include <signal.h>
|
||||
|
||||
#include "xmlrpc_config.h"
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
#define _XOPEN_SOURCE 600 /* Make sure strdup() is in <string.h> */
|
||||
#ifdef __APPLE__
|
||||
#define _DARWIN_C_SOURCE
|
||||
#endif
|
||||
#ifndef _GNU_SOURCE
|
||||
#define _GNU_SOURCE /* But only when HAVE_ASPRINTF */
|
||||
#endif
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
#pragma warning (disable:167)
|
||||
#endif
|
||||
|
||||
static void fs_encode_cleanup()
|
||||
static void fs_encode_cleanup(void)
|
||||
{
|
||||
switch_safe_free(SWITCH_GLOBAL_dirs.conf_dir);
|
||||
switch_safe_free(SWITCH_GLOBAL_dirs.mod_dir);
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
#pragma warning (disable:167)
|
||||
#endif
|
||||
|
||||
static void fs_tts_cleanup()
|
||||
static void fs_tts_cleanup(void)
|
||||
{
|
||||
switch_safe_free(SWITCH_GLOBAL_dirs.conf_dir);
|
||||
switch_safe_free(SWITCH_GLOBAL_dirs.mod_dir);
|
||||
|
|
|
@ -325,6 +325,24 @@ SWITCH_DECLARE(switch_status_t) switch_channel_get_scope_variables(switch_channe
|
|||
SWITCH_DECLARE(const char *) switch_channel_get_variable_dup(switch_channel_t *channel, const char *varname, switch_bool_t dup, int idx);
|
||||
#define switch_channel_get_variable(_c, _v) switch_channel_get_variable_dup(_c, _v, SWITCH_TRUE, -1)
|
||||
|
||||
/*!
|
||||
\brief Retrieve a copy of a variable from a given channel. switch_safe_free() call will be required.
|
||||
\param channel channel to retrieve variable from
|
||||
\param varname the name of the variable
|
||||
\return a strdup copy the value of the requested variable without using a memory pool.
|
||||
*/
|
||||
SWITCH_DECLARE(const char *) switch_channel_get_variable_strdup(switch_channel_t *channel, const char *varname);
|
||||
|
||||
/*!
|
||||
\brief Retrieve a variable from a given channel to a pre-allocated buffer without using a memory pool.
|
||||
\param channel channel to retrieve variable from
|
||||
\param varname the name of the variable
|
||||
\param buf a pre allocated buffer to put the value to
|
||||
\param buflen size of the buffer
|
||||
\return SWITCH_STATUS_SUCCESS if the value was copied to the buffer and it is not NULL, SWITCH_STATUS_FALSE otherwise.
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_channel_get_variable_buf(switch_channel_t *channel, const char *varname, char *buf, switch_size_t buflen);
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_channel_get_variables(switch_channel_t *channel, switch_event_t **event);
|
||||
SWITCH_DECLARE(switch_status_t) switch_channel_get_variables_prefix(switch_channel_t *channel, const char *prefix, switch_event_t **event);
|
||||
SWITCH_DECLARE(switch_status_t) switch_channel_pass_callee_id(switch_channel_t *channel, switch_channel_t *other_channel);
|
||||
|
|
|
@ -40,6 +40,9 @@ typedef int switch_CURLINFO;
|
|||
typedef int switch_CURLcode;
|
||||
typedef int switch_CURLoption;
|
||||
|
||||
#define HAVE_SWITCH_CURL_MIME
|
||||
typedef void switch_curl_mime;
|
||||
|
||||
SWITCH_DECLARE(switch_CURL *) switch_curl_easy_init(void);
|
||||
SWITCH_DECLARE(switch_CURLcode) switch_curl_easy_perform(switch_CURL *handle);
|
||||
SWITCH_DECLARE(switch_CURLcode) switch_curl_easy_getinfo(switch_CURL *curl, switch_CURLINFO info, ... );
|
||||
|
@ -50,7 +53,9 @@ SWITCH_DECLARE(switch_CURLcode) switch_curl_easy_setopt(CURL *handle, switch_CUR
|
|||
SWITCH_DECLARE(const char *) switch_curl_easy_strerror(switch_CURLcode errornum );
|
||||
SWITCH_DECLARE(void) switch_curl_init(void);
|
||||
SWITCH_DECLARE(void) switch_curl_destroy(void);
|
||||
SWITCH_DECLARE(switch_status_t) switch_curl_process_form_post_params(switch_event_t *event, switch_CURL *curl_handle, struct curl_httppost **formpostp);
|
||||
SWITCH_DECLARE(switch_status_t) switch_curl_process_mime(switch_event_t *event, switch_CURL *curl_handle, switch_curl_mime **mimep);
|
||||
SWITCH_DECLARE(void) switch_curl_mime_free(switch_curl_mime **mimep);
|
||||
SWITCH_DECLARE(switch_CURLcode) switch_curl_easy_setopt_mime(switch_CURL *curl_handle, switch_curl_mime *mime);
|
||||
#define switch_curl_easy_setopt curl_easy_setopt
|
||||
|
||||
SWITCH_END_EXTERN_C
|
||||
|
|
|
@ -106,12 +106,13 @@ typedef struct icand_s {
|
|||
} icand_t;
|
||||
|
||||
#define MAX_CAND 50
|
||||
#define MAX_CAND_IDX_COUNT 2
|
||||
typedef struct ice_s {
|
||||
|
||||
icand_t cands[MAX_CAND][2];
|
||||
int cand_idx[2];
|
||||
int chosen[2];
|
||||
int is_chosen[2];
|
||||
icand_t cands[MAX_CAND][MAX_CAND_IDX_COUNT];
|
||||
int cand_idx[MAX_CAND_IDX_COUNT];
|
||||
int chosen[MAX_CAND_IDX_COUNT];
|
||||
int is_chosen[MAX_CAND_IDX_COUNT];
|
||||
char *ufrag;
|
||||
char *pwd;
|
||||
char *options;
|
||||
|
|
|
@ -498,6 +498,14 @@ SWITCH_DECLARE(switch_size_t) switch_fp_read_dline(FILE *fd, char **buf, switch_
|
|||
SWITCH_DECLARE(switch_status_t) switch_frame_alloc(switch_frame_t **frame, switch_size_t size);
|
||||
SWITCH_DECLARE(switch_status_t) switch_frame_dup(switch_frame_t *orig, switch_frame_t **clone);
|
||||
SWITCH_DECLARE(switch_status_t) switch_frame_free(switch_frame_t **frame);
|
||||
|
||||
/*! \brief Check if a 32 bit unsigned number is in a range.
|
||||
* \param str string to check. Should not contain non-digit characters.
|
||||
* \param from start of range including this number
|
||||
* \param to end of range including this number
|
||||
* \return true or false
|
||||
*/
|
||||
SWITCH_DECLARE(switch_bool_t) switch_is_uint_in_range(const char *str, unsigned int from, unsigned int to);
|
||||
SWITCH_DECLARE(switch_bool_t) switch_is_number(const char *str);
|
||||
SWITCH_DECLARE(switch_bool_t) switch_is_leading_number(const char *str);
|
||||
SWITCH_DECLARE(char *) switch_find_parameter(const char *str, const char *param, switch_memory_pool_t *pool);
|
||||
|
|
|
@ -255,7 +255,7 @@ fctstr_safe_cpy(char *dst, char const *src, size_t num)
|
|||
#if defined(WIN32) && _MSC_VER >= 1400
|
||||
strncpy_s(dst, num, src, _TRUNCATE);
|
||||
#else
|
||||
strncpy(dst, src, num);
|
||||
strncpy(dst, src, num - 1);
|
||||
#endif
|
||||
dst[num-1] = '\0';
|
||||
}
|
||||
|
@ -760,6 +760,7 @@ fct_nlist__init2(fct_nlist_t *list, size_t start_sz)
|
|||
list->itm_list = (void**)malloc(sizeof(void*)*start_sz);
|
||||
if ( list->itm_list == NULL )
|
||||
{
|
||||
list->used_itm_num = 0;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
* Seven Du <dujinfang@gmail.com>
|
||||
* Anthony Minessale <anthm@freeswitch.org>
|
||||
* Emmanuel Schmidbauer <eschmidbauer@gmail.com>
|
||||
* Jakub Karolczyk <jakub.karolczyk@signalwire.com>
|
||||
*
|
||||
* mod_avcodec -- Codec with libav.org and ffmpeg
|
||||
*
|
||||
|
@ -34,6 +35,9 @@
|
|||
#include <switch.h>
|
||||
#include "mod_av.h"
|
||||
#include <libavcodec/avcodec.h>
|
||||
#ifdef _MSC_VER
|
||||
#include <libavcodec/version.h> /* LIBAVCODEC_VERSION_INT */
|
||||
#endif
|
||||
#include <libavformat/avformat.h>
|
||||
#include <libavutil/opt.h>
|
||||
#include <libavutil/imgutils.h>
|
||||
|
@ -373,8 +377,13 @@ typedef struct our_h264_nalu_s {
|
|||
|
||||
typedef struct h264_codec_context_s {
|
||||
switch_buffer_t *nalu_buffer;
|
||||
#if (LIBAVCODEC_VERSION_MAJOR < LIBAVCODEC_V)
|
||||
AVCodec *decoder;
|
||||
AVCodec *encoder;
|
||||
#else
|
||||
const AVCodec *decoder;
|
||||
const AVCodec *encoder;
|
||||
#endif
|
||||
AVCodecContext *decoder_ctx;
|
||||
int got_pps; /* if pps packet received */
|
||||
int64_t pts;
|
||||
|
@ -393,12 +402,13 @@ typedef struct h264_codec_context_s {
|
|||
switch_codec_settings_t codec_settings;
|
||||
AVCodecContext *encoder_ctx;
|
||||
AVFrame *encoder_avframe;
|
||||
AVPacket encoder_avpacket;
|
||||
AVPacket *encoder_avpacket;
|
||||
AVFrame *decoder_avframe;
|
||||
our_h264_nalu_t nalus[MAX_NALUS];
|
||||
enum AVCodecID av_codec_id;
|
||||
uint16_t last_seq; // last received frame->seq
|
||||
int hw_encoder;
|
||||
switch_packetizer_t *packetizer;
|
||||
} h264_codec_context_t;
|
||||
|
||||
#ifndef AV_INPUT_BUFFER_PADDING_SIZE
|
||||
|
@ -825,7 +835,11 @@ static void fs_rtp_parse_h263_rfc2190(h264_codec_context_t *context, AVPacket *p
|
|||
const uint8_t *p = buf;
|
||||
const uint8_t *buf_base = buf;
|
||||
uint32_t code = (ntohl(*(uint32_t *)buf) & 0xFFFFFC00) >> 10;
|
||||
#if (LIBAVCODEC_VERSION_MAJOR < LIBAVCODEC_V)
|
||||
int mb_info_size = 0;
|
||||
#else
|
||||
switch_size_t mb_info_size = 0;
|
||||
#endif
|
||||
int mb_info_pos = 0, mb_info_count = 0;
|
||||
const uint8_t *mb_info;
|
||||
|
||||
|
@ -889,7 +903,11 @@ static void fs_rtp_parse_h263_rfc2190(h264_codec_context_t *context, AVPacket *p
|
|||
"Unable to split H263 packet! mb_info_pos=%d mb_info_count=%d pos=%d max=%"SWITCH_SIZE_T_FMT"\n", mb_info_pos, mb_info_count, pos, (switch_size_t)(end - buf_base));
|
||||
}
|
||||
} else {
|
||||
#if (LIBAVCODEC_VERSION_MAJOR < LIBAVCODEC_V)
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Should Not Happen!!! mb_info_pos=%d mb_info_count=%d mb_info_size=%d\n", mb_info_pos, mb_info_count, mb_info_size);
|
||||
#else
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Should Not Happen!!! mb_info_pos=%d mb_info_count=%d mb_info_size=%ld\n", mb_info_pos, mb_info_count, mb_info_size);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1033,7 +1051,7 @@ static switch_status_t consume_h263_bitstream(h264_codec_context_t *context, swi
|
|||
}
|
||||
|
||||
if (!context->nalus[context->nalu_current_index].len) {
|
||||
av_packet_unref(&context->encoder_avpacket);
|
||||
av_packet_unref(context->encoder_avpacket);
|
||||
frame->m = 1;
|
||||
}
|
||||
|
||||
|
@ -1081,81 +1099,27 @@ static switch_status_t consume_h263p_bitstream(h264_codec_context_t *context, sw
|
|||
#endif
|
||||
|
||||
if (frame->m) {
|
||||
av_packet_unref(&context->encoder_avpacket);
|
||||
av_packet_unref(context->encoder_avpacket);
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
return SWITCH_STATUS_MORE_DATA;
|
||||
}
|
||||
|
||||
static switch_status_t consume_h264_bitstream(h264_codec_context_t *context, switch_frame_t *frame)
|
||||
{
|
||||
AVPacket *pkt = &context->encoder_avpacket;
|
||||
our_h264_nalu_t *nalu = &context->nalus[context->nalu_current_index];
|
||||
uint8_t nalu_hdr = *(uint8_t *)(nalu->start);
|
||||
uint8_t nalu_type = nalu_hdr & 0x1f;
|
||||
uint8_t nri = nalu_hdr & 0x60;
|
||||
int left = nalu->len - (nalu->eat - nalu->start);
|
||||
uint8_t *p = frame->data;
|
||||
uint8_t start = nalu->start == nalu->eat ? 0x80 : 0;
|
||||
int n = nalu->len / SLICE_SIZE;
|
||||
int slice_size = nalu->len / (n + 1) + 1 + 2;
|
||||
|
||||
if (nalu->len <= SLICE_SIZE) {
|
||||
memcpy(frame->data, nalu->start, nalu->len);
|
||||
frame->datalen = nalu->len;
|
||||
context->nalu_current_index++;
|
||||
|
||||
if (context->nalus[context->nalu_current_index].len) {
|
||||
frame->m = 0;
|
||||
return SWITCH_STATUS_MORE_DATA;
|
||||
}
|
||||
|
||||
if (pkt->size > 0) av_packet_unref(pkt);
|
||||
|
||||
switch_clear_flag(frame, SFF_CNG);
|
||||
frame->m = 1;
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
if (left <= (slice_size - 2)) {
|
||||
p[0] = nri | 28; // FU-A
|
||||
p[1] = 0x40 | nalu_type;
|
||||
memcpy(p+2, nalu->eat, left);
|
||||
nalu->eat += left;
|
||||
frame->datalen = left + 2;
|
||||
context->nalu_current_index++;
|
||||
|
||||
if (!context->nalus[context->nalu_current_index].len) {
|
||||
if (pkt->size > 0) av_packet_unref(pkt);
|
||||
frame->m = 1;
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
return SWITCH_STATUS_MORE_DATA;
|
||||
}
|
||||
|
||||
p[0] = nri | 28; // FU-A
|
||||
p[1] = start | nalu_type;
|
||||
if (start) nalu->eat++;
|
||||
memcpy(p+2, nalu->eat, slice_size - 2);
|
||||
nalu->eat += (slice_size - 2);
|
||||
frame->datalen = slice_size;
|
||||
frame->m = 0;
|
||||
return SWITCH_STATUS_MORE_DATA;
|
||||
}
|
||||
|
||||
static switch_status_t consume_nalu(h264_codec_context_t *context, switch_frame_t *frame)
|
||||
{
|
||||
AVPacket *pkt = &context->encoder_avpacket;
|
||||
AVPacket *pkt = context->encoder_avpacket;
|
||||
our_h264_nalu_t *nalu = &context->nalus[context->nalu_current_index];
|
||||
|
||||
if (!nalu->len) {
|
||||
frame->datalen = 0;
|
||||
frame->m = 0;
|
||||
if (pkt->size > 0) av_packet_unref(pkt);
|
||||
if (pkt->size > 0) {
|
||||
av_packet_unref(pkt);
|
||||
}
|
||||
|
||||
context->nalu_current_index = 0;
|
||||
|
||||
return SWITCH_STATUS_NOTFOUND;
|
||||
}
|
||||
|
||||
|
@ -1167,7 +1131,9 @@ static switch_status_t consume_nalu(h264_codec_context_t *context, switch_frame_
|
|||
return consume_h263p_bitstream(context, frame);
|
||||
}
|
||||
|
||||
return consume_h264_bitstream(context, frame);
|
||||
switch_assert(0);
|
||||
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
static void set_h264_private_data(h264_codec_context_t *context, avcodec_profile_t *profile)
|
||||
|
@ -1342,9 +1308,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
|||
set_h264_private_data(context, aprofile);
|
||||
}
|
||||
|
||||
GCC_DIAG_OFF(deprecated-declarations)
|
||||
avcodec_string(codec_string, sizeof(codec_string), context->encoder_ctx, 0);
|
||||
GCC_DIAG_ON(deprecated-declarations)
|
||||
|
||||
dump_encoder_ctx(context->encoder_ctx);
|
||||
|
||||
|
@ -1436,6 +1400,16 @@ static switch_status_t switch_h264_init(switch_codec_t *codec, switch_codec_flag
|
|||
}
|
||||
}
|
||||
|
||||
switch (context->av_codec_id) {
|
||||
case AV_CODEC_ID_H264:
|
||||
context->packetizer = switch_packetizer_create(SPT_H264_BITSTREAM, SLICE_SIZE);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
context->encoder_avpacket = av_packet_alloc();
|
||||
|
||||
switch_buffer_create_dynamic(&(context->nalu_buffer), H264_NALU_BUFFER_SIZE, H264_NALU_BUFFER_SIZE * 8, 0);
|
||||
codec->private_info = context;
|
||||
|
||||
|
@ -1460,7 +1434,7 @@ static switch_status_t switch_h264_encode(switch_codec_t *codec, switch_frame_t
|
|||
int ret;
|
||||
int *got_output = &context->got_encoded_output;
|
||||
AVFrame *avframe = NULL;
|
||||
AVPacket *pkt = &context->encoder_avpacket;
|
||||
AVPacket **pkt = &context->encoder_avpacket;
|
||||
uint32_t width = 0;
|
||||
uint32_t height = 0;
|
||||
switch_image_t *img = frame->img;
|
||||
|
@ -1480,6 +1454,16 @@ static switch_status_t switch_h264_encode(switch_codec_t *codec, switch_frame_t
|
|||
}
|
||||
|
||||
if (frame->flags & SFF_SAME_IMAGE) {
|
||||
if (context->packetizer) {
|
||||
switch_status_t status = switch_packetizer_read(context->packetizer, frame);
|
||||
|
||||
if (status == SWITCH_STATUS_SUCCESS && (*pkt)->size > 0) {
|
||||
av_packet_unref(*pkt);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
// read from nalu buffer
|
||||
return consume_nalu(context, frame);
|
||||
}
|
||||
|
@ -1489,6 +1473,7 @@ static switch_status_t switch_h264_encode(switch_codec_t *codec, switch_frame_t
|
|||
if (open_encoder(context, width, height) != SWITCH_STATUS_SUCCESS) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
avctx = context->encoder_ctx;
|
||||
}
|
||||
|
||||
|
@ -1498,6 +1483,7 @@ static switch_status_t switch_h264_encode(switch_codec_t *codec, switch_frame_t
|
|||
if (open_encoder(context, width, height) != SWITCH_STATUS_SUCCESS) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
avctx = context->encoder_ctx;
|
||||
}
|
||||
|
||||
|
@ -1507,13 +1493,13 @@ static switch_status_t switch_h264_encode(switch_codec_t *codec, switch_frame_t
|
|||
if (open_encoder(context, width, height) != SWITCH_STATUS_SUCCESS) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
avctx = context->encoder_ctx;
|
||||
switch_set_flag(frame, SFF_WAIT_KEY_FRAME);
|
||||
}
|
||||
|
||||
av_init_packet(pkt);
|
||||
pkt->data = NULL; // packet data will be allocated by the encoder
|
||||
pkt->size = 0;
|
||||
av_packet_unref(*pkt);
|
||||
/* packet data will be allocated by the encoder */
|
||||
|
||||
avframe = context->encoder_avframe;
|
||||
|
||||
|
@ -1578,14 +1564,42 @@ static switch_status_t switch_h264_encode(switch_codec_t *codec, switch_frame_t
|
|||
/* encode the image */
|
||||
memset(context->nalus, 0, sizeof(context->nalus));
|
||||
context->nalu_current_index = 0;
|
||||
#if (LIBAVCODEC_VERSION_MAJOR < LIBAVCODEC_V)
|
||||
GCC_DIAG_OFF(deprecated-declarations)
|
||||
ret = avcodec_encode_video2(avctx, pkt, avframe, got_output);
|
||||
ret = avcodec_encode_video2(avctx, *pkt, avframe, got_output);
|
||||
GCC_DIAG_ON(deprecated-declarations)
|
||||
|
||||
if (ret < 0) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Encoding Error %d\n", ret);
|
||||
goto error;
|
||||
}
|
||||
#else
|
||||
ret = avcodec_send_frame(avctx, avframe);
|
||||
|
||||
if (ret == AVERROR_EOF) {
|
||||
ret = 0;
|
||||
} else if (ret == AVERROR(EAGAIN)) {
|
||||
/* we fully drain all the output in each encode call, so this should not ever happen */
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG9, "Error sending frame to encoder - BUG, should never happen\n");
|
||||
ret = AVERROR_BUG;
|
||||
goto error;
|
||||
} else if (ret < 0) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error sending frame to encoder\n");
|
||||
goto error;
|
||||
}
|
||||
|
||||
while (ret >= 0) {
|
||||
ret = avcodec_receive_packet(avctx, *pkt);
|
||||
if (ret == AVERROR(EAGAIN)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG9, "No more video packets at the moment\n");
|
||||
} else if (ret == AVERROR_EOF) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG9, "No more video packets at all\n");
|
||||
} else if (ret < 0) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Encoding error\n");
|
||||
av_packet_unref(*pkt);
|
||||
goto error;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (context->need_key_frame && avframe->key_frame == 1) {
|
||||
avframe->pict_type = 0;
|
||||
|
@ -1595,81 +1609,78 @@ GCC_DIAG_ON(deprecated-declarations)
|
|||
|
||||
// process:
|
||||
|
||||
#if (LIBAVCODEC_VERSION_MAJOR < LIBAVCODEC_V)
|
||||
if (*got_output) {
|
||||
const uint8_t *p = pkt->data;
|
||||
int i = 0;
|
||||
#else
|
||||
if (ret >= 0) {
|
||||
#endif
|
||||
switch_status_t status = SWITCH_STATUS_SUCCESS;
|
||||
|
||||
*got_output = 0;
|
||||
|
||||
if (context->av_codec_id == AV_CODEC_ID_H263) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG5,
|
||||
"Encoded frame %" SWITCH_INT64_T_FMT " (size=%5d) [0x%02x 0x%02x 0x%02x 0x%02x] got_output: %d slices: %d\n",
|
||||
context->pts, pkt->size, *((uint8_t *)pkt->data), *((uint8_t *)(pkt->data + 1)), *((uint8_t *)(pkt->data + 2)),
|
||||
*((uint8_t *)(pkt->data + 3)), *got_output, avctx->slices);
|
||||
context->pts, (*pkt)->size, *((uint8_t *)(*pkt)->data), *((uint8_t *)((*pkt)->data + 1)), *((uint8_t *)((*pkt)->data + 2)),
|
||||
*((uint8_t *)((*pkt)->data + 3)), *got_output, avctx->slices);
|
||||
|
||||
#ifdef H263_MODE_B
|
||||
fs_rtp_parse_h263_rfc2190(context, pkt);
|
||||
fs_rtp_parse_h263_rfc2190(context, *pkt);
|
||||
#endif
|
||||
|
||||
context->nalu_current_index = 0;
|
||||
|
||||
return consume_nalu(context, frame);
|
||||
} else if (context->av_codec_id == AV_CODEC_ID_H263P){
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG5,
|
||||
"Encoded frame %" SWITCH_INT64_T_FMT " (size=%5d) [0x%02x 0x%02x 0x%02x 0x%02x] got_output: %d slices: %d\n",
|
||||
context->pts, pkt->size, *((uint8_t *)pkt->data), *((uint8_t *)(pkt->data + 1)), *((uint8_t *)(pkt->data + 2)),
|
||||
*((uint8_t *)(pkt->data + 3)), *got_output, avctx->slices);
|
||||
fs_rtp_parse_h263_rfc4629(context, pkt);
|
||||
context->pts, (*pkt)->size, *((uint8_t *)(*pkt)->data), *((uint8_t *)((*pkt)->data + 1)), *((uint8_t *)((*pkt)->data + 2)),
|
||||
*((uint8_t *)((*pkt)->data + 3)), *got_output, avctx->slices);
|
||||
fs_rtp_parse_h263_rfc4629(context, *pkt);
|
||||
context->nalu_current_index = 0;
|
||||
|
||||
return consume_nalu(context, frame);
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG5,
|
||||
"Encoded frame %" SWITCH_INT64_T_FMT " (size=%5d) nalu_type=0x%x %d\n",
|
||||
context->pts, pkt->size, *((uint8_t *)pkt->data +4), *got_output);
|
||||
}
|
||||
/* split into nalus */
|
||||
memset(context->nalus, 0, sizeof(context->nalus));
|
||||
|
||||
while ((p = fs_avc_find_startcode(p, pkt->data+pkt->size)) < (pkt->data + pkt->size)) {
|
||||
if (!context->nalus[i].start) {
|
||||
while (!(*p++)) ; /* eat the sync bytes, what ever 0 0 1 or 0 0 0 1 */
|
||||
context->nalus[i].start = p;
|
||||
context->nalus[i].eat = p;
|
||||
|
||||
if ((*p & 0x1f) == 7) { // Got Keyframe
|
||||
// prevent to generate key frame too frequently
|
||||
context->last_keyframe_request = switch_time_now();
|
||||
if (mod_av_globals.debug) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "KEY FRAME GENERATED\n");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
context->nalus[i].len = p - context->nalus[i].start;
|
||||
while (!(*p++)) ; /* eat the sync bytes, what ever 0 0 1 or 0 0 0 1 */
|
||||
i++;
|
||||
context->nalus[i].start = p;
|
||||
context->nalus[i].eat = p;
|
||||
}
|
||||
if (i >= MAX_NALUS - 2) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "TOO MANY SLICES!\n");
|
||||
break;
|
||||
}
|
||||
context->pts, (*pkt)->size, *((uint8_t *)(*pkt)->data +4), *got_output);
|
||||
}
|
||||
|
||||
context->nalus[i].len = p - context->nalus[i].start;
|
||||
context->nalu_current_index = 0;
|
||||
return consume_nalu(context, frame);
|
||||
status = switch_packetizer_feed(context->packetizer, (*pkt)->data, (*pkt)->size);
|
||||
if (status != SWITCH_STATUS_SUCCESS) {
|
||||
if ((*pkt)->size > 0) {
|
||||
av_packet_unref(*pkt);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
status = switch_packetizer_read(context->packetizer, frame);
|
||||
if (status == SWITCH_STATUS_SUCCESS && (*pkt)->size > 0) {
|
||||
av_packet_unref(*pkt);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
#if (LIBAVCODEC_VERSION_MAJOR >= LIBAVCODEC_V)
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
error:
|
||||
frame->datalen = 0;
|
||||
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
static switch_status_t switch_h264_decode(switch_codec_t *codec, switch_frame_t *frame)
|
||||
{
|
||||
h264_codec_context_t *context = (h264_codec_context_t *)codec->private_info;
|
||||
AVCodecContext *avctx= context->decoder_ctx;
|
||||
switch_status_t status;
|
||||
#if (LIBAVCODEC_VERSION_MAJOR >= LIBAVCODEC_V)
|
||||
int ret = 0;
|
||||
#endif
|
||||
|
||||
switch_assert(frame);
|
||||
|
||||
|
@ -1702,27 +1713,57 @@ static switch_status_t switch_h264_decode(switch_codec_t *codec, switch_frame_t
|
|||
|
||||
if (frame->m) {
|
||||
uint32_t size = switch_buffer_inuse(context->nalu_buffer);
|
||||
AVPacket pkt = { 0 };
|
||||
AVPacket *pkt = NULL;
|
||||
AVFrame *picture;
|
||||
#if (LIBAVCODEC_VERSION_MAJOR < LIBAVCODEC_V)
|
||||
int got_picture = 0;
|
||||
int decoded_len;
|
||||
#endif
|
||||
|
||||
if (size > 0) {
|
||||
av_init_packet(&pkt);
|
||||
pkt = av_packet_alloc();
|
||||
switch_buffer_zero_fill(context->nalu_buffer, AV_INPUT_BUFFER_PADDING_SIZE);
|
||||
switch_buffer_peek_zerocopy(context->nalu_buffer, (const void **)&pkt.data);
|
||||
pkt.size = size;
|
||||
switch_buffer_peek_zerocopy(context->nalu_buffer, (const void **)&pkt->data);
|
||||
pkt->size = size;
|
||||
|
||||
if (!context->decoder_avframe) context->decoder_avframe = av_frame_alloc();
|
||||
picture = context->decoder_avframe;
|
||||
switch_assert(picture);
|
||||
#if (LIBAVCODEC_VERSION_MAJOR < LIBAVCODEC_V)
|
||||
GCC_DIAG_OFF(deprecated-declarations)
|
||||
decoded_len = avcodec_decode_video2(avctx, picture, &got_picture, &pkt);
|
||||
decoded_len = avcodec_decode_video2(context->decoder_ctx, picture, &got_picture, pkt);
|
||||
GCC_DIAG_ON(deprecated-declarations)
|
||||
#else
|
||||
ret = avcodec_send_packet(context->decoder_ctx, pkt);
|
||||
|
||||
if (ret == AVERROR_EOF) {
|
||||
ret = 0;
|
||||
} else if (ret == AVERROR(EAGAIN)) {
|
||||
/* we fully drain all the output in each decode call, so this should not ever happen */
|
||||
ret = AVERROR_BUG;
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Error sending packet to decoder BUG, should never happen\n");
|
||||
} else if (ret < 0) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Error sending packet to decoder\n");
|
||||
}
|
||||
|
||||
while (ret >= 0) {
|
||||
ret = avcodec_receive_frame(context->decoder_ctx, picture);
|
||||
if (ret == AVERROR(EAGAIN)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG9, "No more video frames at the moment\n");
|
||||
} else if (ret == AVERROR_EOF) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG9, "No more video frames at all\n");
|
||||
} else if (ret < 0) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Video decoding error\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
// switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "buffer: %d got pic: %d len: %d [%dx%d]\n", size, got_picture, decoded_len, picture->width, picture->height);
|
||||
|
||||
#if (LIBAVCODEC_VERSION_MAJOR < LIBAVCODEC_V)
|
||||
if (got_picture && decoded_len > 0) {
|
||||
#else
|
||||
if (ret >= 0) {
|
||||
#endif
|
||||
int width = picture->width;
|
||||
int height = picture->height;
|
||||
|
||||
|
@ -1744,7 +1785,15 @@ GCC_DIAG_ON(deprecated-declarations)
|
|||
frame->img = context->img;
|
||||
}
|
||||
|
||||
#if (LIBAVCODEC_VERSION_MAJOR >= LIBAVCODEC_V)
|
||||
if (ret < 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
av_frame_unref(picture);
|
||||
av_packet_free(&pkt);
|
||||
}
|
||||
|
||||
switch_buffer_zero(context->nalu_buffer);
|
||||
|
@ -1825,6 +1874,10 @@ static switch_status_t switch_h264_destroy(switch_codec_t *codec)
|
|||
av_free(context->encoder_ctx);
|
||||
}
|
||||
|
||||
if (context->packetizer) {
|
||||
switch_packetizer_close(&context->packetizer);
|
||||
}
|
||||
|
||||
if (context->encoder_avframe) {
|
||||
av_frame_free(&context->encoder_avframe);
|
||||
}
|
||||
|
@ -1833,6 +1886,10 @@ static switch_status_t switch_h264_destroy(switch_codec_t *codec)
|
|||
av_frame_free(&context->decoder_avframe);
|
||||
}
|
||||
|
||||
if (context->encoder_avpacket) {
|
||||
av_packet_free(&context->encoder_avpacket);
|
||||
}
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -1860,8 +1917,10 @@ static const AVCodec *next_codec_for_id(enum AVCodecID id, const AVCodec *prev,
|
|||
#endif
|
||||
if (prev->id == id &&
|
||||
(encoder ? av_codec_is_encoder(prev) : av_codec_is_decoder(prev)))
|
||||
|
||||
return prev;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -2208,7 +2267,7 @@ static void parse_codecs(avcodec_profile_t *aprofile, switch_xml_t codecs)
|
|||
}
|
||||
|
||||
|
||||
static void load_config()
|
||||
static void load_config(void)
|
||||
{
|
||||
switch_xml_t cfg = NULL, xml = NULL;
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -25,6 +25,7 @@
|
|||
*
|
||||
* Seven Du <dujinfang@gmail.com>
|
||||
* Anthony Minessale <anthm@freeswitch.org>
|
||||
* Jakub Karolczyk <jakub.karolczyk@signalwire.com>
|
||||
*
|
||||
* mod_av -- FS Video Codec / File Format using libav.org
|
||||
*
|
||||
|
@ -33,7 +34,13 @@
|
|||
#include <switch.h>
|
||||
#include "mod_av.h"
|
||||
#include <libavcodec/avcodec.h>
|
||||
#ifdef _MSC_VER
|
||||
#include <libavcodec/version.h> /* LIBAVCODEC_VERSION_INT */
|
||||
#endif
|
||||
#include <libavformat/avformat.h>
|
||||
#ifdef _MSC_VER
|
||||
#include <libavformat/version.h> /* LIBAVFORMAT_VERSION_INT */
|
||||
#endif
|
||||
|
||||
SWITCH_MODULE_LOAD_FUNCTION(mod_avformat_load);
|
||||
SWITCH_MODULE_LOAD_FUNCTION(mod_avcodec_load);
|
||||
|
@ -49,6 +56,7 @@ typedef struct av_mutex_helper_s {
|
|||
switch_memory_pool_t *pool;
|
||||
} av_mutex_helper_t;
|
||||
|
||||
#if (LIBAVCODEC_VERSION_MAJOR < LIBAVCODEC_V)
|
||||
int mod_av_lockmgr_cb(void **m, enum AVLockOp op)
|
||||
{
|
||||
av_mutex_helper_t *context = NULL;
|
||||
|
@ -93,6 +101,7 @@ int mod_av_lockmgr_cb(void **m, enum AVLockOp op)
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef AV_LOG_TRACE
|
||||
#define AV_LOG_TRACE 96
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
* Marcel Barbulescu <marcelbarbulescu@gmail.com>
|
||||
* Raymond Chandler <intralanman@gmail.com>
|
||||
* Emmanuel Schmidbauer <e.schmidbauer@gmail.com>
|
||||
* Jakub Karolczyk <jakub.karolczyk@signalwire.com>
|
||||
*
|
||||
*
|
||||
* mod_av.h -- LibAV mod
|
||||
|
@ -39,6 +40,10 @@
|
|||
#ifndef MOD_AV_H
|
||||
#define MOD_AV_H
|
||||
|
||||
#define LIBAVCODEC_V 59
|
||||
#define LIBAVFORMAT_V 59
|
||||
#define LIBAVUTIL_V 57
|
||||
|
||||
struct mod_av_globals {
|
||||
int debug;
|
||||
};
|
||||
|
|
|
@ -347,7 +347,7 @@ static size_t file_callback(void *ptr, size_t size, size_t nmemb, void *data)
|
|||
return realsize;
|
||||
}
|
||||
|
||||
static long do_lookup_url(switch_memory_pool_t *pool, switch_event_t *event, char **response, const char *query, struct curl_httppost *post,
|
||||
static long do_lookup_url(switch_memory_pool_t *pool, switch_event_t *event, char **response, const char *query, switch_curl_mime *post,
|
||||
switch_curl_slist_t *headers, int timeout)
|
||||
{
|
||||
switch_time_t start_time = switch_micro_time_now();
|
||||
|
@ -373,7 +373,7 @@ static long do_lookup_url(switch_memory_pool_t *pool, switch_event_t *event, cha
|
|||
switch_curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYHOST, 0);
|
||||
}
|
||||
if (post) {
|
||||
switch_curl_easy_setopt(curl_handle, CURLOPT_HTTPPOST, post);
|
||||
switch_curl_easy_setopt_mime(curl_handle, post);
|
||||
} else {
|
||||
switch_curl_easy_setopt(curl_handle, CURLOPT_HTTPGET, 1);
|
||||
}
|
||||
|
|
|
@ -4087,7 +4087,6 @@ switch_status_t conference_api_sub_set(conference_obj_t *conference,
|
|||
|
||||
switch_status_t conference_api_sub_xml_list(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv)
|
||||
{
|
||||
int count = 0;
|
||||
switch_hash_index_t *hi;
|
||||
void *val;
|
||||
switch_xml_t x_conference, x_conferences;
|
||||
|
@ -4106,7 +4105,6 @@ switch_status_t conference_api_sub_xml_list(conference_obj_t *conference, switch
|
|||
x_conference = switch_xml_add_child_d(x_conferences, "conference", off++);
|
||||
switch_assert(conference);
|
||||
|
||||
count++;
|
||||
conference_xlist(conference, x_conference, off);
|
||||
|
||||
}
|
||||
|
@ -4114,7 +4112,7 @@ switch_status_t conference_api_sub_xml_list(conference_obj_t *conference, switch
|
|||
} else {
|
||||
x_conference = switch_xml_add_child_d(x_conferences, "conference", off++);
|
||||
switch_assert(conference);
|
||||
count++;
|
||||
|
||||
conference_xlist(conference, x_conference, off);
|
||||
}
|
||||
|
||||
|
|
|
@ -662,6 +662,9 @@ void conference_cdr_render(conference_obj_t *conference)
|
|||
x_tag = switch_xml_add_child_d(x_flags, "end_conference", flag_off++);
|
||||
switch_xml_set_txt_d(x_tag, conference_cdr_test_mflag(np, MFLAG_ENDCONF) ? "true" : "false");
|
||||
|
||||
x_tag = switch_xml_add_child_d(x_flags, "mandatory_member_end_conference", flag_off++);
|
||||
switch_xml_set_txt_d(x_tag, conference_cdr_test_mflag(np, MFLAG_MANDATORY_MEMBER_ENDCONF) ? "true" : "false");
|
||||
|
||||
x_tag = switch_xml_add_child_d(x_flags, "was_kicked", flag_off++);
|
||||
switch_xml_set_txt_d(x_tag, conference_cdr_test_mflag(np, MFLAG_KICKED) ? "true" : "false");
|
||||
|
||||
|
@ -737,7 +740,7 @@ void conference_cdr_render(conference_obj_t *conference)
|
|||
#endif
|
||||
int wrote;
|
||||
wrote = write(fd, xml_text, (unsigned) strlen(xml_text));
|
||||
wrote++;
|
||||
(void)wrote;
|
||||
close(fd);
|
||||
} else {
|
||||
char ebuf[512] = { 0 };
|
||||
|
|
|
@ -75,7 +75,7 @@ struct _mapping control_mappings[] = {
|
|||
{"deaf off", conference_loop_deaf_off}
|
||||
};
|
||||
|
||||
int conference_loop_mapping_len()
|
||||
int conference_loop_mapping_len(void)
|
||||
{
|
||||
return (sizeof(control_mappings)/sizeof(control_mappings[0]));
|
||||
}
|
||||
|
|
|
@ -766,7 +766,12 @@ switch_status_t conference_member_add(conference_obj_t *conference, conference_m
|
|||
conference->count++;
|
||||
}
|
||||
|
||||
|
||||
if (conference_utils_member_test_flag(member, MFLAG_ENDCONF)) {
|
||||
conference->endconference_time = 0;
|
||||
}
|
||||
|
||||
if (conference_utils_member_test_flag(member, MFLAG_MANDATORY_MEMBER_ENDCONF)) {
|
||||
if (conference->end_count++) {
|
||||
conference->endconference_time = 0;
|
||||
}
|
||||
|
@ -1314,9 +1319,14 @@ switch_status_t conference_member_del(conference_obj_t *conference, conference_m
|
|||
|
||||
conference_video_check_flush(member, SWITCH_FALSE);
|
||||
|
||||
/* End conference when any member with "endconf" flag disconnects */
|
||||
if (conference_utils_member_test_flag(member, MFLAG_ENDCONF)) {
|
||||
conference_utils_set_flag_locked(conference, CFLAG_DESTRUCT);
|
||||
}
|
||||
|
||||
/* End conference only if all mandatory members have disconnected */
|
||||
if (conference_utils_member_test_flag(member, MFLAG_MANDATORY_MEMBER_ENDCONF)) {
|
||||
if (!--conference->end_count) {
|
||||
//conference_utils_set_flag_locked(conference, CFLAG_DESTRUCT);
|
||||
conference->endconference_time = switch_epoch_time_now(NULL);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -132,6 +132,8 @@ void conference_utils_set_mflags(const char *flags, member_flag_t *f)
|
|||
f[MFLAG_NOMOH] = 1;
|
||||
} else if (!strcasecmp(argv[i], "endconf")) {
|
||||
f[MFLAG_ENDCONF] = 1;
|
||||
} else if (!strcasecmp(argv[i], "mandatory_member_endconf")) {
|
||||
f[MFLAG_MANDATORY_MEMBER_ENDCONF] = 1;
|
||||
} else if (!strcasecmp(argv[i], "mintwo")) {
|
||||
f[MFLAG_MINTWO] = 1;
|
||||
} else if (!strcasecmp(argv[i], "talk-data-events")) {
|
||||
|
|
|
@ -1347,6 +1347,9 @@ void conference_xlist(conference_obj_t *conference, switch_xml_t x_conference, i
|
|||
x_tag = switch_xml_add_child_d(x_flags, "end_conference", count++);
|
||||
switch_xml_set_txt_d(x_tag, conference_utils_member_test_flag(member, MFLAG_ENDCONF) ? "true" : "false");
|
||||
|
||||
x_tag = switch_xml_add_child_d(x_flags, "mandatory_member_end_conference", count++);
|
||||
switch_xml_set_txt_d(x_tag, conference_utils_member_test_flag(member, MFLAG_MANDATORY_MEMBER_ENDCONF) ? "true" : "false");
|
||||
|
||||
x_tag = switch_xml_add_child_d(x_flags, "is_ghost", count++);
|
||||
switch_xml_set_txt_d(x_tag, conference_utils_member_test_flag(member, MFLAG_GHOST) ? "true" : "false");
|
||||
|
||||
|
@ -1456,6 +1459,7 @@ void conference_jlist(conference_obj_t *conference, cJSON *json_conferences)
|
|||
ADDBOOL(json_conference_member_flags, "has_floor", member->id == member->conference->floor_holder);
|
||||
ADDBOOL(json_conference_member_flags, "is_moderator", conference_utils_member_test_flag(member, MFLAG_MOD));
|
||||
ADDBOOL(json_conference_member_flags, "end_conference", conference_utils_member_test_flag(member, MFLAG_ENDCONF));
|
||||
ADDBOOL(json_conference_member_flags, "mandatory_member_end_conference", conference_utils_member_test_flag(member, MFLAG_MANDATORY_MEMBER_ENDCONF));
|
||||
ADDBOOL(json_conference_member_flags, "pass_digits", conference_utils_member_test_flag(member, MFLAG_DIST_DTMF));
|
||||
}
|
||||
switch_mutex_unlock(conference->member_mutex);
|
||||
|
|
|
@ -178,6 +178,7 @@ typedef enum {
|
|||
MFLAG_NO_MINIMIZE_ENCODING,
|
||||
MFLAG_FLUSH_BUFFER,
|
||||
MFLAG_ENDCONF,
|
||||
MFLAG_MANDATORY_MEMBER_ENDCONF,
|
||||
MFLAG_HAS_AUDIO,
|
||||
MFLAG_TALKING,
|
||||
MFLAG_RESTART,
|
||||
|
@ -1123,7 +1124,7 @@ void conference_video_canvas_del_fnode_layer(conference_obj_t *conference, confe
|
|||
void conference_video_canvas_set_fnode_layer(mcu_canvas_t *canvas, conference_file_node_t *fnode, int idx);
|
||||
void conference_list(conference_obj_t *conference, switch_stream_handle_t *stream, char *delim);
|
||||
const char *conference_utils_combine_flag_var(switch_core_session_t *session, const char *var_name);
|
||||
int conference_loop_mapping_len();
|
||||
int conference_loop_mapping_len(void);
|
||||
void conference_api_set_agc(conference_member_t *member, const char *data);
|
||||
|
||||
switch_status_t conference_outcall(conference_obj_t *conference,
|
||||
|
|
|
@ -104,8 +104,13 @@ struct http_sendfile_data_obj {
|
|||
char *extrapost_elements;
|
||||
switch_CURL *curl_handle;
|
||||
char *cacert;
|
||||
#if defined(LIBCURL_VERSION_NUM) && (LIBCURL_VERSION_NUM >= 0x073800)
|
||||
curl_mime *mime;
|
||||
curl_mimepart *part;
|
||||
#else
|
||||
struct curl_httppost *formpost;
|
||||
struct curl_httppost *lastptr;
|
||||
#endif
|
||||
uint8_t flags; /* This is for where to send output of the curl_sendfile commands */
|
||||
switch_stream_handle_t *stream;
|
||||
char *sendfile_response;
|
||||
|
@ -456,8 +461,19 @@ static void http_sendfile_initialize_curl(http_sendfile_data_t *http_data)
|
|||
curl_easy_setopt(http_data->curl_handle, CURLOPT_WRITEFUNCTION, http_sendfile_response_callback);
|
||||
curl_easy_setopt(http_data->curl_handle, CURLOPT_WRITEDATA, (void *) http_data);
|
||||
|
||||
/* Initial http_data->mime */
|
||||
#if defined(LIBCURL_VERSION_NUM) && (LIBCURL_VERSION_NUM >= 0x073800)
|
||||
http_data->mime = curl_mime_init(http_data->curl_handle);
|
||||
#endif
|
||||
|
||||
/* Add the file to upload as a POST form field */
|
||||
#if defined(LIBCURL_VERSION_NUM) && (LIBCURL_VERSION_NUM >= 0x073800)
|
||||
http_data->part = curl_mime_addpart(http_data->mime);
|
||||
curl_mime_name(http_data->part, http_data->filename_element_name);
|
||||
curl_mime_filedata(http_data->part, http_data->filename_element);
|
||||
#else
|
||||
curl_formadd(&http_data->formpost, &http_data->lastptr, CURLFORM_COPYNAME, http_data->filename_element_name, CURLFORM_FILE, http_data->filename_element, CURLFORM_END);
|
||||
#endif
|
||||
|
||||
if(!zstr(http_data->extrapost_elements))
|
||||
{
|
||||
|
@ -476,16 +492,32 @@ static void http_sendfile_initialize_curl(http_sendfile_data_t *http_data)
|
|||
if(argc2 == 2) {
|
||||
switch_url_decode(argv2[0]);
|
||||
switch_url_decode(argv2[1]);
|
||||
#if defined(LIBCURL_VERSION_NUM) && (LIBCURL_VERSION_NUM >= 0x073800)
|
||||
http_data->part = curl_mime_addpart(http_data->mime);
|
||||
curl_mime_name(http_data->part, argv2[0]);
|
||||
curl_mime_data(http_data->part, argv2[1], CURL_ZERO_TERMINATED);
|
||||
#else
|
||||
curl_formadd(&http_data->formpost, &http_data->lastptr, CURLFORM_COPYNAME, argv2[0], CURLFORM_COPYCONTENTS, argv2[1], CURLFORM_END);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Fill in the submit field too, even if this isn't really needed */
|
||||
#if defined(LIBCURL_VERSION_NUM) && (LIBCURL_VERSION_NUM >= 0x073800)
|
||||
http_data->part = curl_mime_addpart(http_data->mime);
|
||||
curl_mime_name(http_data->part, "submit");
|
||||
curl_mime_data(http_data->part, "or_die", CURL_ZERO_TERMINATED);
|
||||
#else
|
||||
curl_formadd(&http_data->formpost, &http_data->lastptr, CURLFORM_COPYNAME, "submit", CURLFORM_COPYCONTENTS, "or_die", CURLFORM_END);
|
||||
#endif
|
||||
|
||||
/* what URL that receives this POST */
|
||||
#if defined(LIBCURL_VERSION_NUM) && (LIBCURL_VERSION_NUM >= 0x073800)
|
||||
curl_easy_setopt(http_data->curl_handle, CURLOPT_MIMEPOST, http_data->mime);
|
||||
#else
|
||||
curl_easy_setopt(http_data->curl_handle, CURLOPT_HTTPPOST, http_data->formpost);
|
||||
#endif
|
||||
|
||||
// This part actually fires off the curl, captures the HTTP response code, and then frees up the handle.
|
||||
curl_easy_perform(http_data->curl_handle);
|
||||
|
@ -494,7 +526,11 @@ static void http_sendfile_initialize_curl(http_sendfile_data_t *http_data)
|
|||
curl_easy_cleanup(http_data->curl_handle);
|
||||
|
||||
// Clean up the form data from POST
|
||||
#if defined(LIBCURL_VERSION_NUM) && (LIBCURL_VERSION_NUM >= 0x073800)
|
||||
curl_mime_free(http_data->mime);
|
||||
#else
|
||||
curl_formfree(http_data->formpost);
|
||||
#endif
|
||||
}
|
||||
|
||||
static switch_status_t http_sendfile_test_file_open(http_sendfile_data_t *http_data, switch_event_t *event)
|
||||
|
|
|
@ -280,7 +280,7 @@ static switch_xml_config_item_t config_settings[] = {
|
|||
SWITCH_CONFIG_ITEM_END()
|
||||
};
|
||||
|
||||
static switch_status_t do_config()
|
||||
static switch_status_t do_config(void)
|
||||
{
|
||||
switch_cache_db_handle_t *dbh = NULL;
|
||||
switch_status_t status = SWITCH_STATUS_SUCCESS;
|
||||
|
|
|
@ -161,7 +161,6 @@ static switch_status_t digit_action_callback(switch_ivr_dmachine_match_t *match)
|
|||
char *string = NULL;
|
||||
switch_channel_t *channel;
|
||||
switch_core_session_t *use_session = act->session;
|
||||
int x = 0;
|
||||
char *flags = "";
|
||||
|
||||
if (act->target == DIGIT_TARGET_PEER || act->target == DIGIT_TARGET_BOTH) {
|
||||
|
@ -171,7 +170,6 @@ static switch_status_t digit_action_callback(switch_ivr_dmachine_match_t *match)
|
|||
}
|
||||
|
||||
top:
|
||||
x++;
|
||||
|
||||
string = switch_core_session_strdup(use_session, act->string);
|
||||
exec = 0;
|
||||
|
|
|
@ -1419,7 +1419,7 @@ static switch_status_t httapi_sync(client_t *client)
|
|||
switch_status_t status = SWITCH_STATUS_FALSE;
|
||||
int get_style_method = 0;
|
||||
char *method = NULL;
|
||||
struct curl_httppost *formpost=NULL;
|
||||
switch_curl_mime *formpost = NULL;
|
||||
switch_event_t *save_params = NULL;
|
||||
const char *put_file;
|
||||
FILE *fd = NULL;
|
||||
|
@ -1476,7 +1476,7 @@ static switch_status_t httapi_sync(client_t *client)
|
|||
}
|
||||
|
||||
if (!put_file) {
|
||||
switch_curl_process_form_post_params(client->params, curl_handle, &formpost);
|
||||
switch_curl_process_mime(client->params, curl_handle, &formpost);
|
||||
}
|
||||
|
||||
if (formpost) {
|
||||
|
@ -1588,7 +1588,7 @@ static switch_status_t httapi_sync(client_t *client)
|
|||
curl_easy_setopt(curl_handle, CURLOPT_READFUNCTION, put_file_read);
|
||||
|
||||
} else if (formpost) {
|
||||
curl_easy_setopt(curl_handle, CURLOPT_HTTPPOST, formpost);
|
||||
switch_curl_easy_setopt_mime(curl_handle, formpost);
|
||||
} else {
|
||||
switch_curl_easy_setopt(curl_handle, CURLOPT_POST, !get_style_method);
|
||||
}
|
||||
|
@ -1670,9 +1670,7 @@ static switch_status_t httapi_sync(client_t *client)
|
|||
switch_curl_easy_cleanup(curl_handle);
|
||||
switch_curl_slist_free_all(headers);
|
||||
|
||||
if (formpost) {
|
||||
curl_formfree(formpost);
|
||||
}
|
||||
switch_curl_mime_free(&formpost);
|
||||
|
||||
if (client->err) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error encountered! [%s]\ndata: [%s]\n", client->profile->url, data);
|
||||
|
|
|
@ -279,7 +279,11 @@ switch_status_t azure_blob_finalise_put(http_profile_t *profile, const char *url
|
|||
goto done;
|
||||
}
|
||||
|
||||
#if defined(LIBCURL_VERSION_NUM) && (LIBCURL_VERSION_NUM >= 0x070c01)
|
||||
switch_curl_easy_setopt(curl_handle, CURLOPT_UPLOAD, 1);
|
||||
#else
|
||||
switch_curl_easy_setopt(curl_handle, CURLOPT_PUT, 1);
|
||||
#endif
|
||||
switch_curl_easy_setopt(curl_handle, CURLOPT_NOSIGNAL, 1);
|
||||
switch_curl_easy_setopt(curl_handle, CURLOPT_HTTPHEADER, headers);
|
||||
switch_curl_easy_setopt(curl_handle, CURLOPT_URL, full_url);
|
||||
|
|
|
@ -393,7 +393,9 @@ static switch_status_t http_put(url_cache_t *cache, http_profile_t *profile, swi
|
|||
goto done;
|
||||
}
|
||||
switch_curl_easy_setopt(curl_handle, CURLOPT_UPLOAD, 1);
|
||||
#if !defined(LIBCURL_VERSION_NUM) || (LIBCURL_VERSION_NUM < 0x070c01)
|
||||
switch_curl_easy_setopt(curl_handle, CURLOPT_PUT, 1);
|
||||
#endif
|
||||
switch_curl_easy_setopt(curl_handle, CURLOPT_NOSIGNAL, 1);
|
||||
switch_curl_easy_setopt(curl_handle, CURLOPT_HTTPHEADER, headers);
|
||||
switch_curl_easy_setopt(curl_handle, CURLOPT_URL, full_url);
|
||||
|
|
|
@ -704,7 +704,7 @@ done:
|
|||
return status;
|
||||
}
|
||||
|
||||
static switch_status_t load_config()
|
||||
static switch_status_t load_config(void)
|
||||
{
|
||||
char *cf = "signalwire.conf";
|
||||
switch_xml_t cfg, xml;
|
||||
|
@ -1390,7 +1390,7 @@ static void mod_signalwire_state_register(void)
|
|||
}
|
||||
}
|
||||
|
||||
static void mod_signalwire_state_ready()
|
||||
static void mod_signalwire_state_ready(void)
|
||||
{
|
||||
if (globals.profile_update) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Signalwire SIP profile update initiated\n");
|
||||
|
|
|
@ -48,7 +48,7 @@ static switch_status_t switch_ilbc_fmtp_parse(const char *fmtp, switch_codec_fmt
|
|||
|
||||
memset(codec_fmtp, '\0', sizeof(struct switch_codec_fmtp));
|
||||
|
||||
if (fmtp && (mode = strstr(fmtp, "mode=")) && (mode + 5)) {
|
||||
if (fmtp && (mode = strstr(fmtp, "mode=")) && *(mode + 5)) {
|
||||
codec_ms = atoi(mode + 5);
|
||||
}
|
||||
if (!codec_ms) {
|
||||
|
|
|
@ -1170,24 +1170,30 @@ static switch_status_t switch_opus_keep_fec_enabled(switch_codec_t *codec)
|
|||
}
|
||||
}
|
||||
|
||||
static switch_bool_t switch_opus_vad(struct opus_context *context, void *encoded_data, uint32_t encoded_data_len) {
|
||||
const uint8_t *payload = (const uint8_t *) encoded_data;
|
||||
static switch_bool_t switch_opus_vad(struct opus_context *context, void *encoded_data, uint32_t encoded_data_len)
|
||||
{
|
||||
const uint8_t *payload = (const uint8_t *)encoded_data;
|
||||
opus_packet_info_t opus_packet_info;
|
||||
switch_bool_t debug = (globals.debug || context->debug > 1);
|
||||
switch_bool_t debug = (globals.debug || context->debug > 1);
|
||||
|
||||
if (!switch_opus_packet_parse(payload, encoded_data_len, &opus_packet_info, debug)) {
|
||||
if (debug) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "OPUS PACKET PARSING ERROR len:%d bytes:%02x %02x\n",
|
||||
(int)encoded_data_len, payload[0], payload[1]);
|
||||
(int)encoded_data_len, payload[0], payload[1]);
|
||||
}
|
||||
|
||||
return SWITCH_TRUE;
|
||||
}
|
||||
|
||||
if (debug) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "OPUS EXTRACT PAYLOAD VAD len:%d vad_ms:%d bytes:%02x %02x\n",
|
||||
(int)encoded_data_len, opus_packet_info.vad_ms, payload[0], payload[1]);
|
||||
(int)encoded_data_len, opus_packet_info.vad_ms, payload[0], payload[1]);
|
||||
}
|
||||
|
||||
if (opus_packet_info.vad_ms == 0) {
|
||||
return SWITCH_FALSE;
|
||||
}
|
||||
|
||||
return SWITCH_TRUE;
|
||||
}
|
||||
|
||||
|
@ -1284,9 +1290,10 @@ static switch_status_t switch_opus_control(switch_codec_t *codec,
|
|||
break;
|
||||
case SCC_AUDIO_VAD:
|
||||
{
|
||||
void* encoded_data = (void *)cmd_data;
|
||||
uint16_t* encoded_data_len = (uint16_t *)cmd_arg;
|
||||
switch_bool_t *ret = (switch_bool_t *) *ret_data;
|
||||
void *encoded_data = (void *)cmd_data;
|
||||
uint16_t *encoded_data_len = (uint16_t *)cmd_arg;
|
||||
switch_bool_t *ret = (switch_bool_t *)*ret_data;
|
||||
|
||||
*ret = switch_opus_vad(context, encoded_data, *encoded_data_len);
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -33,64 +33,72 @@
|
|||
#include "opus_parse.h"
|
||||
/* Tables for LBRR_sympbol decoding */
|
||||
|
||||
static const opus_int16 silk_LBRR_flags_2_PDFCum[3] = {53, 106, 256}; /* 256 - silk_LBRR_flags_2_iCDF[i] ; silk_LBRR_flags_2_iCDF[ 3 ] = { 203, 150, 0 }; */
|
||||
static const opus_int16 silk_LBRR_flags_3_PDFCum[7] = {41, 61, 90, 131, 146, 174, 256}; /* 256 - silk_LBRR_flags_3_iCDF[i] ; silk_LBRR_flags_3_iCDF[ 7 ] = { 215, 195, 166, 125, 110, 82, 0 }; */
|
||||
static const opus_int16 silk_LBRR_flags_2_PDFCum[3] = { 53, 106, 256 }; /* 256 - silk_LBRR_flags_2_iCDF[i] ; silk_LBRR_flags_2_iCDF[ 3 ] = { 203, 150, 0 }; */
|
||||
static const opus_int16 silk_LBRR_flags_3_PDFCum[7] = { 41, 61, 90, 131, 146, 174, 256 }; /* 256 - silk_LBRR_flags_3_iCDF[i] ; silk_LBRR_flags_3_iCDF[ 7 ] = { 215, 195, 166, 125, 110, 82, 0 }; */
|
||||
|
||||
/* get the number of VAD flags - i.e. number of 20 ms frame - from the config */
|
||||
/* in a silk-only or hybrid opus frame mono or stereo*/
|
||||
/* 5 MSB TOC byte (see table 2 of IETF RFC6716 clause 3.1) */
|
||||
/* if 10 ms frame (config=0, 4, 8, 12, 14) : return 1 */
|
||||
/* if CELT_only frame no VAD flag =>return 0 */
|
||||
/* Get the number of VAD flags - i.e. number of 20 ms frame - from the config
|
||||
* in a silk-only or hybrid opus frame mono or stereo
|
||||
* 5 MSB TOC byte (see table 2 of IETF RFC6716 clause 3.1)
|
||||
* if 10 ms frame (config=0, 4, 8, 12, 14) : return 1
|
||||
* if CELT_only frame no VAD flag =>return 0 */
|
||||
static opus_int16 switch_opus_get_nb_flags_in_silk_frame(int16_t config)
|
||||
{
|
||||
opus_int16 silk_frame_nb_flags;
|
||||
|
||||
if (config > 15) {
|
||||
/* CELT_only frame no VAD flag nor LBRR flag */
|
||||
silk_frame_nb_flags = 0;
|
||||
} else {
|
||||
silk_frame_nb_flags = 1; /*default*/
|
||||
silk_frame_nb_flags = 1; /* default */
|
||||
|
||||
if (config < 12) {
|
||||
/* silk-only NB, MB or WB */
|
||||
/* The least two significant bits give the number of VAD flags inside the silk frame 1, 2 or 3 */
|
||||
/* silk-only NB, MB or WB
|
||||
* The least two significant bits give the number of VAD flags inside the silk frame 1, 2 or 3 */
|
||||
silk_frame_nb_flags = config & 0x3;
|
||||
|
||||
if (silk_frame_nb_flags == 0) { /* 0 => 10ms frame : one VAD flag */
|
||||
silk_frame_nb_flags++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return silk_frame_nb_flags;
|
||||
}
|
||||
|
||||
/* get the time in ms corresponding to one VAD flag from the config */
|
||||
/* in a silk-only or hybrid opus frame mono or stereo*/
|
||||
/* 5 MSB TOC byte (see table 2 of IETF RFC6716 clause 3.1) */
|
||||
/* if CELT_only frame (config >15) no VAD flag =>return FALSE */
|
||||
/* if 10 ms frame (config=0, 4, 8, 12, 14) : return 10 */
|
||||
/* otherwise return 20 */
|
||||
/* Get the time in ms corresponding to one VAD flag from the config
|
||||
* in a silk-only or hybrid opus frame mono or stereo
|
||||
* 5 MSB TOC byte (see table 2 of IETF RFC6716 clause 3.1)
|
||||
* if CELT_only frame (config >15) no VAD flag =>return FALSE
|
||||
* if 10 ms frame (config=0, 4, 8, 12, 14) : return 10
|
||||
* otherwise return 20 */
|
||||
static opus_int16 switch_opus_get_silk_frame_ms_per_flag(int16_t config, opus_int16 silk_frame_nb_flags)
|
||||
{
|
||||
opus_int16 silk_size_frame_ms_per_flag;
|
||||
|
||||
if (config > 15) {
|
||||
/* CELT_only frame no VAD flag nor LBRR flag */
|
||||
/* switch_opus_get_silk_frame_ms_per_flag: code not written for CELT-only mode */
|
||||
return FALSE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
silk_size_frame_ms_per_flag = 20; /* default*/
|
||||
if (silk_frame_nb_flags == 1) { /* could be 10 or 20 ms */
|
||||
if ((config &0x01) == 0) {
|
||||
silk_size_frame_ms_per_flag = 10;
|
||||
if ((config & 0x01) == 0) {
|
||||
silk_size_frame_ms_per_flag = 10;
|
||||
}
|
||||
}
|
||||
|
||||
return silk_size_frame_ms_per_flag;
|
||||
}
|
||||
|
||||
/* code written only for mono, silk-only or hybrid mode */
|
||||
/* for CELT-only frame no vad flags for LBRR flag the routine must not be called */
|
||||
/* for stereo : the mid frame VAD_flags and the LBRR_flag could be obtained */
|
||||
/* yet, to get the LBRR_flags of the mid frame the routine should be modified */
|
||||
/* to skip the side VAD flags and the side LBRR flag and to get the mid LBRR_symbol */
|
||||
static bool_t switch_opus_get_VAD_LBRR_flags(const uint8_t *buf, opus_int16 silk_frame_nb_flags,
|
||||
opus_int16 *VAD_flags, opus_int16 *LBRR_flags, opus_int16 *nb_VAD1, opus_int16 *nb_FEC)
|
||||
/* Code written only for mono, silk-only or hybrid mode
|
||||
* for CELT-only frame no vad flags for LBRR flag the routine must not be called
|
||||
* for stereo : the mid frame VAD_flags and the LBRR_flag could be obtained
|
||||
* yet, to get the LBRR_flags of the mid frame the routine should be modified
|
||||
* to skip the side VAD flags and the side LBRR flag and to get the mid LBRR_symbol */
|
||||
static void switch_opus_get_VAD_LBRR_flags(const uint8_t *buf, opus_int16 silk_frame_nb_flags,
|
||||
opus_int16 *VAD_flags, opus_int16 *LBRR_flags, opus_int16 *nb_VAD1, opus_int16 *nb_FEC)
|
||||
{
|
||||
const opus_int16 *ptr_pdf_cum;
|
||||
opus_int nb_pdf_symbol;
|
||||
|
@ -104,39 +112,41 @@ static bool_t switch_opus_get_VAD_LBRR_flags(const uint8_t *buf, opus_int16 silk
|
|||
nb_vad = 0;
|
||||
nb_fec = 0;
|
||||
|
||||
/* get VAD_FLAGS & LBRR_FLAG */
|
||||
/* silk_frame_nb_flags = 1 (10 or 20 ms), the two MSB of the first byte are the VAD flag and the LBRR flag */
|
||||
/* silk_frame_nb_flags = 2 (40 ms), the three MSB of the first byte are the two VAD flags and the LBRR flag */
|
||||
/* silk_frame_nb_flags = 3 (60 ms), the four MSB of the first byte are the three VAD flags and the LBRR flag */
|
||||
/* compute the number of MSB to analyse */
|
||||
/* Get VAD_FLAGS & LBRR_FLAG
|
||||
* silk_frame_nb_flags = 1 (10 or 20 ms), the two MSB of the first byte are the VAD flag and the LBRR flag
|
||||
* silk_frame_nb_flags = 2 (40 ms), the three MSB of the first byte are the two VAD flags and the LBRR flag
|
||||
* silk_frame_nb_flags = 3 (60 ms), the four MSB of the first byte are the three VAD flags and the LBRR flag
|
||||
* compute the number of MSB to analyze */
|
||||
nb_bit = silk_frame_nb_flags + 1;
|
||||
/* number of right shifts to appply to the first byte to only have the bits of LBRR flag and of the VAD flags */
|
||||
|
||||
/* number of right shifts to apply to the first byte to only have the bits of LBRR flag and of the VAD flags */
|
||||
compl_nb_bit = 8 - nb_bit;
|
||||
mask = (1 << nb_bit) - 1;
|
||||
|
||||
/* the bits of the silk_frame_nb_flags VAD flags and the LBRR flag are the MSB of the first byte */
|
||||
/* silk_frame_nb_flags = 1 (10 or 20 ms), VAD_flags(0) | LBRR_flag */
|
||||
/* silk_frame_nb_flags = 2 (40 ms), VAD_flags(0) | VAD_flags(1) | LBRR_flag */
|
||||
/* silk_frame_nb_flags = 3 (60 ms), VAD_flags(0) | VAD_flags(1) | VAD_flags(2) |LBRR_flag */
|
||||
/* The bits of the silk_frame_nb_flags VAD flags and the LBRR flag are the MSB of the first byte
|
||||
* silk_frame_nb_flags = 1 (10 or 20 ms), VAD_flags(0) | LBRR_flag
|
||||
* silk_frame_nb_flags = 2 (40 ms), VAD_flags(0) | VAD_flags(1) | LBRR_flag
|
||||
* silk_frame_nb_flags = 3 (60 ms), VAD_flags(0) | VAD_flags(1) | VAD_flags(2) |LBRR_flag */
|
||||
val = (buf[0] >> compl_nb_bit) & mask;
|
||||
|
||||
LBRR_flag = val & 0x1; /* LBRR_FLAG LSB */
|
||||
|
||||
/* get VAD_flags */
|
||||
ptr_flags = VAD_flags + silk_frame_nb_flags;
|
||||
for (i=0; i < silk_frame_nb_flags; i++) {
|
||||
for (i = 0; i < silk_frame_nb_flags; i++) {
|
||||
LBRR_flags[i] = 0; /* init */
|
||||
val >>= 1;
|
||||
*(--ptr_flags) = val & 0x1;
|
||||
}
|
||||
|
||||
if (LBRR_flag != 0) { /* there is at least one LBRR frame */
|
||||
if (silk_frame_nb_flags == 1) {
|
||||
LBRR_flags[0] = 1;
|
||||
nb_fec = 1;
|
||||
} else { /* get LBRR_symbol then LBRR_flags */
|
||||
/* LBRR symbol is encoded with range encoder : range on 8 bits */
|
||||
/* silk_frame_nb_flags = 2 ; 3 possible values for LBRR_flags(1) | LBRR_flags(0))= 01, 10, 11 */
|
||||
/* silk_frame_nb_flags = 3 ; 7 possible values for LBRR_flags(2) | LBRR_flags(1) | LBRR_flags(0))= 001, 010, 011, 100, 101, 110, 111 */
|
||||
/* LBRR symbol is encoded with range encoder : range on 8 bits
|
||||
* silk_frame_nb_flags = 2 ; 3 possible values for LBRR_flags(1) | LBRR_flags(0))= 01, 10, 11
|
||||
* silk_frame_nb_flags = 3 ; 7 possible values for LBRR_flags(2) | LBRR_flags(1) | LBRR_flags(0))= 001, 010, 011, 100, 101, 110, 111 */
|
||||
mask2 = (1 << compl_nb_bit) - 1;
|
||||
/* get next 8 bits: (8-nb_bit) LSB of the first byte and nb_bit MSB of the second byte */
|
||||
val = (((buf[0]) & mask2) << nb_bit) | ((buf[1] >> compl_nb_bit) & mask);
|
||||
|
@ -148,6 +158,7 @@ static bool_t switch_opus_get_VAD_LBRR_flags(const uint8_t *buf, opus_int16 silk
|
|||
nb_pdf_symbol = 7;
|
||||
ptr_pdf_cum = silk_LBRR_flags_3_PDFCum;
|
||||
}
|
||||
|
||||
LBRR_symbol = 0;
|
||||
for (i = 1; i <= nb_pdf_symbol; i++) {
|
||||
if (val < *ptr_pdf_cum++) {
|
||||
|
@ -155,6 +166,7 @@ static bool_t switch_opus_get_VAD_LBRR_flags(const uint8_t *buf, opus_int16 silk
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < silk_frame_nb_flags; i++) {
|
||||
LBRR_flags[i] = LBRR_symbol & 0x01;
|
||||
LBRR_symbol >>= 1;
|
||||
|
@ -162,20 +174,22 @@ static bool_t switch_opus_get_VAD_LBRR_flags(const uint8_t *buf, opus_int16 silk
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < silk_frame_nb_flags; i++) {
|
||||
nb_vad += VAD_flags[i];
|
||||
}
|
||||
|
||||
*nb_VAD1 = nb_vad;
|
||||
*nb_FEC = nb_fec;
|
||||
return TRUE;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* Parse the packet to retrieve informations about its content
|
||||
* RFC6716: Definition of the Opus Audio Codec
|
||||
* return: FALSE if there was a problem found parsing the packet, the info returned should be ignored.
|
||||
* return: SWITCH_FALSE if there was a problem found parsing the packet, the info returned should be ignored.
|
||||
* */
|
||||
bool_t switch_opus_packet_parse(const uint8_t *payload, int payload_length_bytes, opus_packet_info_t *packet_info, bool_t debug)
|
||||
switch_bool_t switch_opus_packet_parse(const uint8_t *payload, int payload_length_bytes, opus_packet_info_t *packet_info, switch_bool_t debug)
|
||||
{
|
||||
int f;
|
||||
int32_t samplerate;
|
||||
|
@ -188,6 +202,7 @@ bool_t switch_opus_packet_parse(const uint8_t *payload, int payload_length_bytes
|
|||
opus_int16 silk_frame_nb_flags, silk_size_frame_ms_per_flag;
|
||||
opus_int16 silk_frame_nb_fec, silk_frame_nb_vad1;
|
||||
opus_int sample_per_frame;
|
||||
|
||||
packet_info->config = 0;
|
||||
packet_info->fec = 0;
|
||||
packet_info->fec_ms = 0;
|
||||
|
@ -198,19 +213,22 @@ bool_t switch_opus_packet_parse(const uint8_t *payload, int payload_length_bytes
|
|||
packet_info->channels = 1; /* as stereo is set to FALSE */
|
||||
packet_info->ms_per_frame = 0;
|
||||
packet_info->ptime_ts = 0;
|
||||
|
||||
if (payload == NULL || payload_length_bytes <= 0) {
|
||||
if (debug) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "opus_packet_parse: payload null.");
|
||||
}
|
||||
return FALSE;
|
||||
|
||||
return SWITCH_FALSE;
|
||||
}
|
||||
|
||||
/* In CELT_ONLY mode, packets should not have FEC. */
|
||||
if (payload[0] & 0x80) {
|
||||
/* opus_packet_parse: CELT_ONLY mode, we do not support this mode. */
|
||||
return FALSE;
|
||||
return SWITCH_FALSE;
|
||||
} else {
|
||||
int mode = (payload[0] >> 3);
|
||||
|
||||
if (mode <= 3) {
|
||||
samplerate = 8000;
|
||||
} else if (mode <= 7) {
|
||||
|
@ -223,16 +241,18 @@ bool_t switch_opus_packet_parse(const uint8_t *payload, int payload_length_bytes
|
|||
samplerate = 48000;
|
||||
} else {
|
||||
/* opus_packet_parse: CELT_ONLY mode, we do not support this mode. */
|
||||
return FALSE;
|
||||
return SWITCH_FALSE;
|
||||
}
|
||||
if (debug) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "opus_packet_parse: mode[%d]s[%d]c[%d] [%d]Hz\n", mode, (payload[0]>>2)&0x1 ,(payload[0])&0x3, samplerate);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "opus_packet_parse: mode[%d]s[%d]c[%d] [%d]Hz\n", mode, (payload[0] >> 2) & 0x1, (payload[0]) & 0x3, samplerate);
|
||||
}
|
||||
}
|
||||
|
||||
if (payload[0] & 0x04) {
|
||||
packet_info->stereo = TRUE;
|
||||
packet_info->channels = 2;
|
||||
}
|
||||
|
||||
packet_info->config = payload[0] >> 3;
|
||||
sample_per_frame = opus_packet_get_samples_per_frame(payload, samplerate);
|
||||
packet_info->ms_per_frame = sample_per_frame * 1000 / samplerate;
|
||||
|
@ -240,7 +260,8 @@ bool_t switch_opus_packet_parse(const uint8_t *payload, int payload_length_bytes
|
|||
if (debug) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "opus_packet_parse: invalid packet.");
|
||||
}
|
||||
return FALSE;
|
||||
|
||||
return SWITCH_FALSE;
|
||||
}
|
||||
|
||||
packet_info->frames = opus_packet_parse(payload, payload_length_bytes, NULL, frame_data, frame_sizes, NULL);
|
||||
|
@ -249,54 +270,57 @@ bool_t switch_opus_packet_parse(const uint8_t *payload, int payload_length_bytes
|
|||
if (debug) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "opus_packet_parse: opus_packet_parse found no frame.\n");
|
||||
}
|
||||
return FALSE;
|
||||
|
||||
return SWITCH_FALSE;
|
||||
}
|
||||
|
||||
packet_info->ptime_ts = packet_info->frames * sample_per_frame;
|
||||
|
||||
if (frame_sizes[0] <= 1) {
|
||||
if (debug) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "opus_packet_parse: opus_packet_parse frame size too small.\n");
|
||||
}
|
||||
return FALSE;
|
||||
|
||||
return SWITCH_FALSE;
|
||||
}
|
||||
|
||||
/* +---------------+-----------+-----------+-------------------+ */
|
||||
/* | Configuration | Mode | Bandwidth | Frame Sizes | */
|
||||
/* | Number(s) | | | | */
|
||||
/* +---------------+-----------+-----------+-------------------+ */
|
||||
/* | 0...3 | SILK-only | NB | 10, 20, 40, 60 ms | */
|
||||
/* | 4...7 | SILK-only | MB | 10, 20, 40, 60 ms | */
|
||||
/* | 8...11 | SILK-only | WB | 10, 20, 40, 60 ms | */
|
||||
/* | 12...13 | Hybrid | SWB | 10, 20 ms | */
|
||||
/* | 14...15 | Hybrid | FB | 10, 20 ms | */
|
||||
/* | 16...19 | CELT-only | NB | 2.5, 5, 10, 20 ms | */
|
||||
/* | 20...23 | CELT-only | WB | 2.5, 5, 10, 20 ms | */
|
||||
/* | 24...27 | CELT-only | SWB | 2.5, 5, 10, 20 ms | */
|
||||
/* | 28...31 | CELT-only | FB | 2.5, 5, 10, 20 ms | */
|
||||
/* +---------------+-----------+-----------+-------------------+ */
|
||||
/* +---------------+-----------+-----------+-------------------+
|
||||
| Configuration | Mode | Bandwidth | Frame Sizes |
|
||||
| Number(s) | | | |
|
||||
+---------------+-----------+-----------+-------------------+
|
||||
| 0...3 | SILK-only | NB | 10, 20, 40, 60 ms |
|
||||
| 4...7 | SILK-only | MB | 10, 20, 40, 60 ms |
|
||||
| 8...11 | SILK-only | WB | 10, 20, 40, 60 ms |
|
||||
| 12...13 | Hybrid | SWB | 10, 20 ms |
|
||||
| 14...15 | Hybrid | FB | 10, 20 ms |
|
||||
| 16...19 | CELT-only | NB | 2.5, 5, 10, 20 ms |
|
||||
| 20...23 | CELT-only | WB | 2.5, 5, 10, 20 ms |
|
||||
| 24...27 | CELT-only | SWB | 2.5, 5, 10, 20 ms |
|
||||
| 28...31 | CELT-only | FB | 2.5, 5, 10, 20 ms |
|
||||
+---------------+-----------+-----------+-------------------+ */
|
||||
|
||||
if (!packet_info->stereo) {
|
||||
/* the routines opus_get_nb_flags_in_silk_frame and opus_get_silk_frame_ms_per_flag are also valid for stereo frames */
|
||||
/* yet the routine opus_get_VAD_LBRR_flags is currently only for mono frame*/
|
||||
/* The routines opus_get_nb_flags_in_silk_frame and opus_get_silk_frame_ms_per_flag are also valid for stereo frames
|
||||
* yet the routine opus_get_VAD_LBRR_flags is currently only for mono frame */
|
||||
silk_frame_nb_flags = switch_opus_get_nb_flags_in_silk_frame(packet_info->config); /* =1 for 10 or 20 ms frame; = 2 for 40 ms; = 3 for 60 ms */
|
||||
if (!silk_frame_nb_flags) {
|
||||
/* We should not go there as CELT_ONLY is already tested above */
|
||||
return FALSE;
|
||||
return SWITCH_FALSE;
|
||||
}
|
||||
|
||||
packet_info->frames_silk = silk_frame_nb_flags;
|
||||
silk_size_frame_ms_per_flag = switch_opus_get_silk_frame_ms_per_flag(packet_info->config, silk_frame_nb_flags); /* 10 or 20 ms frame*/
|
||||
if (!silk_size_frame_ms_per_flag) {
|
||||
/* we should not go there as CELT_ONLY is already tested above */
|
||||
return FALSE;
|
||||
return SWITCH_FALSE;
|
||||
}
|
||||
|
||||
ptr_LBBR_FLAGS = packet_LBBR_FLAGS;
|
||||
ptr_VAD_FLAGS = packet_VAD_FLAGS;
|
||||
|
||||
for (f = 0; f < packet_info->frames; f++) {
|
||||
switch_opus_get_VAD_LBRR_flags(frame_data[f], silk_frame_nb_flags, ptr_VAD_FLAGS, ptr_LBBR_FLAGS,
|
||||
&silk_frame_nb_vad1, &silk_frame_nb_fec);
|
||||
switch_opus_get_VAD_LBRR_flags(frame_data[f], silk_frame_nb_flags, ptr_VAD_FLAGS, ptr_LBBR_FLAGS,
|
||||
&silk_frame_nb_vad1, &silk_frame_nb_fec);
|
||||
packet_info->vad += silk_frame_nb_vad1;
|
||||
packet_info->fec += silk_frame_nb_fec;
|
||||
packet_info->vad_ms += silk_frame_nb_vad1 * silk_size_frame_ms_per_flag;
|
||||
|
@ -305,6 +329,7 @@ bool_t switch_opus_packet_parse(const uint8_t *payload, int payload_length_bytes
|
|||
ptr_VAD_FLAGS += silk_frame_nb_flags;
|
||||
ptr_LBBR_FLAGS += silk_frame_nb_flags;
|
||||
}
|
||||
|
||||
/* store the VAD & LBRR flags of all 20 ms silk-frames of the packet; LSB the first frame, MSB: the last */
|
||||
vad_flags_per_silk_frame = 0;
|
||||
fec_flags_per_silk_frame = 0;
|
||||
|
@ -313,28 +338,34 @@ bool_t switch_opus_packet_parse(const uint8_t *payload, int payload_length_bytes
|
|||
if (debug) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "opus_packet_parse: more than %d 20-ms frames in the packet ; only first 15 silk-frames data will be stored (pb silkFastAccelerate)\n", silk_frame_packet);
|
||||
}
|
||||
|
||||
silk_frame_packet = 15;
|
||||
}
|
||||
|
||||
ptr_LBBR_FLAGS = packet_LBBR_FLAGS;
|
||||
ptr_VAD_FLAGS = packet_VAD_FLAGS;
|
||||
shift_silk = 0;
|
||||
for (i=0; i < silk_frame_packet; i++) {
|
||||
for (i = 0; i < silk_frame_packet; i++) {
|
||||
vad_flags_per_silk_frame += (*ptr_VAD_FLAGS) << shift_silk;
|
||||
fec_flags_per_silk_frame += (*ptr_LBBR_FLAGS) << shift_silk;
|
||||
shift_silk++;
|
||||
ptr_LBBR_FLAGS++; ptr_VAD_FLAGS++;
|
||||
}
|
||||
|
||||
packet_info->vad_flags_per_silk_frame = vad_flags_per_silk_frame;
|
||||
packet_info->fec_flags_per_silk_frame = fec_flags_per_silk_frame;
|
||||
return TRUE;
|
||||
|
||||
return SWITCH_TRUE;
|
||||
}
|
||||
|
||||
if (packet_info->config != 1 && packet_info->config != 5 && packet_info->config != 9) {
|
||||
if (debug) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "opus_packet_parse: the current parser implementation does not support muliple SILK frames for VAD or FEC detection.\n");
|
||||
}
|
||||
return FALSE;
|
||||
|
||||
return SWITCH_FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Parse the VAD and LBRR flags in each Opus frame
|
||||
* */
|
||||
|
@ -342,16 +373,20 @@ bool_t switch_opus_packet_parse(const uint8_t *payload, int payload_length_bytes
|
|||
if (frame_data[f][0] & 0x80) {
|
||||
packet_info->vad++;
|
||||
}
|
||||
|
||||
if (frame_data[f][0] & 0x40) {
|
||||
packet_info->fec++;
|
||||
}
|
||||
|
||||
if (debug) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "opus_packet_parse: LP layer opus_frame[%d] VAD[%d] FEC[%d]\n", f+1, (frame_data[f][0]&0x80)>>7, (frame_data[f][0]&0x40)>>6);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "opus_packet_parse: LP layer opus_frame[%d] VAD[%d] FEC[%d]\n", f + 1, (frame_data[f][0] & 0x80) >> 7, (frame_data[f][0] & 0x40) >> 6);
|
||||
}
|
||||
}
|
||||
|
||||
packet_info->vad_ms = packet_info->vad * packet_info->ms_per_frame;
|
||||
packet_info->fec_ms = packet_info->fec * packet_info->ms_per_frame;
|
||||
return TRUE;
|
||||
|
||||
return SWITCH_TRUE;
|
||||
}
|
||||
|
||||
/* For Emacs:
|
||||
|
|
|
@ -38,21 +38,24 @@ typedef struct opus_packet_info {
|
|||
int16_t fec;
|
||||
int16_t fec_ms;
|
||||
bool_t stereo;
|
||||
int16_t frames; /* number of opus frames in the packet */
|
||||
/* number of opus frames in the packet */
|
||||
int16_t frames;
|
||||
int16_t config;
|
||||
int16_t channels;
|
||||
int16_t ms_per_frame;
|
||||
int32_t ptime_ts;
|
||||
bool_t valid;
|
||||
int16_t frames_silk; /* number of silk_frames in an opus frame */
|
||||
/* number of silk_frames in an opus frame */
|
||||
int16_t frames_silk;
|
||||
/* VAD flag of all 20 ms silk-frames of the packet; LSB the first frame, MSB: the last */
|
||||
int16_t vad_flags_per_silk_frame;
|
||||
/* LBRR (FEC) flag of all 20 ms silk-frames of the packet; LSB the first frame, MSB: the last */
|
||||
int16_t fec_flags_per_silk_frame;
|
||||
} opus_packet_info_t;
|
||||
|
||||
bool_t switch_opus_packet_parse(const uint8_t *payload, int payload_length_bytes, opus_packet_info_t *packet_info, bool_t debug);
|
||||
#endif
|
||||
switch_bool_t switch_opus_packet_parse(const uint8_t *payload, int payload_length_bytes, opus_packet_info_t *packet_info, switch_bool_t debug);
|
||||
|
||||
#endif /* SWITCH_OPUS_PARSE_H */
|
||||
|
||||
/* For Emacs:
|
||||
* Local Variables:
|
||||
|
|
|
@ -411,7 +411,7 @@ switch_status_t mariadb_finish_results_real(const char* file, const char* func,
|
|||
if ((status = mysql_next_result(&handle->con))) {
|
||||
if (status > 0) {
|
||||
err_str = mariadb_handle_get_error(handle);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "An error occurred trying to get next for query (%s): %s\n", handle->sql, err_str);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "An error occurred trying to get next for query (%s): %s\n", handle->sql, switch_str_nil(err_str));
|
||||
switch_safe_free(err_str);
|
||||
|
||||
break;
|
||||
|
@ -627,13 +627,27 @@ switch_status_t mariadb_send_query(mariadb_handle_t *handle, const char* sql)
|
|||
{
|
||||
char *err_str;
|
||||
int ret;
|
||||
unsigned retries = 60; /* 60 tries, will take 30 to 60 seconds at worst */
|
||||
|
||||
switch_safe_free(handle->sql);
|
||||
handle->sql = strdup(sql);
|
||||
again:
|
||||
handle->stored_results = 0;
|
||||
ret = mysql_real_query(&handle->con, sql, (unsigned long)strlen(sql));
|
||||
if (ret) {
|
||||
err_str = mariadb_handle_get_error(handle);
|
||||
if (strstr(err_str, "Deadlock found when trying to get lock; try restarting transaction")) {
|
||||
if (--retries > 0) {
|
||||
switch_safe_free(err_str);
|
||||
/* We are waiting for 500 ms and random time is not more than 500 ms.
|
||||
This is necessary so that the delay on the primary and secondary servers does not coincide and deadlock does not occur again. */
|
||||
switch_yield(500 + (rand() & 511));
|
||||
goto again;
|
||||
}
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "DeadLock. The retries are over.\n");
|
||||
}
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Failed to send query (%s) to database: %s\n", sql, err_str);
|
||||
switch_safe_free(err_str);
|
||||
mariadb_finish_results(handle);
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#if OPENSSL_VERSION_NUMBER < 0x0090800 || !defined(SHA256_DIGEST_LENGTH)
|
||||
#error Your OpenSSL is too old, need 0.9.8 or newer with SHA256
|
||||
#endif
|
||||
#if OPENSSL_VERSION_NUMBER < 0x30000000L
|
||||
#if OPENSSL_VERSION_NUMBER < 0x10100000L
|
||||
#define HMAC_setup(ctx, key, len) HMAC_CTX_init(&ctx); HMAC_Init_ex(&ctx, key, len, EVP_sha256(), 0)
|
||||
#define HMAC_crunch(ctx, buf, len) HMAC_Update(&ctx, buf, len)
|
||||
|
@ -51,6 +52,7 @@
|
|||
#define HMAC_crunch(ctx, buf, len)HMAC_Update(ctx, buf, len)
|
||||
#define HMAC_finish(ctx, dig, dlen) HMAC_Final(ctx, dig, &dlen); HMAC_CTX_free(ctx)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define FP10
|
||||
#define RTMP_SIG_SIZE 1536
|
||||
|
@ -155,9 +157,13 @@ static unsigned int GetDigestOffset1(uint8_t *handshake, unsigned int len)
|
|||
static getoff *digoff[] = {GetDigestOffset1, GetDigestOffset2};
|
||||
// static getoff *dhoff[] = {GetDHOffset1, GetDHOffset2};
|
||||
|
||||
static void HMACsha256(const uint8_t *message, size_t messageLen, const uint8_t *key, size_t keylen, uint8_t *digest)
|
||||
static void HMACsha256(const uint8_t *message, size_t messageLen, const uint8_t *key, int keylen, uint8_t *digest)
|
||||
{
|
||||
unsigned int digestLen;
|
||||
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
|
||||
HMAC(EVP_sha256(), key, keylen, (uint8_t *)message, messageLen, digest, &digestLen);
|
||||
#else
|
||||
#if OPENSSL_VERSION_NUMBER < 0x10100000L
|
||||
HMAC_CTX ctx;
|
||||
#else
|
||||
|
@ -167,11 +173,12 @@ static void HMACsha256(const uint8_t *message, size_t messageLen, const uint8_t
|
|||
HMAC_setup(ctx, key, (int)keylen);
|
||||
HMAC_crunch(ctx, message, messageLen);
|
||||
HMAC_finish(ctx, digest, digestLen);
|
||||
#endif
|
||||
|
||||
assert(digestLen == 32);
|
||||
}
|
||||
|
||||
static void CalculateDigest(unsigned int digestPos, uint8_t *handshakeMessage, const uint8_t *key, size_t keyLen, uint8_t *digest)
|
||||
static void CalculateDigest(unsigned int digestPos, uint8_t *handshakeMessage, const uint8_t *key, int keyLen, uint8_t *digest)
|
||||
{
|
||||
const int messageLen = RTMP_SIG_SIZE - SHA256_DIGEST_LENGTH;
|
||||
uint8_t message[RTMP_SIG_SIZE - SHA256_DIGEST_LENGTH];
|
||||
|
@ -184,7 +191,7 @@ static void CalculateDigest(unsigned int digestPos, uint8_t *handshakeMessage, c
|
|||
HMACsha256(message, messageLen, key, keyLen, digest);
|
||||
}
|
||||
|
||||
static int VerifyDigest(unsigned int digestPos, uint8_t *handshakeMessage, const uint8_t *key, size_t keyLen)
|
||||
static int VerifyDigest(unsigned int digestPos, uint8_t *handshakeMessage, const uint8_t *key, int keyLen)
|
||||
{
|
||||
uint8_t calcDigest[SHA256_DIGEST_LENGTH];
|
||||
|
||||
|
|
|
@ -2136,7 +2136,7 @@ void launch_skinny_profile_thread(skinny_profile_t *profile) {
|
|||
/*****************************************************************************/
|
||||
/* MODULE FUNCTIONS */
|
||||
/*****************************************************************************/
|
||||
switch_endpoint_interface_t *skinny_get_endpoint_interface()
|
||||
switch_endpoint_interface_t *skinny_get_endpoint_interface(void)
|
||||
{
|
||||
return skinny_endpoint_interface;
|
||||
}
|
||||
|
|
|
@ -355,7 +355,7 @@ switch_status_t channel_kill_channel(switch_core_session_t *session, int sig);
|
|||
/*****************************************************************************/
|
||||
/* MODULE FUNCTIONS */
|
||||
/*****************************************************************************/
|
||||
switch_endpoint_interface_t *skinny_get_endpoint_interface();
|
||||
switch_endpoint_interface_t *skinny_get_endpoint_interface(void);
|
||||
|
||||
/*****************************************************************************/
|
||||
/* TEXT FUNCTIONS */
|
||||
|
|
|
@ -697,7 +697,7 @@ switch_status_t skinny_api_register(switch_loadable_module_interface_t **module_
|
|||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
switch_status_t skinny_api_unregister()
|
||||
switch_status_t skinny_api_unregister(void)
|
||||
{
|
||||
switch_console_set_complete("del skinny");
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
#define _SKINNY_API_H
|
||||
|
||||
switch_status_t skinny_api_register(switch_loadable_module_interface_t **module_interface);
|
||||
switch_status_t skinny_api_unregister();
|
||||
switch_status_t skinny_api_unregister(void);
|
||||
|
||||
#endif /* _SKINNY_API_H */
|
||||
|
||||
|
|
|
@ -92,14 +92,14 @@ char* skinny_codec2string(skinny_codecs skinnycodec);
|
|||
/*****************************************************************************/
|
||||
|
||||
#define skinny_create_message(message,msgtype,field) \
|
||||
message = calloc(1, 12 + sizeof(message->data.field)); \
|
||||
message = calloc(1, sizeof(skinny_message_t)); \
|
||||
message->type = msgtype; \
|
||||
message->length = 4 + sizeof(message->data.field)
|
||||
|
||||
#define skinny_create_empty_message(message,msgtype) \
|
||||
message = calloc(1, 12); \
|
||||
message->type = msgtype; \
|
||||
message->length = 4
|
||||
message = calloc(1, sizeof(skinny_empty_message_t)); \
|
||||
((skinny_empty_message_t *)message)->type = msgtype; \
|
||||
((skinny_empty_message_t *)message)->length = 4
|
||||
|
||||
|
||||
/* KeepAliveMessage */
|
||||
|
@ -937,6 +937,12 @@ union skinny_data {
|
|||
#pragma pack(push, r1, 1)
|
||||
#endif
|
||||
|
||||
struct PACKED skinny_empty_message {
|
||||
uint32_t length;
|
||||
uint32_t version;
|
||||
uint32_t type;
|
||||
};
|
||||
|
||||
/*
|
||||
* header is length+version
|
||||
* body is type+data
|
||||
|
@ -954,6 +960,7 @@ struct PACKED skinny_message {
|
|||
#endif
|
||||
|
||||
typedef struct skinny_message skinny_message_t;
|
||||
typedef struct skinny_empty_message skinny_empty_message_t;
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ switch_endpoint_interface_t *sofia_endpoint_interface;
|
|||
|
||||
#define STRLEN 15
|
||||
|
||||
void mod_sofia_shutdown_cleanup();
|
||||
void mod_sofia_shutdown_cleanup(void);
|
||||
static switch_status_t sofia_on_init(switch_core_session_t *session);
|
||||
|
||||
static switch_status_t sofia_on_exchange_media(switch_core_session_t *session);
|
||||
|
@ -3255,8 +3255,6 @@ static switch_status_t cmd_xml_status(char **argv, int argc, switch_stream_handl
|
|||
switch_hash_index_t *hi;
|
||||
void *val;
|
||||
const void *vvar;
|
||||
int c = 0;
|
||||
int ac = 0;
|
||||
const char *header = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>";
|
||||
|
||||
if (argc > 0) {
|
||||
|
@ -3466,7 +3464,6 @@ static switch_status_t cmd_xml_status(char **argv, int argc, switch_stream_handl
|
|||
if (sofia_test_pflag(profile, PFLAG_RUNNING)) {
|
||||
|
||||
if (strcmp(vvar, profile->name)) {
|
||||
ac++;
|
||||
stream->write_function(stream, "<alias>\n<name>%s</name>\n<type>%s</type>\n<data>%s</data>\n<state>%s</state>\n</alias>\n", vvar, "alias",
|
||||
profile->name, "ALIASED");
|
||||
} else {
|
||||
|
@ -3492,8 +3489,6 @@ static switch_status_t cmd_xml_status(char **argv, int argc, switch_stream_handl
|
|||
profile->inuse);
|
||||
}
|
||||
|
||||
c++;
|
||||
|
||||
for (gp = profile->gateways; gp; gp = gp->next) {
|
||||
switch_assert(gp->state < REG_STATE_LAST);
|
||||
stream->write_function(stream, "<gateway>\n<name>%s</name>\n<type>%s</type>\n<data>%s</data>\n<state>%s</state>\n</gateway>\n",
|
||||
|
@ -6833,7 +6828,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sofia_load)
|
|||
return status;
|
||||
}
|
||||
|
||||
void mod_sofia_shutdown_cleanup() {
|
||||
void mod_sofia_shutdown_cleanup(void) {
|
||||
int sanity = 0;
|
||||
int i;
|
||||
switch_status_t st;
|
||||
|
|
|
@ -82,9 +82,6 @@
|
|||
* <dt>-6</dt>
|
||||
* <dd>Query IP6 addresses (AAAA records).
|
||||
* </dd>
|
||||
* <dt>-v</dt>
|
||||
* <dd>Be verbatim.
|
||||
* </dd>
|
||||
* <dt></dt>
|
||||
* <dd>
|
||||
* </dd>
|
||||
|
@ -201,7 +198,7 @@ switch_bool_t verify_ip(sres_record_t **answers, const char *ip, switch_bool_t i
|
|||
switch_status_t sip_dig_function(_In_opt_z_ const char *cmd, _In_opt_ switch_core_session_t *session, _In_ switch_stream_handle_t *stream)
|
||||
|
||||
{
|
||||
int o_sctp = 1, o_tls_sctp = 1, o_verbatim = 1;
|
||||
int o_sctp = 1, o_tls_sctp = 1;
|
||||
int family = 0, multiple = 0;
|
||||
char const *string;
|
||||
url_t *uri = NULL;
|
||||
|
@ -247,9 +244,7 @@ switch_status_t sip_dig_function(_In_opt_z_ const char *cmd, _In_opt_ switch_cor
|
|||
}
|
||||
|
||||
while (argv[i] && argv[i][0] == '-') {
|
||||
if (strcmp(argv[i], "-v") == 0) {
|
||||
o_verbatim++;
|
||||
} else if (strcmp(argv[i], "-6") == 0) {
|
||||
if (strcmp(argv[i], "-6") == 0) {
|
||||
dig->ip6 = ++family;
|
||||
} else if (strcmp(argv[i], "-4") == 0) {
|
||||
dig->ip4 = ++family;
|
||||
|
|
|
@ -1621,7 +1621,6 @@ void *SWITCH_THREAD_FUNC sofia_presence_event_thread_run(switch_thread_t *thread
|
|||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Event Thread Started\n");
|
||||
|
||||
while (mod_sofia_globals.running == 1) {
|
||||
int count = 0;
|
||||
|
||||
if (switch_queue_pop(mod_sofia_globals.presence_queue, &pop) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_event_t *event = (switch_event_t *) pop;
|
||||
|
@ -1656,7 +1655,6 @@ void *SWITCH_THREAD_FUNC sofia_presence_event_thread_run(switch_thread_t *thread
|
|||
}
|
||||
|
||||
switch_event_destroy(&event);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ static const char *test_wait_for_chan_var(switch_channel_t *channel, const char
|
|||
return var;
|
||||
}
|
||||
|
||||
static switch_bool_t has_ipv6()
|
||||
static switch_bool_t has_ipv6(void)
|
||||
{
|
||||
switch_stream_handle_t stream = { 0 };
|
||||
SWITCH_STANDARD_STREAM(stream);
|
||||
|
@ -110,7 +110,7 @@ static switch_bool_t has_ipv6()
|
|||
return SWITCH_TRUE;
|
||||
}
|
||||
|
||||
static void register_gw()
|
||||
static void register_gw(void)
|
||||
{
|
||||
switch_stream_handle_t stream = { 0 };
|
||||
SWITCH_STANDARD_STREAM(stream);
|
||||
|
@ -118,7 +118,7 @@ static void register_gw()
|
|||
switch_safe_free(stream.data);
|
||||
}
|
||||
|
||||
static void unregister_gw()
|
||||
static void unregister_gw(void)
|
||||
{
|
||||
switch_stream_handle_t stream = { 0 };
|
||||
SWITCH_STANDARD_STREAM(stream);
|
||||
|
|
|
@ -823,7 +823,6 @@ static void set_perm(const char *str, switch_event_t **event, switch_bool_t add)
|
|||
{
|
||||
char delim = ',';
|
||||
char *cur, *next;
|
||||
int count = 0;
|
||||
char *edup;
|
||||
|
||||
if (!zstr(str)) {
|
||||
|
@ -844,7 +843,7 @@ static void set_perm(const char *str, switch_event_t **event, switch_bool_t add)
|
|||
delim = ' ';
|
||||
}
|
||||
|
||||
for (cur = edup; cur; count++) {
|
||||
for (cur = edup; cur;) {
|
||||
if ((next = strchr(cur, delim))) {
|
||||
*next++ = '\0';
|
||||
}
|
||||
|
@ -3866,6 +3865,15 @@ static switch_bool_t verto__info_func(const char *method, cJSON *params, jsock_t
|
|||
cJSON *i, *indialog = cJSON_GetObjectItem(msg, "inDialog");
|
||||
const char *body = cJSON_GetObjectCstr(msg, "body");
|
||||
switch_bool_t is_dialog = indialog && (indialog->type == cJSON_True || (indialog->type == cJSON_String && switch_true(indialog->valuestring)));
|
||||
const char *context = NULL;
|
||||
|
||||
switch_mutex_lock(jsock->flag_mutex);
|
||||
|
||||
if (!(context = switch_event_get_header(jsock->vars, "user_context"))) {
|
||||
context = switch_either(jsock->context, jsock->profile->context);
|
||||
}
|
||||
|
||||
switch_mutex_unlock(jsock->flag_mutex);
|
||||
|
||||
if (!zstr(to)) {
|
||||
if (strchr(to, '+')) {
|
||||
|
@ -3902,6 +3910,8 @@ static switch_bool_t verto__info_func(const char *method, cJSON *params, jsock_t
|
|||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "call_id", call_id);
|
||||
}
|
||||
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "context", context);
|
||||
|
||||
switch_event_add_body(event, "%s", body);
|
||||
|
||||
if (strcasecmp(proto, VERTO_CHAT_PROTO)) {
|
||||
|
@ -5579,8 +5589,6 @@ static switch_status_t cmd_xml_status(char **argv, int argc, switch_stream_handl
|
|||
{
|
||||
verto_profile_t *profile = NULL;
|
||||
jsock_t *jsock;
|
||||
int cp = 0;
|
||||
int cc = 0;
|
||||
const char *header = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>";
|
||||
int i;
|
||||
|
||||
|
@ -5594,14 +5602,12 @@ static switch_status_t cmd_xml_status(char **argv, int argc, switch_stream_handl
|
|||
stream->write_function(stream, "<profile>\n<name>%s</name>\n<type>%s</type>\n<data>%s</data>\n<state>%s</state>\n</profile>\n", profile->name, "profile", tmpurl, (profile->running) ? "RUNNING" : "DOWN");
|
||||
switch_safe_free(tmpurl);
|
||||
}
|
||||
cp++;
|
||||
|
||||
switch_mutex_lock(profile->mutex);
|
||||
for(jsock = profile->jsock_head; jsock; jsock = jsock->next) {
|
||||
char *tmpname = switch_mprintf("%s@%s", jsock->id, jsock->domain);
|
||||
stream->write_function(stream, "<client>\n<profile>%s</profile>\n<name>%s</name>\n<type>%s</type>\n<data>%s</data>\n<state>%s (%s)</state>\n</client>\n", profile->name, tmpname, "client", jsock->name,
|
||||
(!zstr(jsock->uid)) ? "CONN_REG" : "CONN_NO_REG", (jsock->ptype & PTYPE_CLIENT_SSL) ? "WSS": "WS");
|
||||
cc++;
|
||||
switch_safe_free(tmpname);
|
||||
}
|
||||
switch_mutex_unlock(profile->mutex);
|
||||
|
@ -5611,7 +5617,7 @@ static switch_status_t cmd_xml_status(char **argv, int argc, switch_stream_handl
|
|||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static cJSON *json_status()
|
||||
static cJSON *json_status(void)
|
||||
{
|
||||
cJSON *obj, *profiles, *jprofile, *users, *user;
|
||||
verto_profile_t *profile = NULL;
|
||||
|
@ -6740,14 +6746,14 @@ static void mod_verto_ks_logger(const char *file, const char *func, int line, in
|
|||
va_end(ap);
|
||||
}
|
||||
|
||||
static void verto_event_free_subclass()
|
||||
static void verto_event_free_subclass(void)
|
||||
{
|
||||
switch_event_free_subclass(MY_EVENT_LOGIN);
|
||||
switch_event_free_subclass(MY_EVENT_CLIENT_DISCONNECT);
|
||||
switch_event_free_subclass(MY_EVENT_CLIENT_CONNECT);
|
||||
}
|
||||
|
||||
static void verto_destroy_globals_hash_tables()
|
||||
static void verto_destroy_globals_hash_tables(void)
|
||||
{
|
||||
if (verto_globals.method_hash) {
|
||||
switch_core_hash_destroy(&verto_globals.method_hash);
|
||||
|
|
|
@ -272,7 +272,7 @@ static switch_status_t my_on_reporting(switch_core_session_t *session)
|
|||
}
|
||||
|
||||
|
||||
static void do_rotate_all()
|
||||
static void do_rotate_all(void)
|
||||
{
|
||||
switch_hash_index_t *hi;
|
||||
void *val;
|
||||
|
@ -294,7 +294,7 @@ static void do_rotate_all()
|
|||
}
|
||||
|
||||
|
||||
static void do_teardown()
|
||||
static void do_teardown(void)
|
||||
{
|
||||
switch_hash_index_t *hi;
|
||||
void *val;
|
||||
|
|
|
@ -866,7 +866,7 @@ SWITCH_STANDARD_API(event_sink_function)
|
|||
char *loglevel = switch_event_get_header(stream->param_event, "loglevel");
|
||||
switch_memory_pool_t *pool;
|
||||
char *next, *cur;
|
||||
uint32_t count = 0, key_count = 0;
|
||||
uint32_t key_count = 0;
|
||||
uint8_t custom = 0;
|
||||
char *edup;
|
||||
|
||||
|
@ -925,7 +925,7 @@ SWITCH_STANDARD_API(event_sink_function)
|
|||
delim = ' ';
|
||||
}
|
||||
|
||||
for (cur = edup; cur; count++) {
|
||||
for (cur = edup; cur;) {
|
||||
switch_event_types_t type;
|
||||
|
||||
if ((next = strchr(cur, delim))) {
|
||||
|
@ -1846,7 +1846,7 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even
|
|||
if (allowed_events) {
|
||||
char delim = ',';
|
||||
char *cur, *next;
|
||||
int count = 0, custom = 0, key_count = 0;
|
||||
int custom = 0;
|
||||
|
||||
switch_set_flag(listener, LFLAG_AUTH_EVENTS);
|
||||
|
||||
|
@ -1862,7 +1862,7 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even
|
|||
delim = ' ';
|
||||
}
|
||||
|
||||
for (cur = edup; cur; count++) {
|
||||
for (cur = edup; cur;) {
|
||||
switch_event_types_t type;
|
||||
|
||||
if ((next = strchr(cur, delim))) {
|
||||
|
@ -1872,7 +1872,6 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even
|
|||
if (custom) {
|
||||
switch_core_hash_insert(listener->allowed_event_hash, cur, MARKER);
|
||||
} else if (switch_name_event(cur, &type) == SWITCH_STATUS_SUCCESS) {
|
||||
key_count++;
|
||||
if (type == SWITCH_EVENT_ALL) {
|
||||
uint32_t x = 0;
|
||||
switch_set_flag(listener, LFLAG_ALL_EVENTS_AUTHED);
|
||||
|
@ -1904,7 +1903,6 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even
|
|||
if (allowed_api) {
|
||||
char delim = ',';
|
||||
char *cur, *next;
|
||||
int count = 0;
|
||||
|
||||
switch_snprintf(api_reply, sizeof(api_reply), "Allowed-API: %s\n", allowed_api);
|
||||
|
||||
|
@ -1916,7 +1914,7 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even
|
|||
delim = ' ';
|
||||
}
|
||||
|
||||
for (cur = edup; cur; count++) {
|
||||
for (cur = edup; cur;) {
|
||||
if ((next = strchr(cur, delim))) {
|
||||
*next++ = '\0';
|
||||
}
|
||||
|
@ -2540,14 +2538,14 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even
|
|||
|
||||
} else if (!strncasecmp(cmd, "nixevent", 8)) {
|
||||
char *next, *cur;
|
||||
uint32_t count = 0, key_count = 0;
|
||||
uint32_t key_count = 0;
|
||||
uint8_t custom = 0;
|
||||
|
||||
strip_cr(cmd);
|
||||
cur = cmd + 8;
|
||||
|
||||
if ((cur = strchr(cur, ' '))) {
|
||||
for (cur++; cur; count++) {
|
||||
for (cur++; cur;) {
|
||||
switch_event_types_t type;
|
||||
|
||||
if ((next = strchr(cur, ' '))) {
|
||||
|
|
|
@ -366,7 +366,9 @@ SWITCH_STANDARD_API(kz_http_put)
|
|||
goto done;
|
||||
}
|
||||
switch_curl_easy_setopt(curl_handle, CURLOPT_UPLOAD, 1);
|
||||
#if !defined(LIBCURL_VERSION_NUM) || (LIBCURL_VERSION_NUM < 0x070c01)
|
||||
switch_curl_easy_setopt(curl_handle, CURLOPT_PUT, 1);
|
||||
#endif
|
||||
switch_curl_easy_setopt(curl_handle, CURLOPT_NOSIGNAL, 1);
|
||||
switch_curl_easy_setopt(curl_handle, CURLOPT_HTTPHEADER, headers);
|
||||
switch_curl_easy_setopt(curl_handle, CURLOPT_URL, url);
|
||||
|
|
|
@ -7,8 +7,8 @@ if HAVE_MP3LAME
|
|||
|
||||
mod_LTLIBRARIES = mod_shout.la
|
||||
mod_shout_la_SOURCES = mod_shout.c
|
||||
mod_shout_la_CFLAGS = $(AM_CFLAGS)
|
||||
mod_shout_la_CPPFLAGS = $(CURL_CFLAGS) $(AM_CPPFLAGS) $(SHOUT_CFLAGS) $(MP3LAME_CFLAGS) $(MPG123_CFLAGS)
|
||||
mod_shout_la_CFLAGS = $(AM_CFLAGS) -DSHOUT_VERSION=$(SHOUT_VERSION) -DSHOUT_MAJOR_VERSION=$(SHOUT_MAJOR_VERSION) -DSHOUT_MINOR_VERSION=$(SHOUT_MINOR_VERSION) -DSHOUT_PATCH_VERSION=$(SHOUT_PATCH_VERSION)
|
||||
mod_shout_la_CPPFLAGS = $(CURL_CFLAGS) $(AM_CPPFLAGS) $(SHOUT_CFLAGS) $(MP3LAME_CFLAGS) $(MPG123_CFLAGS) -DSHOUT_VERSION=$(SHOUT_VERSION) -DSHOUT_MAJOR_VERSION=$(SHOUT_MAJOR_VERSION) -DSHOUT_MINOR_VERSION=$(SHOUT_MINOR_VERSION) -DSHOUT_PATCH_VERSION=$(SHOUT_PATCH_VERSION)
|
||||
mod_shout_la_LIBADD = $(switch_builddir)/libfreeswitch.la
|
||||
mod_shout_la_LDFLAGS = $(CURL_LIBS) -avoid-version -module -no-undefined -shared $(SHOUT_LIBS) $(MP3LAME_LIBS) $(MPG123_LIBS)
|
||||
|
||||
|
|
|
@ -51,6 +51,11 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_shout_load);
|
|||
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_shout_shutdown);
|
||||
SWITCH_MODULE_DEFINITION(mod_shout, mod_shout_load, mod_shout_shutdown, NULL);
|
||||
|
||||
#define CHECK_SHOUT_MIN_VERSION(major, minor, patch) \
|
||||
(SHOUT_MAJOR_VERSION > major || \
|
||||
(SHOUT_MAJOR_VERSION == major && SHOUT_MINOR_VERSION > minor) || \
|
||||
(SHOUT_MAJOR_VERSION == major && SHOUT_MINOR_VERSION == minor && SHOUT_PATCH_VERSION >= patch))
|
||||
|
||||
static char *supported_formats[SWITCH_MAX_CODECS] = { 0 };
|
||||
|
||||
static struct {
|
||||
|
@ -463,7 +468,11 @@ static size_t stream_callback(void *ptr, size_t size, size_t nmemb, void *data)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#if defined(LIBCURL_VERSION_NUM) && (LIBCURL_VERSION_NUM >= 0x072000)
|
||||
static int progress_callback(void *clientp, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow)
|
||||
#else
|
||||
static int progress_callback(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow)
|
||||
#endif
|
||||
{
|
||||
shout_context_t *context = (shout_context_t *) clientp;
|
||||
return context->err;
|
||||
|
@ -496,8 +505,13 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void
|
|||
switch_mutex_unlock(context->audio_mutex);
|
||||
curl_handle = switch_curl_easy_init();
|
||||
switch_curl_easy_setopt(curl_handle, CURLOPT_URL, context->stream_url);
|
||||
#if defined(LIBCURL_VERSION_NUM) && (LIBCURL_VERSION_NUM >= 0x072000)
|
||||
curl_easy_setopt(curl_handle, CURLOPT_XFERINFOFUNCTION, progress_callback);
|
||||
curl_easy_setopt(curl_handle, CURLOPT_XFERINFODATA, (void *)context);
|
||||
#else
|
||||
curl_easy_setopt(curl_handle, CURLOPT_PROGRESSFUNCTION, progress_callback);
|
||||
curl_easy_setopt(curl_handle, CURLOPT_PROGRESSDATA, (void *)context);
|
||||
#endif
|
||||
switch_curl_easy_setopt(curl_handle, CURLOPT_FOLLOWLOCATION, 1);
|
||||
switch_curl_easy_setopt(curl_handle, CURLOPT_MAXREDIRS, 10);
|
||||
switch_curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, stream_callback);
|
||||
|
@ -862,12 +876,20 @@ static switch_status_t shout_file_open(switch_file_handle_t *handle, const char
|
|||
goto error;
|
||||
}
|
||||
|
||||
#if (CHECK_SHOUT_MIN_VERSION(2, 4, 6))
|
||||
if (shout_set_meta(context->shout, SHOUT_META_URL, "http://www.freeswitch.org") != SHOUTERR_SUCCESS) {
|
||||
#else
|
||||
if (shout_set_url(context->shout, "http://www.freeswitch.org") != SHOUTERR_SUCCESS) {
|
||||
#endif
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting name: %s\n", shout_get_error(context->shout));
|
||||
goto error;
|
||||
}
|
||||
|
||||
#if (CHECK_SHOUT_MIN_VERSION(2, 4, 6))
|
||||
if (shout_set_meta(context->shout, SHOUT_META_DESCRIPTION, "FreeSWITCH mod_shout Broadcasting Module") != SHOUTERR_SUCCESS) {
|
||||
#else
|
||||
if (shout_set_description(context->shout, "FreeSWITCH mod_shout Broadcasting Module") != SHOUTERR_SUCCESS) {
|
||||
#endif
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting description: %s\n", shout_get_error(context->shout));
|
||||
goto error;
|
||||
}
|
||||
|
@ -877,7 +899,11 @@ static switch_status_t shout_file_open(switch_file_handle_t *handle, const char
|
|||
goto error;
|
||||
}
|
||||
|
||||
#if (CHECK_SHOUT_MIN_VERSION(2, 4, 6))
|
||||
if (shout_set_content_format(context->shout, SHOUT_FORMAT_MP3, SHOUT_USAGE_AUDIO, NULL) != SHOUTERR_SUCCESS) {
|
||||
#else
|
||||
if (shout_set_format(context->shout, SHOUT_FORMAT_MP3) != SHOUTERR_SUCCESS) {
|
||||
#endif
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting format: %s\n", shout_get_error(context->shout));
|
||||
goto error;
|
||||
}
|
||||
|
@ -1127,21 +1153,33 @@ static switch_status_t shout_file_set_string(switch_file_handle_t *handle, switc
|
|||
|
||||
switch (col) {
|
||||
case SWITCH_AUDIO_COL_STR_TITLE:
|
||||
#if (CHECK_SHOUT_MIN_VERSION(2, 4, 6))
|
||||
if (shout_set_meta(context->shout, SHOUT_META_NAME, string) == SHOUTERR_SUCCESS) {
|
||||
#else
|
||||
if (shout_set_name(context->shout, string) == SHOUTERR_SUCCESS) {
|
||||
#endif
|
||||
status = SWITCH_STATUS_SUCCESS;
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting name: %s\n", shout_get_error(context->shout));
|
||||
}
|
||||
break;
|
||||
case SWITCH_AUDIO_COL_STR_COMMENT:
|
||||
#if (CHECK_SHOUT_MIN_VERSION(2, 4, 6))
|
||||
if (shout_set_meta(context->shout, SHOUT_META_URL, string) == SHOUTERR_SUCCESS) {
|
||||
#else
|
||||
if (shout_set_url(context->shout, string) == SHOUTERR_SUCCESS) {
|
||||
#endif
|
||||
status = SWITCH_STATUS_SUCCESS;
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting name: %s\n", shout_get_error(context->shout));
|
||||
}
|
||||
break;
|
||||
case SWITCH_AUDIO_COL_STR_ARTIST:
|
||||
#if (CHECK_SHOUT_MIN_VERSION(2, 4, 6))
|
||||
if (shout_set_meta(context->shout, SHOUT_META_DESCRIPTION, string) == SHOUTERR_SUCCESS) {
|
||||
#else
|
||||
if (shout_set_description(context->shout, string) == SHOUTERR_SUCCESS) {
|
||||
#endif
|
||||
status = SWITCH_STATUS_SUCCESS;
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting name: %s\n", shout_get_error(context->shout));
|
||||
|
|
|
@ -21077,6 +21077,22 @@ SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_frame_free___(void *
|
|||
}
|
||||
|
||||
|
||||
SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_is_uint_in_range___(char * jarg1, unsigned int jarg2, unsigned int jarg3) {
|
||||
int jresult ;
|
||||
char *arg1 = (char *) 0 ;
|
||||
unsigned int arg2 ;
|
||||
unsigned int arg3 ;
|
||||
switch_bool_t result;
|
||||
|
||||
arg1 = (char *)jarg1;
|
||||
arg2 = (unsigned int)jarg2;
|
||||
arg3 = (unsigned int)jarg3;
|
||||
result = (switch_bool_t)switch_is_uint_in_range((char const *)arg1,arg2,arg3);
|
||||
jresult = (int)result;
|
||||
return jresult;
|
||||
}
|
||||
|
||||
|
||||
SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_is_number___(char * jarg1) {
|
||||
int jresult ;
|
||||
char *arg1 = (char *) 0 ;
|
||||
|
@ -33245,6 +33261,50 @@ SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_codec_fmtp_microsecon
|
|||
}
|
||||
|
||||
|
||||
SWIGEXPORT void SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_codec_fmtp_max_ptime_set___(void * jarg1, int jarg2) {
|
||||
switch_codec_fmtp *arg1 = (switch_codec_fmtp *) 0 ;
|
||||
int arg2 ;
|
||||
|
||||
arg1 = (switch_codec_fmtp *)jarg1;
|
||||
arg2 = (int)jarg2;
|
||||
if (arg1) (arg1)->max_ptime = arg2;
|
||||
}
|
||||
|
||||
|
||||
SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_codec_fmtp_max_ptime_get___(void * jarg1) {
|
||||
int jresult ;
|
||||
switch_codec_fmtp *arg1 = (switch_codec_fmtp *) 0 ;
|
||||
int result;
|
||||
|
||||
arg1 = (switch_codec_fmtp *)jarg1;
|
||||
result = (int) ((arg1)->max_ptime);
|
||||
jresult = result;
|
||||
return jresult;
|
||||
}
|
||||
|
||||
|
||||
SWIGEXPORT void SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_codec_fmtp_min_ptime_set___(void * jarg1, int jarg2) {
|
||||
switch_codec_fmtp *arg1 = (switch_codec_fmtp *) 0 ;
|
||||
int arg2 ;
|
||||
|
||||
arg1 = (switch_codec_fmtp *)jarg1;
|
||||
arg2 = (int)jarg2;
|
||||
if (arg1) (arg1)->min_ptime = arg2;
|
||||
}
|
||||
|
||||
|
||||
SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_codec_fmtp_min_ptime_get___(void * jarg1) {
|
||||
int jresult ;
|
||||
switch_codec_fmtp *arg1 = (switch_codec_fmtp *) 0 ;
|
||||
int result;
|
||||
|
||||
arg1 = (switch_codec_fmtp *)jarg1;
|
||||
result = (int) ((arg1)->min_ptime);
|
||||
jresult = result;
|
||||
return jresult;
|
||||
}
|
||||
|
||||
|
||||
SWIGEXPORT void SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_codec_fmtp_stereo_set___(void * jarg1, int jarg2) {
|
||||
switch_codec_fmtp *arg1 = (switch_codec_fmtp *) 0 ;
|
||||
int arg2 ;
|
||||
|
@ -33267,6 +33327,28 @@ SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_codec_fmtp_stereo_get
|
|||
}
|
||||
|
||||
|
||||
SWIGEXPORT void SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_codec_fmtp_sprop_stereo_set___(void * jarg1, int jarg2) {
|
||||
switch_codec_fmtp *arg1 = (switch_codec_fmtp *) 0 ;
|
||||
int arg2 ;
|
||||
|
||||
arg1 = (switch_codec_fmtp *)jarg1;
|
||||
arg2 = (int)jarg2;
|
||||
if (arg1) (arg1)->sprop_stereo = arg2;
|
||||
}
|
||||
|
||||
|
||||
SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_codec_fmtp_sprop_stereo_get___(void * jarg1) {
|
||||
int jresult ;
|
||||
switch_codec_fmtp *arg1 = (switch_codec_fmtp *) 0 ;
|
||||
int result;
|
||||
|
||||
arg1 = (switch_codec_fmtp *)jarg1;
|
||||
result = (int) ((arg1)->sprop_stereo);
|
||||
jresult = result;
|
||||
return jresult;
|
||||
}
|
||||
|
||||
|
||||
SWIGEXPORT void SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_codec_fmtp_private_info_set___(void * jarg1, void * jarg2) {
|
||||
switch_codec_fmtp *arg1 = (switch_codec_fmtp *) 0 ;
|
||||
void *arg2 = (void *) 0 ;
|
||||
|
@ -36802,6 +36884,44 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_channel_get_variab
|
|||
}
|
||||
|
||||
|
||||
SWIGEXPORT char * SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_channel_get_variable_strdup___(void * jarg1, char * jarg2) {
|
||||
char * jresult ;
|
||||
switch_channel_t *arg1 = (switch_channel_t *) 0 ;
|
||||
char *arg2 = (char *) 0 ;
|
||||
char *result = 0 ;
|
||||
|
||||
arg1 = (switch_channel_t *)jarg1;
|
||||
arg2 = (char *)jarg2;
|
||||
result = (char *)switch_channel_get_variable_strdup(arg1,(char const *)arg2);
|
||||
jresult = SWIG_csharp_string_callback((const char *)result);
|
||||
return jresult;
|
||||
}
|
||||
|
||||
|
||||
SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_channel_get_variable_buf___(void * jarg1, char * jarg2, char * jarg3, void * jarg4) {
|
||||
int jresult ;
|
||||
switch_channel_t *arg1 = (switch_channel_t *) 0 ;
|
||||
char *arg2 = (char *) 0 ;
|
||||
char *arg3 = (char *) 0 ;
|
||||
switch_size_t arg4 ;
|
||||
switch_size_t *argp4 ;
|
||||
switch_status_t result;
|
||||
|
||||
arg1 = (switch_channel_t *)jarg1;
|
||||
arg2 = (char *)jarg2;
|
||||
arg3 = (char *)jarg3;
|
||||
argp4 = (switch_size_t *)jarg4;
|
||||
if (!argp4) {
|
||||
SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
|
||||
return 0;
|
||||
}
|
||||
arg4 = *argp4;
|
||||
result = (switch_status_t)switch_channel_get_variable_buf(arg1,(char const *)arg2,arg3,arg4);
|
||||
jresult = (int)result;
|
||||
return jresult;
|
||||
}
|
||||
|
||||
|
||||
SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_channel_get_variables___(void * jarg1, void * jarg2) {
|
||||
int jresult ;
|
||||
switch_channel_t *arg1 = (switch_channel_t *) 0 ;
|
||||
|
@ -45145,6 +45265,16 @@ SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_MAX_CAND_get___() {
|
|||
}
|
||||
|
||||
|
||||
SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_MAX_CAND_IDX_COUNT_get___() {
|
||||
int jresult ;
|
||||
int result;
|
||||
|
||||
result = (int)(2);
|
||||
jresult = result;
|
||||
return jresult;
|
||||
}
|
||||
|
||||
|
||||
SWIGEXPORT void SWIGSTDCALL CSharp_FreeSWITCHfNative_ice_t_cands_set___(void * jarg1, void * jarg2) {
|
||||
ice_s *arg1 = (ice_s *) 0 ;
|
||||
icand_t (*arg2)[2] ;
|
||||
|
|
|
@ -10932,6 +10932,11 @@ else
|
|||
return ret;
|
||||
}
|
||||
|
||||
public static switch_bool_t switch_is_uint_in_range(string str, uint from, uint to) {
|
||||
switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_is_uint_in_range(str, from, to);
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static switch_bool_t switch_is_number(string str) {
|
||||
switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_is_number(str);
|
||||
return ret;
|
||||
|
@ -11884,6 +11889,17 @@ else
|
|||
return ret;
|
||||
}
|
||||
|
||||
public static string switch_channel_get_variable_strdup(SWIGTYPE_p_switch_channel channel, string varname) {
|
||||
string ret = freeswitchPINVOKE.switch_channel_get_variable_strdup(SWIGTYPE_p_switch_channel.getCPtr(channel), varname);
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static switch_status_t switch_channel_get_variable_buf(SWIGTYPE_p_switch_channel channel, string varname, string buf, SWIGTYPE_p_switch_size_t buflen) {
|
||||
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_get_variable_buf(SWIGTYPE_p_switch_channel.getCPtr(channel), varname, buf, SWIGTYPE_p_switch_size_t.getCPtr(buflen));
|
||||
if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static switch_status_t switch_channel_get_variables(SWIGTYPE_p_switch_channel channel, SWIGTYPE_p_p_switch_event arg1) {
|
||||
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_get_variables(SWIGTYPE_p_switch_channel.getCPtr(channel), SWIGTYPE_p_p_switch_event.getCPtr(arg1));
|
||||
return ret;
|
||||
|
@ -15223,6 +15239,7 @@ else
|
|||
public static readonly string SWITCH_RTP_CRYPTO_KEY_80 = freeswitchPINVOKE.SWITCH_RTP_CRYPTO_KEY_80_get();
|
||||
public static readonly int SWITCH_RTP_BUNDLE_INTERNAL_PT = freeswitchPINVOKE.SWITCH_RTP_BUNDLE_INTERNAL_PT_get();
|
||||
public static readonly int MAX_CAND = freeswitchPINVOKE.MAX_CAND_get();
|
||||
public static readonly int MAX_CAND_IDX_COUNT = freeswitchPINVOKE.MAX_CAND_IDX_COUNT_get();
|
||||
public static readonly int SWITCH_XML_BUFSIZE = freeswitchPINVOKE.SWITCH_XML_BUFSIZE_get();
|
||||
}
|
||||
|
||||
|
@ -20575,6 +20592,9 @@ class freeswitchPINVOKE {
|
|||
[global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_frame_free___")]
|
||||
public static extern int switch_frame_free(global::System.Runtime.InteropServices.HandleRef jarg1);
|
||||
|
||||
[global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_is_uint_in_range___")]
|
||||
public static extern int switch_is_uint_in_range(string jarg1, uint jarg2, uint jarg3);
|
||||
|
||||
[global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_is_number___")]
|
||||
public static extern int switch_is_number(string jarg1);
|
||||
|
||||
|
@ -23614,12 +23634,30 @@ class freeswitchPINVOKE {
|
|||
[global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_codec_fmtp_microseconds_per_packet_get___")]
|
||||
public static extern int switch_codec_fmtp_microseconds_per_packet_get(global::System.Runtime.InteropServices.HandleRef jarg1);
|
||||
|
||||
[global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_codec_fmtp_max_ptime_set___")]
|
||||
public static extern void switch_codec_fmtp_max_ptime_set(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2);
|
||||
|
||||
[global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_codec_fmtp_max_ptime_get___")]
|
||||
public static extern int switch_codec_fmtp_max_ptime_get(global::System.Runtime.InteropServices.HandleRef jarg1);
|
||||
|
||||
[global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_codec_fmtp_min_ptime_set___")]
|
||||
public static extern void switch_codec_fmtp_min_ptime_set(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2);
|
||||
|
||||
[global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_codec_fmtp_min_ptime_get___")]
|
||||
public static extern int switch_codec_fmtp_min_ptime_get(global::System.Runtime.InteropServices.HandleRef jarg1);
|
||||
|
||||
[global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_codec_fmtp_stereo_set___")]
|
||||
public static extern void switch_codec_fmtp_stereo_set(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2);
|
||||
|
||||
[global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_codec_fmtp_stereo_get___")]
|
||||
public static extern int switch_codec_fmtp_stereo_get(global::System.Runtime.InteropServices.HandleRef jarg1);
|
||||
|
||||
[global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_codec_fmtp_sprop_stereo_set___")]
|
||||
public static extern void switch_codec_fmtp_sprop_stereo_set(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2);
|
||||
|
||||
[global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_codec_fmtp_sprop_stereo_get___")]
|
||||
public static extern int switch_codec_fmtp_sprop_stereo_get(global::System.Runtime.InteropServices.HandleRef jarg1);
|
||||
|
||||
[global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_codec_fmtp_private_info_set___")]
|
||||
public static extern void switch_codec_fmtp_private_info_set(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2);
|
||||
|
||||
|
@ -24487,6 +24525,12 @@ class freeswitchPINVOKE {
|
|||
[global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_channel_get_variable_dup___")]
|
||||
public static extern string switch_channel_get_variable_dup(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, int jarg3, int jarg4);
|
||||
|
||||
[global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_channel_get_variable_strdup___")]
|
||||
public static extern string switch_channel_get_variable_strdup(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2);
|
||||
|
||||
[global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_channel_get_variable_buf___")]
|
||||
public static extern int switch_channel_get_variable_buf(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, string jarg3, global::System.Runtime.InteropServices.HandleRef jarg4);
|
||||
|
||||
[global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_channel_get_variables___")]
|
||||
public static extern int switch_channel_get_variables(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2);
|
||||
|
||||
|
@ -26281,6 +26325,9 @@ class freeswitchPINVOKE {
|
|||
[global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_MAX_CAND_get___")]
|
||||
public static extern int MAX_CAND_get();
|
||||
|
||||
[global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_MAX_CAND_IDX_COUNT_get___")]
|
||||
public static extern int MAX_CAND_IDX_COUNT_get();
|
||||
|
||||
[global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_ice_t_cands_set___")]
|
||||
public static extern void ice_t_cands_set(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2);
|
||||
|
||||
|
@ -31066,7 +31113,8 @@ public enum switch_call_cause_t {
|
|||
SWITCH_CAUSE_BAD_IDENTITY_INFO = 821,
|
||||
SWITCH_CAUSE_UNSUPPORTED_CERTIFICATE = 822,
|
||||
SWITCH_CAUSE_INVALID_IDENTITY = 823,
|
||||
SWITCH_CAUSE_STALE_DATE = 824
|
||||
SWITCH_CAUSE_STALE_DATE = 824,
|
||||
SWITCH_CAUSE_REJECT_ALL = 825
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -32781,6 +32829,7 @@ public enum switch_codec_control_command_t {
|
|||
SCC_VIDEO_RESET,
|
||||
SCC_AUDIO_PACKET_LOSS,
|
||||
SCC_AUDIO_ADJUST_BITRATE,
|
||||
SCC_AUDIO_VAD,
|
||||
SCC_DEBUG,
|
||||
SCC_CODEC_SPECIFIC
|
||||
}
|
||||
|
@ -32905,6 +32954,26 @@ public class switch_codec_fmtp : global::System.IDisposable {
|
|||
}
|
||||
}
|
||||
|
||||
public int max_ptime {
|
||||
set {
|
||||
freeswitchPINVOKE.switch_codec_fmtp_max_ptime_set(swigCPtr, value);
|
||||
}
|
||||
get {
|
||||
int ret = freeswitchPINVOKE.switch_codec_fmtp_max_ptime_get(swigCPtr);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
public int min_ptime {
|
||||
set {
|
||||
freeswitchPINVOKE.switch_codec_fmtp_min_ptime_set(swigCPtr, value);
|
||||
}
|
||||
get {
|
||||
int ret = freeswitchPINVOKE.switch_codec_fmtp_min_ptime_get(swigCPtr);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
public int stereo {
|
||||
set {
|
||||
freeswitchPINVOKE.switch_codec_fmtp_stereo_set(swigCPtr, value);
|
||||
|
@ -32915,6 +32984,16 @@ public class switch_codec_fmtp : global::System.IDisposable {
|
|||
}
|
||||
}
|
||||
|
||||
public int sprop_stereo {
|
||||
set {
|
||||
freeswitchPINVOKE.switch_codec_fmtp_sprop_stereo_set(swigCPtr, value);
|
||||
}
|
||||
get {
|
||||
int ret = freeswitchPINVOKE.switch_codec_fmtp_sprop_stereo_get(swigCPtr);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
public SWIGTYPE_p_void private_info {
|
||||
set {
|
||||
freeswitchPINVOKE.switch_codec_fmtp_private_info_set(swigCPtr, SWIGTYPE_p_void.getCPtr(value));
|
||||
|
|
|
@ -86,6 +86,9 @@ static void print_python_error(const char * script)
|
|||
{
|
||||
PyObject *pyType = NULL, *pyValue = NULL, *pyTraceback = NULL, *pyString = NULL;
|
||||
PyObject *pyModule=NULL, *pyFunction = NULL, *pyResult = NULL;
|
||||
#if PY_VERSION_HEX >= 0x030B0000
|
||||
PyCodeObject *pcode = NULL;
|
||||
#endif
|
||||
char * buffer = (char*) malloc( 20 * 1024 * sizeof(char));
|
||||
/* Variables for the traceback */
|
||||
PyTracebackObject * pyTB = NULL/*, *pyTB2 = NULL*/;
|
||||
|
@ -153,10 +156,23 @@ static void print_python_error(const char * script)
|
|||
|
||||
/* Traceback */
|
||||
do {
|
||||
sprintf((char*)sTemp, "\n\tFile: \"%s\", line %i, in %s",
|
||||
#if PY_VERSION_HEX >= 0x030B0000
|
||||
if (pyTB->tb_frame != NULL) {
|
||||
pcode = PyFrame_GetCode(pyTB->tb_frame);
|
||||
} else {
|
||||
pcode = NULL;
|
||||
}
|
||||
|
||||
snprintf((char*)sTemp, sizeof(sTemp), "\n\tFile: \"%s\", line %i, in %s",
|
||||
(pcode)?PyString_AsString(pcode->co_filename):"",
|
||||
pyTB->tb_lineno,
|
||||
(pcode)?PyString_AsString(pcode->co_name):"" );
|
||||
#else
|
||||
snprintf((char*)sTemp, sizeof(sTemp), "\n\tFile: \"%s\", line %i, in %s",
|
||||
PyString_AsString(pyTB->tb_frame->f_code->co_filename),
|
||||
pyTB->tb_lineno,
|
||||
PyString_AsString(pyTB->tb_frame->f_code->co_name) );
|
||||
#endif
|
||||
strcat(buffer, (char*)sTemp);
|
||||
|
||||
pyTB=pyTB->tb_next;
|
||||
|
|
|
@ -98,6 +98,8 @@ static switch_status_t mod_logfile_openlogfile(logfile_profile_t *profile, switc
|
|||
|
||||
stat = switch_file_open(&afd, profile->logfile, flags, SWITCH_FPROT_OS_DEFAULT, module_pool);
|
||||
if (stat != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "logfile %s open error, status=%d\n", profile->logfile, stat);
|
||||
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
|
@ -459,7 +461,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_logfile_load)
|
|||
if ((profiles = switch_xml_child(cfg, "profiles"))) {
|
||||
for (xprofile = switch_xml_child(profiles, "profile"); xprofile; xprofile = xprofile->next) {
|
||||
if (load_profile(xprofile) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "error loading profile.");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "error loading profile.\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ static size_t httpCallBack(char *buffer, size_t size, size_t nitems, void *outst
|
|||
return size * nitems;
|
||||
}
|
||||
|
||||
static switch_status_t set_xml_cdr_log_dirs()
|
||||
static switch_status_t set_xml_cdr_log_dirs(void)
|
||||
{
|
||||
switch_time_exp_t tm;
|
||||
char *path = NULL;
|
||||
|
@ -254,7 +254,7 @@ static switch_status_t my_on_reporting(switch_core_session_t *session)
|
|||
#endif
|
||||
int wrote;
|
||||
wrote = write(fd, xml_text, (unsigned) strlen(xml_text));
|
||||
wrote++;
|
||||
(void)wrote;
|
||||
close(fd);
|
||||
} else {
|
||||
char ebuf[512] = { 0 };
|
||||
|
@ -427,7 +427,7 @@ static switch_status_t my_on_reporting(switch_core_session_t *session)
|
|||
#endif
|
||||
int wrote;
|
||||
wrote = write(fd, xml_text, (unsigned) strlen(xml_text));
|
||||
wrote++;
|
||||
(void)wrote;
|
||||
close(fd);
|
||||
} else {
|
||||
char ebuf[512] = { 0 };
|
||||
|
|
|
@ -101,7 +101,7 @@ static void handle_SIGTERM(int sig)
|
|||
}
|
||||
|
||||
/* kill a freeswitch process running in background mode */
|
||||
static int freeswitch_kill_background()
|
||||
static int freeswitch_kill_background(void)
|
||||
{
|
||||
FILE *f; /* FILE handle to open the pid file */
|
||||
char path[PATH_MAX] = ""; /* full path of the PID file */
|
||||
|
|
|
@ -74,7 +74,16 @@
|
|||
#if (defined(HAVE_LIBMD5) || defined(HAVE_LIBMD) || defined(HAVE_MD5INIT))
|
||||
#include <md5.h>
|
||||
#elif defined(HAVE_LIBCRYPTO)
|
||||
#include <openssl/md5.h>
|
||||
#ifndef OPENSSL_VERSION_NUMBER
|
||||
#include <openssl/opensslv.h>
|
||||
#endif
|
||||
#if OPENSSL_VERSION_NUMBER < 0x30000000
|
||||
#include <openssl/md5.h>
|
||||
#else
|
||||
#include <openssl/evp.h>
|
||||
#endif
|
||||
#else
|
||||
#include <apr_md5.h>
|
||||
#endif
|
||||
|
||||
#ifndef WIN32
|
||||
|
@ -1174,11 +1183,24 @@ SWITCH_DECLARE(switch_status_t) switch_md5(unsigned char digest[SWITCH_MD5_DIGES
|
|||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
#elif defined(HAVE_LIBCRYPTO)
|
||||
MD5_CTX md5_context;
|
||||
#if OPENSSL_VERSION_NUMBER < 0x30000000
|
||||
MD5_CTX md5_context;
|
||||
|
||||
MD5_Init(&md5_context);
|
||||
MD5_Update(&md5_context, input, inputLen);
|
||||
MD5_Final(digest, &md5_context);
|
||||
MD5_Init(&md5_context);
|
||||
MD5_Update(&md5_context, input, inputLen);
|
||||
MD5_Final(digest, &md5_context);
|
||||
#else
|
||||
EVP_MD_CTX *md5_context;
|
||||
|
||||
/* MD5_Init */
|
||||
md5_context = EVP_MD_CTX_new();
|
||||
EVP_DigestInit_ex(md5_context, EVP_md5(), NULL);
|
||||
/* MD5_Update */
|
||||
EVP_DigestUpdate(md5_context, input, inputLen);
|
||||
/* MD5_Final */
|
||||
EVP_DigestFinal_ex(md5_context, digest, NULL);
|
||||
EVP_MD_CTX_free(md5_context);
|
||||
#endif
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
#else
|
||||
|
|
|
@ -1022,6 +1022,24 @@ SWITCH_DECLARE(const char *) switch_channel_get_variable_dup(switch_channel_t *c
|
|||
return r;
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(const char *) switch_channel_get_variable_strdup(switch_channel_t *channel, const char *varname)
|
||||
{
|
||||
const char *value = switch_channel_get_variable_dup(channel, varname, SWITCH_FALSE, -1);
|
||||
|
||||
return value ? (const char *)strdup(value) : NULL;
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_channel_get_variable_buf(switch_channel_t *channel, const char *varname, char *buf, switch_size_t buflen)
|
||||
{
|
||||
const char *value = switch_channel_get_variable_dup(channel, varname, SWITCH_FALSE, -1);
|
||||
|
||||
if (value && buf && buflen && switch_copy_string(buf, value, buflen)) {
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(const char *) switch_channel_get_variable_partner(switch_channel_t *channel, const char *varname)
|
||||
{
|
||||
const char *uuid;
|
||||
|
|
|
@ -1849,7 +1849,7 @@ SWITCH_DECLARE(switch_status_t) switch_console_set_complete(const char *string)
|
|||
SWITCH_STANDARD_STREAM(mystream);
|
||||
|
||||
if (!strcasecmp(argv[0], "stickyadd")) {
|
||||
mystream.write_function(&mystream, "insert into complete values (1,");
|
||||
mystream.write_function(&mystream, "insert into complete (sticky, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, hostname) values (1,");
|
||||
for (x = 0; x < 10; x++) {
|
||||
if (argv[x + 1] && !strcasecmp(argv[x + 1], "_any_")) {
|
||||
mystream.write_function(&mystream, "%s", "'', ");
|
||||
|
@ -1865,7 +1865,7 @@ SWITCH_DECLARE(switch_status_t) switch_console_set_complete(const char *string)
|
|||
switch_core_sql_exec(mystream.data);
|
||||
status = SWITCH_STATUS_SUCCESS;
|
||||
} else if (!strcasecmp(argv[0], "add")) {
|
||||
mystream.write_function(&mystream, "insert into complete values (0,");
|
||||
mystream.write_function(&mystream, "insert into complete (sticky, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, hostname) values (0,");
|
||||
for (x = 0; x < 10; x++) {
|
||||
if (argv[x + 1] && !strcasecmp(argv[x + 1], "_any_")) {
|
||||
mystream.write_function(&mystream, "%s", "'', ");
|
||||
|
|
|
@ -3566,7 +3566,7 @@ SWITCH_DECLARE(int) switch_stream_system(const char *cmd, switch_stream_handle_t
|
|||
}
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(uint16_t) switch_core_get_rtp_port_range_start_port()
|
||||
SWITCH_DECLARE(uint16_t) switch_core_get_rtp_port_range_start_port(void)
|
||||
{
|
||||
uint16_t start_port = 0;
|
||||
|
||||
|
@ -3577,7 +3577,7 @@ SWITCH_DECLARE(uint16_t) switch_core_get_rtp_port_range_start_port()
|
|||
return start_port;
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(uint16_t) switch_core_get_rtp_port_range_end_port()
|
||||
SWITCH_DECLARE(uint16_t) switch_core_get_rtp_port_range_end_port(void)
|
||||
{
|
||||
uint16_t end_port = 0;
|
||||
|
||||
|
|
|
@ -287,7 +287,10 @@ SWITCH_DECLARE(int) switch_core_gen_certs(const char *prefix)
|
|||
|
||||
//bio_err=BIO_new_fp(stderr, BIO_NOCLOSE);
|
||||
|
||||
mkcert(&x509, &pkey, 4096, 0, 36500);
|
||||
if (!mkcert(&x509, &pkey, 4096, 0, 36500)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Certificate generation failed\n");
|
||||
goto end;
|
||||
}
|
||||
|
||||
//RSA_print_fp(stdout, pkey->pkey.rsa, 0);
|
||||
//X509_print_fp(stdout, x509);
|
||||
|
@ -410,7 +413,9 @@ static int mkcert(X509 **x509p, EVP_PKEY **pkeyp, int bits, int serial, int days
|
|||
{
|
||||
X509 *x;
|
||||
EVP_PKEY *pk;
|
||||
#if OPENSSL_VERSION_NUMBER < 0x30000000
|
||||
RSA *rsa;
|
||||
#endif
|
||||
X509_NAME *name=NULL;
|
||||
|
||||
switch_assert(pkeyp);
|
||||
|
@ -432,7 +437,26 @@ static int mkcert(X509 **x509p, EVP_PKEY **pkeyp, int bits, int serial, int days
|
|||
x = *x509p;
|
||||
}
|
||||
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x10100000
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x30000000
|
||||
{
|
||||
EVP_PKEY_CTX *ctx;
|
||||
|
||||
ctx = EVP_PKEY_CTX_new_id(EVP_PKEY_RSA, NULL);
|
||||
/* Setup the key context */
|
||||
if ((!ctx) || (EVP_PKEY_keygen_init(ctx) <= 0) || (EVP_PKEY_CTX_set_rsa_keygen_bits(ctx, bits) <= 0)) {
|
||||
abort();
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* Generate key */
|
||||
if (EVP_PKEY_generate(ctx, &pk) <= 0) {
|
||||
abort();
|
||||
goto err;
|
||||
}
|
||||
|
||||
EVP_PKEY_CTX_free(ctx);
|
||||
}
|
||||
#elif OPENSSL_VERSION_NUMBER >= 0x10100000
|
||||
rsa = RSA_new();
|
||||
{
|
||||
static const BN_ULONG ULONG_RSA_F4 = RSA_F4;
|
||||
|
@ -449,11 +473,13 @@ static int mkcert(X509 **x509p, EVP_PKEY **pkeyp, int bits, int serial, int days
|
|||
rsa = RSA_generate_key(bits, RSA_F4, NULL, NULL);
|
||||
#endif
|
||||
|
||||
#if OPENSSL_VERSION_NUMBER < 0x30000000
|
||||
if (!EVP_PKEY_assign_RSA(pk, rsa)) {
|
||||
abort();
|
||||
}
|
||||
|
||||
rsa = NULL;
|
||||
#endif
|
||||
|
||||
X509_set_version(x, 2);
|
||||
ASN1_INTEGER_set(X509_get_serialNumber(x), serial);
|
||||
|
@ -476,13 +502,21 @@ static int mkcert(X509 **x509p, EVP_PKEY **pkeyp, int bits, int serial, int days
|
|||
*/
|
||||
X509_set_issuer_name(x, name);
|
||||
|
||||
if (!X509_sign(x, pk, EVP_sha1()))
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x30000000
|
||||
if (!X509_sign(x, pk, EVP_sha256())) {
|
||||
#else
|
||||
if (!X509_sign(x, pk, EVP_sha1())) {
|
||||
#endif
|
||||
goto err;
|
||||
}
|
||||
|
||||
*x509p = x;
|
||||
*pkeyp = pk;
|
||||
|
||||
return(1);
|
||||
err:
|
||||
err:
|
||||
ERR_print_errors_fp(stdout);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -120,8 +120,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_set_real_read_codec(switch_c
|
|||
}
|
||||
} else { /* replace real_read_codec */
|
||||
switch_codec_t *cur_codec;
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Original read codec replaced with %s:%d\n",
|
||||
switch_channel_get_name(session->channel), codec->implementation->iananame, codec->implementation->ianacode);
|
||||
switch_channel_get_name(session->channel), codec->implementation ? codec->implementation->iananame : "undefined", codec->implementation ? codec->implementation->ianacode : -1);
|
||||
/* Set real_read_codec to front of the list of read_codecs */
|
||||
cur_codec = session->read_codec;
|
||||
while (cur_codec != NULL) {
|
||||
|
@ -129,8 +130,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_set_real_read_codec(switch_c
|
|||
cur_codec->next = codec;
|
||||
break;
|
||||
}
|
||||
|
||||
cur_codec = cur_codec->next;
|
||||
}
|
||||
|
||||
session->real_read_codec = codec;
|
||||
session->real_read_impl = *codec->implementation;
|
||||
|
||||
|
@ -154,6 +157,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_set_real_read_codec(switch_c
|
|||
session->bug_codec.implementation->iananame, session->bug_codec.implementation->ianacode);
|
||||
switch_core_codec_destroy(&session->bug_codec);
|
||||
}
|
||||
|
||||
switch_thread_rwlock_unlock(session->bug_rwlock);
|
||||
} else {
|
||||
status = SWITCH_STATUS_FALSE;
|
||||
|
@ -169,6 +173,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_set_real_read_codec(switch_c
|
|||
if (session->read_impl.actual_samples_per_second != session->read_impl.samples_per_second) {
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-reported-read-codec-rate", "%d", session->read_impl.samples_per_second);
|
||||
}
|
||||
|
||||
switch_event_fire(&event);
|
||||
}
|
||||
|
||||
|
@ -191,6 +196,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_set_real_read_codec(switch_c
|
|||
}
|
||||
|
||||
switch_mutex_unlock(session->codec_read_mutex);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
@ -221,7 +227,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_set_read_codec(switch_core_s
|
|||
goto end;
|
||||
}
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Push codec %s:%d\n",
|
||||
switch_channel_get_name(session->channel), codec->implementation->iananame, codec->implementation->ianacode);
|
||||
switch_channel_get_name(session->channel), codec->implementation ? codec->implementation->iananame : "undefined", codec->implementation ? codec->implementation->ianacode : -1);
|
||||
codec->next = session->read_codec;
|
||||
session->read_codec = codec;
|
||||
if (codec->implementation) {
|
||||
|
|
|
@ -1170,7 +1170,7 @@ static uint32_t parse_lifetime_mki(const char **p, const char *end)
|
|||
val += ((**p) - '0') * i;
|
||||
}
|
||||
res |= (val & 0x000000ff); /* MKI_SIZE */
|
||||
} else if (isdigit(*(field_begin + 1)) && (field_begin + 2) && (*(field_begin + 2) == '^') && (field_begin + 3) && isdigit(*(field_begin + 3))) {
|
||||
} else if (isdigit(*(field_begin + 1)) && (*(field_begin + 2) == '^') && isdigit(*(field_begin + 3))) {
|
||||
res |= (CRYPTO_KEY_MATERIAL_LIFETIME << 24);
|
||||
val = ((uint32_t) (*(field_begin + 1) - '0')) << 8;
|
||||
res |= val; /* LIFETIME base. */
|
||||
|
@ -4167,10 +4167,15 @@ static switch_status_t check_ice(switch_media_handle_t *smh, switch_media_type_t
|
|||
|
||||
argc = switch_split(data, ' ', fields);
|
||||
|
||||
if (argc < 6 || !switch_is_uint_in_range(fields[1], 1, MAX_CAND_IDX_COUNT)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(smh->session), SWITCH_LOG_WARNING, "Invalid data\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
cid = fields[1] ? atoi(fields[1]) - 1 : 0;
|
||||
|
||||
if (argc < 6 || engine->ice_in.cand_idx[cid] >= MAX_CAND - 1) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(smh->session), SWITCH_LOG_WARNING, "Invalid data\n");
|
||||
if (engine->ice_in.cand_idx[cid] >= MAX_CAND - 1) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(smh->session), SWITCH_LOG_WARNING, "Too many candidates\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -4250,7 +4255,7 @@ static switch_status_t check_ice(switch_media_handle_t *smh, switch_media_type_t
|
|||
|
||||
relay:
|
||||
|
||||
for (cid = 0; cid < 2; cid++) {
|
||||
for (cid = 0; cid < MAX_CAND_IDX_COUNT; cid++) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(smh->session), SWITCH_LOG_DEBUG, "Searching for %s candidate.\n", cid ? "rtcp" : "rtp");
|
||||
|
||||
for (ai = 0; ai < engine->cand_acl_count; ai++) {
|
||||
|
@ -4499,19 +4504,28 @@ struct matches {
|
|||
int codec_idx;
|
||||
};
|
||||
|
||||
#ifndef MIN
|
||||
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
static void greedy_sort(switch_media_handle_t *smh, struct matches *matches, int m_idx, const switch_codec_implementation_t **codec_array, int total_codecs)
|
||||
{
|
||||
int j = 0, f = 0, g;
|
||||
struct matches mtmp[MAX_MATCHES] = { { 0 } };
|
||||
|
||||
m_idx = MIN(m_idx, MAX_MATCHES);
|
||||
|
||||
for(j = 0; j < m_idx; j++) {
|
||||
*&mtmp[j] = *&matches[j];
|
||||
}
|
||||
for (g = 0; g < smh->mparams->num_codecs && g < total_codecs; g++) {
|
||||
}
|
||||
|
||||
for (g = 0; g < smh->mparams->num_codecs && g < total_codecs && f < MAX_MATCHES; g++) {
|
||||
const switch_codec_implementation_t *imp = codec_array[g];
|
||||
|
||||
for(j = 0; j < m_idx; j++) {
|
||||
if (mtmp[j].imp == imp) {
|
||||
if (mtmp[j].imp && mtmp[j].imp == imp) {
|
||||
*&matches[f++] = *&mtmp[j];
|
||||
mtmp[j].imp = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4762,7 +4776,7 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
|
|||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
const char *val;
|
||||
const char *crypto = NULL;
|
||||
int got_crypto = 0, got_video_crypto = 0, got_audio = 0, saw_audio = 0, saw_video = 0, got_avp = 0, got_video_avp = 0, got_video_savp = 0, got_savp = 0, got_udptl = 0, got_webrtc = 0, got_text = 0, got_text_crypto = 0, got_msrp = 0;
|
||||
int got_crypto = 0, got_video_crypto = 0, got_audio = 0, saw_audio = 0, saw_video = 0, got_avp = 0, got_savp = 0, got_udptl = 0, got_webrtc = 0, got_text = 0, got_text_crypto = 0, got_msrp = 0;
|
||||
int scrooge = 0;
|
||||
sdp_parser_t *parser = NULL;
|
||||
sdp_session_t *sdp;
|
||||
|
@ -4958,14 +4972,10 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
|
|||
if (m->m_proto == sdp_proto_srtp || m->m_proto == sdp_proto_extended_srtp) {
|
||||
if (m->m_type == sdp_media_audio) {
|
||||
got_savp++;
|
||||
} else {
|
||||
got_video_savp++;
|
||||
}
|
||||
} else if (m->m_proto == sdp_proto_rtp) {
|
||||
if (m->m_type == sdp_media_audio) {
|
||||
got_avp++;
|
||||
} else {
|
||||
got_video_avp++;
|
||||
}
|
||||
} else if (m->m_proto == sdp_proto_udptl) {
|
||||
got_udptl++;
|
||||
|
@ -5549,6 +5559,13 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
|
|||
/* ptime does not match */
|
||||
match = 0;
|
||||
|
||||
if (nm_idx >= MAX_MATCHES) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
|
||||
"Audio Codec Compare [%s:%d:%u:%u:%d:%u:%d] was not saved as a near-match. Too many. Ignoring.\n",
|
||||
imp->iananame, imp->ianacode, codec_rate, imp->actual_samples_per_second, imp->microseconds_per_packet / 1000, bit_rate, imp->number_of_channels);
|
||||
continue;
|
||||
}
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
|
||||
"Audio Codec Compare [%s:%d:%u:%d:%u:%d] is saved as a near-match\n",
|
||||
imp->iananame, imp->ianacode, codec_rate, imp->microseconds_per_packet / 1000, bit_rate, imp->number_of_channels);
|
||||
|
@ -6157,10 +6174,18 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
|
|||
imp->iananame, map->rm_pt);
|
||||
|
||||
m_idx++;
|
||||
|
||||
if (m_idx >= MAX_MATCHES) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
vmatch = 0;
|
||||
}
|
||||
|
||||
if (m_idx >= MAX_MATCHES) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (consider_video_fmtp && (!m_idx || almost_vmatch)) {
|
||||
|
@ -7406,7 +7431,7 @@ static void *SWITCH_THREAD_FUNC video_helper_thread(switch_thread_t *thread, voi
|
|||
switch_status_t status;
|
||||
switch_frame_t *read_frame = NULL;
|
||||
switch_media_handle_t *smh;
|
||||
uint32_t loops = 0, xloops = 0, vloops = 0;
|
||||
uint32_t loops = 0, xloops = 0;
|
||||
switch_image_t *blank_img = NULL;
|
||||
switch_frame_t fr = { 0 };
|
||||
unsigned char *buf = NULL;
|
||||
|
@ -7531,8 +7556,6 @@ static void *SWITCH_THREAD_FUNC video_helper_thread(switch_thread_t *thread, voi
|
|||
continue;
|
||||
}
|
||||
|
||||
vloops++;
|
||||
|
||||
send_blank = blank_enabled || switch_channel_test_flag(channel, CF_VIDEO_ECHO);
|
||||
|
||||
if (switch_channel_test_flag(channel, CF_VIDEO_READY) && !switch_test_flag(read_frame, SFF_CNG)) {
|
||||
|
@ -14243,7 +14266,7 @@ SWITCH_DECLARE(char *) switch_core_media_filter_sdp(const char *sdp_str, const c
|
|||
switch_size_t len;
|
||||
const char *i;
|
||||
char *o;
|
||||
int in_m = 0, m_tally = 0, slash = 0;
|
||||
int in_m = 0, slash = 0;
|
||||
int number = 0, skip = 0;
|
||||
int remove = !strcasecmp(cmd, "remove");
|
||||
int only = !strcasecmp(cmd, "only");
|
||||
|
@ -14277,7 +14300,6 @@ SWITCH_DECLARE(char *) switch_core_media_filter_sdp(const char *sdp_str, const c
|
|||
|
||||
if (*i == 'm' && *(i+1) == '=') {
|
||||
in_m = 1;
|
||||
m_tally++;
|
||||
}
|
||||
|
||||
if (in_m) {
|
||||
|
@ -14981,7 +15003,6 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_video_frame(switch_core
|
|||
{
|
||||
switch_status_t status = SWITCH_STATUS_FALSE;
|
||||
switch_io_event_hook_video_read_frame_t *ptr;
|
||||
uint32_t loops = 0;
|
||||
switch_media_handle_t *smh;
|
||||
int is_keyframe = 0;
|
||||
|
||||
|
@ -14993,8 +15014,6 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_video_frame(switch_core
|
|||
|
||||
top:
|
||||
|
||||
loops++;
|
||||
|
||||
if (switch_channel_down_nosig(session->channel)) {
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
|
|
@ -799,6 +799,7 @@ static const char *message_names[] = {
|
|||
"DEFLECT",
|
||||
"VIDEO_REFRESH_REQ",
|
||||
"DISPLAY",
|
||||
"MEDIA_PARAMS",
|
||||
"TRANSCODING_NECESSARY",
|
||||
"AUDIO_SYNC",
|
||||
"VIDEO_SYNC",
|
||||
|
|
|
@ -58,11 +58,16 @@ SWITCH_DECLARE(void) switch_curl_destroy(void)
|
|||
curl_global_cleanup();
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_curl_process_form_post_params(switch_event_t *event, switch_CURL *curl_handle, struct curl_httppost **formpostp)
|
||||
SWITCH_DECLARE(switch_status_t) switch_curl_process_mime(switch_event_t *event, switch_CURL *curl_handle, switch_curl_mime **mimep)
|
||||
{
|
||||
|
||||
#if defined(LIBCURL_VERSION_NUM) && (LIBCURL_VERSION_NUM >= 0x073800)
|
||||
curl_mime *mime = NULL;
|
||||
curl_mimepart *part = NULL;
|
||||
uint8_t added = 0;
|
||||
#else
|
||||
struct curl_httppost *formpost=NULL;
|
||||
struct curl_httppost *lastptr=NULL;
|
||||
#endif
|
||||
switch_event_header_t *hp;
|
||||
int go = 0;
|
||||
|
||||
|
@ -77,39 +82,87 @@ SWITCH_DECLARE(switch_status_t) switch_curl_process_form_post_params(switch_even
|
|||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
for (hp = event->headers; hp; hp = hp->next) {
|
||||
#if defined(LIBCURL_VERSION_NUM) && (LIBCURL_VERSION_NUM >= 0x073800)
|
||||
mime = curl_mime_init(curl_handle);
|
||||
#endif
|
||||
|
||||
for (hp = event->headers; hp; hp = hp->next) {
|
||||
if (!strncasecmp(hp->name, "attach_file:", 12)) {
|
||||
char *pname = strdup(hp->name + 12);
|
||||
|
||||
if (pname) {
|
||||
char *fname = strchr(pname, ':');
|
||||
|
||||
if (fname) {
|
||||
*fname++ = '\0';
|
||||
|
||||
#if defined(LIBCURL_VERSION_NUM) && (LIBCURL_VERSION_NUM >= 0x073800)
|
||||
part = curl_mime_addpart(mime);
|
||||
curl_mime_name(part, pname);
|
||||
curl_mime_filename(part, fname);
|
||||
curl_mime_filedata(part, hp->value);
|
||||
added++;
|
||||
#else
|
||||
curl_formadd(&formpost,
|
||||
&lastptr,
|
||||
CURLFORM_COPYNAME, pname,
|
||||
CURLFORM_FILENAME, fname,
|
||||
CURLFORM_FILE, hp->value,
|
||||
CURLFORM_END);
|
||||
#endif
|
||||
}
|
||||
|
||||
free(pname);
|
||||
}
|
||||
} else {
|
||||
#if defined(LIBCURL_VERSION_NUM) && (LIBCURL_VERSION_NUM >= 0x073800)
|
||||
part = curl_mime_addpart(mime);
|
||||
curl_mime_name(part, hp->name);
|
||||
curl_mime_data(part, hp->value, CURL_ZERO_TERMINATED);
|
||||
added++;
|
||||
#else
|
||||
curl_formadd(&formpost,
|
||||
&lastptr,
|
||||
CURLFORM_COPYNAME, hp->name,
|
||||
CURLFORM_COPYCONTENTS, hp->value,
|
||||
CURLFORM_END);
|
||||
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
*formpostp = formpost;
|
||||
#if defined(LIBCURL_VERSION_NUM) && (LIBCURL_VERSION_NUM >= 0x073800)
|
||||
if (!added) {
|
||||
curl_mime_free(mime);
|
||||
mime = NULL;
|
||||
}
|
||||
|
||||
*mimep = mime;
|
||||
#else
|
||||
*mimep = formpost;
|
||||
#endif
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(void) switch_curl_mime_free(switch_curl_mime **mimep)
|
||||
{
|
||||
if (mimep && *mimep) {
|
||||
#if defined(LIBCURL_VERSION_NUM) && (LIBCURL_VERSION_NUM >= 0x073800)
|
||||
curl_mime_free(*mimep);
|
||||
#else
|
||||
curl_formfree(*mimep);
|
||||
#endif
|
||||
mimep = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(switch_CURLcode) switch_curl_easy_setopt_mime(switch_CURL *curl_handle, switch_curl_mime *mime)
|
||||
{
|
||||
#if defined(LIBCURL_VERSION_NUM) && (LIBCURL_VERSION_NUM >= 0x073800)
|
||||
return curl_easy_setopt(curl_handle, CURLOPT_MIMEPOST, mime);
|
||||
#else
|
||||
return curl_easy_setopt(curl_handle, CURLOPT_HTTPPOST, mime);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* For Emacs:
|
||||
|
|
|
@ -651,7 +651,6 @@ SWITCH_DECLARE(void) switch_event_launch_dispatch_threads(uint32_t max)
|
|||
{
|
||||
switch_threadattr_t *thd_attr;
|
||||
uint32_t index = 0;
|
||||
int launched = 0;
|
||||
uint32_t sanity = 200;
|
||||
|
||||
switch_memory_pool_t *pool = RUNTIME_POOL;
|
||||
|
@ -682,7 +681,6 @@ SWITCH_DECLARE(void) switch_event_launch_dispatch_threads(uint32_t max)
|
|||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Create additional event dispatch thread %d\n", index);
|
||||
}
|
||||
launched++;
|
||||
}
|
||||
|
||||
SOFT_MAX_DISPATCH = index;
|
||||
|
@ -2073,15 +2071,18 @@ SWITCH_DECLARE(switch_status_t) switch_event_bind_removable(const char *id, swit
|
|||
switch_mutex_lock(CUSTOM_HASH_MUTEX);
|
||||
|
||||
if (!(subclass = switch_core_hash_find(CUSTOM_HASH, subclass_name))) {
|
||||
switch_event_reserve_subclass_detailed(id, subclass_name);
|
||||
subclass = switch_core_hash_find(CUSTOM_HASH, subclass_name);
|
||||
subclass->bind = 1;
|
||||
if (switch_event_reserve_subclass_detailed(id, subclass_name) == SWITCH_STATUS_SUCCESS) {
|
||||
if ((subclass = switch_core_hash_find(CUSTOM_HASH, subclass_name))) {
|
||||
subclass->bind = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch_mutex_unlock(CUSTOM_HASH_MUTEX);
|
||||
|
||||
if (!subclass) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not reserve subclass. '%s'\n", subclass_name);
|
||||
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
}
|
||||
|
@ -2096,6 +2097,7 @@ SWITCH_DECLARE(switch_status_t) switch_event_bind_removable(const char *id, swit
|
|||
if (subclass_name) {
|
||||
event_node->subclass_name = DUP(subclass_name);
|
||||
}
|
||||
|
||||
event_node->callback = callback;
|
||||
event_node->user_data = user_data;
|
||||
|
||||
|
@ -2954,14 +2956,17 @@ static void ecd_deliver(event_channel_data_t **ecdP)
|
|||
int x_argc = switch_separate_string_string(key, (char*) sep, x_argv, SWITCH_CHANNEL_DISPATCH_MAX_KEY_PARTS);
|
||||
char buf[1024];
|
||||
int i, r;
|
||||
|
||||
for(i=x_argc - 1; i > 0; i--) {
|
||||
int z;
|
||||
|
||||
memset(buf, 0, 1024);
|
||||
sprintf(buf, "%s", x_argv[0]);
|
||||
switch_snprintf(buf, sizeof(buf), "%s", x_argv[0]);
|
||||
for(z=1; z < i; z++) {
|
||||
strcat(buf, sep);
|
||||
strcat(buf, x_argv[z]);
|
||||
strncat(buf, x_argv[z], sizeof(buf) - strlen(buf) - 1);
|
||||
}
|
||||
|
||||
r = _switch_event_channel_broadcast(buf, ecd->event_channel, ecd->json, ecd->key, ecd->id);
|
||||
t += r;
|
||||
if (r && switch_core_test_flag(SCF_EVENT_CHANNEL_HIERARCHY_DELIVERY_ONCE)) {
|
||||
|
@ -2970,11 +2975,13 @@ static void ecd_deliver(event_channel_data_t **ecdP)
|
|||
}
|
||||
} else {
|
||||
char *p = NULL;
|
||||
|
||||
if ((p = strchr(key, '.'))) {
|
||||
*p = '\0';
|
||||
t += _switch_event_channel_broadcast(key, ecd->event_channel, ecd->json, ecd->key, ecd->id);
|
||||
}
|
||||
}
|
||||
|
||||
switch_safe_free(key);
|
||||
|
||||
t += _switch_event_channel_broadcast(SWITCH_EVENT_CHANNEL_GLOBAL, ecd->event_channel, ecd->json, ecd->key, ecd->id);
|
||||
|
@ -2982,6 +2989,7 @@ static void ecd_deliver(event_channel_data_t **ecdP)
|
|||
if(t == 0) {
|
||||
if (switch_core_test_flag(SCF_EVENT_CHANNEL_LOG_UNDELIVERABLE_JSON)) {
|
||||
char *json = cJSON_Print(ecd->json);
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "no subscribers for %s , %s => %s\n", ecd->event_channel, ecd->key, json);
|
||||
switch_safe_free(json);
|
||||
} else {
|
||||
|
|
|
@ -186,15 +186,16 @@ struct key_collect {
|
|||
static void *SWITCH_THREAD_FUNC collect_thread_run(switch_thread_t *thread, void *obj)
|
||||
{
|
||||
struct key_collect *collect = (struct key_collect *) obj;
|
||||
switch_channel_t *channel = switch_core_session_get_channel(collect->session);
|
||||
switch_channel_t *channel = NULL;
|
||||
char buf[10] = SWITCH_BLANK_STRING;
|
||||
switch_application_interface_t *application_interface = NULL;
|
||||
|
||||
if (collect->session) {
|
||||
if (switch_core_session_read_lock(collect->session) != SWITCH_STATUS_SUCCESS) {
|
||||
return NULL;
|
||||
}
|
||||
} else {
|
||||
if (!collect->session) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
channel = switch_core_session_get_channel(collect->session);
|
||||
if (switch_core_session_read_lock(collect->session) != SWITCH_STATUS_SUCCESS) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -232,6 +233,7 @@ static void *SWITCH_THREAD_FUNC collect_thread_run(switch_thread_t *thread, void
|
|||
switch_channel_set_flag(channel, CF_WINNER);
|
||||
switch_channel_set_variable(channel, "group_dial_status", "winner");
|
||||
}
|
||||
|
||||
goto wbreak;
|
||||
}
|
||||
|
||||
|
@ -271,6 +273,7 @@ static void *SWITCH_THREAD_FUNC collect_thread_run(switch_thread_t *thread, void
|
|||
switch_ivr_play_file(collect->session, NULL, collect->error_file, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
wbreak:
|
||||
|
||||
switch_core_session_rwunlock(collect->session);
|
||||
|
|
|
@ -1271,7 +1271,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
|
|||
int sleep_val_i = 250;
|
||||
int eof = 0;
|
||||
switch_size_t bread = 0;
|
||||
int l16 = 0;
|
||||
switch_codec_implementation_t read_impl = { 0 };
|
||||
char *file_dup;
|
||||
char *argv[128] = { 0 };
|
||||
|
@ -1334,10 +1333,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
|
|||
|
||||
arg_recursion_check_start(args);
|
||||
|
||||
if (!zstr(read_impl.iananame) && !strcasecmp(read_impl.iananame, "l16")) {
|
||||
l16++;
|
||||
}
|
||||
|
||||
if (play_delimiter) {
|
||||
file_dup = switch_core_session_strdup(session, file);
|
||||
argc = switch_separate_string(file_dup, play_delimiter, argv, (sizeof(argv) / sizeof(argv[0])));
|
||||
|
|
|
@ -362,25 +362,22 @@ static inline void hide_nodes(switch_jb_t *jb)
|
|||
}
|
||||
|
||||
static inline switch_bool_t packet_vad(switch_jb_t *jb, switch_rtp_packet_t *packet, switch_size_t len) {
|
||||
void* payload;
|
||||
void *payload = packet ? (packet->ebody ? packet->ebody : packet->body) : NULL;
|
||||
uint16_t payload_len = len;
|
||||
|
||||
if (packet->ebody) {
|
||||
payload = packet->ebody;
|
||||
} else {
|
||||
payload = packet->body;
|
||||
}
|
||||
if (payload && payload_len > 0) {
|
||||
switch_bool_t ret;
|
||||
switch_bool_t *ret_p = &ret;
|
||||
switch_bool_t ret = SWITCH_FALSE, *ret_p = &ret;
|
||||
switch_codec_control_type_t ret_t;
|
||||
|
||||
switch_core_media_codec_control(jb->session, SWITCH_MEDIA_TYPE_AUDIO,
|
||||
SWITCH_IO_WRITE, SCC_AUDIO_VAD,
|
||||
SCCT_STRING, (void *)payload,
|
||||
SCCT_INT, (void *)&payload_len,
|
||||
&ret_t, (void *)&ret_p);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
return SWITCH_TRUE;
|
||||
}
|
||||
|
||||
|
@ -916,126 +913,153 @@ static inline switch_status_t jb_next_packet_by_ts(switch_jb_t *jb, switch_jb_no
|
|||
static inline int check_jb_size(switch_jb_t *jb)
|
||||
{
|
||||
switch_jb_node_t *np;
|
||||
uint16_t seq;
|
||||
uint16_t l_seq=0;
|
||||
uint16_t h_seq=0;
|
||||
uint16_t count=0;
|
||||
uint16_t old=0;
|
||||
uint16_t seq_hs, target_seq_hs;
|
||||
uint16_t l_seq = 0;
|
||||
uint16_t h_seq = 0;
|
||||
uint16_t count = 0;
|
||||
uint16_t old = 0;
|
||||
|
||||
switch_mutex_lock(jb->list_mutex);
|
||||
|
||||
target_seq_hs = ntohs(jb->target_seq);
|
||||
|
||||
for (np = jb->node_list; np; np = np->next) {
|
||||
if (!np->visible) {
|
||||
continue;
|
||||
}
|
||||
|
||||
seq = ntohs(np->packet.header.seq);
|
||||
if (ntohs(jb->target_seq) > seq) {
|
||||
hide_node(np, SWITCH_FALSE);
|
||||
old++;
|
||||
continue;
|
||||
}
|
||||
if (count == 0) {
|
||||
l_seq = h_seq = seq;
|
||||
}
|
||||
count++;
|
||||
if (seq < l_seq)
|
||||
l_seq = seq;
|
||||
if (seq > h_seq)
|
||||
h_seq = seq;
|
||||
seq_hs = ntohs(np->packet.header.seq);
|
||||
if (target_seq_hs > seq_hs) {
|
||||
hide_node(np, SWITCH_FALSE);
|
||||
old++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (count == 0) {
|
||||
l_seq = h_seq = seq_hs;
|
||||
}
|
||||
|
||||
count++;
|
||||
|
||||
if (seq_hs < l_seq) {
|
||||
l_seq = seq_hs;
|
||||
}
|
||||
|
||||
if (seq_hs > h_seq) {
|
||||
h_seq = seq_hs;
|
||||
}
|
||||
}
|
||||
|
||||
if (count > jb->jitter.stats.size_max) {
|
||||
jb->jitter.stats.size_max = count;
|
||||
}
|
||||
|
||||
if (jb->jitter.stats.size_est == 0) {
|
||||
jb->jitter.stats.size_est = count;
|
||||
} else {
|
||||
jb->jitter.stats.size_est = ((99*jb->jitter.stats.size_est)+(1*count))/100;
|
||||
jb->jitter.stats.size_est = ((99 * jb->jitter.stats.size_est) + (1 * count)) / 100;
|
||||
}
|
||||
if (ntohs(jb->target_seq) % 50 == 0) { /* update the stats every x packets */
|
||||
|
||||
/* update the stats every x packets */
|
||||
if (target_seq_hs % 50 == 0) {
|
||||
int packet_ms = jb->jitter.samples_per_frame / (jb->jitter.samples_per_second / 1000);
|
||||
|
||||
jb->jitter.stats.estimate_ms = (*jb->jitter.estimate) / jb->jitter.samples_per_second * 1000;
|
||||
switch_channel_set_variable_printf(jb->channel, "rtp_jb_size_max_ms", "%u", jb->jitter.stats.size_max*packet_ms);
|
||||
switch_channel_set_variable_printf(jb->channel, "rtp_jb_size_est_ms", "%u", jb->jitter.stats.size_est*packet_ms);
|
||||
switch_channel_set_variable_printf(jb->channel, "rtp_jb_acceleration_ms", "%u", jb->jitter.stats.acceleration*packet_ms);
|
||||
switch_channel_set_variable_printf(jb->channel, "rtp_jb_expand_ms", "%u", jb->jitter.stats.expand*packet_ms);
|
||||
if (jb->jitter.stats.jitter_max_ms < jb->jitter.stats.estimate_ms) {
|
||||
if (jb->channel) {
|
||||
switch_channel_set_variable_printf(jb->channel, "rtp_jb_size_max_ms", "%u", jb->jitter.stats.size_max * packet_ms);
|
||||
switch_channel_set_variable_printf(jb->channel, "rtp_jb_size_est_ms", "%u", jb->jitter.stats.size_est * packet_ms);
|
||||
switch_channel_set_variable_printf(jb->channel, "rtp_jb_acceleration_ms", "%u", jb->jitter.stats.acceleration * packet_ms);
|
||||
switch_channel_set_variable_printf(jb->channel, "rtp_jb_expand_ms", "%u", jb->jitter.stats.expand * packet_ms);
|
||||
}
|
||||
|
||||
if (jb->jitter.stats.jitter_max_ms < jb->jitter.stats.estimate_ms) {
|
||||
jb->jitter.stats.jitter_max_ms = jb->jitter.stats.estimate_ms;
|
||||
}
|
||||
switch_channel_set_variable_printf(jb->channel, "rtp_jb_jitter_max_ms", "%u", jb->jitter.stats.jitter_max_ms);
|
||||
switch_channel_set_variable_printf(jb->channel, "rtp_jb_jitter_est_ms", "%u", jb->jitter.stats.estimate_ms);
|
||||
|
||||
if (jb->channel) {
|
||||
switch_channel_set_variable_printf(jb->channel, "rtp_jb_jitter_max_ms", "%u", jb->jitter.stats.jitter_max_ms);
|
||||
switch_channel_set_variable_printf(jb->channel, "rtp_jb_jitter_est_ms", "%u", jb->jitter.stats.estimate_ms);
|
||||
}
|
||||
}
|
||||
|
||||
if (old) {
|
||||
sort_free_nodes(jb);
|
||||
}
|
||||
|
||||
switch_mutex_unlock(jb->list_mutex);
|
||||
jb_debug(jb, SWITCH_LOG_INFO, "JITTER buffersize %u == %u old[%u] target[%u] seq[%u|%u]\n", count, h_seq-l_seq+1, old, ntohs(jb->target_seq), l_seq, h_seq);
|
||||
|
||||
jb_debug(jb, SWITCH_LOG_INFO, "JITTER buffersize %u == %u old[%u] target[%u] seq[%u|%u]\n", count, h_seq - l_seq + 1, old, target_seq_hs, l_seq, h_seq);
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static inline switch_status_t jb_next_packet_by_seq_with_acceleration(switch_jb_t *jb, switch_jb_node_t **nodep)
|
||||
{
|
||||
switch_status_t status = jb_next_packet_by_seq(jb, nodep);
|
||||
switch_rtp_packet_t *packet;
|
||||
uint32_t len;
|
||||
uint16_t seq = ntohs(jb->target_seq);
|
||||
switch_status_t status = jb_next_packet_by_seq(jb, nodep);
|
||||
switch_rtp_packet_t *packet;
|
||||
uint32_t len;
|
||||
uint16_t seq = ntohs(jb->target_seq);
|
||||
|
||||
/* When using a Codec that provides voice activity detection ex. Opus, use it to
|
||||
select packet to drop/accelerate. */
|
||||
/* When using a Codec that provides voice activity detection ex. Opus, use it to
|
||||
select packet to drop/accelerate. */
|
||||
|
||||
if (jb->elastic && jb->jitter.estimate && (jb->visible_nodes*jb->jitter.samples_per_frame)>0 && jb->jitter.samples_per_second) {
|
||||
int visible_not_old = check_jb_size(jb);
|
||||
jb->jitter.stats.estimate_ms = (int)((*jb->jitter.estimate)/((jb->jitter.samples_per_second))*1000);
|
||||
jb->jitter.stats.buffer_size_ms = (int)((visible_not_old*jb->jitter.samples_per_frame)/(jb->jitter.samples_per_second/1000));
|
||||
if (jb->elastic && jb->jitter.estimate && (jb->visible_nodes * jb->jitter.samples_per_frame) > 0 && jb->jitter.samples_per_second) {
|
||||
int visible_not_old = check_jb_size(jb);
|
||||
|
||||
// We try to accelerate in order to remove delay when the jitter buffer is 3x larger than the estimation.
|
||||
if (jb->jitter.stats.buffer_size_ms > (3*jb->jitter.stats.estimate_ms) && jb->jitter.stats.buffer_size_ms > 60) {
|
||||
if (status == SWITCH_STATUS_SUCCESS) {
|
||||
packet = &(*nodep)->packet;
|
||||
seq = ntohs((*nodep)->packet.header.seq);
|
||||
len = (*nodep)->len;
|
||||
}
|
||||
if (jb->jitter.drop_gap > 0) {
|
||||
jb_debug(jb, SWITCH_LOG_INFO, "JITTER estimation %dms buffersize %d/%d %dms seq:%u [drop-gap][%d]\n",
|
||||
jb->jitter.stats.estimate_ms, jb->complete_frames , jb->frame_len, jb->jitter.stats.buffer_size_ms, seq, jb->jitter.drop_gap);
|
||||
jb->jitter.drop_gap--;
|
||||
} else {
|
||||
if (status != SWITCH_STATUS_SUCCESS || packet_vad(jb, packet, len) == SWITCH_FALSE) {
|
||||
jb->jitter.drop_gap = 3;
|
||||
if (status != SWITCH_STATUS_SUCCESS) {
|
||||
jb_debug(jb, SWITCH_LOG_INFO, "JITTER estimation n/a buffersize %d/%d %dms seq:%u [drop-missing/no-plc]\n",
|
||||
jb->complete_frames , jb->frame_len, jb->jitter.stats.buffer_size_ms, seq);
|
||||
} else {
|
||||
jb_debug(jb, SWITCH_LOG_INFO, "JITTER estimation %dms buffersize %d/%d %dms seq:%u ACCELERATE [drop]\n",
|
||||
jb->jitter.stats.estimate_ms, jb->complete_frames , jb->frame_len, jb->jitter.stats.buffer_size_ms, seq);
|
||||
}
|
||||
jb->jitter.stats.acceleration++;
|
||||
return jb_next_packet_by_seq(jb, nodep);
|
||||
} else {
|
||||
jb_debug(jb, SWITCH_LOG_INFO, "JITTER estimation %dms buffersize %d/%d %dms seq:%u [drop-skip-vad]\n",
|
||||
jb->jitter.stats.estimate_ms, jb->complete_frames , jb->frame_len, jb->jitter.stats.buffer_size_ms, seq);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
jb_debug(jb, 2, "JITTER estimation %dms buffersize %d/%d %dms\n",
|
||||
jb->jitter.stats.estimate_ms, jb->complete_frames , jb->frame_len, jb->jitter.stats.buffer_size_ms);
|
||||
jb->jitter.stats.estimate_ms = (int)((*jb->jitter.estimate) / ((jb->jitter.samples_per_second)) * 1000);
|
||||
jb->jitter.stats.buffer_size_ms = (int)((visible_not_old * jb->jitter.samples_per_frame) / (jb->jitter.samples_per_second / 1000));
|
||||
|
||||
/* We try to accelerate in order to remove delay when the jitter buffer is 3x larger than the estimation. */
|
||||
if (jb->jitter.stats.buffer_size_ms > (3 * jb->jitter.stats.estimate_ms) && jb->jitter.stats.buffer_size_ms > 60) {
|
||||
if (status == SWITCH_STATUS_SUCCESS) {
|
||||
packet = &(*nodep)->packet;
|
||||
seq = ntohs((*nodep)->packet.header.seq);
|
||||
len = (*nodep)->len;
|
||||
}
|
||||
|
||||
if (jb->jitter.drop_gap > 0) {
|
||||
jb_debug(jb, SWITCH_LOG_INFO, "JITTER estimation %dms buffersize %d/%d %dms seq:%u [drop-gap][%d]\n",
|
||||
jb->jitter.stats.estimate_ms, jb->complete_frames, jb->frame_len, jb->jitter.stats.buffer_size_ms, seq, jb->jitter.drop_gap);
|
||||
jb->jitter.drop_gap--;
|
||||
} else {
|
||||
if (status != SWITCH_STATUS_SUCCESS || packet_vad(jb, packet, len) == SWITCH_FALSE) {
|
||||
jb->jitter.drop_gap = 3;
|
||||
if (status != SWITCH_STATUS_SUCCESS) {
|
||||
jb_debug(jb, SWITCH_LOG_INFO, "JITTER estimation n/a buffersize %d/%d %dms seq:%u [drop-missing/no-plc]\n",
|
||||
jb->complete_frames, jb->frame_len, jb->jitter.stats.buffer_size_ms, seq);
|
||||
} else {
|
||||
jb_debug(jb, SWITCH_LOG_INFO, "JITTER estimation %dms buffersize %d/%d %dms seq:%u ACCELERATE [drop]\n",
|
||||
jb->jitter.stats.estimate_ms, jb->complete_frames, jb->frame_len, jb->jitter.stats.buffer_size_ms, seq);
|
||||
}
|
||||
|
||||
jb->jitter.stats.acceleration++;
|
||||
|
||||
return jb_next_packet_by_seq(jb, nodep);
|
||||
} else {
|
||||
jb_debug(jb, SWITCH_LOG_INFO, "JITTER estimation %dms buffersize %d/%d %dms seq:%u [drop-skip-vad]\n",
|
||||
jb->jitter.stats.estimate_ms, jb->complete_frames, jb->frame_len, jb->jitter.stats.buffer_size_ms, seq);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
jb_debug(jb, 2, "JITTER estimation %dms buffersize %d/%d %dms\n",
|
||||
jb->jitter.stats.estimate_ms, jb->complete_frames, jb->frame_len, jb->jitter.stats.buffer_size_ms);
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
static inline switch_status_t jb_next_packet(switch_jb_t *jb, switch_jb_node_t **nodep)
|
||||
{
|
||||
if (jb->samples_per_frame) {
|
||||
return jb_next_packet_by_ts(jb, nodep);
|
||||
} else {
|
||||
switch_status_t status;
|
||||
if (jb->elastic && jb->jitter.estimate) {
|
||||
status = jb_next_packet_by_seq_with_acceleration(jb, nodep);
|
||||
} else {
|
||||
status = jb_next_packet_by_seq(jb, nodep);
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
if (jb->elastic && jb->jitter.estimate) {
|
||||
return jb_next_packet_by_seq_with_acceleration(jb, nodep);
|
||||
}
|
||||
|
||||
return jb_next_packet_by_seq(jb, nodep);
|
||||
}
|
||||
|
||||
static inline void free_nodes(switch_jb_t *jb)
|
||||
|
@ -1055,21 +1079,24 @@ SWITCH_DECLARE(void) switch_jb_ts_mode(switch_jb_t *jb, uint32_t samples_per_fra
|
|||
SWITCH_DECLARE(void) switch_jb_set_jitter_estimator(switch_jb_t *jb, double *jitter, uint32_t samples_per_frame, uint32_t samples_per_second)
|
||||
{
|
||||
if (jb && jitter) {
|
||||
memset(&jb->jitter,0,sizeof(switch_jb_jitter_t));
|
||||
switch_channel_set_variable_printf(jb->channel, "rtp_jb_max_ms", "%u", 0);
|
||||
switch_channel_set_variable_printf(jb->channel, "rtp_jb_size_ms", "%u", 0);
|
||||
switch_channel_set_variable_printf(jb->channel, "rtp_jb_acceleration_ms", "%u", 0);
|
||||
switch_channel_set_variable_printf(jb->channel, "rtp_jb_expand_ms", "%u", 0);
|
||||
switch_channel_set_variable_printf(jb->channel, "rtp_jb_jitter_max_ms", "%u", 0);
|
||||
switch_channel_set_variable_printf(jb->channel, "rtp_jb_jitter_ms", "%u", 0);
|
||||
switch_channel_set_variable_printf(jb->channel, "rtp_jb_reset_count", "%u", 0);
|
||||
switch_channel_set_variable_printf(jb->channel, "rtp_jb_reset_too_big", "%u", 0);
|
||||
switch_channel_set_variable_printf(jb->channel, "rtp_jb_reset_missing_frames", "%u", 0);
|
||||
switch_channel_set_variable_printf(jb->channel, "rtp_jb_reset_ts_jump", "%u", 0);
|
||||
switch_channel_set_variable_printf(jb->channel, "rtp_jb_reset_error", "%u", 0);
|
||||
memset(&jb->jitter, 0, sizeof(switch_jb_jitter_t));
|
||||
if (jb->channel) {
|
||||
switch_channel_set_variable_printf(jb->channel, "rtp_jb_max_ms", "%u", 0);
|
||||
switch_channel_set_variable_printf(jb->channel, "rtp_jb_size_ms", "%u", 0);
|
||||
switch_channel_set_variable_printf(jb->channel, "rtp_jb_acceleration_ms", "%u", 0);
|
||||
switch_channel_set_variable_printf(jb->channel, "rtp_jb_expand_ms", "%u", 0);
|
||||
switch_channel_set_variable_printf(jb->channel, "rtp_jb_jitter_max_ms", "%u", 0);
|
||||
switch_channel_set_variable_printf(jb->channel, "rtp_jb_jitter_ms", "%u", 0);
|
||||
switch_channel_set_variable_printf(jb->channel, "rtp_jb_reset_count", "%u", 0);
|
||||
switch_channel_set_variable_printf(jb->channel, "rtp_jb_reset_too_big", "%u", 0);
|
||||
switch_channel_set_variable_printf(jb->channel, "rtp_jb_reset_missing_frames", "%u", 0);
|
||||
switch_channel_set_variable_printf(jb->channel, "rtp_jb_reset_ts_jump", "%u", 0);
|
||||
switch_channel_set_variable_printf(jb->channel, "rtp_jb_reset_error", "%u", 0);
|
||||
}
|
||||
|
||||
jb->jitter.estimate = jitter;
|
||||
jb->jitter.samples_per_frame = samples_per_frame;
|
||||
jb->jitter.samples_per_second = samples_per_second;
|
||||
jb->jitter.samples_per_second = samples_per_second;
|
||||
jb->jitter.drop_gap = 5;
|
||||
}
|
||||
}
|
||||
|
@ -1083,22 +1110,22 @@ SWITCH_DECLARE(void) switch_jb_set_session(switch_jb_t *jb, switch_core_session_
|
|||
jb->session = session;
|
||||
jb->channel = switch_core_session_get_channel(session);
|
||||
if (!strcmp(jb->codec->implementation->iananame, "opus")) {
|
||||
if (switch_true(switch_channel_get_variable(jb->channel, "rtp_jitter_buffer_accelerate"))) {
|
||||
if (switch_channel_var_true(jb->channel, "rtp_jitter_buffer_accelerate")) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "codec is %s, accelerate on\n", jb->codec->implementation->iananame);
|
||||
jb->elastic = SWITCH_TRUE;
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "codec is %s, accelerate off\n", jb->codec->implementation->iananame);
|
||||
jb->elastic = SWITCH_FALSE;
|
||||
}
|
||||
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "codec not opus: %s\n", jb->codec->implementation->iananame);
|
||||
jb->elastic = SWITCH_FALSE;
|
||||
}
|
||||
|
||||
if (jb->type == SJB_VIDEO && !switch_test_flag(jb, SJB_QUEUE_ONLY) &&
|
||||
if (jb->type == SJB_VIDEO && !switch_test_flag(jb, SJB_QUEUE_ONLY) &&
|
||||
(var = switch_channel_get_variable_dup(jb->channel, "jb_video_low_bitrate", SWITCH_FALSE, -1))) {
|
||||
int tmp = atoi(var);
|
||||
|
||||
if (tmp >= 128 && tmp <= 10240) {
|
||||
jb->video_low_bitrate = (uint32_t)tmp;
|
||||
}
|
||||
|
@ -1145,11 +1172,13 @@ SWITCH_DECLARE(void) switch_jb_debug_level(switch_jb_t *jb, uint8_t level)
|
|||
SWITCH_DECLARE(void) switch_jb_reset(switch_jb_t *jb)
|
||||
{
|
||||
jb->jitter.stats.reset++;
|
||||
switch_channel_set_variable_printf(jb->channel, "rtp_jb_reset_count", "%u", jb->jitter.stats.reset);
|
||||
switch_channel_set_variable_printf(jb->channel, "rtp_jb_reset_too_big", "%u", jb->jitter.stats.reset_too_big);
|
||||
switch_channel_set_variable_printf(jb->channel, "rtp_jb_reset_missing_frames", "%u", jb->jitter.stats.reset_missing_frames);
|
||||
switch_channel_set_variable_printf(jb->channel, "rtp_jb_reset_ts_jump", "%u", jb->jitter.stats.reset_ts_jump);
|
||||
switch_channel_set_variable_printf(jb->channel, "rtp_jb_reset_error", "%u", jb->jitter.stats.reset_error);
|
||||
if (jb->channel) {
|
||||
switch_channel_set_variable_printf(jb->channel, "rtp_jb_reset_count", "%u", jb->jitter.stats.reset);
|
||||
switch_channel_set_variable_printf(jb->channel, "rtp_jb_reset_too_big", "%u", jb->jitter.stats.reset_too_big);
|
||||
switch_channel_set_variable_printf(jb->channel, "rtp_jb_reset_missing_frames", "%u", jb->jitter.stats.reset_missing_frames);
|
||||
switch_channel_set_variable_printf(jb->channel, "rtp_jb_reset_ts_jump", "%u", jb->jitter.stats.reset_ts_jump);
|
||||
switch_channel_set_variable_printf(jb->channel, "rtp_jb_reset_error", "%u", jb->jitter.stats.reset_error);
|
||||
}
|
||||
|
||||
if (jb->type == SJB_VIDEO) {
|
||||
switch_mutex_lock(jb->mutex);
|
||||
|
@ -1161,13 +1190,13 @@ SWITCH_DECLARE(void) switch_jb_reset(switch_jb_t *jb)
|
|||
switch_core_session_request_video_refresh(jb->session);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
jb_debug(jb, 2, "%s", "RESET BUFFER\n");
|
||||
|
||||
switch_mutex_lock(jb->mutex);
|
||||
hide_nodes(jb);
|
||||
switch_mutex_unlock(jb->mutex);
|
||||
|
||||
|
||||
jb->drop_flag = 0;
|
||||
jb->last_target_seq = 0;
|
||||
jb->target_seq = 0;
|
||||
|
@ -1478,7 +1507,6 @@ SWITCH_DECLARE(switch_status_t) switch_jb_put_packet(switch_jb_t *jb, switch_rtp
|
|||
jb->jitter.stats.reset_missing_frames++;
|
||||
switch_jb_reset(jb);
|
||||
} else {
|
||||
|
||||
if (jb->type != SJB_VIDEO && jb->frame_len < got - want) {
|
||||
jb_frame_inc(jb, 1);
|
||||
}
|
||||
|
@ -1666,12 +1694,13 @@ SWITCH_DECLARE(switch_status_t) switch_jb_get_packet(switch_jb_t *jb, switch_rtp
|
|||
} else {
|
||||
if (jb->elastic) {
|
||||
int visible_not_old = check_jb_size(jb);
|
||||
jb->jitter.stats.estimate_ms = (int)((*jb->jitter.estimate)/((jb->jitter.samples_per_second))*1000);
|
||||
jb->jitter.stats.buffer_size_ms = (int)((visible_not_old*jb->jitter.samples_per_frame)/(jb->jitter.samples_per_second/1000));
|
||||
|
||||
jb->jitter.stats.estimate_ms = (int)((*jb->jitter.estimate) / ((jb->jitter.samples_per_second)) * 1000);
|
||||
jb->jitter.stats.buffer_size_ms = (int)((visible_not_old * jb->jitter.samples_per_frame) / (jb->jitter.samples_per_second / 1000));
|
||||
/* When playing PLC, we take the oportunity to expand the buffer if the jitter buffer is smaller than the 3x the estimated jitter. */
|
||||
if (jb->jitter.stats.buffer_size_ms < (3*jb->jitter.stats.estimate_ms)) {
|
||||
if (jb->jitter.stats.buffer_size_ms < (3 * jb->jitter.stats.estimate_ms)) {
|
||||
jb_debug(jb, SWITCH_LOG_INFO, "JITTER estimation %dms buffersize %d/%d %dms EXPAND [plc]\n",
|
||||
jb->jitter.stats.estimate_ms, jb->complete_frames , jb->frame_len, jb->jitter.stats.buffer_size_ms);
|
||||
jb->jitter.stats.estimate_ms, jb->complete_frames, jb->frame_len, jb->jitter.stats.buffer_size_ms);
|
||||
jb->jitter.stats.expand++;
|
||||
decrement_seq(jb);
|
||||
} else {
|
||||
|
@ -1680,6 +1709,7 @@ SWITCH_DECLARE(switch_status_t) switch_jb_get_packet(switch_jb_t *jb, switch_rtp
|
|||
} else {
|
||||
jb_debug(jb, 2, "%s", "Frame not found suggest PLC\n");
|
||||
}
|
||||
|
||||
plc = 1;
|
||||
switch_goto_status(SWITCH_STATUS_NOTFOUND, end);
|
||||
}
|
||||
|
|
|
@ -115,12 +115,11 @@ static void *SWITCH_THREAD_FUNC switch_loadable_module_exec(switch_thread_t *thr
|
|||
switch_status_t status = SWITCH_STATUS_SUCCESS;
|
||||
switch_core_thread_session_t *ts = obj;
|
||||
switch_loadable_module_t *module = ts->objs[0];
|
||||
int restarts;
|
||||
|
||||
switch_assert(thread != NULL);
|
||||
switch_assert(module != NULL);
|
||||
|
||||
for (restarts = 0; status != SWITCH_STATUS_TERM && !module->shutting_down; restarts++) {
|
||||
while (status != SWITCH_STATUS_TERM && !module->shutting_down) {
|
||||
status = module->switch_module_runtime();
|
||||
}
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Thread ended for %s\n", module->module_interface->module_name);
|
||||
|
|
|
@ -246,7 +246,7 @@ SWITCH_DECLARE(cJSON *) switch_log_node_to_json(const switch_log_node_t *node, i
|
|||
return json;
|
||||
}
|
||||
|
||||
static switch_log_node_t *switch_log_node_alloc()
|
||||
static switch_log_node_t *switch_log_node_alloc(void)
|
||||
{
|
||||
switch_log_node_t *node = NULL;
|
||||
#ifdef SWITCH_LOG_RECYCLE
|
||||
|
|
|
@ -99,7 +99,7 @@ static switch_bool_t msrp_check_success_report(switch_msrp_msg_t *msrp_msg)
|
|||
return (msrp_h_success_report && !strcmp(msrp_h_success_report, "yes"));
|
||||
}
|
||||
|
||||
static void msrp_deinit_ssl()
|
||||
static void msrp_deinit_ssl(void)
|
||||
{
|
||||
globals.ssl_ready = 0;
|
||||
if (globals.ssl_ctx) {
|
||||
|
@ -112,7 +112,7 @@ static void msrp_deinit_ssl()
|
|||
}
|
||||
}
|
||||
|
||||
static void msrp_init_ssl()
|
||||
static void msrp_init_ssl(void)
|
||||
{
|
||||
const char *err = "";
|
||||
|
||||
|
@ -187,7 +187,7 @@ static void msrp_init_ssl()
|
|||
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_ip, globals.ip);
|
||||
|
||||
static switch_status_t load_config()
|
||||
static switch_status_t load_config(void)
|
||||
{
|
||||
char *cf = "msrp.conf";
|
||||
switch_xml_t cfg, xml = NULL, settings, param;
|
||||
|
@ -286,12 +286,12 @@ sock_fail:
|
|||
return rv;
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(const char *) switch_msrp_listen_ip()
|
||||
SWITCH_DECLARE(const char *) switch_msrp_listen_ip(void)
|
||||
{
|
||||
return globals.ip;
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_msrp_init()
|
||||
SWITCH_DECLARE(switch_status_t) switch_msrp_init(void)
|
||||
{
|
||||
switch_memory_pool_t *pool;
|
||||
switch_thread_t *thread;
|
||||
|
@ -346,7 +346,7 @@ SWITCH_DECLARE(switch_status_t) switch_msrp_init()
|
|||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_msrp_destroy()
|
||||
SWITCH_DECLARE(switch_status_t) switch_msrp_destroy(void)
|
||||
{
|
||||
switch_status_t st = SWITCH_STATUS_SUCCESS;
|
||||
switch_socket_t *sock;
|
||||
|
@ -1622,7 +1622,7 @@ SWITCH_DECLARE (switch_status_t) switch_msrp_perform_send(switch_msrp_session_t
|
|||
return status;
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(switch_msrp_msg_t *) switch_msrp_msg_create()
|
||||
SWITCH_DECLARE(switch_msrp_msg_t *) switch_msrp_msg_create(void)
|
||||
{
|
||||
switch_msrp_msg_t *msg = malloc(sizeof(switch_msrp_msg_t));
|
||||
switch_assert(msg);
|
||||
|
|
|
@ -265,7 +265,7 @@ SWITCH_DECLARE(switch_status_t) switch_packetizer_feed(switch_packetizer_t *pack
|
|||
context->nalus[i].eat = p;
|
||||
} else {
|
||||
context->nalus[i].len = p - context->nalus[i].start;
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "#%d %x len=%u\n", i, *context->nalus[i].start, context->nalus[i].len);
|
||||
//switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "#%d %x len=%u\n", i, *context->nalus[i].start, context->nalus[i].len);
|
||||
while (!(*p++)) ; /* eat the sync bytes, what ever 0 0 1 or 0 0 0 1 */
|
||||
i++;
|
||||
context->nalus[i].start = p;
|
||||
|
@ -307,8 +307,8 @@ SWITCH_DECLARE(switch_status_t) switch_packetizer_read(switch_packetizer_t *pack
|
|||
nri = nalu_hdr & 0x60;
|
||||
|
||||
if (real_slice_size > slice_size) real_slice_size = slice_size;
|
||||
if (frame->buflen < slice_size) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "frame buffer too small %u < %u\n", frame->buflen, slice_size);
|
||||
if (frame->datalen < slice_size) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "frame buffer too small %u < %u\n", frame->datalen, slice_size);
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -262,8 +262,8 @@ typedef struct {
|
|||
|
||||
struct switch_rtp;
|
||||
|
||||
static void switch_rtp_dtls_init();
|
||||
static void switch_rtp_dtls_destroy();
|
||||
static void switch_rtp_dtls_init(void);
|
||||
static void switch_rtp_dtls_destroy(void);
|
||||
|
||||
#define MAX_DTLS_MTU 4096
|
||||
|
||||
|
@ -1660,7 +1660,7 @@ static void rtcp_generate_sender_info(switch_rtp_t *rtp_session, struct switch_r
|
|||
);
|
||||
}
|
||||
|
||||
static inline uint32_t calc_local_lsr_now()
|
||||
static inline uint32_t calc_local_lsr_now(void)
|
||||
{
|
||||
switch_time_t now;
|
||||
uint32_t ntp_sec, ntp_usec, lsr_now, sec;
|
||||
|
@ -3493,7 +3493,7 @@ static BIO_METHOD dtls_bio_filter_methods = {
|
|||
static BIO_METHOD *dtls_bio_filter_methods = NULL;
|
||||
#endif
|
||||
|
||||
static void switch_rtp_dtls_init() {
|
||||
static void switch_rtp_dtls_init(void) {
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
|
||||
dtls_bio_filter_methods = BIO_meth_new(BIO_TYPE_FILTER | BIO_get_new_index(), "DTLS filter");
|
||||
BIO_meth_set_write(dtls_bio_filter_methods, dtls_bio_filter_write);
|
||||
|
@ -3503,7 +3503,7 @@ static void switch_rtp_dtls_init() {
|
|||
#endif
|
||||
}
|
||||
|
||||
static void switch_rtp_dtls_destroy() {
|
||||
static void switch_rtp_dtls_destroy(void) {
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
|
||||
if (dtls_bio_filter_methods) {
|
||||
BIO_meth_free(dtls_bio_filter_methods);
|
||||
|
@ -3642,8 +3642,10 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_dtls(switch_rtp_t *rtp_session, d
|
|||
unsigned long ssl_ctx_error = 0;
|
||||
const SSL_METHOD *ssl_method;
|
||||
SSL_CTX *ssl_ctx;
|
||||
#if OPENSSL_VERSION_NUMBER < 0x30000000
|
||||
BIO *bio;
|
||||
DH *dh;
|
||||
#endif
|
||||
switch_status_t status = SWITCH_STATUS_SUCCESS;
|
||||
#ifndef OPENSSL_NO_EC
|
||||
#if OPENSSL_VERSION_NUMBER < 0x10002000L
|
||||
|
@ -3722,6 +3724,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_dtls(switch_rtp_t *rtp_session, d
|
|||
|
||||
switch_assert(dtls->ssl_ctx);
|
||||
|
||||
#if OPENSSL_VERSION_NUMBER < 0x30000000
|
||||
bio = BIO_new_file(dtls->pem, "r");
|
||||
dh = PEM_read_bio_DHparams(bio, NULL, NULL, NULL);
|
||||
BIO_free(bio);
|
||||
|
@ -3729,7 +3732,11 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_dtls(switch_rtp_t *rtp_session, d
|
|||
SSL_CTX_set_tmp_dh(dtls->ssl_ctx, dh);
|
||||
DH_free(dh);
|
||||
}
|
||||
|
||||
#else
|
||||
if(!SSL_CTX_set_dh_auto(dtls->ssl_ctx, 1)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_ERROR, "Failed enable auto DH!\n");
|
||||
}
|
||||
#endif
|
||||
SSL_CTX_set_mode(dtls->ssl_ctx, SSL_MODE_AUTO_RETRY);
|
||||
|
||||
//SSL_CTX_set_verify(dtls->ssl_ctx, SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT, NULL);
|
||||
|
@ -3934,12 +3941,6 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_crypto_key(switch_rtp_t *rtp_sess
|
|||
case SWITCH_RTP_CRYPTO_RECV:
|
||||
switch_channel_set_variable(channel, "srtp_remote_crypto_key", (const char *)b64_key);
|
||||
break;
|
||||
case SWITCH_RTP_CRYPTO_SEND_RTCP:
|
||||
switch_channel_set_variable(channel, "srtcp_local_crypto_key", (const char *)b64_key);
|
||||
break;
|
||||
case SWITCH_RTP_CRYPTO_RECV_RTCP:
|
||||
switch_channel_set_variable(channel, "srtcp_remote_crypto_key", (const char *)b64_key);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -3952,12 +3953,6 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_crypto_key(switch_rtp_t *rtp_sess
|
|||
case SWITCH_RTP_CRYPTO_RECV:
|
||||
switch_channel_set_variable(channel, "srtp_remote_video_crypto_key", (const char *)b64_key);
|
||||
break;
|
||||
case SWITCH_RTP_CRYPTO_SEND_RTCP:
|
||||
switch_channel_set_variable(channel, "srtcp_local_video_crypto_key", (const char *)b64_key);
|
||||
break;
|
||||
case SWITCH_RTP_CRYPTO_RECV_RTCP:
|
||||
switch_channel_set_variable(channel, "srtcp_remote_video_crypto_key", (const char *)b64_key);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -3970,12 +3965,6 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_crypto_key(switch_rtp_t *rtp_sess
|
|||
case SWITCH_RTP_CRYPTO_RECV:
|
||||
switch_channel_set_variable(channel, "srtp_remote_audio_crypto_key", (const char *)b64_key);
|
||||
break;
|
||||
case SWITCH_RTP_CRYPTO_SEND_RTCP:
|
||||
switch_channel_set_variable(channel, "srtcp_local_audio_crypto_key", (const char *)b64_key);
|
||||
break;
|
||||
case SWITCH_RTP_CRYPTO_RECV_RTCP:
|
||||
switch_channel_set_variable(channel, "srtcp_remote_audio_crypto_key", (const char *)b64_key);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -5494,7 +5483,6 @@ static switch_size_t do_flush(switch_rtp_t *rtp_session, int force, switch_size_
|
|||
{
|
||||
int was_blocking = 0;
|
||||
switch_size_t bytes;
|
||||
uint32_t flushed = 0;
|
||||
switch_size_t bytes_out = 0;
|
||||
|
||||
if (!switch_rtp_ready(rtp_session)) {
|
||||
|
@ -5576,8 +5564,6 @@ static switch_size_t do_flush(switch_rtp_t *rtp_session, int force, switch_size_
|
|||
#endif
|
||||
}
|
||||
|
||||
flushed++;
|
||||
|
||||
rtp_session->stats.inbound.raw_bytes += bytes;
|
||||
rtp_session->stats.inbound.flush_packet_count++;
|
||||
rtp_session->stats.inbound.packet_count++;
|
||||
|
|
|
@ -470,7 +470,7 @@ static switch_status_t switch_speex_destroy(switch_codec_t *codec)
|
|||
/**
|
||||
* read default settings from speex.conf
|
||||
*/
|
||||
static void load_configuration()
|
||||
static void load_configuration(void)
|
||||
{
|
||||
switch_xml_t xml = NULL, cfg = NULL;
|
||||
|
||||
|
|
|
@ -1173,9 +1173,8 @@ SWITCH_MODULE_RUNTIME_FUNCTION(softtimer_runtime)
|
|||
} else {
|
||||
if (tfd > -1 && globals.RUNNING == 1) {
|
||||
uint64_t exp;
|
||||
int r;
|
||||
r = read(tfd, &exp, sizeof(exp));
|
||||
r++;
|
||||
read(tfd, &exp, sizeof(exp));
|
||||
(void)exp;
|
||||
} else {
|
||||
switch_time_t timediff = runtime.reference - ts;
|
||||
|
||||
|
|
|
@ -139,13 +139,10 @@ struct switch_frame_buffer_s {
|
|||
static switch_frame_t *find_free_frame(switch_frame_buffer_t *fb, switch_frame_t *orig)
|
||||
{
|
||||
switch_frame_node_t *np;
|
||||
int x = 0;
|
||||
|
||||
switch_mutex_lock(fb->mutex);
|
||||
|
||||
for (np = fb->head; np; np = np->next) {
|
||||
x++;
|
||||
|
||||
if (!np->inuse && ((orig->packet && np->frame->packet) || (!orig->packet && !np->frame->packet))) {
|
||||
|
||||
if (np == fb->head) {
|
||||
|
@ -1610,6 +1607,30 @@ SWITCH_DECLARE(char *) switch_separate_paren_args(char *str)
|
|||
return args;
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(switch_bool_t) switch_is_uint_in_range(const char *str, unsigned int from, unsigned int to)
|
||||
{
|
||||
unsigned int number;
|
||||
const char *original_str = str;
|
||||
|
||||
if (str == NULL || *str == '\0' || from > to) {
|
||||
return SWITCH_FALSE;
|
||||
}
|
||||
|
||||
for (; *str != '\0'; str++) {
|
||||
if (!isdigit(*str)) {
|
||||
return SWITCH_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
number = atoi(original_str);
|
||||
|
||||
if (number < from || number > to) {
|
||||
return SWITCH_FALSE;
|
||||
}
|
||||
|
||||
return SWITCH_TRUE;
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(switch_bool_t) switch_is_number(const char *str)
|
||||
{
|
||||
const char *p;
|
||||
|
@ -2383,7 +2404,7 @@ SWITCH_DECLARE(int) switch_cmp_addr(switch_sockaddr_t *sa1, switch_sockaddr_t *s
|
|||
return (s1->sin_addr.s_addr == s2->sin_addr.s_addr && s1->sin_port == s2->sin_port);
|
||||
}
|
||||
case AF_INET6:
|
||||
if (s16->sin6_addr.s6_addr && s26->sin6_addr.s6_addr) {
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!ip_only) {
|
||||
|
@ -2437,7 +2458,7 @@ SWITCH_DECLARE(int) switch_cp_addr(switch_sockaddr_t *sa1, switch_sockaddr_t *sa
|
|||
|
||||
return 1;
|
||||
case AF_INET6:
|
||||
if (s16->sin6_addr.s6_addr && s26->sin6_addr.s6_addr) {
|
||||
{
|
||||
int i;
|
||||
|
||||
s16->sin6_port = s26->sin6_port;
|
||||
|
|
|
@ -1853,7 +1853,7 @@ static void parse_codecs(my_vpx_cfg_t *my_cfg, switch_xml_t codecs)
|
|||
}
|
||||
}
|
||||
|
||||
static void load_config()
|
||||
static void load_config(void)
|
||||
{
|
||||
switch_xml_t cfg = NULL, xml = NULL;
|
||||
my_vpx_cfg_t *my_cfg = NULL;
|
||||
|
|
|
@ -550,15 +550,22 @@ SWITCH_DECLARE(const char **) switch_xml_pi(switch_xml_t xml, const char *target
|
|||
switch_xml_root_t root = (switch_xml_root_t) xml;
|
||||
int i = 0;
|
||||
|
||||
if (!root)
|
||||
if (!root) {
|
||||
return (const char **) SWITCH_XML_NIL;
|
||||
while (root->xml.parent)
|
||||
}
|
||||
|
||||
while (root && root->xml.parent) {
|
||||
root = (switch_xml_root_t) root->xml.parent; /* root tag */
|
||||
}
|
||||
|
||||
if (!root || !root->pi) {
|
||||
return (const char **) SWITCH_XML_NIL;
|
||||
}
|
||||
while (root->pi[i] && strcmp(target, root->pi[i][0]))
|
||||
|
||||
while (root->pi[i] && strcmp(target, root->pi[i][0])) {
|
||||
i++; /* find target */
|
||||
}
|
||||
|
||||
return (const char **) ((root->pi[i]) ? root->pi[i] + 1 : SWITCH_XML_NIL);
|
||||
}
|
||||
|
||||
|
@ -1146,7 +1153,7 @@ SWITCH_DECLARE(switch_xml_t) switch_xml_parse_str(char *s, switch_size_t len)
|
|||
return switch_xml_err(root, d, "unclosed <!--");
|
||||
} else if (!strncmp(s, "![CDATA[", 8)) { /* cdata */
|
||||
if ((s = strstr(s, "]]>"))) {
|
||||
if (root && root->cur) {
|
||||
if (root->cur) {
|
||||
root->cur->flags |= SWITCH_XML_CDATA;
|
||||
}
|
||||
switch_xml_char_content(root, d + 8, (s += 2) - d - 10, 'c');
|
||||
|
@ -1213,10 +1220,18 @@ SWITCH_DECLARE(switch_xml_t) switch_xml_parse_fp(FILE * fp)
|
|||
}
|
||||
} while (s && l == SWITCH_XML_BUFSIZE);
|
||||
|
||||
if (!s)
|
||||
if (!s) {
|
||||
return NULL;
|
||||
root = (switch_xml_root_t) switch_xml_parse_str(s, len);
|
||||
}
|
||||
|
||||
if (!(root = (switch_xml_root_t) switch_xml_parse_str(s, len))) {
|
||||
free(s);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
root->dynamic = 1; /* so we know to free s in switch_xml_free() */
|
||||
|
||||
return &root->xml;
|
||||
}
|
||||
|
||||
|
@ -1232,9 +1247,8 @@ SWITCH_DECLARE(switch_xml_t) switch_xml_parse_fd(int fd)
|
|||
|
||||
if (fd < 0)
|
||||
return NULL;
|
||||
fstat(fd, &st);
|
||||
|
||||
if (!st.st_size) {
|
||||
if (fstat(fd, &st) == -1 || !st.st_size) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -1243,8 +1257,10 @@ SWITCH_DECLARE(switch_xml_t) switch_xml_parse_fd(int fd)
|
|||
if (!(0<(l = read(fd, m, st.st_size)))
|
||||
|| !(root = (switch_xml_root_t) switch_xml_parse_str((char *) m, l))) {
|
||||
free(m);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
root->dynamic = 1; /* so we know to free s in switch_xml_free() */
|
||||
|
||||
return &root->xml;
|
||||
|
@ -1637,8 +1653,7 @@ SWITCH_DECLARE(switch_xml_t) switch_xml_parse_file_simple(const char *file)
|
|||
switch_xml_root_t root;
|
||||
|
||||
if ((fd = open(file, O_RDONLY, 0)) > -1) {
|
||||
fstat(fd, &st);
|
||||
if (!st.st_size) {
|
||||
if (fstat(fd, &st) == -1 || !st.st_size) {
|
||||
close(fd);
|
||||
goto error;
|
||||
}
|
||||
|
@ -1659,6 +1674,7 @@ SWITCH_DECLARE(switch_xml_t) switch_xml_parse_file_simple(const char *file)
|
|||
|
||||
root->dynamic = 1;
|
||||
close(fd);
|
||||
|
||||
return &root->xml;
|
||||
}
|
||||
|
||||
|
|
|
@ -95,6 +95,21 @@ FST_CORE_BEGIN("./conf")
|
|||
FST_TEST_END()
|
||||
#endif
|
||||
|
||||
FST_TEST_BEGIN(test_switch_is_number_in_range)
|
||||
{
|
||||
fst_check_int_equals(switch_is_uint_in_range("x5", 0, 10), SWITCH_FALSE);
|
||||
fst_check_int_equals(switch_is_uint_in_range("0", 1, 10), SWITCH_FALSE);
|
||||
fst_check_int_equals(switch_is_uint_in_range("-11", -10, 10), SWITCH_FALSE);
|
||||
fst_check_int_equals(switch_is_uint_in_range("-10", -10, 10), SWITCH_FALSE);
|
||||
fst_check_int_equals(switch_is_uint_in_range("-5", -10, 10), SWITCH_FALSE);
|
||||
fst_check_int_equals(switch_is_uint_in_range("-5", -10, 10), SWITCH_FALSE);
|
||||
fst_check_int_equals(switch_is_uint_in_range("5", -10, 10), SWITCH_FALSE);
|
||||
fst_check_int_equals(switch_is_uint_in_range("0", 0, 10), SWITCH_TRUE);
|
||||
fst_check_int_equals(switch_is_uint_in_range("10", 0, 10), SWITCH_TRUE);
|
||||
fst_check_int_equals(switch_is_uint_in_range("11", 0, 10), SWITCH_FALSE);
|
||||
}
|
||||
FST_TEST_END()
|
||||
|
||||
FST_TEST_BEGIN(test_md5)
|
||||
{
|
||||
char digest[SWITCH_MD5_DIGEST_STRING_SIZE] = { 0 };
|
||||
|
@ -416,6 +431,42 @@ FST_CORE_BEGIN("./conf")
|
|||
fst_requires(hash == NULL);
|
||||
}
|
||||
FST_TEST_END()
|
||||
|
||||
FST_SESSION_BEGIN(test_switch_channel_get_variable_strdup)
|
||||
{
|
||||
const char *val;
|
||||
switch_channel_t *channel = switch_core_session_get_channel(fst_session);
|
||||
|
||||
fst_check(channel);
|
||||
|
||||
switch_channel_set_variable(channel, "test_var", "test_value");
|
||||
|
||||
fst_check(!switch_channel_get_variable_strdup(channel, "test_var_does_not_exist"));
|
||||
|
||||
val = switch_channel_get_variable_strdup(channel, "test_var");
|
||||
|
||||
fst_check(val);
|
||||
fst_check_string_equals(val, "test_value");
|
||||
|
||||
free((char *)val);
|
||||
}
|
||||
FST_SESSION_END()
|
||||
|
||||
FST_SESSION_BEGIN(test_switch_channel_get_variable_buf)
|
||||
{
|
||||
char buf[16] = { 0 };
|
||||
switch_channel_t *channel = switch_core_session_get_channel(fst_session);
|
||||
|
||||
fst_check(channel);
|
||||
|
||||
switch_channel_set_variable(channel, "test_var", "test_value");
|
||||
|
||||
fst_check(switch_channel_get_variable_buf(channel, "test_var", buf, sizeof(buf)) == SWITCH_STATUS_SUCCESS);
|
||||
fst_check_string_equals(buf, "test_value");
|
||||
|
||||
fst_check(switch_channel_get_variable_buf(channel, "test_var_does_not_exist", buf, sizeof(buf)) == SWITCH_STATUS_FALSE);
|
||||
}
|
||||
FST_SESSION_END()
|
||||
}
|
||||
FST_SUITE_END()
|
||||
}
|
||||
|
|
|
@ -52,6 +52,7 @@ FST_CORE_BEGIN("conf")
|
|||
|
||||
frame.data = data;
|
||||
frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE;
|
||||
frame.datalen = SWITCH_RECOMMENDED_BUFFER_SIZE;
|
||||
switch_set_flag(&frame, SFF_ENCODED);
|
||||
|
||||
status = switch_packetizer_feed(packetizer, h264data, sizeof(h264data));
|
||||
|
@ -94,6 +95,7 @@ FST_CORE_BEGIN("conf")
|
|||
|
||||
frame.data = data;
|
||||
frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE;
|
||||
frame.datalen = SWITCH_RECOMMENDED_BUFFER_SIZE;
|
||||
switch_set_flag(&frame, SFF_ENCODED);
|
||||
|
||||
status = switch_packetizer_feed(packetizer, h264data, sizeof(h264data));
|
||||
|
@ -138,6 +140,7 @@ FST_CORE_BEGIN("conf")
|
|||
// 1 fps 3 bytes 1pps 3 bytes
|
||||
frame.data = data;
|
||||
frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE;
|
||||
frame.datalen = SWITCH_RECOMMENDED_BUFFER_SIZE;
|
||||
switch_set_flag(&frame, SFF_ENCODED);
|
||||
|
||||
status = switch_packetizer_feed_extradata(packetizer, extradata, sizeof(extradata));
|
||||
|
@ -210,6 +213,7 @@ FST_CORE_BEGIN("conf")
|
|||
|
||||
frame.data = data;
|
||||
frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE;
|
||||
frame.datalen = SWITCH_RECOMMENDED_BUFFER_SIZE;
|
||||
switch_set_flag(&frame, SFF_ENCODED);
|
||||
|
||||
status = switch_packetizer_feed(packetizer, h264data, sizeof(h264data));
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
<Target Name="SpandspDownloadTarget" BeforeTargets="CustomBuild;PreBuildEvent;" DependsOnTargets="7za">
|
||||
<DownloadPackageTask
|
||||
package="https://github.com/freeswitch/spandsp/archive/master.zip"
|
||||
package="https://github.com/freeswitch/spandsp/archive/0d2e6ac65e0e8f53d652665a743015a88bf048d4.zip"
|
||||
expectfileordirectory="$(BaseDir)libs\spandsp\configure.ac"
|
||||
outputfolder=""
|
||||
outputfilename="spandsp-$(SpandspVersion).zip"
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<Import Project="basedir.props" Condition=" '$(BaseDirImported)' == ''"/>
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros">
|
||||
<ffmpegVersion>4.1</ffmpegVersion>
|
||||
<ffmpegVersion>5.1.3</ffmpegVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ffmpegVersionImported>true</ffmpegVersionImported>
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalLibraryDirectories>$(ffmpegDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>Bcrypt.lib;Secur32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>Bcrypt.lib;Secur32.lib;Mfuuid.lib;strmiids.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies Condition="'$(Configuration)'=='Debug-openh264' OR '$(Configuration)'=='Release-openh264'">openh264.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<Import Project="basedir.props" Condition=" '$(BaseDirImported)' == ''"/>
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros">
|
||||
<libksVersion>1.8.2</libksVersion>
|
||||
<libksVersion>2.0.0</libksVersion>
|
||||
<libksBuildNumber>1</libksBuildNumber>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
<Target Name="libksBinariesDownloadTarget" BeforeTargets="CustomBuild" DependsOnTargets="7za">
|
||||
<DownloadPackageTask
|
||||
package="http://files.freeswitch.org/windows/packages/libks/$(libksVersion)_$(libksBuildNumber)/libks-$(libksVersion)_$(libksBuildNumber)-binaries-$(Platform.ToLower())-$(Configuration.ToLower()).zip"
|
||||
expectfileordirectory="$(libksDir)\binaries\$(Platform)\$(Configuration)\ks.dll"
|
||||
expectfileordirectory="$(libksDir)\binaries\$(Platform)\$(Configuration)\ks2.dll"
|
||||
outputfolder=""
|
||||
outputfilename=""
|
||||
extractto="$(BaseDir)libs\"
|
||||
|
@ -46,7 +46,7 @@
|
|||
<Target Name="libksHeadersDownloadTarget" BeforeTargets="CustomBuild" DependsOnTargets="7za">
|
||||
<DownloadPackageTask
|
||||
package="http://files.freeswitch.org/windows/packages/libks/$(libksVersion)_$(libksBuildNumber)/libks-$(libksVersion)_$(libksBuildNumber)-headers.zip"
|
||||
expectfileordirectory="$(libksDir)\src\include\libks\ks.h"
|
||||
expectfileordirectory="$(libksDir)\libks\src\include\libks\ks.h"
|
||||
outputfolder=""
|
||||
outputfilename=""
|
||||
extractto="$(BaseDir)libs\"
|
||||
|
@ -58,7 +58,7 @@
|
|||
<ItemGroup>
|
||||
<libksFiles Include="$(libksDir)\binaries\$(Platform)\$(Configuration)\*.dll"/>
|
||||
</ItemGroup>
|
||||
<Copy Condition="!exists('$(BaseDir)\$(Platform)\$(Configuration)\ks.dll')"
|
||||
<Copy Condition="!exists('$(BaseDir)\$(Platform)\$(Configuration)\ks2.dll')"
|
||||
SourceFiles="@(libksFiles)"
|
||||
DestinationFiles="@(libksFiles->'$(BaseDir)\$(Platform)\$(Configuration)\%(Filename)%(Extension)')"
|
||||
/>
|
||||
|
@ -67,12 +67,12 @@
|
|||
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(libksDir)\src\include;$(libksDir)\src\include\libks;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>__PRETTY_FUNCTION__=__FUNCSIG__;WIN32;_WINDOWS;SWCLT_VERSION_MAJOR=1;SWCLT_VERSION_MINOR=0;SWCLT_VERSION_REVISION=0;_WIN32_WINNT=0x0600;_WINSOCK_DEPRECATED_NO_WARNINGS=1;WIN32_LEAN_AND_MEAN=1;KS_PLAT_WIN=1;NOMAXMIN=1;_CRT_SECURE_NO_WARNINGS=1;SWCLT_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(libksDir)\libks\src\include;$(libksDir)\libks\src\include\libks;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>__KS_FUNC__=__FUNCSIG__;WIN32;_WINDOWS;SWCLT_VERSION_MAJOR=1;SWCLT_VERSION_MINOR=0;SWCLT_VERSION_REVISION=0;_WIN32_WINNT=0x0600;_WINSOCK_DEPRECATED_NO_WARNINGS=1;WIN32_LEAN_AND_MEAN=1;KS_PLAT_WIN=1;NOMAXMIN=1;_CRT_SECURE_NO_WARNINGS=1;SWCLT_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalLibraryDirectories>$(libksDir)\binaries\$(Platform)\$(Configuration)\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>ks.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>ks2.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
</Project>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<Import Project="basedir.props" Condition=" '$(BaseDirImported)' == ''"/>
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros">
|
||||
<signalwire-client-cVersion>1.3.2</signalwire-client-cVersion>
|
||||
<signalwire-client-cVersion>2.0.0</signalwire-client-cVersion>
|
||||
<signalwire-client-cBuildNumber>1</signalwire-client-cBuildNumber>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
<Target Name="signalwire-client-cBinariesDownloadTarget" BeforeTargets="CustomBuild" DependsOnTargets="7za">
|
||||
<DownloadPackageTask
|
||||
package="http://files.freeswitch.org/windows/packages/signalwire-client-c/$(signalwire-client-cVersion)_$(signalwire-client-cBuildNumber)/signalwire-client-c-$(signalwire-client-cVersion)_$(signalwire-client-cBuildNumber)-binaries-$(Platform.ToLower())-$(Configuration.ToLower()).zip"
|
||||
expectfileordirectory="$(signalwire-client-cDir)\binaries\$(Platform)\$(Configuration)\signalwire_client.dll"
|
||||
expectfileordirectory="$(signalwire-client-cDir)\binaries\$(Platform)\$(Configuration)\signalwire_client2.dll"
|
||||
outputfolder=""
|
||||
outputfilename=""
|
||||
extractto="$(BaseDir)libs\"
|
||||
|
@ -56,7 +56,7 @@
|
|||
<ItemGroup>
|
||||
<signalwire-client-cFiles Include="$(signalwire-client-cDir)\binaries\$(Platform)\$(Configuration)\*.dll"/>
|
||||
</ItemGroup>
|
||||
<Copy Condition="!exists('$(BaseDir)\$(Platform)\$(Configuration)\signalwire_client.dll')"
|
||||
<Copy Condition="!exists('$(BaseDir)\$(Platform)\$(Configuration)\signalwire_client2.dll')"
|
||||
SourceFiles="@(signalwire-client-cFiles)"
|
||||
DestinationFiles="@(signalwire-client-cFiles->'$(BaseDir)\$(Platform)\$(Configuration)\%(Filename)%(Extension)')"
|
||||
/>
|
||||
|
@ -70,7 +70,7 @@
|
|||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalLibraryDirectories>$(signalwire-client-cDir)\binaries\$(Platform)\$(Configuration)\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>signalwire_client.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>signalwire_client2.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
</Project>
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue