Merge branch 'signalwire:master' into allow_non_ascii_mod_ssml
This commit is contained in:
commit
ab004e0414
11
.drone.yml
11
.drone.yml
|
@ -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
|
||||
|
||||
...
|
||||
|
|
|
@ -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
|
||||
|
|
4
LICENSE
4
LICENSE
|
@ -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
|
||||
|
|
12
Makefile.am
12
Makefile.am
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1 +1 @@
|
|||
1.10.7-dev
|
||||
1.10.8-dev
|
||||
|
|
|
@ -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 ../../../..
|
||||
|
|
Binary file not shown.
|
@ -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" />
|
||||
|
|
|
@ -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"/>
|
||||
|
||||
|
|
|
@ -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" />
|
||||
|
|
|
@ -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" />
|
||||
|
|
|
@ -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" />
|
||||
|
|
|
@ -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" />
|
||||
|
|
|
@ -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" />
|
||||
|
|
|
@ -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"/>-->
|
||||
|
|
|
@ -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"/>
|
||||
|
||||
|
|
|
@ -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"/>
|
||||
|
|
|
@ -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" />
|
||||
|
|
|
@ -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 -->
|
||||
|
|
|
@ -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"/>-->
|
||||
|
|
|
@ -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"/>-->
|
||||
|
|
216
configure.ac
216
configure.ac
|
@ -3,10 +3,10 @@
|
|||
|
||||
# Must change all of the below together
|
||||
# For a release, set revision for that tagged release as well and uncomment
|
||||
AC_INIT([freeswitch], [1.10.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
|
||||
|
|
|
@ -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}),
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1 +1 @@
|
|||
/usr/lib/python*/*-packages/freeswitch.py
|
||||
/usr/lib/python2*/*-packages/freeswitch.py
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
/usr/lib/python3*/*-packages/freeswitch.py
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 49 KiB |
Binary file not shown.
After Width: | Height: | Size: 113 KiB |
|
@ -794,3 +794,4 @@ mariadb-connector-c-*
|
|||
/spandsp*/
|
||||
/spandsp*
|
||||
win32/spandsp/spandsp.h
|
||||
win32/spandsp/win32
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
||||
|
|
@ -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
|
@ -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()
|
|
@ -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))
|
||||
|
|
@ -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()
|
||||
|
||||
|
|
@ -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:])
|
|
@ -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)) {
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -374,6 +374,6 @@ main (int argc, char *argv[])
|
|||
#ifdef _WIN32
|
||||
WSACleanup ();
|
||||
#endif
|
||||
|
||||
if (file) free(file);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
;;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
|
@ -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)
|
||||
{
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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">
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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:
|
||||
*/
|
|
@ -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;
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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:
|
||||
*/
|
|
@ -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;
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
||||
/*!
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 */
|
||||
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
test/test_BT7.mp4
|
||||
test/test_RGB.mp4
|
||||
test/test_packetizer
|
|
@ -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,8 +1638,12 @@ GCC_DIAG_ON(deprecated-declarations)
|
|||
context->nalus[i].start = p;
|
||||
context->nalus[i].eat = p;
|
||||
|
||||
if (mod_av_globals.debug && (*p & 0x1f) == 7) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "KEY FRAME GENERATED\n");
|
||||
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;
|
||||
|
@ -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")) {
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1523,9 +1612,9 @@ GCC_DIAG_OFF(deprecated-declarations)
|
|||
if ((error = avcodec_decode_audio4(context->audio_st[0].st->codec, &in_frame, &got_data, &pkt)) < 0) {
|
||||
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)));
|
||||
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";
|
||||
|
|
|
@ -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
|
||||
switch_log_vprintf(SWITCH_CHANNEL_LOG_CLEAN, switch_level, fmt, vl);
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -50,7 +50,7 @@ static fctcl_init_t my_cl_options[] = {
|
|||
|
||||
FST_CORE_BEGIN("conf")
|
||||
{
|
||||
const char *loop_;
|
||||
const char *loop_;
|
||||
fctcl_install(my_cl_options);
|
||||
|
||||
loop_ = fctcl_val("--loop");
|
||||
|
@ -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);
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* Contributor(s):
|
||||
*
|
||||
* Eric des Courtis <eric.des.courtis@benbria.com>
|
||||
* Piotr Gregor <piotrgregor@rsyncme.org>
|
||||
* Piotr Gregor <piotrgregor@rsyncme.org>
|
||||
*/
|
||||
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
|||
|
||||
|
||||
double avmd_amplitude(circ_buffer_t *b, size_t i, double f) {
|
||||
double result;
|
||||
result = sqrt(PSI(b, i) / sin(f * f));
|
||||
return result;
|
||||
double result;
|
||||
result = sqrt(PSI(b, i) / sin(f * f));
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* Contributor(s):
|
||||
*
|
||||
* Eric des Courtis <eric.des.courtis@benbria.com>
|
||||
* Piotr Gregor <piotrgregor@rsyncme.org>
|
||||
* Piotr Gregor <piotrgregor@rsyncme.org>
|
||||
*/
|
||||
|
||||
|
||||
|
|
|
@ -11,20 +11,20 @@
|
|||
|
||||
extern size_t next_power_of_2(size_t v)
|
||||
{
|
||||
size_t prev;
|
||||
size_t tmp = 1;
|
||||
size_t prev;
|
||||
size_t tmp = 1;
|
||||
|
||||
v++;
|
||||
v++;
|
||||
|
||||
do {
|
||||
prev = v;
|
||||
v &= ~tmp;
|
||||
tmp <<= 1;
|
||||
} while (v != 0);
|
||||
do {
|
||||
prev = v;
|
||||
v &= ~tmp;
|
||||
tmp <<= 1;
|
||||
} while (v != 0);
|
||||
|
||||
prev <<= 1;
|
||||
prev <<= 1;
|
||||
|
||||
return prev;
|
||||
return prev;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* Contributor(s):
|
||||
*
|
||||
* Eric des Courtis <eric.des.courtis@benbria.com>
|
||||
* Piotr Gregor <piotrgregor@rsyncme.org>
|
||||
* Piotr Gregor <piotrgregor@rsyncme.org>
|
||||
*/
|
||||
|
||||
|
||||
|
@ -15,89 +15,89 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#include <float.h>
|
||||
#include <inttypes.h>
|
||||
#include <float.h>
|
||||
#include <inttypes.h>
|
||||
#endif
|
||||
|
||||
#ifndef INT16_MIN
|
||||
#define INT16_MIN (-32767-1)
|
||||
#define INT16_MIN (-32767-1)
|
||||
#endif
|
||||
#ifndef INT16_MAX
|
||||
#define INT16_MAX (32767)
|
||||
#define INT16_MAX (32767)
|
||||
#endif
|
||||
|
||||
#define BUFF_TYPE double
|
||||
|
||||
typedef struct {
|
||||
size_t pos;
|
||||
size_t lpos;
|
||||
BUFF_TYPE *buf;
|
||||
size_t buf_len;
|
||||
size_t mask;
|
||||
size_t i;
|
||||
size_t backlog;
|
||||
size_t pos;
|
||||
size_t lpos;
|
||||
BUFF_TYPE *buf;
|
||||
size_t buf_len;
|
||||
size_t mask;
|
||||
size_t i;
|
||||
size_t backlog;
|
||||
} circ_buffer_t;
|
||||
|
||||
extern size_t next_power_of_2(size_t v);
|
||||
|
||||
#define INC_POS(b) \
|
||||
{ \
|
||||
{ \
|
||||
(b)->pos++; \
|
||||
(b)->pos &= (b)->mask; \
|
||||
(b)->lpos + 1 < 2 * (b)->buf_len ? (b)->lpos++ : (b)->lpos = (b)->buf_len; \
|
||||
if ((b)->backlog < (b)->buf_len) (b)->backlog++; \
|
||||
}
|
||||
}
|
||||
|
||||
#define DEC_POS(b) \
|
||||
{ \
|
||||
{ \
|
||||
(b)->pos--; \
|
||||
(b)->pos &= (b)->mask; \
|
||||
(b)->lpos--; \
|
||||
if (((b)->backlog - 1) < (b)->backlog) (b)->backlog--; \
|
||||
}
|
||||
}
|
||||
|
||||
#define GET_SAMPLE(b, i) ((b)->buf[(i) & (b)->mask])
|
||||
#define SET_SAMPLE(b, i, v) ((b)->buf[(i) & (b)->mask] = (v))
|
||||
|
||||
#define INSERT_FRAME(b, f, l) \
|
||||
do { \
|
||||
do { \
|
||||
for ((b)->i = 0; (b)->i < (l); (b)->i++) { \
|
||||
SET_SAMPLE((b), ((b)->i + (b)->pos), (f)[(b)->i]); \
|
||||
SET_SAMPLE((b), ((b)->i + (b)->pos), (f)[(b)->i]); \
|
||||
} \
|
||||
(b)->pos += (l); \
|
||||
(b)->lpos += (l); \
|
||||
(b)->pos %= (b)->buf_len; \
|
||||
(b)->backlog += (l); \
|
||||
if ((b)->backlog > (b)->buf_len) (b)->backlog = (b)->buf_len; \
|
||||
} while (0)
|
||||
} while (0)
|
||||
|
||||
|
||||
/* ((f)[(b)->i] >= 0) ? \
|
||||
((BUFF_TYPE)(f)[(b)->i] / (BUFF_TYPE)INT16_MAX): \
|
||||
(0.0 - ((BUFF_TYPE)(f)[(b)->i] / (BUFF_TYPE)INT16_MIN)) \ */
|
||||
/* ((f)[(b)->i] >= 0) ? \
|
||||
((BUFF_TYPE)(f)[(b)->i] / (BUFF_TYPE)INT16_MAX): \
|
||||
(0.0 - ((BUFF_TYPE)(f)[(b)->i] / (BUFF_TYPE)INT16_MIN)) \ */
|
||||
#define INSERT_INT16_FRAME(b, f, l) \
|
||||
{ \
|
||||
{ \
|
||||
for ((b)->i = 0; (b)->i < (l); (b)->i++) { \
|
||||
SET_SAMPLE( \
|
||||
SET_SAMPLE( \
|
||||
(b), \
|
||||
((b)->i + (b)->pos), \
|
||||
( \
|
||||
(BUFF_TYPE)(f)[(b)->i] \
|
||||
(BUFF_TYPE)(f)[(b)->i] \
|
||||
) \
|
||||
); \
|
||||
); \
|
||||
} \
|
||||
(b)->pos += (l); \
|
||||
(b)->lpos += (l); \
|
||||
(b)->pos &= (b)->mask; \
|
||||
(b)->backlog += (l); \
|
||||
if ((b)->backlog > (b)->buf_len) (b)->backlog = (b)->buf_len; \
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#define CALC_BUFF_LEN(fl, bl) (((fl) >= (bl))? next_power_of_2((fl) << 1): next_power_of_2((bl) << 1))
|
||||
|
||||
#define INIT_CIRC_BUFFER(bf, bl, fl, s) \
|
||||
{ \
|
||||
{ \
|
||||
(bf)->buf_len = CALC_BUFF_LEN((fl), (bl)); \
|
||||
(bf)->mask = (bf)->buf_len - 1; \
|
||||
(bf)->buf = (BUFF_TYPE *) switch_core_session_alloc(s, (bf)->buf_len * sizeof(BUFF_TYPE)); \
|
||||
|
@ -105,7 +105,7 @@ extern size_t next_power_of_2(size_t v);
|
|||
(bf)->lpos = 0; \
|
||||
(bf)->backlog = 0; \
|
||||
(bf)->i = 0; \
|
||||
}
|
||||
}
|
||||
|
||||
//#define DESTROY_CIRC_BUFFER(b) free((b)->buf)
|
||||
#define GET_BACKLOG_POS(b) ((b)->lpos - (b)->backlog)
|
||||
|
@ -114,9 +114,9 @@ extern size_t next_power_of_2(size_t v);
|
|||
#define GET_CURRENT_SAMPLE(b) GET_SAMPLE((b), GET_CURRENT_LPOS((b)))
|
||||
|
||||
#define ADD_SAMPLE(b, s) \
|
||||
do { \
|
||||
do { \
|
||||
INC_POS((b)); \
|
||||
SET_SAMPLE((b), GET_CURRENT_LPOS((b)), (s)); \
|
||||
} while (0)
|
||||
} while (0)
|
||||
|
||||
#endif /* __AVMD_BUFFER_H__ */
|
||||
|
|
|
@ -2,15 +2,15 @@
|
|||
* Contributor(s):
|
||||
*
|
||||
* Eric des Courtis <eric.des.courtis@benbria.com>
|
||||
* Piotr Gregor <piotrgregor@rsyncme.org>
|
||||
* Piotr Gregor <piotrgregor@rsyncme.org>
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#include <float.h>
|
||||
#define ISNAN(x) (!!(_isnan(x)))
|
||||
#define ISINF(x) (isinf(x))
|
||||
#include <float.h>
|
||||
#define ISNAN(x) (!!(_isnan(x)))
|
||||
#define ISINF(x) (isinf(x))
|
||||
#endif
|
||||
|
||||
#include "avmd_buffer.h"
|
||||
|
@ -18,50 +18,50 @@
|
|||
#include "avmd_options.h"
|
||||
|
||||
#ifdef AVMD_FAST_MATH
|
||||
#include "avmd_fast_acosf.h"
|
||||
#include "avmd_fast_acosf.h"
|
||||
#endif
|
||||
|
||||
|
||||
double avmd_desa2(circ_buffer_t *b, size_t i, double *amplitude) {
|
||||
double d;
|
||||
double n;
|
||||
double x0;
|
||||
double x1;
|
||||
double x2;
|
||||
double x3;
|
||||
double x4;
|
||||
double x2sq;
|
||||
double result;
|
||||
double PSI_Xn, PSI_Yn, NEEDED;
|
||||
double d;
|
||||
double n;
|
||||
double x0;
|
||||
double x1;
|
||||
double x2;
|
||||
double x3;
|
||||
double x4;
|
||||
double x2sq;
|
||||
double result;
|
||||
double PSI_Xn, PSI_Yn, NEEDED;
|
||||
|
||||
x0 = GET_SAMPLE((b), (i));
|
||||
x1 = GET_SAMPLE((b), ((i) + 1));
|
||||
x2 = GET_SAMPLE((b), ((i) + 2));
|
||||
x3 = GET_SAMPLE((b), ((i) + 3));
|
||||
x4 = GET_SAMPLE((b), ((i) + 4));
|
||||
x0 = GET_SAMPLE((b), (i));
|
||||
x1 = GET_SAMPLE((b), ((i) + 1));
|
||||
x2 = GET_SAMPLE((b), ((i) + 2));
|
||||
x3 = GET_SAMPLE((b), ((i) + 3));
|
||||
x4 = GET_SAMPLE((b), ((i) + 4));
|
||||
|
||||
x2sq = x2 * x2;
|
||||
d = 2.0 * ((x2sq) - (x1 * x3));
|
||||
if (d == 0.0) {
|
||||
*amplitude = 0.0;
|
||||
return 0.0;
|
||||
}
|
||||
PSI_Xn = ((x2sq) - (x0 * x4));
|
||||
NEEDED = ((x1 * x1) - (x0 * x2)) + ((x3 * x3) - (x2 * x4));
|
||||
n = ((x2sq) - (x0 * x4)) - NEEDED;
|
||||
PSI_Yn = NEEDED + PSI_Xn;
|
||||
x2sq = x2 * x2;
|
||||
d = 2.0 * ((x2sq) - (x1 * x3));
|
||||
if (d == 0.0) {
|
||||
*amplitude = 0.0;
|
||||
return 0.0;
|
||||
}
|
||||
PSI_Xn = ((x2sq) - (x0 * x4));
|
||||
NEEDED = ((x1 * x1) - (x0 * x2)) + ((x3 * x3) - (x2 * x4));
|
||||
n = ((x2sq) - (x0 * x4)) - NEEDED;
|
||||
PSI_Yn = NEEDED + PSI_Xn;
|
||||
|
||||
#ifdef AVMD_FAST_MATH
|
||||
result = 0.5 * (double)fast_acosf((float)n/d);
|
||||
result = 0.5 * (double)fast_acosf((float)n/d);
|
||||
#else
|
||||
result = 0.5 * acos(n/d);
|
||||
result = 0.5 * acos(n/d);
|
||||
#endif
|
||||
|
||||
if (ISNAN(result)) {
|
||||
result = 0.0;
|
||||
}
|
||||
*amplitude = 2.0 * PSI_Xn / sqrt(PSI_Yn);
|
||||
if (ISNAN(result)) {
|
||||
result = 0.0;
|
||||
}
|
||||
*amplitude = 2.0 * PSI_Xn / sqrt(PSI_Yn);
|
||||
|
||||
return result;
|
||||
return result;
|
||||
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* Contributor(s):
|
||||
*
|
||||
* Eric des Courtis <eric.des.courtis@benbria.com>
|
||||
* Piotr Gregor <piotrgregor@rsyncme.org>
|
||||
* Piotr Gregor <piotrgregor@rsyncme.org>
|
||||
*/
|
||||
|
||||
|
||||
|
|
|
@ -1,71 +1,71 @@
|
|||
/*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Piotr Gregor <piotrgregor@rsyncme.org>
|
||||
* Piotr Gregor <piotrgregor@rsyncme.org>
|
||||
*/
|
||||
|
||||
#ifndef __AVMD_DESA2_TWEAKED_H__
|
||||
#include "avmd_desa2_tweaked.h"
|
||||
#include "avmd_desa2_tweaked.h"
|
||||
#endif
|
||||
|
||||
#include <switch.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#include <float.h>
|
||||
#define ISNAN(x) (!!(_isnan(x)))
|
||||
#define ISINF(x) (isinf(x))
|
||||
#include <float.h>
|
||||
#define ISNAN(x) (!!(_isnan(x)))
|
||||
#define ISINF(x) (isinf(x))
|
||||
#endif
|
||||
|
||||
#include "avmd_buffer.h"
|
||||
#include "avmd_options.h"
|
||||
|
||||
#ifndef AVMD_FAST_MATH
|
||||
#include "avmd_fast_acosf.h"
|
||||
#include "avmd_fast_acosf.h"
|
||||
#endif
|
||||
|
||||
|
||||
double
|
||||
avmd_desa2_tweaked(circ_buffer_t *b, size_t i, double *amplitude) {
|
||||
double n, d;
|
||||
double x0;
|
||||
double x1;
|
||||
double x2;
|
||||
double x3;
|
||||
double x4;
|
||||
double x2sq;
|
||||
double result;
|
||||
double PSI_Xn, PSI_Yn, NEEDED;
|
||||
double n, d;
|
||||
double x0;
|
||||
double x1;
|
||||
double x2;
|
||||
double x3;
|
||||
double x4;
|
||||
double x2sq;
|
||||
double result;
|
||||
double PSI_Xn, PSI_Yn, NEEDED;
|
||||
|
||||
x0 = GET_SAMPLE((b), (i));
|
||||
x1 = GET_SAMPLE((b), ((i) + 1));
|
||||
x2 = GET_SAMPLE((b), ((i) + 2));
|
||||
x3 = GET_SAMPLE((b), ((i) + 3));
|
||||
x4 = GET_SAMPLE((b), ((i) + 4));
|
||||
x2sq = x2 * x2;
|
||||
d = 2.0 * ((x2sq) - (x1 * x3));
|
||||
PSI_Xn = ((x2sq) - (x0 * x4));
|
||||
NEEDED = ((x1 * x1) - (x0 * x2)) + ((x3 * x3) - (x2 * x4));
|
||||
n = ((x2sq) - (x0 * x4)) - NEEDED;
|
||||
PSI_Yn = NEEDED + PSI_Xn;
|
||||
x0 = GET_SAMPLE((b), (i));
|
||||
x1 = GET_SAMPLE((b), ((i) + 1));
|
||||
x2 = GET_SAMPLE((b), ((i) + 2));
|
||||
x3 = GET_SAMPLE((b), ((i) + 3));
|
||||
x4 = GET_SAMPLE((b), ((i) + 4));
|
||||
x2sq = x2 * x2;
|
||||
d = 2.0 * ((x2sq) - (x1 * x3));
|
||||
PSI_Xn = ((x2sq) - (x0 * x4));
|
||||
NEEDED = ((x1 * x1) - (x0 * x2)) + ((x3 * x3) - (x2 * x4));
|
||||
n = ((x2sq) - (x0 * x4)) - NEEDED;
|
||||
PSI_Yn = NEEDED + PSI_Xn;
|
||||
|
||||
/* instead of
|
||||
#ifdef FASTMATH
|
||||
result = 0.5 * (double)fast_acosf((float)n/d);
|
||||
result = 0.5 * (double)fast_acosf((float)n/d);
|
||||
#else
|
||||
result = 0.5 * acos(n/d);
|
||||
result = 0.5 * acos(n/d);
|
||||
#endif
|
||||
we do simplified, modified for speed version : */
|
||||
|
||||
result = n/d;
|
||||
/* if (ISINF(result)) {
|
||||
*amplitude = 0.0;
|
||||
if (n < 0.0) {
|
||||
return -10.0;
|
||||
} else {
|
||||
return 10.0;
|
||||
}
|
||||
}*/
|
||||
*amplitude = 2.0 * PSI_Xn / sqrt(PSI_Yn);
|
||||
return result;
|
||||
result = n/d;
|
||||
/* if (ISINF(result)) {
|
||||
*amplitude = 0.0;
|
||||
if (n < 0.0) {
|
||||
return -10.0;
|
||||
} else {
|
||||
return 10.0;
|
||||
}
|
||||
}*/
|
||||
*amplitude = 2.0 * PSI_Xn / sqrt(PSI_Yn);
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Piotr Gregor <piotrgregor@rsyncme.org>
|
||||
* Piotr Gregor <piotrgregor@rsyncme.org>
|
||||
*
|
||||
* @date 20 Mar 2016
|
||||
*/
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* Contributor(s):
|
||||
*
|
||||
* Eric des Courtis <eric.des.courtis@benbria.com>
|
||||
* Piotr Gregor <piotrgregor@rsyncme.org>
|
||||
* Piotr Gregor <piotrgregor@rsyncme.org>
|
||||
*/
|
||||
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
#ifndef _MSC_VER
|
||||
#include <stdint.h>
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
@ -22,7 +22,7 @@
|
|||
#include <fcntl.h>
|
||||
|
||||
#ifndef _MSC_VER
|
||||
#include <sys/mman.h>
|
||||
#include <sys/mman.h>
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
|
@ -31,7 +31,7 @@
|
|||
#include <string.h>
|
||||
|
||||
#ifndef _MSC_VER
|
||||
#include <unistd.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "avmd_fast_acosf.h"
|
||||
|
@ -39,8 +39,8 @@
|
|||
|
||||
|
||||
typedef union {
|
||||
uint32_t i;
|
||||
float f;
|
||||
uint32_t i;
|
||||
float f;
|
||||
} float_conv_t;
|
||||
|
||||
/*
|
||||
|
@ -58,14 +58,14 @@ typedef union {
|
|||
#define ACOS_TABLE_CONST_EXPONENT_BITS (3)
|
||||
#define ACOS_TABLE_DISCARDED_BITS (3)
|
||||
/* rosolution:
|
||||
3: 15 728 640 indices spreading range [0.0, 1.0], table size on disk 134 217 728 bytes (default)
|
||||
4: 7 364 320 indices spreading range [0.0, 1.0], table size on disk 67 108 864 bytes
|
||||
5: 3 932 160 indices spreading range [0.0, 1.0], table size on disk 33 554 432 bytes
|
||||
12: 30 720 indices spreading range [0.0, 1.0], table size on disk 262 144 bytes
|
||||
16: 1 920 indices spreading range [0.0, 1.0], table size on disk 16 384 bytes
|
||||
20: 120 indices spreading range [0.0, 1.0], table size on disk 1 024 bytes
|
||||
24: 7 indices spreading range [0.0, 1.0], table size on disk 64 bytes
|
||||
26: 1 indices spreading range [0.0, 1.0], table size on disk 16 bytes
|
||||
3: 15 728 640 indices spreading range [0.0, 1.0], table size on disk 134 217 728 bytes (default)
|
||||
4: 7 364 320 indices spreading range [0.0, 1.0], table size on disk 67 108 864 bytes
|
||||
5: 3 932 160 indices spreading range [0.0, 1.0], table size on disk 33 554 432 bytes
|
||||
12: 30 720 indices spreading range [0.0, 1.0], table size on disk 262 144 bytes
|
||||
16: 1 920 indices spreading range [0.0, 1.0], table size on disk 16 384 bytes
|
||||
20: 120 indices spreading range [0.0, 1.0], table size on disk 1 024 bytes
|
||||
24: 7 indices spreading range [0.0, 1.0], table size on disk 64 bytes
|
||||
26: 1 indices spreading range [0.0, 1.0], table size on disk 16 bytes
|
||||
*/
|
||||
#define ACOS_TABLE_FREE_EXPONENT_BITS (7 - ACOS_TABLE_CONST_EXPONENT_BITS)
|
||||
#define ACOS_TABLE_DATA_BITS (31 - ACOS_TABLE_CONST_EXPONENT_BITS - ACOS_TABLE_DISCARDED_BITS)
|
||||
|
@ -73,7 +73,7 @@ typedef union {
|
|||
|
||||
#define VARIA_DATA_MASK (0x87FFFFFF & ~((1 << ACOS_TABLE_DISCARDED_BITS) - 1))
|
||||
#define CONST_DATA_MASK (((1 << ACOS_TABLE_CONST_EXPONENT_BITS) - 1) \
|
||||
<< (ACOS_TABLE_DATA_BITS - 1 + ACOS_TABLE_DISCARDED_BITS))
|
||||
<< (ACOS_TABLE_DATA_BITS - 1 + ACOS_TABLE_DISCARDED_BITS))
|
||||
|
||||
#define SIGN_UNPACK_MASK (1 << (ACOS_TABLE_DATA_BITS - 1))
|
||||
#define DATA_UNPACK_MASK ((1 << (ACOS_TABLE_DATA_BITS - 1)) - 1)
|
||||
|
@ -105,107 +105,107 @@ dump_table_summary(void);
|
|||
|
||||
extern int compute_table(void)
|
||||
{
|
||||
uint32_t i;
|
||||
float f;
|
||||
FILE *acos_table_file;
|
||||
size_t res;
|
||||
uint32_t i;
|
||||
float f;
|
||||
FILE *acos_table_file;
|
||||
size_t res;
|
||||
|
||||
acos_table_file = fopen(ACOS_TABLE_FILENAME, "w");
|
||||
acos_table_file = fopen(ACOS_TABLE_FILENAME, "w");
|
||||
|
||||
for (i = 0; i < ACOS_TABLE_LENGTH; i++) {
|
||||
f = acosf(float_from_index(i));
|
||||
res = fwrite(&f, sizeof(f), 1, acos_table_file);
|
||||
if (res != 1) {
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < ACOS_TABLE_LENGTH; i++) {
|
||||
f = acosf(float_from_index(i));
|
||||
res = fwrite(&f, sizeof(f), 1, acos_table_file);
|
||||
if (res != 1) {
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
||||
res = fclose(acos_table_file);
|
||||
if (res != 0) {
|
||||
return -2;
|
||||
}
|
||||
return 0;
|
||||
res = fclose(acos_table_file);
|
||||
if (res != 0) {
|
||||
return -2;
|
||||
}
|
||||
return 0;
|
||||
|
||||
fail:
|
||||
fclose(acos_table_file);
|
||||
return -1;
|
||||
fclose(acos_table_file);
|
||||
return -1;
|
||||
}
|
||||
|
||||
extern int init_fast_acosf(void)
|
||||
{
|
||||
int ret, errsv;
|
||||
FILE *acos_fp;
|
||||
char err[150];
|
||||
int ret, errsv;
|
||||
FILE *acos_fp;
|
||||
char err[150];
|
||||
|
||||
if (acos_table == NULL) {
|
||||
ret = access(ACOS_TABLE_FILENAME, F_OK);
|
||||
if (ret == -1) {
|
||||
/* file doesn't exist, bad permissions,
|
||||
* or some other error occured */
|
||||
errsv = errno;
|
||||
strerror_r(errsv, err, 150);
|
||||
if (errsv != ENOENT) return -1;
|
||||
else {
|
||||
switch_log_printf(
|
||||
SWITCH_CHANNEL_LOG,
|
||||
SWITCH_LOG_NOTICE,
|
||||
"File [%s] doesn't exist. Creating file...\n", ACOS_TABLE_FILENAME
|
||||
);
|
||||
ret = compute_table();
|
||||
if (ret != 0) return -2;
|
||||
}
|
||||
} else {
|
||||
switch_log_printf(
|
||||
SWITCH_CHANNEL_LOG,
|
||||
SWITCH_LOG_INFO,
|
||||
"Using previously created file [%s]\n", ACOS_TABLE_FILENAME
|
||||
);
|
||||
}
|
||||
}
|
||||
if (acos_table == NULL) {
|
||||
ret = access(ACOS_TABLE_FILENAME, F_OK);
|
||||
if (ret == -1) {
|
||||
/* file doesn't exist, bad permissions,
|
||||
* or some other error occured */
|
||||
errsv = errno;
|
||||
strerror_r(errsv, err, 150);
|
||||
if (errsv != ENOENT) return -1;
|
||||
else {
|
||||
switch_log_printf(
|
||||
SWITCH_CHANNEL_LOG,
|
||||
SWITCH_LOG_NOTICE,
|
||||
"File [%s] doesn't exist. Creating file...\n", ACOS_TABLE_FILENAME
|
||||
);
|
||||
ret = compute_table();
|
||||
if (ret != 0) return -2;
|
||||
}
|
||||
} else {
|
||||
switch_log_printf(
|
||||
SWITCH_CHANNEL_LOG,
|
||||
SWITCH_LOG_INFO,
|
||||
"Using previously created file [%s]\n", ACOS_TABLE_FILENAME
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
acos_fp = fopen(ACOS_TABLE_FILENAME, "r");
|
||||
if (acos_fp == NULL) return -3;
|
||||
/* can't fail */
|
||||
acos_fd = fileno(acos_fp);
|
||||
acos_table = (float *) mmap(
|
||||
NULL, /* kernel chooses the address at which to create the mapping */
|
||||
ACOS_TABLE_LENGTH * sizeof(float), PROT_READ, MAP_SHARED, acos_fd, 0);
|
||||
if (acos_table == MAP_FAILED) return -4;
|
||||
acos_fp = fopen(ACOS_TABLE_FILENAME, "r");
|
||||
if (acos_fp == NULL) return -3;
|
||||
/* can't fail */
|
||||
acos_fd = fileno(acos_fp);
|
||||
acos_table = (float *) mmap(
|
||||
NULL, /* kernel chooses the address at which to create the mapping */
|
||||
ACOS_TABLE_LENGTH * sizeof(float), PROT_READ, MAP_SHARED, acos_fd, 0);
|
||||
if (acos_table == MAP_FAILED) return -4;
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern int destroy_fast_acosf(void)
|
||||
{
|
||||
if (munmap(acos_table, ACOS_TABLE_LENGTH) == -1) return -1;
|
||||
if (acos_fd != -1) {
|
||||
if (close(acos_fd) == -1) return -2;
|
||||
}
|
||||
/* disable use of fast arc cosine file */
|
||||
acos_table = NULL;
|
||||
if (munmap(acos_table, ACOS_TABLE_LENGTH) == -1) return -1;
|
||||
if (acos_fd != -1) {
|
||||
if (close(acos_fd) == -1) return -2;
|
||||
}
|
||||
/* disable use of fast arc cosine file */
|
||||
acos_table = NULL;
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern float fast_acosf(float x)
|
||||
{
|
||||
return acos_table[index_from_float(x)];
|
||||
return acos_table[index_from_float(x)];
|
||||
}
|
||||
|
||||
static uint32_t index_from_float(float f)
|
||||
{
|
||||
float_conv_t d;
|
||||
d.f = f;
|
||||
return ((d.i & SIGN_MASK) >> (32 - ACOS_TABLE_DATA_BITS)) |
|
||||
((d.i & DATA_MASK) >> ACOS_TABLE_DISCARDED_BITS);
|
||||
float_conv_t d;
|
||||
d.f = f;
|
||||
return ((d.i & SIGN_MASK) >> (32 - ACOS_TABLE_DATA_BITS)) |
|
||||
((d.i & DATA_MASK) >> ACOS_TABLE_DISCARDED_BITS);
|
||||
}
|
||||
|
||||
static float float_from_index(uint32_t d)
|
||||
{
|
||||
float_conv_t f;
|
||||
f.i = ((d & SIGN_UNPACK_MASK) << (32 - ACOS_TABLE_DATA_BITS)) |
|
||||
((d & DATA_UNPACK_MASK) << ACOS_TABLE_DISCARDED_BITS) | CONST_DATA_MASK;
|
||||
return f.f;
|
||||
float_conv_t f;
|
||||
f.i = ((d & SIGN_UNPACK_MASK) << (32 - ACOS_TABLE_DATA_BITS)) |
|
||||
((d & DATA_UNPACK_MASK) << ACOS_TABLE_DISCARDED_BITS) | CONST_DATA_MASK;
|
||||
return f.f;
|
||||
}
|
||||
|
||||
#ifdef FAST_ACOSF_TESTING
|
||||
|
@ -216,111 +216,111 @@ static float float_from_index(uint32_t d)
|
|||
static void
|
||||
debug_print(void)
|
||||
{
|
||||
INF(ACOS_TABLE_CONST_EXPONENT);
|
||||
INF(ACOS_TABLE_CONST_EXPONENT_BITS);
|
||||
INF(ACOS_TABLE_FREE_EXPONENT_BITS);
|
||||
INF(ACOS_TABLE_DISCARDED_BITS);
|
||||
INF(ACOS_TABLE_DATA_BITS);
|
||||
INF(ACOS_TABLE_LENGTH);
|
||||
INFX(VARIA_DATA_MASK);
|
||||
INFX(CONST_DATA_MASK);
|
||||
INFX(SIGN_UNPACK_MASK);
|
||||
INFX(DATA_UNPACK_MASK);
|
||||
INFX(SIGN_MASK);
|
||||
INFX(DATA_MASK);
|
||||
INF(ACOS_TABLE_CONST_EXPONENT);
|
||||
INF(ACOS_TABLE_CONST_EXPONENT_BITS);
|
||||
INF(ACOS_TABLE_FREE_EXPONENT_BITS);
|
||||
INF(ACOS_TABLE_DISCARDED_BITS);
|
||||
INF(ACOS_TABLE_DATA_BITS);
|
||||
INF(ACOS_TABLE_LENGTH);
|
||||
INFX(VARIA_DATA_MASK);
|
||||
INFX(CONST_DATA_MASK);
|
||||
INFX(SIGN_UNPACK_MASK);
|
||||
INFX(DATA_UNPACK_MASK);
|
||||
INFX(SIGN_MASK);
|
||||
INFX(DATA_MASK);
|
||||
}
|
||||
|
||||
static void
|
||||
dump_table_summary(void)
|
||||
{
|
||||
uint32_t i, i_0, i_1, di;
|
||||
float f;
|
||||
uint32_t i, i_0, i_1, di;
|
||||
float f;
|
||||
|
||||
i = 1;
|
||||
i_0 = index_from_float(0.0);
|
||||
i_1 = index_from_float(1.0);
|
||||
di = (i_1 - i_0)/100;
|
||||
if (di == 0) di = 1;
|
||||
i = 1;
|
||||
i_0 = index_from_float(0.0);
|
||||
i_1 = index_from_float(1.0);
|
||||
di = (i_1 - i_0)/100;
|
||||
if (di == 0) di = 1;
|
||||
|
||||
for (; i < ACOS_TABLE_LENGTH; i += di )
|
||||
{
|
||||
f = float_from_index(i);
|
||||
printf("-01i[%.10u] : ffi[%f] fa[%f] acos[%f]\n",
|
||||
i, f, fast_acosf(f), acos(f));
|
||||
}
|
||||
for (; i < ACOS_TABLE_LENGTH; i += di )
|
||||
{
|
||||
f = float_from_index(i);
|
||||
printf("-01i[%.10u] : ffi[%f] fa[%f] acos[%f]\n",
|
||||
i, f, fast_acosf(f), acos(f));
|
||||
}
|
||||
|
||||
i = 1;
|
||||
for (; i < ACOS_TABLE_LENGTH; i = (i << 1))
|
||||
{
|
||||
f = fast_acosf(float_from_index(i));
|
||||
printf("--i[%.10u] : fa[%f] ffi[%f]\n",
|
||||
i, f, float_from_index(i));
|
||||
}
|
||||
i = 1;
|
||||
for (; i < ACOS_TABLE_LENGTH; i = (i << 1))
|
||||
{
|
||||
f = fast_acosf(float_from_index(i));
|
||||
printf("--i[%.10u] : fa[%f] ffi[%f]\n",
|
||||
i, f, float_from_index(i));
|
||||
}
|
||||
|
||||
f = 0.0;
|
||||
printf("i [%d] from float [%f]\n", index_from_float(f), f);
|
||||
f = 0.1;
|
||||
printf("i [%d] from float [%f]\n", index_from_float(f), f);
|
||||
f = 0.2;
|
||||
printf("i [%d] from float [%f]\n", index_from_float(f), f);
|
||||
f = 0.3;
|
||||
printf("i [%d] from float [%f]\n", index_from_float(f), f);
|
||||
f = 0.4;
|
||||
printf("i [%d] from float [%f]\n", index_from_float(f), f);
|
||||
f = 0.5;
|
||||
printf("i [%d] from float [%f]\n", index_from_float(f), f);
|
||||
f = 0.6;
|
||||
printf("i [%d] from float [%f]\n", index_from_float(f), f);
|
||||
f = 0.7;
|
||||
printf("i [%d] from float [%f]\n", index_from_float(f), f);
|
||||
f = 7.5;
|
||||
printf("i [%d] from float [%f]\n", index_from_float(f), f);
|
||||
f = 0.8;
|
||||
printf("i [%d] from float [%f]\n", index_from_float(f), f);
|
||||
f = 0.9;
|
||||
printf("i [%d] from float [%f]\n", index_from_float(f), f);
|
||||
f = 0.95;
|
||||
printf("i [%d] from float [%f]\n", index_from_float(f), f);
|
||||
f = 0.99;
|
||||
printf("i [%d] from float [%f]\n", index_from_float(f), f);
|
||||
f = 1.0;
|
||||
printf("i [%d] from float [%f]\n", index_from_float(f), f);
|
||||
f = 1.1;
|
||||
printf("i [%d] from float [%f]\n", index_from_float(f), f);
|
||||
f = 1.2;
|
||||
printf("i [%d] from float [%f]\n", index_from_float(f), f);
|
||||
f = 0.0;
|
||||
printf("i [%d] from float [%f]\n", index_from_float(f), f);
|
||||
f = -0.1;
|
||||
printf("i [%d] from float [%f]\n", index_from_float(f), f);
|
||||
f = -0.2;
|
||||
printf("i [%d] from float [%f]\n", index_from_float(f), f);
|
||||
f = -0.3;
|
||||
printf("i [%d] from float [%f]\n", index_from_float(f), f);
|
||||
f = -0.4;
|
||||
printf("i [%d] from float [%f]\n", index_from_float(f), f);
|
||||
f = -0.5;
|
||||
printf("i [%d] from float [%f]\n", index_from_float(f), f);
|
||||
f = -0.6;
|
||||
printf("i [%d] from float [%f]\n", index_from_float(f), f);
|
||||
f = -0.7;
|
||||
printf("i [%d] from float [%f]\n", index_from_float(f), f);
|
||||
f = -7.5;
|
||||
printf("i [%d] from float [%f]\n", index_from_float(f), f);
|
||||
f = -0.8;
|
||||
printf("i [%d] from float [%f]\n", index_from_float(f), f);
|
||||
f = -0.9;
|
||||
printf("i [%d] from float [%f]\n", index_from_float(f), f);
|
||||
f = -0.95;
|
||||
printf("i [%d] from float [%f]\n", index_from_float(f), f);
|
||||
f = -0.99;
|
||||
printf("i [%d] from float [%f]\n", index_from_float(f), f);
|
||||
f = -1.0;
|
||||
printf("i [%d] from float [%f]\n", index_from_float(f), f);
|
||||
f = -1.1;
|
||||
printf("i [%d] from float [%f]\n", index_from_float(f), f);
|
||||
f = -1.2;
|
||||
printf("i [%d] from float [%f]\n", index_from_float(f), f);
|
||||
f = 0.0;
|
||||
printf("i [%d] from float [%f]\n", index_from_float(f), f);
|
||||
f = 0.1;
|
||||
printf("i [%d] from float [%f]\n", index_from_float(f), f);
|
||||
f = 0.2;
|
||||
printf("i [%d] from float [%f]\n", index_from_float(f), f);
|
||||
f = 0.3;
|
||||
printf("i [%d] from float [%f]\n", index_from_float(f), f);
|
||||
f = 0.4;
|
||||
printf("i [%d] from float [%f]\n", index_from_float(f), f);
|
||||
f = 0.5;
|
||||
printf("i [%d] from float [%f]\n", index_from_float(f), f);
|
||||
f = 0.6;
|
||||
printf("i [%d] from float [%f]\n", index_from_float(f), f);
|
||||
f = 0.7;
|
||||
printf("i [%d] from float [%f]\n", index_from_float(f), f);
|
||||
f = 7.5;
|
||||
printf("i [%d] from float [%f]\n", index_from_float(f), f);
|
||||
f = 0.8;
|
||||
printf("i [%d] from float [%f]\n", index_from_float(f), f);
|
||||
f = 0.9;
|
||||
printf("i [%d] from float [%f]\n", index_from_float(f), f);
|
||||
f = 0.95;
|
||||
printf("i [%d] from float [%f]\n", index_from_float(f), f);
|
||||
f = 0.99;
|
||||
printf("i [%d] from float [%f]\n", index_from_float(f), f);
|
||||
f = 1.0;
|
||||
printf("i [%d] from float [%f]\n", index_from_float(f), f);
|
||||
f = 1.1;
|
||||
printf("i [%d] from float [%f]\n", index_from_float(f), f);
|
||||
f = 1.2;
|
||||
printf("i [%d] from float [%f]\n", index_from_float(f), f);
|
||||
f = 0.0;
|
||||
printf("i [%d] from float [%f]\n", index_from_float(f), f);
|
||||
f = -0.1;
|
||||
printf("i [%d] from float [%f]\n", index_from_float(f), f);
|
||||
f = -0.2;
|
||||
printf("i [%d] from float [%f]\n", index_from_float(f), f);
|
||||
f = -0.3;
|
||||
printf("i [%d] from float [%f]\n", index_from_float(f), f);
|
||||
f = -0.4;
|
||||
printf("i [%d] from float [%f]\n", index_from_float(f), f);
|
||||
f = -0.5;
|
||||
printf("i [%d] from float [%f]\n", index_from_float(f), f);
|
||||
f = -0.6;
|
||||
printf("i [%d] from float [%f]\n", index_from_float(f), f);
|
||||
f = -0.7;
|
||||
printf("i [%d] from float [%f]\n", index_from_float(f), f);
|
||||
f = -7.5;
|
||||
printf("i [%d] from float [%f]\n", index_from_float(f), f);
|
||||
f = -0.8;
|
||||
printf("i [%d] from float [%f]\n", index_from_float(f), f);
|
||||
f = -0.9;
|
||||
printf("i [%d] from float [%f]\n", index_from_float(f), f);
|
||||
f = -0.95;
|
||||
printf("i [%d] from float [%f]\n", index_from_float(f), f);
|
||||
f = -0.99;
|
||||
printf("i [%d] from float [%f]\n", index_from_float(f), f);
|
||||
f = -1.0;
|
||||
printf("i [%d] from float [%f]\n", index_from_float(f), f);
|
||||
f = -1.1;
|
||||
printf("i [%d] from float [%f]\n", index_from_float(f), f);
|
||||
f = -1.2;
|
||||
printf("i [%d] from float [%f]\n", index_from_float(f), f);
|
||||
}
|
||||
|
||||
#endif /* FAST_ACOSF_TESTING */
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* Contributor(s):
|
||||
*
|
||||
* Eric des Courtis <eric.des.courtis@benbria.com>
|
||||
* Piotr Gregor <piotrgregor@rsyncme.org>
|
||||
* Piotr Gregor <piotrgregor@rsyncme.org>
|
||||
*/
|
||||
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue