Merge branch 'signalwire:master' into allow_non_ascii_mod_ssml

This commit is contained in:
David Wilkie 2022-02-23 15:58:55 +07:00 committed by GitHub
commit ab004e0414
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
286 changed files with 45364 additions and 7741 deletions

View File

@ -18,7 +18,6 @@ steps:
- DEBIAN_FRONTEND=noninteractive apt-get -yq install libspandsp3-dev
- git clone https://github.com/freeswitch/sofia-sip.git
- cd sofia-sip && ./autogen.sh && ./configure.gnu && make -j`nproc` && make install && cd ..
- echo "applications/mod_test" >> modules.conf
- echo 'codecs/mod_openh264' >> modules.conf
- sed -i '/applications\\/mod_http_cache/s/^#//g' modules.conf
- sed -i '/event_handlers\\/mod_rayo/s/^#//g' modules.conf
@ -79,13 +78,13 @@ name: scan-build
steps:
- name: bootstrap
image: signalwire/freeswitch-public-base:stretch
image: signalwire/freeswitch-public-base
pull: always
commands:
- ./bootstrap.sh -j
- name: configure
image: signalwire/freeswitch-public-base:stretch
image: signalwire/freeswitch-public-base
pull: always
commands:
- apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -yq remove libspandsp-dev
@ -116,13 +115,13 @@ steps:
- ./configure
- name: scan-build
image: signalwire/freeswitch-public-base:stretch
image: signalwire/freeswitch-public-base
pull: always
commands:
- apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -yq remove libspandsp-dev
- DEBIAN_FRONTEND=noninteractive apt-get -yq install libsofia-sip-ua-dev libspandsp3-dev
- mkdir -p scan-build
- echo '#!/bin/bash\nscan-build-4.0 -o ./scan-build/ make -j`nproc --all` |& tee ./scan-build-result.txt\nexitstatus=$${PIPESTATUS[0]}\necho $$exitstatus > ./scan-build-status.txt\n' > scan.sh
- echo '#!/bin/bash\nscan-build-7 -o ./scan-build/ make -j`nproc --all` |& tee ./scan-build-result.txt\nexitstatus=$${PIPESTATUS[0]}\necho $$exitstatus > ./scan-build-status.txt\n' > scan.sh
- chmod +x scan.sh
- ./scan.sh
- exitstatus=`cat ./scan-build-status.txt`
@ -148,6 +147,6 @@ trigger:
---
kind: signature
hmac: 5d5cfb225053294d7cf1a4fed88eaf9a3a53c99a7bad4dc7164eece336c8861a
hmac: a85b0db203d2c9a71c3e4a63a46b5513fbdb3b8f5135e21d0fe0992f33626824
...

11
.gitignore vendored
View File

@ -102,6 +102,7 @@ Release/
/build/config/ltmain.sh
/build/config/missing
/build/freeswitch.pc
/build/standalone_module/freeswitch.pc
/build/getlib.sh
/build/getg729.sh
/build/getsounds.sh
@ -156,6 +157,7 @@ Release/
/src/mod/languages/mod_lua/mod_lua_wrap.cpp.orig
/src/mod/languages/mod_perl/mod_perl_wrap.cpp.orig
/src/mod/languages/mod_python/mod_python_wrap.cpp.orig
/src/mod/languages/mod_python3/mod_python_wrap.cpp.orig
/src/mod/say/mod_say_de/Makefile
/src/mod/say/mod_say_es/Makefile
/src/mod/say/mod_say_fr/Makefile
@ -264,9 +266,18 @@ src/mod/applications/mod_http_cache/test/test_aws.log
src/mod/applications/mod_http_cache/test/test_aws.trs
src/mod/formats/mod_sndfile/test/test_sndfile
src/mod/formats/mod_sndfile/test/test_sndfile_conf
src/mod/formats/mod_ssml/test/test_tts_format
src/mod/*/*/test/*.log
src/mod/*/*/test/*.trs
src/mod/*/*/test/[0-9]*/*
test-suite.log
src/mod/applications/mod_av/test/test_BT7.mp4
src/mod/applications/mod_av/test/test_RGB.mp4
images/test-argb.png
images/test-rgb.png
images/test.png
images/test_patched.png
images/test_text.png
src/mod/codecs/mod_amrwb/test/test_amrwb
src/mod/endpoints/mod_sofia/test/sipp-based-tests

View File

@ -3,8 +3,8 @@ Upstream-Name: freeswitch
Source: https://freeswitch.org/
Files: *
Copyright: 2005-2014 Anthony Minessale II <anthm@freeswitch.org>
2005-2014 Anthony Minessale II
Copyright: 2005-2022 Anthony Minessale II <anthm@freeswitch.org>
2005-2022 Anthony Minessale II
License: MPL-1.1
MOZILLA PUBLIC LICENSE
Version 1.1

View File

@ -248,7 +248,7 @@ endif
lib_LTLIBRARIES = libfreeswitch.la
libfreeswitch_la_CFLAGS = $(CORE_CFLAGS) $(SQLITE_CFLAGS) $(GUMBO_CFLAGS) $(FVAD_CFLAGS) $(FREETYPE_CFLAGS) $(CURL_CFLAGS) $(PCRE_CFLAGS) $(SPEEX_CFLAGS) $(LIBEDIT_CFLAGS) $(openssl_CFLAGS) $(SOFIA_SIP_CFLAGS) $(AM_CFLAGS) $(TPL_CFLAGS)
libfreeswitch_la_LDFLAGS = -version-info 1:0:0 $(AM_LDFLAGS) $(PLATFORM_CORE_LDFLAGS) -no-undefined
libfreeswitch_la_LIBADD = $(CORE_LIBS) $(APR_LIBS) $(SQLITE_LIBS) $(GUMBO_LIBS) $(FVAD_LIBS) $(FREETYPE_LIBS) $(CURL_LIBS) $(PCRE_LIBS) $(SPEEX_LIBS) $(LIBEDIT_LIBS) $(openssl_LIBS) $(PLATFORM_CORE_LIBS) $(TPL_LIBS) $(SPANDSP_LIBS) $(SOFIA_SIP_LIBS)
libfreeswitch_la_LIBADD = $(CORE_LIBS) $(APR_LIBS) $(SQLITE_LIBS) $(GUMBO_LIBS) $(FVAD_LIBS) $(FREETYPE_LIBS) $(CURL_LIBS) $(PCRE_LIBS) $(SPEEX_LIBS) $(LIBEDIT_LIBS) $(SYSTEMD_LIBS) $(openssl_LIBS) $(PLATFORM_CORE_LIBS) $(TPL_LIBS) $(SPANDSP_LIBS) $(SOFIA_SIP_LIBS)
libfreeswitch_la_DEPENDENCIES = $(BUILT_SOURCES)
if HAVE_PNG
@ -300,6 +300,7 @@ library_include_HEADERS = \
src/include/switch_dso.h \
src/include/switch_loadable_module.h \
src/include/switch_module_interfaces.h \
src/include/switch_packetizer.h \
src/include/switch_platform.h \
src/include/switch_resample.h \
src/include/switch_regex.h \
@ -309,6 +310,7 @@ library_include_HEADERS = \
src/include/switch_jitterbuffer.h \
src/include/switch_estimators.h \
src/include/switch_rtcp_frame.h \
src/include/switch_spandsp.h \
src/include/switch_stun.h \
src/include/switch_nat.h \
src/include/switch_log.h \
@ -364,6 +366,7 @@ libfreeswitch_la_SOURCES = \
src/switch_version.c \
src/switch_core_media.c \
src/switch_core_video.c \
src/switch_packetizer.c \
src/switch_sdp.c \
src/switch_scheduler.c \
src/switch_core_db.c \
@ -383,6 +386,7 @@ libfreeswitch_la_SOURCES = \
src/switch_ivr_say.c \
src/switch_ivr_menu.c \
src/switch_ivr.c \
src/switch_spandsp.c \
src/switch_stun.c \
src/switch_nat.c \
src/switch_log.c \
@ -742,7 +746,7 @@ pristine:
git clean -fdx
git reset --hard
update-clean: clean python-reconf
update-clean: clean python-reconf python3-reconf
cd libs/esl && $(MAKE) clean
cd libs/srtp && $(MAKE) clean
@ -759,6 +763,10 @@ python-reconf:
rm -f src/mod/languages/mod_python/Makefile
./config.status
python3-reconf:
rm -f src/mod/languages/mod_python3/Makefile
./config.status
reconf:
rm config.cache
sh ./config.status --recheck

View File

@ -4,6 +4,10 @@ After=syslog.target network.target
After=postgresql.service postgresql-9.3.service postgresql-9.4.service mysqld.service httpd.service
[Service]
# You can use Type=notify only if you compile FreeSWITCH with --enable-systemd configure option
# In this case you have to run FreeSWITCH in foreground mode (-nf option)!
#Type=notify
#NotifyAccess=main
User=freeswitch
EnvironmentFile=-/etc/sysconfig/freeswitch
# RuntimeDirectory is not yet supported in CentOS 7. A workaround is to use /etc/tmpfiles.d/freeswitch.conf

View File

@ -188,7 +188,7 @@ $(MODNAME).o: $(MODDIR)/$(SOURCEFILE) \
$(switch_srcdir)/src/include/switch_event.h $(switch_srcdir)/src/include/switch_resample.h \
$(switch_srcdir)/src/include/switch_ivr.h $(switch_srcdir)/src/include/switch_rtp.h \
$(switch_srcdir)/src/include/switch_stun.h $(switch_srcdir)/src/include/switch_log.h \
$(switch_srcdir)/src/include/switch_xml.h
$(switch_srcdir)/src/include/switch_xml.h $(switch_srcdir)/src/include/switch_spandsp.h
@echo Compiling $<...
if test -f "$(CSOURCEFILE)" -o -f "$(MODDIR)/$(CSOURCEFILE)"; then \
if test ! -z $(VERBOSE) ; then echo $(COMPILE) -c -o $@ `test -f '$<' || echo '$(MODDIR)/'`$< ; fi ;\
@ -211,7 +211,7 @@ $(MODNAME).lo: $(MODDIR)/$(SOURCEFILE) \
$(switch_srcdir)/src/include/switch_event.h $(switch_srcdir)/src/include/switch_resample.h \
$(switch_srcdir)/src/include/switch_ivr.h $(switch_srcdir)/src/include/switch_rtp.h \
$(switch_srcdir)/src/include/switch_stun.h $(switch_srcdir)/src/include/switch_log.h \
$(switch_srcdir)/src/include/switch_xml.h
$(switch_srcdir)/src/include/switch_xml.h $(switch_srcdir)/src/include/switch_spandsp.h
@echo Compiling $<...
if test -f "$(CSOURCEFILE)" -o -f "$(MODDIR)/$(CSOURCEFILE)"; then \
if test ! -z $(VERBOSE) ; then echo $(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(MODDIR)/'`$< ; fi ;\
@ -261,6 +261,8 @@ $(switch_srcdir)/src/include/switch_ivr.h:
$(switch_srcdir)/src/include/switch_rtp.h:
$(switch_srcdir)/src/include/switch_spandsp.h:
$(switch_srcdir)/src/include/switch_stun.h:
$(switch_srcdir)/src/include/switch_log.h:

View File

@ -49,6 +49,7 @@ applications/mod_sms
applications/mod_spandsp
#applications/mod_spy
#applications/mod_stress
applications/mod_test
#applications/mod_translate
applications/mod_valet_parking
#applications/mod_video_filter
@ -134,6 +135,7 @@ languages/mod_lua
#languages/mod_managed
#languages/mod_perl
#languages/mod_python
#languages/mod_python3
#languages/mod_v8
#languages/mod_yaml
loggers/mod_console

View File

@ -47,6 +47,7 @@ applications/mod_soundtouch
applications/mod_spandsp
applications/mod_spy
applications/mod_stress
applications/mod_test
applications/mod_translate
applications/mod_valet_parking
applications/mod_video_filter
@ -127,7 +128,7 @@ languages/mod_java
languages/mod_lua
languages/mod_managed
languages/mod_perl
languages/mod_python
languages/mod_python3
#languages/mod_v8
languages/mod_yaml
loggers/mod_console

View File

@ -1 +1 @@
1.10.7-dev
1.10.8-dev

View File

@ -13,6 +13,11 @@ make swigclean
make mod_python_wrap.cpp
cd ../../../..
cd src/mod/languages/mod_python3
make swigclean
make mod_python_wrap.cpp
cd ../../../..
cd src/mod/languages/mod_java
make reswig
cd ../../../..

BIN
conf/FreeMono.ttf Normal file

Binary file not shown.

View File

@ -184,7 +184,7 @@
<zone name="America/Rosario" value="ART3ARST,M10.1.0/0,M3.3.0/0" />
<zone name="America/Santiago" value="CLST" />
<zone name="America/Santo_Domingo" value="AST4" />
<zone name="America/Sao_Paulo" value="BRT3BRST,M10.2.0/0,M2.3.0/0" />
<zone name="America/Sao_Paulo" value="BRT3" />
<zone name="America/Scoresbysund" value="EGT1EGST,M3.5.0/0,M10.5.0/1" />
<zone name="America/Shiprock" value="MST7MDT,M3.2.0,M11.1.0" />
<zone name="America/St_Barthelemy" value="AST4" />

View File

@ -81,6 +81,7 @@
<load module="mod_v8"/>
<!-- <load module="mod_perl"/> -->
<!-- <load module="mod_python"/> -->
<!-- <load module="mod_python3"/> -->
<!-- <load module="mod_java"/> -->
<load module="mod_lua"/>

View File

@ -184,7 +184,7 @@
<zone name="America/Rosario" value="ART3ARST,M10.1.0/0,M3.3.0/0" />
<zone name="America/Santiago" value="CLST" />
<zone name="America/Santo_Domingo" value="AST4" />
<zone name="America/Sao_Paulo" value="BRT3BRST,M10.2.0/0,M2.3.0/0" />
<zone name="America/Sao_Paulo" value="BRT3" />
<zone name="America/Scoresbysund" value="EGT1EGST,M3.5.0/0,M10.5.0/1" />
<zone name="America/Shiprock" value="MST7MDT,M3.2.0,M11.1.0" />
<zone name="America/St_Barthelemy" value="AST4" />

View File

@ -196,7 +196,7 @@
<zone name="America/Santarem" value="BRT3" />
<zone name="America/Santiago" value="CLST" />
<zone name="America/Santo_Domingo" value="AST4" />
<zone name="America/Sao_Paulo" value="BRT3BRST,M10.3.0/0,M2.3.0/0" />
<zone name="America/Sao_Paulo" value="BRT3" />
<zone name="America/Scoresbysund" value="EGT1EGST,M3.5.0/0,M10.5.0/1" />
<zone name="America/Shiprock" value="MST7MDT,M3.2.0,M11.1.0" />
<zone name="America/Sitka" value="AKST9AKDT,M3.2.0,M11.1.0" />

View File

@ -184,7 +184,7 @@
<zone name="America/Rosario" value="ART3ARST,M10.1.0/0,M3.3.0/0" />
<zone name="America/Santiago" value="CLST" />
<zone name="America/Santo_Domingo" value="AST4" />
<zone name="America/Sao_Paulo" value="BRT3BRST,M10.2.0/0,M2.3.0/0" />
<zone name="America/Sao_Paulo" value="BRT3" />
<zone name="America/Scoresbysund" value="EGT1EGST,M3.5.0/0,M10.5.0/1" />
<zone name="America/Shiprock" value="MST7MDT,M3.2.0,M11.1.0" />
<zone name="America/St_Barthelemy" value="AST4" />

View File

@ -184,7 +184,7 @@
<zone name="America/Rosario" value="ART3ARST,M10.1.0/0,M3.3.0/0" />
<zone name="America/Santiago" value="CLST" />
<zone name="America/Santo_Domingo" value="AST4" />
<zone name="America/Sao_Paulo" value="BRT3BRST,M10.2.0/0,M2.3.0/0" />
<zone name="America/Sao_Paulo" value="BRT3" />
<zone name="America/Scoresbysund" value="EGT1EGST,M3.5.0/0,M10.5.0/1" />
<zone name="America/Shiprock" value="MST7MDT,M3.2.0,M11.1.0" />
<zone name="America/St_Barthelemy" value="AST4" />

View File

@ -196,7 +196,7 @@
<zone name="America/Santarem" value="BRT3" />
<zone name="America/Santiago" value="CLST" />
<zone name="America/Santo_Domingo" value="AST4" />
<zone name="America/Sao_Paulo" value="BRT3BRST,M10.3.0/0,M2.3.0/0" />
<zone name="America/Sao_Paulo" value="BRT3" />
<zone name="America/Scoresbysund" value="EGT1EGST,M3.5.0/0,M10.5.0/1" />
<zone name="America/Shiprock" value="MST7MDT,M3.2.0,M11.1.0" />
<zone name="America/Sitka" value="AKST9AKDT,M3.2.0,M11.1.0" />

View File

@ -216,6 +216,14 @@
<!-- TLS ciphers default: ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH -->
<param name="tls-ciphers" value="$${sip_tls_ciphers}"/>
<!--
Connect timeout for outgoing requests using TLS (in milliseconds).
Set the timeout and SIP engine will try again sending an outgoing request
and when possible - using an alternative address (DNS failover).
Default - 0 (disabled)
-->
<!-- <param name="tls-orq-connect-timeout" value="3000" /> -->
<!-- turn on auto-flush during bridge (skip timer sleep when the socket already has data)
(reduces delay on latent connections default true, must be disabled explicitly)-->
<!--<param name="rtp-autoflush-during-bridge" value="false"/>-->

View File

@ -122,6 +122,7 @@
<!-- <load module="mod_v8"/> -->
<!-- <load module="mod_perl"/> -->
<!-- <load module="mod_python"/> -->
<!-- <load module="mod_python3"/> -->
<!-- <load module="mod_java"/> -->
<load module="mod_lua"/>

View File

@ -28,6 +28,7 @@
<fax-settings>
<param name="use-ecm" value="true"/>
<param name="verbose" value="false"/>
<!--param name="verbose-log-level" value="INFO"/-->
<param name="disable-v17" value="false"/>
<param name="ident" value="SpanDSP Fax Ident"/>
<param name="header" value="SpanDSP Fax Header"/>

View File

@ -197,7 +197,7 @@
<zone name="America/Santarem" value="BRT3" />
<zone name="America/Santiago" value="CLT3" />
<zone name="America/Santo_Domingo" value="AST4" />
<zone name="America/Sao_Paulo" value="BRT3BRST,M10.3.0/0,M2.3.0/0" />
<zone name="America/Sao_Paulo" value="BRT3" />
<zone name="America/Scoresbysund" value="EGT1EGST,M3.5.0/0,M10.5.0/1" />
<zone name="America/Shiprock" value="MST7MDT,M3.2.0,M11.1.0" />
<zone name="America/Sitka" value="AKST9AKDT,M3.2.0,M11.1.0" />

View File

@ -2,6 +2,7 @@
<settings>
<param name="debug" value="0"/>
<!-- <param name="kslog" value="true"/> -->
<!-- seconds to wait before hanging up a disconnected channel -->
<!-- <param name="detach-timeout-sec" value="120"/> -->
<!-- enable broadcasting all FreeSWITCH events in Verto -->

View File

@ -36,6 +36,8 @@
<!-- <param name="bitpacking" value="aal2"/> -->
<!--max number of open dialogs in proceeding -->
<!--<param name="max-proceeding" value="1000"/>-->
<!--max number of receiving requests per second (Default: 1000, 0 - unlimited) -->
<!--<param name="max-recv-requests-per-second" value="0"/>-->
<!--session timers for all call to expire after the specified seconds -->
<!--<param name="session-timeout" value="1800"/>-->
<!--<param name="multiple-registrations" value="true"/>-->

View File

@ -172,6 +172,8 @@
<!-- <param name="bitpacking" value="aal2"/> -->
<!--max number of open dialogs in proceeding -->
<!--<param name="max-proceeding" value="1000"/>-->
<!--max number of receiving requests per second (Default: 1000, 0 - unlimited) -->
<!--<param name="max-recv-requests-per-second" value="0"/> -->
<!--session timers for all call to expire after the specified seconds -->
<!--<param name="session-timeout" value="1800"/>-->
<!-- Can be 'true' or 'contact' -->
@ -216,6 +218,14 @@
<!-- TLS ciphers default: ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH -->
<param name="tls-ciphers" value="$${sip_tls_ciphers}"/>
<!--
Connect timeout for outgoing requests using TLS (in milliseconds).
Set the timeout and SIP engine will try again sending an outgoing request
and when possible - using an alternative address (DNS failover).
Default - 0 (disabled)
-->
<!-- <param name="tls-orq-connect-timeout" value="3000" /> -->
<!-- turn on auto-flush during bridge (skip timer sleep when the socket already has data)
(reduces delay on latent connections default true, must be disabled explicitly)-->
<!--<param name="rtp-autoflush-during-bridge" value="false"/>-->

View File

@ -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.7-dev], bugs@freeswitch.org)
AC_INIT([freeswitch], [1.10.8-dev], bugs@freeswitch.org)
AC_SUBST(SWITCH_VERSION_MAJOR, [1])
AC_SUBST(SWITCH_VERSION_MINOR, [10])
AC_SUBST(SWITCH_VERSION_MICRO, [7-dev])
AC_SUBST(SWITCH_VERSION_MICRO, [8-dev])
AC_SUBST(SWITCH_VERSION_REVISION, [])
AC_SUBST(SWITCH_VERSION_REVISION_HUMAN, [])
@ -598,7 +598,7 @@ AC_ARG_ENABLE(srtp,
AM_CONDITIONAL([ENABLE_SRTP],[test "${enable_srtp}" = "yes"])
have_openal=no
AC_CHECK_LIB(openal, alMidiGainSOFT, [have_openal="yes"])
AC_CHECK_LIB(openal, alcLoopbackOpenDeviceSOFT, [have_openal="yes"])
AM_CONDITIONAL([HAVE_OPENAL],[test "${have_openal}" = "yes"])
AC_ARG_ENABLE(zrtp,
@ -725,7 +725,7 @@ PKG_CHECK_MODULES([SPANDSP], [spandsp >= 3.0],[
AC_MSG_ERROR([no usable spandsp; please install spandsp3 devel package or equivalent])
])
PKG_CHECK_MODULES([SOFIA_SIP], [sofia-sip-ua >= 1.13.5],[
PKG_CHECK_MODULES([SOFIA_SIP], [sofia-sip-ua >= 1.13.6],[
AM_CONDITIONAL([HAVE_SOFIA_SIP],[true])],[
AC_MSG_ERROR([no usable sofia-sip; please install sofia-sip-ua devel package or equivalent])
])
@ -883,7 +883,7 @@ AC_SUBST(LIBTOOL_LIB_EXTEN)
# Checks for header files.
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_CHECK_HEADERS([sys/types.h sys/resource.h sched.h wchar.h sys/filio.h sys/ioctl.h sys/prctl.h sys/select.h netdb.h execinfo.h sys/time.h])
AC_CHECK_HEADERS([sys/types.h sys/resource.h sched.h wchar.h sys/filio.h sys/ioctl.h sys/prctl.h sys/select.h netdb.h sys/time.h])
# Solaris 11 privilege management
AS_CASE([$host],
@ -1408,7 +1408,9 @@ PKG_CHECK_MODULES([VLC], [libvlc >= 2.1.0],[
PKG_CHECK_MODULES([OPENCV], [opencv >= 2.4.5],[
AM_CONDITIONAL([HAVE_OPENCV],[true])],[
AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_OPENCV],[false])])
PKG_CHECK_MODULES([OPENCV], [opencv4 >= 2.4.5],[
AM_CONDITIONAL([HAVE_OPENCV],[true])],[
AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_OPENCV],[false])])])
PKG_CHECK_MODULES([OPUSFILE_DECODE], [opusfile >= 0.5],[
AM_CONDITIONAL([HAVE_OPUSFILE_DECODE],[true])],[
@ -1529,11 +1531,25 @@ PKG_CHECK_MODULES([V8FS_STATIC], [v8-6.1_static >= 6.1.298],[
PKG_CHECK_MODULES([KS], [libks >= 1.1.0],[
AM_CONDITIONAL([HAVE_KS],[true])],[
AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_KS],[false])])
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])
else
AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_KS],[false])
fi
fi
])
PKG_CHECK_MODULES([SIGNALWIRE_CLIENT], [signalwire_client >= 1.0.0],[
AM_CONDITIONAL([HAVE_SIGNALWIRE_CLIENT],[true])],[
AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_SIGNALWIRE_CLIENT],[false])])
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([AMQP], [librabbitmq >= 0.5.2],[
AM_CONDITIONAL([HAVE_AMQP],[true])],[
@ -1576,6 +1592,17 @@ AS_IF([test "x$enable_core_libedit_support" != "xno"],[
AC_MSG_ERROR([You need to either install libedit-dev (>= 2.11) or configure with --disable-core-libedit-support])
])])])
AC_ARG_ENABLE(systemd,
[AS_HELP_STRING([--enable-systemd], [Compile with systemd notify support])])
AS_IF([test "x$enable_systemd" = "xyes"],[
PKG_CHECK_MODULES([SYSTEMD], [libsystemd >= 219], [
AC_DEFINE([HAVE_SYSTEMD], [1], [Define to 1 if systemd is available])])
])
AC_SUBST(SYSTEMD_LIBS)
dnl ---------------------------------------------------------------------------
dnl - OpenLDAP SDK
dnl ---------------------------------------------------------------------------
@ -1702,7 +1729,7 @@ if test "x$ac_cv_have_php" != "xno" -a "x$ac_cv_have_php_config" != "xno"; then
fi
#
# Python checks for mod_python
# Python checks for mod_python (scroll down to see python3 checks for mod_python3)
#
AC_ARG_WITH(
[python],
@ -1822,6 +1849,127 @@ else
AC_MSG_WARN([python support disabled, building mod_python will fail!])
fi
#
# Python3 checks for mod_python3
#
AC_ARG_WITH(
[python3],
[AS_HELP_STRING([--with-python3], [Use system provided version of python3 (default: try)])],
[with_python3="$withval"],
[with_python3="try"]
)
if test "$with_python3" != "no"
then
save_CFLAGS="$CFLAGS"
save_LIBS="$LIBS"
if test "$with_python3" != "yes" -a "$with_python3" != "try" ; then
AC_MSG_CHECKING([for python3])
if test ! -x "$with_python3" ; then
AC_MSG_ERROR([Specified python3 does not exist or is not executable: $with_python3])
fi
AC_MSG_RESULT([$with_python3])
AC_SUBST([PYTHON3], ["$with_python3"])
else
AC_PATH_PROG([PYTHON3], ["python3"], ["no"], ["$PATH:/usr/bin:/usr/local/bin"])
fi
if test "$PYTHON3" != "no" ; then
AC_MSG_CHECKING([python3 version])
PYTHON3_VER="`$PYTHON3 -V 2>&1 | cut -d' ' -f2`"
if test -z "$PYTHON3_VER" ; then
AC_MSG_ERROR([Unable to detect python3 version])
fi
AC_MSG_RESULT([$PYTHON3_VER])
AC_MSG_CHECKING([for python3 distutils])
python3_result="`$PYTHON3 -c 'import distutils;' 2>&1`"
if test -z "$python3_result" ; then
python3_has_distutils="yes"
else
python3_has_distutils="no"
fi
AC_MSG_RESULT([$python3_has_distutils])
if test "$python3_has_distutils" != "no" ; then
AC_MSG_CHECKING([location of python3 site-packages])
PYTHON3_SITE_DIR="`$PYTHON3 -c 'from distutils import sysconfig; print(sysconfig.get_python_lib(0));'`"
if test -z "$PYTHON3_SITE_DIR" ; then
AC_MSG_ERROR([Unable to detect python3 site-packages path])
elif test ! -d "$PYTHON3_SITE_DIR" ; then
AC_MSG_ERROR([Path $PYTHON3_SITE_DIR returned by python3 does not exist!])
fi
AC_MSG_RESULT([$PYTHON3_SITE_DIR])
AC_SUBST([PYTHON3_SITE_DIR], [$PYTHON3_SITE_DIR])
#
# python3 distutils found, get settings from python3 directly
#
PYTHON3_CFLAGS="`$PYTHON3 -c 'from distutils import sysconfig; flags = [[\"-I\" + sysconfig.get_python_inc(0), \"-I\" + sysconfig.get_python_inc(1), \" \".join(sysconfig.get_config_var(\"CFLAGS\").split())]]; print(\" \".join(flags));' | sed -e 's/-arch i386//g;s/-arch x86_64//g'`"
PYTHON3_LDFLAGS="`$PYTHON3 -c 'from distutils import sysconfig; ldver = sysconfig.get_config_var(\"LDVERSION\"); libs = sysconfig.get_config_var(\"LIBS\").split() + sysconfig.get_config_var(\"SYSLIBS\").split(); libs.append(\"-lpython\" + [[ldver,sysconfig.get_config_var(\"VERSION\")]][[ldver==None]]); print(\" \".join(libs));'`"
PYTHON3_LIB="`$PYTHON3 -c 'from distutils import sysconfig; ldver = sysconfig.get_config_var(\"LDVERSION\"); print(\"python\" + [[ldver,sysconfig.get_config_var(\"VERSION\")]][[ldver==None]]);'`"
PYTHON3_LIBDIR="`$PYTHON3 -c 'from distutils import sysconfig; print(sysconfig.get_config_var(\"LIBDIR\"));'`"
# handle python3 being installed into /usr/local
AC_MSG_CHECKING([python3 libdir])
if test -z "`echo $PYTHON3_LIBDIR | grep "/usr/lib"`" ; then
PYTHON3_LDFLAGS="-L$PYTHON3_LIBDIR $PYTHON3_LDFLAGS"
LIBS="-L$PYTHON3_LIBDIR $LIBS"
fi
AC_MSG_RESULT([$PYTHON3_LIBDIR])
# check libpython3
AC_CHECK_LIB([$PYTHON3_LIB], [main], [has_libpython3="yes"], [has_libpython3="no"])
if test "$has_libpython3" = "no" ; then
AS_IF([test "$with_python3" = "try"],
[AC_MSG_WARN([$PYTHON3_LIB is unusable])],
[AC_MSG_ERROR([$PYTHON3_LIB is unusable])]
)
fi
# check whether system libpython3 is usable and has threads support
CFLAGS="$PYTHON3_CFLAGS"
LIBS="$PYTHON3_LDFLAGS"
AC_CHECK_FUNC([PyThread_init_thread], [python3_has_threads="yes"], [python3_has_threads="no"])
if test "$python3_has_threads" = "no"; then
AS_IF([test "$with_python3" = "try"],
[AC_MSG_WARN([Your python3 lacks threads support, can not build mod_python3])],
[AC_MSG_ERROR([Your python3 lacks threads support, can not build mod_python3])]
)
else
AC_MSG_NOTICE([Your python3 seems OK, do not forget to enable mod_python3 in modules.conf])
AC_SUBST([PYTHON3_CFLAGS], [$PYTHON3_CFLAGS])
AC_SUBST([PYTHON3_LDFLAGS], [$PYTHON3_LDFLAGS])
fi
else
AS_IF([test "$with_python3" = "try"],
[AC_MSG_WARN([Could not find or use python3 distutils module: $python3_result])],
[AC_MSG_ERROR([Could not find or use python3 distutils module: $python3_result])]
)
fi
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
unset python3_has_threads
unset python3_has_distutils
unset python3_result
else
AS_IF([test "$with_python3" = "try"],
[AC_MSG_WARN([Could not find python3, mod_python3 will not build, use --with-python3 to specify the location])],
[AC_MSG_ERROR([Could not find python3, use --with-python3 to specify the location])]
)
fi
else
AC_MSG_WARN([python3 support disabled, building mod_python3 will fail!])
fi
#
# SNMP checks for mod_snmp
#
@ -1852,6 +2000,55 @@ if test "${enable_address_sanitizer}" = "yes"; then
APR_ADDTO(LDFLAGS, -fsanitize=address)
fi
# Enable HEAP profiler (requires libgoogle-perftools-dev package)
AC_ARG_ENABLE(heap_profiler,
[AC_HELP_STRING([--enable-heap-profiler],[build with google heap profiler])],
[enable_heap_profiler="$enable_heap_profiler"],
[enable_heap_profiler="no"])
# Enable CPU profiler (requires libgoogle-perftools-dev package)
AC_ARG_ENABLE(cpu_profiler,
[AC_HELP_STRING([--enable-cpu-profiler],[build with google cpu profiler])],
[enable_cpu_profiler="$enable_cpu_profiler"],
[enable_cpu_profiler="no"])
PKG_CHECK_MODULES([TCMALLOC], [libtcmalloc], [have_tcmalloc=yes], [have_tcmalloc=no])
if test "${enable_heap_profiler}" = "yes" || test "${enable_cpu_profiler}" = "yes"; then
if test "x$have_tcmalloc" != "xyes" ; then
AC_MSG_ERROR([You must install libgoogle-perftools-dev in order to use heap or cpu profiler])
fi
fi
# WARNING: When both enabled you can NOT link them statically and MUST use the special library
if test "${enable_heap_profiler}" = "yes" && test "${enable_cpu_profiler}" = "yes"; then
APR_ADDTO(CFLAGS, -ltcmalloc_and_profiler)
APR_ADDTO(CXXFLAGS, -ltcmalloc_and_profiler)
APR_ADDTO(LDFLAGS, -ltcmalloc_and_profiler)
else
if test "${enable_heap_profiler}" = "yes"; then
APR_ADDTO(CFLAGS, -ltcmalloc)
APR_ADDTO(CXXFLAGS, -ltcmalloc)
APR_ADDTO(LDFLAGS, -ltcmalloc)
fi
if test "${enable_cpu_profiler}" = "yes"; then
APR_ADDTO(CFLAGS, -lprofiler)
APR_ADDTO(CXXFLAGS, -lprofiler)
APR_ADDTO(LDFLAGS, -lprofiler)
fi
fi
# Enable fake dlclose
AC_ARG_ENABLE(fake_dlclose,
[AC_HELP_STRING([--enable-fake-dlclose],[Do not unload dynamic libraries])],
[enable_fake_dlclose="$enable_fake_dlclose"],
[enable_fake_dlclose="no"])
if test "${enable_fake_dlclose}" = "yes"; then
APR_ADDTO(SWITCH_AM_CFLAGS, -DHAVE_FAKE_DLCLOSE)
fi
AC_ARG_ENABLE(,
[AC_HELP_STRING([--enable-pool-sanitizer],[build with sanitizer friendly pool behavior])],
[enable_pool_sanitizer="$enable_pool_sanitizer"],
@ -2012,6 +2209,7 @@ AC_CONFIG_FILES([Makefile
src/mod/languages/mod_managed/Makefile
src/mod/languages/mod_perl/Makefile
src/mod/languages/mod_python/Makefile
src/mod/languages/mod_python3/Makefile
src/mod/languages/mod_v8/Makefile
src/mod/languages/mod_yaml/Makefile
src/mod/languages/mod_basic/Makefile

14
debian/bootstrap.sh vendored
View File

@ -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 sid"
supported_debian_distros="wheezy jessie stretch buster bullseye sid"
supported_ubuntu_distros="trusty utopic xenial"
supported_distros="$supported_debian_distros $supported_ubuntu_distros"
avoid_mods=(
@ -299,7 +299,7 @@ print_source_control () {
esac
local debhelper_dep="debhelper (>= 8.0.0)"
if [ ${use_sysvinit} = "false" ]; then
debhelper_dep=${debhelper_dep}", dh-systemd"
debhelper_dep=${debhelper_dep}", dh-systemd | debhelper (>= 8.0.0)"
fi
cat <<EOF
Source: freeswitch
@ -325,14 +325,14 @@ 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-all-dev, python-support (>= 0.90) | dh-python, erlang-dev, libtpl-dev (>= 1.5),
python-dev | python-dev-is-python2, python3-dev, python-all-dev, python-support (>= 0.90) | dh-python, erlang-dev, libtpl-dev (>= 1.5),
# documentation
doxygen,
# for APR (not essential for build)
uuid-dev, libexpat1-dev, libgdbm-dev, libdb-dev,
# used by many modules
libcurl4-openssl-dev | libcurl4-gnutls-dev | libcurl-dev,
bison, zlib1g-dev, libsofia-sip-ua-dev (>= 1.13.5),
bison, zlib1g-dev, libsofia-sip-ua-dev (>= 1.13.6),
libspandsp3-dev,
# used to format the private freeswitch apt-repo key properly
gnupg,
@ -371,7 +371,7 @@ Description: Cross-Platform Scalable Multi-Protocol Soft Switch
Package: libfreeswitch1
Architecture: amd64 armhf
Depends: \${shlibs:Depends}, \${misc:Depends}
Depends: \${shlibs:Depends}, \${misc:Depends}, libsofia-sip-ua0 (>= 1.13.6)
Recommends:
Suggests: libfreeswitch1-dbg
Conflicts: freeswitch-all (<= 1.6.7)
@ -683,7 +683,7 @@ Depends: \${misc:Depends}, freeswitch (= \${binary:Version}),
freeswitch-mod-java (= \${binary:Version}),
freeswitch-mod-lua (= \${binary:Version}),
freeswitch-mod-perl (= \${binary:Version}),
freeswitch-mod-python (= \${binary:Version}),
freeswitch-mod-python3 (= \${binary:Version}),
freeswitch-mod-yaml (= \${binary:Version}),
freeswitch-mod-console (= \${binary:Version}),
freeswitch-mod-logfile (= \${binary:Version}),
@ -922,7 +922,7 @@ Depends: \${misc:Depends}, freeswitch (= \${binary:Version}),
freeswitch-mod-java-dbg (= \${binary:Version}),
freeswitch-mod-lua-dbg (= \${binary:Version}),
freeswitch-mod-perl-dbg (= \${binary:Version}),
freeswitch-mod-python-dbg (= \${binary:Version}),
freeswitch-mod-python3-dbg (= \${binary:Version}),
freeswitch-mod-yaml-dbg (= \${binary:Version}),
freeswitch-mod-console-dbg (= \${binary:Version}),
freeswitch-mod-logfile-dbg (= \${binary:Version}),

View File

@ -492,6 +492,7 @@ Description: Adds mod_verto.
Adds mod_verto.
Build-Depends: libperl-dev
Build-Depends-Buster: libperl-dev, libgdbm-compat-dev
Build-Depends-Bullseye: libperl-dev, libgdbm-compat-dev
## mod/event_handlers
@ -665,11 +666,17 @@ Description: mod_perl
Adds mod_perl.
Build-Depends: libperl-dev
Build-Depends-Buster: libperl-dev, libgdbm-compat-dev
Build-Depends-Bullseye: libperl-dev, libgdbm-compat-dev
Module: languages/mod_python
Description: mod_python
Adds mod_python.
Build-Depends: python-dev
Build-Depends: python-dev | python-dev-is-python2
Module: languages/mod_python3
Description: mod_python3
Adds mod_python3.
Build-Depends: python3-dev
Module: languages/mod_v8
Description: mod_v8

View File

@ -1 +1 @@
/usr/lib/python*/*-packages/freeswitch.py
/usr/lib/python2*/*-packages/freeswitch.py

View File

@ -0,0 +1 @@
/usr/lib/python3*/*-packages/freeswitch.py

