mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-06-28 04:02:37 +00:00
Merge branch 'master' into v1.8
This commit is contained in:
commit
9c167578b3
2
.gitignore
vendored
2
.gitignore
vendored
@ -155,6 +155,8 @@ Release/
|
|||||||
/src/mod/applications/mod_osp/Makefile.in
|
/src/mod/applications/mod_osp/Makefile.in
|
||||||
/src/mod/applications/mod_rss/Makefile
|
/src/mod/applications/mod_rss/Makefile
|
||||||
/src/mod/applications/mod_snipe_hunt/Makefile
|
/src/mod/applications/mod_snipe_hunt/Makefile
|
||||||
|
/src/mod/applications/mod_test/test/Makefile
|
||||||
|
/src/mod/applications/mod_test/test/Makefile.in
|
||||||
/src/mod/codecs/mod_com_g729/Makefile
|
/src/mod/codecs/mod_com_g729/Makefile
|
||||||
/src/mod/codecs/mod_com_g729/Makefile.in
|
/src/mod/codecs/mod_com_g729/Makefile.in
|
||||||
/src/mod/codecs/mod_dahdi_codec/Makefile
|
/src/mod/codecs/mod_dahdi_codec/Makefile
|
||||||
|
5647
Freeswitch.2017.sln
5647
Freeswitch.2017.sln
File diff suppressed because it is too large
Load Diff
23
Makefile.am
23
Makefile.am
@ -1,5 +1,5 @@
|
|||||||
EXTRA_DIST =
|
EXTRA_DIST =
|
||||||
SUBDIRS = . src build
|
SUBDIRS = . src build tests/unit
|
||||||
AUTOMAKE_OPTIONS = foreign subdir-objects
|
AUTOMAKE_OPTIONS = foreign subdir-objects
|
||||||
NAME = freeswitch
|
NAME = freeswitch
|
||||||
|
|
||||||
@ -271,6 +271,11 @@ CORE_LIBS += libs/libzrtp/libzrtp.a
|
|||||||
LIBS += libs/libzrtp/third_party/bnlib/libbn.a
|
LIBS += libs/libzrtp/third_party/bnlib/libbn.a
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
library_includetestdir = $(includedir)/test
|
||||||
|
library_includetest_HEADERS = \
|
||||||
|
src/include/test/switch_fct.h \
|
||||||
|
src/include/test/switch_test.h
|
||||||
|
|
||||||
library_includedir = $(includedir)
|
library_includedir = $(includedir)
|
||||||
library_include_HEADERS = \
|
library_include_HEADERS = \
|
||||||
src/include/switch_am_config.h \
|
src/include/switch_am_config.h \
|
||||||
@ -693,6 +698,9 @@ nodepends: .nodepends
|
|||||||
yesdepends:
|
yesdepends:
|
||||||
rm .nodepends
|
rm .nodepends
|
||||||
|
|
||||||
|
iksemel-dep:
|
||||||
|
make -C src/mod/endpoints/mod_dingaling deps
|
||||||
|
|
||||||
core: $(switch_builddir)/modules.conf src/include/switch_version.h $(CORE_LIBS)
|
core: $(switch_builddir)/modules.conf src/include/switch_version.h $(CORE_LIBS)
|
||||||
$(MAKE) $(AM_MAKEFLAGS) libfreeswitch.la
|
$(MAKE) $(AM_MAKEFLAGS) libfreeswitch.la
|
||||||
|
|
||||||
@ -857,16 +865,3 @@ support:
|
|||||||
@cp support-d/.bashrc ~
|
@cp support-d/.bashrc ~
|
||||||
@test -f ~/.cc-mode-installed || sh support-d/install-cc-mode.sh && touch ~/.cc-mode-installed
|
@test -f ~/.cc-mode-installed || sh support-d/install-cc-mode.sh && touch ~/.cc-mode-installed
|
||||||
|
|
||||||
# Using a non-recursive Makefile structure for the automated tests so that the tests have visibility into
|
|
||||||
# targets in the rest of the FreeSWITCH tree. This greatly simplifies dependency tracking at the expense
|
|
||||||
# of longer test target names. Since the tests are expected to be run easily and rapidly after minor source
|
|
||||||
# changes this is the most effective structure.
|
|
||||||
|
|
||||||
check_PROGRAMS =
|
|
||||||
|
|
||||||
include tests/unit/unit.mk
|
|
||||||
|
|
||||||
TESTS = $(check_PROGRAMS)
|
|
||||||
|
|
||||||
tests: $(check_PROGRAMS)
|
|
||||||
|
|
||||||
|
@ -39,6 +39,7 @@ applications/mod_httapi
|
|||||||
#applications/mod_rad_auth
|
#applications/mod_rad_auth
|
||||||
#applications/mod_redis
|
#applications/mod_redis
|
||||||
#applications/mod_rss
|
#applications/mod_rss
|
||||||
|
applications/mod_signalwire
|
||||||
applications/mod_sms
|
applications/mod_sms
|
||||||
#applications/mod_sms_flowroute
|
#applications/mod_sms_flowroute
|
||||||
#applications/mod_snapshot
|
#applications/mod_snapshot
|
||||||
|
@ -38,6 +38,7 @@ applications/mod_prefix
|
|||||||
#applications/mod_rad_auth
|
#applications/mod_rad_auth
|
||||||
applications/mod_redis
|
applications/mod_redis
|
||||||
applications/mod_rss
|
applications/mod_rss
|
||||||
|
applications/mod_signalwire
|
||||||
applications/mod_sms
|
applications/mod_sms
|
||||||
applications/mod_snapshot
|
applications/mod_snapshot
|
||||||
applications/mod_snom
|
applications/mod_snom
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
<!-- <load module="mod_freetdm"/> -->
|
<!-- <load module="mod_freetdm"/> -->
|
||||||
|
|
||||||
<!-- Applications -->
|
<!-- Applications -->
|
||||||
|
<!--load module="mod_signalwire"/-->
|
||||||
<load module="mod_commands"/>
|
<load module="mod_commands"/>
|
||||||
<load module="mod_conference"/>
|
<load module="mod_conference"/>
|
||||||
<load module="mod_dptools"/>
|
<load module="mod_dptools"/>
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
<load module="mod_loopback"/>
|
<load module="mod_loopback"/>
|
||||||
|
|
||||||
<!-- Applications -->
|
<!-- Applications -->
|
||||||
|
<!--load module="mod_signalwire"/-->
|
||||||
<load module="mod_commands"/>
|
<load module="mod_commands"/>
|
||||||
<load module="mod_conference"/>
|
<load module="mod_conference"/>
|
||||||
<load module="mod_db"/>
|
<load module="mod_db"/>
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
<load module="mod_loopback"/>
|
<load module="mod_loopback"/>
|
||||||
|
|
||||||
<!-- Applications -->
|
<!-- Applications -->
|
||||||
|
<!--load module="mod_signalwire"-->
|
||||||
<load module="mod_commands"/>
|
<load module="mod_commands"/>
|
||||||
<load module="mod_conference"/>
|
<load module="mod_conference"/>
|
||||||
<load module="mod_dptools"/>
|
<load module="mod_dptools"/>
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
<!-- <load module="mod_woomera"/> -->
|
<!-- <load module="mod_woomera"/> -->
|
||||||
|
|
||||||
<!-- Applications -->
|
<!-- Applications -->
|
||||||
|
<!--load module="mod_signalwire"/-->
|
||||||
<load module="mod_commands"/>
|
<load module="mod_commands"/>
|
||||||
<load module="mod_dptools"/>
|
<load module="mod_dptools"/>
|
||||||
<load module="mod_expr"/>
|
<load module="mod_expr"/>
|
||||||
|
@ -89,6 +89,7 @@
|
|||||||
<load module="mod_sndfile"/>
|
<load module="mod_sndfile"/>
|
||||||
<load module="mod_tone_stream"/>
|
<load module="mod_tone_stream"/>
|
||||||
<load module="mod_local_stream"/>
|
<load module="mod_local_stream"/>
|
||||||
|
<!--load module="mod_signalwire"/-->
|
||||||
</modules>
|
</modules>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
<!-- <param name="key-frame-min-freq" value="250"/> -->
|
<!-- <param name="key-frame-min-freq" value="250"/> -->
|
||||||
|
|
||||||
<!-- integer of cpus, or 'auto', or 'cpu/<divisor>/<max> -->
|
<!-- integer of cpus, or 'auto', or 'cpu/<divisor>/<max> -->
|
||||||
<param name="dec-threads" value="cpu/2/4"/>
|
<param name="dec-threads" value="1"/>
|
||||||
<param name="enc-threads" value="cpu/2/4"/>
|
<param name="enc-threads" value="cpu/2/4"/>
|
||||||
<param name="h263-profile" value="H263"/>
|
<param name="h263-profile" value="H263"/>
|
||||||
<param name="h263+-profile" value="H263+"/>
|
<param name="h263+-profile" value="H263+"/>
|
||||||
|
5
conf/vanilla/autoload_configs/curl.conf.xml
Normal file
5
conf/vanilla/autoload_configs/curl.conf.xml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<configuration name="curl.conf" description="cURL module">
|
||||||
|
<settings>
|
||||||
|
<param name="max-bytes" value="64000"/>
|
||||||
|
</settings>
|
||||||
|
</configuration>
|
@ -50,6 +50,7 @@
|
|||||||
<load module="mod_verto"/>
|
<load module="mod_verto"/>
|
||||||
|
|
||||||
<!-- Applications -->
|
<!-- Applications -->
|
||||||
|
<load module="mod_signalwire"/>
|
||||||
<load module="mod_commands"/>
|
<load module="mod_commands"/>
|
||||||
<load module="mod_conference"/>
|
<load module="mod_conference"/>
|
||||||
<!-- <load module="mod_curl"/> -->
|
<!-- <load module="mod_curl"/> -->
|
||||||
|
16
configure.ac
16
configure.ac
@ -595,7 +595,7 @@ AC_SUBST(SYS_XMLRPC_CFLAGS)
|
|||||||
AC_SUBST(SYS_XMLRPC_LDFLAGS)
|
AC_SUBST(SYS_XMLRPC_LDFLAGS)
|
||||||
AM_CONDITIONAL([SYSTEM_XMLRPCC],[test "${enable_xmlrpcc}" = "yes"])
|
AM_CONDITIONAL([SYSTEM_XMLRPCC],[test "${enable_xmlrpcc}" = "yes"])
|
||||||
|
|
||||||
for luaversion in lua5.2 lua-5.2 lua52 lua5.1 lua-5.1 lua; do
|
for luaversion in luajit lua5.2 lua-5.2 lua52 lua5.1 lua-5.1 lua; do
|
||||||
PKG_CHECK_MODULES([LUA],[${luaversion}],[have_lua=yes],[have_lua=no])
|
PKG_CHECK_MODULES([LUA],[${luaversion}],[have_lua=yes],[have_lua=no])
|
||||||
if test ${have_lua} = yes; then
|
if test ${have_lua} = yes; then
|
||||||
break
|
break
|
||||||
@ -1498,6 +1498,14 @@ 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])])
|
||||||
|
|
||||||
|
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])])
|
||||||
|
|
||||||
PKG_CHECK_MODULES([AMQP], [librabbitmq >= 0.5.2],[
|
PKG_CHECK_MODULES([AMQP], [librabbitmq >= 0.5.2],[
|
||||||
AM_CONDITIONAL([HAVE_AMQP],[true])],[
|
AM_CONDITIONAL([HAVE_AMQP],[true])],[
|
||||||
AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_AMQP],[false])])
|
AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_AMQP],[false])])
|
||||||
@ -1807,6 +1815,7 @@ ac_cv_file_dbd_apr_dbd_mysql_c=no
|
|||||||
|
|
||||||
AC_CONFIG_FILES([Makefile
|
AC_CONFIG_FILES([Makefile
|
||||||
build/Makefile
|
build/Makefile
|
||||||
|
tests/unit/Makefile
|
||||||
src/Makefile
|
src/Makefile
|
||||||
src/mod/Makefile
|
src/mod/Makefile
|
||||||
src/mod/applications/mod_abstraction/Makefile
|
src/mod/applications/mod_abstraction/Makefile
|
||||||
@ -1852,6 +1861,7 @@ AC_CONFIG_FILES([Makefile
|
|||||||
src/mod/applications/mod_redis/Makefile
|
src/mod/applications/mod_redis/Makefile
|
||||||
src/mod/applications/mod_rss/Makefile
|
src/mod/applications/mod_rss/Makefile
|
||||||
src/mod/applications/mod_skel/Makefile
|
src/mod/applications/mod_skel/Makefile
|
||||||
|
src/mod/applications/mod_signalwire/Makefile
|
||||||
src/mod/applications/mod_sms/Makefile
|
src/mod/applications/mod_sms/Makefile
|
||||||
src/mod/applications/mod_sms_flowroute/Makefile
|
src/mod/applications/mod_sms_flowroute/Makefile
|
||||||
src/mod/applications/mod_snapshot/Makefile
|
src/mod/applications/mod_snapshot/Makefile
|
||||||
@ -1861,6 +1871,8 @@ AC_CONFIG_FILES([Makefile
|
|||||||
src/mod/applications/mod_spandsp/Makefile
|
src/mod/applications/mod_spandsp/Makefile
|
||||||
src/mod/applications/mod_spy/Makefile
|
src/mod/applications/mod_spy/Makefile
|
||||||
src/mod/applications/mod_stress/Makefile
|
src/mod/applications/mod_stress/Makefile
|
||||||
|
src/mod/applications/mod_test/Makefile
|
||||||
|
src/mod/applications/mod_test/test/Makefile
|
||||||
src/mod/applications/mod_translate/Makefile
|
src/mod/applications/mod_translate/Makefile
|
||||||
src/mod/applications/mod_valet_parking/Makefile
|
src/mod/applications/mod_valet_parking/Makefile
|
||||||
src/mod/applications/mod_vmd/Makefile
|
src/mod/applications/mod_vmd/Makefile
|
||||||
@ -1927,6 +1939,7 @@ AC_CONFIG_FILES([Makefile
|
|||||||
src/mod/event_handlers/mod_radius_cdr/Makefile
|
src/mod/event_handlers/mod_radius_cdr/Makefile
|
||||||
src/mod/event_handlers/mod_odbc_cdr/Makefile
|
src/mod/event_handlers/mod_odbc_cdr/Makefile
|
||||||
src/mod/event_handlers/mod_rayo/Makefile
|
src/mod/event_handlers/mod_rayo/Makefile
|
||||||
|
src/mod/event_handlers/mod_rayo/test/Makefile
|
||||||
src/mod/event_handlers/mod_smpp/Makefile
|
src/mod/event_handlers/mod_smpp/Makefile
|
||||||
src/mod/event_handlers/mod_snmp/Makefile
|
src/mod/event_handlers/mod_snmp/Makefile
|
||||||
src/mod/event_handlers/mod_event_zmq/Makefile
|
src/mod/event_handlers/mod_event_zmq/Makefile
|
||||||
@ -1980,6 +1993,7 @@ AC_CONFIG_FILES([Makefile
|
|||||||
src/mod/xml_int/mod_xml_rpc/Makefile
|
src/mod/xml_int/mod_xml_rpc/Makefile
|
||||||
src/mod/xml_int/mod_xml_scgi/Makefile
|
src/mod/xml_int/mod_xml_scgi/Makefile
|
||||||
src/mod/applications/mod_av/Makefile
|
src/mod/applications/mod_av/Makefile
|
||||||
|
src/mod/applications/mod_av/test/Makefile
|
||||||
src/mod/applications/mod_video_filter/Makefile
|
src/mod/applications/mod_video_filter/Makefile
|
||||||
src/include/switch_am_config.h
|
src/include/switch_am_config.h
|
||||||
build/getsounds.sh
|
build/getsounds.sh
|
||||||
|
61
debian/bootstrap.sh
vendored
61
debian/bootstrap.sh
vendored
@ -343,7 +343,7 @@ EOF
|
|||||||
print_core_control () {
|
print_core_control () {
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
Package: freeswitch-all
|
Package: freeswitch-all
|
||||||
Architecture: any
|
Architecture: amd64
|
||||||
Depends: freeswitch-meta-all (= \${binary:Version}), freeswitch-meta-all-dbg (= \${binary:Version})
|
Depends: freeswitch-meta-all (= \${binary:Version}), freeswitch-meta-all-dbg (= \${binary:Version})
|
||||||
Conflicts: freeswitch-all (<= 1.6.7)
|
Conflicts: freeswitch-all (<= 1.6.7)
|
||||||
Description: Cross-Platform Scalable Multi-Protocol Soft Switch
|
Description: Cross-Platform Scalable Multi-Protocol Soft Switch
|
||||||
@ -352,7 +352,7 @@ Description: Cross-Platform Scalable Multi-Protocol Soft Switch
|
|||||||
This is a package which depends on all packaged FreeSWITCH modules.
|
This is a package which depends on all packaged FreeSWITCH modules.
|
||||||
|
|
||||||
Package: freeswitch
|
Package: freeswitch
|
||||||
Architecture: any
|
Architecture: amd64
|
||||||
Depends: \${shlibs:Depends}, \${perl:Depends}, \${misc:Depends},
|
Depends: \${shlibs:Depends}, \${perl:Depends}, \${misc:Depends},
|
||||||
libfreeswitch1 (= \${binary:Version})
|
libfreeswitch1 (= \${binary:Version})
|
||||||
Recommends:
|
Recommends:
|
||||||
@ -364,7 +364,7 @@ Description: Cross-Platform Scalable Multi-Protocol Soft Switch
|
|||||||
This package contains the FreeSWITCH core.
|
This package contains the FreeSWITCH core.
|
||||||
|
|
||||||
Package: libfreeswitch1
|
Package: libfreeswitch1
|
||||||
Architecture: any
|
Architecture: amd64
|
||||||
Depends: \${shlibs:Depends}, \${misc:Depends}
|
Depends: \${shlibs:Depends}, \${misc:Depends}
|
||||||
Recommends:
|
Recommends:
|
||||||
Suggests: libfreeswitch1-dbg
|
Suggests: libfreeswitch1-dbg
|
||||||
@ -376,7 +376,7 @@ Description: Cross-Platform Scalable Multi-Protocol Soft Switch
|
|||||||
|
|
||||||
Package: python-esl
|
Package: python-esl
|
||||||
Section: python
|
Section: python
|
||||||
Architecture: any
|
Architecture: amd64
|
||||||
Depends: \${shlibs:Depends}, \${misc:Depends}, \${python:Depends}
|
Depends: \${shlibs:Depends}, \${misc:Depends}, \${python:Depends}
|
||||||
Description: Cross-Platform Scalable Multi-Protocol Soft Switch
|
Description: Cross-Platform Scalable Multi-Protocol Soft Switch
|
||||||
$(debian_wrap "${fs_description}")
|
$(debian_wrap "${fs_description}")
|
||||||
@ -385,7 +385,7 @@ Description: Cross-Platform Scalable Multi-Protocol Soft Switch
|
|||||||
|
|
||||||
Package: libesl-perl
|
Package: libesl-perl
|
||||||
Section: perl
|
Section: perl
|
||||||
Architecture: any
|
Architecture: amd64
|
||||||
Depends: \${shlibs:Depends}, \${misc:Depends}, \${perl:Depends}
|
Depends: \${shlibs:Depends}, \${misc:Depends}, \${perl:Depends}
|
||||||
Description: Cross-Platform Scalable Multi-Protocol Soft Switch
|
Description: Cross-Platform Scalable Multi-Protocol Soft Switch
|
||||||
$(debian_wrap "${fs_description}")
|
$(debian_wrap "${fs_description}")
|
||||||
@ -393,7 +393,7 @@ Description: Cross-Platform Scalable Multi-Protocol Soft Switch
|
|||||||
This package contains the Perl binding for FreeSWITCH Event Socket Library (ESL).
|
This package contains the Perl binding for FreeSWITCH Event Socket Library (ESL).
|
||||||
|
|
||||||
Package: freeswitch-meta-bare
|
Package: freeswitch-meta-bare
|
||||||
Architecture: any
|
Architecture: amd64
|
||||||
Depends: \${misc:Depends}, freeswitch (= \${binary:Version})
|
Depends: \${misc:Depends}, freeswitch (= \${binary:Version})
|
||||||
Recommends:
|
Recommends:
|
||||||
freeswitch-doc (= \${binary:Version}),
|
freeswitch-doc (= \${binary:Version}),
|
||||||
@ -411,7 +411,7 @@ Description: Cross-Platform Scalable Multi-Protocol Soft Switch
|
|||||||
bare FreeSWITCH install.
|
bare FreeSWITCH install.
|
||||||
|
|
||||||
Package: freeswitch-meta-default
|
Package: freeswitch-meta-default
|
||||||
Architecture: any
|
Architecture: amd64
|
||||||
Depends: \${misc:Depends}, freeswitch (= \${binary:Version}),
|
Depends: \${misc:Depends}, freeswitch (= \${binary:Version}),
|
||||||
freeswitch-mod-commands (= \${binary:Version}),
|
freeswitch-mod-commands (= \${binary:Version}),
|
||||||
freeswitch-mod-conference (= \${binary:Version}),
|
freeswitch-mod-conference (= \${binary:Version}),
|
||||||
@ -452,7 +452,7 @@ Description: Cross-Platform Scalable Multi-Protocol Soft Switch
|
|||||||
reasonably basic FreeSWITCH install.
|
reasonably basic FreeSWITCH install.
|
||||||
|
|
||||||
Package: freeswitch-meta-vanilla
|
Package: freeswitch-meta-vanilla
|
||||||
Architecture: any
|
Architecture: amd64
|
||||||
Depends: \${misc:Depends}, freeswitch (= \${binary:Version}),
|
Depends: \${misc:Depends}, freeswitch (= \${binary:Version}),
|
||||||
freeswitch-init,
|
freeswitch-init,
|
||||||
freeswitch-mod-console (= \${binary:Version}),
|
freeswitch-mod-console (= \${binary:Version}),
|
||||||
@ -500,7 +500,7 @@ Description: Cross-Platform Scalable Multi-Protocol Soft Switch
|
|||||||
running the FreeSWITCH vanilla example configuration.
|
running the FreeSWITCH vanilla example configuration.
|
||||||
|
|
||||||
Package: freeswitch-meta-sorbet
|
Package: freeswitch-meta-sorbet
|
||||||
Architecture: any
|
Architecture: amd64
|
||||||
Depends: \${misc:Depends}, freeswitch (= \${binary:Version}),
|
Depends: \${misc:Depends}, freeswitch (= \${binary:Version}),
|
||||||
Recommends:
|
Recommends:
|
||||||
freeswitch-init,
|
freeswitch-init,
|
||||||
@ -582,7 +582,7 @@ Description: Cross-Platform Scalable Multi-Protocol Soft Switch
|
|||||||
modules except a few which aren't recommended.
|
modules except a few which aren't recommended.
|
||||||
|
|
||||||
Package: freeswitch-meta-all
|
Package: freeswitch-meta-all
|
||||||
Architecture: any
|
Architecture: amd64
|
||||||
Depends: \${misc:Depends}, freeswitch (= \${binary:Version}),
|
Depends: \${misc:Depends}, freeswitch (= \${binary:Version}),
|
||||||
freeswitch-init,
|
freeswitch-init,
|
||||||
freeswitch-lang (= \${binary:Version}),
|
freeswitch-lang (= \${binary:Version}),
|
||||||
@ -624,6 +624,7 @@ Depends: \${misc:Depends}, freeswitch (= \${binary:Version}),
|
|||||||
freeswitch-mod-png (= \${binary:Version}),
|
freeswitch-mod-png (= \${binary:Version}),
|
||||||
freeswitch-mod-redis (= \${binary:Version}),
|
freeswitch-mod-redis (= \${binary:Version}),
|
||||||
freeswitch-mod-rss (= \${binary:Version}),
|
freeswitch-mod-rss (= \${binary:Version}),
|
||||||
|
freeswitch-mod-shout (= \${binary:Version}),
|
||||||
freeswitch-mod-sms (= \${binary:Version}),
|
freeswitch-mod-sms (= \${binary:Version}),
|
||||||
freeswitch-mod-snapshot (= \${binary:Version}),
|
freeswitch-mod-snapshot (= \${binary:Version}),
|
||||||
freeswitch-mod-snom (= \${binary:Version}),
|
freeswitch-mod-snom (= \${binary:Version}),
|
||||||
@ -692,7 +693,7 @@ Description: Cross-Platform Scalable Multi-Protocol Soft Switch
|
|||||||
FreeSWITCH modules.
|
FreeSWITCH modules.
|
||||||
|
|
||||||
Package: freeswitch-meta-codecs
|
Package: freeswitch-meta-codecs
|
||||||
Architecture: any
|
Architecture: amd64
|
||||||
Depends: \${misc:Depends}, freeswitch (= \${binary:Version}),
|
Depends: \${misc:Depends}, freeswitch (= \${binary:Version}),
|
||||||
freeswitch-mod-amr (= \${binary:Version}),
|
freeswitch-mod-amr (= \${binary:Version}),
|
||||||
freeswitch-mod-amrwb (= \${binary:Version}),
|
freeswitch-mod-amrwb (= \${binary:Version}),
|
||||||
@ -719,7 +720,7 @@ Description: Cross-Platform Scalable Multi-Protocol Soft Switch
|
|||||||
most FreeSWITCH codecs.
|
most FreeSWITCH codecs.
|
||||||
|
|
||||||
Package: freeswitch-meta-codecs-dbg
|
Package: freeswitch-meta-codecs-dbg
|
||||||
Architecture: any
|
Architecture: amd64
|
||||||
Depends: \${misc:Depends}, freeswitch (= \${binary:Version}),
|
Depends: \${misc:Depends}, freeswitch (= \${binary:Version}),
|
||||||
freeswitch-mod-amr-dbg (= \${binary:Version}),
|
freeswitch-mod-amr-dbg (= \${binary:Version}),
|
||||||
freeswitch-mod-amrwb-dbg (= \${binary:Version}),
|
freeswitch-mod-amrwb-dbg (= \${binary:Version}),
|
||||||
@ -746,7 +747,7 @@ Description: Cross-Platform Scalable Multi-Protocol Soft Switch
|
|||||||
most FreeSWITCH codecs.
|
most FreeSWITCH codecs.
|
||||||
|
|
||||||
Package: freeswitch-meta-conf
|
Package: freeswitch-meta-conf
|
||||||
Architecture: all
|
Architecture: amd64
|
||||||
Depends: \${misc:Depends},
|
Depends: \${misc:Depends},
|
||||||
freeswitch-conf-curl (= \${binary:Version}),
|
freeswitch-conf-curl (= \${binary:Version}),
|
||||||
freeswitch-conf-insideout (= \${binary:Version}),
|
freeswitch-conf-insideout (= \${binary:Version}),
|
||||||
@ -760,7 +761,7 @@ Description: Cross-Platform Scalable Multi-Protocol Soft Switch
|
|||||||
examples for FreeSWITCH.
|
examples for FreeSWITCH.
|
||||||
|
|
||||||
Package: freeswitch-meta-lang
|
Package: freeswitch-meta-lang
|
||||||
Architecture: all
|
Architecture: amd64
|
||||||
Depends: \${misc:Depends},
|
Depends: \${misc:Depends},
|
||||||
freeswitch-lang-de (= \${binary:Version}),
|
freeswitch-lang-de (= \${binary:Version}),
|
||||||
freeswitch-lang-en (= \${binary:Version}),
|
freeswitch-lang-en (= \${binary:Version}),
|
||||||
@ -776,7 +777,7 @@ Description: Cross-Platform Scalable Multi-Protocol Soft Switch
|
|||||||
FreeSWITCH.
|
FreeSWITCH.
|
||||||
|
|
||||||
Package: freeswitch-meta-mod-say
|
Package: freeswitch-meta-mod-say
|
||||||
Architecture: any
|
Architecture: amd64
|
||||||
Depends: \${misc:Depends},
|
Depends: \${misc:Depends},
|
||||||
freeswitch-mod-say-de (= \${binary:Version}),
|
freeswitch-mod-say-de (= \${binary:Version}),
|
||||||
freeswitch-mod-say-en (= \${binary:Version}),
|
freeswitch-mod-say-en (= \${binary:Version}),
|
||||||
@ -801,7 +802,7 @@ Description: Cross-Platform Scalable Multi-Protocol Soft Switch
|
|||||||
FreeSWITCH.
|
FreeSWITCH.
|
||||||
|
|
||||||
Package: freeswitch-meta-mod-say-dbg
|
Package: freeswitch-meta-mod-say-dbg
|
||||||
Architecture: any
|
Architecture: amd64
|
||||||
Depends: \${misc:Depends},
|
Depends: \${misc:Depends},
|
||||||
freeswitch-mod-say-de-dbg (= \${binary:Version}),
|
freeswitch-mod-say-de-dbg (= \${binary:Version}),
|
||||||
freeswitch-mod-say-en-dbg (= \${binary:Version}),
|
freeswitch-mod-say-en-dbg (= \${binary:Version}),
|
||||||
@ -826,7 +827,7 @@ Description: Cross-Platform Scalable Multi-Protocol Soft Switch
|
|||||||
FreeSWITCH.
|
FreeSWITCH.
|
||||||
|
|
||||||
Package: freeswitch-meta-all-dbg
|
Package: freeswitch-meta-all-dbg
|
||||||
Architecture: any
|
Architecture: amd64
|
||||||
Depends: \${misc:Depends}, freeswitch (= \${binary:Version}),
|
Depends: \${misc:Depends}, freeswitch (= \${binary:Version}),
|
||||||
freeswitch-meta-codecs-dbg (= \${binary:Version}),
|
freeswitch-meta-codecs-dbg (= \${binary:Version}),
|
||||||
freeswitch-meta-mod-say (= \${binary:Version}),
|
freeswitch-meta-mod-say (= \${binary:Version}),
|
||||||
@ -931,7 +932,7 @@ Description: Cross-Platform Scalable Multi-Protocol Soft Switch
|
|||||||
Package: freeswitch-all-dbg
|
Package: freeswitch-all-dbg
|
||||||
Section: debug
|
Section: debug
|
||||||
Priority: extra
|
Priority: extra
|
||||||
Architecture: any
|
Architecture: amd64
|
||||||
Depends: \${misc:Depends}, freeswitch-meta-all (= \${binary:Version}), freeswitch-meta-all-dbg (= \${binary:Version})
|
Depends: \${misc:Depends}, freeswitch-meta-all (= \${binary:Version}), freeswitch-meta-all-dbg (= \${binary:Version})
|
||||||
Description: debugging symbols for FreeSWITCH
|
Description: debugging symbols for FreeSWITCH
|
||||||
$(debian_wrap "${fs_description}")
|
$(debian_wrap "${fs_description}")
|
||||||
@ -941,7 +942,7 @@ Description: debugging symbols for FreeSWITCH
|
|||||||
Package: freeswitch-dbg
|
Package: freeswitch-dbg
|
||||||
Section: debug
|
Section: debug
|
||||||
Priority: extra
|
Priority: extra
|
||||||
Architecture: any
|
Architecture: amd64
|
||||||
Depends: \${misc:Depends}, freeswitch (= \${binary:Version})
|
Depends: \${misc:Depends}, freeswitch (= \${binary:Version})
|
||||||
Description: debugging symbols for FreeSWITCH
|
Description: debugging symbols for FreeSWITCH
|
||||||
$(debian_wrap "${fs_description}")
|
$(debian_wrap "${fs_description}")
|
||||||
@ -951,7 +952,7 @@ Description: debugging symbols for FreeSWITCH
|
|||||||
Package: libfreeswitch1-dbg
|
Package: libfreeswitch1-dbg
|
||||||
Section: debug
|
Section: debug
|
||||||
Priority: extra
|
Priority: extra
|
||||||
Architecture: any
|
Architecture: amd64
|
||||||
Depends: \${misc:Depends}, libfreeswitch1 (= \${binary:Version})
|
Depends: \${misc:Depends}, libfreeswitch1 (= \${binary:Version})
|
||||||
Description: debugging symbols for FreeSWITCH
|
Description: debugging symbols for FreeSWITCH
|
||||||
$(debian_wrap "${fs_description}")
|
$(debian_wrap "${fs_description}")
|
||||||
@ -960,7 +961,7 @@ Description: debugging symbols for FreeSWITCH
|
|||||||
|
|
||||||
Package: libfreeswitch-dev
|
Package: libfreeswitch-dev
|
||||||
Section: libdevel
|
Section: libdevel
|
||||||
Architecture: any
|
Architecture: amd64
|
||||||
Depends: \${misc:Depends}, freeswitch
|
Depends: \${misc:Depends}, freeswitch
|
||||||
Description: development libraries and header files for FreeSWITCH
|
Description: development libraries and header files for FreeSWITCH
|
||||||
$(debian_wrap "${fs_description}")
|
$(debian_wrap "${fs_description}")
|
||||||
@ -969,7 +970,7 @@ Description: development libraries and header files for FreeSWITCH
|
|||||||
|
|
||||||
Package: freeswitch-doc
|
Package: freeswitch-doc
|
||||||
Section: doc
|
Section: doc
|
||||||
Architecture: all
|
Architecture: amd64
|
||||||
Depends: \${misc:Depends}
|
Depends: \${misc:Depends}
|
||||||
Description: documentation for FreeSWITCH
|
Description: documentation for FreeSWITCH
|
||||||
$(debian_wrap "${fs_description}")
|
$(debian_wrap "${fs_description}")
|
||||||
@ -982,7 +983,7 @@ Description: documentation for FreeSWITCH
|
|||||||
## languages
|
## languages
|
||||||
|
|
||||||
Package: freeswitch-lang
|
Package: freeswitch-lang
|
||||||
Architecture: all
|
Architecture: amd64
|
||||||
Depends: \${misc:Depends},
|
Depends: \${misc:Depends},
|
||||||
freeswitch-lang-en (= \${binary:Version})
|
freeswitch-lang-en (= \${binary:Version})
|
||||||
Description: Language files for FreeSWITCH
|
Description: Language files for FreeSWITCH
|
||||||
@ -994,7 +995,7 @@ Description: Language files for FreeSWITCH
|
|||||||
## timezones
|
## timezones
|
||||||
|
|
||||||
Package: freeswitch-timezones
|
Package: freeswitch-timezones
|
||||||
Architecture: all
|
Architecture: amd64
|
||||||
Depends: \${misc:Depends}
|
Depends: \${misc:Depends}
|
||||||
Description: Timezone files for FreeSWITCH
|
Description: Timezone files for FreeSWITCH
|
||||||
$(debian_wrap "${fs_description}")
|
$(debian_wrap "${fs_description}")
|
||||||
@ -1008,7 +1009,7 @@ EOF
|
|||||||
if [ ${use_sysvinit} = "true" ]; then
|
if [ ${use_sysvinit} = "true" ]; then
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
Package: freeswitch-sysvinit
|
Package: freeswitch-sysvinit
|
||||||
Architecture: all
|
Architecture: amd64
|
||||||
Depends: \${misc:Depends}, lsb-base (>= 3.0-6), sysvinit | sysvinit-utils
|
Depends: \${misc:Depends}, lsb-base (>= 3.0-6), sysvinit | sysvinit-utils
|
||||||
Conflicts: freeswitch-init
|
Conflicts: freeswitch-init
|
||||||
Provides: freeswitch-init
|
Provides: freeswitch-init
|
||||||
@ -1021,7 +1022,7 @@ EOF
|
|||||||
else
|
else
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
Package: freeswitch-systemd
|
Package: freeswitch-systemd
|
||||||
Architecture: all
|
Architecture: amd64
|
||||||
Depends: \${misc:Depends}, systemd
|
Depends: \${misc:Depends}, systemd
|
||||||
Conflicts: freeswitch-init, freeswitch-all (<= 1.6.7)
|
Conflicts: freeswitch-init, freeswitch-all (<= 1.6.7)
|
||||||
Provides: freeswitch-init
|
Provides: freeswitch-init
|
||||||
@ -1039,7 +1040,7 @@ print_mod_control () {
|
|||||||
cat <<EOF
|
cat <<EOF
|
||||||
Package: freeswitch-${module_name//_/-}
|
Package: freeswitch-${module_name//_/-}
|
||||||
Section: ${m_section}
|
Section: ${m_section}
|
||||||
Architecture: any
|
Architecture: amd64
|
||||||
$(debian_wrap "Depends: \${shlibs:Depends}, \${misc:Depends}, libfreeswitch1 (= \${binary:Version}), ${depends}")
|
$(debian_wrap "Depends: \${shlibs:Depends}, \${misc:Depends}, libfreeswitch1 (= \${binary:Version}), ${depends}")
|
||||||
$(debian_wrap "Recommends: ${recommends}")
|
$(debian_wrap "Recommends: ${recommends}")
|
||||||
$(debian_wrap "Suggests: freeswitch-${module_name//_/-}-dbg, ${suggests}")
|
$(debian_wrap "Suggests: freeswitch-${module_name//_/-}-dbg, ${suggests}")
|
||||||
@ -1054,7 +1055,7 @@ Description: ${description} for FreeSWITCH
|
|||||||
Package: freeswitch-${module_name//_/-}-dbg
|
Package: freeswitch-${module_name//_/-}-dbg
|
||||||
Section: debug
|
Section: debug
|
||||||
Priority: extra
|
Priority: extra
|
||||||
Architecture: any
|
Architecture: amd64
|
||||||
Depends: \${misc:Depends},
|
Depends: \${misc:Depends},
|
||||||
freeswitch-${module_name//_/-} (= \${binary:Version})
|
freeswitch-${module_name//_/-} (= \${binary:Version})
|
||||||
Description: ${description} for FreeSWITCH (debug)
|
Description: ${description} for FreeSWITCH (debug)
|
||||||
@ -1119,7 +1120,7 @@ print_conf_overrides () {
|
|||||||
print_conf_control () {
|
print_conf_control () {
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
Package: freeswitch-conf-${conf//_/-}
|
Package: freeswitch-conf-${conf//_/-}
|
||||||
Architecture: all
|
Architecture: amd64
|
||||||
Depends: \${misc:Depends}
|
Depends: \${misc:Depends}
|
||||||
Conflicts: freeswitch-all (<= 1.6.7)
|
Conflicts: freeswitch-all (<= 1.6.7)
|
||||||
Description: FreeSWITCH ${conf} configuration
|
Description: FreeSWITCH ${conf} configuration
|
||||||
@ -1153,7 +1154,7 @@ print_lang_control () {
|
|||||||
esac
|
esac
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
Package: freeswitch-lang-${lang//_/-}
|
Package: freeswitch-lang-${lang//_/-}
|
||||||
Architecture: all
|
Architecture: amd64
|
||||||
Depends: \${misc:Depends}
|
Depends: \${misc:Depends}
|
||||||
Recommends: freeswitch-sounds-${lang}
|
Recommends: freeswitch-sounds-${lang}
|
||||||
Conflicts: freeswitch-all (<= 1.6.7)
|
Conflicts: freeswitch-all (<= 1.6.7)
|
||||||
|
7
debian/control-modules
vendored
7
debian/control-modules
vendored
@ -117,7 +117,7 @@ Module: applications/mod_hiredis
|
|||||||
Description: Redis client support
|
Description: Redis client support
|
||||||
This module provides a mechanism to use Redis as a datastore.
|
This module provides a mechanism to use Redis as a datastore.
|
||||||
Build-Depends: libhiredis-dev
|
Build-Depends: libhiredis-dev
|
||||||
Depends: libhiredis0.10
|
Depends: libhiredis0.10 | libhiredis0.13
|
||||||
|
|
||||||
Module: applications/mod_httapi
|
Module: applications/mod_httapi
|
||||||
Description: HT-TAPI Hypertext Telephony API
|
Description: HT-TAPI Hypertext Telephony API
|
||||||
@ -206,6 +206,11 @@ Module: applications/mod_skel
|
|||||||
Description: Adds mod_skel
|
Description: Adds mod_skel
|
||||||
Adds mod_skel.
|
Adds mod_skel.
|
||||||
|
|
||||||
|
Module: applications/mod_signalwire
|
||||||
|
Description: mod_signalwire
|
||||||
|
Adds mod_signalwire.
|
||||||
|
Build-Depends: libks, signalwire-client-c
|
||||||
|
|
||||||
Module: applications/mod_sms
|
Module: applications/mod_sms
|
||||||
Description: Astract SMS
|
Description: Astract SMS
|
||||||
This module provides an abstract facility for interfacing with SMS
|
This module provides an abstract facility for interfacing with SMS
|
||||||
|
3
debian/freeswitch-systemd.freeswitch.service
vendored
3
debian/freeswitch-systemd.freeswitch.service
vendored
@ -2,7 +2,8 @@
|
|||||||
|
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=freeswitch
|
Description=freeswitch
|
||||||
After=syslog.target network.target local-fs.target
|
Requires=syslog.socket network.target local-fs.target
|
||||||
|
After=syslog.socket network.target local-fs.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
; service
|
; service
|
||||||
|
3
debian/freeswitch.install
vendored
3
debian/freeswitch.install
vendored
@ -1,3 +1,4 @@
|
|||||||
/usr/bin
|
/usr/bin
|
||||||
fonts/FreeMono.ttf /usr/share/freeswitch/fonts/
|
fonts/FreeMono.ttf /usr/share/freeswitch/fonts/
|
||||||
fonts/FreeSans.ttf /usr/share/freeswitch/fonts/
|
fonts/FreeSans.ttf /usr/share/freeswitch/fonts/
|
||||||
|
images/*.png /var/lib/freeswitch/images/
|
2
debian/rules
vendored
2
debian/rules
vendored
@ -82,6 +82,8 @@ override_dh_auto_configure: .stamp-configure
|
|||||||
|
|
||||||
.stamp-build: .stamp-configure
|
.stamp-build: .stamp-configure
|
||||||
@$(call show_vars)
|
@$(call show_vars)
|
||||||
|
make -j$(NJOBS) core
|
||||||
|
make iksemel-dep
|
||||||
make -j$(NJOBS)
|
make -j$(NJOBS)
|
||||||
make -C libs/esl pymod
|
make -C libs/esl pymod
|
||||||
make -C libs/esl perlmod
|
make -C libs/esl perlmod
|
||||||
|
2
debian/util.sh
vendored
2
debian/util.sh
vendored
@ -152,7 +152,7 @@ create_orig () {
|
|||||||
hrev="$(get_nightly_revision_human)"
|
hrev="$(get_nightly_revision_human)"
|
||||||
fi
|
fi
|
||||||
local treeish="$1" dver="$(mk_dver "$uver")"
|
local treeish="$1" dver="$(mk_dver "$uver")"
|
||||||
local orig="../freeswitch_$dver.orig.tar.xz"
|
local orig="../freeswitch_$dver~$(lsb_release -sc).orig.tar.xz"
|
||||||
[ -n "$treeish" ] || treeish="HEAD"
|
[ -n "$treeish" ] || treeish="HEAD"
|
||||||
check_repo_clean
|
check_repo_clean
|
||||||
git reset --hard "$treeish"
|
git reset --hard "$treeish"
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
# spec file for package freeswitch
|
# spec file for package freeswitch
|
||||||
#
|
#
|
||||||
# includes module(s): freeswitch-devel freeswitch-codec-passthru-amr freeswitch-codec-passthru-amrwb freeswitch-codec-passthru-g729
|
# includes module(s): freeswitch-devel freeswitch-codec-passthru-amr freeswitch-codec-passthru-amrwb freeswitch-codec-passthru-g729
|
||||||
# freeswitch-codec-passthru-g7231 freeswitch-lua freeswitch-perl freeswitch-python freeswitch-v8
|
# freeswitch-codec-passthru-g7231 freeswitch-lua freeswitch-perl freeswitch-python freeswitch-v8 freeswitch-signalwire
|
||||||
# freeswitch-lan-de freeswitch-lang-en freeswitch-lang-fr freeswitch-lang-hu freeswitch-lang-ru freeswitch-freetdm
|
# freeswitch-lan-de freeswitch-lang-en freeswitch-lang-fr freeswitch-lang-hu freeswitch-lang-ru freeswitch-freetdm
|
||||||
# and others
|
# and others
|
||||||
#
|
#
|
||||||
@ -536,6 +536,14 @@ Requires: %{name} = %{version}-%{release}
|
|||||||
Provides FreeSWITCH mod_rss, edisrse and read an XML based RSS feed, then read
|
Provides FreeSWITCH mod_rss, edisrse and read an XML based RSS feed, then read
|
||||||
the entries aloud via a TTS engine
|
the entries aloud via a TTS engine
|
||||||
|
|
||||||
|
%package application-signalwire
|
||||||
|
Summary: FreeSWITCH mod_signalwire
|
||||||
|
Group: System/Libraries
|
||||||
|
Requires: %{name} = %{version}-%{release}
|
||||||
|
|
||||||
|
%description application-signalwire
|
||||||
|
Provides FreeSWITCH mod_signalwire
|
||||||
|
|
||||||
%package application-sms
|
%package application-sms
|
||||||
Summary: FreeSWITCH mod_sms
|
Summary: FreeSWITCH mod_sms
|
||||||
Group: System/Libraries
|
Group: System/Libraries
|
||||||
@ -1373,6 +1381,7 @@ Requires: freeswitch-application-memcache
|
|||||||
Requires: freeswitch-application-nibblebill
|
Requires: freeswitch-application-nibblebill
|
||||||
Requires: freeswitch-application-redis
|
Requires: freeswitch-application-redis
|
||||||
Requires: freeswitch-application-rss
|
Requires: freeswitch-application-rss
|
||||||
|
Requires: freeswitch-application-signalwire
|
||||||
Requires: freeswitch-application-sms
|
Requires: freeswitch-application-sms
|
||||||
Requires: freeswitch-application-snapshot
|
Requires: freeswitch-application-snapshot
|
||||||
Requires: freeswitch-application-snom
|
Requires: freeswitch-application-snom
|
||||||
@ -1458,7 +1467,7 @@ APPLICATION_MODULES_FR="applications/mod_fifo applications/mod_fsk applications/
|
|||||||
applications/mod_memcache applications/mod_mongo applications/mod_nibblebill applications/mod_rad_auth \
|
applications/mod_memcache applications/mod_mongo applications/mod_nibblebill applications/mod_rad_auth \
|
||||||
applications/mod_redis applications/mod_rss "
|
applications/mod_redis applications/mod_rss "
|
||||||
|
|
||||||
APPLICATION_MODULES_SZ="applications/mod_sms applications/mod_snapshot applications/mod_snom applications/mod_soundtouch \
|
APPLICATION_MODULES_SZ="applications/mod_signalwire applications/mod_sms applications/mod_snapshot applications/mod_snom applications/mod_soundtouch \
|
||||||
applications/mod_spandsp applications/mod_spy applications/mod_stress \
|
applications/mod_spandsp applications/mod_spy applications/mod_stress \
|
||||||
applications/mod_valet_parking applications/mod_translate applications/mod_voicemail \
|
applications/mod_valet_parking applications/mod_translate applications/mod_voicemail \
|
||||||
applications/mod_voicemail_ivr applications/mod_video_filter"
|
applications/mod_voicemail_ivr applications/mod_video_filter"
|
||||||
@ -1884,6 +1893,7 @@ fi
|
|||||||
%{PKGCONFIGDIR}/*
|
%{PKGCONFIGDIR}/*
|
||||||
%{MODINSTDIR}/*.*a
|
%{MODINSTDIR}/*.*a
|
||||||
%{INCLUDEDIR}/*.h
|
%{INCLUDEDIR}/*.h
|
||||||
|
%{INCLUDEDIR}/test/*.h
|
||||||
|
|
||||||
|
|
||||||
######################################################################################################################
|
######################################################################################################################
|
||||||
@ -2114,6 +2124,9 @@ fi
|
|||||||
%files application-rss
|
%files application-rss
|
||||||
%{MODINSTDIR}/mod_rss.so*
|
%{MODINSTDIR}/mod_rss.so*
|
||||||
|
|
||||||
|
%files application-signalwire
|
||||||
|
%{MODINSTDIR}/mod_signalwire.so*
|
||||||
|
|
||||||
%files application-sms
|
%files application-sms
|
||||||
%{MODINSTDIR}/mod_sms.so*
|
%{MODINSTDIR}/mod_sms.so*
|
||||||
|
|
||||||
@ -2540,6 +2553,8 @@ fi
|
|||||||
#
|
#
|
||||||
######################################################################################################################
|
######################################################################################################################
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Dec 11 2018 - Andrey Volk
|
||||||
|
- add mod_signalwire
|
||||||
* Sun Mar 13 2016 - Matthew Vale
|
* Sun Mar 13 2016 - Matthew Vale
|
||||||
- add perl and python ESL language module packages
|
- add perl and python ESL language module packages
|
||||||
* Thu Jul 09 2015 - Artur Zaprzała
|
* Thu Jul 09 2015 - Artur Zaprzała
|
||||||
|
@ -550,11 +550,6 @@
|
|||||||
mandatory: obj.options.videoParams,
|
mandatory: obj.options.videoParams,
|
||||||
optional: opt
|
optional: opt
|
||||||
};
|
};
|
||||||
// NOTE: This is a workaround for
|
|
||||||
// https://bugs.chromium.org/p/chromium/issues/detail?id=862325
|
|
||||||
if (!!navigator.userAgent.match(/Android/i)) {
|
|
||||||
delete video.frameRate.min;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
@ -715,6 +710,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
config.bundlePolicy = "max-compat";
|
config.bundlePolicy = "max-compat";
|
||||||
|
config.sdpSemantics = "plan-b";
|
||||||
|
|
||||||
var peer = new window.RTCPeerConnection(config);
|
var peer = new window.RTCPeerConnection(config);
|
||||||
|
|
||||||
|
5
libs/.gitignore
vendored
5
libs/.gitignore
vendored
@ -858,3 +858,8 @@ libsndfile-*/
|
|||||||
libsndfile-*
|
libsndfile-*
|
||||||
opencv-*/
|
opencv-*/
|
||||||
opencv-*
|
opencv-*
|
||||||
|
libks-*/
|
||||||
|
libks*
|
||||||
|
signalwire-client-c-*/
|
||||||
|
signalwire-client-c-*
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ static int connected = 0;
|
|||||||
static int allow_ctl_c = 0;
|
static int allow_ctl_c = 0;
|
||||||
static char bare_prompt_str[514] = "";
|
static char bare_prompt_str[514] = "";
|
||||||
static int bare_prompt_str_len = 0;
|
static int bare_prompt_str_len = 0;
|
||||||
static char prompt_str[512] = "";
|
static char prompt_str[1024] = "";
|
||||||
static char prompt_color[12] = {ESL_SEQ_DEFAULT_COLOR};
|
static char prompt_color[12] = {ESL_SEQ_DEFAULT_COLOR};
|
||||||
static char input_text_color[12] = {ESL_SEQ_DEFAULT_COLOR};
|
static char input_text_color[12] = {ESL_SEQ_DEFAULT_COLOR};
|
||||||
static char output_text_color[12] = {ESL_SEQ_DEFAULT_COLOR};
|
static char output_text_color[12] = {ESL_SEQ_DEFAULT_COLOR};
|
||||||
@ -700,7 +700,7 @@ static void redisplay(void)
|
|||||||
char s1[12], s2[12] = "";
|
char s1[12], s2[12] = "";
|
||||||
|
|
||||||
putchar('\r');
|
putchar('\r');
|
||||||
snprintf(s1, sizeof(s1), "\033[%dC", bare_prompt_str_len);
|
snprintf(s1, sizeof(s1), "\033[%dC", bare_prompt_str_len);
|
||||||
if (pos) snprintf(s2, sizeof(s2), "\033[%dC", pos);
|
if (pos) snprintf(s2, sizeof(s2), "\033[%dC", pos);
|
||||||
printf("%s%s",s1,s2);
|
printf("%s%s",s1,s2);
|
||||||
}
|
}
|
||||||
@ -1418,7 +1418,7 @@ int main(int argc, char *argv[])
|
|||||||
esl_handle_t handle = {{0}};
|
esl_handle_t handle = {{0}};
|
||||||
int count = 0;
|
int count = 0;
|
||||||
const char *line = NULL;
|
const char *line = NULL;
|
||||||
char cmd_str[1024] = "";
|
char cmd_str[2048] = "";
|
||||||
cli_profile_t *profile = NULL;
|
cli_profile_t *profile = NULL;
|
||||||
int argv_use_history_file = 1;
|
int argv_use_history_file = 1;
|
||||||
int use_history_file = 0;
|
int use_history_file = 0;
|
||||||
|
@ -315,7 +315,7 @@ int tport_open_log(tport_master_t *mr, tagi_t *tags)
|
|||||||
|
|
||||||
/** Create log stamp */
|
/** Create log stamp */
|
||||||
void tport_stamp(tport_t const *self, msg_t *msg,
|
void tport_stamp(tport_t const *self, msg_t *msg,
|
||||||
char stamp[128], char const *what,
|
char stamp[512], char const *what,
|
||||||
size_t n, char const *via,
|
size_t n, char const *via,
|
||||||
su_time_t now)
|
su_time_t now)
|
||||||
{
|
{
|
||||||
@ -357,7 +357,7 @@ void tport_stamp(tport_t const *self, msg_t *msg,
|
|||||||
|
|
||||||
su_inet_ntop(su->su_family, SU_ADDR(su), name, sizeof(name));
|
su_inet_ntop(su->su_family, SU_ADDR(su), name, sizeof(name));
|
||||||
|
|
||||||
snprintf(stamp, 128,
|
snprintf(stamp, 144,
|
||||||
"%s "MOD_ZU" bytes %s %s/[%s]:%u%s%s at %02u:%02u:%02u.%06lu:\n",
|
"%s "MOD_ZU" bytes %s %s/[%s]:%u%s%s at %02u:%02u:%02u.%06lu:\n",
|
||||||
what, (size_t)n, via, self->tp_name->tpn_proto,
|
what, (size_t)n, via, self->tp_name->tpn_proto,
|
||||||
name, ntohs(su->su_port), label[0] ? label : "", comp,
|
name, ntohs(su->su_port), label[0] ? label : "", comp,
|
||||||
|
@ -254,10 +254,10 @@ int ws_handshake(wsh_t *wsh)
|
|||||||
char version[5] = "";
|
char version[5] = "";
|
||||||
char proto[256] = "";
|
char proto[256] = "";
|
||||||
char proto_buf[384] = "";
|
char proto_buf[384] = "";
|
||||||
char input[256] = "";
|
char input[512] = "";
|
||||||
unsigned char output[SHA1_HASH_SIZE] = "";
|
unsigned char output[SHA1_HASH_SIZE] = "";
|
||||||
char b64[256] = "";
|
char b64[256] = "";
|
||||||
char respond[512] = "";
|
char respond[1024] = "";
|
||||||
ssize_t bytes;
|
ssize_t bytes;
|
||||||
char *p, *e = 0;
|
char *p, *e = 0;
|
||||||
|
|
||||||
|
@ -58,11 +58,11 @@ APT_BEGIN_EXTERN_C
|
|||||||
/** Format to log string identifiers and resources */
|
/** Format to log string identifiers and resources */
|
||||||
#define APT_SIDRES_FMT "<%s@%s>"
|
#define APT_SIDRES_FMT "<%s@%s>"
|
||||||
/** Format to log pointers and identifiers */
|
/** Format to log pointers and identifiers */
|
||||||
#define APT_PTRSID_FMT APT_PTR_FMT" "APT_SID_FMT
|
#define APT_PTRSID_FMT APT_PTR_FMT" " APT_SID_FMT
|
||||||
/** Format to log pointers and identifiers */
|
/** Format to log pointers and identifiers */
|
||||||
#define APT_NAMESID_FMT "%s "APT_SID_FMT
|
#define APT_NAMESID_FMT "%s " APT_SID_FMT
|
||||||
/** Format to log names, identifiers and resources */
|
/** Format to log names, identifiers and resources */
|
||||||
#define APT_NAMESIDRES_FMT "%s "APT_SIDRES_FMT
|
#define APT_NAMESIDRES_FMT "%s " APT_SIDRES_FMT
|
||||||
|
|
||||||
/** Priority of log messages ordered from highest priority to lowest (rfc3164) */
|
/** Priority of log messages ordered from highest priority to lowest (rfc3164) */
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
@ -246,7 +246,7 @@ void UmcConsole::Usage()
|
|||||||
{
|
{
|
||||||
printf(
|
printf(
|
||||||
"\n"
|
"\n"
|
||||||
" * "UNI_COPYRIGHT"\n"
|
" * " UNI_COPYRIGHT"\n"
|
||||||
" *\n"
|
" *\n"
|
||||||
UNI_LICENSE"\n"
|
UNI_LICENSE"\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
@ -221,7 +221,7 @@ const char* UmcScenario::LoadFileContent(const char* pFileName, apr_size_t& size
|
|||||||
|
|
||||||
size = (apr_size_t)finfo.size;
|
size = (apr_size_t)finfo.size;
|
||||||
char* pContent = (char*) apr_palloc(pool,size+1);
|
char* pContent = (char*) apr_palloc(pool,size+1);
|
||||||
apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Load File Content size [%"APR_SIZE_T_FMT" bytes] %s",size,pFilePath);
|
apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Load File Content size [%" APR_SIZE_T_FMT" bytes] %s",size,pFilePath);
|
||||||
if(apr_file_read(pFile,pContent,&size) != APR_SUCCESS)
|
if(apr_file_read(pFile,pContent,&size) != APR_SUCCESS)
|
||||||
{
|
{
|
||||||
apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Read Content %s",pFilePath);
|
apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Read Content %s",pFilePath);
|
||||||
|
65
libs/win32/Sound_Files/48khz.2017.vcxproj
Normal file
65
libs/win32/Sound_Files/48khz.2017.vcxproj
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Debug|x64">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|x64">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
</ItemGroup>
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<ProjectName>48khz</ProjectName>
|
||||||
|
<RootNamespace>My48khz</RootNamespace>
|
||||||
|
<ProjectGuid>{8154C82D-58EE-4145-9DEC-A445A5AA3D6B}</ProjectGuid>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Utility</ConfigurationType>
|
||||||
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Utility</ConfigurationType>
|
||||||
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Utility</ConfigurationType>
|
||||||
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Utility</ConfigurationType>
|
||||||
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<SoundPrimaryName>en-us-callie</SoundPrimaryName>
|
||||||
|
<SoundQuality>48000</SoundQuality>
|
||||||
|
<ExpectRelative>en\us\callie\voicemail\$(SoundQuality)</ExpectRelative>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<IntDir>$(PlatformName)\$(Configuration)\$(ProjectName)\$(SoundQuality)</IntDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
|
<Import Project="..\..\..\w32\download_sounds.props" />
|
||||||
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
</ImportGroup>
|
||||||
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
65
libs/win32/Sound_Files/48khzmusic.2017.vcxproj
Normal file
65
libs/win32/Sound_Files/48khzmusic.2017.vcxproj
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Debug|x64">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|x64">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
</ItemGroup>
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<ProjectName>48khz music</ProjectName>
|
||||||
|
<RootNamespace>My48khzmusic</RootNamespace>
|
||||||
|
<ProjectGuid>{EBD0B6B4-C5CA-46B0-BBC7-DBA71DF05D31}</ProjectGuid>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Utility</ConfigurationType>
|
||||||
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Utility</ConfigurationType>
|
||||||
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Utility</ConfigurationType>
|
||||||
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Utility</ConfigurationType>
|
||||||
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<SoundPrimaryName>music</SoundPrimaryName>
|
||||||
|
<SoundQuality>48000</SoundQuality>
|
||||||
|
<ExpectRelative>music\$(SoundQuality)</ExpectRelative>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<IntDir>$(PlatformName)\$(Configuration)\$(ProjectName)\$(SoundQuality)</IntDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
|
<Import Project="..\..\..\w32\download_sounds.props" />
|
||||||
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
</ImportGroup>
|
||||||
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
File diff suppressed because it is too large
Load Diff
@ -60,15 +60,15 @@ else
|
|||||||
-- Looks good, let's play some sound files
|
-- Looks good, let's play some sound files
|
||||||
sound_base = session:getVariable('sounds_dir') .. '/en/us/callie/' .. stype .. '/' .. srate;
|
sound_base = session:getVariable('sounds_dir') .. '/en/us/callie/' .. stype .. '/' .. srate;
|
||||||
input_file = '/tmp/filez.txt';
|
input_file = '/tmp/filez.txt';
|
||||||
res = os.execute('ls -1 ' .. sound_base .. ' > ' .. input_file);
|
res, what, code = os.execute('ls -1 ' .. sound_base .. ' > ' .. input_file);
|
||||||
freeswitch.consoleLog("INFO","Result of system call: " .. res .. "\n");
|
freeswitch.consoleLog("INFO","Result of system call: " .. what .. " " .. code .. "\n");
|
||||||
if ( res == 0 ) then
|
if ( res == true and what == 'exit' and code == 0 ) then
|
||||||
for fname in io.lines(input_file) do
|
for fname in io.lines(input_file) do
|
||||||
freeswitch.consoleLog("NOTICE","Playing file: " .. fname .. "\n");
|
freeswitch.consoleLog("NOTICE","Playing file: " .. fname .. "\n");
|
||||||
session:streamFile(sound_base .. '/' .. fname);
|
session:streamFile(sound_base .. '/' .. fname);
|
||||||
session:sleep(100);
|
session:sleep(100);
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
freeswitch.consoleLog("ERR","Result of system call: " .. res .. "\n");
|
freeswitch.consoleLog("ERR","Result of system call: " .. what .. " " .. code .. "\n");
|
||||||
end
|
end
|
||||||
end
|
end
|
@ -9,7 +9,7 @@ Build-Depends-Indep: perl (>= 5.8.0-7), libmodule-install-perl,
|
|||||||
Maintainer: Massimo Cetra <devel@navynet.it>
|
Maintainer: Massimo Cetra <devel@navynet.it>
|
||||||
|
|
||||||
Package: libfreeswitch-client-perl
|
Package: libfreeswitch-client-perl
|
||||||
Architecture: all
|
Architecture: amd64
|
||||||
Depends: ${perl:Depends}, ${misc:Depends}, libmodule-scandeps-perl (>= 0.51), libio-socket-ssl-perl (>= 0.97)
|
Depends: ${perl:Depends}, ${misc:Depends}, libmodule-scandeps-perl (>= 0.51), libio-socket-ssl-perl (>= 0.97)
|
||||||
Recommends: gnupg, libmodule-signature-perl, libpar-packer-perl
|
Recommends: gnupg, libmodule-signature-perl, libpar-packer-perl
|
||||||
Description: FreeSWITCH Client perl library
|
Description: FreeSWITCH Client perl library
|
||||||
|
3956
src/include/test/switch_fct.h
Normal file
3956
src/include/test/switch_fct.h
Normal file
File diff suppressed because it is too large
Load Diff
807
src/include/test/switch_test.h
Normal file
807
src/include/test/switch_test.h
Normal file
@ -0,0 +1,807 @@
|
|||||||
|
/*
|
||||||
|
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||||
|
* Copyright (C) 2005-2018, 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):
|
||||||
|
*
|
||||||
|
* Chris Rienzo <chris@signalwire.com>
|
||||||
|
* Seven Du <seven@signalwire.com>
|
||||||
|
*
|
||||||
|
* switch_test.h -- FreeSWITCH test macros
|
||||||
|
*/
|
||||||
|
#ifndef SWITCH_FST_H
|
||||||
|
#define SWITCH_FST_H
|
||||||
|
|
||||||
|
#include <switch.h>
|
||||||
|
|
||||||
|
#include <test/switch_fct.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get environment variable and save to var
|
||||||
|
*/
|
||||||
|
static char *fst_getenv_default(const char *env, char *default_value, switch_bool_t required)
|
||||||
|
{
|
||||||
|
char *val = getenv(env);
|
||||||
|
if (!val) {
|
||||||
|
if (required) {
|
||||||
|
fprintf(stderr, "Failed to start test: environment variable \"%s\" is not set!\n", env);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
return default_value;
|
||||||
|
}
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get environment variable and save to var
|
||||||
|
*/
|
||||||
|
#define fst_getenv(env, default_value) \
|
||||||
|
char *env = fst_getenv_default(#env, (char *)default_value, SWITCH_FALSE);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get mandatory environment variable and save to var. Exit with error if missing.
|
||||||
|
*/
|
||||||
|
#define fst_getenv_required(env) \
|
||||||
|
char *env = fst_getenv_default(#env, NULL, SWITCH_TRUE);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* initialize FS core from optional configuration dir
|
||||||
|
*/
|
||||||
|
static void fst_init_core_and_modload(const char *confdir, const char *basedir, int minimal)
|
||||||
|
{
|
||||||
|
const char *err;
|
||||||
|
// Let FreeSWITCH core pick these
|
||||||
|
//SWITCH_GLOBAL_dirs.base_dir = strdup("/usr/local/freeswitch");
|
||||||
|
//SWITCH_GLOBAL_dirs.mod_dir = strdup("/usr/local/freeswitch/mod");
|
||||||
|
//SWITCH_GLOBAL_dirs.lib_dir = strdup("/usr/local/freeswitch/lib");
|
||||||
|
//SWITCH_GLOBAL_dirs.temp_dir = strdup("/tmp");
|
||||||
|
|
||||||
|
if (zstr(basedir)) {
|
||||||
|
basedir = ".";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Allow test to define the runtime dir
|
||||||
|
if (!zstr(confdir)) {
|
||||||
|
#ifdef SWITCH_TEST_BASE_DIR_FOR_CONF
|
||||||
|
SWITCH_GLOBAL_dirs.conf_dir = switch_mprintf("%s%s%s", SWITCH_TEST_BASE_DIR_FOR_CONF, SWITCH_PATH_SEPARATOR, confdir);
|
||||||
|
#else
|
||||||
|
if (confdir[0] != '/') {
|
||||||
|
SWITCH_GLOBAL_dirs.conf_dir = switch_mprintf(".%s%s", SWITCH_PATH_SEPARATOR, confdir);
|
||||||
|
} else {
|
||||||
|
SWITCH_GLOBAL_dirs.conf_dir = strdup(confdir);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
} else {
|
||||||
|
SWITCH_GLOBAL_dirs.conf_dir = switch_mprintf("%s%sconf", basedir, SWITCH_PATH_SEPARATOR);
|
||||||
|
}
|
||||||
|
|
||||||
|
SWITCH_GLOBAL_dirs.log_dir = switch_mprintf("%s%s", basedir, SWITCH_PATH_SEPARATOR);
|
||||||
|
SWITCH_GLOBAL_dirs.run_dir = switch_mprintf("%s%s", basedir, SWITCH_PATH_SEPARATOR);
|
||||||
|
SWITCH_GLOBAL_dirs.recordings_dir = switch_mprintf("%s%s", basedir, SWITCH_PATH_SEPARATOR);
|
||||||
|
SWITCH_GLOBAL_dirs.sounds_dir = switch_mprintf("%s%s", basedir, SWITCH_PATH_SEPARATOR);
|
||||||
|
SWITCH_GLOBAL_dirs.cache_dir = switch_mprintf("%s%s", basedir, SWITCH_PATH_SEPARATOR);
|
||||||
|
SWITCH_GLOBAL_dirs.db_dir = switch_mprintf("%s%s", basedir, SWITCH_PATH_SEPARATOR);
|
||||||
|
SWITCH_GLOBAL_dirs.script_dir = switch_mprintf("%s%s", basedir, SWITCH_PATH_SEPARATOR);
|
||||||
|
SWITCH_GLOBAL_dirs.htdocs_dir = switch_mprintf("%s%s", basedir, SWITCH_PATH_SEPARATOR);
|
||||||
|
SWITCH_GLOBAL_dirs.grammar_dir = switch_mprintf("%s%s", basedir, SWITCH_PATH_SEPARATOR);
|
||||||
|
SWITCH_GLOBAL_dirs.fonts_dir = switch_mprintf("%s%s", basedir, SWITCH_PATH_SEPARATOR);
|
||||||
|
SWITCH_GLOBAL_dirs.images_dir = switch_mprintf("%s%s", basedir, SWITCH_PATH_SEPARATOR);
|
||||||
|
SWITCH_GLOBAL_dirs.storage_dir = switch_mprintf("%s%s", basedir, SWITCH_PATH_SEPARATOR);
|
||||||
|
SWITCH_GLOBAL_dirs.data_dir = switch_mprintf("%s%s", basedir, SWITCH_PATH_SEPARATOR);
|
||||||
|
SWITCH_GLOBAL_dirs.localstate_dir = switch_mprintf("%s%s", basedir, SWITCH_PATH_SEPARATOR);
|
||||||
|
|
||||||
|
switch_core_set_globals();
|
||||||
|
|
||||||
|
if (!minimal) {
|
||||||
|
switch_core_init_and_modload(0, SWITCH_TRUE, &err);
|
||||||
|
switch_sleep(1 * 1000000);
|
||||||
|
switch_core_set_variable("sound_prefix", "." SWITCH_PATH_SEPARATOR);
|
||||||
|
} else {
|
||||||
|
switch_core_init(SCF_MINIMAL, SWITCH_TRUE, &err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Park FreeSWITCH session. This is handy when wanting to use switch_core_session_execute_async() on the test session.
|
||||||
|
* @param session to park
|
||||||
|
*/
|
||||||
|
#define fst_session_park(session) \
|
||||||
|
switch_ivr_park_session(session); \
|
||||||
|
switch_channel_wait_for_state(switch_core_session_get_channel(session), NULL, CS_PARK);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* check for test requirement - execute teardown on failure
|
||||||
|
*/
|
||||||
|
#define fst_requires fct_req
|
||||||
|
|
||||||
|
/**
|
||||||
|
* check for required module - execute teardown on failure
|
||||||
|
*/
|
||||||
|
#define fst_requires_module(modname) fct_req(switch_loadable_module_exists(modname) == SWITCH_STATUS_SUCCESS)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* test boolean expression - continue test execution on failure
|
||||||
|
*/
|
||||||
|
#define fst_check fct_chk
|
||||||
|
|
||||||
|
/**
|
||||||
|
* test integers for equality - continue test execution on failure
|
||||||
|
*/
|
||||||
|
#define fst_check_int_equals fct_chk_eq_int
|
||||||
|
|
||||||
|
/**
|
||||||
|
* test strings for equality - continue test execution on failure
|
||||||
|
*/
|
||||||
|
#define fst_check_string_equals fct_chk_eq_str
|
||||||
|
|
||||||
|
/**
|
||||||
|
* test strings for inequality - continue test execution on failure
|
||||||
|
*/
|
||||||
|
#define fst_check_string_not_equals fct_chk_neq_str
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mark reference for time measure
|
||||||
|
*/
|
||||||
|
#define fst_time_mark() \
|
||||||
|
fst_time_start = switch_time_now();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check a test /w error message
|
||||||
|
*/
|
||||||
|
#define fst_xcheck(expr, error_msg) \
|
||||||
|
fct_xchk(expr, error_msg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fail a test
|
||||||
|
*/
|
||||||
|
#define fst_fail(error_msg) \
|
||||||
|
fct_xchk(0, error_msg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check duration relative to test start, last marked time, or last check.
|
||||||
|
*/
|
||||||
|
#define fst_check_duration(duration_ms, precision_ms) \
|
||||||
|
{ \
|
||||||
|
int actual_duration_ms = (int)((switch_time_now() - fst_time_start) / 1000); \
|
||||||
|
fct_xchk( \
|
||||||
|
abs((actual_duration_ms - duration_ms)) <= precision_ms, \
|
||||||
|
"fst_check_duration: %d != %d +/- %d", \
|
||||||
|
(actual_duration_ms), \
|
||||||
|
(duration_ms), \
|
||||||
|
(precision_ms) \
|
||||||
|
); \
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if integer is in range
|
||||||
|
*/
|
||||||
|
#define fst_check_int_range(actual, expected, precision) \
|
||||||
|
fct_xchk( \
|
||||||
|
abs((actual - expected)) <= precision, \
|
||||||
|
"fst_check_int_range: %d != %d +/- %d", \
|
||||||
|
(actual), \
|
||||||
|
(expected), \
|
||||||
|
(precision) \
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if double-precision number is in range
|
||||||
|
*/
|
||||||
|
#define fst_check_double_range(actual, expected, precision) \
|
||||||
|
fct_xchk( \
|
||||||
|
fabs((actual - expected)) <= precision, \
|
||||||
|
"fst_check_double_range: %f != %f +/- %f", \
|
||||||
|
(actual), \
|
||||||
|
(expected), \
|
||||||
|
(precision) \
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Run test without loading FS core
|
||||||
|
*/
|
||||||
|
#define FST_BEGIN() \
|
||||||
|
FCT_BGN() \
|
||||||
|
{ \
|
||||||
|
int fst_core = 0; \
|
||||||
|
switch_time_t fst_time_start = 0; \
|
||||||
|
switch_timer_t fst_timer = { 0 }; \
|
||||||
|
switch_memory_pool_t *fst_pool = NULL; \
|
||||||
|
fst_getenv_default("FST_SUPPRESS_UNUSED_STATIC_WARNING", NULL, SWITCH_FALSE); \
|
||||||
|
if (fst_core) { \
|
||||||
|
fst_init_core_and_modload(NULL, NULL, 0); /* shuts up compiler */ \
|
||||||
|
} \
|
||||||
|
{ \
|
||||||
|
|
||||||
|
|
||||||
|
#define FST_END() \
|
||||||
|
} \
|
||||||
|
if (fst_time_start) { \
|
||||||
|
/* shut up compiler */ \
|
||||||
|
fst_time_start = 0; \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
FCT_END()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define the beginning of a freeswitch core test driver. Only one per test application allowed.
|
||||||
|
* @param confdir directory containing freeswitch.xml configuration
|
||||||
|
*/
|
||||||
|
#define FST_CORE_BEGIN(confdir) \
|
||||||
|
FCT_BGN() \
|
||||||
|
{ \
|
||||||
|
int fst_core = 2; \
|
||||||
|
switch_time_t fst_time_start = 0; \
|
||||||
|
switch_timer_t fst_timer = { 0 }; \
|
||||||
|
switch_memory_pool_t *fst_pool = NULL; \
|
||||||
|
fst_getenv_default("FST_SUPPRESS_UNUSED_STATIC_WARNING", NULL, SWITCH_FALSE); \
|
||||||
|
fst_init_core_and_modload(confdir, NULL, 0); \
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define the end of a freeswitch core test driver.
|
||||||
|
*/
|
||||||
|
#define FST_CORE_END() \
|
||||||
|
/*switch_core_destroy();*/ \
|
||||||
|
} \
|
||||||
|
if (fst_time_start) { \
|
||||||
|
/* shut up compiler */ \
|
||||||
|
fst_time_start = 0; \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
FCT_END()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Minimal FS core load
|
||||||
|
*/
|
||||||
|
#define FST_MINCORE_BEGIN() \
|
||||||
|
FCT_BGN() \
|
||||||
|
{ \
|
||||||
|
int fst_core = 1; \
|
||||||
|
switch_time_t fst_time_start = 0; \
|
||||||
|
switch_timer_t fst_timer = { 0 }; \
|
||||||
|
switch_memory_pool_t *fst_pool = NULL; \
|
||||||
|
fst_getenv_default("FST_SUPPRESS_UNUSED_STATIC_WARNING", NULL, SWITCH_FALSE); \
|
||||||
|
fst_init_core_and_modload(".", NULL, 1); /* minimal load */ \
|
||||||
|
{
|
||||||
|
|
||||||
|
#define FST_MINCORE_END FST_CORE_END
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define the beginning of a FreeSWITCH module test suite. Loads the module for test.
|
||||||
|
* @param modname name of module to load.
|
||||||
|
* @param suite the name of this test suite
|
||||||
|
*/
|
||||||
|
#ifdef WIN32
|
||||||
|
#define FST_MODULE_BEGIN(modname,suite) \
|
||||||
|
{ \
|
||||||
|
const char *fst_test_module = #modname; \
|
||||||
|
if (fst_core && !zstr(fst_test_module)) { \
|
||||||
|
const char *err; \
|
||||||
|
switch_loadable_module_load_module((char *)"./mod", (char *)fst_test_module, SWITCH_TRUE, &err); \
|
||||||
|
} \
|
||||||
|
FCT_FIXTURE_SUITE_BGN(suite);
|
||||||
|
#else
|
||||||
|
#define FST_MODULE_BEGIN(modname,suite) \
|
||||||
|
{ \
|
||||||
|
const char *fst_test_module = #modname; \
|
||||||
|
if (fst_core && !zstr(fst_test_module)) { \
|
||||||
|
const char *err; \
|
||||||
|
switch_loadable_module_load_module((char *)"../.libs", (char *)fst_test_module, SWITCH_TRUE, &err); \
|
||||||
|
} \
|
||||||
|
FCT_FIXTURE_SUITE_BGN(suite);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define the end of a FreeSWITCH module test suite.
|
||||||
|
*/
|
||||||
|
#ifdef WIN32
|
||||||
|
#define FST_MODULE_END() \
|
||||||
|
FCT_FIXTURE_SUITE_END(); \
|
||||||
|
if (!zstr(fst_test_module) && switch_loadable_module_exists(fst_test_module) == SWITCH_STATUS_SUCCESS) { \
|
||||||
|
const char *err; \
|
||||||
|
switch_loadable_module_unload_module((char *)"./mod", (char *)fst_test_module, SWITCH_FALSE, &err); \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
#define FST_MODULE_END() \
|
||||||
|
FCT_FIXTURE_SUITE_END(); \
|
||||||
|
if (!zstr(fst_test_module) && switch_loadable_module_exists(fst_test_module) == SWITCH_STATUS_SUCCESS) { \
|
||||||
|
const char *err; \
|
||||||
|
switch_loadable_module_unload_module((char *)"../.libs", (char *)fst_test_module, SWITCH_FALSE, &err); \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define the beginning of a test suite not associated with a module.
|
||||||
|
* @param suite the name of this test suite
|
||||||
|
*/
|
||||||
|
#define FST_SUITE_BEGIN(suite) \
|
||||||
|
const char *fst_test_module = NULL; \
|
||||||
|
FCT_FIXTURE_SUITE_BGN(suite)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define the end of a test suite.
|
||||||
|
*/
|
||||||
|
#define FST_SUITE_END FCT_FIXTURE_SUITE_END
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define the test suite setup. This is run before each test or session test.
|
||||||
|
*/
|
||||||
|
#define FST_SETUP_BEGIN() \
|
||||||
|
FCT_SETUP_BGN() \
|
||||||
|
if (fst_core) { \
|
||||||
|
switch_core_new_memory_pool(&fst_pool); \
|
||||||
|
fst_requires(fst_pool != NULL); \
|
||||||
|
if (fst_core > 1) { \
|
||||||
|
fst_requires(switch_core_timer_init(&fst_timer, "soft", 20, 160, fst_pool) == SWITCH_STATUS_SUCCESS); \
|
||||||
|
} \
|
||||||
|
fst_time_mark(); \
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define the end of test suite setup.
|
||||||
|
*/
|
||||||
|
#define FST_SETUP_END FCT_SETUP_END
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define the test suite teardown. This is run after each test or session test.
|
||||||
|
*/
|
||||||
|
#define FST_TEARDOWN_BEGIN() \
|
||||||
|
FCT_TEARDOWN_BGN() \
|
||||||
|
if (fst_core) { \
|
||||||
|
switch_core_destroy_memory_pool(&fst_pool); \
|
||||||
|
if (fst_core > 1) { \
|
||||||
|
switch_core_timer_destroy(&fst_timer); \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define the test suite teardown end.
|
||||||
|
*/
|
||||||
|
#define FST_TEARDOWN_END FCT_TEARDOWN_END
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define a test in a test suite.
|
||||||
|
* Defined vars:
|
||||||
|
* switch_memory_pool_t *fst_pool; A memory pool that is torn down on test completion
|
||||||
|
* switch_core_timer_t *fst_timer; A 8kHz, 20ms soft timer (160 samples per frame)
|
||||||
|
* @param name the name of this test
|
||||||
|
*/
|
||||||
|
#define FST_TEST_BEGIN(name) \
|
||||||
|
FCT_TEST_BGN(name) \
|
||||||
|
if (fst_test_module) { \
|
||||||
|
fst_requires_module(fst_test_module); \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define FST_TEST_END FCT_TEST_END
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define a session test in a test suite. This can be used to test IVR functions.
|
||||||
|
*
|
||||||
|
* Records session audio to /tmp/name.wav where name is the name of the test.
|
||||||
|
*
|
||||||
|
* Required modules:
|
||||||
|
* mod_loopback - for null endpoint
|
||||||
|
* mod_sndfile - for wav file support
|
||||||
|
*
|
||||||
|
* Defined vars:
|
||||||
|
* switch_memory_pool_t *fst_pool; A memory pool that is torn down on test completion
|
||||||
|
* switch_core_timer_t *fst_timer; A 8kHz, 20ms soft timer (160 samples per frame)
|
||||||
|
* switch_core_session_t *fst_session; The outbound null session. L16, 1 channel, 8kHz.
|
||||||
|
* switch_core_session_t *fst_session_pool; The outbound null session's pool.
|
||||||
|
* switch_channel_t *fst_channel; The outbound null session's channel.
|
||||||
|
*
|
||||||
|
* @param name the name of this test
|
||||||
|
* @param rate the rate of the channel
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define FST_SESSION_BEGIN_RATE(name, rate) \
|
||||||
|
FCT_TEST_BGN(name) \
|
||||||
|
{ \
|
||||||
|
switch_core_session_t *fst_session = NULL; \
|
||||||
|
switch_event_t *fst_originate_vars = NULL; \
|
||||||
|
switch_call_cause_t fst_cause = SWITCH_CAUSE_NORMAL_CLEARING; \
|
||||||
|
fst_requires(fst_core); \
|
||||||
|
if (fst_test_module) { \
|
||||||
|
fst_requires_module(fst_test_module); \
|
||||||
|
} \
|
||||||
|
fst_requires_module("mod_loopback"); \
|
||||||
|
fst_requires_module("mod_sndfile"); \
|
||||||
|
fst_requires(switch_core_running()); \
|
||||||
|
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) { \
|
||||||
|
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); \
|
||||||
|
switch_channel_wait_for_state(fst_channel, NULL, CS_SOFT_EXECUTE); \
|
||||||
|
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); \
|
||||||
|
for(;;) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define a session test in a test suite. This can be used to test IVR functions.
|
||||||
|
* See FST_SESSION_BEGIN_RATE
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define FST_SESSION_BEGIN(name) FST_SESSION_BEGIN_RATE(name, 8000)
|
||||||
|
|
||||||
|
/* BODY OF TEST CASE HERE */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define the end of a session test in a test suite.
|
||||||
|
* Hangs up session under test.
|
||||||
|
*/
|
||||||
|
#define FST_SESSION_END() \
|
||||||
|
break; \
|
||||||
|
} \
|
||||||
|
if (switch_channel_ready(fst_channel)) { \
|
||||||
|
switch_channel_hangup(fst_channel, SWITCH_CAUSE_NORMAL_CLEARING); \
|
||||||
|
} \
|
||||||
|
if (fst_originate_vars) { \
|
||||||
|
switch_event_destroy(&fst_originate_vars); \
|
||||||
|
} \
|
||||||
|
if (fst_session_pool) { \
|
||||||
|
fst_session_pool = NULL; \
|
||||||
|
} \
|
||||||
|
switch_core_session_rwunlock(fst_session); \
|
||||||
|
switch_sleep(1000000); \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
FCT_TEST_END()
|
||||||
|
|
||||||
|
|
||||||
|
/* CORE ASR TEST MACROS */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Open core ASR for a recognizer module. Opens for L16, 1 channel, 8KHz.
|
||||||
|
*
|
||||||
|
* Test Requires:
|
||||||
|
* switch_core_asr_open() == SWITCH_STATUS_SUCCESS
|
||||||
|
*
|
||||||
|
* Defined vars:
|
||||||
|
* switch_asr_handle_t ah; Core ASR handle
|
||||||
|
* switch_asr_flag_t flags; Core ASR flags used to open recognizer.
|
||||||
|
* char *fst_asr_result; Result of last recognition. Allocated from test memory pool.
|
||||||
|
*
|
||||||
|
* @param recognizer name of recognizer to open (like gcloud_dialogflow)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#define fst_test_core_asr_open(recognizer) \
|
||||||
|
{\
|
||||||
|
char *fst_asr_result = NULL; \
|
||||||
|
switch_asr_handle_t ah = { 0 }; \
|
||||||
|
switch_asr_flag_t flags = SWITCH_ASR_FLAG_NONE; \
|
||||||
|
fst_requires(fst_core > 1); \
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Open recognizer: %s\n", recognizer); \
|
||||||
|
/* open ASR interface and feed recorded audio into it and collect result */ \
|
||||||
|
fst_requires(switch_core_asr_open(&ah, recognizer, "L16", 8000, "", &flags, fst_pool) == SWITCH_STATUS_SUCCESS); \
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute test on opened recognizer. Reads audio from input file and passes it to the recognizer.
|
||||||
|
*
|
||||||
|
* Test Requires:
|
||||||
|
* switch_core_asr_load_grammar(grammar) == SWITCH_STATUS_SUCCESS
|
||||||
|
* switch_core_file_open(input_filename) == SWITCH_STATUS_SUCCESS
|
||||||
|
* switch_core_file_close() == SWITCH_STATUS_SUCCESS
|
||||||
|
*
|
||||||
|
* Test Checks:
|
||||||
|
* Got result from recognizer.
|
||||||
|
*
|
||||||
|
* Test Output:
|
||||||
|
* fst_asr_result has the xmlstr from switch_core_file_get_results()
|
||||||
|
*
|
||||||
|
* @param grammar recognizer grammar
|
||||||
|
* @param input_filename name of file containing audio to send to recognizer.
|
||||||
|
*/
|
||||||
|
#define fst_test_core_asr(grammar, input_filename) \
|
||||||
|
{ \
|
||||||
|
/* feed file into ASR */ \
|
||||||
|
switch_status_t result; \
|
||||||
|
switch_file_handle_t file_handle = { 0 }; \
|
||||||
|
uint8_t *buf; \
|
||||||
|
size_t len = 160; \
|
||||||
|
int got_result = 0; \
|
||||||
|
fst_asr_result = NULL; \
|
||||||
|
file_handle.channels = 1; \
|
||||||
|
file_handle.native_rate = 8000; \
|
||||||
|
fst_requires(fst_core > 1); \
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Test recognizer: input = %s\n", input_filename); \
|
||||||
|
fst_requires(switch_core_asr_load_grammar(&ah, grammar, "") == SWITCH_STATUS_SUCCESS); \
|
||||||
|
fst_requires(switch_core_file_open(&file_handle, input_filename, file_handle.channels, 8000, SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) == SWITCH_STATUS_SUCCESS); \
|
||||||
|
buf = (uint8_t *)switch_core_alloc(fst_pool, sizeof(uint8_t) * 160 * sizeof(uint16_t) * file_handle.channels); \
|
||||||
|
switch_core_timer_sync(&fst_timer); \
|
||||||
|
while ((result = switch_core_file_read(&file_handle, buf, &len)) == SWITCH_STATUS_SUCCESS) { \
|
||||||
|
fst_requires(switch_core_asr_feed(&ah, buf, len * sizeof(int16_t), &flags) == SWITCH_STATUS_SUCCESS); \
|
||||||
|
switch_core_timer_next(&fst_timer); \
|
||||||
|
if (switch_core_asr_check_results(&ah, &flags) == SWITCH_STATUS_SUCCESS) { \
|
||||||
|
char *xmlstr = NULL; \
|
||||||
|
switch_event_t *headers = NULL; \
|
||||||
|
flags = SWITCH_ASR_FLAG_NONE; \
|
||||||
|
/* switch_ivr_detect_speech.. checks one in media bug then again in speech_thread */ \
|
||||||
|
fst_requires(switch_core_asr_check_results(&ah, &flags) == SWITCH_STATUS_SUCCESS); \
|
||||||
|
result = switch_core_asr_get_results(&ah, &xmlstr, &flags); \
|
||||||
|
if (result == SWITCH_STATUS_SUCCESS) { \
|
||||||
|
got_result++; \
|
||||||
|
switch_core_asr_get_result_headers(&ah, &headers, &flags); \
|
||||||
|
if (headers) { \
|
||||||
|
switch_event_destroy(&headers); \
|
||||||
|
} \
|
||||||
|
fst_check(xmlstr != NULL); \
|
||||||
|
if (xmlstr != NULL) { \
|
||||||
|
fst_asr_result = switch_core_strdup(fst_pool, xmlstr);\
|
||||||
|
} \
|
||||||
|
switch_safe_free(xmlstr); \
|
||||||
|
break; \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
len = 160; \
|
||||||
|
} \
|
||||||
|
fst_check(got_result == 1); \
|
||||||
|
fst_requires(switch_core_file_close(&file_handle) == SWITCH_STATUS_SUCCESS); \
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pause an open recognizer.
|
||||||
|
*
|
||||||
|
* Test Requires:
|
||||||
|
* switch_core_asr_pause(&ah) == SWITCH_STATUS_SUCCESS
|
||||||
|
*/
|
||||||
|
#define fst_test_core_asr_pause() \
|
||||||
|
fst_requires(fst_core > 1); \
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Pause recognizer\n"); \
|
||||||
|
flags = SWITCH_ASR_FLAG_NONE; \
|
||||||
|
fst_requires(switch_core_asr_pause(&ah) == SWITCH_STATUS_SUCCESS);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resumes an open recognizer
|
||||||
|
*
|
||||||
|
* Test Requires:
|
||||||
|
* switch_core_asr_resume(&ah) == SWITCH_STATUS_SUCCESS
|
||||||
|
*/
|
||||||
|
#define fst_test_core_asr_resume() \
|
||||||
|
fst_requires(fst_core > 1); \
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Resume recognizer\n"); \
|
||||||
|
flags = SWITCH_ASR_FLAG_NONE; \
|
||||||
|
fst_requires(switch_core_asr_resume(&ah) == SWITCH_STATUS_SUCCESS);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Close an open recognizer
|
||||||
|
*
|
||||||
|
* Test Requires:
|
||||||
|
* switch_core_asr_close(&ah, flags) == SWITCH_STATUS_SUCCESS
|
||||||
|
*/
|
||||||
|
#define fst_test_core_asr_close() \
|
||||||
|
fst_requires(fst_core > 1); \
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Close recognizer\n"); \
|
||||||
|
flags = SWITCH_ASR_FLAG_NONE; \
|
||||||
|
fst_requires(switch_core_asr_close(&ah, &flags) == SWITCH_STATUS_SUCCESS); \
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* PLAY AND DETECT SPEECH TEST MACROS - requires FST_SESSION */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define beginning of play_and_detect_speech recognizer test
|
||||||
|
*
|
||||||
|
* Defined vars:
|
||||||
|
* const char *fst_asr_result; Result of last recognition. Allocated from test memory pool.
|
||||||
|
*/
|
||||||
|
#define fst_play_and_detect_speech_test_begin() \
|
||||||
|
{ \
|
||||||
|
const char *fst_asr_result = NULL; \
|
||||||
|
fst_requires(fst_core > 1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use play_and_detect_speech APP to test recognizer
|
||||||
|
*
|
||||||
|
* Test Requires:
|
||||||
|
* switch_ivr_displace_session(input_filename) == SWITCH_STATUS_SUCCESS
|
||||||
|
* switch_core_session_execute_application(play_and_detect_speech) == SWITCH_STATUS_SUCCESS
|
||||||
|
* mod_dptools is loaded
|
||||||
|
*
|
||||||
|
* Test Checks:
|
||||||
|
* fst_asr_result != NULL after recognition completes
|
||||||
|
*
|
||||||
|
* Test Output:
|
||||||
|
* fst_asr_result has the result from detect_speech_result channel variable.
|
||||||
|
*
|
||||||
|
* @param recognizer name of recognizer
|
||||||
|
* @param grammar recognizer grammar
|
||||||
|
* @param prompt_filename name of prompt to play
|
||||||
|
* @param input_filename name of file containing input audio for the recognizer
|
||||||
|
*/
|
||||||
|
#define fst_play_and_detect_speech_app_test(recognizer, grammar, prompt_filename, input_filename) \
|
||||||
|
{ \
|
||||||
|
char *args = NULL; \
|
||||||
|
fst_requires(fst_core > 1); \
|
||||||
|
fst_requires_module("mod_dptools"); \
|
||||||
|
switch_channel_set_variable(fst_channel, "detect_speech_result", ""); \
|
||||||
|
fst_requires(switch_ivr_displace_session(fst_session, input_filename, 0, "mr") == SWITCH_STATUS_SUCCESS); \
|
||||||
|
args = switch_core_session_sprintf(fst_session, "%s detect:%s %s", prompt_filename, recognizer, grammar); \
|
||||||
|
fst_requires(switch_core_session_execute_application(fst_session, "play_and_detect_speech", args) == SWITCH_STATUS_SUCCESS); \
|
||||||
|
fst_asr_result = switch_channel_get_variable(fst_channel, "detect_speech_result"); \
|
||||||
|
fst_check(fst_asr_result != NULL); \
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use play_and_detect_speech core function to test recognizer
|
||||||
|
*
|
||||||
|
* Test Requires:
|
||||||
|
* switch_ivr_displace_session(input_filename) == SWITCH_STATUS_SUCCESS
|
||||||
|
*
|
||||||
|
* Test Checks:
|
||||||
|
* fst_asr_result != NULL after recognition completes
|
||||||
|
*
|
||||||
|
* Test Output:
|
||||||
|
* fst_asr_result has the result from detect_speech_result channel variable.
|
||||||
|
*
|
||||||
|
* @param recognizer name of recognizer
|
||||||
|
* @param grammar recognizer grammar
|
||||||
|
* @param prompt_filename name of prompt to play
|
||||||
|
* @param input_filename name of file containing input audio for the recognizer
|
||||||
|
* @param input_args input callback args
|
||||||
|
*/
|
||||||
|
#define fst_play_and_detect_speech_test(recognizer, grammar, prompt_filename, input_filename, input_args) \
|
||||||
|
{ \
|
||||||
|
char *args = NULL; \
|
||||||
|
fst_asr_result = NULL; \
|
||||||
|
fst_requires(fst_core > 1); \
|
||||||
|
fst_requires(switch_ivr_displace_session(fst_session, input_filename, 0, "mr") == SWITCH_STATUS_SUCCESS); \
|
||||||
|
switch_status_t status = switch_ivr_play_and_detect_speech(fst_session, prompt_filename, recognizer, grammar, (char **)&fst_asr_result, 0, input_args); \
|
||||||
|
fst_check(fst_asr_result != NULL); \
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define end of play_and_detect_speech recognizer test
|
||||||
|
*/
|
||||||
|
#define fst_play_and_detect_speech_test_end() \
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compare extension dialplan apps and args with expected apps and args
|
||||||
|
* @param expected NULL terminated string array of app arg and names.
|
||||||
|
* const char *expected[] = { "playback", "https://example.com/foo.wav", "park", "", NULL };
|
||||||
|
* @param extension the switch_caller_extension_t to check
|
||||||
|
*/
|
||||||
|
#define fst_check_extension_apps(expected, extension) \
|
||||||
|
{ \
|
||||||
|
fst_xcheck(extension != NULL, "Missing extension\n"); \
|
||||||
|
if (extension) { \
|
||||||
|
int i; \
|
||||||
|
switch_caller_application_t *cur_app = extension->applications; \
|
||||||
|
for (i = 0; ; i += 2, cur_app = cur_app->next) { \
|
||||||
|
int cur_app_num = i / 2 + 1; \
|
||||||
|
if (!expected[i]) { \
|
||||||
|
if (cur_app != NULL) { \
|
||||||
|
fst_fail(switch_core_sprintf(fst_pool, "Unexpected application #%d \"%s\"\n", cur_app_num, cur_app->application_name)); \
|
||||||
|
} \
|
||||||
|
break; \
|
||||||
|
} \
|
||||||
|
fst_xcheck(cur_app != NULL, switch_core_sprintf(fst_pool, "Extension application #%d \"%s\" is missing", cur_app_num, expected[i])); \
|
||||||
|
if (!cur_app) { \
|
||||||
|
break; \
|
||||||
|
} \
|
||||||
|
fst_xcheck(cur_app->application_name && !strcmp(expected[i], cur_app->application_name), switch_core_sprintf(fst_pool, "Expected application #%d name is \"%s\", but is \"%s\"\n", cur_app_num, expected[i], cur_app->application_name)); \
|
||||||
|
fst_xcheck(cur_app->application_data && !strcmp(expected[i + 1], cur_app->application_data), switch_core_sprintf(fst_pool, "Expected application #%d %s data is \"%s\", but is \"%s\"\n", cur_app_num, expected[i], expected[i + 1], cur_app->application_data)); \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inject DTMF into the session to be detected.
|
||||||
|
*
|
||||||
|
* Test Requires:
|
||||||
|
* switch_api_execute(sched_api) == SWITCH_STATUS_SUCCESS
|
||||||
|
* mod_commands is loaded
|
||||||
|
*
|
||||||
|
* @param when string describing when to send dtmf
|
||||||
|
* @param digits to send
|
||||||
|
*/
|
||||||
|
#define fst_sched_recv_dtmf(when, digits) \
|
||||||
|
{ \
|
||||||
|
switch_stream_handle_t stream = { 0 }; \
|
||||||
|
SWITCH_STANDARD_STREAM(stream); \
|
||||||
|
fst_requires(fst_core > 1); \
|
||||||
|
fst_requires_module("mod_commands"); \
|
||||||
|
switch_status_t api_result = switch_api_execute("sched_api", switch_core_session_sprintf(fst_session, "%s none uuid_recv_dtmf %s %s", when, switch_core_session_get_uuid(fst_session), digits), NULL, &stream); \
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fst_session), SWITCH_LOG_INFO, "Injecting DTMF %s at %s\n", digits, when); \
|
||||||
|
fst_requires(api_result == SWITCH_STATUS_SUCCESS); \
|
||||||
|
switch_safe_free(stream.data); \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define fst_xml_start() \
|
||||||
|
switch_stream_handle_t fst_xml_stream = { 0 }; \
|
||||||
|
SWITCH_STANDARD_STREAM(fst_xml_stream);
|
||||||
|
int fst_tag_children = 0;
|
||||||
|
int fst_tag_body = 0;
|
||||||
|
|
||||||
|
#define fst_xml_open_tag(tag_name) \
|
||||||
|
fst_xml_stream.write_function(&fst_xml_stream, "<%s", #tag_name); \
|
||||||
|
fst_tag_children++;
|
||||||
|
|
||||||
|
#define fst_xml_attr(attr) \
|
||||||
|
if (!zstr(attr)) fst_xml_stream.write_function(&fst_xml_stream, " %s=\"%s\"", #attr, attr);
|
||||||
|
|
||||||
|
#define fst_xml_close_tag(tag_name) \
|
||||||
|
--fst_tag_children; \
|
||||||
|
if (fst_tag_children > 0 || fst_tag_body) { \
|
||||||
|
fst_xml_stream.write_function(&fst_xml_stream, "</%s>", #tag_name); \
|
||||||
|
} else { \
|
||||||
|
fst_xml_stream.write_function(&fst_xml_stream, "/>"); \
|
||||||
|
} \
|
||||||
|
fst_tag_body = 0;
|
||||||
|
|
||||||
|
#define fst_xml_body(body) \
|
||||||
|
if (fst_tag_body) { \
|
||||||
|
fst_xml_stream.write_function(&fst_xml_stream, "%s", body); \
|
||||||
|
} else { \
|
||||||
|
fst_tag_body = 1; \
|
||||||
|
fst_xml_stream.write_function(&fst_xml_stream, ">%s", body); \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define fst_xml_end() \
|
||||||
|
switch_xml_parse_str_dynamic((char *)fst_xml_stream.data, SWITCH_FALSE);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse JSON file and save to varname
|
||||||
|
*
|
||||||
|
* Test Requires:
|
||||||
|
* JSON file can be opened and parsed
|
||||||
|
*
|
||||||
|
* Test Output:
|
||||||
|
* varname points at cJSON object
|
||||||
|
*
|
||||||
|
* @param varname name of var to store the resulting cJSON object
|
||||||
|
* @param file name of file to parse
|
||||||
|
*/
|
||||||
|
#define fst_parse_json_file(varname, file) \
|
||||||
|
cJSON *varname = NULL; \
|
||||||
|
{ \
|
||||||
|
char *buf; \
|
||||||
|
struct stat s; \
|
||||||
|
int size; \
|
||||||
|
int fd = open(file, O_RDONLY); \
|
||||||
|
fst_requires(fd >= 0); \
|
||||||
|
fstat(fd, &s); \
|
||||||
|
buf = malloc(s.st_size + 1); \
|
||||||
|
fst_requires(buf); \
|
||||||
|
size = read(fd, buf, s.st_size); \
|
||||||
|
fst_requires(size == s.st_size); \
|
||||||
|
close(fd); \
|
||||||
|
varname = cJSON_Parse(buf); \
|
||||||
|
free(buf); \
|
||||||
|
fst_requires(varname); \
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -9,6 +9,8 @@ mod_av_la_CFLAGS = $(AM_CFLAGS) $(AVFORMAT_CFLAGS) $(AVCODEC_CFLAGS) $(SWSCALE
|
|||||||
mod_av_la_LIBADD = $(switch_builddir)/libfreeswitch.la $(AVFORMAT_LIBS) $(AVCODEC_LIBS) $(SWSCALE_LIBS) $(AVUTIL_LIBS) $(AVRESAMPLE_LIBS)
|
mod_av_la_LIBADD = $(switch_builddir)/libfreeswitch.la $(AVFORMAT_LIBS) $(AVCODEC_LIBS) $(SWSCALE_LIBS) $(AVUTIL_LIBS) $(AVRESAMPLE_LIBS)
|
||||||
mod_av_la_LDFLAGS = -avoid-version -module -no-undefined -shared -lm -lz
|
mod_av_la_LDFLAGS = -avoid-version -module -no-undefined -shared -lm -lz
|
||||||
|
|
||||||
|
SUBDIRS=. test
|
||||||
|
|
||||||
else
|
else
|
||||||
install: error
|
install: error
|
||||||
all: error
|
all: error
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
<!-- <param name="key-frame-min-freq" value="250"/> -->
|
<!-- <param name="key-frame-min-freq" value="250"/> -->
|
||||||
|
|
||||||
<!-- integer of cpus, or 'auto', or 'cpu/<divisor>/<max> -->
|
<!-- integer of cpus, or 'auto', or 'cpu/<divisor>/<max> -->
|
||||||
<param name="dec-threads" value="cpu/2/4"/>
|
<param name="dec-threads" value="1"/>
|
||||||
<param name="enc-threads" value="cpu/2/4"/>
|
<param name="enc-threads" value="cpu/2/4"/>
|
||||||
<param name="h263-profile" value="H263"/>
|
<param name="h263-profile" value="H263"/>
|
||||||
<param name="h263+-profile" value="H263+"/>
|
<param name="h263+-profile" value="H263+"/>
|
||||||
|
@ -1089,14 +1089,16 @@ static void set_h264_private_data(h264_codec_context_t *context, avcodec_profile
|
|||||||
if (context->hw_encoder) {
|
if (context->hw_encoder) {
|
||||||
av_opt_set(context->encoder_ctx->priv_data, "preset", "llhp", 0);
|
av_opt_set(context->encoder_ctx->priv_data, "preset", "llhp", 0);
|
||||||
av_opt_set_int(context->encoder_ctx->priv_data, "2pass", 1, 0);
|
av_opt_set_int(context->encoder_ctx->priv_data, "2pass", 1, 0);
|
||||||
|
av_opt_set_int(context->encoder_ctx->priv_data, "delay", 0, 0);
|
||||||
|
av_opt_set(context->encoder_ctx->priv_data, "forced-idr", "true", 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
av_opt_set(context->encoder_ctx->priv_data, "preset", "veryfast", 0);
|
av_opt_set(context->encoder_ctx->priv_data, "preset", "veryfast", 0);
|
||||||
av_opt_set(context->encoder_ctx->priv_data, "intra-refresh", "1", 0);
|
av_opt_set(context->encoder_ctx->priv_data, "intra-refresh", "1", 0);
|
||||||
av_opt_set(context->encoder_ctx->priv_data, "tune", "animation+zerolatency", 0);
|
av_opt_set(context->encoder_ctx->priv_data, "tune", "animation+zerolatency", 0);
|
||||||
av_opt_set(context->encoder_ctx->priv_data, "sc_threshold", "40", 0);
|
//av_opt_set(context->encoder_ctx->priv_data, "sc_threshold", "40", 0);
|
||||||
av_opt_set(context->encoder_ctx->priv_data, "crf", "18", 0);
|
//av_opt_set(context->encoder_ctx->priv_data, "crf", "18", 0);
|
||||||
|
|
||||||
if (profile->options) {
|
if (profile->options) {
|
||||||
switch_event_header_t *hp;
|
switch_event_header_t *hp;
|
||||||
@ -1269,22 +1271,19 @@ GCC_DIAG_ON(deprecated-declarations)
|
|||||||
return SWITCH_STATUS_FALSE;
|
return SWITCH_STATUS_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Could not open hardware codec %s, trying software encoder\n", codec_string);
|
if (context->encoder_ctx) {
|
||||||
|
if (avcodec_is_open(context->encoder_ctx)) {
|
||||||
|
avcodec_close(context->encoder_ctx);
|
||||||
|
}
|
||||||
|
av_free(context->encoder_ctx);
|
||||||
|
context->encoder_ctx = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
context->encoder = NULL;
|
||||||
context->hw_encoder = 0;
|
context->hw_encoder = 0;
|
||||||
av_opt_free(context->encoder_ctx->priv_data);
|
context->codec_settings.video.try_hardware_encoder = 0;
|
||||||
set_h264_private_data(context, profile);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Could not open hardware codec %s, trying software encoder\n", codec_string);
|
||||||
context->encoder = avcodec_find_encoder(context->av_codec_id);
|
return open_encoder(context, width, height);
|
||||||
|
|
||||||
if (!context->encoder) {
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot find encoder id: %d\n", context->av_codec_id);
|
|
||||||
return SWITCH_STATUS_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (avcodec_open2(context->encoder_ctx, context->encoder, NULL) < 0) {
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not open codec %s\n", codec_string);
|
|
||||||
return SWITCH_STATUS_FALSE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "codec opened: %s\n", codec_string);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "codec opened: %s\n", codec_string);
|
||||||
@ -1993,6 +1992,9 @@ static void load_config()
|
|||||||
|
|
||||||
val = atoi(value);
|
val = atoi(value);
|
||||||
|
|
||||||
|
ctx->profile = FF_PROFILE_H264_BASELINE;
|
||||||
|
ctx->level = 31;
|
||||||
|
|
||||||
if (!strcmp(name, "dec-threads")) {
|
if (!strcmp(name, "dec-threads")) {
|
||||||
aprofile->decoder_thread_count = switch_parse_cpu_string(value);
|
aprofile->decoder_thread_count = switch_parse_cpu_string(value);
|
||||||
} else if (!strcmp(name, "enc-threads")) {
|
} else if (!strcmp(name, "enc-threads")) {
|
||||||
|
@ -51,6 +51,13 @@ GCC_DIAG_ON(deprecated-declarations)
|
|||||||
|
|
||||||
#define AV_TS_MAX_STRING_SIZE 32
|
#define AV_TS_MAX_STRING_SIZE 32
|
||||||
|
|
||||||
|
// Compatibility with old libav on Debian Jessie
|
||||||
|
// Not required if libavcodec version > 56.34.1
|
||||||
|
#ifndef AV_CODEC_FLAG_LOOP_FILTER
|
||||||
|
#define AV_CODEC_FLAG_LOOP_FILTER CODEC_FLAG_LOOP_FILTER
|
||||||
|
#define AV_CODEC_FLAG_GLOBAL_HEADER CODEC_FLAG_GLOBAL_HEADER
|
||||||
|
#define AV_CODEC_CAP_VARIABLE_FRAME_SIZE CODEC_CAP_VARIABLE_FRAME_SIZE
|
||||||
|
#endif
|
||||||
|
|
||||||
/* App interface */
|
/* App interface */
|
||||||
|
|
||||||
@ -479,13 +486,14 @@ GCC_DIAG_ON(deprecated-declarations)
|
|||||||
c->ticks_per_frame = 2;
|
c->ticks_per_frame = 2;
|
||||||
|
|
||||||
|
|
||||||
c->flags|=CODEC_FLAG_LOOP_FILTER; // flags=+loop
|
c->flags|=AV_CODEC_FLAG_LOOP_FILTER; // flags=+loop
|
||||||
c->me_cmp|= 1; // cmp=+chroma, where CHROMA = 1
|
c->me_cmp|= 1; // cmp=+chroma, where CHROMA = 1
|
||||||
c->me_range = 16; // me_range=16
|
c->me_range = 16; // me_range=16
|
||||||
c->max_b_frames = 3; // bf=3
|
c->max_b_frames = 3; // bf=3
|
||||||
|
|
||||||
av_opt_set_int(c->priv_data, "b_strategy", 1, 0);
|
av_opt_set_int(c->priv_data, "b_strategy", 1, 0);
|
||||||
av_opt_set_int(c->priv_data, "motion_est", ME_HEX, 0);
|
//av_opt_set_int(c->priv_data, "motion_est", ME_HEX, 0);
|
||||||
|
av_opt_set(c->priv_data, "motion_est", "hex", 0);
|
||||||
av_opt_set_int(c->priv_data, "coder", 1, 0);
|
av_opt_set_int(c->priv_data, "coder", 1, 0);
|
||||||
|
|
||||||
switch (mm->vprofile) {
|
switch (mm->vprofile) {
|
||||||
@ -568,7 +576,7 @@ GCC_DIAG_ON(deprecated-declarations)
|
|||||||
|
|
||||||
/* Some formats want stream headers to be separate. */
|
/* Some formats want stream headers to be separate. */
|
||||||
if (fc->oformat->flags & AVFMT_GLOBALHEADER) {
|
if (fc->oformat->flags & AVFMT_GLOBALHEADER) {
|
||||||
c->flags |= CODEC_FLAG_GLOBAL_HEADER;
|
c->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
|
||||||
}
|
}
|
||||||
|
|
||||||
mst->active = 1;
|
mst->active = 1;
|
||||||
@ -660,7 +668,7 @@ GCC_DIAG_ON(deprecated-declarations)
|
|||||||
mst->frame->format = AV_SAMPLE_FMT_S16;
|
mst->frame->format = AV_SAMPLE_FMT_S16;
|
||||||
mst->frame->channel_layout = c->channel_layout;
|
mst->frame->channel_layout = c->channel_layout;
|
||||||
|
|
||||||
if (c->codec->capabilities & CODEC_CAP_VARIABLE_FRAME_SIZE) {
|
if (c->codec->capabilities & AV_CODEC_CAP_VARIABLE_FRAME_SIZE) {
|
||||||
//mst->frame->nb_samples = 10000;
|
//mst->frame->nb_samples = 10000;
|
||||||
mst->frame->nb_samples = (mst->frame->sample_rate / 50) * c->channels;
|
mst->frame->nb_samples = (mst->frame->sample_rate / 50) * c->channels;
|
||||||
} else {
|
} else {
|
||||||
@ -2357,6 +2365,7 @@ static switch_status_t av_file_read_video(switch_file_handle_t *handle, switch_f
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (pop && status == SWITCH_STATUS_SUCCESS) {
|
if (pop && status == SWITCH_STATUS_SUCCESS) {
|
||||||
|
switch_img_free(&context->last_img);
|
||||||
context->last_img = (switch_image_t *)pop;
|
context->last_img = (switch_image_t *)pop;
|
||||||
switch_img_copy(context->last_img, &frame->img);
|
switch_img_copy(context->last_img, &frame->img);
|
||||||
context->vid_ready = 1;
|
context->vid_ready = 1;
|
||||||
@ -2467,6 +2476,7 @@ GCC_DIAG_ON(deprecated-declarations)
|
|||||||
if (switch_micro_time_now() - mst->next_pts > -10000) {
|
if (switch_micro_time_now() - mst->next_pts > -10000) {
|
||||||
frame->img = img;
|
frame->img = img;
|
||||||
} else {
|
} else {
|
||||||
|
switch_img_free(&context->last_img);
|
||||||
context->last_img = img;
|
context->last_img = img;
|
||||||
return SWITCH_STATUS_BREAK;
|
return SWITCH_STATUS_BREAK;
|
||||||
}
|
}
|
||||||
|
4
src/mod/applications/mod_av/test/Makefile.am
Normal file
4
src/mod/applications/mod_av/test/Makefile.am
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
bin_PROGRAMS = test_mod_av
|
||||||
|
AM_CFLAGS = $(SWITCH_AM_CFLAGS) -I../ $(AVFORMAT_CFLAGS) $(AVCODEC_CFLAGS) $(SWSCALE_CFLAGS) $(AVUTIL_CFLAGS) $(AVRESAMPLE_CFALGS)
|
||||||
|
AM_LDFLAGS = $(switch_builddir)/libfreeswitch.la $(AVFORMAT_LIBS) $(AVCODEC_LIBS) $(SWSCALE_LIBS) $(AVUTIL_LIBS) $(AVRESAMPLE_LIBS) -avoid-version -no-undefined $(SWITCH_AM_LDFLAGS) ../mod_av.la
|
||||||
|
TESTS = $(bin_PROGRAMS)
|
40
src/mod/applications/mod_av/test/conf/freeswitch.xml
Normal file
40
src/mod/applications/mod_av/test/conf/freeswitch.xml
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<document type="freeswitch/xml">
|
||||||
|
|
||||||
|
<section name="configuration" description="Various Configuration">
|
||||||
|
<configuration name="modules.conf" description="Modules">
|
||||||
|
<modules>
|
||||||
|
<load module="mod_console"/>
|
||||||
|
</modules>
|
||||||
|
</configuration>
|
||||||
|
|
||||||
|
<configuration name="console.conf" description="Console Logger">
|
||||||
|
<mappings>
|
||||||
|
<map name="all" value="console,debug,info,notice,warning,err,crit,alert"/>
|
||||||
|
</mappings>
|
||||||
|
<settings>
|
||||||
|
<param name="colorize" value="true"/>
|
||||||
|
<param name="loglevel" value="debug"/>
|
||||||
|
</settings>
|
||||||
|
</configuration>
|
||||||
|
|
||||||
|
<configuration name="timezones.conf" description="Timezones">
|
||||||
|
<timezones>
|
||||||
|
<zone name="GMT" value="GMT0" />
|
||||||
|
</timezones>
|
||||||
|
</configuration>
|
||||||
|
|
||||||
|
<X-PRE-PROCESS cmd="include" data="./vpx.conf.xml"/>
|
||||||
|
<X-PRE-PROCESS cmd="include" data="./av.conf.xml"/>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section name="dialplan" description="Regex/XML Dialplan">
|
||||||
|
<context name="default">
|
||||||
|
<extension name="sample">
|
||||||
|
<condition>
|
||||||
|
<action application="info"/>
|
||||||
|
</condition>
|
||||||
|
</extension>
|
||||||
|
</context>
|
||||||
|
</section>
|
||||||
|
</document>
|
203
src/mod/applications/mod_av/test/test_mod_av.2017.vcxproj
Normal file
203
src/mod/applications/mod_av/test/test_mod_av.2017.vcxproj
Normal file
@ -0,0 +1,203 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Debug|x64">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|x64">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
</ItemGroup>
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<ProjectName>test_mod_av</ProjectName>
|
||||||
|
<RootNamespace>test_mod_av</RootNamespace>
|
||||||
|
<Keyword>Win32Proj</Keyword>
|
||||||
|
<WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
|
||||||
|
<ProjectGuid>{7926CB0D-62CE-4A09-AE94-1DA2BC92D625}</ProjectGuid>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
<Import Project="$(SolutionDir)w32\winlibs.props" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
<Import Project="$(SolutionDir)w32\winlibs.props" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
<Import Project="$(SolutionDir)w32\winlibs.props" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
<Import Project="$(SolutionDir)w32\winlibs.props" />
|
||||||
|
</ImportGroup>
|
||||||
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
|
||||||
|
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(PlatformName)\$(Configuration)\</OutDir>
|
||||||
|
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(PlatformName)\$(Configuration)\</IntDir>
|
||||||
|
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</LinkIncremental>
|
||||||
|
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(PlatformName)\$(Configuration)\</OutDir>
|
||||||
|
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir>
|
||||||
|
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</LinkIncremental>
|
||||||
|
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(PlatformName)\$(Configuration)\</OutDir>
|
||||||
|
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(PlatformName)\$(Configuration)\</IntDir>
|
||||||
|
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
|
||||||
|
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
|
||||||
|
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir>
|
||||||
|
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemDefinitionGroup>
|
||||||
|
<ClCompile>
|
||||||
|
<AdditionalIncludeDirectories>$(SolutionDir)src\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<PreprocessorDefinitions>SWITCH_TEST_BASE_DIR_FOR_CONF="..\\..\\src\\mod\\applications\\mod_av\\test\\";%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<BuildLog />
|
||||||
|
<ClCompile>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<MinimalRebuild>true</MinimalRebuild>
|
||||||
|
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||||
|
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level4</WarningLevel>
|
||||||
|
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||||
|
<EnablePREfast>true</EnablePREfast>
|
||||||
|
<DisableSpecificWarnings>6031;6340;6246;6011;6387;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<RandomizedBaseAddress>true</RandomizedBaseAddress>
|
||||||
|
<DataExecutionPrevention>
|
||||||
|
</DataExecutionPrevention>
|
||||||
|
<TargetMachine>MachineX86</TargetMachine>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<BuildLog />
|
||||||
|
<Midl>
|
||||||
|
<TargetEnvironment>X64</TargetEnvironment>
|
||||||
|
</Midl>
|
||||||
|
<ClCompile>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<MinimalRebuild>true</MinimalRebuild>
|
||||||
|
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||||
|
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level4</WarningLevel>
|
||||||
|
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||||
|
<EnablePREfast>true</EnablePREfast>
|
||||||
|
<DisableSpecificWarnings>6031;6340;6246;6011;6387;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<RandomizedBaseAddress>true</RandomizedBaseAddress>
|
||||||
|
<DataExecutionPrevention>
|
||||||
|
</DataExecutionPrevention>
|
||||||
|
<TargetMachine>MachineX64</TargetMachine>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<BuildLog />
|
||||||
|
<ClCompile>
|
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level4</WarningLevel>
|
||||||
|
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||||
|
<DisableSpecificWarnings>6031;6340;6246;6011;6387;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
|
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<RandomizedBaseAddress>true</RandomizedBaseAddress>
|
||||||
|
<DataExecutionPrevention>
|
||||||
|
</DataExecutionPrevention>
|
||||||
|
<TargetMachine>MachineX86</TargetMachine>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<BuildLog />
|
||||||
|
<Midl>
|
||||||
|
<TargetEnvironment>X64</TargetEnvironment>
|
||||||
|
</Midl>
|
||||||
|
<ClCompile>
|
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level4</WarningLevel>
|
||||||
|
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||||
|
<DisableSpecificWarnings>6031;6340;6246;6011;6387;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
|
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<RandomizedBaseAddress>true</RandomizedBaseAddress>
|
||||||
|
<DataExecutionPrevention>
|
||||||
|
</DataExecutionPrevention>
|
||||||
|
<TargetMachine>MachineX64</TargetMachine>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="test_mod_av.c" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="$(SolutionDir)w32\Library\FreeSwitchCore.2017.vcxproj">
|
||||||
|
<Project>{202d7a4e-760d-4d0e-afa1-d7459ced30ff}</Project>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
145
src/mod/applications/mod_av/test/test_mod_av.c
Normal file
145
src/mod/applications/mod_av/test/test_mod_av.c
Normal file
@ -0,0 +1,145 @@
|
|||||||
|
/*
|
||||||
|
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||||
|
* Copyright (C) 2005-2018, 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):
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* mod_av_test -- avcodec tests
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <test/switch_test.h>
|
||||||
|
|
||||||
|
int loop = 0;
|
||||||
|
|
||||||
|
/* Add our command line options. */
|
||||||
|
static fctcl_init_t my_cl_options[] = {
|
||||||
|
{"--disable-hw", /* long_opt */
|
||||||
|
NULL, /* short_opt (optional) */
|
||||||
|
FCTCL_STORE_TRUE , /* action */
|
||||||
|
"disable hardware encoder" /* help */
|
||||||
|
},
|
||||||
|
|
||||||
|
{"--loop", /* long_opt */
|
||||||
|
NULL, /* short_opt (optional) */
|
||||||
|
FCTCL_STORE_VALUE , /* action */
|
||||||
|
"loops to encode a picture" /* help */
|
||||||
|
},
|
||||||
|
FCTCL_INIT_NULL /* Sentinel */
|
||||||
|
};
|
||||||
|
|
||||||
|
FST_CORE_BEGIN("conf")
|
||||||
|
{
|
||||||
|
fctcl_install(my_cl_options);
|
||||||
|
|
||||||
|
const char *loop_ = fctcl_val("--loop");
|
||||||
|
if (loop_) loop = atoi(loop_);
|
||||||
|
|
||||||
|
FST_MODULE_BEGIN(mod_av, mod_av_test)
|
||||||
|
{
|
||||||
|
FST_SETUP_BEGIN()
|
||||||
|
{
|
||||||
|
// fst_requires_module("mod_av");
|
||||||
|
}
|
||||||
|
FST_SETUP_END()
|
||||||
|
|
||||||
|
FST_TEST_BEGIN(encoder_test)
|
||||||
|
{
|
||||||
|
switch_status_t status;
|
||||||
|
switch_codec_t codec = { 0 };
|
||||||
|
switch_codec_settings_t codec_settings = { 0 };
|
||||||
|
|
||||||
|
// switch_set_string(codec_settings.video.config_profile_name, "conference");
|
||||||
|
|
||||||
|
if (!fctcl_is("--disable-hw")) {
|
||||||
|
codec_settings.video.try_hardware_encoder = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
status = switch_core_codec_init(&codec,
|
||||||
|
"H264",
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
|
||||||
|
&codec_settings, fst_pool);
|
||||||
|
fst_check(status == SWITCH_STATUS_SUCCESS);
|
||||||
|
|
||||||
|
switch_image_t *img = switch_img_alloc(NULL, SWITCH_IMG_FMT_I420, 1280, 720, 1);
|
||||||
|
fst_requires(img);
|
||||||
|
|
||||||
|
uint8_t buf[SWITCH_DEFAULT_VIDEO_SIZE + 12];
|
||||||
|
switch_frame_t frame = { 0 };
|
||||||
|
|
||||||
|
frame.packet = buf;
|
||||||
|
frame.packetlen = SWITCH_DEFAULT_VIDEO_SIZE + 12;
|
||||||
|
frame.data = buf + 12;
|
||||||
|
frame.datalen = SWITCH_DEFAULT_VIDEO_SIZE;
|
||||||
|
frame.payload = 96;
|
||||||
|
frame.m = 0;
|
||||||
|
frame.seq = 0;
|
||||||
|
frame.timestamp = 0;
|
||||||
|
frame.img = img;
|
||||||
|
|
||||||
|
int packets = 0;
|
||||||
|
switch_status_t encode_status;
|
||||||
|
|
||||||
|
do {
|
||||||
|
frame.datalen = SWITCH_DEFAULT_VIDEO_SIZE;
|
||||||
|
encode_status = switch_core_codec_encode_video(&codec, &frame);
|
||||||
|
|
||||||
|
if (encode_status == SWITCH_STATUS_SUCCESS || encode_status == SWITCH_STATUS_MORE_DATA) {
|
||||||
|
|
||||||
|
fst_requires((encode_status == SWITCH_STATUS_SUCCESS && frame.m) || !frame.m);
|
||||||
|
|
||||||
|
if (frame.flags & SFF_PICTURE_RESET) {
|
||||||
|
frame.flags &= ~SFF_PICTURE_RESET;
|
||||||
|
fst_check(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
packets++;
|
||||||
|
}
|
||||||
|
|
||||||
|
} while(encode_status == SWITCH_STATUS_MORE_DATA || loop-- > 1);
|
||||||
|
|
||||||
|
fst_check(frame.m == 1);
|
||||||
|
fst_check(packets > 0);
|
||||||
|
|
||||||
|
switch_core_codec_destroy(&codec);
|
||||||
|
}
|
||||||
|
FST_TEST_END()
|
||||||
|
|
||||||
|
FST_TEARDOWN_BEGIN()
|
||||||
|
{
|
||||||
|
const char *err = NULL;
|
||||||
|
switch_sleep(1000000);
|
||||||
|
fst_check(switch_loadable_module_unload_module(SWITCH_GLOBAL_dirs.mod_dir, (char *)"mod_av", SWITCH_TRUE, &err) == SWITCH_STATUS_SUCCESS);
|
||||||
|
}
|
||||||
|
FST_TEARDOWN_END()
|
||||||
|
}
|
||||||
|
FST_MODULE_END()
|
||||||
|
}
|
||||||
|
FST_CORE_END()
|
@ -2709,6 +2709,9 @@ switch_status_t conference_api_sub_file_seek(conference_obj_t *conference, switc
|
|||||||
|
|
||||||
switch_status_t conference_api_set_moh(conference_obj_t *conference, const char *what)
|
switch_status_t conference_api_set_moh(conference_obj_t *conference, const char *what)
|
||||||
{
|
{
|
||||||
|
if (!what) {
|
||||||
|
return SWITCH_STATUS_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
if (!strcasecmp(what, "toggle")) {
|
if (!strcasecmp(what, "toggle")) {
|
||||||
if (conference_utils_test_flag(conference, CFLAG_NO_MOH)) {
|
if (conference_utils_test_flag(conference, CFLAG_NO_MOH)) {
|
||||||
@ -2737,7 +2740,15 @@ switch_status_t conference_api_set_moh(conference_obj_t *conference, const char
|
|||||||
switch_status_t conference_api_sub_moh(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv)
|
switch_status_t conference_api_sub_moh(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
|
||||||
conference_api_set_moh(conference, argv[2]);
|
if (conference_api_set_moh(conference, argv[2]) == SWITCH_STATUS_SUCCESS) {
|
||||||
|
if (stream) {
|
||||||
|
stream->write_function(stream, "+OK moh\n");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (stream) {
|
||||||
|
stream->write_function(stream, "-ERR invalid moh param\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
@ -4084,6 +4095,8 @@ switch_status_t conference_api_sub_json_list(conference_obj_t *conference, switc
|
|||||||
switch_assert(ebuf);
|
switch_assert(ebuf);
|
||||||
stream->write_function(stream, "%s", ebuf);
|
stream->write_function(stream, "%s", ebuf);
|
||||||
free(ebuf);
|
free(ebuf);
|
||||||
|
|
||||||
|
cJSON_Delete(conferences);
|
||||||
|
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -248,7 +248,7 @@ switch_status_t conference_file_play(conference_obj_t *conference, char *file, u
|
|||||||
|
|
||||||
flags = SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT;
|
flags = SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT;
|
||||||
|
|
||||||
if (conference_utils_test_flag(conference, CFLAG_TRANSCODE_VIDEO)) {
|
if (conference_utils_test_flag(conference, CFLAG_TRANSCODE_VIDEO) && conference->conference_video_mode == CONF_VIDEO_MODE_MUX) {
|
||||||
flags |= SWITCH_FILE_FLAG_VIDEO;
|
flags |= SWITCH_FILE_FLAG_VIDEO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
<configuration name="curl.conf" description="cURL module">
|
||||||
|
<settings>
|
||||||
|
<param name="max-bytes" value="64000"/>
|
||||||
|
</settings>
|
||||||
|
</configuration>
|
@ -55,11 +55,20 @@ static char *SYNTAX = "curl url [headers|json|content-type <mime-type>|connect-t
|
|||||||
#define HTTP_SENDFILE_ACK_EVENT "curl_sendfile::ack"
|
#define HTTP_SENDFILE_ACK_EVENT "curl_sendfile::ack"
|
||||||
#define HTTP_SENDFILE_RESPONSE_SIZE 32768
|
#define HTTP_SENDFILE_RESPONSE_SIZE 32768
|
||||||
#define HTTP_MAX_APPEND_HEADERS 10
|
#define HTTP_MAX_APPEND_HEADERS 10
|
||||||
|
#define HTTP_DEFAULT_MAX_BYTES 64000
|
||||||
|
|
||||||
static struct {
|
static struct {
|
||||||
switch_memory_pool_t *pool;
|
switch_memory_pool_t *pool;
|
||||||
|
switch_event_node_t *node;
|
||||||
|
int max_bytes;
|
||||||
} globals;
|
} globals;
|
||||||
|
|
||||||
|
static switch_xml_config_item_t instructions[] = {
|
||||||
|
/* parameter name type reloadable pointer default value options structure */
|
||||||
|
SWITCH_CONFIG_ITEM("max-bytes", SWITCH_CONFIG_INT, CONFIG_RELOADABLE, &globals.max_bytes, (void *) HTTP_DEFAULT_MAX_BYTES, NULL,NULL, NULL),
|
||||||
|
SWITCH_CONFIG_ITEM_END()
|
||||||
|
};
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
CSO_NONE = (1 << 0),
|
CSO_NONE = (1 << 0),
|
||||||
CSO_EVENT = (1 << 1),
|
CSO_EVENT = (1 << 1),
|
||||||
@ -173,7 +182,7 @@ static http_data_t *do_lookup_url(switch_memory_pool_t *pool, const char *url, c
|
|||||||
memset(http_data, 0, sizeof(http_data_t));
|
memset(http_data, 0, sizeof(http_data_t));
|
||||||
http_data->pool = pool;
|
http_data->pool = pool;
|
||||||
|
|
||||||
http_data->max_bytes = 64000;
|
http_data->max_bytes = globals.max_bytes;
|
||||||
SWITCH_STANDARD_STREAM(http_data->stream);
|
SWITCH_STANDARD_STREAM(http_data->stream);
|
||||||
|
|
||||||
if (!method) {
|
if (!method) {
|
||||||
@ -1037,24 +1046,44 @@ SWITCH_STANDARD_API(curl_function)
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void do_config(switch_bool_t reload)
|
||||||
|
{
|
||||||
|
globals.max_bytes = HTTP_DEFAULT_MAX_BYTES;
|
||||||
|
|
||||||
|
switch_xml_config_parse_module_settings("curl.conf", reload, instructions);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void event_handler(switch_event_t *event)
|
||||||
|
{
|
||||||
|
do_config(SWITCH_TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
/* Macro expands to: switch_status_t mod_cidlookup_load(switch_loadable_module_interface_t **module_interface, switch_memory_pool_t *pool) */
|
/* Macro expands to: switch_status_t mod_cidlookup_load(switch_loadable_module_interface_t **module_interface, switch_memory_pool_t *pool) */
|
||||||
SWITCH_MODULE_LOAD_FUNCTION(mod_curl_load)
|
SWITCH_MODULE_LOAD_FUNCTION(mod_curl_load)
|
||||||
{
|
{
|
||||||
switch_api_interface_t *api_interface;
|
switch_api_interface_t *api_interface;
|
||||||
switch_application_interface_t *app_interface;
|
switch_application_interface_t *app_interface;
|
||||||
|
|
||||||
|
memset(&globals, 0, sizeof(globals));
|
||||||
|
|
||||||
if (switch_event_reserve_subclass(HTTP_SENDFILE_ACK_EVENT) != SWITCH_STATUS_SUCCESS) {
|
if (switch_event_reserve_subclass(HTTP_SENDFILE_ACK_EVENT) != SWITCH_STATUS_SUCCESS) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", HTTP_SENDFILE_ACK_EVENT);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", HTTP_SENDFILE_ACK_EVENT);
|
||||||
return SWITCH_STATUS_TERM;
|
return SWITCH_STATUS_TERM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((switch_event_bind_removable(modname, SWITCH_EVENT_RELOADXML, NULL, event_handler, NULL, &globals.node) != SWITCH_STATUS_SUCCESS)) {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind event!\n");
|
||||||
|
switch_event_free_subclass(HTTP_SENDFILE_ACK_EVENT);
|
||||||
|
return SWITCH_STATUS_TERM;
|
||||||
|
}
|
||||||
|
|
||||||
/* connect my internal structure to the blank pointer passed to me */
|
/* connect my internal structure to the blank pointer passed to me */
|
||||||
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
|
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
|
||||||
|
|
||||||
memset(&globals, 0, sizeof(globals));
|
|
||||||
|
|
||||||
globals.pool = pool;
|
globals.pool = pool;
|
||||||
|
|
||||||
|
do_config(SWITCH_FALSE);
|
||||||
|
|
||||||
SWITCH_ADD_API(api_interface, "curl", "curl API", curl_function, SYNTAX);
|
SWITCH_ADD_API(api_interface, "curl", "curl API", curl_function, SYNTAX);
|
||||||
SWITCH_ADD_APP(app_interface, "curl", "Perform a http request", "Perform a http request",
|
SWITCH_ADD_APP(app_interface, "curl", "Perform a http request", "Perform a http request",
|
||||||
curl_app_function, SYNTAX, SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC);
|
curl_app_function, SYNTAX, SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC);
|
||||||
@ -1074,6 +1103,10 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_curl_shutdown)
|
|||||||
|
|
||||||
switch_event_free_subclass(HTTP_SENDFILE_ACK_EVENT);
|
switch_event_free_subclass(HTTP_SENDFILE_ACK_EVENT);
|
||||||
|
|
||||||
|
switch_xml_config_cleanup(instructions);
|
||||||
|
|
||||||
|
switch_event_unbind(&globals.node);
|
||||||
|
|
||||||
/* Cleanup dynamically allocated config settings */
|
/* Cleanup dynamically allocated config settings */
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
27
src/mod/applications/mod_signalwire/Makefile.am
Normal file
27
src/mod/applications/mod_signalwire/Makefile.am
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
include $(top_srcdir)/build/modmake.rulesam
|
||||||
|
MODNAME=mod_signalwire
|
||||||
|
|
||||||
|
if HAVE_KS
|
||||||
|
if HAVE_SIGNALWIRE_CLIENT
|
||||||
|
|
||||||
|
mod_LTLIBRARIES = mod_signalwire.la
|
||||||
|
mod_signalwire_la_SOURCES = mod_signalwire.c
|
||||||
|
mod_signalwire_la_CFLAGS = $(AM_CFLAGS)
|
||||||
|
mod_signalwire_la_CFLAGS += $(KS_CFLAGS) $(SIGNALWIRE_CLIENT_CFLAGS)
|
||||||
|
mod_signalwire_la_LIBADD = $(switch_builddir)/libfreeswitch.la
|
||||||
|
mod_signalwire_la_LDFLAGS = -avoid-version -module -no-undefined -shared $(KS_LIBS) $(SIGNALWIRE_CLIENT_LIBS)
|
||||||
|
|
||||||
|
else
|
||||||
|
install: error
|
||||||
|
all: error
|
||||||
|
error:
|
||||||
|
$(error You must install signalwire-client-c to build mod_signalwire)
|
||||||
|
endif
|
||||||
|
|
||||||
|
else
|
||||||
|
install: error
|
||||||
|
all: error
|
||||||
|
error:
|
||||||
|
$(error You must install libks to build mod_signalwire)
|
||||||
|
endif
|
||||||
|
|
@ -0,0 +1,10 @@
|
|||||||
|
<configuration name="signalwire.conf" description="SignalWire">
|
||||||
|
<settings>
|
||||||
|
<!-- on/off/file-path -->
|
||||||
|
<!--param name="kslog" value="on"/-->
|
||||||
|
<!--param name="blade-bootstrap" value="blade://switchblade:2100"/-->
|
||||||
|
<!--param name="adoption-service" value="https://adopt.signalwire.com/adoption"/-->
|
||||||
|
<!--param name="stun-server" value="stun.freeswitch.org"/-->
|
||||||
|
<!-- <authentication></authentication> -->
|
||||||
|
</settings>
|
||||||
|
</configuration>
|
149
src/mod/applications/mod_signalwire/mod_signalwire.2017.vcxproj
Normal file
149
src/mod/applications/mod_signalwire/mod_signalwire.2017.vcxproj
Normal file
@ -0,0 +1,149 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Debug|x64">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|x64">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
</ItemGroup>
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<ProjectName>mod_signalwire</ProjectName>
|
||||||
|
<RootNamespace>mod_signalwire</RootNamespace>
|
||||||
|
<Keyword>Win32Proj</Keyword>
|
||||||
|
<ProjectGuid>{B19AE6FC-BFFF-428D-B483-3BBEAECCC618}</ProjectGuid>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
|
<Import Project="$(SolutionDir)\w32\libks.props" Condition=" '$(libksPropsImported)' == '' " />
|
||||||
|
<Import Project="$(SolutionDir)\w32\signalwire-client-c.props" Condition=" '$(signalwire-client-cPropsImported)' == '' " />
|
||||||
|
<Import Project="$(SolutionDir)\w32\openssl.props" Condition=" '$(OpensslPropsImported)' == '' " />
|
||||||
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
<Import Project="..\..\..\..\w32\module_release.props" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
<Import Project="..\..\..\..\w32\module_debug.props" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
<Import Project="..\..\..\..\w32\module_release.props" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
<Import Project="..\..\..\..\w32\module_debug.props" />
|
||||||
|
</ImportGroup>
|
||||||
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemDefinitionGroup>
|
||||||
|
<ClCompile>
|
||||||
|
<AdditionalIncludeDirectories>.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<PreprocessorDefinitions>_DEBUG;DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||||
|
<DataExecutionPrevention>
|
||||||
|
</DataExecutionPrevention>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<Midl>
|
||||||
|
<TargetEnvironment>X64</TargetEnvironment>
|
||||||
|
</Midl>
|
||||||
|
<ClCompile>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<PreprocessorDefinitions>_DEBUG;DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||||
|
<DataExecutionPrevention>
|
||||||
|
</DataExecutionPrevention>
|
||||||
|
<TargetMachine>MachineX64</TargetMachine>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||||
|
<DataExecutionPrevention>
|
||||||
|
</DataExecutionPrevention>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<Midl>
|
||||||
|
<TargetEnvironment>X64</TargetEnvironment>
|
||||||
|
</Midl>
|
||||||
|
<ClCompile>
|
||||||
|
<PrecompiledHeader>
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||||
|
<DataExecutionPrevention>
|
||||||
|
</DataExecutionPrevention>
|
||||||
|
<TargetMachine>MachineX64</TargetMachine>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="mod_signalwire.c" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\..\..\w32\Library\FreeSwitchCore.2017.vcxproj">
|
||||||
|
<Project>{202d7a4e-760d-4d0e-afa1-d7459ced30ff}</Project>
|
||||||
|
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
1308
src/mod/applications/mod_signalwire/mod_signalwire.c
Normal file
1308
src/mod/applications/mod_signalwire/mod_signalwire.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -252,7 +252,8 @@ SWITCH_STANDARD_APP(soundtouch_start_function)
|
|||||||
char *argv[6];
|
char *argv[6];
|
||||||
int argc;
|
int argc;
|
||||||
char *lbuf = NULL;
|
char *lbuf = NULL;
|
||||||
int x, n;
|
int x;
|
||||||
|
int n=0;
|
||||||
|
|
||||||
if ((bug = (switch_media_bug_t *) switch_channel_get_private(channel, "_soundtouch_"))) {
|
if ((bug = (switch_media_bug_t *) switch_channel_get_private(channel, "_soundtouch_"))) {
|
||||||
if (!zstr(data) && !strcasecmp(data, "stop")) {
|
if (!zstr(data) && !strcasecmp(data, "stop")) {
|
||||||
@ -334,7 +335,6 @@ SWITCH_STANDARD_API(soundtouch_api_function)
|
|||||||
char *argv[10] = { 0 };
|
char *argv[10] = { 0 };
|
||||||
char *uuid = NULL;
|
char *uuid = NULL;
|
||||||
char *action = NULL;
|
char *action = NULL;
|
||||||
char *lbuf = NULL;
|
|
||||||
int x, n;
|
int x, n;
|
||||||
|
|
||||||
if (zstr(cmd)) {
|
if (zstr(cmd)) {
|
||||||
|
10
src/mod/applications/mod_test/Makefile.am
Normal file
10
src/mod/applications/mod_test/Makefile.am
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
include $(top_srcdir)/build/modmake.rulesam
|
||||||
|
MODNAME=mod_test
|
||||||
|
|
||||||
|
mod_LTLIBRARIES = mod_test.la
|
||||||
|
mod_test_la_SOURCES = mod_test.c
|
||||||
|
mod_test_la_CFLAGS = $(AM_CFLAGS)
|
||||||
|
mod_test_la_LIBADD = $(switch_builddir)/libfreeswitch.la
|
||||||
|
mod_test_la_LDFLAGS = -avoid-version -module -no-undefined -shared
|
||||||
|
|
||||||
|
SUBDIRS=. test
|
407
src/mod/applications/mod_test/mod_test.c
Normal file
407
src/mod/applications/mod_test/mod_test.c
Normal file
@ -0,0 +1,407 @@
|
|||||||
|
/*
|
||||||
|
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||||
|
* Copyright (C) 2005-2018, 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):
|
||||||
|
* Chris Rienzo <chris@signalwire.com>
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* mod_test.c -- mock module interfaces for testing
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <switch.h>
|
||||||
|
|
||||||
|
|
||||||
|
SWITCH_MODULE_LOAD_FUNCTION(mod_test_load);
|
||||||
|
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_test_shutdown);
|
||||||
|
SWITCH_MODULE_RUNTIME_FUNCTION(mod_test_runtime);
|
||||||
|
SWITCH_MODULE_DEFINITION(mod_test, mod_test_load, mod_test_shutdown, mod_test_runtime);
|
||||||
|
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
ASRFLAG_READY = (1 << 0),
|
||||||
|
ASRFLAG_INPUT_TIMERS = (1 << 1),
|
||||||
|
ASRFLAG_START_OF_SPEECH = (1 << 2),
|
||||||
|
ASRFLAG_RETURNED_START_OF_SPEECH = (1 << 3),
|
||||||
|
ASRFLAG_NOINPUT_TIMEOUT = (1 << 4),
|
||||||
|
ASRFLAG_RESULT = (1 << 5),
|
||||||
|
ASRFLAG_RETURNED_RESULT = (1 << 6)
|
||||||
|
} test_asr_flag_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
uint32_t flags;
|
||||||
|
const char *result_text;
|
||||||
|
double result_confidence;
|
||||||
|
uint32_t thresh;
|
||||||
|
uint32_t silence_ms;
|
||||||
|
uint32_t voice_ms;
|
||||||
|
int no_input_timeout;
|
||||||
|
int speech_timeout;
|
||||||
|
switch_bool_t start_input_timers;
|
||||||
|
switch_time_t no_input_time;
|
||||||
|
switch_time_t speech_time;
|
||||||
|
char *grammar;
|
||||||
|
char *channel_uuid;
|
||||||
|
switch_vad_t *vad;
|
||||||
|
} test_asr_t;
|
||||||
|
|
||||||
|
|
||||||
|
static void test_asr_reset(test_asr_t *context)
|
||||||
|
{
|
||||||
|
if (context->vad) {
|
||||||
|
switch_vad_reset(context->vad);
|
||||||
|
}
|
||||||
|
context->flags = 0;
|
||||||
|
context->result_text = "agent";
|
||||||
|
context->result_confidence = 87.3;
|
||||||
|
switch_set_flag(context, ASRFLAG_READY);
|
||||||
|
context->no_input_time = switch_micro_time_now();
|
||||||
|
if (context->start_input_timers) {
|
||||||
|
switch_set_flag(context, ASRFLAG_INPUT_TIMERS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static switch_status_t test_asr_open(switch_asr_handle_t *ah, const char *codec, int rate, const char *dest, switch_asr_flag_t *flags)
|
||||||
|
{
|
||||||
|
test_asr_t *context;
|
||||||
|
|
||||||
|
if (switch_test_flag(ah, SWITCH_ASR_FLAG_CLOSED)) {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "asr_open attempt on CLOSED asr handle\n");
|
||||||
|
return SWITCH_STATUS_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(context = (test_asr_t *) switch_core_alloc(ah->memory_pool, sizeof(*context)))) {
|
||||||
|
return SWITCH_STATUS_MEMERR;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "codec = %s, rate = %d, dest = %s\n", codec, rate, dest);
|
||||||
|
|
||||||
|
ah->private_info = context;
|
||||||
|
ah->codec = switch_core_strdup(ah->memory_pool, codec);
|
||||||
|
|
||||||
|
if (rate > 16000) {
|
||||||
|
ah->native_rate = 16000;
|
||||||
|
}
|
||||||
|
|
||||||
|
context->thresh = 400;
|
||||||
|
context->silence_ms = 700;
|
||||||
|
context->voice_ms = 60;
|
||||||
|
context->start_input_timers = 1;
|
||||||
|
context->no_input_timeout = 5000;
|
||||||
|
context->speech_timeout = 10000;
|
||||||
|
|
||||||
|
context->vad = switch_vad_init(ah->native_rate, 1);
|
||||||
|
switch_vad_set_mode(context->vad, -1);
|
||||||
|
switch_vad_set_param(context->vad, "thresh", context->thresh);
|
||||||
|
switch_vad_set_param(context->vad, "silence_ms", context->silence_ms);
|
||||||
|
switch_vad_set_param(context->vad, "voice_ms", context->voice_ms);
|
||||||
|
switch_vad_set_param(context->vad, "debug", 0);
|
||||||
|
|
||||||
|
test_asr_reset(context);
|
||||||
|
|
||||||
|
return SWITCH_STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
static switch_status_t test_asr_load_grammar(switch_asr_handle_t *ah, const char *grammar, const char *name)
|
||||||
|
{
|
||||||
|
test_asr_t *context = (test_asr_t *)ah->private_info;
|
||||||
|
|
||||||
|
if (switch_test_flag(ah, SWITCH_ASR_FLAG_CLOSED)) {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "asr_open attempt on CLOSED asr handle\n");
|
||||||
|
return SWITCH_STATUS_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_UUID_LOG(context->channel_uuid), SWITCH_LOG_INFO, "load grammar %s\n", grammar);
|
||||||
|
context->grammar = switch_core_strdup(ah->memory_pool, grammar);
|
||||||
|
return SWITCH_STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
static switch_status_t test_asr_unload_grammar(switch_asr_handle_t *ah, const char *name)
|
||||||
|
{
|
||||||
|
return SWITCH_STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
static switch_status_t test_asr_close(switch_asr_handle_t *ah, switch_asr_flag_t *flags)
|
||||||
|
{
|
||||||
|
test_asr_t *context = (test_asr_t *)ah->private_info;
|
||||||
|
switch_status_t status = SWITCH_STATUS_SUCCESS;
|
||||||
|
|
||||||
|
if (switch_test_flag(ah, SWITCH_ASR_FLAG_CLOSED)) {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Double ASR close!\n");
|
||||||
|
return SWITCH_STATUS_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_UUID_LOG(context->channel_uuid), SWITCH_LOG_NOTICE, "ASR closing ...\n");
|
||||||
|
|
||||||
|
if (context->vad) {
|
||||||
|
switch_vad_destroy(&context->vad);
|
||||||
|
}
|
||||||
|
|
||||||
|
switch_set_flag(ah, SWITCH_ASR_FLAG_CLOSED);
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
static switch_status_t test_asr_feed(switch_asr_handle_t *ah, void *data, unsigned int len, switch_asr_flag_t *flags)
|
||||||
|
{
|
||||||
|
test_asr_t *context = (test_asr_t *) ah->private_info;
|
||||||
|
switch_status_t status = SWITCH_STATUS_SUCCESS;
|
||||||
|
switch_vad_state_t vad_state;
|
||||||
|
|
||||||
|
if (switch_test_flag(ah, SWITCH_ASR_FLAG_CLOSED)) {
|
||||||
|
return SWITCH_STATUS_BREAK;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (switch_test_flag(context, ASRFLAG_RETURNED_RESULT) && switch_test_flag(ah, SWITCH_ASR_FLAG_AUTO_RESUME)) {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_UUID_LOG(context->channel_uuid), SWITCH_LOG_DEBUG, "Auto Resuming\n");
|
||||||
|
test_asr_reset(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (switch_test_flag(context, ASRFLAG_READY)) {
|
||||||
|
vad_state = switch_vad_process(context->vad, (int16_t *)data, len / sizeof(uint16_t));
|
||||||
|
if (vad_state == SWITCH_VAD_STATE_STOP_TALKING) {
|
||||||
|
switch_set_flag(context, ASRFLAG_RESULT);
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_UUID_LOG(context->channel_uuid), SWITCH_LOG_INFO, "Talking stopped, have result.\n");
|
||||||
|
switch_vad_reset(context->vad);
|
||||||
|
switch_clear_flag(context, ASRFLAG_READY);
|
||||||
|
} else if (vad_state == SWITCH_VAD_STATE_START_TALKING) {
|
||||||
|
switch_set_flag(context, ASRFLAG_START_OF_SPEECH);
|
||||||
|
context->speech_time = switch_micro_time_now();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
static switch_status_t test_asr_pause(switch_asr_handle_t *ah)
|
||||||
|
{
|
||||||
|
test_asr_t *context = (test_asr_t *) ah->private_info;
|
||||||
|
|
||||||
|
if (switch_test_flag(ah, SWITCH_ASR_FLAG_CLOSED)) {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "asr_pause attempt on CLOSED asr handle\n");
|
||||||
|
return SWITCH_STATUS_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_UUID_LOG(context->channel_uuid), SWITCH_LOG_DEBUG, "Pausing\n");
|
||||||
|
context->flags = 0;
|
||||||
|
|
||||||
|
return SWITCH_STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
static switch_status_t test_asr_resume(switch_asr_handle_t *ah)
|
||||||
|
{
|
||||||
|
test_asr_t *context = (test_asr_t *) ah->private_info;
|
||||||
|
|
||||||
|
if (switch_test_flag(ah, SWITCH_ASR_FLAG_CLOSED)) {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "asr_resume attempt on CLOSED asr handle\n");
|
||||||
|
return SWITCH_STATUS_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_UUID_LOG(context->channel_uuid), SWITCH_LOG_DEBUG, "Resuming\n");
|
||||||
|
test_asr_reset(context);
|
||||||
|
|
||||||
|
return SWITCH_STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
static switch_status_t test_asr_check_results(switch_asr_handle_t *ah, switch_asr_flag_t *flags)
|
||||||
|
{
|
||||||
|
test_asr_t *context = (test_asr_t *) ah->private_info;
|
||||||
|
|
||||||
|
if (switch_test_flag(context, ASRFLAG_RETURNED_RESULT) || switch_test_flag(ah, SWITCH_ASR_FLAG_CLOSED)) {
|
||||||
|
return SWITCH_STATUS_BREAK;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!switch_test_flag(context, ASRFLAG_RETURNED_START_OF_SPEECH) && switch_test_flag(context, ASRFLAG_START_OF_SPEECH)) {
|
||||||
|
return SWITCH_STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((!switch_test_flag(context, ASRFLAG_RESULT)) && (!switch_test_flag(context, ASRFLAG_NOINPUT_TIMEOUT))) {
|
||||||
|
if (switch_test_flag(context, ASRFLAG_INPUT_TIMERS) && !(switch_test_flag(context, ASRFLAG_START_OF_SPEECH)) &&
|
||||||
|
context->no_input_timeout >= 0 &&
|
||||||
|
(switch_micro_time_now() - context->no_input_time) / 1000 >= context->no_input_timeout) {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_UUID_LOG(context->channel_uuid), SWITCH_LOG_DEBUG, "NO INPUT TIMEOUT %" SWITCH_TIME_T_FMT "ms\n", (switch_micro_time_now() - context->no_input_time) / 1000);
|
||||||
|
switch_set_flag(context, ASRFLAG_NOINPUT_TIMEOUT);
|
||||||
|
} else if (switch_test_flag(context, ASRFLAG_START_OF_SPEECH) && context->speech_timeout > 0 && (switch_micro_time_now() - context->speech_time) / 1000 >= context->speech_timeout) {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_UUID_LOG(context->channel_uuid), SWITCH_LOG_DEBUG, "SPEECH TIMEOUT %" SWITCH_TIME_T_FMT "ms\n", (switch_micro_time_now() - context->speech_time) / 1000);
|
||||||
|
if (switch_test_flag(context, ASRFLAG_START_OF_SPEECH)) {
|
||||||
|
switch_set_flag(context, ASRFLAG_RESULT);
|
||||||
|
} else {
|
||||||
|
switch_set_flag(context, ASRFLAG_NOINPUT_TIMEOUT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return switch_test_flag(context, ASRFLAG_RESULT) || switch_test_flag(context, ASRFLAG_NOINPUT_TIMEOUT) ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_BREAK;
|
||||||
|
}
|
||||||
|
|
||||||
|
static switch_status_t test_asr_get_results(switch_asr_handle_t *ah, char **resultstr, switch_asr_flag_t *flags)
|
||||||
|
{
|
||||||
|
test_asr_t *context = (test_asr_t *) ah->private_info;
|
||||||
|
switch_status_t status = SWITCH_STATUS_SUCCESS;
|
||||||
|
switch_stream_handle_t result = { 0 };
|
||||||
|
SWITCH_STANDARD_STREAM(result);
|
||||||
|
|
||||||
|
if (switch_test_flag(context, ASRFLAG_RETURNED_RESULT) || switch_test_flag(ah, SWITCH_ASR_FLAG_CLOSED)) {
|
||||||
|
return SWITCH_STATUS_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (switch_test_flag(context, ASRFLAG_RESULT)) {
|
||||||
|
|
||||||
|
*resultstr = switch_mprintf("{\"grammar\": \"%s\", \"text\": \"%s\", \"confidence\": %f}", context->grammar, context->result_text, context->result_confidence);
|
||||||
|
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_UUID_LOG(context->channel_uuid), SWITCH_LOG_ERROR, "Result: %s\n", *resultstr);
|
||||||
|
|
||||||
|
status = SWITCH_STATUS_SUCCESS;
|
||||||
|
} else if (switch_test_flag(context, ASRFLAG_NOINPUT_TIMEOUT)) {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_UUID_LOG(context->channel_uuid), SWITCH_LOG_DEBUG, "Result: NO INPUT\n");
|
||||||
|
|
||||||
|
*resultstr = switch_mprintf("{\"grammar\": \"%s\", \"text\": \"\", \"confidence\": 0, \"error\": \"no_input\"}", context->grammar);
|
||||||
|
|
||||||
|
status = SWITCH_STATUS_SUCCESS;
|
||||||
|
} else if (!switch_test_flag(context, ASRFLAG_RETURNED_START_OF_SPEECH) && switch_test_flag(context, ASRFLAG_START_OF_SPEECH)) {
|
||||||
|
switch_set_flag(context, ASRFLAG_RETURNED_START_OF_SPEECH);
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_UUID_LOG(context->channel_uuid), SWITCH_LOG_DEBUG, "Result: START OF SPEECH\n");
|
||||||
|
status = SWITCH_STATUS_BREAK;
|
||||||
|
} else {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_UUID_LOG(context->channel_uuid), SWITCH_LOG_ERROR, "Unexpected call to asr_get_results - no results to return!\n");
|
||||||
|
status = SWITCH_STATUS_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (status == SWITCH_STATUS_SUCCESS) {
|
||||||
|
switch_set_flag(context, ASRFLAG_RETURNED_RESULT);
|
||||||
|
switch_clear_flag(context, ASRFLAG_READY);
|
||||||
|
}
|
||||||
|
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
static switch_status_t test_asr_start_input_timers(switch_asr_handle_t *ah)
|
||||||
|
{
|
||||||
|
test_asr_t *context = (test_asr_t *) ah->private_info;
|
||||||
|
|
||||||
|
if (switch_test_flag(ah, SWITCH_ASR_FLAG_CLOSED)) {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "asr_start_input_timers attempt on CLOSED asr handle\n");
|
||||||
|
return SWITCH_STATUS_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_UUID_LOG(context->channel_uuid), SWITCH_LOG_DEBUG, "start_input_timers\n");
|
||||||
|
|
||||||
|
if (!switch_test_flag(context, ASRFLAG_INPUT_TIMERS)) {
|
||||||
|
switch_set_flag(context, ASRFLAG_INPUT_TIMERS);
|
||||||
|
context->no_input_time = switch_micro_time_now();
|
||||||
|
} else {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_UUID_LOG(context->channel_uuid), SWITCH_LOG_INFO, "Input timers already started\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
return SWITCH_STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void test_asr_text_param(switch_asr_handle_t *ah, char *param, const char *val)
|
||||||
|
{
|
||||||
|
test_asr_t *context = (test_asr_t *) ah->private_info;
|
||||||
|
|
||||||
|
if (!zstr(param) && !zstr(val)) {
|
||||||
|
int nval = atoi(val);
|
||||||
|
double fval = atof(val);
|
||||||
|
|
||||||
|
if (!strcasecmp("no-input-timeout", param) && switch_is_number(val)) {
|
||||||
|
context->no_input_timeout = nval;
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_UUID_LOG(context->channel_uuid), SWITCH_LOG_DEBUG, "no-input-timeout = %d\n", context->no_input_timeout);
|
||||||
|
} else if (!strcasecmp("speech-timeout", param) && switch_is_number(val)) {
|
||||||
|
context->speech_timeout = nval;
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_UUID_LOG(context->channel_uuid), SWITCH_LOG_DEBUG, "speech-timeout = %d\n", context->speech_timeout);
|
||||||
|
} else if (!strcasecmp("start-input-timers", param)) {
|
||||||
|
context->start_input_timers = switch_true(val);
|
||||||
|
if (context->start_input_timers) {
|
||||||
|
switch_set_flag(context, ASRFLAG_INPUT_TIMERS);
|
||||||
|
} else {
|
||||||
|
switch_clear_flag(context, ASRFLAG_INPUT_TIMERS);
|
||||||
|
}
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_UUID_LOG(context->channel_uuid), SWITCH_LOG_DEBUG, "start-input-timers = %d\n", context->start_input_timers);
|
||||||
|
} else if (!strcasecmp("vad-mode", param)) {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_UUID_LOG(context->channel_uuid), SWITCH_LOG_DEBUG, "vad-mode = %s\n", val);
|
||||||
|
if (context->vad) switch_vad_set_mode(context->vad, nval);
|
||||||
|
} else if (!strcasecmp("vad-voice-ms", param) && nval > 0) {
|
||||||
|
context->voice_ms = nval;
|
||||||
|
switch_vad_set_param(context->vad, "voice_ms", nval);
|
||||||
|
} else if (!strcasecmp("vad-silence-ms", param) && nval > 0) {
|
||||||
|
context->silence_ms = nval;
|
||||||
|
switch_vad_set_param(context->vad, "silence_ms", nval);
|
||||||
|
} else if (!strcasecmp("vad-thresh", param) && nval > 0) {
|
||||||
|
context->thresh = nval;
|
||||||
|
switch_vad_set_param(context->vad, "thresh", nval);
|
||||||
|
} else if (!strcasecmp("channel-uuid", param)) {
|
||||||
|
context->channel_uuid = switch_core_strdup(ah->memory_pool, val);
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_UUID_LOG(context->channel_uuid), SWITCH_LOG_DEBUG, "channel-uuid = %s\n", val);
|
||||||
|
} else if (!strcasecmp("result", param)) {
|
||||||
|
context->result_text = switch_core_strdup(ah->memory_pool, val);
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_UUID_LOG(context->channel_uuid), SWITCH_LOG_DEBUG, "result = %s\n", val);
|
||||||
|
} else if (!strcasecmp("confidence", param) && fval >= 0.0) {
|
||||||
|
context->result_confidence = fval;
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_UUID_LOG(context->channel_uuid), SWITCH_LOG_DEBUG, "confidence = %f\n", fval);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SWITCH_MODULE_LOAD_FUNCTION(mod_test_load)
|
||||||
|
{
|
||||||
|
switch_asr_interface_t *asr_interface;
|
||||||
|
|
||||||
|
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
|
||||||
|
|
||||||
|
asr_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_ASR_INTERFACE);
|
||||||
|
asr_interface->interface_name = "test";
|
||||||
|
asr_interface->asr_open = test_asr_open;
|
||||||
|
asr_interface->asr_load_grammar = test_asr_load_grammar;
|
||||||
|
asr_interface->asr_unload_grammar = test_asr_unload_grammar;
|
||||||
|
asr_interface->asr_close = test_asr_close;
|
||||||
|
asr_interface->asr_feed = test_asr_feed;
|
||||||
|
asr_interface->asr_resume = test_asr_resume;
|
||||||
|
asr_interface->asr_pause = test_asr_pause;
|
||||||
|
asr_interface->asr_check_results = test_asr_check_results;
|
||||||
|
asr_interface->asr_get_results = test_asr_get_results;
|
||||||
|
asr_interface->asr_start_input_timers = test_asr_start_input_timers;
|
||||||
|
asr_interface->asr_text_param = test_asr_text_param;
|
||||||
|
|
||||||
|
return SWITCH_STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_test_shutdown)
|
||||||
|
{
|
||||||
|
return SWITCH_STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
SWITCH_MODULE_RUNTIME_FUNCTION(mod_test_runtime)
|
||||||
|
{
|
||||||
|
return SWITCH_STATUS_TERM;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 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:
|
||||||
|
*/
|
5
src/mod/applications/mod_test/test/Makefile.am
Normal file
5
src/mod/applications/mod_test/test/Makefile.am
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
include $(top_srcdir)/build/modmake.rulesam
|
||||||
|
bin_PROGRAMS = test_asr
|
||||||
|
test_asr_CFLAGS = $(AM_CFLAGS) -I../
|
||||||
|
test_asr_LDFLAGS = $(AM_LDFLAGS) -avoid-version -no-undefined $(freeswitch_LDFLAGS) ../mod_test.la $(switch_builddir)/libfreeswitch.la $(CORE_LIBS) $(APR_LIBS)
|
||||||
|
TESTS = $(bin_PROGRAMS)
|
23
src/mod/applications/mod_test/test/freeswitch.xml
Normal file
23
src/mod/applications/mod_test/test/freeswitch.xml
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<document type="freeswitch/xml">
|
||||||
|
|
||||||
|
<section name="configuration" description="Various Configuration">
|
||||||
|
<configuration name="modules.conf" description="Modules">
|
||||||
|
<modules>
|
||||||
|
<load module="mod_loopback"/>
|
||||||
|
<load module="mod_tone_stream"/>
|
||||||
|
<load module="mod_dptools"/>
|
||||||
|
<load module="mod_sndfile"/>
|
||||||
|
</modules>
|
||||||
|
</configuration>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section name="dialplan" description="Regex/XML Dialplan">
|
||||||
|
<context name="default">
|
||||||
|
<extension name="sample">
|
||||||
|
<condition>
|
||||||
|
<action application="info"/>
|
||||||
|
</condition>
|
||||||
|
</extension>
|
||||||
|
</context>
|
||||||
|
</section>
|
||||||
|
</document>
|
BIN
src/mod/applications/mod_test/test/sounds/agent.wav
Normal file
BIN
src/mod/applications/mod_test/test/sounds/agent.wav
Normal file
Binary file not shown.
BIN
src/mod/applications/mod_test/test/sounds/hi.wav
Normal file
BIN
src/mod/applications/mod_test/test/sounds/hi.wav
Normal file
Binary file not shown.
Binary file not shown.
BIN
src/mod/applications/mod_test/test/sounds/test.wav
Normal file
BIN
src/mod/applications/mod_test/test/sounds/test.wav
Normal file
Binary file not shown.
BIN
src/mod/applications/mod_test/test/sounds/test_agent.wav
Normal file
BIN
src/mod/applications/mod_test/test/sounds/test_agent.wav
Normal file
Binary file not shown.
292
src/mod/applications/mod_test/test/test_asr.c
Normal file
292
src/mod/applications/mod_test/test/test_asr.c
Normal file
@ -0,0 +1,292 @@
|
|||||||
|
/*
|
||||||
|
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||||
|
* Copyright (C) 2005-2018, 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):
|
||||||
|
* Chris Rienzo <chris@signalwire.com>
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* test_asr.c -- tests for mock test asr interface
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#include <switch.h>
|
||||||
|
#include <test/switch_test.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
|
||||||
|
static const char *get_query_result_text(switch_memory_pool_t *pool, const char *result)
|
||||||
|
{
|
||||||
|
const char *result_text = NULL;
|
||||||
|
cJSON *result_json = cJSON_Parse(result);
|
||||||
|
if (result_json) {
|
||||||
|
const char *text = cJSON_GetObjectCstr(result_json, "text");
|
||||||
|
if (!zstr(text)) {
|
||||||
|
result_text = switch_core_strdup(pool, text);
|
||||||
|
} else {
|
||||||
|
text = cJSON_GetObjectCstr(result_json, "error");
|
||||||
|
if (!zstr(text)) {
|
||||||
|
result_text = switch_core_strdup(pool, text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cJSON_Delete(result_json);
|
||||||
|
}
|
||||||
|
return result_text;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FST_CORE_BEGIN(".")
|
||||||
|
|
||||||
|
FST_MODULE_BEGIN(mod_test, test_asr)
|
||||||
|
|
||||||
|
FST_SETUP_BEGIN()
|
||||||
|
{
|
||||||
|
fst_requires_module("mod_tone_stream");
|
||||||
|
fst_requires_module("mod_sndfile");
|
||||||
|
fst_requires_module("mod_dptools");
|
||||||
|
}
|
||||||
|
FST_SETUP_END()
|
||||||
|
|
||||||
|
FST_TEARDOWN_BEGIN()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
FST_TEARDOWN_END()
|
||||||
|
|
||||||
|
|
||||||
|
FST_TEST_BEGIN(core_asr)
|
||||||
|
{
|
||||||
|
const char* session_id = "123435";
|
||||||
|
char *grammar = switch_core_sprintf(fst_pool, "{start-input-timers=true,no-input-timeout=5000,speech-timeout=10000,channel-uuid=%s}default", session_id);
|
||||||
|
fst_test_core_asr_open("test");
|
||||||
|
fst_test_core_asr(
|
||||||
|
grammar,
|
||||||
|
"file_string://silence_stream://3000,0!sounds/agent.wav!silence_stream://3000,0");
|
||||||
|
fst_check_string_equals(get_query_result_text(fst_pool, fst_asr_result), "agent");
|
||||||
|
fst_test_core_asr_resume();
|
||||||
|
fst_test_core_asr(
|
||||||
|
grammar,
|
||||||
|
"silence_stream://30000,0");
|
||||||
|
fst_check_string_equals(get_query_result_text(fst_pool, fst_asr_result), "no_input");
|
||||||
|
fst_test_core_asr_resume();
|
||||||
|
fst_test_core_asr(
|
||||||
|
grammar,
|
||||||
|
"file_string://sounds/agent.wav!silence_stream://3000,0");
|
||||||
|
fst_check_string_equals(get_query_result_text(fst_pool, fst_asr_result), "agent");
|
||||||
|
fst_test_core_asr_resume();
|
||||||
|
fst_test_core_asr(
|
||||||
|
grammar,
|
||||||
|
"silence_stream://30000,0");
|
||||||
|
fst_check_string_equals(get_query_result_text(fst_pool, fst_asr_result), "no_input");
|
||||||
|
fst_test_core_asr_resume();
|
||||||
|
fst_test_core_asr(
|
||||||
|
grammar,
|
||||||
|
"file_string://sounds/agent.wav!silence_stream://3000,0");
|
||||||
|
fst_check_string_equals(get_query_result_text(fst_pool, fst_asr_result), "agent");
|
||||||
|
fst_test_core_asr_pause();
|
||||||
|
fst_test_core_asr_resume();
|
||||||
|
fst_test_core_asr(
|
||||||
|
grammar,
|
||||||
|
"file_string://sounds/agent.wav!silence_stream://3000,0");
|
||||||
|
fst_check_string_equals(get_query_result_text(fst_pool, fst_asr_result), "agent");
|
||||||
|
fst_test_core_asr_close();
|
||||||
|
|
||||||
|
fst_test_core_asr_open("test");
|
||||||
|
fst_test_core_asr(
|
||||||
|
grammar,
|
||||||
|
"file_string://silence_stream://1000,0!sounds/ivr-please_state_your_name_and_reason_for_calling.wav!silence_stream://3000,0");
|
||||||
|
fst_check_string_equals(get_query_result_text(fst_pool, fst_asr_result), "agent");
|
||||||
|
fst_test_core_asr_close();
|
||||||
|
}
|
||||||
|
FST_TEST_END()
|
||||||
|
|
||||||
|
FST_TEST_BEGIN(core_asr_auto_resume)
|
||||||
|
{
|
||||||
|
const char* session_id = "123435";
|
||||||
|
char *grammar = switch_core_sprintf(fst_pool, "{start-input-timers=true,no-input-timeout=5000,speech-timeout=10000,channel-uuid=%s}default", session_id);
|
||||||
|
fst_test_core_asr_open("test");
|
||||||
|
switch_set_flag(&ah, SWITCH_ASR_FLAG_AUTO_RESUME);
|
||||||
|
fst_test_core_asr(
|
||||||
|
grammar,
|
||||||
|
"file_string://silence_stream://3000,0!sounds/agent.wav!silence_stream://3000,0");
|
||||||
|
fst_check_string_equals(get_query_result_text(fst_pool, fst_asr_result), "agent");
|
||||||
|
fst_test_core_asr(
|
||||||
|
grammar,
|
||||||
|
"silence_stream://30000,0");
|
||||||
|
fst_check_string_equals(get_query_result_text(fst_pool, fst_asr_result), "no_input");
|
||||||
|
fst_test_core_asr(
|
||||||
|
grammar,
|
||||||
|
"file_string://sounds/agent.wav!silence_stream://3000,0");
|
||||||
|
fst_check_string_equals(get_query_result_text(fst_pool, fst_asr_result), "agent");
|
||||||
|
fst_test_core_asr(
|
||||||
|
grammar,
|
||||||
|
"silence_stream://30000,0");
|
||||||
|
fst_check_string_equals(get_query_result_text(fst_pool, fst_asr_result), "no_input");
|
||||||
|
fst_test_core_asr_resume();
|
||||||
|
fst_test_core_asr(
|
||||||
|
grammar,
|
||||||
|
"file_string://sounds/agent.wav!silence_stream://3000,0");
|
||||||
|
fst_check_string_equals(get_query_result_text(fst_pool, fst_asr_result), "agent");
|
||||||
|
fst_test_core_asr_resume();
|
||||||
|
fst_test_core_asr(
|
||||||
|
grammar,
|
||||||
|
"file_string://silence_stream://1000,0!sounds/ivr-please_state_your_name_and_reason_for_calling.wav!silence_stream://3000,0");
|
||||||
|
fst_check_string_equals(get_query_result_text(fst_pool, fst_asr_result), "agent");
|
||||||
|
fst_test_core_asr_close();
|
||||||
|
}
|
||||||
|
FST_TEST_END()
|
||||||
|
|
||||||
|
FST_TEST_BEGIN(core_asr_abuse)
|
||||||
|
{
|
||||||
|
const char* session_id = "5351514";
|
||||||
|
char *grammar = switch_core_sprintf(fst_pool, "{start-input-timers=true,no-input-timeout=5000,speech-timeout=10000,channel-uuid=%s}default", session_id);
|
||||||
|
fst_test_core_asr_open("test");
|
||||||
|
fst_test_core_asr(
|
||||||
|
grammar,
|
||||||
|
"file_string://silence_stream://3000,0!sounds/agent.wav!silence_stream://3000,0");
|
||||||
|
fst_check_string_equals(get_query_result_text(fst_pool, fst_asr_result), "agent");
|
||||||
|
fst_test_core_asr_resume();
|
||||||
|
fst_test_core_asr_resume();
|
||||||
|
fst_test_core_asr_resume();
|
||||||
|
fst_test_core_asr_pause();
|
||||||
|
fst_test_core_asr_resume();
|
||||||
|
fst_test_core_asr(
|
||||||
|
grammar,
|
||||||
|
"file_string://sounds/agent.wav!silence_stream://3000,0");
|
||||||
|
fst_check_string_equals(get_query_result_text(fst_pool, fst_asr_result), "agent");
|
||||||
|
fst_test_core_asr_resume();
|
||||||
|
|
||||||
|
// Tested double-close, but FS core will crash...
|
||||||
|
fst_test_core_asr_close();
|
||||||
|
}
|
||||||
|
FST_TEST_END()
|
||||||
|
|
||||||
|
|
||||||
|
FST_SESSION_BEGIN(play_and_detect_1)
|
||||||
|
{
|
||||||
|
const char *result_text = NULL;
|
||||||
|
char *grammar = switch_core_session_sprintf(fst_session, "{start-input-timers=false,no-input-timeout=5000,speech-timeout=10000,channel-uuid=%s}default", switch_core_session_get_uuid(fst_session));
|
||||||
|
fst_play_and_detect_speech_test_begin();
|
||||||
|
|
||||||
|
/* initial welcome and request */
|
||||||
|
fst_play_and_detect_speech_app_test("test",
|
||||||
|
grammar,
|
||||||
|
"sounds/ivr-please_state_your_name_and_reason_for_calling.wav",
|
||||||
|
"sounds/agent.wav");
|
||||||
|
result_text = get_query_result_text(fst_pool, fst_asr_result);
|
||||||
|
fst_requires(result_text != NULL);
|
||||||
|
fst_check_string_equals(result_text, "agent");
|
||||||
|
|
||||||
|
/* follow up request */
|
||||||
|
fst_play_and_detect_speech_app_test("test",
|
||||||
|
grammar,
|
||||||
|
"sounds/ivr-please_state_your_name_and_reason_for_calling.wav",
|
||||||
|
"file_string://1000,0!sounds/agent.wav");
|
||||||
|
result_text = get_query_result_text(fst_pool, fst_asr_result);
|
||||||
|
fst_requires(result_text != NULL);
|
||||||
|
fst_check_string_equals(result_text, "agent");
|
||||||
|
|
||||||
|
fst_play_and_detect_speech_test_end();
|
||||||
|
}
|
||||||
|
FST_SESSION_END()
|
||||||
|
|
||||||
|
FST_SESSION_BEGIN(play_and_detect_no_input_follow_up)
|
||||||
|
{
|
||||||
|
const char *result_text = NULL;
|
||||||
|
char *grammar = switch_core_session_sprintf(fst_session, "{start-input-timers=false,no-input-timeout=5000,speech-timeout=10000,channel-uuid=%s}", switch_core_session_get_uuid(fst_session));
|
||||||
|
|
||||||
|
switch_ivr_schedule_hangup(switch_epoch_time_now(NULL) + 60, switch_core_session_get_uuid(fst_session), SWITCH_CAUSE_NORMAL_CLEARING, SWITCH_FALSE);
|
||||||
|
fst_play_and_detect_speech_test_begin();
|
||||||
|
fst_play_and_detect_speech_app_test("test",
|
||||||
|
grammar,
|
||||||
|
"sounds/ivr-please_state_your_name_and_reason_for_calling.wav",
|
||||||
|
"file_string://silence_stream://4000,0!sounds/agent.wav");
|
||||||
|
result_text = get_query_result_text(fst_pool, fst_asr_result);
|
||||||
|
fst_requires(result_text != NULL);
|
||||||
|
fst_check_string_equals(result_text, "agent");
|
||||||
|
|
||||||
|
/* follow up request - no input */
|
||||||
|
fst_play_and_detect_speech_app_test("test",
|
||||||
|
grammar,
|
||||||
|
"sounds/ivr-please_state_your_name_and_reason_for_calling.wav",
|
||||||
|
"silence_stream://10000,0");
|
||||||
|
result_text = get_query_result_text(fst_pool, fst_asr_result);
|
||||||
|
fst_requires(result_text != NULL);
|
||||||
|
fst_check_string_equals(result_text, "no_input");
|
||||||
|
|
||||||
|
fst_play_and_detect_speech_test_end();
|
||||||
|
}
|
||||||
|
FST_SESSION_END()
|
||||||
|
|
||||||
|
FST_SESSION_BEGIN(play_and_detect_no_input)
|
||||||
|
{
|
||||||
|
const char *result_text = NULL;
|
||||||
|
|
||||||
|
switch_ivr_schedule_hangup(switch_epoch_time_now(NULL) + 60, switch_core_session_get_uuid(fst_session), SWITCH_CAUSE_NORMAL_CLEARING, SWITCH_FALSE);
|
||||||
|
fst_play_and_detect_speech_test_begin();
|
||||||
|
fst_play_and_detect_speech_app_test("test",
|
||||||
|
switch_core_session_sprintf(fst_session,
|
||||||
|
"{start-input-timers=false,no-input-timeout=5000,speech-timeout=10000,channel-uuid=%s}default",
|
||||||
|
switch_core_session_get_uuid(fst_session)),
|
||||||
|
"sounds/ivr-please_state_your_name_and_reason_for_calling.wav",
|
||||||
|
"silence_stream://10000,0");
|
||||||
|
result_text = get_query_result_text(fst_pool, fst_asr_result);
|
||||||
|
fst_requires(result_text != NULL);
|
||||||
|
fst_check_string_equals(result_text, "no_input");
|
||||||
|
|
||||||
|
fst_play_and_detect_speech_test_end();
|
||||||
|
}
|
||||||
|
FST_SESSION_END()
|
||||||
|
|
||||||
|
FST_SESSION_BEGIN(play_and_detect_start_input_timers)
|
||||||
|
{
|
||||||
|
const char *result_text = NULL;
|
||||||
|
|
||||||
|
switch_ivr_schedule_hangup(switch_epoch_time_now(NULL) + 60, switch_core_session_get_uuid(fst_session), SWITCH_CAUSE_NORMAL_CLEARING, SWITCH_FALSE);
|
||||||
|
fst_play_and_detect_speech_test_begin();
|
||||||
|
|
||||||
|
fst_play_and_detect_speech_app_test("test",
|
||||||
|
switch_core_session_sprintf(fst_session,
|
||||||
|
"{start-input-timers=true,no-input-timeout=5000,speech-timeout=10000,channel-uuid=%s}default",
|
||||||
|
switch_core_session_get_uuid(fst_session)),
|
||||||
|
"sounds/ivr-please_state_your_name_and_reason_for_calling.wav",
|
||||||
|
"silence_stream://10000,0");
|
||||||
|
result_text = get_query_result_text(fst_pool, fst_asr_result);
|
||||||
|
fst_requires(result_text != NULL);
|
||||||
|
fst_check_string_equals(result_text, "no_input");
|
||||||
|
|
||||||
|
fst_play_and_detect_speech_test_end();
|
||||||
|
|
||||||
|
fst_check_duration(5000, 500);
|
||||||
|
}
|
||||||
|
FST_SESSION_END()
|
||||||
|
|
||||||
|
FST_TEST_BEGIN(unload_test)
|
||||||
|
{
|
||||||
|
const char *err = NULL;
|
||||||
|
switch_sleep(1000000);
|
||||||
|
fst_check(switch_loadable_module_unload_module((char *)"../.libs", (char *)"mod_test", SWITCH_FALSE, &err) == SWITCH_STATUS_SUCCESS);
|
||||||
|
}
|
||||||
|
FST_TEST_END()
|
||||||
|
|
||||||
|
|
||||||
|
FST_MODULE_END()
|
||||||
|
|
||||||
|
FST_CORE_END()
|
@ -61,6 +61,9 @@
|
|||||||
#define WEBRTC_ARCH_X86_64
|
#define WEBRTC_ARCH_X86_64
|
||||||
#define WEBRTC_ARCH_64_BITS
|
#define WEBRTC_ARCH_64_BITS
|
||||||
#define WEBRTC_ARCH_LITTLE_ENDIAN
|
#define WEBRTC_ARCH_LITTLE_ENDIAN
|
||||||
|
#elif defined(__aarch64__)
|
||||||
|
#define WEBRTC_ARCH_64_BITS
|
||||||
|
#define WEBRTC_ARCH_LITTLE_ENDIAN
|
||||||
#elif defined(_M_IX86) || defined(__i386__)
|
#elif defined(_M_IX86) || defined(__i386__)
|
||||||
#define WEBRTC_ARCH_X86_FAMILY
|
#define WEBRTC_ARCH_X86_FAMILY
|
||||||
#define WEBRTC_ARCH_X86
|
#define WEBRTC_ARCH_X86
|
||||||
|
@ -207,19 +207,19 @@ static uint32_t switch_opus_encoder_set_audio_bandwidth(OpusEncoder *encoder_obj
|
|||||||
static switch_bool_t switch_opus_show_audio_bandwidth(int audiobandwidth,char *audiobandwidth_str)
|
static switch_bool_t switch_opus_show_audio_bandwidth(int audiobandwidth,char *audiobandwidth_str)
|
||||||
{
|
{
|
||||||
if (audiobandwidth == OPUS_BANDWIDTH_NARROWBAND) {
|
if (audiobandwidth == OPUS_BANDWIDTH_NARROWBAND) {
|
||||||
strncpy(audiobandwidth_str, "NARROWBAND",10);
|
strncpy(audiobandwidth_str, "NARROWBAND",11);
|
||||||
return SWITCH_TRUE;
|
return SWITCH_TRUE;
|
||||||
} else if (audiobandwidth == OPUS_BANDWIDTH_MEDIUMBAND) {
|
} else if (audiobandwidth == OPUS_BANDWIDTH_MEDIUMBAND) {
|
||||||
strncpy(audiobandwidth_str, "MEDIUMBAND",10);
|
strncpy(audiobandwidth_str, "MEDIUMBAND",11);
|
||||||
return SWITCH_TRUE;
|
return SWITCH_TRUE;
|
||||||
} else if (audiobandwidth == OPUS_BANDWIDTH_WIDEBAND) {
|
} else if (audiobandwidth == OPUS_BANDWIDTH_WIDEBAND) {
|
||||||
strncpy(audiobandwidth_str,"WIDEBAND",8);
|
strncpy(audiobandwidth_str,"WIDEBAND",9);
|
||||||
return SWITCH_TRUE;
|
return SWITCH_TRUE;
|
||||||
} else if (audiobandwidth == OPUS_BANDWIDTH_SUPERWIDEBAND) {
|
} else if (audiobandwidth == OPUS_BANDWIDTH_SUPERWIDEBAND) {
|
||||||
strncpy(audiobandwidth_str, "SUPERWIDEBAND",13);
|
strncpy(audiobandwidth_str, "SUPERWIDEBAND",14);
|
||||||
return SWITCH_TRUE;
|
return SWITCH_TRUE;
|
||||||
} else if (audiobandwidth == OPUS_BANDWIDTH_FULLBAND) {
|
} else if (audiobandwidth == OPUS_BANDWIDTH_FULLBAND) {
|
||||||
strncpy(audiobandwidth_str, "FULLBAND",8);
|
strncpy(audiobandwidth_str, "FULLBAND",9);
|
||||||
return SWITCH_TRUE;
|
return SWITCH_TRUE;
|
||||||
}
|
}
|
||||||
return SWITCH_FALSE;
|
return SWITCH_FALSE;
|
||||||
|
@ -20,3 +20,5 @@ BUILT_SOURCES=$(IKS_LA)
|
|||||||
$(IKS_LA): $(IKS_BUILDDIR) $(IKS_DIR) $(IKS_DIR)/.update
|
$(IKS_LA): $(IKS_BUILDDIR) $(IKS_DIR) $(IKS_DIR)/.update
|
||||||
@cd $(IKS_BUILDDIR) && $(MAKE)
|
@cd $(IKS_BUILDDIR) && $(MAKE)
|
||||||
@$(TOUCH_TARGET)
|
@$(TOUCH_TARGET)
|
||||||
|
|
||||||
|
deps: $(IKS_LA)
|
@ -1220,6 +1220,7 @@ struct null_private_object {
|
|||||||
switch_caller_profile_t *caller_profile;
|
switch_caller_profile_t *caller_profile;
|
||||||
switch_frame_t read_frame;
|
switch_frame_t read_frame;
|
||||||
int16_t *null_buf;
|
int16_t *null_buf;
|
||||||
|
int rate;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct null_private_object null_private_t;
|
typedef struct null_private_object null_private_t;
|
||||||
@ -1239,20 +1240,19 @@ static switch_status_t null_channel_kill_channel(switch_core_session_t *session,
|
|||||||
static switch_status_t null_tech_init(null_private_t *tech_pvt, switch_core_session_t *session)
|
static switch_status_t null_tech_init(null_private_t *tech_pvt, switch_core_session_t *session)
|
||||||
{
|
{
|
||||||
const char *iananame = "L16";
|
const char *iananame = "L16";
|
||||||
uint32_t rate = 8000;
|
|
||||||
uint32_t interval = 20;
|
uint32_t interval = 20;
|
||||||
switch_status_t status = SWITCH_STATUS_SUCCESS;
|
switch_status_t status = SWITCH_STATUS_SUCCESS;
|
||||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||||
const switch_codec_implementation_t *read_impl;
|
const switch_codec_implementation_t *read_impl;
|
||||||
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s setup codec %s/%d/%d\n", switch_channel_get_name(channel), iananame, rate,
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s setup codec %s/%d/%d\n",
|
||||||
interval);
|
switch_channel_get_name(channel), iananame, tech_pvt->rate, interval);
|
||||||
|
|
||||||
status = switch_core_codec_init(&tech_pvt->read_codec,
|
status = switch_core_codec_init(&tech_pvt->read_codec,
|
||||||
iananame,
|
iananame,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
rate, interval, 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, switch_core_session_get_pool(session));
|
tech_pvt->rate, interval, 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, switch_core_session_get_pool(session));
|
||||||
|
|
||||||
if (status != SWITCH_STATUS_SUCCESS || !tech_pvt->read_codec.implementation || !switch_core_codec_ready(&tech_pvt->read_codec)) {
|
if (status != SWITCH_STATUS_SUCCESS || !tech_pvt->read_codec.implementation || !switch_core_codec_ready(&tech_pvt->read_codec)) {
|
||||||
goto end;
|
goto end;
|
||||||
@ -1262,7 +1262,7 @@ static switch_status_t null_tech_init(null_private_t *tech_pvt, switch_core_sess
|
|||||||
iananame,
|
iananame,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
rate, interval, 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, switch_core_session_get_pool(session));
|
tech_pvt->rate, interval, 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, switch_core_session_get_pool(session));
|
||||||
|
|
||||||
|
|
||||||
if (status != SWITCH_STATUS_SUCCESS) {
|
if (status != SWITCH_STATUS_SUCCESS) {
|
||||||
@ -1494,6 +1494,19 @@ static switch_call_cause_t null_channel_outgoing_channel(switch_core_session_t *
|
|||||||
switch_core_session_add_stream(*new_session, NULL);
|
switch_core_session_add_stream(*new_session, NULL);
|
||||||
|
|
||||||
if ((tech_pvt = (null_private_t *) switch_core_session_alloc(*new_session, sizeof(null_private_t))) != 0) {
|
if ((tech_pvt = (null_private_t *) switch_core_session_alloc(*new_session, sizeof(null_private_t))) != 0) {
|
||||||
|
const char *rate_ = switch_event_get_header(var_event, "rate");
|
||||||
|
int rate = 0;
|
||||||
|
|
||||||
|
if (rate_) {
|
||||||
|
rate = atoi(rate_);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(rate > 0 && rate % 8000 == 0)) {
|
||||||
|
rate = 8000;
|
||||||
|
}
|
||||||
|
|
||||||
|
tech_pvt->rate = rate;
|
||||||
|
|
||||||
channel = switch_core_session_get_channel(*new_session);
|
channel = switch_core_session_get_channel(*new_session);
|
||||||
switch_snprintf(name, sizeof(name), "null/%s", outbound_profile->destination_number);
|
switch_snprintf(name, sizeof(name), "null/%s", outbound_profile->destination_number);
|
||||||
switch_channel_set_name(channel, name);
|
switch_channel_set_name(channel, name);
|
||||||
|
@ -1993,26 +1993,15 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
|
|||||||
|
|
||||||
nua_info(tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("message/sipfrag"),
|
nua_info(tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("message/sipfrag"),
|
||||||
TAG_IF(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)), SIPTAG_PAYLOAD_STR(message), TAG_END());
|
TAG_IF(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)), SIPTAG_PAYLOAD_STR(message), TAG_END());
|
||||||
} else if (update_allowed && ua && switch_stristr("polycom", ua)) {
|
} else if (update_allowed && ua && (switch_stristr("polycom", ua) ||
|
||||||
if ( switch_stristr("UA/4", ua) ) {
|
(switch_stristr("aastra", ua) && !switch_stristr("Intelligate", ua)) ||
|
||||||
snprintf(message, sizeof(message), "P-Asserted-Identity: \"%s\" <sip:%s@%s>", name, number, tech_pvt->profile->sipip);
|
(switch_stristr("cisco/spa50", ua) ||
|
||||||
} else {
|
switch_stristr("cisco/spa525", ua)) ||
|
||||||
snprintf(message, sizeof(message), "P-Asserted-Identity: \"%s\" <%s>", name, number);
|
switch_stristr("cisco/spa30", ua) ||
|
||||||
}
|
switch_stristr("Grandstream", ua) ||
|
||||||
sofia_set_flag_locked(tech_pvt, TFLAG_UPDATING_DISPLAY);
|
switch_stristr("Yealink", ua) ||
|
||||||
nua_update(tech_pvt->nh,
|
switch_stristr("Mitel", ua) ||
|
||||||
NUTAG_SESSION_TIMER(tech_pvt->session_timeout),
|
switch_stristr("Panasonic", ua))) {
|
||||||
NUTAG_SESSION_REFRESHER(tech_pvt->session_refresher),
|
|
||||||
NUTAG_UPDATE_REFRESH(tech_pvt->update_refresher),
|
|
||||||
TAG_IF(call_info, SIPTAG_CALL_INFO_STR(call_info)),
|
|
||||||
TAG_IF(!zstr(tech_pvt->route_uri), NUTAG_PROXY(tech_pvt->route_uri)),
|
|
||||||
TAG_IF(!zstr_buf(message), SIPTAG_HEADER_STR(message)),
|
|
||||||
TAG_IF(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)), TAG_END());
|
|
||||||
} else if (update_allowed && ua && ((switch_stristr("aastra", ua) && !switch_stristr("Intelligate", ua)) ||
|
|
||||||
(switch_stristr("cisco/spa50", ua) || switch_stristr("cisco/spa525", ua)) ||
|
|
||||||
switch_stristr("cisco/spa30", ua) || switch_stristr("Grandstream GXP", ua) ||
|
|
||||||
switch_stristr("Yealink", ua) || switch_stristr("Mitel", ua) ||
|
|
||||||
switch_stristr("Panasonic", ua))) {
|
|
||||||
snprintf(message, sizeof(message), "P-Asserted-Identity: \"%s\" <sip:%s@%s>", name, number, tech_pvt->profile->sipip);
|
snprintf(message, sizeof(message), "P-Asserted-Identity: \"%s\" <sip:%s@%s>", name, number, tech_pvt->profile->sipip);
|
||||||
|
|
||||||
sofia_set_flag_locked(tech_pvt, TFLAG_UPDATING_DISPLAY);
|
sofia_set_flag_locked(tech_pvt, TFLAG_UPDATING_DISPLAY);
|
||||||
@ -2020,6 +2009,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
|
|||||||
NUTAG_SESSION_TIMER(tech_pvt->session_timeout),
|
NUTAG_SESSION_TIMER(tech_pvt->session_timeout),
|
||||||
NUTAG_SESSION_REFRESHER(tech_pvt->session_refresher),
|
NUTAG_SESSION_REFRESHER(tech_pvt->session_refresher),
|
||||||
NUTAG_UPDATE_REFRESH(tech_pvt->update_refresher),
|
NUTAG_UPDATE_REFRESH(tech_pvt->update_refresher),
|
||||||
|
TAG_IF(!zstr(tech_pvt->privacy), SIPTAG_PRIVACY_STR(tech_pvt->privacy)),
|
||||||
TAG_IF(call_info, SIPTAG_CALL_INFO_STR(call_info)),
|
TAG_IF(call_info, SIPTAG_CALL_INFO_STR(call_info)),
|
||||||
TAG_IF(!zstr(tech_pvt->route_uri), NUTAG_PROXY(tech_pvt->route_uri)),
|
TAG_IF(!zstr(tech_pvt->route_uri), NUTAG_PROXY(tech_pvt->route_uri)),
|
||||||
TAG_IF(!zstr_buf(message), SIPTAG_HEADER_STR(message)),
|
TAG_IF(!zstr_buf(message), SIPTAG_HEADER_STR(message)),
|
||||||
|
@ -561,6 +561,8 @@ struct sofia_gateway {
|
|||||||
sofia_gateway_subscription_t *subscriptions;
|
sofia_gateway_subscription_t *subscriptions;
|
||||||
int distinct_to;
|
int distinct_to;
|
||||||
sofia_cid_type_t cid_type;
|
sofia_cid_type_t cid_type;
|
||||||
|
char register_network_ip[80];
|
||||||
|
int register_network_port;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
@ -8916,11 +8916,15 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t
|
|||||||
|
|
||||||
if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, MY_EVENT_TRANSFEROR) == SWITCH_STATUS_SUCCESS) {
|
if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, MY_EVENT_TRANSFEROR) == SWITCH_STATUS_SUCCESS) {
|
||||||
switch_channel_event_set_data(channel_a, event);
|
switch_channel_event_set_data(channel_a, event);
|
||||||
|
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "att_xfer_original_call_id", br_a);
|
||||||
|
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "att_xfer_destination_call_id", br_b);
|
||||||
|
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "att_xfer_destination_peer_uuid", switch_core_session_get_uuid(b_session));
|
||||||
switch_event_fire(&event);
|
switch_event_fire(&event);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, MY_EVENT_TRANSFEREE) == SWITCH_STATUS_SUCCESS) {
|
if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, MY_EVENT_TRANSFEREE) == SWITCH_STATUS_SUCCESS) {
|
||||||
switch_channel_event_set_data(a_channel, event);
|
switch_channel_event_set_data(a_channel, event);
|
||||||
|
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "att_xfer_replaced_call_id", switch_core_session_get_uuid(b_session));
|
||||||
switch_event_fire(&event);
|
switch_event_fire(&event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -9023,6 +9027,9 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t
|
|||||||
|
|
||||||
if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, MY_EVENT_TRANSFEROR) == SWITCH_STATUS_SUCCESS) {
|
if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, MY_EVENT_TRANSFEROR) == SWITCH_STATUS_SUCCESS) {
|
||||||
switch_channel_event_set_data(channel_a, event);
|
switch_channel_event_set_data(channel_a, event);
|
||||||
|
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "att_xfer_original_call_id", br_a);
|
||||||
|
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "att_xfer_destination_call_id", br_b);
|
||||||
|
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "att_xfer_destination_peer_uuid", switch_core_session_get_uuid(b_session));
|
||||||
switch_event_fire(&event);
|
switch_event_fire(&event);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -9101,6 +9108,9 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t
|
|||||||
if(sofia_test_pflag(profile, PFLAG_FIRE_TRANFER_EVENTS)) {
|
if(sofia_test_pflag(profile, PFLAG_FIRE_TRANFER_EVENTS)) {
|
||||||
if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, MY_EVENT_TRANSFEROR) == SWITCH_STATUS_SUCCESS) {
|
if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, MY_EVENT_TRANSFEROR) == SWITCH_STATUS_SUCCESS) {
|
||||||
switch_channel_event_set_data(channel_a, event);
|
switch_channel_event_set_data(channel_a, event);
|
||||||
|
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "att_xfer_original_call_id", switch_core_session_get_uuid(hup_session));
|
||||||
|
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "att_xfer_destination_call_id", switch_core_session_get_uuid(t_session));
|
||||||
|
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "att_xfer_destination_peer_uuid", switch_channel_get_partner_uuid(t_channel));
|
||||||
switch_event_fire(&event);
|
switch_event_fire(&event);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -9288,6 +9298,8 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t
|
|||||||
|
|
||||||
if(sofia_test_pflag(profile, PFLAG_FIRE_TRANFER_EVENTS)) {
|
if(sofia_test_pflag(profile, PFLAG_FIRE_TRANFER_EVENTS)) {
|
||||||
if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, MY_EVENT_TRANSFEROR) == SWITCH_STATUS_SUCCESS) {
|
if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, MY_EVENT_TRANSFEROR) == SWITCH_STATUS_SUCCESS) {
|
||||||
|
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "att_xfer_original_call_id", br_a);
|
||||||
|
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "att_xfer_destination_call_id", br_b);
|
||||||
switch_channel_event_set_data(channel_a, event);
|
switch_channel_event_set_data(channel_a, event);
|
||||||
switch_event_fire(&event);
|
switch_event_fire(&event);
|
||||||
}
|
}
|
||||||
|
@ -4945,7 +4945,7 @@ void sofia_presence_handle_sip_i_message(int status,
|
|||||||
first_history_info = 0;
|
first_history_info = 0;
|
||||||
} else {
|
} else {
|
||||||
/* Append the History-Info into one long string */
|
/* Append the History-Info into one long string */
|
||||||
const char *history_var = switch_channel_get_variable(channel, "sip_history_info");
|
const char *history_var = switch_event_get_header(event, "sip_history_info");
|
||||||
if (!zstr(history_var)) {
|
if (!zstr(history_var)) {
|
||||||
char *tmp_str;
|
char *tmp_str;
|
||||||
if ((tmp_str = switch_mprintf("%s, %s", history_var, un->un_value))) {
|
if ((tmp_str = switch_mprintf("%s, %s", history_var, un->un_value))) {
|
||||||
|
@ -151,6 +151,9 @@ void sofia_reg_fire_custom_gateway_state_event(sofia_gateway_t *gateway, int sta
|
|||||||
switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "Gateway", gateway->name);
|
switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "Gateway", gateway->name);
|
||||||
switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "State", sofia_state_string(gateway->state));
|
switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "State", sofia_state_string(gateway->state));
|
||||||
switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "Ping-Status", sofia_gateway_status_name(gateway->status));
|
switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "Ping-Status", sofia_gateway_status_name(gateway->status));
|
||||||
|
switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "Register-Network-IP", gateway->register_network_ip);
|
||||||
|
switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "Register-Network-Port", "%d", gateway->register_network_port);
|
||||||
|
|
||||||
if (!zstr(phrase)) {
|
if (!zstr(phrase)) {
|
||||||
switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "Phrase", phrase);
|
switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "Phrase", phrase);
|
||||||
}
|
}
|
||||||
@ -2402,6 +2405,15 @@ void sofia_reg_handle_sip_r_register(int status,
|
|||||||
|
|
||||||
if (sofia_private && gateway) {
|
if (sofia_private && gateway) {
|
||||||
reg_state_t ostate = gateway->state;
|
reg_state_t ostate = gateway->state;
|
||||||
|
char oregister_network_ip[80] = { 0 };
|
||||||
|
char network_ip[80];
|
||||||
|
|
||||||
|
if (!zstr_buf(gateway->register_network_ip)) {
|
||||||
|
strncpy(oregister_network_ip, gateway->register_network_ip, sizeof(oregister_network_ip) - 1);
|
||||||
|
}
|
||||||
|
sofia_glue_get_addr(de->data->e_msg, network_ip, sizeof(network_ip), &gateway->register_network_port);
|
||||||
|
snprintf(gateway->register_network_ip, sizeof(gateway->register_network_ip), (msg_addrinfo(de->data->e_msg))->ai_addr->sa_family == AF_INET6 ? "[%s]" : "%s", network_ip);
|
||||||
|
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case 200:
|
case 200:
|
||||||
if (sip && sip->sip_contact) {
|
if (sip && sip->sip_contact) {
|
||||||
@ -2457,7 +2469,9 @@ void sofia_reg_handle_sip_r_register(int status,
|
|||||||
gateway->name, switch_str_nil(phrase), status, ++gateway->failures);
|
gateway->name, switch_str_nil(phrase), status, ++gateway->failures);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (ostate != gateway->state) {
|
if (ostate != gateway->state ||
|
||||||
|
zstr_buf(oregister_network_ip) || strcmp(oregister_network_ip, gateway->register_network_ip)) {
|
||||||
|
|
||||||
sofia_reg_fire_custom_gateway_state_event(gateway, status, phrase);
|
sofia_reg_fire_custom_gateway_state_event(gateway, status, phrase);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3075,7 +3089,7 @@ auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile,
|
|||||||
switch_assert(call_id);
|
switch_assert(call_id);
|
||||||
|
|
||||||
sql = switch_mprintf("select count(sip_user) from sip_registrations where sip_user='%q' AND call_id <> '%q' AND sip_host='%q'",
|
sql = switch_mprintf("select count(sip_user) from sip_registrations where sip_user='%q' AND call_id <> '%q' AND sip_host='%q'",
|
||||||
username, call_id, domain_name);
|
sip->sip_to->a_url->url_user, call_id, domain_name);
|
||||||
switch_assert(sql != NULL);
|
switch_assert(sql != NULL);
|
||||||
sofia_glue_execute_sql_callback(profile, NULL, sql, sofia_reg_regcount_callback, &count);
|
sofia_glue_execute_sql_callback(profile, NULL, sql, sofia_reg_regcount_callback, &count);
|
||||||
free(sql);
|
free(sql);
|
||||||
|
@ -254,10 +254,10 @@ int ws_handshake(wsh_t *wsh)
|
|||||||
char version[5] = "";
|
char version[5] = "";
|
||||||
char proto[256] = "";
|
char proto[256] = "";
|
||||||
char proto_buf[384] = "";
|
char proto_buf[384] = "";
|
||||||
char input[256] = "";
|
char input[512] = "";
|
||||||
unsigned char output[SHA1_HASH_SIZE] = "";
|
unsigned char output[SHA1_HASH_SIZE] = "";
|
||||||
char b64[256] = "";
|
char b64[256] = "";
|
||||||
char respond[512] = "";
|
char respond[1024] = "";
|
||||||
ssize_t bytes;
|
ssize_t bytes;
|
||||||
char *p, *e = 0;
|
char *p, *e = 0;
|
||||||
|
|
||||||
|
@ -17,3 +17,5 @@ BUILT_SOURCES=$(IKS_LA)
|
|||||||
$(IKS_LA): $(IKS_BUILDDIR) $(IKS_DIR) $(IKS_DIR)/.update
|
$(IKS_LA): $(IKS_BUILDDIR) $(IKS_DIR) $(IKS_DIR)/.update
|
||||||
@cd $(IKS_BUILDDIR) && $(MAKE)
|
@cd $(IKS_BUILDDIR) && $(MAKE)
|
||||||
@$(TOUCH_TARGET)
|
@$(TOUCH_TARGET)
|
||||||
|
|
||||||
|
SUBDIRS=. test
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* mod_rayo for FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
* mod_rayo for FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||||
* Copyright (C) 2013, Grasshopper
|
* Copyright (C) 2013-2018, Grasshopper
|
||||||
*
|
*
|
||||||
* Version: MPL 1.1
|
* Version: MPL 1.1
|
||||||
*
|
*
|
||||||
@ -51,50 +51,50 @@ struct xmpp_error {
|
|||||||
|
|
||||||
#undef XMPP_ERROR
|
#undef XMPP_ERROR
|
||||||
#define XMPP_ERROR(def_name, name, type) \
|
#define XMPP_ERROR(def_name, name, type) \
|
||||||
extern const struct xmpp_error def_name##_val; \
|
SWITCH_DECLARE(const struct xmpp_error) def_name##_val; \
|
||||||
extern const struct xmpp_error *def_name;
|
SWITCH_DECLARE(const struct xmpp_error *) def_name;
|
||||||
#include "xmpp_errors.def"
|
#include "xmpp_errors.def"
|
||||||
|
|
||||||
/* See RFC-3920 XMPP core for error definitions */
|
/* See RFC-3920 XMPP core for error definitions */
|
||||||
extern iks *iks_new_presence(const char *name, const char *namespace, const char *from, const char *to);
|
SWITCH_DECLARE(iks *) iks_new_presence(const char *name, const char *namespace, const char *from, const char *to);
|
||||||
extern iks *iks_new_error(iks *iq, const struct xmpp_error *err);
|
SWITCH_DECLARE(iks *) iks_new_error(iks *iq, const struct xmpp_error *err);
|
||||||
extern iks *iks_new_error_detailed(iks *iq, const struct xmpp_error *err, const char *detail_text);
|
SWITCH_DECLARE(iks *) iks_new_error_detailed(iks *iq, const struct xmpp_error *err, const char *detail_text);
|
||||||
extern iks *iks_new_error_detailed_printf(iks *iq, const struct xmpp_error *err, const char *detail_text_format, ...);
|
SWITCH_DECLARE(iks *) iks_new_error_detailed_printf(iks *iq, const struct xmpp_error *err, const char *detail_text_format, ...);
|
||||||
extern iks *iks_new_iq_result(iks *iq);
|
SWITCH_DECLARE(iks *) iks_new_iq_result(iks *iq);
|
||||||
extern const char *iks_find_attrib_soft(iks *xml, const char *attrib);
|
SWITCH_DECLARE(const char *) iks_find_attrib_soft(iks *xml, const char *attrib);
|
||||||
extern const char *iks_find_attrib_default(iks *xml, const char *attrib, const char *def);
|
SWITCH_DECLARE(const char *) iks_find_attrib_default(iks *xml, const char *attrib, const char *def);
|
||||||
extern int iks_find_bool_attrib(iks *xml, const char *attrib);
|
SWITCH_DECLARE(int) iks_find_bool_attrib(iks *xml, const char *attrib);
|
||||||
extern int iks_find_int_attrib(iks *xml, const char *attrib);
|
SWITCH_DECLARE(int) iks_find_int_attrib(iks *xml, const char *attrib);
|
||||||
extern char iks_find_char_attrib(iks *xml, const char *attrib);
|
SWITCH_DECLARE(char) iks_find_char_attrib(iks *xml, const char *attrib);
|
||||||
extern double iks_find_decimal_attrib(iks *xml, const char *attrib);
|
SWITCH_DECLARE(double) iks_find_decimal_attrib(iks *xml, const char *attrib);
|
||||||
extern const char *iks_node_type_to_string(int type);
|
SWITCH_DECLARE(const char *) iks_node_type_to_string(int type);
|
||||||
extern const char *iks_net_error_to_string(int err);
|
SWITCH_DECLARE(const char *) iks_net_error_to_string(int err);
|
||||||
extern iks *iks_insert_attrib_printf(iks *xml, const char *name, const char *fmt, ...);
|
SWITCH_DECLARE(iks *) iks_insert_attrib_printf(iks *xml, const char *name, const char *fmt, ...);
|
||||||
|
|
||||||
extern char *iks_server_dialback_key(const char *secret, const char *receiving_server, const char *originating_server, const char *stream_id);
|
SWITCH_DECLARE(char *) iks_server_dialback_key(const char *secret, const char *receiving_server, const char *originating_server, const char *stream_id);
|
||||||
extern void iks_sha_print_base64(iksha *sha, char *buf);
|
SWITCH_DECLARE(void) iks_sha_print_base64(iksha *sha, char *buf);
|
||||||
|
|
||||||
/** A function to validate attribute value */
|
/** A function to validate attribute value */
|
||||||
typedef int (*iks_attrib_validation_function)(const char *);
|
typedef int (*iks_attrib_validation_function)(const char *);
|
||||||
|
|
||||||
extern int validate_optional_attrib(iks_attrib_validation_function fn, const char *attrib);
|
SWITCH_DECLARE(int) validate_optional_attrib(iks_attrib_validation_function fn, const char *attrib);
|
||||||
|
|
||||||
#define ELEMENT_DECL(name) extern int VALIDATE_##name(iks *node);
|
#define ELEMENT_DECL(name) SWITCH_DECLARE(int) VALIDATE_##name(iks *node);
|
||||||
#define ELEMENT(name) int VALIDATE_##name(iks *node) { int result = 1; if (!node) return 0;
|
#define ELEMENT(name) int VALIDATE_##name(iks *node) { int result = 1; if (!node) return 0;
|
||||||
#define ATTRIB(name, def, rule) result &= iks_attrib_is_##rule(iks_find_attrib_default(node, #name, #def));
|
#define ATTRIB(name, def, rule) result &= iks_attrib_is_##rule(iks_find_attrib_default(node, #name, #def));
|
||||||
#define OPTIONAL_ATTRIB(name, def, rule) result &= validate_optional_attrib(iks_attrib_is_##rule, iks_find_attrib_default(node, #name, #def));
|
#define OPTIONAL_ATTRIB(name, def, rule) result &= validate_optional_attrib(iks_attrib_is_##rule, iks_find_attrib_default(node, #name, #def));
|
||||||
#define STRING_ATTRIB(name, def, rule) result &= value_matches(iks_find_attrib_default(node, #name, #def), rule);
|
#define STRING_ATTRIB(name, def, rule) result &= value_matches(iks_find_attrib_default(node, #name, #def), rule);
|
||||||
#define ELEMENT_END return result; }
|
#define ELEMENT_END return result; }
|
||||||
|
|
||||||
extern int value_matches(const char *value, const char *rule);
|
SWITCH_DECLARE(int) value_matches(const char *value, const char *rule);
|
||||||
|
|
||||||
extern int iks_attrib_is_bool(const char *value);
|
SWITCH_DECLARE(int) iks_attrib_is_bool(const char *value);
|
||||||
extern int iks_attrib_is_not_negative(const char *value);
|
SWITCH_DECLARE(int) iks_attrib_is_not_negative(const char *value);
|
||||||
extern int iks_attrib_is_positive(const char *value);
|
SWITCH_DECLARE(int) iks_attrib_is_positive(const char *value);
|
||||||
extern int iks_attrib_is_positive_or_neg_one(const char *value);
|
SWITCH_DECLARE(int) iks_attrib_is_positive_or_neg_one(const char *value);
|
||||||
extern int iks_attrib_is_any(const char *value);
|
SWITCH_DECLARE(int) iks_attrib_is_any(const char *value);
|
||||||
extern int iks_attrib_is_decimal_between_zero_and_one(const char *value);
|
SWITCH_DECLARE(int) iks_attrib_is_decimal_between_zero_and_one(const char *value);
|
||||||
extern int iks_attrib_is_dtmf_digit(const char *value);
|
SWITCH_DECLARE(int) iks_attrib_is_dtmf_digit(const char *value);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* mod_rayo for FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
* mod_rayo for FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||||
* Copyright (C) 2013, Grasshopper
|
* Copyright (C) 2013-2018, Grasshopper
|
||||||
*
|
*
|
||||||
* Version: MPL 1.1
|
* Version: MPL 1.1
|
||||||
*
|
*
|
||||||
@ -129,20 +129,20 @@ struct rayo_component {
|
|||||||
#define RAYO_CALL(x) ((struct rayo_call *)x)
|
#define RAYO_CALL(x) ((struct rayo_call *)x)
|
||||||
#define RAYO_MIXER(x) ((struct rayo_mixer *)x)
|
#define RAYO_MIXER(x) ((struct rayo_mixer *)x)
|
||||||
|
|
||||||
extern void rayo_message_send(struct rayo_actor *from, const char *to, iks *payload, int dup, int reply, const char *file, int line);
|
SWITCH_DECLARE(void) rayo_message_send(struct rayo_actor *from, const char *to, iks *payload, int dup, int reply, const char *file, int line);
|
||||||
extern void rayo_message_destroy(struct rayo_message *msg);
|
SWITCH_DECLARE(void) rayo_message_destroy(struct rayo_message *msg);
|
||||||
extern iks *rayo_message_remove_payload(struct rayo_message *msg);
|
SWITCH_DECLARE(iks *) rayo_message_remove_payload(struct rayo_message *msg);
|
||||||
#define RAYO_SEND_MESSAGE(from, to, payload) rayo_message_send(RAYO_ACTOR(from), to, payload, 0, 0, __FILE__, __LINE__)
|
#define RAYO_SEND_MESSAGE(from, to, payload) rayo_message_send(RAYO_ACTOR(from), to, payload, 0, 0, __FILE__, __LINE__)
|
||||||
#define RAYO_SEND_MESSAGE_DUP(from, to, payload) rayo_message_send(RAYO_ACTOR(from), to, payload, 1, 0, __FILE__, __LINE__)
|
#define RAYO_SEND_MESSAGE_DUP(from, to, payload) rayo_message_send(RAYO_ACTOR(from), to, payload, 1, 0, __FILE__, __LINE__)
|
||||||
#define RAYO_SEND_REPLY(from, to, payload) rayo_message_send(RAYO_ACTOR(from), to, payload, 0, 1, __FILE__, __LINE__)
|
#define RAYO_SEND_REPLY(from, to, payload) rayo_message_send(RAYO_ACTOR(from), to, payload, 0, 1, __FILE__, __LINE__)
|
||||||
#define RAYO_SEND_REPLY_DUP(from, to, payload) rayo_message_send(RAYO_ACTOR(from), to, payload, 1, 1, __FILE__, __LINE__)
|
#define RAYO_SEND_REPLY_DUP(from, to, payload) rayo_message_send(RAYO_ACTOR(from), to, payload, 1, 1, __FILE__, __LINE__)
|
||||||
|
|
||||||
extern struct rayo_actor *rayo_actor_locate(const char *jid, const char *file, int line);
|
SWITCH_DECLARE(struct rayo_actor *) rayo_actor_locate(const char *jid, const char *file, int line);
|
||||||
extern struct rayo_actor *rayo_actor_locate_by_id(const char *id, const char *file, int line);
|
SWITCH_DECLARE(struct rayo_actor *) rayo_actor_locate_by_id(const char *id, const char *file, int line);
|
||||||
extern int rayo_actor_seq_next(struct rayo_actor *actor);
|
SWITCH_DECLARE(int) rayo_actor_seq_next(struct rayo_actor *actor);
|
||||||
extern void rayo_actor_retain(struct rayo_actor *actor, const char *file, int line);
|
SWITCH_DECLARE(void) rayo_actor_retain(struct rayo_actor *actor, const char *file, int line);
|
||||||
extern void rayo_actor_release(struct rayo_actor *actor, const char *file, int line);
|
SWITCH_DECLARE(void) rayo_actor_release(struct rayo_actor *actor, const char *file, int line);
|
||||||
extern void rayo_actor_destroy(struct rayo_actor *actor, const char *file, int line);
|
SWITCH_DECLARE(void) rayo_actor_destroy(struct rayo_actor *actor, const char *file, int line);
|
||||||
|
|
||||||
#define RAYO_LOCATE(jid) rayo_actor_locate(jid, __FILE__, __LINE__)
|
#define RAYO_LOCATE(jid) rayo_actor_locate(jid, __FILE__, __LINE__)
|
||||||
#define RAYO_LOCATE_BY_ID(id) rayo_actor_locate_by_id(id, __FILE__, __LINE__)
|
#define RAYO_LOCATE_BY_ID(id) rayo_actor_locate_by_id(id, __FILE__, __LINE__)
|
||||||
@ -156,21 +156,21 @@ extern void rayo_actor_destroy(struct rayo_actor *actor, const char *file, int l
|
|||||||
#define RAYO_DESTROY(x) rayo_actor_destroy(RAYO_ACTOR(x), __FILE__, __LINE__)
|
#define RAYO_DESTROY(x) rayo_actor_destroy(RAYO_ACTOR(x), __FILE__, __LINE__)
|
||||||
#define RAYO_SEQ_NEXT(x) rayo_actor_seq_next(RAYO_ACTOR(x))
|
#define RAYO_SEQ_NEXT(x) rayo_actor_seq_next(RAYO_ACTOR(x))
|
||||||
|
|
||||||
extern int rayo_call_is_joined(struct rayo_call *call);
|
SWITCH_DECLARE(int) rayo_call_is_joined(struct rayo_call *call);
|
||||||
extern int rayo_call_is_faxing(struct rayo_call *call);
|
SWITCH_DECLARE(int) rayo_call_is_faxing(struct rayo_call *call);
|
||||||
extern void rayo_call_set_faxing(struct rayo_call *call, int faxing);
|
SWITCH_DECLARE(void) rayo_call_set_faxing(struct rayo_call *call, int faxing);
|
||||||
extern const char *rayo_call_get_dcp_jid(struct rayo_call *call);
|
SWITCH_DECLARE(const char *) rayo_call_get_dcp_jid(struct rayo_call *call);
|
||||||
|
|
||||||
#define rayo_mixer_get_name(mixer) RAYO_ID(mixer)
|
#define rayo_mixer_get_name(mixer) RAYO_ID(mixer)
|
||||||
|
|
||||||
#define rayo_component_init(component, pool, type, subtype, id, parent, client_jid) _rayo_component_init(component, pool, type, subtype, id, parent, client_jid, NULL, __FILE__, __LINE__)
|
#define rayo_component_init(component, pool, type, subtype, id, parent, client_jid) _rayo_component_init(component, pool, type, subtype, id, parent, client_jid, NULL, __FILE__, __LINE__)
|
||||||
#define rayo_component_init_cleanup(component, pool, type, subtype, id, parent, client_jid, cleanup) _rayo_component_init(component, pool, type, subtype, id, parent, client_jid, cleanup, __FILE__, __LINE__)
|
#define rayo_component_init_cleanup(component, pool, type, subtype, id, parent, client_jid, cleanup) _rayo_component_init(component, pool, type, subtype, id, parent, client_jid, cleanup, __FILE__, __LINE__)
|
||||||
extern struct rayo_component *_rayo_component_init(struct rayo_component *component, switch_memory_pool_t *pool, const char *type, const char *subtype, const char *id, struct rayo_actor *parent, const char *client_jid, rayo_actor_cleanup_fn cleanup, const char *file, int line);
|
SWITCH_DECLARE(struct rayo_component *) _rayo_component_init(struct rayo_component *component, switch_memory_pool_t *pool, const char *type, const char *subtype, const char *id, struct rayo_actor *parent, const char *client_jid, rayo_actor_cleanup_fn cleanup, const char *file, int line);
|
||||||
extern switch_bool_t is_component_actor(struct rayo_actor *);
|
SWITCH_DECLARE(switch_bool_t) is_component_actor(struct rayo_actor *);
|
||||||
|
|
||||||
typedef iks *(*rayo_actor_xmpp_handler)(struct rayo_actor *, struct rayo_message *, void *);
|
typedef iks *(*rayo_actor_xmpp_handler)(struct rayo_actor *, struct rayo_message *, void *);
|
||||||
extern void rayo_actor_command_handler_add(const char *type, const char *subtype, const char *name, rayo_actor_xmpp_handler fn);
|
SWITCH_DECLARE(void) rayo_actor_command_handler_add(const char *type, const char *subtype, const char *name, rayo_actor_xmpp_handler fn);
|
||||||
extern void rayo_actor_event_handler_add(const char *from_type, const char *from_subtype, const char *to_type, const char *to_subtype, const char *name, rayo_actor_xmpp_handler fn);
|
SWITCH_DECLARE(void) rayo_actor_event_handler_add(const char *from_type, const char *from_subtype, const char *to_type, const char *to_subtype, const char *name, rayo_actor_xmpp_handler fn);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* mod_rayo for FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
* mod_rayo for FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||||
* Copyright (C) 2013-2014, Grasshopper
|
* Copyright (C) 2013-2018, Grasshopper
|
||||||
*
|
*
|
||||||
* Version: MPL 1.1
|
* Version: MPL 1.1
|
||||||
*
|
*
|
||||||
@ -30,6 +30,7 @@
|
|||||||
#include <iksemel.h>
|
#include <iksemel.h>
|
||||||
|
|
||||||
#include "nlsml.h"
|
#include "nlsml.h"
|
||||||
|
#include "iks_helpers.h"
|
||||||
|
|
||||||
struct nlsml_parser;
|
struct nlsml_parser;
|
||||||
|
|
||||||
@ -417,48 +418,60 @@ static int isdtmf(const char digit)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct an NLSML result for digit match
|
* Construct an NLSML result for match
|
||||||
* @param digits the matching digits
|
* @param match the matching digits or text
|
||||||
|
* @param interpretation the optional digit interpretation
|
||||||
|
* @param mode dtmf or speech
|
||||||
|
* @param confidence 0-100
|
||||||
|
* @return the NLSML <result>
|
||||||
|
*/
|
||||||
|
iks *nlsml_create_match(const char *match, const char *interpretation, const char *mode, int confidence)
|
||||||
|
{
|
||||||
|
iks *result = iks_new("result");
|
||||||
|
iks_insert_attrib(result, "xmlns", NLSML_NS);
|
||||||
|
iks_insert_attrib(result, "xmlns:xf", "http://www.w3.org/2000/xforms");
|
||||||
|
if (!zstr(match)) {
|
||||||
|
iks *interpretation_node = iks_insert(result, "interpretation");
|
||||||
|
iks *input_node = iks_insert(interpretation_node, "input");
|
||||||
|
iks *instance_node = iks_insert(interpretation_node, "instance");
|
||||||
|
iks_insert_attrib(input_node, "mode", mode);
|
||||||
|
iks_insert_attrib_printf(input_node, "confidence", "%d", confidence);
|
||||||
|
iks_insert_cdata(input_node, match, strlen(match));
|
||||||
|
if (zstr(interpretation)) {
|
||||||
|
iks_insert_cdata(instance_node, match, strlen(match));
|
||||||
|
} else {
|
||||||
|
iks_insert_cdata(instance_node, interpretation, strlen(interpretation));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct an NLSML result for match
|
||||||
|
* @param match the matching digits or text
|
||||||
* @param interpretation the optional digit interpretation
|
* @param interpretation the optional digit interpretation
|
||||||
* @return the NLSML <result>
|
* @return the NLSML <result>
|
||||||
*/
|
*/
|
||||||
iks *nlsml_create_dtmf_match(const char *digits, const char *interpretation)
|
iks *nlsml_create_dtmf_match(const char *digits, const char *interpretation)
|
||||||
{
|
{
|
||||||
iks *result = iks_new("result");
|
iks *result = NULL;
|
||||||
iks_insert_attrib(result, "xmlns", NLSML_NS);
|
int first = 1;
|
||||||
iks_insert_attrib(result, "xmlns:xf", "http://www.w3.org/2000/xforms");
|
int i;
|
||||||
if (!zstr(digits)) {
|
int num_digits = strlen(digits);
|
||||||
int first = 1;
|
switch_stream_handle_t stream = { 0 };
|
||||||
int i;
|
SWITCH_STANDARD_STREAM(stream);
|
||||||
int num_digits = strlen(digits);
|
for (i = 0; i < num_digits; i++) {
|
||||||
switch_stream_handle_t stream = { 0 };
|
if (isdtmf(digits[i])) {
|
||||||
|
if (first) {
|
||||||
iks *interpretation_node = iks_insert(result, "interpretation");
|
stream.write_function(&stream, "%c", digits[i]);
|
||||||
iks *input_node = iks_insert(interpretation_node, "input");
|
first = 0;
|
||||||
iks *instance_node = iks_insert(interpretation_node, "instance");
|
} else {
|
||||||
iks_insert_attrib(input_node, "mode", "dtmf");
|
stream.write_function(&stream, " %c", digits[i]);
|
||||||
iks_insert_attrib(input_node, "confidence", "100");
|
|
||||||
|
|
||||||
SWITCH_STANDARD_STREAM(stream);
|
|
||||||
for (i = 0; i < num_digits; i++) {
|
|
||||||
if (isdtmf(digits[i])) {
|
|
||||||
if (first) {
|
|
||||||
stream.write_function(&stream, "%c", digits[i]);
|
|
||||||
first = 0;
|
|
||||||
} else {
|
|
||||||
stream.write_function(&stream, " %c", digits[i]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
iks_insert_cdata(input_node, stream.data, strlen(stream.data));
|
|
||||||
|
|
||||||
if (zstr(interpretation)) {
|
|
||||||
iks_insert_cdata(instance_node, stream.data, strlen(stream.data));
|
|
||||||
} else {
|
|
||||||
iks_insert_cdata(instance_node, interpretation, strlen(interpretation));
|
|
||||||
}
|
|
||||||
switch_safe_free(stream.data);
|
|
||||||
}
|
}
|
||||||
|
result = nlsml_create_match((const char *)stream.data, interpretation, "dtmf", 100);
|
||||||
|
switch_safe_free(stream.data);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* mod_rayo for FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
* mod_rayo for FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||||
* Copyright (C) 2013-2014, Grasshopper
|
* Copyright (C) 2013-2018, Grasshopper
|
||||||
*
|
*
|
||||||
* Version: MPL 1.1
|
* Version: MPL 1.1
|
||||||
*
|
*
|
||||||
@ -39,11 +39,12 @@ enum nlsml_match_type {
|
|||||||
NMT_NOMATCH
|
NMT_NOMATCH
|
||||||
};
|
};
|
||||||
|
|
||||||
extern int nlsml_init(void);
|
SWITCH_DECLARE(int) nlsml_init(void);
|
||||||
extern void nlsml_destroy(void);
|
SWITCH_DECLARE(void) nlsml_destroy(void);
|
||||||
enum nlsml_match_type nlsml_parse(const char *result, const char *uuid);
|
SWITCH_DECLARE(enum nlsml_match_type) nlsml_parse(const char *result, const char *uuid);
|
||||||
iks *nlsml_normalize(const char *result);
|
SWITCH_DECLARE(iks *) nlsml_normalize(const char *result);
|
||||||
extern iks *nlsml_create_dtmf_match(const char *digits, const char *interpretation);
|
SWITCH_DECLARE(iks *) nlsml_create_dtmf_match(const char *digits, const char *interpretation);
|
||||||
|
SWITCH_DECLARE(iks *) nlsml_create_match(const char *digits, const char *interpretation, const char *mode, int confidence);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -60,37 +60,37 @@
|
|||||||
#define COMPONENT_COMPLETE_HANGUP "hangup", RAYO_EXT_COMPLETE_NS
|
#define COMPONENT_COMPLETE_HANGUP "hangup", RAYO_EXT_COMPLETE_NS
|
||||||
#define COMPONENT_COMPLETE_DONE "done", RAYO_EXT_COMPLETE_NS
|
#define COMPONENT_COMPLETE_DONE "done", RAYO_EXT_COMPLETE_NS
|
||||||
|
|
||||||
extern switch_status_t rayo_components_load(switch_loadable_module_interface_t **module_interface, switch_memory_pool_t *pool, const char *config_file);
|
SWITCH_DECLARE(switch_status_t) rayo_components_load(switch_loadable_module_interface_t **module_interface, switch_memory_pool_t *pool, const char *config_file);
|
||||||
extern switch_status_t rayo_input_component_load(switch_loadable_module_interface_t **module_interface, switch_memory_pool_t *pool, const char *config_file);
|
SWITCH_DECLARE(switch_status_t) rayo_input_component_load(switch_loadable_module_interface_t **module_interface, switch_memory_pool_t *pool, const char *config_file);
|
||||||
extern switch_status_t rayo_output_component_load(switch_loadable_module_interface_t **module_interface, switch_memory_pool_t *pool, const char *config_file);
|
SWITCH_DECLARE(switch_status_t) rayo_output_component_load(switch_loadable_module_interface_t **module_interface, switch_memory_pool_t *pool, const char *config_file);
|
||||||
extern switch_status_t rayo_prompt_component_load(switch_loadable_module_interface_t **module_interface, switch_memory_pool_t *pool, const char *config_file);
|
SWITCH_DECLARE(switch_status_t) rayo_prompt_component_load(switch_loadable_module_interface_t **module_interface, switch_memory_pool_t *pool, const char *config_file);
|
||||||
extern switch_status_t rayo_record_component_load(switch_loadable_module_interface_t **module_interface, switch_memory_pool_t *pool, const char *config_file);
|
SWITCH_DECLARE(switch_status_t) rayo_record_component_load(switch_loadable_module_interface_t **module_interface, switch_memory_pool_t *pool, const char *config_file);
|
||||||
extern switch_status_t rayo_fax_components_load(switch_loadable_module_interface_t **module_interface, switch_memory_pool_t *pool, const char *config_file);
|
SWITCH_DECLARE(switch_status_t) rayo_fax_components_load(switch_loadable_module_interface_t **module_interface, switch_memory_pool_t *pool, const char *config_file);
|
||||||
extern switch_status_t rayo_exec_component_load(switch_loadable_module_interface_t **module_interface, switch_memory_pool_t *pool, const char *config_file);
|
SWITCH_DECLARE(switch_status_t) rayo_exec_component_load(switch_loadable_module_interface_t **module_interface, switch_memory_pool_t *pool, const char *config_file);
|
||||||
|
|
||||||
extern switch_status_t rayo_components_shutdown(void);
|
SWITCH_DECLARE(switch_status_t) rayo_components_shutdown(void);
|
||||||
extern switch_status_t rayo_input_component_shutdown(void);
|
SWITCH_DECLARE(switch_status_t) rayo_input_component_shutdown(void);
|
||||||
extern switch_status_t rayo_output_component_shutdown(void);
|
SWITCH_DECLARE(switch_status_t) rayo_output_component_shutdown(void);
|
||||||
extern switch_status_t rayo_prompt_component_shutdown(void);
|
SWITCH_DECLARE(switch_status_t) rayo_prompt_component_shutdown(void);
|
||||||
extern switch_status_t rayo_record_component_shutdown(void);
|
SWITCH_DECLARE(switch_status_t) rayo_record_component_shutdown(void);
|
||||||
extern switch_status_t rayo_fax_components_shutdown(void);
|
SWITCH_DECLARE(switch_status_t) rayo_fax_components_shutdown(void);
|
||||||
extern switch_status_t rayo_exec_component_shutdown(void);
|
SWITCH_DECLARE(switch_status_t) rayo_exec_component_shutdown(void);
|
||||||
|
|
||||||
extern void rayo_component_send_start(struct rayo_component *component, iks *iq);
|
SWITCH_DECLARE(void) rayo_component_send_start(struct rayo_component *component, iks *iq);
|
||||||
extern void rayo_component_send_iq_error(struct rayo_component *component, iks *iq, const char *error_name, const char *error_type);
|
SWITCH_DECLARE(void) rayo_component_send_iq_error(struct rayo_component *component, iks *iq, const char *error_name, const char *error_type);
|
||||||
extern void rayo_component_send_iq_error_detailed(struct rayo_component *component, iks *iq, const char *error_name, const char *error_type, const char *detail);
|
SWITCH_DECLARE(void) rayo_component_send_iq_error_detailed(struct rayo_component *component, iks *iq, const char *error_name, const char *error_type, const char *detail);
|
||||||
extern void rayo_component_send_complete(struct rayo_component *component, const char *reason, const char *reason_namespace);
|
SWITCH_DECLARE(void) rayo_component_send_complete(struct rayo_component *component, const char *reason, const char *reason_namespace);
|
||||||
extern void rayo_component_send_complete_event(struct rayo_component *component, iks *response);
|
SWITCH_DECLARE(void) rayo_component_send_complete_event(struct rayo_component *component, iks *response);
|
||||||
extern void rayo_component_send_complete_with_metadata(struct rayo_component *component, const char *reason, const char *reason_namespace, iks *meta, int child_of_complete);
|
SWITCH_DECLARE(void) rayo_component_send_complete_with_metadata(struct rayo_component *component, const char *reason, const char *reason_namespace, iks *meta, int child_of_complete);
|
||||||
extern void rayo_component_send_complete_with_metadata_string(struct rayo_component *component, const char *reason, const char *reason_namespace, const char *meta, int child_of_complete);
|
SWITCH_DECLARE(void) rayo_component_send_complete_with_metadata_string(struct rayo_component *component, const char *reason, const char *reason_namespace, const char *meta, int child_of_complete);
|
||||||
|
|
||||||
extern iks *rayo_component_create_complete_event(struct rayo_component *component, const char *reason, const char *reason_namespace);
|
SWITCH_DECLARE(iks *) rayo_component_create_complete_event(struct rayo_component *component, const char *reason, const char *reason_namespace);
|
||||||
extern iks *rayo_component_create_complete_event_with_metadata(struct rayo_component *component, const char *reason, const char *reason_namespace, iks *meta, int child_of_complete);
|
SWITCH_DECLARE(iks *) rayo_component_create_complete_event_with_metadata(struct rayo_component *component, const char *reason, const char *reason_namespace, iks *meta, int child_of_complete);
|
||||||
|
|
||||||
extern void rayo_component_api_execute_async(struct rayo_component *component, const char *cmd, const char *args);
|
SWITCH_DECLARE(void) rayo_component_api_execute_async(struct rayo_component *component, const char *cmd, const char *args);
|
||||||
|
|
||||||
#define RAYO_COMPONENT_LOCATE(id) rayo_component_locate(id, __FILE__, __LINE__)
|
#define RAYO_COMPONENT_LOCATE(id) rayo_component_locate(id, __FILE__, __LINE__)
|
||||||
extern struct rayo_component *rayo_component_locate(const char *id, const char *file, int line);
|
SWITCH_DECLARE(struct rayo_component *) rayo_component_locate(const char *id, const char *file, int line);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -34,9 +34,9 @@
|
|||||||
|
|
||||||
#include "mod_rayo.h"
|
#include "mod_rayo.h"
|
||||||
|
|
||||||
extern switch_status_t rayo_cpa_component_load(switch_loadable_module_interface_t **module_interface, switch_memory_pool_t *pool, const char *config_file);
|
SWITCH_DECLARE(switch_status_t) rayo_cpa_component_load(switch_loadable_module_interface_t **module_interface, switch_memory_pool_t *pool, const char *config_file);
|
||||||
extern void rayo_cpa_component_shutdown(void);
|
SWITCH_DECLARE(void) rayo_cpa_component_shutdown(void);
|
||||||
extern iks *rayo_cpa_component_start(struct rayo_actor *call, struct rayo_message *msg, void *session_data);
|
SWITCH_DECLARE(iks *) rayo_cpa_component_start(struct rayo_actor *call, struct rayo_message *msg, void *session_data);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -33,10 +33,10 @@
|
|||||||
|
|
||||||
#include "mod_rayo.h"
|
#include "mod_rayo.h"
|
||||||
|
|
||||||
extern switch_status_t rayo_cpa_detector_load(switch_loadable_module_interface_t **module_interface, switch_memory_pool_t *pool, const char *config_file);
|
SWITCH_DECLARE(switch_status_t) rayo_cpa_detector_load(switch_loadable_module_interface_t **module_interface, switch_memory_pool_t *pool, const char *config_file);
|
||||||
extern void rayo_cpa_detector_shutdown(void);
|
SWITCH_DECLARE(void) rayo_cpa_detector_shutdown(void);
|
||||||
extern int rayo_cpa_detector_start(const char *call_uuid, const char *signal_ns, const char **error_detail);
|
SWITCH_DECLARE(int) rayo_cpa_detector_start(const char *call_uuid, const char *signal_ns, const char **error_detail);
|
||||||
extern void rayo_cpa_detector_stop(const char *call_uuid, const char *signal_ns);
|
SWITCH_DECLARE(void) rayo_cpa_detector_stop(const char *call_uuid, const char *signal_ns);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* mod_rayo for FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
* mod_rayo for FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||||
* Copyright (C) 2013, Grasshopper
|
* Copyright (C) 2013-2018, Grasshopper
|
||||||
*
|
*
|
||||||
* Version: MPL 1.1
|
* Version: MPL 1.1
|
||||||
*
|
*
|
||||||
@ -42,7 +42,6 @@ ELEMENT(RAYO_INPUT)
|
|||||||
ATTRIB(sensitivity, 0.5, decimal_between_zero_and_one)
|
ATTRIB(sensitivity, 0.5, decimal_between_zero_and_one)
|
||||||
ATTRIB(min-confidence, 0, decimal_between_zero_and_one)
|
ATTRIB(min-confidence, 0, decimal_between_zero_and_one)
|
||||||
ATTRIB(max-silence, -1, positive_or_neg_one)
|
ATTRIB(max-silence, -1, positive_or_neg_one)
|
||||||
/* for now, only NLSML */
|
|
||||||
STRING_ATTRIB(match-content-type, application/nlsml+xml, "application/nlsml+xml")
|
STRING_ATTRIB(match-content-type, application/nlsml+xml, "application/nlsml+xml")
|
||||||
/* internal attribs for prompt support */
|
/* internal attribs for prompt support */
|
||||||
ATTRIB(barge-event, false, bool)
|
ATTRIB(barge-event, false, bool)
|
||||||
@ -72,6 +71,7 @@ ELEMENT(RAYO_OUTPUT)
|
|||||||
ATTRIB(max-time, -1, positive_or_neg_one)
|
ATTRIB(max-time, -1, positive_or_neg_one)
|
||||||
ATTRIB(renderer,, any)
|
ATTRIB(renderer,, any)
|
||||||
ATTRIB(voice,, any)
|
ATTRIB(voice,, any)
|
||||||
|
STRING_ATTRIB(direction, out, "out,in")
|
||||||
ELEMENT_END
|
ELEMENT_END
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -415,7 +415,7 @@ static int validate_call_input(iks *input, const char **error)
|
|||||||
if (!zstr(iks_find_attrib(grammar, "url"))) {
|
if (!zstr(iks_find_attrib(grammar, "url"))) {
|
||||||
*error = "url not allowed with content-type";
|
*error = "url not allowed with content-type";
|
||||||
return 0;
|
return 0;
|
||||||
} else if (strcmp("application/srgs+xml", content_type)) {
|
} else if (strcmp("application/srgs+xml", content_type) && strcmp("text/plain", content_type)) {
|
||||||
*error = "Unsupported content type";
|
*error = "Unsupported content type";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -876,6 +876,30 @@ static iks *start_timers_call_input_component(struct rayo_actor *component, stru
|
|||||||
return iks_new_iq_result(iq);
|
return iks_new_iq_result(iq);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get text / error from result
|
||||||
|
*/
|
||||||
|
static const char *get_detected_speech_result_text(cJSON *result_json, double *confidence, const char **error_text)
|
||||||
|
{
|
||||||
|
const char *result_text = NULL;
|
||||||
|
const char *text = cJSON_GetObjectCstr(result_json, "text");
|
||||||
|
if (confidence) {
|
||||||
|
*confidence = 0.0;
|
||||||
|
}
|
||||||
|
if (!zstr(text)) {
|
||||||
|
cJSON *json_confidence = cJSON_GetObjectItem(result_json, "confidence");
|
||||||
|
if (json_confidence && json_confidence->valuedouble > 0.0) {
|
||||||
|
*confidence = json_confidence->valuedouble;
|
||||||
|
} else {
|
||||||
|
*confidence = 0.99;
|
||||||
|
}
|
||||||
|
result_text = text;
|
||||||
|
} else if (error_text) {
|
||||||
|
*error_text = cJSON_GetObjectCstr(result_json, "error");
|
||||||
|
}
|
||||||
|
return result_text;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle speech detection event
|
* Handle speech detection event
|
||||||
*/
|
*/
|
||||||
@ -905,7 +929,50 @@ static void on_detected_speech_event(switch_event_t *event)
|
|||||||
if (zstr(result)) {
|
if (zstr(result)) {
|
||||||
rayo_component_send_complete(component, INPUT_NOMATCH);
|
rayo_component_send_complete(component, INPUT_NOMATCH);
|
||||||
} else {
|
} else {
|
||||||
if (strchr(result, '<')) {
|
if (result[0] == '{') {
|
||||||
|
// internal FS JSON format
|
||||||
|
cJSON *json_result = cJSON_Parse(result);
|
||||||
|
if (json_result) {
|
||||||
|
// examine result to determine what happened
|
||||||
|
double confidence = 0.0;
|
||||||
|
const char *error_text = NULL;
|
||||||
|
const char *result_text = NULL;
|
||||||
|
result_text = get_detected_speech_result_text(json_result, &confidence, &error_text);
|
||||||
|
if (!zstr(result_text)) {
|
||||||
|
// got result... send as NLSML
|
||||||
|
iks *result = nlsml_create_match(result_text, NULL, "speech", (int)(confidence * 100.0));
|
||||||
|
/* notify of match */
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_UUID_LOG(uuid), SWITCH_LOG_DEBUG, "MATCH = %s\n", result_text);
|
||||||
|
send_match_event(RAYO_COMPONENT(component), result);
|
||||||
|
iks_delete(result);
|
||||||
|
} else if (zstr(error_text)) {
|
||||||
|
// unknown error
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_UUID_LOG(uuid), SWITCH_LOG_WARNING, "No matching text nor error in result: %s!\n", result);
|
||||||
|
rayo_component_send_complete(component, INPUT_NOMATCH);
|
||||||
|
} else if (!strcmp(error_text, "no_input")) {
|
||||||
|
// no input error
|
||||||
|
rayo_component_send_complete(component, INPUT_NOINPUT);
|
||||||
|
} else if (!strcmp(error_text, "no_match")) {
|
||||||
|
// no match error
|
||||||
|
rayo_component_send_complete(component, INPUT_NOMATCH);
|
||||||
|
} else {
|
||||||
|
// generic error
|
||||||
|
iks *response = rayo_component_create_complete_event(component, COMPONENT_COMPLETE_ERROR);
|
||||||
|
iks *error = NULL;
|
||||||
|
if ((error = iks_find(response, "complete"))) {
|
||||||
|
if ((error = iks_find(error, "error"))) {
|
||||||
|
iks_insert_cdata(error, error_text, strlen(error_text));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
rayo_component_send_complete_event(component, response);
|
||||||
|
}
|
||||||
|
cJSON_Delete(json_result);
|
||||||
|
} else {
|
||||||
|
// failed to parse JSON result
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_UUID_LOG(uuid), SWITCH_LOG_WARNING, "Failed to parse JSON result: %s!\n", result);
|
||||||
|
rayo_component_send_complete(component, INPUT_NOMATCH);
|
||||||
|
}
|
||||||
|
} else if (strchr(result, '<')) {
|
||||||
/* got an XML result */
|
/* got an XML result */
|
||||||
enum nlsml_match_type match_type = nlsml_parse(result, uuid);
|
enum nlsml_match_type match_type = nlsml_parse(result, uuid);
|
||||||
switch (match_type) {
|
switch (match_type) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* mod_rayo for FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
* mod_rayo for FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||||
* Copyright (C) 2013-2016, Grasshopper
|
* Copyright (C) 2013-2018, Grasshopper
|
||||||
*
|
*
|
||||||
* Version: MPL 1.1
|
* Version: MPL 1.1
|
||||||
*
|
*
|
||||||
@ -53,6 +53,8 @@ struct output_component {
|
|||||||
const char *renderer;
|
const char *renderer;
|
||||||
/** optional headers to pass to renderer */
|
/** optional headers to pass to renderer */
|
||||||
const char *headers;
|
const char *headers;
|
||||||
|
/** audio direction */
|
||||||
|
const char *direction;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define OUTPUT_FINISH "finish", RAYO_OUTPUT_COMPLETE_NS
|
#define OUTPUT_FINISH "finish", RAYO_OUTPUT_COMPLETE_NS
|
||||||
@ -79,6 +81,7 @@ static struct rayo_component *create_output_component(struct rayo_actor *actor,
|
|||||||
output_component->max_time_ms = iks_find_int_attrib(output, "max-time");
|
output_component->max_time_ms = iks_find_int_attrib(output, "max-time");
|
||||||
output_component->start_paused = iks_find_bool_attrib(output, "start-paused");
|
output_component->start_paused = iks_find_bool_attrib(output, "start-paused");
|
||||||
output_component->renderer = switch_core_strdup(RAYO_POOL(output_component), iks_find_attrib_soft(output, "renderer"));
|
output_component->renderer = switch_core_strdup(RAYO_POOL(output_component), iks_find_attrib_soft(output, "renderer"));
|
||||||
|
output_component->direction = strcmp(iks_find_attrib_soft(output, "direction"), "in") ? "m" : "mr";
|
||||||
output_component->headers = NULL;
|
output_component->headers = NULL;
|
||||||
/* get custom headers */
|
/* get custom headers */
|
||||||
{
|
{
|
||||||
@ -136,7 +139,7 @@ static iks *start_call_output(struct rayo_component *component, switch_core_sess
|
|||||||
}
|
}
|
||||||
stream.write_function(&stream, "}fileman://rayo://%s", RAYO_JID(component));
|
stream.write_function(&stream, "}fileman://rayo://%s", RAYO_JID(component));
|
||||||
|
|
||||||
if (switch_ivr_displace_session(session, stream.data, 0, "m") == SWITCH_STATUS_SUCCESS) {
|
if (switch_ivr_displace_session(session, stream.data, 0, OUTPUT_COMPONENT(component)->direction) == SWITCH_STATUS_SUCCESS) {
|
||||||
RAYO_RELEASE(component);
|
RAYO_RELEASE(component);
|
||||||
} else {
|
} else {
|
||||||
if (component->complete) {
|
if (component->complete) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* mod_rayo for FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
* mod_rayo for FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||||
* Copyright (C) 2013, Grasshopper
|
* Copyright (C) 2013-2018, Grasshopper
|
||||||
*
|
*
|
||||||
* Version: MPL 1.1
|
* Version: MPL 1.1
|
||||||
*
|
*
|
||||||
@ -29,7 +29,7 @@
|
|||||||
#ifndef SASL_H
|
#ifndef SASL_H
|
||||||
#define SASL_H
|
#define SASL_H
|
||||||
|
|
||||||
extern void parse_plain_auth_message(const char *message, char **authzid, char **authcid, char **password);
|
SWITCH_DECLARE(void) parse_plain_auth_message(const char *message, char **authzid, char **authcid, char **password);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* mod_rayo for FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
* mod_rayo for FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||||
* Copyright (C) 2013-2014, Grasshopper
|
* Copyright (C) 2013-2018, Grasshopper
|
||||||
*
|
*
|
||||||
* Version: MPL 1.1
|
* Version: MPL 1.1
|
||||||
*
|
*
|
||||||
@ -45,15 +45,15 @@ enum srgs_match_type {
|
|||||||
SMT_MATCH_END
|
SMT_MATCH_END
|
||||||
};
|
};
|
||||||
|
|
||||||
extern int srgs_init(void);
|
SWITCH_DECLARE(int) srgs_init(void);
|
||||||
extern void srgs_destroy(void);
|
SWITCH_DECLARE(void) srgs_destroy(void);
|
||||||
extern struct srgs_parser *srgs_parser_new(const char *uuid);
|
SWITCH_DECLARE(struct srgs_parser *) srgs_parser_new(const char *uuid);
|
||||||
extern struct srgs_grammar *srgs_parse(struct srgs_parser *parser, const char *document);
|
SWITCH_DECLARE(struct srgs_grammar *) srgs_parse(struct srgs_parser *parser, const char *document);
|
||||||
extern const char *srgs_grammar_to_regex(struct srgs_grammar *grammar);
|
SWITCH_DECLARE(const char *) srgs_grammar_to_regex(struct srgs_grammar *grammar);
|
||||||
extern const char *srgs_grammar_to_jsgf(struct srgs_grammar *grammar);
|
SWITCH_DECLARE(const char *) srgs_grammar_to_jsgf(struct srgs_grammar *grammar);
|
||||||
extern const char *srgs_grammar_to_jsgf_file(struct srgs_grammar *grammar, const char *basedir, const char *ext);
|
SWITCH_DECLARE(const char *) srgs_grammar_to_jsgf_file(struct srgs_grammar *grammar, const char *basedir, const char *ext);
|
||||||
extern enum srgs_match_type srgs_grammar_match(struct srgs_grammar *grammar, const char *input, const char **interpretation);
|
SWITCH_DECLARE(enum srgs_match_type) srgs_grammar_match(struct srgs_grammar *grammar, const char *input, const char **interpretation);
|
||||||
extern void srgs_parser_destroy(struct srgs_parser *parser);
|
SWITCH_DECLARE(void) srgs_parser_destroy(struct srgs_parser *parser);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1,101 +0,0 @@
|
|||||||
/*
|
|
||||||
* mod_rayo for FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
|
||||||
* Copyright (C) 2013, Grasshopper
|
|
||||||
*
|
|
||||||
* 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 mod_rayo for FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
|
||||||
*
|
|
||||||
* The Initial Developer of the Original Code is Grasshopper
|
|
||||||
* Portions created by the Initial Developer are Copyright (C)
|
|
||||||
* the Initial Developer. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Contributor(s):
|
|
||||||
* Chris Rienzo <chris.rienzo@grasshopper.com>
|
|
||||||
*
|
|
||||||
* test.h -- simple unit testing macros
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#ifndef TEST_H
|
|
||||||
#define TEST_H
|
|
||||||
|
|
||||||
#define assert_equals(test, expected_str, expected, actual, file, line) \
|
|
||||||
{ \
|
|
||||||
int actual_val = actual; \
|
|
||||||
if (expected != actual_val) { \
|
|
||||||
printf("TEST\t%s\tFAIL\t%s\t%i\t!=\t%i\t%s:%i\n", test, expected_str, expected, actual_val, file, line); \
|
|
||||||
exit(1); \
|
|
||||||
} else { \
|
|
||||||
printf("TEST\t%s\tPASS\n", test); \
|
|
||||||
} \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define assert_string_equals(test, expected, actual, file, line) \
|
|
||||||
{ \
|
|
||||||
const char *actual_str = actual; \
|
|
||||||
if (!actual_str || strcmp(expected, actual_str)) { \
|
|
||||||
printf("TEST\t%s\tFAIL\t\t%s\t!=\t%s\t%s:%i\n", test, expected, actual_str, file, line); \
|
|
||||||
exit(1); \
|
|
||||||
} else { \
|
|
||||||
printf("TEST\t%s\tPASS\n", test); \
|
|
||||||
} \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define assert_not_null(test, actual, file, line) \
|
|
||||||
{ \
|
|
||||||
const void *actual_val = actual; \
|
|
||||||
if (!actual_val) { \
|
|
||||||
printf("TEST\t%s\tFAIL\t\t\t\t\t%s:%i\n", test, file, line); \
|
|
||||||
exit(1); \
|
|
||||||
} else { \
|
|
||||||
printf("TEST\t%s\tPASS\n", test); \
|
|
||||||
} \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define assert_null(test, actual, file, line) \
|
|
||||||
{ \
|
|
||||||
const void *actual_val = actual; \
|
|
||||||
if (actual_val) { \
|
|
||||||
printf("TEST\t%s\tFAIL\t\t\t\t\t%s:%i\n", test, file, line); \
|
|
||||||
exit(1); \
|
|
||||||
} else { \
|
|
||||||
printf("TEST\t%s\tPASS\n", test); \
|
|
||||||
} \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define ASSERT_EQUALS(expected, actual) assert_equals(#actual, #expected, expected, actual, __FILE__, __LINE__)
|
|
||||||
#define ASSERT_STRING_EQUALS(expected, actual) assert_string_equals(#actual, expected, actual, __FILE__, __LINE__)
|
|
||||||
#define ASSERT_NOT_NULL(actual) assert_not_null(#actual " not null", actual, __FILE__, __LINE__)
|
|
||||||
#define ASSERT_NULL(actual) assert_null(#actual " is null", actual, __FILE__, __LINE__)
|
|
||||||
|
|
||||||
#define SKIP_ASSERT_EQUALS(expected, actual) if (0) { ASSERT_EQUALS(expected, actual); }
|
|
||||||
|
|
||||||
#define TEST(name) printf("TEST BEGIN\t" #name "\n"); name(); printf("TEST END\t"#name "\tPASS\n");
|
|
||||||
|
|
||||||
#define SKIP_TEST(name) if (0) { TEST(name) };
|
|
||||||
|
|
||||||
#define TEST_INIT switch_core_init(0, SWITCH_TRUE, &err);
|
|
||||||
|
|
||||||
#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
|
|
||||||
*/
|
|
||||||
|
|
13
src/mod/event_handlers/mod_rayo/test/Makefile.am
Normal file
13
src/mod/event_handlers/mod_rayo/test/Makefile.am
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
include $(top_srcdir)/build/modmake.rulesam
|
||||||
|
bin_PROGRAMS = test_iks test_nlsml test_srgs
|
||||||
|
|
||||||
|
test_iks_CFLAGS = $(AM_CFLAGS) -I../ -I$(switch_builddir)/libs/iksemel/include $(PCRE_CFLAGS)
|
||||||
|
test_iks_LDFLAGS = $(AM_LDFLAGS) -avoid-version -no-undefined $(freeswitch_LDFLAGS) ../mod_rayo.la $(switch_builddir)/libfreeswitch.la $(CORE_LIBS) $(APR_LIBS)
|
||||||
|
|
||||||
|
test_nlsml_CFLAGS = $(AM_CFLAGS) -I../ -I$(switch_builddir)/libs/iksemel/include $(PCRE_CFLAGS)
|
||||||
|
test_nlsml_LDFLAGS = $(AM_LDFLAGS) -avoid-version -no-undefined $(freeswitch_LDFLAGS) ../mod_rayo.la $(switch_builddir)/libfreeswitch.la $(CORE_LIBS) $(APR_LIBS)
|
||||||
|
|
||||||
|
test_srgs_CFLAGS = $(AM_CFLAGS) -I../ -I$(switch_builddir)/libs/iksemel/include $(PCRE_CFLAGS)
|
||||||
|
test_srgs_LDFLAGS = $(AM_LDFLAGS) -avoid-version -no-undefined $(freeswitch_LDFLAGS) ../mod_rayo.la $(switch_builddir)/libfreeswitch.la $(CORE_LIBS) $(APR_LIBS)
|
||||||
|
|
||||||
|
TESTS = $(bin_PROGRAMS)
|
204
src/mod/event_handlers/mod_rayo/test/test_iks.c
Normal file
204
src/mod/event_handlers/mod_rayo/test/test_iks.c
Normal file
@ -0,0 +1,204 @@
|
|||||||
|
|
||||||
|
|
||||||
|
#include <switch.h>
|
||||||
|
#include <iksemel.h>
|
||||||
|
#include <test/switch_test.h>
|
||||||
|
#include <iks_helpers.h>
|
||||||
|
|
||||||
|
static const char *voxeo_grammar =
|
||||||
|
"<iq id='8847' type='set' from='usera@192.168.1.10/voxeo3' to='e7632f74-8c55-11e2-84b0-e538fa88a1ef@192.168.1.10'><input xmlns='urn:xmpp:rayo:input:1' min-confidence='0.3' mode='DTMF' sensitivity='0.5'><grammar content-type='application/grammar+voxeo'><![CDATA[[1 DIGITS]]]></grammar></input></iq>";
|
||||||
|
|
||||||
|
|
||||||
|
static const char *repeating_bracket =
|
||||||
|
"<iq id='8847' type='set' from='usera@192.168.1.10/voxeo3' to='e7632f74-8c55-11e2-84b0-e538fa88a1ef@192.168.1.10'><input xmlns='urn:xmpp:rayo:input:1' min-confidence='0.3' mode='DTMF' sensitivity='0.5'><grammar content-type='application/grammar+voxeo'><![CDATA[[1 DIGITS]>]]]]]]]]] ]] ]]></grammar></input></iq>";
|
||||||
|
|
||||||
|
|
||||||
|
static const char *normal_cdata =
|
||||||
|
"<iq id='8847' type='set' from='usera@192.168.1.10/voxeo3' to='e7632f74-8c55-11e2-84b0-e538fa88a1ef@192.168.1.10'><input xmlns='urn:xmpp:rayo:input:1' min-confidence='0.3' mode='DTMF' sensitivity='0.5'><grammar content-type='application/grammar+voxeo'><![CDATA[1 DIGITS]]></grammar></input></iq>";
|
||||||
|
|
||||||
|
|
||||||
|
static const char *empty_cdata =
|
||||||
|
"<iq id='8847' type='set' from='usera@192.168.1.10/voxeo3' to='e7632f74-8c55-11e2-84b0-e538fa88a1ef@192.168.1.10'><input xmlns='urn:xmpp:rayo:input:1' min-confidence='0.3' mode='DTMF' sensitivity='0.5'><grammar content-type='application/grammar+voxeo'><![CDATA[]]></grammar></input></iq>";
|
||||||
|
|
||||||
|
static const char *rayo_test_srgs =
|
||||||
|
"<grammar xmlns=\"http://www.w3.org/2001/06/grammar\" root=\"MAINRULE\">\n"
|
||||||
|
" <rule id=\"MAINRULE\">\n"
|
||||||
|
" <one-of>\n"
|
||||||
|
" <item>\n"
|
||||||
|
" <item repeat=\"0-1\"> need a</item>\n"
|
||||||
|
" <item repeat=\"0-1\"> i need a</item>\n"
|
||||||
|
" <one-of>\n"
|
||||||
|
" <item> clue </item>\n"
|
||||||
|
" </one-of>\n"
|
||||||
|
" <tag> out.concept = \"clue\";</tag>\n"
|
||||||
|
" </item>\n"
|
||||||
|
" <item>\n"
|
||||||
|
" <item repeat=\"0-1\"> have an</item>\n"
|
||||||
|
" <item repeat=\"0-1\"> i have an</item>\n"
|
||||||
|
" <one-of>\n"
|
||||||
|
" <item> answer </item>\n"
|
||||||
|
" </one-of>\n"
|
||||||
|
" <tag> out.concept = \"answer\";</tag>\n"
|
||||||
|
" </item>\n"
|
||||||
|
" </one-of>\n"
|
||||||
|
" </rule>\n"
|
||||||
|
"</grammar>";
|
||||||
|
|
||||||
|
|
||||||
|
#define MATCH 1
|
||||||
|
#define NO_MATCH 0
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* main program
|
||||||
|
*/
|
||||||
|
FST_BEGIN()
|
||||||
|
|
||||||
|
FST_SUITE_BEGIN(iks)
|
||||||
|
|
||||||
|
FST_SETUP_BEGIN()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
FST_SETUP_END()
|
||||||
|
|
||||||
|
FST_TEARDOWN_BEGIN()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
FST_TEARDOWN_END()
|
||||||
|
|
||||||
|
|
||||||
|
FST_TEST_BEGIN(iks_cdata_bug)
|
||||||
|
{
|
||||||
|
iks *iq = NULL;
|
||||||
|
iks *input = NULL;
|
||||||
|
iksparser *p = iks_dom_new(&iq);
|
||||||
|
const char *cdata;
|
||||||
|
fst_check(IKS_OK == iks_parse(p, voxeo_grammar, 0, 1));
|
||||||
|
iks_parser_delete(p);
|
||||||
|
fst_check((input = iks_find(iq, "input")));
|
||||||
|
fst_check((cdata = iks_find_cdata(input, "grammar")));
|
||||||
|
fst_check_string_equals("[1 DIGITS]", cdata);
|
||||||
|
iks_delete(iq);
|
||||||
|
}
|
||||||
|
FST_TEST_END()
|
||||||
|
|
||||||
|
FST_TEST_BEGIN(repeating_bracket)
|
||||||
|
{
|
||||||
|
iks *iq = NULL;
|
||||||
|
iks *input = NULL;
|
||||||
|
iksparser *p = iks_dom_new(&iq);
|
||||||
|
const char *cdata;
|
||||||
|
fst_check(IKS_OK == iks_parse(p, repeating_bracket, 0, 1));
|
||||||
|
iks_parser_delete(p);
|
||||||
|
fst_check((input = iks_find(iq, "input")));
|
||||||
|
fst_check((cdata = iks_find_cdata(input, "grammar")));
|
||||||
|
fst_check_string_equals("[1 DIGITS]>]]]]]]]]] ]] ", cdata);
|
||||||
|
iks_delete(iq);
|
||||||
|
}
|
||||||
|
FST_TEST_END()
|
||||||
|
|
||||||
|
FST_TEST_BEGIN(normal_cdata)
|
||||||
|
{
|
||||||
|
iks *iq = NULL;
|
||||||
|
iks *input = NULL;
|
||||||
|
iksparser *p = iks_dom_new(&iq);
|
||||||
|
const char *cdata;
|
||||||
|
fst_check(IKS_OK == iks_parse(p, normal_cdata, 0, 1));
|
||||||
|
iks_parser_delete(p);
|
||||||
|
fst_check((input = iks_find(iq, "input")));
|
||||||
|
fst_check((cdata = iks_find_cdata(input, "grammar")));
|
||||||
|
fst_check_string_equals("1 DIGITS", cdata);
|
||||||
|
iks_delete(iq);
|
||||||
|
}
|
||||||
|
FST_TEST_END()
|
||||||
|
|
||||||
|
FST_TEST_BEGIN(empty_cdata)
|
||||||
|
{
|
||||||
|
iks *iq = NULL;
|
||||||
|
iks *input = NULL;
|
||||||
|
iksparser *p = iks_dom_new(&iq);
|
||||||
|
const char *cdata;
|
||||||
|
fst_check(IKS_OK == iks_parse(p, empty_cdata, 0, 1));
|
||||||
|
iks_parser_delete(p);
|
||||||
|
fst_check((input = iks_find(iq, "input")));
|
||||||
|
fst_check(NULL == (cdata = iks_find_cdata(input, "grammar")));
|
||||||
|
iks_delete(iq);
|
||||||
|
}
|
||||||
|
FST_TEST_END()
|
||||||
|
|
||||||
|
|
||||||
|
FST_TEST_BEGIN(rayo_test_srgs)
|
||||||
|
{
|
||||||
|
iks *grammar = NULL;
|
||||||
|
iksparser *p = iks_dom_new(&grammar);
|
||||||
|
fst_check(IKS_OK == iks_parse(p, rayo_test_srgs, 0, 1));
|
||||||
|
iks_parser_delete(p);
|
||||||
|
iks_delete(grammar);
|
||||||
|
}
|
||||||
|
FST_TEST_END()
|
||||||
|
|
||||||
|
FST_TEST_BEGIN(iks_helper_value_matches)
|
||||||
|
{
|
||||||
|
fst_check(MATCH == value_matches("1", "1,2,3"));
|
||||||
|
fst_check(MATCH == value_matches("2", "1,2,3"));
|
||||||
|
fst_check(MATCH == value_matches("3", "1,2,3"));
|
||||||
|
fst_check(NO_MATCH == value_matches("4", "1,2,3"));
|
||||||
|
fst_check(NO_MATCH == value_matches("1,2", "1,2,3"));
|
||||||
|
fst_check(NO_MATCH == value_matches(NULL, "1,2,3"));
|
||||||
|
fst_check(NO_MATCH == value_matches(NULL, NULL));
|
||||||
|
fst_check(NO_MATCH == value_matches("1", NULL));
|
||||||
|
fst_check(NO_MATCH == value_matches("", "1,2,3"));
|
||||||
|
fst_check(NO_MATCH == value_matches("", ""));
|
||||||
|
fst_check(NO_MATCH == value_matches("1", ""));
|
||||||
|
fst_check(MATCH == value_matches("duplex", "duplex,send,recv"));
|
||||||
|
fst_check(MATCH == value_matches("send", "duplex,send,recv"));
|
||||||
|
fst_check(MATCH == value_matches("recv", "duplex,send,recv"));
|
||||||
|
fst_check(NO_MATCH == value_matches("sendrecv", "duplex,send,recv"));
|
||||||
|
fst_check(MATCH == value_matches("duplex1", "duplex1,duplex2,duplex3"));
|
||||||
|
fst_check(MATCH == value_matches("duplex2", "duplex1,duplex2,duplex3"));
|
||||||
|
fst_check(MATCH == value_matches("duplex3", "duplex1,duplex2,duplex3"));
|
||||||
|
fst_check(NO_MATCH == value_matches("duplex4", "duplex1,duplex2,duplex3"));
|
||||||
|
fst_check(NO_MATCH == value_matches("duplex", "duplex1,duplex2,duplex3"));
|
||||||
|
}
|
||||||
|
FST_TEST_END()
|
||||||
|
|
||||||
|
FST_TEST_BEGIN(dialback_key)
|
||||||
|
{
|
||||||
|
fst_check_string_equals("37c69b1cf07a3f67c04a5ef5902fa5114f2c76fe4a2686482ba5b89323075643", iks_server_dialback_key("s3cr3tf0rd14lb4ck", "xmpp.example.com", "example.org", "D60000229F"));
|
||||||
|
fst_check(NULL == iks_server_dialback_key("", "xmpp.example.com", "example.org", "D60000229F"));
|
||||||
|
fst_check(NULL == iks_server_dialback_key("s3cr3tf0rd14lb4ck", "", "example.org", "D60000229F"));
|
||||||
|
fst_check(NULL == iks_server_dialback_key("s3cr3tf0rd14lb4ck", "xmpp.example.com", "", "D60000229F"));
|
||||||
|
fst_check(NULL == iks_server_dialback_key("s3cr3tf0rd14lb4ck", "xmpp.example.com", "example.org", ""));
|
||||||
|
fst_check(NULL == iks_server_dialback_key(NULL, "xmpp.example.com", "example.org", "D60000229F"));
|
||||||
|
fst_check(NULL == iks_server_dialback_key("s3cr3tf0rd14lb4ck", NULL, "example.org", "D60000229F"));
|
||||||
|
fst_check(NULL == iks_server_dialback_key("s3cr3tf0rd14lb4ck", "xmpp.example.com", NULL, "D60000229F"));
|
||||||
|
fst_check(NULL == iks_server_dialback_key("s3cr3tf0rd14lb4ck", "xmpp.example.com", "example.org", NULL));
|
||||||
|
}
|
||||||
|
FST_TEST_END()
|
||||||
|
|
||||||
|
FST_TEST_BEGIN(validate_dtmf)
|
||||||
|
{
|
||||||
|
fst_check(SWITCH_TRUE == iks_attrib_is_dtmf_digit("1"));
|
||||||
|
fst_check(SWITCH_TRUE == iks_attrib_is_dtmf_digit("A"));
|
||||||
|
fst_check(SWITCH_TRUE == iks_attrib_is_dtmf_digit("a"));
|
||||||
|
fst_check(SWITCH_TRUE == iks_attrib_is_dtmf_digit("D"));
|
||||||
|
fst_check(SWITCH_TRUE == iks_attrib_is_dtmf_digit("d"));
|
||||||
|
fst_check(SWITCH_TRUE == iks_attrib_is_dtmf_digit("*"));
|
||||||
|
fst_check(SWITCH_TRUE == iks_attrib_is_dtmf_digit("#"));
|
||||||
|
fst_check(SWITCH_FALSE == iks_attrib_is_dtmf_digit("E"));
|
||||||
|
fst_check(SWITCH_FALSE == iks_attrib_is_dtmf_digit(NULL));
|
||||||
|
fst_check(SWITCH_FALSE == iks_attrib_is_dtmf_digit(""));
|
||||||
|
fst_check(SWITCH_FALSE == iks_attrib_is_dtmf_digit("11"));
|
||||||
|
fst_check(SWITCH_TRUE == validate_optional_attrib(iks_attrib_is_dtmf_digit, "A"));
|
||||||
|
fst_check(SWITCH_TRUE == validate_optional_attrib(iks_attrib_is_dtmf_digit, "1"));
|
||||||
|
fst_check(SWITCH_FALSE == validate_optional_attrib(iks_attrib_is_dtmf_digit, "Z"));
|
||||||
|
fst_check(SWITCH_FALSE == validate_optional_attrib(iks_attrib_is_dtmf_digit, "11"));
|
||||||
|
fst_check(SWITCH_TRUE == validate_optional_attrib(iks_attrib_is_dtmf_digit, NULL));
|
||||||
|
fst_check(SWITCH_TRUE == validate_optional_attrib(iks_attrib_is_dtmf_digit, ""));
|
||||||
|
}
|
||||||
|
FST_TEST_END()
|
||||||
|
|
||||||
|
|
||||||
|
FST_SUITE_END()
|
||||||
|
|
||||||
|
FST_END()
|
@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
|
|
||||||
#include <switch.h>
|
#include <switch.h>
|
||||||
#include "test.h"
|
#include <test/switch_test.h>
|
||||||
#include "nlsml.h"
|
#include <nlsml.h>
|
||||||
|
|
||||||
static const char *nlsml_good =
|
static const char *nlsml_good =
|
||||||
"<result x-model=\"http://theYesNoModel\""
|
"<result x-model=\"http://theYesNoModel\""
|
||||||
@ -224,22 +224,6 @@ static const char *nlsml_no_match =
|
|||||||
" </interpretation>\n"
|
" </interpretation>\n"
|
||||||
"</result>\n";
|
"</result>\n";
|
||||||
|
|
||||||
/**
|
|
||||||
* Test parsing NLSML example results
|
|
||||||
*/
|
|
||||||
static void test_parse_nlsml_examples(void)
|
|
||||||
{
|
|
||||||
ASSERT_EQUALS(NMT_MATCH, nlsml_parse(nlsml_good, "1234"));
|
|
||||||
ASSERT_EQUALS(NMT_BAD_XML, nlsml_parse(nlsml_bad, "1234"));
|
|
||||||
ASSERT_EQUALS(NMT_MATCH, nlsml_parse(nlsml_match_with_model_instance, "1234"));
|
|
||||||
ASSERT_EQUALS(NMT_MATCH, nlsml_parse(nlsml_multi_input, "1234"));
|
|
||||||
ASSERT_EQUALS(NMT_NOINPUT, nlsml_parse(nlsml_no_input, "1234"));
|
|
||||||
ASSERT_EQUALS(NMT_MATCH, nlsml_parse(nlsml_multi_input_dtmf, "1234"));
|
|
||||||
ASSERT_EQUALS(NMT_MATCH, nlsml_parse(nlsml_meta, "1234"));
|
|
||||||
ASSERT_EQUALS(NMT_MATCH, nlsml_parse(nlsml_simple_ambiguity, "1234"));
|
|
||||||
ASSERT_EQUALS(NMT_MATCH, nlsml_parse(nlsml_mixed_initiative, "1234"));
|
|
||||||
ASSERT_EQUALS(NMT_NOMATCH, nlsml_parse(nlsml_no_match, "1234"));
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *nlsml_dtmf_result =
|
static const char *nlsml_dtmf_result =
|
||||||
"<result xmlns='http://www.ietf.org/xml/ns/mrcpv2' "
|
"<result xmlns='http://www.ietf.org/xml/ns/mrcpv2' "
|
||||||
@ -248,38 +232,6 @@ static const char *nlsml_dtmf_result =
|
|||||||
"<instance>1 2 3 4</instance>"
|
"<instance>1 2 3 4</instance>"
|
||||||
"</interpretation></result>";
|
"</interpretation></result>";
|
||||||
|
|
||||||
/**
|
|
||||||
* Test creating DTMF match result
|
|
||||||
*/
|
|
||||||
static void test_create_dtmf_match(void)
|
|
||||||
{
|
|
||||||
iks *result = nlsml_create_dtmf_match("1234", NULL);
|
|
||||||
char *result_str;
|
|
||||||
ASSERT_NOT_NULL(result);
|
|
||||||
result_str = iks_string(NULL, result);
|
|
||||||
ASSERT_STRING_EQUALS(nlsml_dtmf_result, result_str);
|
|
||||||
iks_free(result_str);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *nlsml_dtmf_instance_result =
|
|
||||||
"<result xmlns='http://www.ietf.org/xml/ns/mrcpv2' "
|
|
||||||
"xmlns:xf='http://www.w3.org/2000/xforms'><interpretation>"
|
|
||||||
"<input mode='dtmf' confidence='100'>1</input>"
|
|
||||||
"<instance>foo</instance>"
|
|
||||||
"</interpretation></result>";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Test creating DTMF match result with instance interpretation
|
|
||||||
*/
|
|
||||||
static void test_create_dtmf_instance(void)
|
|
||||||
{
|
|
||||||
iks *result = nlsml_create_dtmf_match("1", "foo");
|
|
||||||
char *result_str;
|
|
||||||
ASSERT_NOT_NULL(result);
|
|
||||||
result_str = iks_string(NULL, result);
|
|
||||||
ASSERT_STRING_EQUALS(nlsml_dtmf_instance_result, result_str);
|
|
||||||
iks_free(result_str);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *nlsml_good_normalized =
|
static const char *nlsml_good_normalized =
|
||||||
"<result x-model='http://theYesNoModel'"
|
"<result x-model='http://theYesNoModel'"
|
||||||
@ -296,28 +248,89 @@ static const char *nlsml_good_normalized =
|
|||||||
"</interpretation>"
|
"</interpretation>"
|
||||||
"</result>";
|
"</result>";
|
||||||
|
|
||||||
|
|
||||||
|
static const char *nlsml_dtmf_instance_result =
|
||||||
|
"<result xmlns='http://www.ietf.org/xml/ns/mrcpv2' "
|
||||||
|
"xmlns:xf='http://www.w3.org/2000/xforms'><interpretation>"
|
||||||
|
"<input mode='dtmf' confidence='100'>1</input>"
|
||||||
|
"<instance>foo</instance>"
|
||||||
|
"</interpretation></result>";
|
||||||
|
|
||||||
|
|
||||||
|
FST_BEGIN()
|
||||||
|
|
||||||
|
FST_SUITE_BEGIN(nlsml)
|
||||||
|
|
||||||
|
FST_SETUP_BEGIN()
|
||||||
|
{
|
||||||
|
fst_requires(nlsml_init());
|
||||||
|
}
|
||||||
|
FST_SETUP_END()
|
||||||
|
|
||||||
|
FST_TEARDOWN_BEGIN()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
FST_TEARDOWN_END()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test parsing NLSML example results
|
||||||
|
*/
|
||||||
|
FST_TEST_BEGIN(parse_nlsml_examples)
|
||||||
|
{
|
||||||
|
fst_check(NMT_MATCH == nlsml_parse(nlsml_good, "1234"));
|
||||||
|
fst_check(NMT_BAD_XML == nlsml_parse(nlsml_bad, "1234"));
|
||||||
|
fst_check(NMT_MATCH == nlsml_parse(nlsml_match_with_model_instance, "1234"));
|
||||||
|
fst_check(NMT_MATCH == nlsml_parse(nlsml_multi_input, "1234"));
|
||||||
|
fst_check(NMT_NOINPUT == nlsml_parse(nlsml_no_input, "1234"));
|
||||||
|
fst_check(NMT_MATCH == nlsml_parse(nlsml_multi_input_dtmf, "1234"));
|
||||||
|
fst_check(NMT_MATCH == nlsml_parse(nlsml_meta, "1234"));
|
||||||
|
fst_check(NMT_MATCH == nlsml_parse(nlsml_simple_ambiguity, "1234"));
|
||||||
|
fst_check(NMT_MATCH == nlsml_parse(nlsml_mixed_initiative, "1234"));
|
||||||
|
fst_check(NMT_NOMATCH == nlsml_parse(nlsml_no_match, "1234"));
|
||||||
|
}
|
||||||
|
FST_TEST_END()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test creating DTMF match result
|
||||||
|
*/
|
||||||
|
FST_TEST_BEGIN(create_dtmf_match)
|
||||||
|
{
|
||||||
|
iks *result = nlsml_create_dtmf_match("1234", NULL);
|
||||||
|
char *result_str;
|
||||||
|
fst_requires(result);
|
||||||
|
result_str = iks_string(NULL, result);
|
||||||
|
fst_check_string_equals(nlsml_dtmf_result, result_str);
|
||||||
|
iks_free(result_str);
|
||||||
|
}
|
||||||
|
FST_TEST_END()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test creating DTMF match result with instance interpretation
|
||||||
|
*/
|
||||||
|
FST_TEST_BEGIN(create_dtmf_instance)
|
||||||
|
{
|
||||||
|
iks *result = nlsml_create_dtmf_match("1", "foo");
|
||||||
|
char *result_str;
|
||||||
|
fst_requires(result);
|
||||||
|
result_str = iks_string(NULL, result);
|
||||||
|
fst_check_string_equals(nlsml_dtmf_instance_result, result_str);
|
||||||
|
iks_free(result_str);
|
||||||
|
}
|
||||||
|
FST_TEST_END()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test NLSML normalization
|
* Test NLSML normalization
|
||||||
*/
|
*/
|
||||||
static void test_normalize(void)
|
FST_TEST_BEGIN(normalize)
|
||||||
{
|
{
|
||||||
iks *result = nlsml_normalize(nlsml_good);
|
iks *result = nlsml_normalize(nlsml_good);
|
||||||
ASSERT_NOT_NULL(result);
|
fst_requires(result);
|
||||||
ASSERT_STRING_EQUALS(nlsml_good_normalized, iks_string(NULL, result));
|
fst_check_string_equals(nlsml_good_normalized, iks_string(NULL, result));
|
||||||
}
|
}
|
||||||
|
FST_TEST_END()
|
||||||
|
|
||||||
/**
|
|
||||||
* main program
|
|
||||||
*/
|
|
||||||
int main(int argc, char **argv)
|
|
||||||
{
|
|
||||||
const char *err;
|
|
||||||
TEST_INIT
|
|
||||||
nlsml_init();
|
|
||||||
TEST(test_parse_nlsml_examples);
|
|
||||||
TEST(test_create_dtmf_match);
|
|
||||||
TEST(test_create_dtmf_instance);
|
|
||||||
TEST(test_normalize);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
FST_SUITE_END()
|
||||||
|
|
||||||
|
FST_END()
|
File diff suppressed because it is too large
Load Diff
@ -1,18 +0,0 @@
|
|||||||
BASE=../../../../..
|
|
||||||
|
|
||||||
IKS_DIR=$(BASE)/libs/iksemel
|
|
||||||
IKS_LA=$(IKS_DIR)/src/libiksemel.la
|
|
||||||
LOCAL_CFLAGS += -I../ -I$(BASE)/libs/iksemel/include
|
|
||||||
LOCAL_OBJS= $(PCRE_LA) $(IKS_LA) main.o ../iks_helpers.o
|
|
||||||
LOCAL_SOURCES= main.c
|
|
||||||
include $(BASE)/build/modmake.rules
|
|
||||||
|
|
||||||
$(IKS_LA): $(IKS_DIR) $(IKS_DIR)/.update
|
|
||||||
@cd $(IKS_DIR) && $(MAKE)
|
|
||||||
@$(TOUCH_TARGET)
|
|
||||||
|
|
||||||
local_all:
|
|
||||||
libtool --mode=link gcc main.o ../iks_helpers.o -o test test_iks.la
|
|
||||||
|
|
||||||
local_clean:
|
|
||||||
-rm test
|
|
@ -1,185 +0,0 @@
|
|||||||
|
|
||||||
|
|
||||||
#include <switch.h>
|
|
||||||
#include <iksemel.h>
|
|
||||||
#include "test.h"
|
|
||||||
#include "iks_helpers.h"
|
|
||||||
|
|
||||||
static const char *voxeo_grammar =
|
|
||||||
"<iq id='8847' type='set' from='usera@192.168.1.10/voxeo3' to='e7632f74-8c55-11e2-84b0-e538fa88a1ef@192.168.1.10'><input xmlns='urn:xmpp:rayo:input:1' min-confidence='0.3' mode='DTMF' sensitivity='0.5'><grammar content-type='application/grammar+voxeo'><![CDATA[[1 DIGITS]]]></grammar></input></iq>";
|
|
||||||
|
|
||||||
static void test_iks_cdata_bug(void)
|
|
||||||
{
|
|
||||||
iks *iq = NULL;
|
|
||||||
iks *input = NULL;
|
|
||||||
iksparser *p = iks_dom_new(&iq);
|
|
||||||
const char *cdata;
|
|
||||||
ASSERT_EQUALS(IKS_OK, iks_parse(p, voxeo_grammar, 0, 1));
|
|
||||||
iks_parser_delete(p);
|
|
||||||
ASSERT_NOT_NULL((input = iks_find(iq, "input")));
|
|
||||||
ASSERT_NOT_NULL((cdata = iks_find_cdata(input, "grammar")));
|
|
||||||
ASSERT_STRING_EQUALS("[1 DIGITS]", cdata);
|
|
||||||
iks_delete(iq);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *repeating_bracket =
|
|
||||||
"<iq id='8847' type='set' from='usera@192.168.1.10/voxeo3' to='e7632f74-8c55-11e2-84b0-e538fa88a1ef@192.168.1.10'><input xmlns='urn:xmpp:rayo:input:1' min-confidence='0.3' mode='DTMF' sensitivity='0.5'><grammar content-type='application/grammar+voxeo'><![CDATA[[1 DIGITS]>]]]]]]]]] ]] ]]></grammar></input></iq>";
|
|
||||||
|
|
||||||
static void test_repeating_bracket(void)
|
|
||||||
{
|
|
||||||
iks *iq = NULL;
|
|
||||||
iks *input = NULL;
|
|
||||||
iksparser *p = iks_dom_new(&iq);
|
|
||||||
const char *cdata;
|
|
||||||
ASSERT_EQUALS(IKS_OK, iks_parse(p, repeating_bracket, 0, 1));
|
|
||||||
iks_parser_delete(p);
|
|
||||||
ASSERT_NOT_NULL((input = iks_find(iq, "input")));
|
|
||||||
ASSERT_NOT_NULL((cdata = iks_find_cdata(input, "grammar")));
|
|
||||||
ASSERT_STRING_EQUALS("[1 DIGITS]>]]]]]]]]] ]] ", cdata);
|
|
||||||
iks_delete(iq);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *normal_cdata =
|
|
||||||
"<iq id='8847' type='set' from='usera@192.168.1.10/voxeo3' to='e7632f74-8c55-11e2-84b0-e538fa88a1ef@192.168.1.10'><input xmlns='urn:xmpp:rayo:input:1' min-confidence='0.3' mode='DTMF' sensitivity='0.5'><grammar content-type='application/grammar+voxeo'><![CDATA[1 DIGITS]]></grammar></input></iq>";
|
|
||||||
|
|
||||||
static void test_normal_cdata(void)
|
|
||||||
{
|
|
||||||
iks *iq = NULL;
|
|
||||||
iks *input = NULL;
|
|
||||||
iksparser *p = iks_dom_new(&iq);
|
|
||||||
const char *cdata;
|
|
||||||
ASSERT_EQUALS(IKS_OK, iks_parse(p, normal_cdata, 0, 1));
|
|
||||||
iks_parser_delete(p);
|
|
||||||
ASSERT_NOT_NULL((input = iks_find(iq, "input")));
|
|
||||||
ASSERT_NOT_NULL((cdata = iks_find_cdata(input, "grammar")));
|
|
||||||
ASSERT_STRING_EQUALS("1 DIGITS", cdata);
|
|
||||||
iks_delete(iq);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *empty_cdata =
|
|
||||||
"<iq id='8847' type='set' from='usera@192.168.1.10/voxeo3' to='e7632f74-8c55-11e2-84b0-e538fa88a1ef@192.168.1.10'><input xmlns='urn:xmpp:rayo:input:1' min-confidence='0.3' mode='DTMF' sensitivity='0.5'><grammar content-type='application/grammar+voxeo'><![CDATA[]]></grammar></input></iq>";
|
|
||||||
|
|
||||||
static void test_empty_cdata(void)
|
|
||||||
{
|
|
||||||
iks *iq = NULL;
|
|
||||||
iks *input = NULL;
|
|
||||||
iksparser *p = iks_dom_new(&iq);
|
|
||||||
const char *cdata;
|
|
||||||
ASSERT_EQUALS(IKS_OK, iks_parse(p, empty_cdata, 0, 1));
|
|
||||||
iks_parser_delete(p);
|
|
||||||
ASSERT_NOT_NULL((input = iks_find(iq, "input")));
|
|
||||||
ASSERT_NULL((cdata = iks_find_cdata(input, "grammar")));
|
|
||||||
iks_delete(iq);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *rayo_test_srgs =
|
|
||||||
"<grammar xmlns=\"http://www.w3.org/2001/06/grammar\" root=\"MAINRULE\">\n"
|
|
||||||
" <rule id=\"MAINRULE\">\n"
|
|
||||||
" <one-of>\n"
|
|
||||||
" <item>\n"
|
|
||||||
" <item repeat=\"0-1\"> need a</item>\n"
|
|
||||||
" <item repeat=\"0-1\"> i need a</item>\n"
|
|
||||||
" <one-of>\n"
|
|
||||||
" <item> clue </item>\n"
|
|
||||||
" </one-of>\n"
|
|
||||||
" <tag> out.concept = \"clue\";</tag>\n"
|
|
||||||
" </item>\n"
|
|
||||||
" <item>\n"
|
|
||||||
" <item repeat=\"0-1\"> have an</item>\n"
|
|
||||||
" <item repeat=\"0-1\"> i have an</item>\n"
|
|
||||||
" <one-of>\n"
|
|
||||||
" <item> answer </item>\n"
|
|
||||||
" </one-of>\n"
|
|
||||||
" <tag> out.concept = \"answer\";</tag>\n"
|
|
||||||
" </item>\n"
|
|
||||||
" </one-of>\n"
|
|
||||||
" </rule>\n"
|
|
||||||
"</grammar>";
|
|
||||||
|
|
||||||
static void test_rayo_test_srgs(void)
|
|
||||||
{
|
|
||||||
iks *grammar = NULL;
|
|
||||||
iksparser *p = iks_dom_new(&grammar);
|
|
||||||
ASSERT_EQUALS(IKS_OK, iks_parse(p, rayo_test_srgs, 0, 1));
|
|
||||||
iks_parser_delete(p);
|
|
||||||
iks_delete(grammar);
|
|
||||||
}
|
|
||||||
|
|
||||||
#define MATCH 1
|
|
||||||
#define NO_MATCH 0
|
|
||||||
|
|
||||||
static void test_iks_helper_value_matches(void)
|
|
||||||
{
|
|
||||||
ASSERT_EQUALS(MATCH, value_matches("1", "1,2,3"));
|
|
||||||
ASSERT_EQUALS(MATCH, value_matches("2", "1,2,3"));
|
|
||||||
ASSERT_EQUALS(MATCH, value_matches("3", "1,2,3"));
|
|
||||||
ASSERT_EQUALS(NO_MATCH, value_matches("4", "1,2,3"));
|
|
||||||
ASSERT_EQUALS(NO_MATCH, value_matches("1,2", "1,2,3"));
|
|
||||||
ASSERT_EQUALS(NO_MATCH, value_matches(NULL, "1,2,3"));
|
|
||||||
ASSERT_EQUALS(NO_MATCH, value_matches(NULL, NULL));
|
|
||||||
ASSERT_EQUALS(NO_MATCH, value_matches("1", NULL));
|
|
||||||
ASSERT_EQUALS(NO_MATCH, value_matches("", "1,2,3"));
|
|
||||||
ASSERT_EQUALS(NO_MATCH, value_matches("", ""));
|
|
||||||
ASSERT_EQUALS(NO_MATCH, value_matches("1", ""));
|
|
||||||
ASSERT_EQUALS(MATCH, value_matches("duplex", "duplex,send,recv"));
|
|
||||||
ASSERT_EQUALS(MATCH, value_matches("send", "duplex,send,recv"));
|
|
||||||
ASSERT_EQUALS(MATCH, value_matches("recv", "duplex,send,recv"));
|
|
||||||
ASSERT_EQUALS(NO_MATCH, value_matches("sendrecv", "duplex,send,recv"));
|
|
||||||
ASSERT_EQUALS(MATCH, value_matches("duplex1", "duplex1,duplex2,duplex3"));
|
|
||||||
ASSERT_EQUALS(MATCH, value_matches("duplex2", "duplex1,duplex2,duplex3"));
|
|
||||||
ASSERT_EQUALS(MATCH, value_matches("duplex3", "duplex1,duplex2,duplex3"));
|
|
||||||
ASSERT_EQUALS(NO_MATCH, value_matches("duplex4", "duplex1,duplex2,duplex3"));
|
|
||||||
ASSERT_EQUALS(NO_MATCH, value_matches("duplex", "duplex1,duplex2,duplex3"));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void test_dialback_key(void)
|
|
||||||
{
|
|
||||||
ASSERT_STRING_EQUALS("37c69b1cf07a3f67c04a5ef5902fa5114f2c76fe4a2686482ba5b89323075643", iks_server_dialback_key("s3cr3tf0rd14lb4ck", "xmpp.example.com", "example.org", "D60000229F"));
|
|
||||||
ASSERT_NULL(iks_server_dialback_key("", "xmpp.example.com", "example.org", "D60000229F"));
|
|
||||||
ASSERT_NULL(iks_server_dialback_key("s3cr3tf0rd14lb4ck", "", "example.org", "D60000229F"));
|
|
||||||
ASSERT_NULL(iks_server_dialback_key("s3cr3tf0rd14lb4ck", "xmpp.example.com", "", "D60000229F"));
|
|
||||||
ASSERT_NULL(iks_server_dialback_key("s3cr3tf0rd14lb4ck", "xmpp.example.com", "example.org", ""));
|
|
||||||
ASSERT_NULL(iks_server_dialback_key(NULL, "xmpp.example.com", "example.org", "D60000229F"));
|
|
||||||
ASSERT_NULL(iks_server_dialback_key("s3cr3tf0rd14lb4ck", NULL, "example.org", "D60000229F"));
|
|
||||||
ASSERT_NULL(iks_server_dialback_key("s3cr3tf0rd14lb4ck", "xmpp.example.com", NULL, "D60000229F"));
|
|
||||||
ASSERT_NULL(iks_server_dialback_key("s3cr3tf0rd14lb4ck", "xmpp.example.com", "example.org", NULL));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void test_validate_dtmf(void)
|
|
||||||
{
|
|
||||||
ASSERT_EQUALS(SWITCH_TRUE, iks_attrib_is_dtmf_digit("1"));
|
|
||||||
ASSERT_EQUALS(SWITCH_TRUE, iks_attrib_is_dtmf_digit("A"));
|
|
||||||
ASSERT_EQUALS(SWITCH_TRUE, iks_attrib_is_dtmf_digit("a"));
|
|
||||||
ASSERT_EQUALS(SWITCH_TRUE, iks_attrib_is_dtmf_digit("D"));
|
|
||||||
ASSERT_EQUALS(SWITCH_TRUE, iks_attrib_is_dtmf_digit("d"));
|
|
||||||
ASSERT_EQUALS(SWITCH_TRUE, iks_attrib_is_dtmf_digit("*"));
|
|
||||||
ASSERT_EQUALS(SWITCH_TRUE, iks_attrib_is_dtmf_digit("#"));
|
|
||||||
ASSERT_EQUALS(SWITCH_FALSE, iks_attrib_is_dtmf_digit("E"));
|
|
||||||
ASSERT_EQUALS(SWITCH_FALSE, iks_attrib_is_dtmf_digit(NULL));
|
|
||||||
ASSERT_EQUALS(SWITCH_FALSE, iks_attrib_is_dtmf_digit(""));
|
|
||||||
ASSERT_EQUALS(SWITCH_FALSE, iks_attrib_is_dtmf_digit("11"));
|
|
||||||
ASSERT_EQUALS(SWITCH_TRUE, validate_optional_attrib(iks_attrib_is_dtmf_digit, "A"));
|
|
||||||
ASSERT_EQUALS(SWITCH_TRUE, validate_optional_attrib(iks_attrib_is_dtmf_digit, "1"));
|
|
||||||
ASSERT_EQUALS(SWITCH_FALSE, validate_optional_attrib(iks_attrib_is_dtmf_digit, "Z"));
|
|
||||||
ASSERT_EQUALS(SWITCH_FALSE, validate_optional_attrib(iks_attrib_is_dtmf_digit, "11"));
|
|
||||||
ASSERT_EQUALS(SWITCH_TRUE, validate_optional_attrib(iks_attrib_is_dtmf_digit, NULL));
|
|
||||||
ASSERT_EQUALS(SWITCH_TRUE, validate_optional_attrib(iks_attrib_is_dtmf_digit, ""));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* main program
|
|
||||||
*/
|
|
||||||
int main(int argc, char **argv)
|
|
||||||
{
|
|
||||||
const char *err;
|
|
||||||
TEST_INIT
|
|
||||||
TEST(test_iks_cdata_bug);
|
|
||||||
TEST(test_repeating_bracket);
|
|
||||||
TEST(test_normal_cdata);
|
|
||||||
TEST(test_empty_cdata);
|
|
||||||
TEST(test_rayo_test_srgs);
|
|
||||||
TEST(test_iks_helper_value_matches);
|
|
||||||
TEST(test_dialback_key);
|
|
||||||
TEST(test_validate_dtmf);
|
|
||||||
return 0;
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
int dummy(int i)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,18 +0,0 @@
|
|||||||
BASE=../../../../..
|
|
||||||
|
|
||||||
IKS_DIR=$(BASE)/libs/iksemel
|
|
||||||
IKS_LA=$(IKS_DIR)/src/libiksemel.la
|
|
||||||
LOCAL_CFLAGS += -I../ -I$(BASE)/libs/iksemel/include
|
|
||||||
LOCAL_OBJS= $(PCRE_LA) $(IKS_LA) main.o ../nlsml.o
|
|
||||||
LOCAL_SOURCES= main.c
|
|
||||||
include $(BASE)/build/modmake.rules
|
|
||||||
|
|
||||||
$(IKS_LA): $(IKS_DIR) $(IKS_DIR)/.update
|
|
||||||
@cd $(IKS_DIR) && $(MAKE)
|
|
||||||
@$(TOUCH_TARGET)
|
|
||||||
|
|
||||||
local_all:
|
|
||||||
libtool --mode=link gcc main.o ../nlsml.o -o test test_nlsml.la
|
|
||||||
|
|
||||||
local_clean:
|
|
||||||
-rm test
|
|
@ -1,6 +0,0 @@
|
|||||||
int dummy(int i)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,18 +0,0 @@
|
|||||||
BASE=../../../../..
|
|
||||||
|
|
||||||
IKS_DIR=$(BASE)/libs/iksemel
|
|
||||||
IKS_LA=$(IKS_DIR)/src/libiksemel.la
|
|
||||||
LOCAL_CFLAGS += -I../ -I$(BASE)/libs/iksemel/include
|
|
||||||
LOCAL_OBJS= $(PCRE_LA) $(IKS_LA) main.o ../srgs.o
|
|
||||||
LOCAL_SOURCES= main.c
|
|
||||||
include $(BASE)/build/modmake.rules
|
|
||||||
|
|
||||||
$(IKS_LA): $(IKS_DIR) $(IKS_DIR)/.update
|
|
||||||
@cd $(IKS_DIR) && $(MAKE)
|
|
||||||
@$(TOUCH_TARGET)
|
|
||||||
|
|
||||||
local_all:
|
|
||||||
libtool --mode=link gcc main.o ../srgs.o -o test test_srgs.la
|
|
||||||
|
|
||||||
local_clean:
|
|
||||||
-rm test
|
|
@ -1,6 +0,0 @@
|
|||||||
int dummy(int i)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* mod_rayo for FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
* mod_rayo for FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||||
* Copyright (C) 2013-2015, Grasshopper
|
* Copyright (C) 2013-2018, Grasshopper
|
||||||
*
|
*
|
||||||
* Version: MPL 1.1
|
* Version: MPL 1.1
|
||||||
*
|
*
|
||||||
@ -37,22 +37,22 @@ typedef int (* xmpp_stream_ready_callback)(struct xmpp_stream *stream);
|
|||||||
typedef void (* xmpp_stream_recv_callback)(struct xmpp_stream *stream, iks *stanza);
|
typedef void (* xmpp_stream_recv_callback)(struct xmpp_stream *stream, iks *stanza);
|
||||||
typedef void (* xmpp_stream_destroy_callback)(struct xmpp_stream *stream);
|
typedef void (* xmpp_stream_destroy_callback)(struct xmpp_stream *stream);
|
||||||
|
|
||||||
extern struct xmpp_stream_context *xmpp_stream_context_create(const char *domain, const char *domain_secret, xmpp_stream_bind_callback bind_cb, xmpp_stream_ready_callback ready, xmpp_stream_recv_callback recv, xmpp_stream_destroy_callback destroy);
|
SWITCH_DECLARE(struct xmpp_stream_context *) xmpp_stream_context_create(const char *domain, const char *domain_secret, xmpp_stream_bind_callback bind_cb, xmpp_stream_ready_callback ready, xmpp_stream_recv_callback recv, xmpp_stream_destroy_callback destroy);
|
||||||
extern void xmpp_stream_context_add_cert(struct xmpp_stream_context *context, const char *cert_pem_file);
|
SWITCH_DECLARE(void) xmpp_stream_context_add_cert(struct xmpp_stream_context *context, const char *cert_pem_file);
|
||||||
extern void xmpp_stream_context_add_key(struct xmpp_stream_context *context, const char *key_pem_file);
|
SWITCH_DECLARE(void) xmpp_stream_context_add_key(struct xmpp_stream_context *context, const char *key_pem_file);
|
||||||
extern void xmpp_stream_context_add_user(struct xmpp_stream_context *context, const char *user, const char *password);
|
SWITCH_DECLARE(void) xmpp_stream_context_add_user(struct xmpp_stream_context *context, const char *user, const char *password);
|
||||||
extern void xmpp_stream_context_dump(struct xmpp_stream_context *context, switch_stream_handle_t *stream);
|
SWITCH_DECLARE(void) xmpp_stream_context_dump(struct xmpp_stream_context *context, switch_stream_handle_t *stream);
|
||||||
extern void xmpp_stream_context_destroy(struct xmpp_stream_context *context);
|
SWITCH_DECLARE(void) xmpp_stream_context_destroy(struct xmpp_stream_context *context);
|
||||||
extern void xmpp_stream_context_send(struct xmpp_stream_context *context, const char *jid, iks *stanza);
|
SWITCH_DECLARE(void) xmpp_stream_context_send(struct xmpp_stream_context *context, const char *jid, iks *stanza);
|
||||||
|
|
||||||
extern switch_status_t xmpp_stream_context_listen(struct xmpp_stream_context *context, const char *addr, int port, int is_s2s, const char *acl);
|
SWITCH_DECLARE(switch_status_t) xmpp_stream_context_listen(struct xmpp_stream_context *context, const char *addr, int port, int is_s2s, const char *acl);
|
||||||
extern switch_status_t xmpp_stream_context_connect(struct xmpp_stream_context *context, const char *peer_domain, const char *peer_address, int peer_port);
|
SWITCH_DECLARE(switch_status_t) xmpp_stream_context_connect(struct xmpp_stream_context *context, const char *peer_domain, const char *peer_address, int peer_port);
|
||||||
|
|
||||||
extern int xmpp_stream_is_s2s(struct xmpp_stream *stream);
|
SWITCH_DECLARE(int) xmpp_stream_is_s2s(struct xmpp_stream *stream);
|
||||||
extern int xmpp_stream_is_incoming(struct xmpp_stream *stream);
|
SWITCH_DECLARE(int) xmpp_stream_is_incoming(struct xmpp_stream *stream);
|
||||||
extern const char *xmpp_stream_get_jid(struct xmpp_stream *stream);
|
SWITCH_DECLARE(const char *) xmpp_stream_get_jid(struct xmpp_stream *stream);
|
||||||
extern void xmpp_stream_set_private(struct xmpp_stream *stream, void *user_private);
|
SWITCH_DECLARE(void) xmpp_stream_set_private(struct xmpp_stream *stream, void *user_private);
|
||||||
extern void *xmpp_stream_get_private(struct xmpp_stream *stream);
|
SWITCH_DECLARE(void *) xmpp_stream_get_private(struct xmpp_stream *stream);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -529,10 +529,11 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void
|
|||||||
source->has_video = 1;
|
source->has_video = 1;
|
||||||
if (source->total) {
|
if (source->total) {
|
||||||
if (switch_queue_trypush(source->video_q, vid_frame.img) == SWITCH_STATUS_SUCCESS) {
|
if (switch_queue_trypush(source->video_q, vid_frame.img) == SWITCH_STATUS_SUCCESS) {
|
||||||
|
vid_frame.img = NULL;
|
||||||
flush = 0;
|
flush = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flush) {
|
if (flush) {
|
||||||
switch_img_free(&vid_frame.img);
|
switch_img_free(&vid_frame.img);
|
||||||
flush_video_queue(source->video_q);
|
flush_video_queue(source->video_q);
|
||||||
@ -645,13 +646,15 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void
|
|||||||
if (!pop) break;
|
if (!pop) break;
|
||||||
|
|
||||||
img = (switch_image_t *) pop;
|
img = (switch_image_t *) pop;
|
||||||
|
|
||||||
switch_mutex_lock(source->mutex);
|
switch_mutex_lock(source->mutex);
|
||||||
if (source->context_list) {
|
if (source->context_list) {
|
||||||
if (source->total == 1) {
|
if (source->total == 1) {
|
||||||
if (switch_queue_trypush(source->context_list->video_q, img) != SWITCH_STATUS_SUCCESS) {
|
if (!switch_test_flag(source->context_list->handle, SWITCH_FILE_FLAG_VIDEO)) {
|
||||||
flush_video_queue(source->context_list->video_q);
|
flush_video_queue(source->context_list->video_q);
|
||||||
|
} else if (switch_queue_trypush(source->context_list->video_q, img) != SWITCH_STATUS_SUCCESS) {
|
||||||
|
flush_video_queue(source->context_list->video_q);
|
||||||
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Flushing video queue\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Flushing video queue\n");
|
||||||
if (++source->context_list->video_flushes > 1) {
|
if (++source->context_list->video_flushes > 1) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Disconnecting file\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Disconnecting file\n");
|
||||||
@ -659,6 +662,7 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
source->context_list->video_flushes = 0;
|
source->context_list->video_flushes = 0;
|
||||||
|
img = NULL;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (cp = source->context_list; cp && RUNNING; cp = cp->next) {
|
for (cp = source->context_list; cp && RUNNING; cp = cp->next) {
|
||||||
@ -671,7 +675,9 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void
|
|||||||
imgcp = NULL;
|
imgcp = NULL;
|
||||||
switch_img_copy(img, &imgcp);
|
switch_img_copy(img, &imgcp);
|
||||||
if (imgcp) {
|
if (imgcp) {
|
||||||
if (switch_queue_trypush(cp->video_q, imgcp) != SWITCH_STATUS_SUCCESS) {
|
if (!switch_test_flag(cp->handle, SWITCH_FILE_FLAG_VIDEO)) {
|
||||||
|
flush_video_queue(cp->video_q);
|
||||||
|
} else if (switch_queue_trypush(cp->video_q, imgcp) != SWITCH_STATUS_SUCCESS) {
|
||||||
flush_video_queue(cp->video_q);
|
flush_video_queue(cp->video_q);
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Flushing video queue\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Flushing video queue\n");
|
||||||
if (++cp->video_flushes > 1) {
|
if (++cp->video_flushes > 1) {
|
||||||
@ -684,10 +690,10 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
switch_img_free(&img);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
switch_mutex_unlock(source->mutex);
|
switch_mutex_unlock(source->mutex);
|
||||||
|
switch_img_free(&img);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -887,7 +893,7 @@ static switch_status_t local_stream_file_open(switch_file_handle_t *handle, cons
|
|||||||
|
|
||||||
context->pool = pool;
|
context->pool = pool;
|
||||||
|
|
||||||
switch_queue_create(&context->video_q, 500, context->pool);
|
switch_queue_create(&context->video_q, 40, context->pool);
|
||||||
|
|
||||||
handle->samples = 0;
|
handle->samples = 0;
|
||||||
handle->samplerate = source->rate;
|
handle->samplerate = source->rate;
|
||||||
@ -907,7 +913,7 @@ static switch_status_t local_stream_file_open(switch_file_handle_t *handle, cons
|
|||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!switch_core_has_video() ||
|
if (!switch_core_has_video() || !source->has_video ||
|
||||||
(switch_test_flag(handle, SWITCH_FILE_FLAG_VIDEO) && !source->has_video && !source->blank_img && !source->cover_art && !source->banner_txt)) {
|
(switch_test_flag(handle, SWITCH_FILE_FLAG_VIDEO) && !source->has_video && !source->blank_img && !source->cover_art && !source->banner_txt)) {
|
||||||
switch_clear_flag_locked(handle, SWITCH_FILE_FLAG_VIDEO);
|
switch_clear_flag_locked(handle, SWITCH_FILE_FLAG_VIDEO);
|
||||||
}
|
}
|
||||||
@ -1037,7 +1043,7 @@ static switch_status_t local_stream_file_read_video(switch_file_handle_t *handle
|
|||||||
buf_qsize = 1;
|
buf_qsize = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
while(context->ready && context->source->ready && (flags & SVR_FLUSH) && switch_queue_size(context->video_q) > min_qsize) {
|
while(context->ready && context->source->ready && switch_queue_size(context->video_q) > min_qsize) {
|
||||||
if (switch_queue_trypop(context->video_q, &pop) == SWITCH_STATUS_SUCCESS) {
|
if (switch_queue_trypop(context->video_q, &pop) == SWITCH_STATUS_SUCCESS) {
|
||||||
switch_image_t *img = (switch_image_t *) pop;
|
switch_image_t *img = (switch_image_t *) pop;
|
||||||
switch_img_free(&img);
|
switch_img_free(&img);
|
||||||
@ -1151,11 +1157,7 @@ static switch_status_t local_stream_file_read(switch_file_handle_t *handle, void
|
|||||||
return SWITCH_STATUS_FALSE;
|
return SWITCH_STATUS_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (context->source->has_video) {
|
if (!context->source->has_video) {
|
||||||
if (!switch_test_flag(handle, SWITCH_FILE_FLAG_VIDEO)) {
|
|
||||||
switch_set_flag_locked(handle, SWITCH_FILE_FLAG_VIDEO);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (switch_test_flag(handle, SWITCH_FILE_FLAG_VIDEO)) {
|
if (switch_test_flag(handle, SWITCH_FILE_FLAG_VIDEO)) {
|
||||||
switch_clear_flag_locked(handle, SWITCH_FILE_FLAG_VIDEO);
|
switch_clear_flag_locked(handle, SWITCH_FILE_FLAG_VIDEO);
|
||||||
}
|
}
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user