4
debian/rules vendored
View File

@ -73,7 +73,7 @@ override_dh_auto_clean:
./configure -C --enable-portable-binary --disable-dependency-tracking \
--host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \
--prefix=/usr --localstatedir=/var --sysconfdir=/etc \
--with-gnu-ld --with-python --with-erlang --with-openssl \
--with-gnu-ld --with-python --with-python3 --with-erlang --with-openssl \
--enable-core-odbc-support --enable-zrtp
touch $@
@ -85,6 +85,7 @@ override_dh_auto_configure: .stamp-configure
make iksemel-dep
make -j$(NJOBS)
make -C libs/esl pymod
make -C libs/esl py3mod
make -C libs/esl perlmod
touch $@
@ -99,6 +100,7 @@ override_dh_strip:
override_dh_auto_install:
dh_auto_install
dh_auto_install -- -C libs/esl pymod-install
dh_auto_install -- -C libs/esl py3mod-install
dh_auto_install -- -C libs/esl perlmod-install
rm -f debian/tmp/usr/share/freeswitch/grammar/model/communicator/COPYING

12
debian/util.sh vendored
View File

@ -46,9 +46,9 @@ find_distro () {
case "$1" in
experimental) echo "sid";;
unstable) echo "sid";;
testing) echo "buster";;
stable) echo "stretch";;
oldstable) echo "jessie";;
testing) echo "bullseye";;
stable) echo "buster";;
oldstable) echo "stretch";;
*) echo "$1";;
esac
}
@ -56,9 +56,9 @@ find_distro () {
find_suite () {
case "$1" in
sid) echo "unstable";;
buster) echo "testing";;
stretch) echo "stable";;
jessie) echo "oldstable";;
bullseye) echo "testing";;
buster) echo "stable";;
stretch) echo "oldstable";;
*) echo "$1";;
esac
}

View File

@ -140,7 +140,7 @@ BuildRequires: curl-devel >= 7.19
BuildRequires: gcc-c++
BuildRequires: libtool >= 1.5.17
BuildRequires: openssl-devel >= 1.0.1e
BuildRequires: sofia-sip-devel >= 1.13.5
BuildRequires: sofia-sip-devel >= 1.13.6
BuildRequires: spandsp3-devel >= 3.0
BuildRequires: pcre-devel
BuildRequires: speex-devel

BIN
images/cluecon.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

BIN
images/cluecon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 KiB

1
libs/.gitignore vendored
View File

@ -794,3 +794,4 @@ mariadb-connector-c-*
/spandsp*/
/spandsp*
win32/spandsp/spandsp.h
win32/spandsp/win32

View File

@ -28,6 +28,8 @@
#include <string.h>
#endif
#include <assert.h> /* assert() */
#if APR_POOL_DEBUG && APR_HAVE_STDIO_H
#include <stdio.h>
#endif
@ -433,6 +435,7 @@ APR_DECLARE(apr_hash_t *) apr_hash_merge(apr_pool_t *p,
for (k = 0; k <= base->max; k++) {
for (iter = base->array[k]; iter; iter = iter->next) {
i = iter->hash & res->max;
assert(new_vals);
new_vals[j].klen = iter->klen;
new_vals[j].key = iter->key;
new_vals[j].val = iter->val;

View File

@ -54,6 +54,7 @@ reswig: swigclean
$(MAKE) -C php reswig
$(MAKE) -C lua reswig
$(MAKE) -C python reswig
$(MAKE) -C python3 reswig
$(MAKE) -C ruby reswig
$(MAKE) -C java reswig
$(MAKE) -C managed reswig
@ -63,6 +64,7 @@ swigclean: clean
$(MAKE) -C php swigclean
$(MAKE) -C lua swigclean
$(MAKE) -C python swigclean
$(MAKE) -C python3 swigclean
$(MAKE) -C ruby swigclean
$(MAKE) -C java swigclean
$(MAKE) -C managed swigclean
@ -77,7 +79,10 @@ luamod: $(MYLIB)
$(MAKE) MYLIB="../$(MYLIB)" SOLINK="$(SOLINK)" CFLAGS="-I$(switch_srcdir)/libs/esl/src/include $(SWITCH_AM_CFLAGS)" CXXFLAGS="-I$(switch_srcdir)/libs/esl/src/include $(SWITCH_AM_CXXFLAGS)" CXX_CFLAGS="$(CXX_CFLAGS)" LUA_CFLAGS="$(LUA_CFLAGS)" LUA_LIBS="$(LUA_LIBS)" -C lua
pymod: $(MYLIB)
$(MAKE) MYLIB="../$(MYLIB)" SOLINK="$(SOLINK)" CFLAGS="-I$(switch_srcdir)/libs/esl/src/include $(SWITCH_AM_CFLAGS)" CXXFLAGS="-I$(switch_srcdir)/libs/esl/src/include $(SWITCH_AM_CXXFLAGS)" CXX_CFLAGS="$(CXX_CFLAGS)" -C python
$(MAKE) PYTHON=$(PYTHON) MYLIB="../$(MYLIB)" SOLINK="$(SOLINK)" CFLAGS="-I$(switch_srcdir)/libs/esl/src/include $(SWITCH_AM_CFLAGS)" CXXFLAGS="-I$(switch_srcdir)/libs/esl/src/include $(SWITCH_AM_CXXFLAGS)" CXX_CFLAGS="$(CXX_CFLAGS)" -C python
py3mod: $(MYLIB)
$(MAKE) PYTHON3=$(PYTHON3) MYLIB="../$(MYLIB)" SOLINK="$(SOLINK)" CFLAGS="-I$(switch_srcdir)/libs/esl/src/include $(SWITCH_AM_CFLAGS)" CXXFLAGS="-I$(switch_srcdir)/libs/esl/src/include $(SWITCH_AM_CXXFLAGS)" CXX_CFLAGS="$(CXX_CFLAGS)" -C python3
tclmod: $(MYLIB)
$(MAKE) MYLIB="../$(MYLIB)" SOLINK="$(SOLINK)" CFLAGS="-I$(switch_srcdir)/libs/esl/src/include $(SWITCH_AM_CFLAGS)" CXXFLAGS="-I$(switch_srcdir)/libs/esl/src/include $(SWITCH_AM_CXXFLAGS)" CXX_CFLAGS="$(CXX_CFLAGS)" -C tcl
@ -98,9 +103,12 @@ phpmod-install: phpmod
$(MAKE) -C php install
pymod-install: pymod
$(MAKE) -C python install
$(MAKE) PYTHON=$(PYTHON) -C python install
py3mod-install: py3mod
$(MAKE) PYTHON3=$(PYTHON3) -C python3 install
rubymod-install: rubymod
$(MAKE) -C ruby install
everymod: perlmod phpmod luamod pymod rubymod javamod managedmod
everymod: perlmod phpmod luamod pymod py3mod rubymod javamod managedmod

View File

@ -1,6 +1,6 @@
LOCAL_CFLAGS=`python ./python-config --includes`
LOCAL_LDFLAGS=`python ./python-config --ldflags`
SITE_DIR=$(DESTDIR)/`python -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)"`
LOCAL_CFLAGS=`$(PYTHON) ./python-config --includes`
LOCAL_LDFLAGS=`$(PYTHON) ./python-config --ldflags`
SITE_DIR=$(DESTDIR)/`$(PYTHON) -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)"`
all: _ESL.so

132
libs/esl/python3/ESL.py Normal file
View File

@ -0,0 +1,132 @@
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 3.0.2
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
from sys import version_info
if version_info >= (2,6,0):
def swig_import_helper():
from os.path import dirname
import imp
fp = None
try:
fp, pathname, description = imp.find_module('_ESL', [dirname(__file__)])
except ImportError:
import _ESL
return _ESL
if fp is not None:
try:
_mod = imp.load_module('_ESL', fp, pathname, description)
finally:
fp.close()
return _mod
_ESL = swig_import_helper()
del swig_import_helper
else:
import _ESL
del version_info
def _swig_setattr_nondynamic(self,class_type,name,value,static=1):
if (name == "thisown"): return self.this.own(value)
if (name == "this"):
if type(value).__name__ == 'SwigPyObject':
self.__dict__[name] = value
return
method = class_type.__swig_setmethods__.get(name,None)
if method: return method(self,value)
if (not static):
self.__dict__[name] = value
else:
raise AttributeError("You cannot add attributes to %s" % self)
def _swig_setattr(self,class_type,name,value):
return _swig_setattr_nondynamic(self,class_type,name,value,0)
def _swig_getattr(self,class_type,name):
if (name == "thisown"): return self.this.own()
method = class_type.__swig_getmethods__.get(name,None)
if method: return method(self)
raise AttributeError(name)
def _swig_repr(self):
try: strthis = "proxy of " + self.this.__repr__()
except: strthis = ""
return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
class ESLevent:
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, ESLevent, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, ESLevent, name)
__repr__ = _swig_repr
__swig_setmethods__["event"] = _ESL.ESLevent_event_set
__swig_getmethods__["event"] = _ESL.ESLevent_event_get
__swig_setmethods__["serialized_string"] = _ESL.ESLevent_serialized_string_set
__swig_getmethods__["serialized_string"] = _ESL.ESLevent_serialized_string_get
__swig_setmethods__["mine"] = _ESL.ESLevent_mine_set
__swig_getmethods__["mine"] = _ESL.ESLevent_mine_get
def __init__(self, *args):
this = _ESL.new_ESLevent(*args)
try: self.this.append(this)
except: self.this = this
__swig_destroy__ = _ESL.delete_ESLevent
__del__ = lambda self : None;
def serialize(self, format=None): return _ESL.ESLevent_serialize(self, format)
def setPriority(self, *args): return _ESL.ESLevent_setPriority(self, *args)
def getHeader(self, *args): return _ESL.ESLevent_getHeader(self, *args)
def getBody(self): return _ESL.ESLevent_getBody(self)
def getType(self): return _ESL.ESLevent_getType(self)
def addBody(self, *args): return _ESL.ESLevent_addBody(self, *args)
def addHeader(self, *args): return _ESL.ESLevent_addHeader(self, *args)
def pushHeader(self, *args): return _ESL.ESLevent_pushHeader(self, *args)
def unshiftHeader(self, *args): return _ESL.ESLevent_unshiftHeader(self, *args)
def delHeader(self, *args): return _ESL.ESLevent_delHeader(self, *args)
def firstHeader(self): return _ESL.ESLevent_firstHeader(self)
def nextHeader(self): return _ESL.ESLevent_nextHeader(self)
ESLevent_swigregister = _ESL.ESLevent_swigregister
ESLevent_swigregister(ESLevent)
class ESLconnection:
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, ESLconnection, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, ESLconnection, name)
__repr__ = _swig_repr
def __init__(self, *args):
this = _ESL.new_ESLconnection(*args)
try: self.this.append(this)
except: self.this = this
__swig_destroy__ = _ESL.delete_ESLconnection
__del__ = lambda self : None;
def socketDescriptor(self): return _ESL.ESLconnection_socketDescriptor(self)
def connected(self): return _ESL.ESLconnection_connected(self)
def getInfo(self): return _ESL.ESLconnection_getInfo(self)
def send(self, *args): return _ESL.ESLconnection_send(self, *args)
def sendRecv(self, *args): return _ESL.ESLconnection_sendRecv(self, *args)
def api(self, *args): return _ESL.ESLconnection_api(self, *args)
def bgapi(self, *args): return _ESL.ESLconnection_bgapi(self, *args)
def sendEvent(self, *args): return _ESL.ESLconnection_sendEvent(self, *args)
def sendMSG(self, *args): return _ESL.ESLconnection_sendMSG(self, *args)
def recvEvent(self): return _ESL.ESLconnection_recvEvent(self)
def recvEventTimed(self, *args): return _ESL.ESLconnection_recvEventTimed(self, *args)
def filter(self, *args): return _ESL.ESLconnection_filter(self, *args)
def events(self, *args): return _ESL.ESLconnection_events(self, *args)
def execute(self, *args): return _ESL.ESLconnection_execute(self, *args)
def executeAsync(self, *args): return _ESL.ESLconnection_executeAsync(self, *args)
def setAsyncExecute(self, *args): return _ESL.ESLconnection_setAsyncExecute(self, *args)
def setEventLock(self, *args): return _ESL.ESLconnection_setEventLock(self, *args)
def disconnect(self): return _ESL.ESLconnection_disconnect(self)
ESLconnection_swigregister = _ESL.ESLconnection_swigregister
ESLconnection_swigregister(ESLconnection)
def eslSetLogLevel(*args):
return _ESL.eslSetLogLevel(*args)
eslSetLogLevel = _ESL.eslSetLogLevel
# This file is compatible with both classic and new-style classes.

28
libs/esl/python3/Makefile Normal file
View File

@ -0,0 +1,28 @@
LOCAL_CFLAGS=`$(PYTHON3) ./python-config --includes`
LOCAL_LDFLAGS=`$(PYTHON3) ./python-config --ldflags`
SITE_DIR=$(DESTDIR)/`$(PYTHON3) -c "from distutils.sysconfig import get_python_lib; print (get_python_lib(1))"`
all: _ESL.so
esl_wrap.cpp:
swig3.0 -module ESL -classic -python -c++ -DMULTIPLICITY -threads -I../src/include -o esl_wrap.cpp ../ESL.i
esl_wrap.o: esl_wrap.cpp
$(CXX) $(CXX_CFLAGS) $(CXXFLAGS) $(LOCAL_CFLAGS) -c esl_wrap.cpp -o esl_wrap.o
_ESL.so: esl_wrap.o
$(CXX) $(SOLINK) esl_wrap.o $(MYLIB) $(LOCAL_LDFLAGS) -o _ESL.so -L. $(LIBS)
install: _ESL.so
mkdir -p $(SITE_DIR)
install -m 755 _ESL.so $(SITE_DIR)
install -m 755 ESL.py $(SITE_DIR)
clean:
rm -f *.o *.so *~
swigclean:
rm -f esl_wrap.* ESL.so
reswig: swigclean esl_wrap.cpp

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,20 @@
#!/usr/bin/env python
import string
import sys
from ESL import *
con = ESLconnection("localhost","8021","ClueCon")
#are we connected?
if con.connected:
con.events("plain", "all");
while 1:
#my $e = $con->recvEventTimed(100);
e = con.recvEvent()
if e:
print e.serialize()

View File

@ -0,0 +1,55 @@
#!/usr/bin/env python3
from __future__ import print_function
import sys
import os
import getopt
from distutils import sysconfig
valid_opts = ['prefix', 'exec-prefix', 'includes', 'libs', 'cflags',
'ldflags', 'help']
def exit_with_usage(code=1):
print("Usage: %s [%s]" % (sys.argv[0], '|'.join('--'+opt for opt in valid_opts)), file=sys.stderr)
sys.exit(code)
try:
opts, args = getopt.getopt(sys.argv[1:], '', valid_opts)
except getopt.error:
exit_with_usage()
if not opts:
exit_with_usage()
opt = opts[0][0]
pyver = sysconfig.get_config_var('LDVERSION')
if pyver == None:
pyver = sysconfig.get_config_var('VERSION')
getvar = sysconfig.get_config_var
if opt == '--help':
exit_with_usage(0)
elif opt == '--prefix':
print(sysconfig.PREFIX)
elif opt == '--exec-prefix':
print(sysconfig.EXEC_PREFIX)
elif opt in ('--includes', '--cflags'):
flags = ['-I' + sysconfig.get_python_inc(),
'-I' + sysconfig.get_python_inc(plat_specific=True)]
if opt == '--cflags':
flags.extend(getvar('CFLAGS').split())
print(' '.join(flags))
elif opt in ('--libs', '--ldflags'):
libs = getvar('LIBS').split() + getvar('SYSLIBS').split()
libs.append('-lpython'+pyver)
# add the prefix/lib/pythonX.Y/config dir, but only if there is no
# shared library in prefix/lib/.
if opt == '--ldflags' and not getvar('Py_ENABLE_SHARED'):
libs.insert(0, '-L' + getvar('LIBPL'))
print(' '.join(libs))

View File

@ -0,0 +1,29 @@
#!/usr/bin/env python
import SocketServer
from ESL import *
class ESLRequestHandler(SocketServer.BaseRequestHandler ):
def setup(self):
print self.client_address, 'connected!'
fd = self.request.fileno()
print fd
con = ESLconnection(fd)
print "Connected: "
print con.connected()
if con.connected():
info = con.getInfo()
uuid = info.getHeader("unique-id")
print uuid
con.execute("answer", "", uuid)
con.execute("playback", "/ram/swimp.raw", uuid);
#server host is a tuple ('host', port)
server = SocketServer.ThreadingTCPServer(('', 8040), ESLRequestHandler)
server.serve_forever()

View File

@ -0,0 +1,43 @@
#!/usr/bin/env python
import string
import sys
from optparse import OptionParser
from ESL import *
def main(argv):
try:
parser = OptionParser()
parser.add_option("-a", "--auth", dest="auth", default="ClueCon",
help="ESL password")
parser.add_option("-s", "--server", dest="server", default="127.0.0.1",
help="FreeSWITCH server IP address")
parser.add_option("-p", "--port", dest="port", default="8021",
help="FreeSWITCH server event socket port")
parser.add_option("-c", "--command", dest="command",
help="command to run, surround mutli word commands in \"\'s")
(options, args) = parser.parse_args()
con = ESLconnection(options.server, options.port, options.auth)
#are we connected?
if con.connected():
#run command
e = con.api(options.command)
print e.getBody()
else:
print "Not Connected"
sys.exit(2)
except:
print parser.get_usage()
if __name__ == "__main__":
main(sys.argv[1:])

View File

@ -132,6 +132,7 @@ static const char *EVENT_NAMES[] = {
"SEND_INFO",
"RECV_INFO",
"RECV_RTCP_MESSAGE",
"SEND_RTCP_MESSAGE",
"CALL_SECURE",
"NAT",
"RECORD_START",
@ -483,11 +484,14 @@ static esl_status_t esl_event_base_add_header(esl_event_t *event, esl_stack_t st
exists = 1;
}
FREE(data);
goto redraw;
}
} else if (tmp_header) {
free_header(&tmp_header);
}
FREE(data);
goto end;
} else {
if ((stack & ESL_STACK_PUSH) || (stack & ESL_STACK_UNSHIFT)) {

View File

@ -120,6 +120,7 @@ typedef enum {
ESL_EVENT_SEND_INFO,
ESL_EVENT_RECV_INFO,
ESL_EVENT_RECV_RTCP_MESSAGE,
ESL_EVENT_SEND_RTCP_MESSAGE,
ESL_EVENT_CALL_SECURE,
ESL_EVENT_NAT,
ESL_EVENT_RECORD_START,

View File

@ -374,6 +374,6 @@ main (int argc, char *argv[])
#ifdef _WIN32
WSACleanup ();
#endif
if (file) free(file);
return 0;
}

View File

@ -1297,6 +1297,8 @@ static int on_subscribe(void *user_data, ikspak *pak)
handle->session_callback(handle, NULL, LDL_SIGNAL_SUBSCRIBE, to, from, NULL, NULL);
}
if (id) free(id);
return IKS_FILTER_EAT;
}
@ -2325,6 +2327,9 @@ void ldl_handle_send_msg(ldl_handle_t *handle, char *from, char *to, const char
if (strchr(my_body, '<')) {
len = (int) strlen(my_body);
if (!(bdup = malloc(len))) {
if (my_body_base) {
free(my_body_base);
}
return;
}

View File

@ -865,7 +865,11 @@ process_common_toolchain() {
case ${toolchain} in
*-darwin-*)
mvmin=$(sw_vers -productVersion)
mvmin="-mmacosx-version-min="${mvmin%.*}
if [[ $mvmin == 10.* ]]; then
mvmin="-mmacosx-version-min=""${mvmin%.*}"
else
mvmin="-mmacosx-version-min=""${mvmin%%.*}"
fi
add_cflags $mvmin
add_ldflags $mvmin
;;

View File

@ -631,16 +631,16 @@ void vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset,
}
#endif
assert(plane[LAST_FRAME][0] != NULL);
dot_artifact_candidate = check_dot_artifact_candidate(
if (plane[LAST_FRAME][0]) dot_artifact_candidate = check_dot_artifact_candidate(
cpi, x, target_y, stride, plane[LAST_FRAME][0], mb_row, mb_col, 0);
// If not found in Y channel, check UV channel.
if (!dot_artifact_candidate) {
assert(plane[LAST_FRAME][1] != NULL);
dot_artifact_candidate = check_dot_artifact_candidate(
if (plane[LAST_FRAME][1]) dot_artifact_candidate = check_dot_artifact_candidate(
cpi, x, target_u, stride_uv, plane[LAST_FRAME][1], mb_row, mb_col, 1);
if (!dot_artifact_candidate) {
assert(plane[LAST_FRAME][2] != NULL);
dot_artifact_candidate = check_dot_artifact_candidate(
if (plane[LAST_FRAME][2]) dot_artifact_candidate = check_dot_artifact_candidate(
cpi, x, target_v, stride_uv, plane[LAST_FRAME][2], mb_row, mb_col,
2);
}

View File

@ -72,7 +72,7 @@ static int remap_prob(int v, int m) {
i = recenter_nonneg(MAX_PROB - 1 - v, MAX_PROB - 1 - m) - 1;
assert(i >= 0 && (size_t)i < sizeof(map_table));
i = map_table[i];
if (i >= 0 && (size_t)i < sizeof(map_table)) i = map_table[i];
return i;
}

View File

@ -736,6 +736,9 @@ static void ScaleAddCols2_C(int dst_width,
int dx,
const uint16_t* src_ptr,
uint8_t* dst_ptr) {
#ifdef __clang_analyzer__
*dst_ptr = 0;
#else
int i;
int scaletbl[2];
int minboxwidth = dx >> 16;
@ -750,6 +753,7 @@ static void ScaleAddCols2_C(int dst_width,
SumPixels(boxwidth, src_ptr + ix) * scaletbl[boxwidth - minboxwidth] >>
16;
}
#endif
}
static void ScaleAddCols2_16_C(int dst_width,
@ -758,6 +762,9 @@ static void ScaleAddCols2_16_C(int dst_width,
int dx,
const uint32_t* src_ptr,
uint16_t* dst_ptr) {
#ifdef __clang_analyzer__
* dst_ptr = 0;
#else
int i;
int scaletbl[2];
int minboxwidth = dx >> 16;
@ -772,6 +779,7 @@ static void ScaleAddCols2_16_C(int dst_width,
scaletbl[boxwidth - minboxwidth] >>
16;
}
#endif
}
static void ScaleAddCols0_C(int dst_width,

View File

@ -1,196 +0,0 @@
/* config_in.h. Generated from configure.ac by autoheader. */
/* Define if building universal (internal helper macro) */
#undef AC_APPLE_UNIVERSAL_BUILD
/* Define if building for a CISC machine (e.g. Intel). */
#undef CPU_CISC
/* Define if building for a RISC machine (assume slow byte access). */
#undef CPU_RISC
/* Define to enabled debug logging for all mudules. */
#undef ENABLE_DEBUG_LOGGING
/* Logging statments will be writen to this file. */
#undef ERR_REPORTING_FILE
/* Define to redirect logging to stdout. */
#undef ERR_REPORTING_STDOUT
/* Define this to use AES-GCM. */
#undef GCM
/* Define to 1 if you have the <arpa/inet.h> header file. */
#undef HAVE_ARPA_INET_H
/* Define to 1 if you have the <byteswap.h> header file. */
#undef HAVE_BYTESWAP_H
/* Define to 1 if you have the `inet_aton' function. */
#undef HAVE_INET_ATON
/* Define to 1 if the system has the type `int16_t'. */
#undef HAVE_INT16_T
/* Define to 1 if the system has the type `int32_t'. */
#undef HAVE_INT32_T
/* Define to 1 if the system has the type `int8_t'. */
#undef HAVE_INT8_T
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the `dl' library (-ldl). */
#undef HAVE_LIBDL
/* Define to 1 if you have the `nspr4' library (-lnspr4). */
#undef HAVE_LIBNSPR4
/* Define to 1 if you have the `nss3' library (-lnss3). */
#undef HAVE_LIBNSS3
/* Define to 1 if you have the `socket' library (-lsocket). */
#undef HAVE_LIBSOCKET
/* Define to 1 if you have the `z' library (-lz). */
#undef HAVE_LIBZ
/* Define to 1 if you have the <machine/types.h> header file. */
#undef HAVE_MACHINE_TYPES_H
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the <netinet/in.h> header file. */
#undef HAVE_NETINET_IN_H
/* Define to 1 if you have the <nss.h> header file. */
#undef HAVE_NSS_H
/* Define to 1 if you have the `winpcap' library (-lwpcap) */
#undef HAVE_PCAP
/* Define to 1 if you have the `sigaction' function. */
#undef HAVE_SIGACTION
/* Define to 1 if you have the `socket' function. */
#undef HAVE_SOCKET
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the <sys/int_types.h> header file. */
#undef HAVE_SYS_INT_TYPES_H
/* Define to 1 if you have the <sys/socket.h> header file. */
#undef HAVE_SYS_SOCKET_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the <sys/uio.h> header file. */
#undef HAVE_SYS_UIO_H
/* Define to 1 if the system has the type `uint16_t'. */
#undef HAVE_UINT16_T
/* Define to 1 if the system has the type `uint32_t'. */
#undef HAVE_UINT32_T
/* Define to 1 if the system has the type `uint64_t'. */
#undef HAVE_UINT64_T
/* Define to 1 if the system has the type `uint8_t'. */
#undef HAVE_UINT8_T
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define to 1 if you have the `usleep' function. */
#undef HAVE_USLEEP
/* Define to 1 if you have the <windows.h> header file. */
#undef HAVE_WINDOWS_H
/* Define to 1 if you have the <winsock2.h> header file. */
#undef HAVE_WINSOCK2_H
/* Define to use X86 inlined assembly code */
#undef HAVE_X86
/* Define this to use NSS crypto. */
#undef NSS
/* Define this to use OpenSSL crypto. */
#undef OPENSSL
/* Define this if OPENSSL_cleanse is broken. */
#undef OPENSSL_CLEANSE_BROKEN
/* Define this to use OpenSSL KDF for SRTP. */
#undef OPENSSL_KDF
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* The size of `unsigned long', as computed by sizeof. */
#undef SIZEOF_UNSIGNED_LONG
/* The size of `unsigned long long', as computed by sizeof. */
#undef SIZEOF_UNSIGNED_LONG_LONG
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
significant byte first (like Motorola and SPARC, unlike Intel). */
#if defined AC_APPLE_UNIVERSAL_BUILD
# if defined __BIG_ENDIAN__
# define WORDS_BIGENDIAN 1
# endif
#else
# ifndef WORDS_BIGENDIAN
# undef WORDS_BIGENDIAN
# endif
#endif
/* Define to empty if `const' does not conform to ANSI C. */
#undef const
/* Define to `__inline__' or `__inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */
#ifndef __cplusplus
#undef inline
#endif
/* Define to `unsigned int' if <sys/types.h> does not define. */
#undef size_t

View File

@ -168,7 +168,7 @@ void octet_string_set_to_zero(void *s, size_t len);
#define be64_to_cpu(x) bswap_64((x))
#else /* WORDS_BIGENDIAN */
#if defined(__GNUC__) && (defined(HAVE_X86) || defined(__x86_64__))
#if defined(__GNUC__) && defined(HAVE_X86)
/* Fall back. */
static inline uint32_t be32_to_cpu(uint32_t v)
{

7656
libs/stb/stb_image.h Normal file

File diff suppressed because it is too large Load Diff

1666
libs/stb/stb_image_write.h Normal file

File diff suppressed because it is too large Load Diff

View File

@ -190,6 +190,11 @@
<ClInclude Include="include\mpf_termination_factory.h" />
<ClInclude Include="include\mpf_types.h" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\win32\apr\libapr.2017.vcxproj">
<Project>{f6c55d93-b927-4483-bb69-15aef3dd2dff}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>

View File

@ -120,6 +120,11 @@
<ClCompile Include="src\mrcp_client.c" />
<ClCompile Include="src\mrcp_client_session.c" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\win32\apr\libapr.2017.vcxproj">
<Project>{f6c55d93-b927-4483-bb69-15aef3dd2dff}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>

View File

@ -119,6 +119,11 @@
<ClCompile Include="src\mrcp_session_descriptor.c" />
<ClCompile Include="src\mrcp_sig_agent.c" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\win32\apr\libapr.2017.vcxproj">
<Project>{f6c55d93-b927-4483-bb69-15aef3dd2dff}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>

View File

@ -152,6 +152,11 @@
<ClCompile Include="resources\src\mrcp_verifier_header.c" />
<ClCompile Include="resources\src\mrcp_verifier_resource.c" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\win32\apr\libapr.2017.vcxproj">
<Project>{f6c55d93-b927-4483-bb69-15aef3dd2dff}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>

View File

@ -123,6 +123,11 @@
<ClCompile Include="src\mrcp_control_descriptor.c" />
<ClCompile Include="src\mrcp_server_connection.c" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\win32\apr\libapr.2017.vcxproj">
<Project>{f6c55d93-b927-4483-bb69-15aef3dd2dff}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>

View File

@ -130,6 +130,11 @@
<ClCompile Include="src\rtsp_start_line.c" />
<ClCompile Include="src\rtsp_stream.c" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\win32\apr\libapr.2017.vcxproj">
<Project>{f6c55d93-b927-4483-bb69-15aef3dd2dff}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>

View File

@ -182,6 +182,9 @@
<Project>{0feeaec6-4399-4c46-b7db-62ece80d15b4}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
<ProjectReference Include="..\pthread\pthread.2017.vcxproj">
<Project>{df018947-0fff-4eb3-bdee-441dc81da7a4}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">

View File

@ -8,7 +8,7 @@ wget -O - https://files.freeswitch.org/repo/deb/debian/freeswitch_archive_g0.pub
echo "deb http://files.freeswitch.org/repo/deb/freeswitch-1.6/ jessie main" > /etc/apt/sources.list.d/freeswitch.list
apt-get update && apt-get install -y libtool libjpeg62-turbo-dev ntpdate libfreetype6-dev git-buildpackage doxygen yasm gdb git build-essential automake autoconf wget uuid-dev zlib1g-dev libncurses5-dev libssl-dev libpcre3-dev libcurl4-openssl-dev libldns-dev libedit-dev libspeexdsp-dev libsqlite3-dev perl libgdbm-dev libdb-dev bison pkg-config ccache libpng16-dev libpng12-dev libopenal-dev libbroadvoice-dev libcodec2-dev libflite-dev libg7221-dev libilbc-dev libsilk-dev liblua5.2-dev libopus-dev libsndfile-dev libavformat-dev libavcodec-extra libx264-dev libperl-dev unixodbc-dev libpq-dev libsctp-dev
apt-get update && apt-get install -y libtool libjpeg62-turbo-dev ntpdate libfreetype6-dev git-buildpackage doxygen yasm gdb git build-essential automake autoconf wget uuid-dev zlib1g-dev libncurses5-dev libssl-dev libpcre3-dev libcurl4-openssl-dev libldns-dev libedit-dev libspeexdsp-dev libsqlite3-dev perl libgdbm-dev libdb-dev bison pkg-config ccache libpng16-dev libpng12-dev libopenal-dev libbroadvoice-dev libcodec2-dev libflite-dev libg7221-dev libilbc-dev libsilk-dev liblua5.2-dev libopus-dev libsndfile-dev libavformat-dev libavcodec-extra libswscale-dev libx264-dev libperl-dev unixodbc-dev libpq-dev libsctp-dev
cd /usr/src

View File

@ -0,0 +1,66 @@
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2021, Anthony Minessale II <anthm@freeswitch.org>
*
* Version: MPL 1.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
*
* The Initial Developer of the Original Code is
* Anthony Minessale II <anthm@freeswitch.org>
* Portions created by the Initial Developer are Copyright (C)
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Anthony Minessale II <anthm@freeswitch.org>
* Andrey Volk <andywolk@gmail.com>
*
*
* switch_apr_pvt.h - APR
*
*/
#ifndef __SWITCH_APR_PVT_H__
#define __SWITCH_APR_PVT_H__
/* for apr_pool_create and apr_pool_destroy */
/* functions only used in this file so not exposed */
#include <apr_pools.h>
/* for apr_hash_make, apr_hash_pool_get, apr_hash_set */
/* functions only used in this file so not exposed */
#include <apr_hash.h>
/* for apr_pvsprintf */
/* function only used in this file so not exposed */
#include <apr_strings.h>
/* for apr_initialize and apr_terminate */
/* function only used in this file so not exposed */
#include <apr_general.h>
#include <apr_portable.h>
#endif // __SWITCH_APR_PVT_H__
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
*/

View File

@ -32,32 +32,12 @@
* this file does not exist!!!!
*
*/
#define SPANDSP_NO_TIFF 1
#include "spandsp.h"
#include "switch_profile.h"
#ifndef WIN32
#include <switch_private.h>
#endif
/* for apr_pool_create and apr_pool_destroy */
/* functions only used in this file so not exposed */
#include <apr_pools.h>
/* for apr_hash_make, apr_hash_pool_get, apr_hash_set */
/* functions only used in this file so not exposed */
#include <apr_hash.h>
/* for apr_pvsprintf */
/* function only used in this file so not exposed */
#include <apr_strings.h>
/* for apr_initialize and apr_terminate */
/* function only used in this file so not exposed */
#include <apr_general.h>
#include <apr_portable.h>
#ifdef HAVE_MLOCKALL
#include <sys/mman.h>
#endif
@ -175,7 +155,7 @@ struct switch_core_session {
switch_log_level_t loglevel;
uint32_t soft_lock;
switch_ivr_dmachine_t *dmachine[2];
plc_state_t *plc;
switch_plc_state_t *plc;
switch_media_handle_t *media_handle;
uint32_t decoder_errors;
@ -189,6 +169,7 @@ struct switch_core_session {
switch_buffer_t *text_buffer;
switch_buffer_t *text_line_buffer;
switch_mutex_t *text_mutex;
const char *external_id;
};
struct switch_media_bug {
@ -305,6 +286,7 @@ struct switch_runtime {
uint32_t port_alloc_flags;
char *event_channel_key_separator;
uint32_t max_audio_channels;
switch_call_cause_t shutdown_cause;
};
extern struct switch_runtime runtime;

View File

@ -112,6 +112,7 @@
#include "switch_platform.h"
#include "switch_types.h"
#include "switch_apr.h"
#include "switch_spandsp.h"
#include "switch_mprintf.h"
#include "switch_core_db.h"
#include "switch_dso.h"
@ -136,6 +137,7 @@
#include "switch_core_event_hook.h"
#include "switch_scheduler.h"
#include "switch_config.h"
#include "switch_packetizer.h"
#include "switch_nat.h"
#include "switch_odbc.h"
#include "switch_json.h"

View File

@ -278,6 +278,8 @@ SWITCH_DECLARE(switch_status_t) switch_channel_get_log_tags(switch_channel_t *ch
SWITCH_DECLARE(switch_status_t) switch_channel_set_variable_var_check(switch_channel_t *channel,
const char *varname, const char *value, switch_bool_t var_check);
SWITCH_DECLARE(switch_status_t) switch_channel_set_variable_strip_quotes_var_check(switch_channel_t *channel,
const char *varname, const char *value, switch_bool_t var_check);
SWITCH_DECLARE(switch_status_t) switch_channel_add_variable_var_check(switch_channel_t *channel,
const char *varname, const char *value, switch_bool_t var_check, switch_stack_t stack);
SWITCH_DECLARE(switch_status_t) switch_channel_set_variable_printf(switch_channel_t *channel, const char *varname, const char *fmt, ...);
@ -295,6 +297,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_transfer_variable_prefix(switch_c
#define switch_channel_set_variable_safe(_channel, _var, _val) switch_channel_set_variable_var_check(_channel, _var, _val, SWITCH_FALSE)
#define switch_channel_set_variable(_channel, _var, _val) switch_channel_set_variable_var_check(_channel, _var, _val, SWITCH_TRUE)
#define switch_channel_set_variable_strip_quotes(_channel, _var, _val) switch_channel_set_variable_strip_quotes_var_check(_channel, _var, _val, SWITCH_TRUE)
#define switch_channel_set_variable_partner(_channel, _var, _val) switch_channel_set_variable_partner_var_check(_channel, _var, _val, SWITCH_TRUE)
@ -323,7 +326,7 @@ SWITCH_DECLARE(const char *) switch_channel_get_variable_dup(switch_channel_t *c
#define switch_channel_get_variable(_c, _v) switch_channel_get_variable_dup(_c, _v, SWITCH_TRUE, -1)
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);
static inline int switch_channel_var_false(switch_channel_t *channel, const char *variable) {
@ -682,6 +685,7 @@ SWITCH_DECLARE(void) switch_channel_mark_hold(switch_channel_t *channel, switch_
/** @} */
SWITCH_DECLARE(switch_status_t) switch_channel_execute_on(switch_channel_t *channel, const char *variable_prefix);
SWITCH_DECLARE(switch_status_t) switch_channel_execute_on_value(switch_channel_t *channel, const char *variable_value);
SWITCH_DECLARE(switch_status_t) switch_channel_api_on(switch_channel_t *channel, const char *variable_prefix);
SWITCH_DECLARE(void) switch_channel_process_device_hangup(switch_channel_t *channel);
SWITCH_DECLARE(switch_caller_extension_t *) switch_channel_get_queued_extension(switch_channel_t *channel);

View File

@ -1,6 +1,6 @@
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
* Copyright (C) 2005-2020, Anthony Minessale II <anthm@freeswitch.org>
*
* Version: MPL 1.1
*
@ -67,6 +67,7 @@ typedef struct switch_thread_data_s {
switch_thread_start_t func;
void *obj;
int alloc;
int running;
switch_memory_pool_t *pool;
} switch_thread_data_t;
@ -243,14 +244,6 @@ static inline void *switch_must_realloc(void *_b, size_t _z)
return m;
}
static inline char *switch_must_strdup(const char *_s)
{
char *s = strdup(_s);
switch_assert(s);
return s;
}
/*!
\defgroup core1 Core Library
\ingroup FREESWITCH
@ -811,6 +804,8 @@ SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_uuid(_In_ sw
SWITCH_DECLARE(switch_status_t) switch_core_session_set_uuid(_In_ switch_core_session_t *session, _In_z_ const char *use_uuid);
SWITCH_DECLARE(switch_status_t) switch_core_session_set_external_id(_In_ switch_core_session_t *session, _In_z_ const char *use_external_id);
SWITCH_DECLARE(void) switch_core_session_perform_destroy(_Inout_ switch_core_session_t **session,
_In_z_ const char *file, _In_z_ const char *func, _In_ int line);
@ -859,6 +854,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_thread_launch(_In_ switch_co
SWITCH_DECLARE(switch_status_t) switch_thread_pool_launch_thread(switch_thread_data_t **tdp);
SWITCH_DECLARE(switch_status_t) switch_core_session_thread_pool_launch(switch_core_session_t *session);
SWITCH_DECLARE(switch_status_t) switch_thread_pool_wait(switch_thread_data_t *td, int ms);
/*!
\brief Retrieve a pointer to the channel object associated with a given session
@ -881,6 +877,13 @@ SWITCH_DECLARE(void) switch_core_session_signal_state_change(_In_ switch_core_se
*/
SWITCH_DECLARE(char *) switch_core_session_get_uuid(_In_ switch_core_session_t *session);
/*!
\brief Retrieve the unique external identifier from a session
\param session the session to retrieve the uuid from
\return a string representing the uuid
*/
SWITCH_DECLARE(const char *) switch_core_session_get_external_id(_In_ switch_core_session_t *session);
/*!
\brief Sets the log level for a session
@ -1436,6 +1439,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_hash_init_case(_Out_ switch_hash_t *
*/
SWITCH_DECLARE(switch_status_t) switch_core_hash_destroy(_Inout_ switch_hash_t **hash);
/*!
\brief Insert data into a hash with an auto-generated key based on the data pointer
\param hash the hash to add data to
\param data unique pointer to add
\return SWITCH_STATUS_SUCCESS if the data is added
*/
SWITCH_DECLARE(switch_status_t) switch_core_hash_insert_pointer(switch_hash_t *hash, const void *data);
/*!
\brief Insert data into a hash and set flags so the value is automatically freed on delete
\param hash the hash to add data to
@ -1446,6 +1457,16 @@ SWITCH_DECLARE(switch_status_t) switch_core_hash_destroy(_Inout_ switch_hash_t *
*/
SWITCH_DECLARE(switch_status_t) switch_core_hash_insert_auto_free(switch_hash_t *hash, const char *key, const void *data);
/*!
\brief Insert strdup(str) into a hash and set flags so the value is automatically freed on delete
\param hash the hash to add str to
\param key the name of the key to add the str to
\param str string to strdup and add
\return SWITCH_STATUS_SUCCESS if the data is added
\note the string key must be a constant or a dynamic string
*/
SWITCH_DECLARE(switch_status_t) switch_core_hash_insert_dup_auto_free(switch_hash_t *hash, const char *key, const char *str);
/*!
\brief Insert data into a hash
\param hash the hash to add data to
@ -1457,6 +1478,28 @@ SWITCH_DECLARE(switch_status_t) switch_core_hash_insert_auto_free(switch_hash_t
SWITCH_DECLARE(switch_status_t) switch_core_hash_insert_destructor(_In_ switch_hash_t *hash, _In_z_ const char *key, _In_opt_ const void *data, hashtable_destructor_t destructor);
#define switch_core_hash_insert(_h, _k, _d) switch_core_hash_insert_destructor(_h, _k, _d, NULL)
/*!
\brief Allocate memory and insert into a hash
\param hash the hash to add data to
\param key the name of the key to add the data to
\param size the size in bytes to allocate
\return pointer to the allocated memory
\note the string key must be a constant or a dynamic string
*/
SWITCH_DECLARE(void *) switch_core_hash_insert_alloc_destructor(_In_ switch_hash_t *hash, _In_z_ const char *key, _In_opt_ size_t size, hashtable_destructor_t destructor);
#define switch_core_hash_insert_alloc(_h, _k, _s) switch_core_hash_insert_alloc_destructor(_h, _k, _s, NULL)
/*!
\brief Insert strdup(str) into a hash
\param hash the hash to add str to
\param key the name of the key to add the str to
\param str string to strdup and add
\return SWITCH_STATUS_SUCCESS if the data is added
\note the string key must be a constant or a dynamic string
*/
SWITCH_DECLARE(switch_status_t) switch_core_hash_insert_dup_destructor(_In_ switch_hash_t *hash, _In_z_ const char *key, _In_opt_ const char *str, hashtable_destructor_t destructor);
#define switch_core_hash_insert_dup(_h, _k, _d) switch_core_hash_insert_dup_destructor(_h, _k, _d, NULL)
/*!
\brief Insert data into a hash

View File

@ -49,6 +49,12 @@ typedef enum {
DTMF_NONE
} switch_core_media_dtmf_t;
typedef enum {
AVP_NO_SECURE,
AVP_SECURE,
AVP_UNDEFINED
} switch_core_media_avp_secure_t;
typedef enum {
SM_NDLB_ALLOW_BAD_IANANAME = (1 << 0),
SM_NDLB_ALLOW_NONDUP_SDP = (1 << 1),
@ -207,6 +213,7 @@ SWITCH_DECLARE(int) switch_core_session_check_incoming_crypto(switch_core_sessio
SWITCH_DECLARE(uint32_t) switch_core_media_get_video_fps(switch_core_session_t *session);
SWITCH_DECLARE(void) switch_core_media_set_rtp_session(switch_core_session_t *session, switch_media_type_t type, switch_rtp_t *rtp_session);
SWITCH_DECLARE(switch_rtp_t *) switch_core_media_get_rtp_session(switch_core_session_t *session, switch_media_type_t type);
SWITCH_DECLARE(const char *)switch_core_media_get_codec_string(switch_core_session_t *session);
SWITCH_DECLARE(void) switch_core_media_parse_rtp_bugs(switch_rtp_bug_flag_t *flag_pole, const char *str);
@ -248,6 +255,8 @@ SWITCH_DECLARE(switch_core_media_params_t *) switch_core_media_get_mparams(switc
SWITCH_DECLARE(void) switch_core_media_prepare_codecs(switch_core_session_t *session, switch_bool_t force);
SWITCH_DECLARE(void) switch_core_media_start_udptl(switch_core_session_t *session, switch_t38_options_t *t38_options);
SWITCH_DECLARE(void) switch_core_media_hard_mute(switch_core_session_t *session, switch_bool_t on);
SWITCH_DECLARE(cJSON *) switch_core_media_gen_json_constraint(float min, float ideal, float max);
SWITCH_DECLARE(switch_status_t) switch_core_media_media_params(switch_core_session_t *session, const char *json);
SWITCH_DECLARE(switch_status_t) switch_core_media_receive_message(switch_core_session_t *session, switch_core_session_message_t *msg);
@ -390,6 +399,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_printf(switch_core_session_t
SWITCH_DECLARE(switch_msrp_session_t *) switch_core_media_get_msrp_session(switch_core_session_t *session);
SWITCH_DECLARE(void) switch_core_media_set_smode(switch_core_session_t *session, switch_media_type_t type, switch_media_flow_t smode, switch_sdp_type_t sdp_type);
SWITCH_DECLARE(void) switch_core_media_set_resolveice(switch_bool_t resolve_ice);
SWITCH_DECLARE(switch_bool_t) switch_core_media_has_resolveice(void);
SWITCH_END_EXTERN_C
#endif
/* For Emacs:

View File

@ -390,10 +390,21 @@ SWITCH_DECLARE(void) switch_img_patch_hole(switch_image_t *IMG, switch_image_t *
SWITCH_DECLARE(switch_status_t) switch_png_patch_img(switch_png_t *use_png, switch_image_t *img, int x, int y);
SWITCH_DECLARE(switch_image_t *) switch_img_read_png(const char *file_name, switch_img_fmt_t img_fmt);
SWITCH_DECLARE(switch_image_t *) switch_img_read_png_from_memory(void *mem, size_t size, switch_img_fmt_t img_fmt);
SWITCH_DECLARE(switch_status_t) switch_img_write_png(switch_image_t *img, char *file_name);
SWITCH_DECLARE(switch_status_t) switch_png_open(switch_png_t **pngP, const char *file_name);
SWITCH_DECLARE(void) switch_png_free(switch_png_t **pngP);
SWITCH_DECLARE(switch_status_t) switch_img_data_url_png(switch_image_t *img, char **urlP);
SWITCH_DECLARE(switch_status_t) switch_img_data_url(switch_image_t *img, char **urlP, const char *type, int quality);
/*!\brief Read an image file to switch_image_t */
SWITCH_DECLARE(switch_image_t *) switch_img_read_from_file(const char *file_name, switch_img_fmt_t img_fmt);
/*!\brief Write an image file, supported formats png,jpg,bmp,tga,hdr
* \param[in] img The image descriptor
* \param[in] file_name The file_name to write
* \param[in] quality Only used in jpg, 1 ~ 100
*/
SWITCH_DECLARE(switch_status_t) switch_img_write_to_file(switch_image_t *img, const char* file_name, int quality);
/*!\brief put a small img over a big IMG at position x,y, with alpha transparency
*
@ -410,6 +421,7 @@ SWITCH_DECLARE(void) switch_img_overlay(switch_image_t *IMG, switch_image_t *img
SWITCH_DECLARE(switch_status_t) switch_img_mirror(switch_image_t *src, switch_image_t **destP);
SWITCH_DECLARE(switch_status_t) switch_img_scale(switch_image_t *src, switch_image_t **destP, int width, int height);
SWITCH_DECLARE(switch_status_t) switch_img_fit(switch_image_t **srcP, int width, int height, switch_img_fit_t fit);
SWITCH_DECLARE(void) switch_img_calc_fit(switch_image_t *src, int width, int height, int *new_wP, int *new_hP);
SWITCH_DECLARE(switch_img_position_t) parse_img_position(const char *name);
SWITCH_DECLARE(switch_img_fit_t) parse_img_fit(const char *name);
SWITCH_DECLARE(void) switch_img_find_position(switch_img_position_t pos, int sw, int sh, int iw, int ih, int *xP, int *yP);

View File

@ -438,7 +438,19 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_gentones(switch_core_session_t *sessi
SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(_In_ switch_core_session_t *session,
_In_ switch_file_handle_t *fh,
_In_z_ const char *file, _In_opt_ switch_input_args_t *args, _In_ uint32_t limit);
/*!
\brief record a file from the session to a file
\param session the session to record from
\param fh file handle to use
\param file the path to the file
\param args arguements to pass for callbacks etc
\param limit max limit to record for (0 for infinite)
\param vars vars to add to RECORD_START and RECORD_STOP automatically prefixed with Recording-Variable-
\return SWITCH_STATUS_SUCCESS if all is well
*/
SWITCH_DECLARE(switch_status_t) switch_ivr_record_file_event(_In_ switch_core_session_t *session,
_In_ switch_file_handle_t *fh,
_In_z_ const char *file, _In_opt_ switch_input_args_t *args, _In_ uint32_t limit, switch_event_t *vars);
/*!
\brief Play a sound and gather digits with the number of retries specified if the user doesn't give digits in the set time
@ -1031,6 +1043,7 @@ SWITCH_DECLARE(char *) switch_ivr_check_presence_mapping(const char *exten_name,
SWITCH_DECLARE(switch_status_t) switch_ivr_kill_uuid(const char *uuid, switch_call_cause_t cause);
SWITCH_DECLARE(switch_status_t) switch_ivr_blind_transfer_ack(switch_core_session_t *session, switch_bool_t success);
SWITCH_DECLARE(switch_status_t) switch_ivr_record_session_mask(switch_core_session_t *session, const char *file, switch_bool_t on);
SWITCH_DECLARE(switch_status_t) switch_ivr_record_session_pause(switch_core_session_t *session, const char *file, switch_bool_t on);
SWITCH_DECLARE(switch_status_t) switch_ivr_stop_video_write_overlay_session(switch_core_session_t *session);
@ -1069,6 +1082,7 @@ SWITCH_DECLARE(void) switch_dial_handle_list_add_global_var(switch_dial_handle_l
SWITCH_DECLARE(void) switch_dial_handle_list_add_global_var_printf(switch_dial_handle_list_t *hl, const char *var, const char *fmt, ...);
SWITCH_DECLARE(switch_status_t) switch_ivr_enterprise_orig_and_bridge(switch_core_session_t *session, const char *data, switch_dial_handle_list_t *hl, switch_call_cause_t *cause);
SWITCH_DECLARE(switch_status_t) switch_ivr_orig_and_bridge(switch_core_session_t *session, const char *data, switch_dial_handle_t *dh, switch_call_cause_t *cause);
SWITCH_DECLARE(switch_status_t) switch_ivr_send_prompt(switch_core_session_t *session, const char *type, const char *text, const char *regex);
SWITCH_DECLARE(switch_status_t) switch_ivr_play_and_collect_input(switch_core_session_t *session,
const char *prompt,

View File

@ -66,6 +66,10 @@ SWITCH_BEGIN_EXTERN_C
switch_text_channel_t channel;
switch_log_level_t slevel;
switch_event_t *tags;
/* Log sequence */
int64_t sequence;
/* Optional extra log metadata */
cJSON *meta;
} switch_log_node_t;
///\{
@ -94,6 +98,7 @@ typedef struct {
switch_log_json_format_item_t short_message;
const char *custom_field_prefix;
double timestamp_divisor;
switch_log_json_format_item_t sequence;
} switch_log_json_format_t;
typedef switch_status_t (*switch_log_function_t) (const switch_log_node_t *node, switch_log_level_t level);
@ -154,7 +159,40 @@ SWITCH_DECLARE(void) switch_log_printf(_In_ switch_text_channel_t channel, _In_z
SWITCH_DECLARE(void) switch_log_vprintf(_In_ switch_text_channel_t channel, _In_z_ const char *file,
_In_z_ const char *func, _In_ int line,
_In_opt_z_ const char *userdata, _In_ switch_log_level_t level, const char *fmt, va_list ap);
/*!
\brief Write log data to the logging engine w/ optional JSON metadata
\param channel the log channel to write to
\param file the current file
\param func the current function
\param line the current line
\param userdata ununsed
\param level the current log level
\param meta log metadata - consumed by this function
\param fmt desired format
\param ... variable args
\note there are channel macros to supply the first 4 parameters (SWITCH_CHANNEL_LOG, SWITCH_CHANNEL_LOG_CLEAN, ...)
\see switch_types.h
*/
SWITCH_DECLARE(void) switch_log_meta_printf(switch_text_channel_t channel, const char *file, const char *func, int line,
const char *userdata, switch_log_level_t level, cJSON **meta, const char *fmt, ...) PRINTF_FUNCTION(8, 9);
/*!
\brief Write log data to the logging engine w/ optional JSON metadata
\param channel the log channel to write to
\param file the current file
\param func the current function
\param line the current line
\param userdata ununsed
\param level the current log level
\param meta log metadata - consumed by this function
\param fmt desired format
\param ap variable args
\note there are channel macros to supply the first 4 parameters (SWITCH_CHANNEL_LOG, SWITCH_CHANNEL_LOG_CLEAN, ...)
\see switch_types.h
*/
SWITCH_DECLARE(void) switch_log_meta_vprintf(_In_ switch_text_channel_t channel, _In_z_ const char *file,
_In_z_ const char *func, _In_ int line,
_In_opt_z_ const char *userdata, _In_ switch_log_level_t level, cJSON **meta, const char *fmt, va_list ap);
#endif
/*!
\brief Shut down the logging engine

View File

@ -0,0 +1,60 @@
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2020, Anthony Minessale II <anthm@freeswitch.org>
*
* Version: MPL 1.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
*
* The Initial Developer of the Original Code is
* Seven Du <dujinfang@gmail.com>
* Portions created by the Initial Developer are Copyright (C)
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Seven Du <dujinfang@gmail.com>
*
* switch_packetizer H264 packetizer
*
*/
#ifndef SWITCH_PACKETIZER_H
#define SWITCH_PACKETIZER_H
typedef void switch_packetizer_t;
typedef enum {
SPT_H264_BITSTREAM, // with separator 0 0 0 1 or 0 0 1
SPT_H264_SIZED_BITSTREAM,
SPT_H264_SIGNALE_NALU,
SPT_VP8_BITSTREAM,
SPT_VP9_BITSTREAM,
// no more beyond this line
SPT_INVALID_STREAM
} switch_packetizer_bitstream_t;
/*
create a packetizer and feed data, to avoid data copy, data MUST be valid before the next feed, or before close.
*/
SWITCH_DECLARE(switch_packetizer_t *) switch_packetizer_create(switch_packetizer_bitstream_t type, uint32_t slice_size);
SWITCH_DECLARE(switch_status_t) switch_packetizer_feed(switch_packetizer_t *packetizer, void *data, uint32_t size);
SWITCH_DECLARE(switch_status_t) switch_packetizer_feed_extradata(switch_packetizer_t *packetizer, void *data, uint32_t size);
SWITCH_DECLARE(switch_status_t) switch_packetizer_read(switch_packetizer_t *packetizer, switch_frame_t *frame);
SWITCH_DECLARE(void) switch_packetizer_close(switch_packetizer_t **packetizer);
#endif

View File

@ -22,9 +22,6 @@
/* Define to 1 if you have the <dlfcn.h> header file. */
#cmakedefine HAVE_DLFCN_H
/* Define to 1 if you have the <execinfo.h> header file. */
#cmakedefine HAVE_EXECINFO_H
/* Define to 1 if you have the `gethostname' function. */
#cmakedefine HAVE_GETHOSTNAME

View File

@ -41,9 +41,11 @@
SWITCH_BEGIN_EXTERN_C
#define SWITCH_RTP_HEADER_LEN sizeof(switch_rtp_hdr_t)
#define SWITCH_RTP_MAX_BUF_LEN 16384
#define SWITCH_RTCP_MAX_BUF_LEN 16384
#define SWITCH_RTP_MAX_BUF_LEN_WORDS 4094 /* (max / 4) - 2 */
#define SWITCH_RTP_MAX_PACKET_LEN (SWITCH_RTP_MAX_BUF_LEN + SWITCH_RTP_HEADER_LEN)
//#define SWITCH_RTP_KEY_LEN 30
//#define SWITCH_RTP_CRYPTO_KEY_32 "AES_CM_128_HMAC_SHA1_32"
#define SWITCH_RTP_CRYPTO_KEY_80 "AES_CM_128_HMAC_SHA1_80"

View File

@ -0,0 +1,54 @@
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
*
* Version: MPL 1.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
*
* The Initial Developer of the Original Code is
* Anthony Minessale II <anthm@freeswitch.org>
* Portions created by the Initial Developer are Copyright (C)
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Anthony Minessale II <anthm@freeswitch.org>
* Andrey Volk <andrey@signalwire.com>
*
* switch_spandsp.h -- SpanDSP includes header
*
*/
#ifndef SWITCH_SPANDSP_H
#define SWITCH_SPANDSP_H
SWITCH_BEGIN_EXTERN_C
SWITCH_DECLARE(switch_plc_state_t *) switch_plc_init(switch_plc_state_t *s);
SWITCH_DECLARE(int) switch_plc_free(switch_plc_state_t *s);
SWITCH_DECLARE(int) switch_plc_rx(switch_plc_state_t *s, int16_t amp[], int len);
SWITCH_DECLARE(int) switch_plc_fillin(switch_plc_state_t *s, int16_t amp[], int len);
SWITCH_END_EXTERN_C
#endif
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
*/

View File

@ -843,6 +843,9 @@ typedef enum {
SWITCH_RTP_FLAG_PASSTHRU,
SWITCH_RTP_FLAG_SECURE_SEND_MKI,
SWITCH_RTP_FLAG_SECURE_RECV_MKI,
SWITCH_RTP_FLAG_SRTP_HANGUP_ON_ERROR,
SWITCH_RTP_FLAG_AUDIO_FIRE_SEND_RTCP_EVENT,
SWITCH_RTP_FLAG_VIDEO_FIRE_SEND_RTCP_EVENT,
SWITCH_RTP_FLAG_INVALID
} switch_rtp_flag_t;
@ -1135,6 +1138,7 @@ typedef enum {
SWITCH_MESSAGE_INDICATE_DEFLECT,
SWITCH_MESSAGE_INDICATE_VIDEO_REFRESH_REQ,
SWITCH_MESSAGE_INDICATE_DISPLAY,
SWITCH_MESSAGE_INDICATE_MEDIA_PARAMS,
SWITCH_MESSAGE_INDICATE_TRANSCODING_NECESSARY,
SWITCH_MESSAGE_INDICATE_AUDIO_SYNC,
SWITCH_MESSAGE_INDICATE_VIDEO_SYNC,
@ -1171,6 +1175,7 @@ typedef enum {
SWITCH_MESSAGE_RESAMPLE_EVENT,
SWITCH_MESSAGE_HEARTBEAT_EVENT,
SWITCH_MESSAGE_INDICATE_SESSION_ID,
SWITCH_MESSAGE_INDICATE_PROMPT,
SWITCH_MESSAGE_INVALID
} switch_core_session_message_types_t;
@ -1324,13 +1329,17 @@ typedef enum {
} switch_core_session_message_flag_enum_t;
typedef uint32_t switch_core_session_message_flag_t;
typedef struct switch_core_session switch_core_session_t;
static inline switch_core_session_t *switch_core_session_type_check(switch_core_session_t *session) { return session; }
static inline const char *switch_const_char_type_check(const char *str) { return str; }
#define SWITCH_CHANNEL_LOG SWITCH_CHANNEL_ID_LOG, __FILE__, __SWITCH_FUNC__, __LINE__, NULL
#define SWITCH_CHANNEL_LOG_CLEAN SWITCH_CHANNEL_ID_LOG_CLEAN, __FILE__, __SWITCH_FUNC__, __LINE__, NULL
#define SWITCH_CHANNEL_SESSION_LOG_CLEAN(x) SWITCH_CHANNEL_ID_LOG_CLEAN, __FILE__, __SWITCH_FUNC__, __LINE__, switch_core_session_get_uuid((x))
#define SWITCH_CHANNEL_EVENT SWITCH_CHANNEL_ID_EVENT, __FILE__, __SWITCH_FUNC__, __LINE__, NULL
#define SWITCH_CHANNEL_SESSION_LOG(x) SWITCH_CHANNEL_ID_SESSION, __FILE__, __SWITCH_FUNC__, __LINE__, (const char*)(x)
#define SWITCH_CHANNEL_SESSION_LOG(x) SWITCH_CHANNEL_ID_SESSION, __FILE__, __SWITCH_FUNC__, __LINE__, (const char*)switch_core_session_type_check(x)
#define SWITCH_CHANNEL_CHANNEL_LOG(x) SWITCH_CHANNEL_ID_SESSION, __FILE__, __SWITCH_FUNC__, __LINE__, (const char*)switch_channel_get_session(x)
#define SWITCH_CHANNEL_UUID_LOG(x) SWITCH_CHANNEL_ID_LOG, __FILE__, __SWITCH_FUNC__, __LINE__, (x)
#define SWITCH_CHANNEL_UUID_LOG(x) SWITCH_CHANNEL_ID_LOG, __FILE__, __SWITCH_FUNC__, __LINE__, switch_const_char_type_check(x)
typedef enum {
CCS_DOWN,
@ -1450,6 +1459,7 @@ typedef enum {
CC_IO_OVERRIDE,
CC_RTP_RTT,
CC_MSRP,
CC_MUTE_VIA_MEDIA_STREAM,
/* WARNING: DO NOT ADD ANY FLAGS BELOW THIS LINE */
CC_FLAG_MAX
} switch_channel_cap_t;
@ -1529,6 +1539,7 @@ typedef enum {
CF_INTERCEPTED,
CF_VIDEO_REFRESH_REQ,
CF_MANUAL_VID_REFRESH,
CF_MANUAL_MEDIA_PARAMS,
CF_SERVICE_AUDIO,
CF_SERVICE_VIDEO,
CF_ZRTP_PASSTHRU_REQ,
@ -1562,6 +1573,7 @@ typedef enum {
CF_T38_PASSTHRU,
CF_DROP_DTMF,
CF_REINVITE,
CF_NOSDP_REINVITE,
CF_AUTOFLUSH_DURING_BRIDGE,
CF_RTP_NOTIMER_DURING_BRIDGE,
CF_AVPF,
@ -1589,7 +1601,7 @@ typedef enum {
CF_VIDEO_DECODED_READ,
CF_VIDEO_DEBUG_READ,
CF_VIDEO_DEBUG_WRITE,
CF_VIDEO_ONLY,
CF_NO_RECOVER,
CF_VIDEO_READY,
CF_VIDEO_MIRROR_INPUT,
CF_VIDEO_READ_FILE_ATTACHED,
@ -1623,6 +1635,10 @@ typedef enum {
CF_STATE_REPEAT,
CF_WANT_DTLSv1_2,
CF_RFC7329_COMPAT,
CF_REATTACHED,
CF_VIDEO_READ_TAPPED,
CF_VIDEO_WRITE_TAPPED,
CF_DEVICES_CHANGED,
/* WARNING: DO NOT ADD ANY FLAGS BELOW THIS LINE */
/* IF YOU ADD NEW ONES CHECK IF THEY SHOULD PERSIST OR ZERO THEM IN switch_core_session.c switch_core_session_request_xml() */
CF_FLAG_MAX
@ -1900,7 +1916,8 @@ typedef enum {
SMBF_SPY_VIDEO_STREAM_BLEG = (1 << 23),
SMBF_READ_VIDEO_PATCH = (1 << 24),
SMBF_READ_TEXT_STREAM = (1 << 25),
SMBF_FIRST = (1 << 26)
SMBF_FIRST = (1 << 26),
SMBF_PAUSE = (1 << 27)
} switch_media_bug_flag_enum_t;
typedef uint32_t switch_media_bug_flag_t;
@ -2037,6 +2054,7 @@ typedef uint32_t switch_io_flag_t;
SWITCH_EVENT_SEND_INFO
SWITCH_EVENT_RECV_INFO
SWITCH_EVENT_RECV_RTCP_MESSAGE
SWITCH_EVENT_SEND_RTCP_MESSAGE
SWITCH_EVENT_CALL_SECURE
SWITCH_EVENT_NAT - NAT Management (new/del/status)
SWITCH_EVENT_RECORD_START
@ -2132,6 +2150,7 @@ typedef enum {
SWITCH_EVENT_SEND_INFO,
SWITCH_EVENT_RECV_INFO,
SWITCH_EVENT_RECV_RTCP_MESSAGE,
SWITCH_EVENT_SEND_RTCP_MESSAGE,
SWITCH_EVENT_CALL_SECURE,
SWITCH_EVENT_NAT,
SWITCH_EVENT_RECORD_START,
@ -2286,7 +2305,9 @@ typedef enum {
SCSC_SPS_PEAK,
SCSC_SPS_PEAK_FIVEMIN,
SCSC_SESSIONS_PEAK,
SCSC_SESSIONS_PEAK_FIVEMIN
SCSC_SESSIONS_PEAK_FIVEMIN,
SCSC_MDNS_RESOLVE,
SCSC_SHUTDOWN_CAUSE
} switch_session_ctl_t;
typedef enum {
@ -2303,6 +2324,7 @@ typedef int switch_os_socket_t;
#endif
typedef struct apr_pool_t switch_memory_pool_t;
typedef void* switch_plc_state_t;
typedef uint16_t switch_port_t;
typedef uint8_t switch_payload_t;
typedef struct switch_app_log switch_app_log_t;
@ -2319,7 +2341,6 @@ typedef struct switch_rtcp_frame switch_rtcp_frame_t;
typedef struct switch_channel switch_channel_t;
typedef struct switch_sql_queue_manager switch_sql_queue_manager_t;
typedef struct switch_file_handle switch_file_handle_t;
typedef struct switch_core_session switch_core_session_t;
typedef struct switch_caller_profile switch_caller_profile_t;
typedef struct switch_caller_extension switch_caller_extension_t;
typedef struct switch_caller_application switch_caller_application_t;
@ -2802,6 +2823,7 @@ typedef struct switch_mm_s {
int cbr;
float fps;
float source_fps;
int source_kps;
int vbuf;
switch_video_profile_t vprofile;
switch_video_encode_speed_t vencspd;

View File

@ -590,7 +590,7 @@ SWITCH_DECLARE(char *) get_addr(char *buf, switch_size_t len, struct sockaddr *s
SWITCH_DECLARE(char *) get_addr6(char *buf, switch_size_t len, struct sockaddr_in6 *sa, socklen_t salen);
SWITCH_DECLARE(int) get_addr_int(switch_sockaddr_t *sa);
SWITCH_DECLARE(int) switch_cmp_addr(switch_sockaddr_t *sa1, switch_sockaddr_t *sa2);
SWITCH_DECLARE(int) switch_cmp_addr(switch_sockaddr_t *sa1, switch_sockaddr_t *sa2, switch_bool_t ip_only);
SWITCH_DECLARE(int) switch_cp_addr(switch_sockaddr_t *sa1, switch_sockaddr_t *sa2);
/*!
@ -888,13 +888,10 @@ static inline char *switch_safe_strdup(const char *it)
static inline char *switch_lc_strdup(const char *it)
{
char *dup;
char *p;
if (it) {
dup = strdup(it);
for (p = dup; p && *p; p++) {
*p = (char) switch_tolower(*p);
}
switch_tolower_max(dup);
return dup;
}
@ -905,13 +902,10 @@ static inline char *switch_lc_strdup(const char *it)
static inline char *switch_uc_strdup(const char *it)
{
char *dup;
char *p;
if (it) {
dup = strdup(it);
for (p = dup; p && *p; p++) {
*p = (char) switch_toupper(*p);
}
switch_toupper_max(dup);
return dup;
}
@ -1150,10 +1144,7 @@ static inline uint32_t switch_parse_cpu_string(const char *cpu)
if (!cpu) return 1;
if (!strcasecmp(cpu, "auto")) {
if (cpu_count > 4) return 4;
if (cpu_count <= 2) return 1;
return (uint32_t)(cpu_count / 2);
return (uint32_t)((cpu_count * 3) / 2);
}
if (!strncasecmp(cpu, "cpu/", 4)) { /* cpu/2 or cpu/2/<max> */
@ -1289,6 +1280,31 @@ static inline switch_bool_t switch_is_file_path(const char *file)
return r ? SWITCH_TRUE : SWITCH_FALSE;
}
static inline int switch_filecmp(const char *a, const char *b)
{
const char *e;
if (zstr(a) || zstr(b)) {
return -1;
}
while(*a == '{') {
if ((e = switch_find_end_paren(a, '{', '}'))) {
a = e + 1;
while(*a == ' ') a++;
}
}
while(*b == '{') {
if ((e = switch_find_end_paren(b, '{', '}'))) {
b = e + 1;
while(*b == ' ') b++;
}
}
return strcmp(a, b);
}
static inline const char *switch_parse_audio_col(switch_audio_col_t col)
{
@ -1487,6 +1503,9 @@ SWITCH_DECLARE(unsigned long) switch_getpid(void);
SWITCH_DECLARE(switch_status_t) switch_digest(const char *digest_name, unsigned char **digest, const void *input, switch_size_t inputLen, unsigned int *outputlen);
SWITCH_DECLARE(switch_status_t) switch_digest_string(const char *digest_name, char **digest_str, const void *input, switch_size_t inputLen, unsigned int *outputlen);
SWITCH_DECLARE(char *) switch_must_strdup(const char *_s);
SWITCH_DECLARE(const char *) switch_memory_usage_stream(switch_stream_handle_t *stream);
SWITCH_END_EXTERN_C
#endif
/* For Emacs:

View File

@ -102,6 +102,10 @@ struct switch_xml {
/*! is_switch_xml_root bool */
switch_bool_t is_switch_xml_root_t;
uint32_t refs;
/*! pointer to end of opening tag, '>', in the original parsed text */
const char *open;
/*! pointer to start of closing tag, '<', in the original parsed text */
const char *close;
};
/*!

View File

@ -2858,6 +2858,10 @@ fct_standard_logger__on_chk(
/* Only record failures. */
if ( !fctchk__is_pass(e->chk) )
{
printf("\nTEST FAIL: %s(%d): %s\n",
fctchk__file(e->chk),
fctchk__lineno(e->chk),
fctchk__msg(e->chk));
fct_logger_record_failure(e->chk, &(logger->failed_cndtns_list));
}
}

View File

@ -203,13 +203,13 @@ static switch_status_t fst_init_core_and_modload(const char *confdir, const char
* Check a test /w error message
*/
#define fst_xcheck(expr, error_msg) \
fct_xchk(expr, "%s", error_msg);
(fct_xchk(expr, "%s", error_msg))
/**
* Fail a test
*/
#define fst_fail(error_msg) \
fct_xchk(0, "%s", error_msg);
(fct_xchk(0, "%s", error_msg))
/**
* Check duration relative to test start, last marked time, or last check.
@ -236,7 +236,7 @@ static switch_status_t fst_init_core_and_modload(const char *confdir, const char
(actual), \
(expected), \
(precision) \
);
)
/**
* Check if double-precision number is in range
@ -248,7 +248,7 @@ static switch_status_t fst_init_core_and_modload(const char *confdir, const char
(actual), \
(expected), \
(precision) \
);
)
/**
* Run test without loading FS core
@ -484,9 +484,10 @@ static switch_status_t fst_init_core_and_modload(const char *confdir, const char
*
* @param name the name of this test
* @param rate the rate of the channel
* @param video_codec the rate of the channel
*/
#define FST_SESSION_BEGIN_RATE(name, rate) \
#define FST_SESSION_BEGIN_RATE_VIDEO(name, rate, video_codec) \
FCT_TEST_BGN(name) \
{ \
if (fst_core) { \
@ -513,7 +514,7 @@ static switch_status_t fst_init_core_and_modload(const char *confdir, const char
fst_requires(switch_event_create_plain(&fst_originate_vars, SWITCH_EVENT_CHANNEL_DATA) == SWITCH_STATUS_SUCCESS); \
switch_event_add_header_string(fst_originate_vars, SWITCH_STACK_BOTTOM, "origination_caller_id_number", "+15551112222"); \
switch_event_add_header(fst_originate_vars, SWITCH_STACK_BOTTOM, "rate", "%d", rate); \
if (switch_ivr_originate(NULL, &fst_session, &fst_cause, "null/+15553334444", 2, NULL, NULL, NULL, NULL, fst_originate_vars, SOF_NONE, NULL, NULL) == SWITCH_STATUS_SUCCESS && fst_session) { \
if (switch_ivr_originate(NULL, &fst_session, &fst_cause, "{null_video_codec=" video_codec "}null/+15553334444", 2, NULL, NULL, NULL, NULL, fst_originate_vars, SOF_NONE, NULL, NULL) == SWITCH_STATUS_SUCCESS && fst_session) { \
switch_memory_pool_t *fst_session_pool = switch_core_session_get_pool(fst_session); \
switch_channel_t *fst_channel = switch_core_session_get_channel(fst_session); \
switch_channel_set_state(fst_channel, CS_SOFT_EXECUTE); \
@ -521,14 +522,16 @@ static switch_status_t fst_init_core_and_modload(const char *confdir, const char
switch_channel_set_variable(fst_channel, "send_silence_when_idle", "-1"); \
switch_channel_set_variable(fst_channel, "RECORD_STEREO", "true"); \
switch_ivr_record_session(fst_session, (char *)"/tmp/"#name".wav", 0, NULL); \
switch_channel_set_variable(fst_channel, "RECORD_STEREO", NULL); \
for(;;) {
/**
* Define a session test in a test suite. This can be used to test IVR functions.
* See FST_SESSION_BEGIN_RATE
* See FST_SESSION_BEGIN_RATE_VIDEO
*/
#define FST_SESSION_BEGIN(name) FST_SESSION_BEGIN_RATE(name, 8000)
#define FST_SESSION_BEGIN_RATE(name, rate) FST_SESSION_BEGIN_RATE_VIDEO(name, rate, "")
/* BODY OF TEST CASE HERE */

View File

@ -0,0 +1,3 @@
test/test_BT7.mp4
test/test_RGB.mp4
test/test_packetizer

View File

@ -385,6 +385,7 @@ typedef struct h264_codec_context_s {
switch_image_t *img;
switch_image_t *encimg;
int need_key_frame;
switch_time_t last_keyframe_request;
switch_bool_t nalu_28_start;
int change_bandwidth;
@ -420,7 +421,7 @@ struct avcodec_globals {
int debug;
uint32_t max_bitrate;
uint32_t rtp_slice_size;
uint32_t key_frame_min_freq;
uint32_t key_frame_min_freq; // in ms
uint32_t enc_threads;
uint32_t dec_threads;
@ -1567,10 +1568,14 @@ static switch_status_t switch_h264_encode(switch_codec_t *codec, switch_frame_t
avframe->pts = context->pts++;
if (context->need_key_frame) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG5, "Send AV KEYFRAME\n");
if (context->need_key_frame && (context->last_keyframe_request + avcodec_globals.key_frame_min_freq) < switch_time_now()) {
if (avcodec_globals.debug) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Generate/Send AV KEYFRAME\n");
}
avframe->pict_type = AV_PICTURE_TYPE_I;
avframe->key_frame = 1;
context->last_keyframe_request = switch_time_now();
}
/* encode the image */
@ -1585,7 +1590,7 @@ GCC_DIAG_ON(deprecated-declarations)
goto error;
}
if (context->need_key_frame) {
if (context->need_key_frame && avframe->key_frame == 1) {
avframe->pict_type = 0;
avframe->key_frame = 0;
context->need_key_frame = 0;
@ -1633,9 +1638,13 @@ GCC_DIAG_ON(deprecated-declarations)
context->nalus[i].start = p;
context->nalus[i].eat = p;
if (mod_av_globals.debug && (*p & 0x1f) == 7) {
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 */
@ -1764,6 +1773,12 @@ static switch_status_t switch_h264_control(switch_codec_t *codec,
h264_codec_context_t *context = (h264_codec_context_t *)codec->private_info;
switch(cmd) {
case SCC_DEBUG:
{
int32_t level = *((uint32_t *) cmd_data);
mod_av_globals.debug = level;
}
break;
case SCC_VIDEO_GEN_KEYFRAME:
context->need_key_frame = 1;
break;
@ -1964,6 +1979,9 @@ static void parse_profile(avcodec_profile_t *aprofile, switch_xml_t profile)
ctx = &aprofile->ctx;
ctx->profile = FF_PROFILE_H264_BASELINE;
ctx->level = 31;
for (param = switch_xml_child(profile, "param"); param; param = param->next) {
const char *name = switch_xml_attr(param, "name");
const char *value = switch_xml_attr(param, "value");
@ -1975,9 +1993,6 @@ static void parse_profile(avcodec_profile_t *aprofile, switch_xml_t profile)
val = atoi(value);
ctx->profile = FF_PROFILE_H264_BASELINE;
ctx->level = 31;
if (!strcmp(name, "dec-threads")) {
aprofile->decoder_thread_count = switch_parse_cpu_string(value);
} else if (!strcmp(name, "enc-threads")) {

View File

@ -54,6 +54,8 @@ GCC_DIAG_OFF(deprecated-declarations)
#include <libswresample/swresample.h>
#endif
#define SLICE_SIZE (SWITCH_DEFAULT_VIDEO_SIZE + 100)
GCC_DIAG_ON(deprecated-declarations)
#define SCALE_FLAGS SWS_BICUBIC
#define DFT_RECORD_OFFSET 0
@ -116,8 +118,6 @@ typedef struct record_helper_s {
uint64_t last_ts;
} record_helper_t;
/* file interface */
struct av_file_context {
@ -161,6 +161,11 @@ struct av_file_context {
switch_time_t last_vid_write;
int audio_timer;
switch_bool_t no_video_decode;
switch_queue_t *video_pkt_queue;
switch_packetizer_t *packetizer;
AVPacket *last_read_pkt;
};
typedef struct av_file_context av_file_context_t;
@ -337,12 +342,27 @@ static void log_packet(const AVFormatContext *fmt_ctx, const AVPacket *pkt)
}
}
static int interrupt_cb(void *cp)
{
av_file_context_t *context = (av_file_context_t *) cp;
if (context->closed) {
return 1;
}
return 0;
}
static int mod_avformat_alloc_output_context2(AVFormatContext **avctx, AVOutputFormat *oformat,
const char *format, const char *filename)
const char *format, const char *filename, av_file_context_t *context)
{
AVFormatContext *s = avformat_alloc_context();
int ret = 0;
s->interrupt_callback.callback = interrupt_cb;
s->interrupt_callback.opaque = context;
*avctx = NULL;
if (!s)
goto nomem;
@ -772,6 +792,16 @@ static int flush_video_queue(switch_queue_t *q, int min)
return switch_queue_size(q);
}
static void flush_video_pkt_queue(switch_queue_t *q)
{
AVPacket *pkt;
while (switch_queue_trypop(q, (void **)&pkt) == SWITCH_STATUS_SUCCESS) {
av_packet_unref(pkt);
free(pkt);
}
}
static void *SWITCH_THREAD_FUNC video_thread_run(switch_thread_t *thread, void *obj)
{
av_file_context_t *context = (av_file_context_t *) obj;
@ -792,7 +822,12 @@ static void *SWITCH_THREAD_FUNC video_thread_run(switch_thread_t *thread, void *
top:
switch_assert(context->eh.video_queue);
while(switch_queue_size(context->eh.video_queue) > 1) {
switch_image_t *tmp_img;
switch_queue_pop(context->eh.video_queue, &pop);
tmp_img = (switch_image_t *) pop;
switch_img_free(&tmp_img);
}
if (switch_queue_pop(context->eh.video_queue, &pop) == SWITCH_STATUS_SUCCESS) {
switch_img_free(&img);
@ -880,7 +915,7 @@ static void *SWITCH_THREAD_FUNC video_thread_run(switch_thread_t *thread, void *
} else {
uint64_t delta_tmp;
switch_core_timer_sync(context->eh.video_timer);
switch_core_timer_next(context->eh.video_timer);
delta_tmp = (context->eh.video_timer->samplecount * 90) - context->eh.last_ts;
if (delta_tmp != 0) {
@ -1111,9 +1146,24 @@ static switch_status_t open_input_file(av_file_context_t *context, switch_file_h
// av_dict_set(&opts, "c:v", "libvpx", 0);
/** Open the input file to read from it. */
if (!context->fc) {
context->fc = avformat_alloc_context();
}
if (!context->fc) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not open input file '%s' (error '%s')\n", filename, "NO MEM");
switch_goto_status(SWITCH_STATUS_FALSE, err);
}
context->fc->interrupt_callback.callback = interrupt_cb;
context->fc->interrupt_callback.opaque = context;
if ((error = avformat_open_input(&context->fc, filename, NULL, NULL)) < 0) {
char ebuf[255] = "";
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Could not open input file '%s' (error '%s')\n", filename, get_error_text(error, ebuf, sizeof(ebuf)));
avformat_free_context(context->fc);
context->fc = NULL;
switch_goto_status(SWITCH_STATUS_FALSE, err);
}
@ -1123,7 +1173,7 @@ static switch_status_t open_input_file(av_file_context_t *context, switch_file_h
/** Get information on the input file (number of streams etc.). */
if ((error = avformat_find_stream_info(context->fc, opts ? &opts : NULL)) < 0) {
char ebuf[255] = "";
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Could not open find stream info (error '%s')\n", get_error_text(error, ebuf, sizeof(ebuf)));
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Could not find stream info in file: %s, error = %s)\n", filename, get_error_text(error, ebuf, sizeof(ebuf)));
if (opts) av_dict_free(&opts);
switch_goto_status(SWITCH_STATUS_FALSE, err);
}
@ -1145,6 +1195,11 @@ GCC_DIAG_ON(deprecated-declarations)
handle->duration = av_rescale_q(context->video_st.st->duration != AV_NOPTS_VALUE ? context->video_st.st->duration : context->fc->duration / AV_TIME_BASE * 1000,
context->video_st.st->time_base, AV_TIME_BASE_Q);
}
if (context->fc->bit_rate) {
handle->mm.source_kps = context->fc->bit_rate / 1024;
}
if (context->video_st.st->avg_frame_rate.num) {
handle->mm.source_fps = ceil(av_q2d(context->video_st.st->avg_frame_rate));
} else {
@ -1289,12 +1344,21 @@ GCC_DIAG_ON(deprecated-declarations)
return status;
err:
/*
if (context->has_video) close_stream(context->fc, &context->video_st);
if (context->has_audio) close_stream(context->fc, &context->audio_st);
if (context->fc) {
int nb_streams = context->fc->nb_streams;
if (nb_streams > 2) nb_streams = 2;
if (context->has_video) close_stream(context->fc, &context->video_st);
for (i = 0; i < nb_streams; i++) {
close_stream(context->fc, &context->audio_st[i]);
}
avformat_free_context(context->fc);
context->fc = NULL;
}
if (context->fc) avformat_close_input(&context->fc);
*/
return status;
}
@ -1379,7 +1443,7 @@ GCC_DIAG_ON(deprecated-declarations)
} else {
char ebuf[255] = "";
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Could not read frame (error '%s')\n", get_error_text(error, ebuf, sizeof(ebuf)));
break;
continue;
}
}
@ -1387,6 +1451,34 @@ GCC_DIAG_ON(deprecated-declarations)
if (context->has_video && pkt.stream_index == context->video_st.st->index) {
AVFrame *vframe;
switch_image_t *img;
if (context->no_video_decode) {
if (eof) {
break;
} else {
switch_status_t status;
AVPacket *new_pkt = malloc(sizeof(AVPacket));
if (0) { // debug
uint8_t *p = pkt.data;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "size = %u %x %x %x %x %x %x\n", pkt.size, *p, *(p+1), *(p+2), *(p+3), *(p+4), *(p+5));
}
av_init_packet(new_pkt);
av_packet_ref(new_pkt, &pkt);
status = switch_queue_push(context->video_pkt_queue, new_pkt);
// switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "size = %4u flag=%x pts=%" SWITCH_INT64_T_FMT " dts=%" SWITCH_INT64_T_FMT "\n", pkt.size, pkt.flags, pkt.pts, pkt.dts);
context->vid_ready = 1;
if (status != SWITCH_STATUS_SUCCESS) {
av_packet_unref(new_pkt);
free(new_pkt);
}
av_packet_unref(&pkt);
continue;
}
}
if (!sync) {
switch_buffer_zero(context->audio_buffer);
sync = 1;
@ -1403,7 +1495,7 @@ GCC_DIAG_ON(deprecated-declarations)
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Could not decode frame (error '%s')\n", get_error_text(error, ebuf, sizeof(ebuf)));
av_packet_unref(&pkt);
av_frame_free(&vframe);
break;
continue;
}
// switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "pkt: %d, pts: %lld dts: %lld\n", pkt.size, pkt.pts, pkt.dts);
@ -1499,9 +1591,6 @@ GCC_DIAG_ON(deprecated-declarations)
context->vid_ready = 1;
switch_queue_push(context->eh.video_queue, img);
context->last_vid_push = switch_time_now();
}
}
}
@ -1525,7 +1614,7 @@ GCC_DIAG_ON(deprecated-declarations)
char ebuf[255] = "";
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Could not decode frame (error '%s')\n", get_error_text(error, ebuf, sizeof(ebuf)));
av_packet_unref(&pkt);
break;
continue;
}
// switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "pkt: %d, decodedddd: %d pts: %lld dts: %lld\n", pkt.size, error, pkt.pts, pkt.dts);
@ -1601,23 +1690,33 @@ static switch_status_t av_file_open(switch_file_handle_t *handle, const char *pa
disable_write_buffer = 1;
}
if ((ext = strrchr((char *)path, '.')) == 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Format\n");
return SWITCH_STATUS_GENERR;
} else if (handle->stream_name && (!strcasecmp(handle->stream_name, "rtmp") || !strcasecmp(handle->stream_name, "youtube"))) {
if (handle->stream_name && (!strcasecmp(handle->stream_name, "rtmp") || !strcasecmp(handle->stream_name, "rtmps") || !strcasecmp(handle->stream_name, "youtube"))) {
char *secure = "";
format = "flv";
if ((ext = strrchr((char *)path, '.')) == 0) {
ext = ".flv";
}
if (!strcasecmp(handle->stream_name, "rtmps")) secure = "s";
// meh really silly format for the user / pass libav.....
if (handle->mm.auth_username && handle->mm.auth_password) {
switch_snprintf(file, sizeof(file), "rtmp://%s pubUser=%s pubPasswd=%s flashver=FMLE/3.0", path, handle->mm.auth_username, handle->mm.auth_password);
switch_snprintf(file, sizeof(file), "rtmp%s://%s pubUser=%s pubPasswd=%s flashver=FMLE/3.0", secure, path, handle->mm.auth_username, handle->mm.auth_password);
} else {
switch_snprintf(file, sizeof(file), "rtmp://%s", path);
switch_snprintf(file, sizeof(file), "rtmp%s://%s", secure, path);
}
} else if (handle->stream_name && !strcasecmp(handle->stream_name, "rtsp")) {
format = "rtsp";
if ((ext = strrchr((char *)path, '.')) == 0) {
ext = ".rtsp";
}
switch_snprintf(file, sizeof(file), "rtsp://%s", path);
disable_write_buffer = 1;
} else if ((ext = strrchr((char *)path, '.')) == 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Format\n");
return SWITCH_STATUS_GENERR;
}
@ -1673,9 +1772,16 @@ static switch_status_t av_file_open(switch_file_handle_t *handle, const char *pa
}
if (context->has_video) {
switch_fps_t fps_data = { 0 };
switch_queue_create(&context->eh.video_queue, context->read_fps, handle->memory_pool);
context->no_video_decode = handle->params && switch_true(switch_event_get_header(handle->params, "no_video_decode"));
if (context->no_video_decode) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Opening video in no decode mode\n");
switch_queue_create(&context->video_pkt_queue, 120 * 5, handle->memory_pool);
}
switch_mutex_init(&context->eh.mutex, SWITCH_MUTEX_NESTED, handle->memory_pool);
switch_core_timer_init(&context->video_timer, "soft", (int)(1000.0f / context->read_fps), 1, context->pool);
switch_calc_video_fps(&fps_data, context->read_fps);
switch_core_timer_init(&context->video_timer, "soft", fps_data.ms, fps_data.samples, context->pool);
}
{
@ -1689,7 +1795,7 @@ static switch_status_t av_file_open(switch_file_handle_t *handle, const char *pa
return SWITCH_STATUS_SUCCESS;
}
mod_avformat_alloc_output_context2(&context->fc, NULL, format, (char *)file);
mod_avformat_alloc_output_context2(&context->fc, NULL, format, (char *)file, context);
if (!context->fc) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Could not deduce output format from file extension\n");
@ -1761,7 +1867,7 @@ static switch_status_t av_file_open(switch_file_handle_t *handle, const char *pa
if (switch_test_flag(handle, SWITCH_FILE_FLAG_VIDEO) && fmt->video_codec != AV_CODEC_ID_NONE) {
const AVCodecDescriptor *desc;
if ((handle->stream_name && (!strcasecmp(handle->stream_name, "rtmp") || !strcasecmp(handle->stream_name, "youtube")))) {
if ((handle->stream_name && (!strcasecmp(handle->stream_name, "rtmp") || !strcasecmp(handle->stream_name, "rtmps") || !strcasecmp(handle->stream_name, "youtube")))) {
if (fmt->video_codec != AV_CODEC_ID_H264 ) {
fmt->video_codec = AV_CODEC_ID_H264; // force H264
@ -2171,6 +2277,15 @@ static switch_status_t av_file_close(switch_file_handle_t *handle)
context->file_read_thread_running = 0;
}
if (context->video_pkt_queue) {
flush_video_pkt_queue(context->video_pkt_queue);
switch_queue_term(context->video_pkt_queue);
}
if (context->packetizer) {
switch_packetizer_close(&context->packetizer);
}
if (context->file_read_thread) {
switch_thread_join(&status, context->file_read_thread);
context->file_read_thread = NULL;
@ -2243,6 +2358,7 @@ static switch_status_t av_file_read(switch_file_handle_t *handle, void *data, si
}
switch_mutex_lock(context->mutex);
while (!context->file_read_thread_started) {
switch_thread_cond_wait(context->cond, context->mutex);
}
@ -2328,6 +2444,82 @@ static switch_status_t av_file_read_video(switch_file_handle_t *handle, switch_f
}
#else
static switch_status_t no_video_decode_packets(switch_file_handle_t *handle, switch_frame_t *frame, switch_video_read_flag_t flags)
{
av_file_context_t *context = (av_file_context_t *)handle->private_info;
MediaStream *mst = &context->video_st;
AVStream *st = mst->st;
// AVCodecContext *ctx = st->codec;
// int ticks = 0;
// int64_t max_delta = 1 * AV_TIME_BASE; // 1 second
switch_status_t status = SWITCH_STATUS_SUCCESS;
AVPacket *pkt;
int64_t pts;
if (!context->packetizer) {
// uint8_t *p = st->codecpar->extradata;
// switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "size = %u %x %x %x %x %x %x\n", st->codecpar->extradata_size, *p, *(p+1), *(p+2), *(p+3), *(p+4), *(p+5));
context->packetizer = switch_packetizer_create(SPT_H264_SIZED_BITSTREAM, SLICE_SIZE);
if (!context->packetizer) return SWITCH_STATUS_FALSE;
switch_packetizer_feed_extradata(context->packetizer, st->codecpar->extradata, st->codecpar->extradata_size);
}
if (context->last_read_pkt) {
status = switch_packetizer_read(context->packetizer, frame);
if (status == SWITCH_STATUS_SUCCESS) {
av_packet_unref(context->last_read_pkt);
free(context->last_read_pkt);
context->last_read_pkt = NULL;
}
return status;
}
status = switch_queue_trypop(context->video_pkt_queue, (void **)&pkt);
if (status != SWITCH_STATUS_SUCCESS || !pkt) {
switch_cond_next();
return SWITCH_STATUS_BREAK;
}
context->last_read_pkt = pkt;
switch_packetizer_feed(context->packetizer, pkt->data, pkt->size);
status = switch_packetizer_read(context->packetizer, frame);
pts = av_rescale_q(pkt->pts, st->time_base, AV_TIME_BASE_Q);
frame->timestamp = pts * 9 / 100; // scale to sample 900000
// switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "pts=%" SWITCH_INT64_T_FMT " status = %d\n", pts, status);
if (status == SWITCH_STATUS_SUCCESS) {
av_packet_unref(context->last_read_pkt);
free(context->last_read_pkt);
context->last_read_pkt = NULL;
}
if (status == SWITCH_STATUS_SUCCESS || status == SWITCH_STATUS_MORE_DATA) {
if (!context->video_start_time) {
context->video_start_time = switch_time_now() - pts;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "set start time: %" SWITCH_INT64_T_FMT " now: %" SWITCH_INT64_T_FMT " pts: %" SWITCH_INT64_T_FMT "\n", context->video_start_time, switch_time_now(), pts);
} else if (flags & SVR_BLOCK) {
int64_t sleep = pts - (switch_time_now() - context->video_start_time);
if (sleep > 0) {
// switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "zzZ... %" SWITCH_INT64_T_FMT "\n", sleep);
if (sleep > 1000000) {
sleep = 1000000;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "but zzZ... %" SWITCH_INT64_T_FMT " at most\n", sleep);
}
switch_yield(sleep);
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "video is late %" SWITCH_INT64_T_FMT "\n", sleep);
}
}
}
return status;
}
static switch_status_t av_file_read_video(switch_file_handle_t *handle, switch_frame_t *frame, switch_video_read_flag_t flags)
{
av_file_context_t *context = (av_file_context_t *)handle->private_info;
@ -2347,6 +2539,13 @@ static switch_status_t av_file_read_video(switch_file_handle_t *handle, switch_f
return SWITCH_STATUS_BREAK;
}
if (context->no_video_decode) {
switch_set_flag(frame, SFF_ENCODED);
status = no_video_decode_packets(handle, frame, flags);
// switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "return len=%4u nalu=%02x m=%d ts=%u\n", frame->datalen, *(uint8_t *)frame->data, frame->m, frame->timestamp);
return status;
}
if (handle->mm.fps > 0 && handle->mm.fps < smaller_ts) {
smaller_ts = handle->mm.fps;
}
@ -2434,6 +2633,7 @@ static switch_status_t av_file_read_video(switch_file_handle_t *handle, switch_f
context->vid_ready = 1;
return SWITCH_STATUS_SUCCESS;
}
return SWITCH_STATUS_BREAK;
}
}
@ -2703,6 +2903,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_avformat_load)
supported_formats[i++] = "av";
supported_formats[i++] = "rtmp";
supported_formats[i++] = "rtmps";
supported_formats[i++] = "rtsp";
supported_formats[i++] = "mp4";
supported_formats[i++] = "m4a";

View File

@ -119,7 +119,21 @@ static void log_callback(void *ptr, int level, const char *fmt, va_list vl)
}
// switch_level = SWITCH_LOG_ERROR; // hardcoded for debug
if (mod_av_globals.debug < 7) {
switch_log_vprintf(SWITCH_CHANNEL_LOG_CLEAN, switch_level, fmt, vl);
} else {
char buffer[1024] = {0};
char *s = NULL;
vsprintf(buffer, fmt, vl);
s = strstr(buffer, "nal_unit_type");
if (!zstr(s) && *(s+15) == '7') {
switch_log_printf(SWITCH_CHANNEL_LOG, switch_level, "Read SPS\n");
} else if (!zstr(s) && *(s+15) == '8') {
switch_log_printf(SWITCH_CHANNEL_LOG, switch_level, "Read PPS\n");
} else if (!zstr(s) && *(s+15) == '5') {
switch_log_printf(SWITCH_CHANNEL_LOG, switch_level, "Read I-frame\n");
}
}
}

View File

@ -162,6 +162,94 @@ FST_CORE_BEGIN("conf")
}
FST_TEST_END()
FST_TEST_BEGIN(avformat_test_play_no_decode)
{
char path[1024];
switch_status_t status;
switch_file_handle_t fh = { 0 };
uint8_t data[SWITCH_RECOMMENDED_BUFFER_SIZE] = { 0 };
switch_frame_t frame = { 0 };
switch_size_t len = SAMPLES;
uint32_t flags = SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT | SWITCH_FILE_FLAG_VIDEO;
int i = 0;
sprintf(path, "{no_video_decode=true}%s%s%s", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, "../test_RGB.mp4");
// switch_set_string(path, "{no_video_decode=true}/usr/local/freeswitch/storage/bingbing.mp4");
status = switch_core_file_open(&fh, path, 1, 8000, flags, fst_pool);
fst_requires(status == SWITCH_STATUS_SUCCESS);
fst_requires(switch_test_flag(&fh, SWITCH_FILE_OPEN));
frame.packet = data;
frame.data = data + 12;
frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE;
do {
frame.datalen = SWITCH_RECOMMENDED_BUFFER_SIZE - 12;
status = switch_core_file_read(&fh, data, &len);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "status: %d len: %d\n", status, (int)len);
fst_check(frame.img == NULL);
frame.datalen = SWITCH_RECOMMENDED_BUFFER_SIZE - 12;
status = switch_core_file_read_video(&fh, &frame, 0);
fst_check(frame.img == NULL);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "status: %d len: %d %02x\n", status, frame.datalen, *(uint8_t *)frame.data);
} while (status == SWITCH_STATUS_MORE_DATA);
switch_core_file_close(&fh);
}
FST_TEST_END()
FST_TEST_BEGIN(avformat_test_read_err)
{
char *path = "$$-non-exist-file.mp4";
switch_status_t status;
switch_file_handle_t fh = { 0 };
uint32_t flags = SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT | SWITCH_FILE_FLAG_VIDEO;
status = switch_core_file_open(&fh, path, 1, 8000, flags, fst_pool);
fst_check(status == SWITCH_STATUS_GENERR);
}
FST_TEST_END()
FST_TEST_BEGIN(avformat_test_read_ok)
{
char path[1024];
switch_status_t status;
switch_file_handle_t fh = { 0 };
uint8_t data[SAMPLES * 2] = { 0 };
switch_frame_t frame = { 0 };
switch_size_t len = SAMPLES;
uint32_t flags = SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT | SWITCH_FILE_FLAG_VIDEO;
frame.data = data;
sprintf(path, "%s%s%s", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, "../test_RGB.mp4");
status = switch_core_file_open(&fh, path, 1, 8000, flags, fst_pool);
fst_requires(status == SWITCH_STATUS_SUCCESS);
fst_requires(switch_test_flag(&fh, SWITCH_FILE_OPEN));
while (1) {
status = switch_core_file_read(&fh, data, &len);
if (status != SWITCH_STATUS_SUCCESS) break;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "read: %" SWITCH_SIZE_T_FMT "\n", len);
// fst_check(len == SAMPLES);
status = switch_core_file_read_video(&fh, &frame, SVR_FLUSH);
if (status == SWITCH_STATUS_BREAK) {
switch_yield(20000);
continue;
}
if (status != SWITCH_STATUS_SUCCESS) {
break;
}
switch_img_free(&frame.img);
switch_yield(20000);
}
switch_core_file_close(&fh);
}
FST_TEST_END()
FST_TEARDOWN_BEGIN()
{
//const char *err = NULL;

View File

@ -73,7 +73,11 @@ FST_CORE_BEGIN("conf")
uint8_t buf[SWITCH_DEFAULT_VIDEO_SIZE + 12];
switch_frame_t frame = { 0 };
int packets = 0;
int frames = 0;
int last_key_frame = 0;
int key_frames = 0;
switch_status_t encode_status;
int debug_level = 9;
switch_set_string(codec_settings.video.config_profile_name, "conference");
@ -105,6 +109,8 @@ FST_CORE_BEGIN("conf")
frame.timestamp = 0;
frame.img = img;
switch_core_codec_control(&codec, SCC_DEBUG, SCCT_NONE, &debug_level, SCCT_INT, NULL, NULL, NULL);
do {
frame.datalen = SWITCH_DEFAULT_VIDEO_SIZE;
encode_status = switch_core_codec_encode_video(&codec, &frame);
@ -120,8 +126,21 @@ FST_CORE_BEGIN("conf")
if (frame.datalen == 0) break;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "[%d]: %02x %02x | m=%d | %d\n", loop, buf[12], buf[13], frame.m, frame.datalen);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "[%d]: %02x %02x | m=%d | %d\n", frames, buf[12], buf[13], frame.m, frame.datalen);
packets++;
if (frame.m) frames++;
if (frames % 20 == 2) {
switch_core_codec_control(&codec, SCC_VIDEO_GEN_KEYFRAME, SCCT_NONE, NULL, SCCT_NONE, NULL, NULL, NULL);
}
if (buf[12] == 0x67) {
key_frames++;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Key Frame %d last=%d diff=%d\n",
key_frames, last_key_frame, frames - last_key_frame);
last_key_frame = frames;
}
}
} while(encode_status == SWITCH_STATUS_MORE_DATA || loop-- > 1);

View File

@ -967,6 +967,10 @@ SWITCH_STANDARD_API(timer_test_function)
stream->write_function(stream, "Avg: %0.3fms Total Time: %0.3fms\n", (float) ((float) (total / (x - 1)) / 1000),
(float) ((float) (end - start) / 1000));
if (switch_core_timer_destroy(&timer) != SWITCH_STATUS_SUCCESS) {
stream->write_function(stream, "Timer Destroy Error!\n");
}
end:
switch_core_destroy_memory_pool(&pool);
@ -2417,7 +2421,7 @@ SWITCH_STANDARD_API(uptime_function)
return SWITCH_STATUS_SUCCESS;
}
#define CTL_SYNTAX "[recover|send_sighup|hupall|pause [inbound|outbound]|resume [inbound|outbound]|shutdown [cancel|elegant|asap|now|restart]|sps|sps_peak_reset|sync_clock|sync_clock_when_idle|reclaim_mem|max_sessions|min_dtmf_duration [num]|max_dtmf_duration [num]|default_dtmf_duration [num]|min_idle_cpu|loglevel [level]|debug_level [level]]"
#define CTL_SYNTAX "[recover|send_sighup|hupall|pause [inbound|outbound]|resume [inbound|outbound]|shutdown [cancel|elegant|asap|now|restart]|sps|sps_peak_reset|sync_clock|sync_clock_when_idle|reclaim_mem|max_sessions|min_dtmf_duration [num]|max_dtmf_duration [num]|default_dtmf_duration [num]|min_idle_cpu|loglevel [level]|debug_level [level]|mdns_resolve [enable|disable]]"
SWITCH_STANDARD_API(ctl_function)
{
int argc;
@ -2673,6 +2677,25 @@ SWITCH_STANDARD_API(ctl_function)
} else {
stream->write_function(stream, "+OK clock will synchronize when there are no more calls\n");
}
} else if (!strcasecmp(argv[0], "mdns_resolve")) {
switch_bool_t set = 0;
if (argv[1]) {
if (!strcasecmp(argv[1], "enable")) {
arg = 1;
set = 1;
} else if (!strcasecmp(argv[1], "disable")) {
arg = 0;
set = 1;
}
}
if (set) {
switch_core_session_ctl(SCSC_MDNS_RESOLVE, &arg);
stream->write_function(stream, "+OK\n");
arg = 0;
} else {
stream->write_function(stream, "-ERR Invalid command\nUSAGE: fsctl %s\n", CTL_SYNTAX);
goto end;
}
} else {
stream->write_function(stream, "-ERR Invalid command\nUSAGE: fsctl %s\n", CTL_SYNTAX);
goto end;
@ -4022,6 +4045,46 @@ SWITCH_STANDARD_API(uuid_display_function)
return SWITCH_STATUS_SUCCESS;
}
#define MEDIA_PARAMS_SYNTAX "<uuid> <json>"
SWITCH_STANDARD_API(uuid_media_params_function)
{
char *mycmd = NULL, *argv[2] = { 0 };
int argc = 0;
switch_status_t status = SWITCH_STATUS_FALSE;
switch_core_session_t *tsession = NULL;
if (!zstr(cmd) && (mycmd = strdup(cmd))) {
argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
}
if (zstr(cmd) || argc < 2 || zstr(argv[0]) || zstr(argv[1])) {
stream->write_function(stream, "-USAGE: %s\n", MEDIA_PARAMS_SYNTAX);
goto end;
} else {
if ((tsession = switch_core_session_locate(argv[0]))) {
switch_channel_t *channel = switch_core_session_get_channel(session);
if (switch_false(argv[1])) {
switch_channel_clear_flag(channel, CF_MANUAL_MEDIA_PARAMS);
} else if ((status = switch_core_media_media_params(tsession, argv[1])) == SWITCH_STATUS_SUCCESS) {
switch_channel_set_flag(channel, CF_MANUAL_MEDIA_PARAMS);
}
switch_core_session_rwunlock(tsession);
}
}
if (status == SWITCH_STATUS_SUCCESS) {
stream->write_function(stream, "+OK Success\n");
} else {
stream->write_function(stream, "-ERR Operation failed\n");
}
end:
switch_safe_free(mycmd);
return SWITCH_STATUS_SUCCESS;
}
#define BUGLIST_SYNTAX "<uuid>"
SWITCH_STANDARD_API(uuid_buglist_function)
{
@ -4722,6 +4785,18 @@ SWITCH_STANDARD_API(session_record_function)
} else {
stream->write_function(stream, "+OK Success\n");
}
} else if (!strcasecmp(action, "pause")) {
if (switch_ivr_record_session_pause(rsession, path, SWITCH_TRUE) != SWITCH_STATUS_SUCCESS) {
stream->write_function(stream, "-ERR Cannot pause recording session!\n");
} else {
stream->write_function(stream, "+OK Success\n");
}
} else if (!strcasecmp(action, "resume")) {
if (switch_ivr_record_session_pause(rsession, path, SWITCH_FALSE) != SWITCH_STATUS_SUCCESS) {
stream->write_function(stream, "-ERR Cannot resume recording session!\n");
} else {
stream->write_function(stream, "+OK Success\n");
}
} else if (!strcasecmp(action, "mask")) {
if (switch_ivr_record_session_mask(rsession, path, SWITCH_TRUE) != SWITCH_STATUS_SUCCESS) {
stream->write_function(stream, "-ERR Cannot mask recording session!\n");
@ -6667,7 +6742,7 @@ SWITCH_STANDARD_API(xml_flush_function)
argc = switch_split(mycmd, ' ', argv);
}
if (argc == 3) {
if (argc > 1) {
r = switch_xml_clear_user_cache(argv[0], argv[1], argv[2]);
} else {
r = switch_xml_clear_user_cache(NULL, NULL, NULL);
@ -7485,6 +7560,18 @@ SWITCH_STANDARD_API(json_function)
return SWITCH_STATUS_SUCCESS;
}
SWITCH_STANDARD_API(memory_function)
{
const char *err;
if (!(err = switch_memory_usage_stream(stream))) {
stream->write_function(stream, "+OK\n");
} else {
stream->write_function(stream, "-ERR %s\n", err);
}
return SWITCH_STATUS_SUCCESS;
}
SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load)
{
switch_api_interface_t *commands_api_interface;
@ -7605,6 +7692,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load)
SWITCH_ADD_API(commands_api_interface, "uuid_deflect", "Send a deflect", uuid_deflect, UUID_DEFLECT_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "uuid_displace", "Displace audio", session_displace_function, "<uuid> [start|stop] <path> [<limit>] [mux]");
SWITCH_ADD_API(commands_api_interface, "uuid_display", "Update phone display", uuid_display_function, DISPLAY_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "uuid_media_params", "Update remote vid params", uuid_media_params_function, MEDIA_PARAMS_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "uuid_drop_dtmf", "Drop all DTMF or replace it with a mask", uuid_drop_dtmf, UUID_DROP_DTMF_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "uuid_dump", "Dump session vars", uuid_dump_function, DUMP_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "uuid_exists", "Check if a uuid exists", uuid_exists_function, EXISTS_SYNTAX);
@ -7652,6 +7740,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load)
SWITCH_ADD_API(commands_api_interface, "file_exists", "Check if a file exists on server", file_exists_function, "<file>");
SWITCH_ADD_API(commands_api_interface, "getcputime", "Gets CPU time in milliseconds (user,kernel)", getcputime_function, GETCPUTIME_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "json", "JSON API", json_function, "JSON");
SWITCH_ADD_API(commands_api_interface, "memory", "Memory usage statistics", memory_function, "memory");
SWITCH_ADD_JSON_API(json_api_interface, "mediaStats", "JSON Media Stats", json_stats_function, "");
@ -7720,6 +7809,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load)
switch_console_set_complete("add fsctl flush_db_handles");
switch_console_set_complete("add fsctl min_idle_cpu");
switch_console_set_complete("add fsctl send_sighup");
switch_console_set_complete("add fsctl mdns_resolve disable");
switch_console_set_complete("add fsctl mdns_resolve enable");
switch_console_set_complete("add interface_ip auto ::console::list_interfaces");
switch_console_set_complete("add interface_ip ipv4 ::console::list_interfaces");
switch_console_set_complete("add interface_ip ipv6 ::console::list_interfaces");
@ -7793,6 +7884,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load)
switch_console_set_complete("add uuid_deflect ::console::list_uuid");
switch_console_set_complete("add uuid_displace ::console::list_uuid");
switch_console_set_complete("add uuid_display ::console::list_uuid");
switch_console_set_complete("add uuid_media_params ::console::list_uuid");
switch_console_set_complete("add uuid_drop_dtmf ::console::list_uuid");
switch_console_set_complete("add uuid_dump ::console::list_uuid");
switch_console_set_complete("add uuid_answer ::console::list_uuid");
@ -7804,6 +7896,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load)
switch_console_set_complete("add uuid_flush_dtmf ::console::list_uuid");
switch_console_set_complete("add uuid_getvar ::console::list_uuid");
switch_console_set_complete("add uuid_hold ::console::list_uuid");
switch_console_set_complete("add uuid_hold off ::console::list_uuid");
switch_console_set_complete("add uuid_hold toggle ::console::list_uuid");
switch_console_set_complete("add uuid_send_info ::console::list_uuid");
switch_console_set_complete("add uuid_jitterbuffer ::console::list_uuid");
switch_console_set_complete("add uuid_kill ::console::list_uuid");

View File

@ -89,6 +89,8 @@ api_command_t conference_api_sub_commands[] = {
{"undeaf", (void_fn_t) & conference_api_sub_undeaf, CONF_API_SUB_MEMBER_TARGET, "undeaf", "<[member_id|all]|last|non_moderator>"},
{"vid-filter", (void_fn_t) & conference_api_sub_video_filter, CONF_API_SUB_MEMBER_TARGET, "vid-filter", "<[member_id|all]|last|non_moderator> <string>"},
{"relate", (void_fn_t) & conference_api_sub_relate, CONF_API_SUB_ARGS_SPLIT, "relate", "<member_id>[,<member_id>] <other_member_id>[,<other_member_id>] [nospeak|nohear|clear]"},
{"getvar", (void_fn_t) & conference_api_sub_getvar, CONF_API_SUB_ARGS_SPLIT, "getvar", "<varname>"},
{"setvar", (void_fn_t) & conference_api_sub_setvar, CONF_API_SUB_ARGS_SPLIT, "setvar", "<varname> <value>"},
{"lock", (void_fn_t) & conference_api_sub_lock, CONF_API_SUB_ARGS_SPLIT, "lock", ""},
{"unlock", (void_fn_t) & conference_api_sub_unlock, CONF_API_SUB_ARGS_SPLIT, "unlock", ""},
{"dial", (void_fn_t) & conference_api_sub_dial, CONF_API_SUB_ARGS_SPLIT, "dial", "<endpoint_module_name>/<destination> <callerid number> <callerid name>"},
@ -138,17 +140,17 @@ switch_status_t conference_api_sub_pause_play(conference_obj_t *conference, swit
}
if (argc == 3) {
uint32_t id = atoi(argv[2]);
const char * id = argv[2];
conference_member_t *member;
if ((member = conference_member_get(conference, id))) {
if ((member = conference_member_get_by_str(conference, id))) {
switch_mutex_lock(member->fnode_mutex);
conference_fnode_toggle_pause(member->fnode, stream);
switch_mutex_unlock(member->fnode_mutex);
switch_thread_rwlock_unlock(member->rwlock);
return SWITCH_STATUS_SUCCESS;
} else {
stream->write_function(stream, "-ERR Member: %u not found.\n", id);
stream->write_function(stream, "-ERR Member: %s not found.\n", id);
}
}
@ -166,17 +168,17 @@ switch_status_t conference_api_sub_play_status(conference_obj_t *conference, swi
}
if (argc == 3) {
uint32_t id = atoi(argv[2]);
const char *id = argv[2];
conference_member_t *member;
if ((member = conference_member_get(conference, id))) {
if ((member = conference_member_get_by_str(conference, id))) {
switch_mutex_lock(member->fnode_mutex);
conference_fnode_check_status(member->fnode, stream);
switch_mutex_unlock(member->fnode_mutex);
switch_thread_rwlock_unlock(member->rwlock);
return SWITCH_STATUS_SUCCESS;
} else {
stream->write_function(stream, "-ERR Member: %u not found.\n", id);
stream->write_function(stream, "-ERR Member: %s not found.\n", id);
}
}
@ -2518,7 +2520,6 @@ static void clear_role_id(conference_obj_t *conference, conference_member_t *mem
switch_status_t conference_api_sub_vid_res_id(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv)
{
uint8_t all = 0, clear = 0, force = 0;
uint32_t member_id;
char *res_id = NULL;
conference_member_t *member;
@ -2538,7 +2539,7 @@ switch_status_t conference_api_sub_vid_res_id(conference_obj_t *conference, swit
if (argc > 4)
force = strcasecmp(argv[4], "force") ? 0 : 1;
if (!(member_id = atoi(argv[2]))) {
if (!atoi(argv[2])) {
all = strcasecmp(argv[2], "all") ? 0 : 1;
}
@ -2550,13 +2551,11 @@ switch_status_t conference_api_sub_vid_res_id(conference_obj_t *conference, swit
}
}
switch_mutex_unlock(conference->member_mutex);
} else if (member_id) {
if (!(member = conference_member_get(conference, member_id)))
} else {
if (!(member = conference_member_get_by_str(conference, argv[2])))
return SWITCH_STATUS_GENERR;
conference_api_sub_vid_res_id_member(member, stream, res_id, clear, force);
switch_thread_rwlock_unlock(member->rwlock);
} else {
return SWITCH_STATUS_GENERR;
}
return SWITCH_STATUS_SUCCESS;
@ -2735,10 +2734,10 @@ switch_status_t conference_api_sub_file_seek(conference_obj_t *conference, switc
}
if (argc == 4) {
uint32_t id = atoi(argv[3]);
conference_member_t *member = conference_member_get(conference, id);
const char *id = argv[3];
conference_member_t *member = conference_member_get_by_str(conference, id);
if (member == NULL) {
stream->write_function(stream, "-ERR Member: %u not found.\n", id);
stream->write_function(stream, "-ERR Member: %s not found.\n", id);
return SWITCH_STATUS_GENERR;
}
@ -2833,7 +2832,7 @@ switch_status_t conference_api_sub_play(conference_obj_t *conference, switch_str
}
ret_status = SWITCH_STATUS_SUCCESS;
} else if (argc >= 4) {
uint32_t id = atoi(argv[3]);
const char *id = argv[3];
conference_member_t *member;
switch_bool_t mux = SWITCH_TRUE;
@ -2841,9 +2840,9 @@ switch_status_t conference_api_sub_play(conference_obj_t *conference, switch_str
mux = SWITCH_FALSE;
}
if ((member = conference_member_get(conference, id))) {
if ((member = conference_member_get_by_str(conference, id))) {
if (conference_member_play_file(member, argv[2], 0, mux) == SWITCH_STATUS_SUCCESS) {
stream->write_function(stream, "+OK (play) Playing file %s to member %u\n", argv[2], id);
stream->write_function(stream, "+OK (play) Playing file %s to member %u\n", argv[2], member->id);
if (test_eflag(conference, EFLAG_PLAY_FILE_MEMBER) &&
switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
conference_member_add_event_data(member, event);
@ -2899,7 +2898,7 @@ switch_status_t conference_api_sub_saymember(conference_obj_t *conference, switc
char *expanded = NULL;
char *start_text = NULL;
char *workspace = NULL;
uint32_t id = 0;
const char *id = NULL;
conference_member_t *member = NULL;
switch_event_t *event;
@ -2918,15 +2917,15 @@ switch_status_t conference_api_sub_saymember(conference_obj_t *conference, switc
text = start_text;
}
id = atoi(workspace);
id = workspace;
if (!id || zstr(text)) {
stream->write_function(stream, "-ERR (saymember) No Text!\n");
goto done;
}
if (!(member = conference_member_get(conference, id))) {
stream->write_function(stream, "-ERR (saymember) Unknown Member %u!\n", id);
if (!(member = conference_member_get_by_str(conference, id))) {
stream->write_function(stream, "-ERR (saymember) Unknown Member %s!\n", id);
goto done;
}
@ -3236,15 +3235,15 @@ switch_status_t conference_api_sub_stop(conference_obj_t *conference, switch_str
return SWITCH_STATUS_GENERR;
if (argc == 4) {
uint32_t id = atoi(argv[3]);
const char *id = argv[3];
conference_member_t *member;
if ((member = conference_member_get(conference, id))) {
if ((member = conference_member_get_by_str(conference, id))) {
uint32_t stopped = conference_member_stop_file(member, async ? FILE_STOP_ASYNC : current ? FILE_STOP_CURRENT : FILE_STOP_ALL);
stream->write_function(stream, "+OK Stopped %u files.\n", stopped);
switch_thread_rwlock_unlock(member->rwlock);
} else {
stream->write_function(stream, "-ERR Member: %u not found.\n", id);
stream->write_function(stream, "-ERR Member: %s not found.\n", id);
}
} else {
uint32_t stopped = conference_file_stop(conference, async ? FILE_STOP_ASYNC : current ? FILE_STOP_CURRENT : FILE_STOP_ALL);
@ -3436,6 +3435,30 @@ switch_status_t conference_api_sub_relate(conference_obj_t *conference, switch_s
return SWITCH_STATUS_SUCCESS;
}
switch_status_t conference_api_sub_getvar(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv)
{
const char *val = NULL;
const char *var = argv[2];
if (var) val = conference_get_variable(conference, var);
stream_write(stream, "%s", switch_str_nil(val));
return SWITCH_STATUS_SUCCESS;
}
switch_status_t conference_api_sub_setvar(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv)
{
const char *val = argv[3];
const char *var = argv[2];
if (var) conference_set_variable(conference, var, val);
stream_write(stream, "+OK\n", VA_NONE);
return SWITCH_STATUS_SUCCESS;
}
switch_status_t conference_api_sub_lock(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv)
{
switch_event_t *event;
@ -3659,13 +3682,13 @@ switch_status_t conference_api_sub_transfer(conference_obj_t *conference, switch
for (x = 3; x < argc; x++) {
conference_member_t *member = NULL;
uint32_t id = atoi(argv[x]);
const char *id = argv[x];
switch_channel_t *channel;
switch_event_t *event;
char *xdest = NULL;
if (!id || !(member = conference_member_get(conference, id))) {
stream->write_function(stream, "-ERR No Member %u in conference %s.\n", id, conference->name);
if (!id || !(member = conference_member_get_by_str(conference, id))) {
stream->write_function(stream, "-ERR No Member %s in conference %s.\n", id, conference->name);
continue;
}

View File

@ -634,7 +634,7 @@ void conference_event_adv_la(conference_obj_t *conference, conference_member_t *
switch_channel_set_flag(member->channel, CF_VIDEO_REFRESH_REQ);
switch_core_media_gen_key_frame(member->session);
if (conference && conference->la && member->session && !switch_channel_test_flag(member->channel, CF_VIDEO_ONLY)) {
if (conference && conference->la && member->session) {
cJSON *msg, *data;
const char *uuid = switch_core_session_get_uuid(member->session);
const char *cookie = switch_channel_get_variable(member->channel, "event_channel_cookie");

View File

@ -839,6 +839,12 @@ void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, void *ob
continue;
}
if (conference_utils_test_flag(member->conference, CFLAG_BREAKABLE) &&
switch_channel_test_flag(channel, CF_BREAK)) {
switch_channel_clear_flag(channel, CF_BREAK);
break;
}
/* Read a frame. */
status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0);

View File

@ -186,7 +186,7 @@ void conference_member_update_status_field(conference_member_t *member)
cJSON_AddItemToObject(video, "visible", cJSON_CreateFalse());
}
cJSON_AddItemToObject(video, "videoOnly", cJSON_CreateBool(switch_channel_test_flag(member->channel, CF_VIDEO_ONLY)));
cJSON_AddItemToObject(video, "noRecover", cJSON_CreateBool(switch_channel_test_flag(member->channel, CF_NO_RECOVER)));
if (switch_true(switch_channel_get_variable_dup(member->channel, "video_screen_share", SWITCH_FALSE, -1))) {
cJSON_AddItemToObject(video, "screenShare", cJSON_CreateTrue());
}
@ -442,6 +442,32 @@ conference_member_t *conference_member_get_by_var(conference_obj_t *conference,
return member;
}
/* traverse the conference member list for the specified member id or variable and return its pointer */
conference_member_t *conference_member_get_by_str(conference_obj_t *conference, const char *id_str)
{
conference_member_t *member = NULL;
switch_assert(conference != NULL);
if (!id_str) {
return NULL;
}
if (strchr(id_str, '=')) {
char *var, *val;
var = strdup(id_str);
switch_assert(var);
if ((val = strchr(var, '='))) {
*val++ = '\0';
}
member = conference_member_get_by_var(conference, var, val);
free(var);
} else {
member = conference_member_get(conference, atoi(id_str));
}
return member;
}
/* traverse the conference member list for the specified member with role and return it's pointer */
conference_member_t *conference_member_get_by_role(conference_obj_t *conference, const char *role_id)
@ -1373,6 +1399,10 @@ void conference_member_send_all_dtmf(conference_member_t *member, conference_obj
if (imember->id == member->id) {
continue;
}
if (conference_utils_member_test_flag(imember, MFLAG_SKIP_DTMF)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Skipping dist-dtmf to member due to skip-dtmf flag.\n");
continue;
}
if (imember->session) {
const char *p;
for (p = dtmf; p && *p; p++) {

View File

@ -124,6 +124,8 @@ void conference_utils_set_mflags(const char *flags, member_flag_t *f)
f[MFLAG_MUTE_DETECT] = 1;
} else if (!strcasecmp(argv[i], "dist-dtmf")) {
f[MFLAG_DIST_DTMF] = 1;
} else if (!strcasecmp(argv[i], "skip-dtmf")) {
f[MFLAG_SKIP_DTMF] = 1;
} else if (!strcasecmp(argv[i], "moderator")) {
f[MFLAG_MOD] = 1;
} else if (!strcasecmp(argv[i], "nomoh")) {
@ -216,6 +218,8 @@ void conference_utils_set_cflags(const char *flags, conference_flag_t *f)
f[CFLAG_PERSONAL_CANVAS] = 1;
} else if (!strcasecmp(argv[i], "ded-vid-layer-audio-floor")) {
f[CFLAG_DED_VID_LAYER_AUDIO_FLOOR] = 1;
} else if (!strcasecmp(argv[i], "breakable")) {
f[CFLAG_BREAKABLE] = 1;
}
}

View File

@ -3344,7 +3344,8 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr
if (imember->watching_canvas_id == canvas->canvas_id && switch_channel_test_flag(imember->channel, CF_VIDEO_REFRESH_REQ)) {
switch_channel_clear_flag(imember->channel, CF_VIDEO_REFRESH_REQ);
send_keyframe = SWITCH_TRUE;
canvas->send_keyframe = 30;
send_keyframe = 1;
}
if (conference_utils_test_flag(conference, CFLAG_MINIMIZE_VIDEO_ENCODING) &&

View File

@ -220,6 +220,7 @@ void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, void *ob
uint32_t x = 0;
int32_t z = 0;
conference_cdr_node_t *np;
switch_time_t last_heartbeat_time = switch_epoch_time_now(NULL);
file_frame = switch_core_alloc(conference->pool, SWITCH_RECOMMENDED_BUFFER_SIZE);
async_file_frame = switch_core_alloc(conference->pool, SWITCH_RECOMMENDED_BUFFER_SIZE);
@ -239,6 +240,7 @@ void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, void *ob
conference->record_count = 0;
while (conference_globals.running && !conference_utils_test_flag(conference, CFLAG_DESTRUCT)) {
switch_time_t now = switch_epoch_time_now(NULL);
switch_size_t file_sample_len = samples;
switch_size_t file_data_len = samples * 2 * conference->channels;
int has_file_data = 0, members_with_video = 0, members_with_avatar = 0, members_seeing_video = 0;
@ -257,6 +259,15 @@ void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, void *ob
floor_holder = conference->floor_holder;
if (conference->heartbeat_period_sec > 0 && (now - last_heartbeat_time) >= conference->heartbeat_period_sec) {
switch_event_t *heartbeat_event = NULL;
last_heartbeat_time = now;
switch_event_create_subclass(&heartbeat_event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT);
conference_event_add_data(conference, heartbeat_event);
switch_event_add_header_string(heartbeat_event, SWITCH_STACK_BOTTOM, "Action", "conference-heartbeat");
switch_event_fire(&heartbeat_event);
}
for (imember = conference->members; imember; imember = imember->next) {
if (!zstr(imember->text_framedata)) {
switch_frame_t frame = { 0 };
@ -1445,6 +1456,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, "pass_digits", conference_utils_member_test_flag(member, MFLAG_DIST_DTMF));
}
switch_mutex_unlock(conference->member_mutex);
}
@ -2463,21 +2475,21 @@ SWITCH_STANDARD_APP(conference_function)
switch_core_session_set_video_read_callback(session, conference_video_thread_callback, (void *)&member);
switch_core_session_set_text_read_callback(session, conference_text_thread_callback, (void *)&member);
if (switch_channel_test_flag(channel, CF_VIDEO_ONLY) || !switch_channel_test_flag(channel, CF_AUDIO)) {
while(conference_utils_member_test_flag((&member), MFLAG_RUNNING) && switch_channel_ready(channel)) {
switch_frame_t *read_frame;
if (switch_channel_test_flag(channel, CF_AUDIO)) {
switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0);
}
switch_yield(100000);
}
} else {
/* Run the conference loop */
do {
switch_media_flow_t audio_flow = switch_core_session_media_flow(session, SWITCH_MEDIA_TYPE_AUDIO);
if (switch_channel_test_flag(channel, CF_AUDIO) && (audio_flow == SWITCH_MEDIA_FLOW_SENDRECV || audio_flow == SWITCH_MEDIA_FLOW_RECVONLY)) {
conference_loop_output(&member);
} while (member.loop_loop);
} else {
if (conference_utils_member_test_flag((&member), MFLAG_RUNNING) && switch_channel_ready(channel)) {
switch_yield(100000);
member.loop_loop = 1;
} else {
break;
}
}
} while (member.loop_loop);
switch_core_session_video_reset(session);
switch_channel_clear_flag_recursive(channel, CF_VIDEO_DECODED_READ);
@ -2644,24 +2656,44 @@ conference_obj_t *conference_find(char *name, char *domain)
void conference_set_variable(conference_obj_t *conference, const char *var, const char *val)
{
switch_assert(var);
switch_mutex_lock(conference->flag_mutex);
if (!val) {
switch_event_del_header(conference->variables, var);
} else {
switch_event_add_header_string(conference->variables, SWITCH_STACK_BOTTOM, var, val);
}
switch_mutex_unlock(conference->flag_mutex);
}
const char *conference_get_variable(conference_obj_t *conference, const char *var)
{
const char *val;
const char *val = NULL, *rval = NULL;
switch_mutex_lock(conference->flag_mutex);
val = switch_event_get_header(conference->variables, var);
if ((val = switch_event_get_header(conference->variables, var))) {
rval = switch_core_strdup(conference->pool, val);
}
switch_mutex_unlock(conference->flag_mutex);
if (val) {
return switch_core_strdup(conference->pool, val);
}
return rval;
}
return NULL;
static void check_var_event(conference_obj_t *conference, switch_event_t *var_event)
{
switch_event_header_t *hi = NULL;
for (hi = var_event->headers; hi; hi = hi->next) {
char *vvar = hi->name;
char *vval = hi->value;
if (vvar && vval && !strncasecmp(vvar, "confvar_", 8)) {
vvar += 8;
if (vvar) {
conference_set_variable(conference, vvar, vval);
}
}
}
}
/* create a new conferene with a specific profile */
@ -2767,6 +2799,8 @@ conference_obj_t *conference_new(char *name, conference_xml_cfg_t cfg, switch_co
char *scale_h264_canvas_bandwidth = NULL;
char *video_codec_config_profile_name = NULL;
int tmp;
int heartbeat_period_sec = 0;
switch_event_t *var_event = NULL;
/* Validate the conference name */
if (zstr(name)) {
@ -3130,6 +3164,8 @@ conference_obj_t *conference_new(char *name, conference_xml_cfg_t cfg, switch_co
scale_h264_canvas_bandwidth = val;
} else if (!strcasecmp(var, "video-codec-config-profile-name") && !zstr(val)) {
video_codec_config_profile_name = val;
} else if (!strcasecmp(var, "heartbeat-period-sec") && !zstr(val)) {
heartbeat_period_sec = atoi(val);
}
}
@ -3649,6 +3685,10 @@ conference_obj_t *conference_new(char *name, conference_xml_cfg_t cfg, switch_co
conference->verbose_events = 1;
}
if (heartbeat_period_sec >= 20 || heartbeat_period_sec == 0) {
conference->heartbeat_period_sec = heartbeat_period_sec;
}
/* Create the conference unique identifier */
switch_uuid_get(&uuid);
switch_uuid_format(uuid_str, &uuid);
@ -3666,6 +3706,14 @@ conference_obj_t *conference_new(char *name, conference_xml_cfg_t cfg, switch_co
switch_mutex_init(&conference->member_mutex, SWITCH_MUTEX_NESTED, conference->pool);
switch_mutex_init(&conference->canvas_mutex, SWITCH_MUTEX_NESTED, conference->pool);
switch_core_get_variables(&var_event);
check_var_event(conference, var_event);
switch_event_destroy(&var_event);
switch_channel_get_variables(channel, &var_event);
check_var_event(conference, var_event);
switch_event_destroy(&var_event);
switch_mutex_lock(conference_globals.hash_mutex);
conference_utils_set_flag(conference, CFLAG_INHASH);
switch_core_hash_insert(conference_globals.conference_hash, conference->name, conference);

View File

@ -214,6 +214,7 @@ typedef enum {
MFLAG_VIDEO_JOIN,
MFLAG_DED_VID_LAYER,
MFLAG_HOLD,
MFLAG_SKIP_DTMF,
///////////////////////////
MFLAG_MAX
} member_flag_t;
@ -255,6 +256,7 @@ typedef enum {
CFLAG_VIDEO_MUTE_EXIT_CANVAS,
CFLAG_NO_MOH,
CFLAG_DED_VID_LAYER_AUDIO_FLOOR,
CFLAG_BREAKABLE,
/////////////////////////////////
CFLAG_MAX
} conference_flag_t;
@ -760,6 +762,7 @@ typedef struct conference_obj {
char *default_layout_name;
int mux_paused;
char *video_codec_config_profile_name;
int heartbeat_period_sec;
} conference_obj_t;
/* Relationship with another member */
@ -1097,6 +1100,7 @@ void conference_member_set_score_iir(conference_member_t *member, uint32_t score
conference_relationship_t *conference_member_add_relationship(conference_member_t *member, uint32_t id);
conference_member_t *conference_member_get(conference_obj_t *conference, uint32_t id);
conference_member_t *conference_member_get_by_str(conference_obj_t *conference, const char *id_str);
conference_member_t *conference_member_get_by_var(conference_obj_t *conference, const char *var, const char *val);
conference_member_t *conference_member_get_by_role(conference_obj_t *conference, const char *role_id);
switch_status_t conference_member_del_relationship(conference_member_t *member, uint32_t id);
@ -1214,6 +1218,8 @@ switch_status_t conference_api_sub_hold(conference_member_t *member, switch_stre
switch_status_t conference_api_sub_unhold(conference_member_t *member, switch_stream_handle_t *stream, void *data);
switch_status_t conference_api_sub_pauserec(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv);
switch_status_t conference_api_sub_volume_out(conference_member_t *member, switch_stream_handle_t *stream, void *data);
switch_status_t conference_api_sub_getvar(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv);
switch_status_t conference_api_sub_setvar(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv);
switch_status_t conference_api_sub_lock(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv);
switch_status_t conference_api_sub_unlock(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv);
switch_status_t conference_api_sub_relate(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv);
@ -1307,8 +1313,8 @@ const char *conference_get_variable(conference_obj_t *conference, const char *va
/* Entries in this list should be kept in sync with the enum above */
extern api_command_t conference_api_sub_commands[];
extern struct _mapping control_mappings[];
#define stream_write(__stream, __fmt, ...) if (__stream)__stream->write_function(__stream, __fmt, __VA_ARGS__)
#define VA_NONE "%s", ""
#endif /* MOD_CONFERENCE_H */
/* For Emacs:

View File

@ -37,7 +37,7 @@
#include <switch.h>
#include "highgui.h"
#include "opencv2/highgui/highgui_c.h"
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
@ -596,9 +596,9 @@ void detectAndDraw(cv_context_t *context)
context->cascade->detectMultiScale( smallImg, detectedObjs,
context->search_scale, context->neighbors, 0
|CV_HAAR_FIND_BIGGEST_OBJECT
|CV_HAAR_DO_ROUGH_SEARCH
|CV_HAAR_SCALE_IMAGE
|CASCADE_FIND_BIGGEST_OBJECT
|CASCADE_DO_ROUGH_SEARCH
|CASCADE_SCALE_IMAGE
,
Size(context->max_search_w, context->max_search_h) );
@ -679,7 +679,7 @@ void detectAndDraw(cv_context_t *context)
//|CV_HAAR_FIND_BIGGEST_OBJECT
//|CV_HAAR_DO_ROUGH_SEARCH
//|CV_HAAR_DO_CANNY_PRUNING
|CV_HAAR_SCALE_IMAGE
|CASCADE_SCALE_IMAGE
,
Size(30, 30) );
@ -690,7 +690,7 @@ void detectAndDraw(cv_context_t *context)
//printf("WTF %d\n", object_neighbors);
//cout << "Detected " << object_neighbors << " object neighbors" << endl;
const int rect_height = cvRound((float)img.rows * object_neighbors / max_neighbors);
CvScalar col = CV_RGB((float)255 * object_neighbors / max_neighbors, 0, 0);
cv:Scalar col = CV_RGB((float)255 * object_neighbors / max_neighbors, 0, 0);
rectangle(img, cvPoint(0, img.rows), cvPoint(img.cols/10, img.rows - rect_height), col, -1);
parse_stats(&context->nestDetected, nestedObjects.size(), context->skip);

Some files were not shown because too many files have changed in this diff Show More