diff --git a/LICENSE b/LICENSE
index 46a2c712e9..2002b83219 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1011,12 +1011,6 @@ License: MPL-1.1 or GPL-2+
use the text of this Exhibit A rather than the text found in the
Original Code Source Code for Your Modifications.]
-Files: libs/unimrcp/*
-Copyright: 2008-2010 Arsen Chaloyan
- 2009-2010 Tomas Valenta, Arsen Chaloyan
- 2001-2006 Steve Underwood
-License: Apache-2.0
-
Files: */inet_pton.c
libs/curl/lib/inet_ntop.c
libs/curl/lib/mprintf.c
diff --git a/bootstrap.sh b/bootstrap.sh
index a68a0624ac..802c6098f7 100755
--- a/bootstrap.sh
+++ b/bootstrap.sh
@@ -10,7 +10,7 @@ BGJOB=false
VERBOSE=false
BASEDIR=`pwd`;
LIBDIR=${BASEDIR}/libs;
-SUBDIRS="apr libzrtp iksemel srtp unimrcp fs";
+SUBDIRS="apr libzrtp iksemel srtp fs";
while getopts 'jhd:v' o; do
case "$o" in
diff --git a/build/buildmrcpserver.sh b/build/buildmrcpserver.sh
deleted file mode 100755
index a6468b06d2..0000000000
--- a/build/buildmrcpserver.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/sh
-base=`pwd`
-cd libs/unimrcp
-./configure --with-pocketsphinx=$base/libs/pocketsphinx-0.5.99 --with-sphinxbase=$base/libs/sphinxbase-0.4.99 --with-flite=$base/libs/flite-1.3.99 --with-apr=$base/libs/apr --with-apr-util=$base/libs/apr-util --with-sofia-sip=$base/libs/sofia-sip --prefix=/usr/local/unimrcpserver --enable-pocketsphinx-plugin --enable-flite-plugin --disable-demosynth-plugin --disable-demorecog-plugin --disable-recorder-plugin --disable-cepstral-plugin
-make
-make install
diff --git a/build/modules.conf.in b/build/modules.conf.in
index ab50bd53dc..7bf59e2acc 100644
--- a/build/modules.conf.in
+++ b/build/modules.conf.in
@@ -60,7 +60,6 @@ applications/mod_voicemail
#asr_tts/mod_flite
#asr_tts/mod_pocketsphinx
#asr_tts/mod_tts_commandline
-#asr_tts/mod_unimrcp
codecs/mod_amr
#codecs/mod_amrwb
codecs/mod_b64
diff --git a/build/modules.conf.most b/build/modules.conf.most
index 86063db582..fbf8100a90 100644
--- a/build/modules.conf.most
+++ b/build/modules.conf.most
@@ -58,7 +58,6 @@ applications/mod_voicemail_ivr
asr_tts/mod_flite
asr_tts/mod_pocketsphinx
asr_tts/mod_tts_commandline
-asr_tts/mod_unimrcp
codecs/mod_amr
codecs/mod_amrwb
codecs/mod_b64
diff --git a/conf/rayo/autoload_configs/rayo.conf.xml b/conf/rayo/autoload_configs/rayo.conf.xml
index e5191909cb..9f525c597c 100644
--- a/conf/rayo/autoload_configs/rayo.conf.xml
+++ b/conf/rayo/autoload_configs/rayo.conf.xml
@@ -277,36 +277,6 @@
]]>
-
-
-
- yesno
- ]]]]>
-
-
- ]]>
-
-
-
-
- yesno
- ]]]]>
-
-
- ]]>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/conf/vanilla/mrcp_profiles/loquendo-7-mrcp-v2.xml b/conf/vanilla/mrcp_profiles/loquendo-7-mrcp-v2.xml
deleted file mode 100644
index dcf42821f5..0000000000
--- a/conf/vanilla/mrcp_profiles/loquendo-7-mrcp-v2.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/conf/vanilla/mrcp_profiles/nuance-1.0.0-mrcp-v1.xml b/conf/vanilla/mrcp_profiles/nuance-1.0.0-mrcp-v1.xml
deleted file mode 100644
index 0700dec629..0000000000
--- a/conf/vanilla/mrcp_profiles/nuance-1.0.0-mrcp-v1.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/conf/vanilla/mrcp_profiles/nuance-5.0-mrcp-v1.xml b/conf/vanilla/mrcp_profiles/nuance-5.0-mrcp-v1.xml
deleted file mode 100644
index 3c4938a66d..0000000000
--- a/conf/vanilla/mrcp_profiles/nuance-5.0-mrcp-v1.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/conf/vanilla/mrcp_profiles/nuance-5.0-mrcp-v2.xml b/conf/vanilla/mrcp_profiles/nuance-5.0-mrcp-v2.xml
deleted file mode 100644
index b53cba0984..0000000000
--- a/conf/vanilla/mrcp_profiles/nuance-5.0-mrcp-v2.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/conf/vanilla/mrcp_profiles/unimrcpserver-mrcp-v1.xml b/conf/vanilla/mrcp_profiles/unimrcpserver-mrcp-v1.xml
deleted file mode 100644
index fe02b1582f..0000000000
--- a/conf/vanilla/mrcp_profiles/unimrcpserver-mrcp-v1.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/conf/vanilla/mrcp_profiles/vestec-mrcp-v1.xml b/conf/vanilla/mrcp_profiles/vestec-mrcp-v1.xml
deleted file mode 100644
index cbde87ca5a..0000000000
--- a/conf/vanilla/mrcp_profiles/vestec-mrcp-v1.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/conf/vanilla/mrcp_profiles/voxeo-prophecy-8.0-mrcp-v1.xml b/conf/vanilla/mrcp_profiles/voxeo-prophecy-8.0-mrcp-v1.xml
deleted file mode 100644
index fb1d0ee287..0000000000
--- a/conf/vanilla/mrcp_profiles/voxeo-prophecy-8.0-mrcp-v1.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/configure.ac b/configure.ac
index 24e838731a..52b0a3cd98 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1089,7 +1089,7 @@ fi
# Tested and fixed lot of modules, but some are untested. Will be added back when the core team decide it ready
# Untested modules : mod_osp mod_soundtouch mod_sangoma_codec mod_opal mod_h323 mod_khomp
-# mod_unimrcp mod_cepstral mod_erlang_event mod_snmp mod_perl mod_java mod_managed
+# mod_cepstral mod_erlang_event mod_snmp mod_perl mod_java mod_managed
#
#saved_CFLAGS="$CFLAGS"
#AC_CACHE_CHECK([whether compiler supports -Wunused-but-set-variable], [ac_cv_gcc_unused_but_set_variable], [
@@ -2144,7 +2144,6 @@ AC_CONFIG_FILES([Makefile
src/mod/asr_tts/mod_flite/Makefile
src/mod/asr_tts/mod_pocketsphinx/Makefile
src/mod/asr_tts/mod_tts_commandline/Makefile
- src/mod/asr_tts/mod_unimrcp/Makefile
src/mod/codecs/mod_amr/Makefile
src/mod/codecs/mod_amrwb/Makefile
src/mod/codecs/mod_b64/Makefile
@@ -2331,7 +2330,6 @@ if test "$use_system_apr" != "yes"; then
AC_CONFIG_SUBDIRS([libs/apr])
fi
AC_CONFIG_SUBDIRS([libs/iksemel])
-#AC_CONFIG_SUBDIRS([libs/unimrcp])
if test "x${enable_zrtp}" = "xyes"; then
AC_CONFIG_SUBDIRS([libs/libzrtp])
fi
diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh
index ba94c9d1ce..71c5b52f99 100755
--- a/debian/bootstrap.sh
+++ b/debian/bootstrap.sh
@@ -653,7 +653,6 @@ Depends: \${misc:Depends}, freeswitch (= \${binary:Version}),
freeswitch-mod-flite (= \${binary:Version}),
freeswitch-mod-pocketsphinx (= \${binary:Version}),
freeswitch-mod-tts-commandline (= \${binary:Version}),
- freeswitch-mod-unimrcp (= \${binary:Version}),
freeswitch-mod-dialplan-asterisk (= \${binary:Version}),
freeswitch-mod-dialplan-directory (= \${binary:Version}),
freeswitch-mod-dialplan-xml (= \${binary:Version}),
@@ -891,7 +890,6 @@ Depends: \${misc:Depends}, freeswitch (= \${binary:Version}),
freeswitch-mod-flite-dbg (= \${binary:Version}),
freeswitch-mod-pocketsphinx-dbg (= \${binary:Version}),
freeswitch-mod-tts-commandline-dbg (= \${binary:Version}),
- freeswitch-mod-unimrcp-dbg (= \${binary:Version}),
freeswitch-mod-dialplan-asterisk-dbg (= \${binary:Version}),
freeswitch-mod-dialplan-directory-dbg (= \${binary:Version}),
freeswitch-mod-dialplan-xml-dbg (= \${binary:Version}),
diff --git a/debian/control-modules b/debian/control-modules
index f438d0277d..b9d7a05933 100644
--- a/debian/control-modules
+++ b/debian/control-modules
@@ -291,10 +291,6 @@ Module: asr_tts/mod_tts_commandline
Description: mod_tts_commandline
Adds mod_tts_commandline.
-Module: asr_tts/mod_unimrcp
-Description: mod_unimrcp
- Adds mod_unimrcp.
-
## mod/codecs
Module: codecs/mod_amr
diff --git a/debian/copyright b/debian/copyright
index af7a6fe152..01473e4940 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -1011,12 +1011,6 @@ License: MPL-1.1 or GPL-2+
use the text of this Exhibit A rather than the text found in the
Original Code Source Code for Your Modifications.]
-Files: libs/unimrcp/*
-Copyright: 2008-2010 Arsen Chaloyan
- 2009-2010 Tomas Valenta, Arsen Chaloyan
- 2001-2006 Steve Underwood
-License: Apache-2.0
-
Files: */inet_pton.c
libs/curl/lib/inet_ntop.c
libs/curl/lib/mprintf.c
diff --git a/docs/Doxygen.conf b/docs/Doxygen.conf
index 5df2a2bcb2..9e62b08232 100644
--- a/docs/Doxygen.conf
+++ b/docs/Doxygen.conf
@@ -1242,7 +1242,7 @@ SEARCH_INCLUDES = YES
INCLUDE_PATH =../libs/apr ../libs/apr-util ../libs/iksemel ../libs/libnatpmp \
../libs/miniupnpc ../libs/sofia-sip ../libs/spandsp \
- ../libs/srtp ../libs/unimrcp ../libs/win32 ../libs/xmlrpc-c
+ ../libs/srtp ../libs/win32 ../libs/xmlrpc-c
# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
# patterns (like *.h and *.hpp) to filter out the header-files in the
diff --git a/freeswitch.spec b/freeswitch.spec
index 7bdb8eaec6..8672b4fc59 100644
--- a/freeswitch.spec
+++ b/freeswitch.spec
@@ -636,15 +636,6 @@ Requires: %{name} = %{version}-%{release}
Provides FreeSWITCH mod_tts_commandline, Run a command line and play the
output file.
-%package asrtts-unimrcp
-Summary: FreeSWITCH mod_unimrcp
-Group: System/Libraries
-Requires: %{name} = %{version}-%{release}
-
-%description asrtts-unimrcp
-Provides FreeSWITCH mod_unimrcp, allows communication with Media Resource
-Control Protocol (MRCP) servers
-
######################################################################################################################
# FreeSWITCH Codec Modules
######################################################################################################################
@@ -1435,7 +1426,7 @@ APPLICATIONS_MODULES="$APPLICATION_MODULES_AC $APPLICATION_MODULES_DE $APPLICATI
# Automatic Speech Recognition and Text To Speech Modules
#
######################################################################################################################
-ASR_TTS_MODULES="asr_tts/mod_flite asr_tts/mod_pocketsphinx asr_tts/mod_tts_commandline asr_tts/mod_unimrcp"
+ASR_TTS_MODULES="asr_tts/mod_flite asr_tts/mod_pocketsphinx asr_tts/mod_tts_commandline"
######################################################################################################################
#
@@ -1962,7 +1953,6 @@ fi
%config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/translate.conf.xml
%config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/tts_commandline.conf.xml
%config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/unicall.conf.xml
-%config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/unimrcp.conf.xml
%config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/verto.conf.xml
%config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/voicemail.conf.xml
%config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/voicemail_ivr.conf.xml
@@ -2163,9 +2153,6 @@ fi
%files asrtts-tts-commandline
%{MODINSTDIR}/mod_tts_commandline.so*
-%files asrtts-unimrcp
-%{MODINSTDIR}/mod_unimrcp.so*
-
######################################################################################################################
#
# CODEC Packages
diff --git a/libs/.gitignore b/libs/.gitignore
index cb4112eb88..f1d983b2da 100644
--- a/libs/.gitignore
+++ b/libs/.gitignore
@@ -551,102 +551,6 @@ opal
/tiff-*/tools/tiffmedian
/tiff-*/tools/tiffset
/tiff-*/tools/tiffsplit
-/unimrcp/build/acmacros/libtool.m4
-/unimrcp/build/acmacros/lt~obsolete.m4
-/unimrcp/build/acmacros/ltoptions.m4
-/unimrcp/build/acmacros/ltsugar.m4
-/unimrcp/build/acmacros/ltversion.m4
-/unimrcp/build/Makefile
-/unimrcp/build/Makefile.in
-/unimrcp/build/pkgconfig/Makefile
-/unimrcp/build/pkgconfig/Makefile.in
-/unimrcp/build/svnrev/Makefile
-/unimrcp/build/svnrev/Makefile.in
-/unimrcp/build/svnrev/svnrev
-!/unimrcp/build/tools/unimrcpservice.exe.manifest
-!/unimrcp/build/uni_revision.h
-!/unimrcp/configure.gnu
-/unimrcp/conf/Makefile
-/unimrcp/conf/Makefile.in
-/unimrcp/data/Makefile
-/unimrcp/data/Makefile.in
-/unimrcp/docs/doxygen.conf
-/unimrcp/libs/apr-toolkit/Makefile
-/unimrcp/libs/apr-toolkit/Makefile.in
-/unimrcp/libs/Makefile
-/unimrcp/libs/Makefile.in
-/unimrcp/libs/mpf/Makefile
-/unimrcp/libs/mpf/Makefile.in
-/unimrcp/libs/mrcp-client/Makefile
-/unimrcp/libs/mrcp-client/Makefile.in
-/unimrcp/libs/mrcp-engine/Makefile
-/unimrcp/libs/mrcp-engine/Makefile.in
-/unimrcp/libs/mrcp/Makefile
-/unimrcp/libs/mrcp/Makefile.in
-/unimrcp/libs/mrcp-server/Makefile
-/unimrcp/libs/mrcp-server/Makefile.in
-/unimrcp/libs/mrcp-signaling/Makefile
-/unimrcp/libs/mrcp-signaling/Makefile.in
-/unimrcp/libs/mrcpv2-transport/Makefile
-/unimrcp/libs/mrcpv2-transport/Makefile.in
-/unimrcp/libs/uni-rtsp/Makefile
-/unimrcp/libs/uni-rtsp/Makefile.in
-/unimrcp/Makefile
-/unimrcp/Makefile.in
-/unimrcp/modules/Makefile
-/unimrcp/modules/Makefile.in
-/unimrcp/modules/mrcp-sofiasip/Makefile
-/unimrcp/modules/mrcp-sofiasip/Makefile.in
-/unimrcp/modules/mrcp-unirtsp/Makefile
-/unimrcp/modules/mrcp-unirtsp/Makefile.in
-/unimrcp/platforms/asr-client/asrclient
-/unimrcp/platforms/asr-client/Makefile
-/unimrcp/platforms/asr-client/Makefile.in
-/unimrcp/platforms/libasr-client/Makefile
-/unimrcp/platforms/libasr-client/Makefile.in
-/unimrcp/platforms/libunimrcp-client/Makefile
-/unimrcp/platforms/libunimrcp-client/Makefile.in
-/unimrcp/platforms/libunimrcp-server/Makefile
-/unimrcp/platforms/libunimrcp-server/Makefile.in
-/unimrcp/platforms/Makefile
-/unimrcp/platforms/Makefile.in
-/unimrcp/platforms/umc/Makefile
-/unimrcp/platforms/umc/Makefile.in
-/unimrcp/platforms/umc/umc
-/unimrcp/platforms/unimrcp-client/Makefile
-/unimrcp/platforms/unimrcp-client/Makefile.in
-/unimrcp/platforms/unimrcp-client/unimrcpclient
-/unimrcp/platforms/unimrcp-server/Makefile
-/unimrcp/platforms/unimrcp-server/Makefile.in
-/unimrcp/platforms/unimrcp-server/unimrcpserver
-/unimrcp/plugins/demo-recog/Makefile
-/unimrcp/plugins/demo-recog/Makefile.in
-/unimrcp/plugins/demo-synth/Makefile
-/unimrcp/plugins/demo-synth/Makefile.in
-/unimrcp/plugins/demo-verifier/Makefile
-/unimrcp/plugins/demo-verifier/Makefile.in
-/unimrcp/plugins/Makefile
-/unimrcp/plugins/Makefile.in
-/unimrcp/plugins/mrcp-cepstral/Makefile
-/unimrcp/plugins/mrcp-cepstral/Makefile.in
-/unimrcp/plugins/mrcp-flite/Makefile
-/unimrcp/plugins/mrcp-flite/Makefile.in
-/unimrcp/plugins/mrcp-pocketsphinx/Makefile
-/unimrcp/plugins/mrcp-pocketsphinx/Makefile.in
-/unimrcp/plugins/mrcp-recorder/Makefile
-/unimrcp/plugins/mrcp-recorder/Makefile.in
-/unimrcp/tests/apttest/Makefile
-/unimrcp/tests/apttest/Makefile.in
-/unimrcp/tests/Makefile
-/unimrcp/tests/Makefile.in
-/unimrcp/tests/mpftest/Makefile
-/unimrcp/tests/mpftest/Makefile.in
-/unimrcp/tests/mrcptest/Makefile
-/unimrcp/tests/mrcptest/Makefile.in
-/unimrcp/tests/rtsptest/Makefile
-/unimrcp/tests/rtsptest/Makefile.in
-/unimrcp/tests/strtablegen/Makefile
-/unimrcp/tests/strtablegen/Makefile.in
/win32/celt/*/*/libcelt.log
/win32/libg722_1/*/*/libg722_1.log
/win32/libshout/*/*/libshout.log
@@ -708,7 +612,6 @@ ilbc/config/compile
libg722_1/config/compile
pcre/compile
srtp/build/compile
-unimrcp/build/compile
/pcre-*/
/speex-*/
/curl-*/
@@ -723,7 +626,6 @@ libyuv/Makefile
libyuv/convert
srtp/configure
tiff-4.0.2/configure
-unimrcp/configure
zlib-*/
zlib-*
libpq-*/
diff --git a/libs/unimrcp/.gitignore b/libs/unimrcp/.gitignore
deleted file mode 100644
index 90ec22bee1..0000000000
--- a/libs/unimrcp/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-.svn
diff --git a/libs/unimrcp/.update b/libs/unimrcp/.update
deleted file mode 100644
index 5875d6e932..0000000000
--- a/libs/unimrcp/.update
+++ /dev/null
@@ -1 +0,0 @@
-Mon Nov 17 11:06:30 EST 2014
diff --git a/libs/unimrcp/AUTHORS b/libs/unimrcp/AUTHORS
deleted file mode 100644
index 6c7b0eee09..0000000000
--- a/libs/unimrcp/AUTHORS
+++ /dev/null
@@ -1,17 +0,0 @@
-Author(s):
- Arsen Chaloyan
-
-
-Contributor(s):
- Kamil Shakirov
- Anthony Masse
- Vlad Socaciu
- Garmt
- Patrick Nunes
- Bayram Boyraz
- Mahmoud Hassan
- Michael Jerris
- Carlos Pina Soares
- Chaitanya Chokkareddy
- Tomas Valenta
- Danijel Korzinek
diff --git a/libs/unimrcp/CHANGES b/libs/unimrcp/CHANGES
deleted file mode 100644
index 8271824144..0000000000
--- a/libs/unimrcp/CHANGES
+++ /dev/null
@@ -1,214 +0,0 @@
-Changes for UniMRCP-1.2.0
-
- APR-toolkit library
-
- * Implemented a new interface for the NLSML parser in accordance with the NSLML schema defined in http://tools.ietf.org/html/rfc6787#section-16.1.
- * Took out the legacy NLSML interface.
- * Fixed a gcc warning for strict-aliasing rules.
- * Implemented apt_pair_array_generate() in 2 passes, apr_pstrcatv() alike.
- * Prevent compilation warnings for unused-but-set-variable.
- * Use int instead of apt_task_msg_type_e to suppress a warning triggered by gcc 4.7: case value not in enumerated type 'apt_task_msg_type_e'.
- * Upon creation of a new memory pool, register apr_abortfunc_t callback which is supposed to be invoked when memory allocation fails within apr_pool.
- * Added apt_va_log() which accepts va_list as an input argument.
- * Set the default maximum number of log files used in rotation to 100.
- * Set thread names for APT tasks to be shown in debuggers. Thanks Vali.
- * Enable apt_timer logs only if APT_TIMER_DEBUG is defined.
- * Use a local temporary char buffer to construct the hostname in apt_ip_get() not to allocate memory from a permanent pool.
- * Unified pointer logging in APT style. Thanks Vali.
- * Define APT_PTR_FMT as 0x%I64x for 64-bit Windows.
- * Removed unused function apt_text_boolean_value_insert/apt_boolean_value_insert (inconsistent declaration/definition). Thanks Vali.
-
- MPF library
-
- * The function mpf_codec_lists_intersect() now returns FALSE if there is no match for the primary codec descriptor.
- * Reject the RTP session if there is no match in remote and local codecs.
- * Use the reserved RTP payload type 19 in case codec list is empty (media stream is rejected).
- * If the codec list does not match the capabilities, mark the stream as disabled.
- * Do not set SO_REUSEADDR on RTP sockets.
- * Made G.711 implementation bit-exact with ITU-T reference implementation.
- * Use APR typedefs in G.711 implementation.
- * Improved the RTP port management for those cases when the specified RTP port range is not enough to handle concurrent MRCP sessions.
- * Check the number of ports per engine to be even to ensure there is a room for a pair of RTP/RTCP ports.
- * Added debugging capabilities to mpf_frame_buffer.
- * Copy name string when adding to codec capabilities. Thanks Vali.
-
- MRCP common library
-
- * Use apr_snprintf() instead of sprintf() in mrcp_request_id_generate().
- * Get rid of local fixed-size char buffers and additional string copies. Instead, allocate buffers from memory pool and generate strings straight into the buffers.
-
- MRCP client library
-
- * Completed the implementation of the new API function to retrieve a SIP/RTSP response code received from the server (Issue-90).
- * Fixed a potential crash of the client stack which could happen when the server unexpectedly closes the MRCPv2 connection while the client stack is processing an application request.
- * Allow a pool/factory of signaling agents to be defined with the MRCPv1 and/or MRCPv2 profiles.
- * Respond straight away with success to the session termination request if the session creation failed in the first place.
- * Keep track of associations between RTP termination factories (pools of RTP ports) and media engines.
- * Allow a pool/factory of media processing engines to be defined with the MRCPv1 and/or MRCPv2 profiles.
- * Allow a pool/factory of MRCPv2 connection agents to be defined with the MRCPv2 profiles.
- * Added the ability to specify an IP address by the name of network interface/adapter.
- * Added a new accessor function to the client API mrcp_client_profiles_get() which retrieves the available profiles.
- * Store the profile name not only as a key in the profile table but also in the profile structure.
- * Allow setting an arbitrary tag to the profile.
-
- MRCP server library
-
- * Handle separately the case when an RTSP SETUP contains no SDP, which means it's up to the server to decide which codec to use.
- * Fixed a crash if MRCP resource not found. Thanks Vali.
- * Keep track of associations between RTP termination factories (pools of RTP ports) and media engines.
- * Added the ability to specify an IP address by the name of network interface/adapter.
- * Log maximum engine channel count exceeded. Thanks Vali.
-
- Sofia-SIP module (MRCPv2 agent)
-
- * Do not generate media format list for a disabled audio stream.
- * Use snprintf() consistently in mrcp_sdp.c.
- * Implemented the log redirection routine of SofiaSIP.
- * Added an indentifier of the SofiaSIP agent to the log statement "Receive SIP Event".
-
- RTSP module (MRCPv1 agent)
-
- * Do not generate media format list for a disabled audio stream.
-
- Demo plugins
-
- * Respond with failure if codec descriptor is unavailable (associated media stream is disabled).
-
- UMC sample application
-
- * Terminate execution of sample application if media descriptor is unavailable (media stream is disabled).
- * Use the new NLSML parser interface in sample apps.
- * Set the header field Save-Waveform to TRUE in the sample umc recog application.
- * Fixed an invalid read of 8 bytes in umc application: sizeof(mpf_codec_capabilities_t) was meant to be allocated.
-
- ASR Client application (and library)
-
- * Get rid of 1Kb grammar file limit in libasrclient. Load the content into an allocated buffer instead.
-
- Miscellaneous
-
- * Copy the version and revision header files located in the build directory to the SDK include directory.
- * Added/fixed support for DESTDIR.
- * Take into consideration m4 macro files generated for/by libtool 2.
- * Set ac_macro_dir variable manually, since newer versions of autoconf don't do that.
- * Enable silent build rules (--enable-silent-rules)and use silent build by default.
- * Enhanced the report generated by the ./configure script.
- * Pass no-define to AM_INIT_AUTOMAKE in order not to define PACKAGE and VERSION.
- * Do not use autoconf generated compiler DEFS by replacing confdefs.h after AC_INIT, AM_INIT_AUTOMAKE and AC_PROG_LIBTOLL getting called.
- * Updated definition of the macro AX_COMPILER_VENDOR and moved it out from configure.ac to a separate m4 file.
- * Added missing dereferences of pointers to the (potential) terminal NUL of some strings. Thanks Vali.
- * Disabled DEFAULT_INCLUDES provided by automake.
- * Added generic apr_common.m4 in order to use helper m4 macros APR_ADDTO() and APR_CONFIG_NICE().
- * Generate ./config.nice to reuse ./configure command-line.
- * Added uni_plugin.m4 which provides generic macros UNI_PLUGIN_ENABLED(name) and UNI_PLUGIN_DISABLED(name).
- * Added common GNU make rules/vars for plugins, client and server libs/apps alike VS property sheets.
- * The macro UNIMRCP_CHECK_APR() now checks and sets variables for both APR and APR-util libraries.
- * Added a brief description of the license definition which is intended to be used for Windows resource files only.
- * Brought XML schema definitions of configuration file formats up to date.
- * Cppcheck: printf-like formats fix, possible NULL pointer dereference, member not initialized in the constructor,
- unused variable/value, method can be made static. Thanks Vali.
- * Define _WIN64 in Visual Studio x64 targets (for IDE only, the compiler defines _WIN64 anyway). Thanks Vali.
- * Fixed some GCC warnings. Thanks Vali.
- * Moved mrcp-flite and mrcp-pocketsphinx plugins out of the source tree into the external solutions directory.
-
-
-Changes for UniMRCP-1.1.0
-
- APR-toolkit library
-
- * The function apt_log_file_open() makes a copy of dir_path and file_name variables passed from a user application.
- * Applied a patch to the apt_log routine which allows the log file to be appended instead of being overwritten. The patch was submitted by Dani. Thanks.
- * Added a new parameter to the function apt_log_file_open() which specifies whether the log file should be appended or overwritten.
- * Fixed the formatting of float values in the header fields. Applied a patch submitted by Randy (Issue-108). Thanks.
- * Fixed apt_log_output_mode_check() which returned TRUE if any mode was enabled or checked regardless their correspondence. Thanks Vali.
- * Enhanced the debug output by adding task message identifier to the log statements "Signal Message" and "Process Message".
- * Fixed a potential crash related to the use of pollsets.
- * Fixed a potential buffer overflow in apt_text_pair_array_insert(). Thanks Vali.
- * Remove a socket descriptor from the pollset only if the descriptor has been properly added to the pollset. Otherwise, this operation could cause a crash.
-
- MPF library
-
- * Tweaked DTMF detector's energy thresholds to eliminate false positives during in-band (from audio) DTMF detection. Thanks Vali.
- * Took into consideration the RTP marker in order to re-sync the jitter buffer on a new talkspurt. Audio data loss could be experienced in the RTP receiver in case of consecutive SPEAK (for client) or RECOGNIZE (for server) requests.
- * Instead of discarding a non-aligned RTP packet, adjust the timestamp and write available frames to the jitter buffer (Issue-122).
- * Added support for the adaptive jitter buffer. Applied a reworked patch submitted by Erik. Thanks.
- * Enhanced the detection of a new RTP talkspurt by implicitly setting the RTP marker if a gap between two RTP packets is more than the specified threshold (INTER_TALSKPUSRT_GAP = 1000 msec).
- * Allow the initial playout delay in the jitter buffer to be set to 0.
- * Implemented a time skew detection algorithm for RTP streams. The detection can be enabled and used for both the adaptive and static jitter buffer.
- * Added support for redirection of RTP traces (RTP_TRACE, JB_TRACE) to the debug output window of Visual Studio.
- * Enhanced the processing of the RTP named events.
-
- RTSP library
-
- * Use strcasecmp() instead of apr_strnatcasecmp() to match RTSP resource names (Issue-94).
- * Fixed a crash in the RTSP client stack when the server closes a TCP connection while the associated RTSP session is being destroyed (Issue-124).
- * Fixed the processing of RTSP TEARDOWN requests being timed out. Applied a patch submitted to Issue-125 by Chris. Thanks.
- * For logging purposes, pass a string identifier of the RTSP/MRCPv1 signaling agent to the RTSP client and server stacks.
-
- MRCP common library
-
- * Added missing recognizer header fields used for voice enrollment (speaker-dependent recognition).
- * Added support for custom MRCP header fields.
- * Added support for speaker verification and identification resource.
- * Added missing recognizer methods used for voice enrollment and interpretation.
- * Updated the state machine of the recognizer resource to take into consideration requests, responses and events used for interpretation.
- * Enhanced helper functions which operate on the MRCP header to properly set, get and inherit header fields (Issue-110).
-
- MRCP client library
-
- * Added support for SIP redirection with 300 Multiple Choices used by the Nuance Resource Manager.
- * Added support for feature-tags set in the SIP Accept-Contact header field in an outgoing SIP INVITE message sent to the Nuance Resource Manager.
- * Added a new accessor function to the client API to get an audio stream associated with the specified channel. The function name is mrcp_application_audio_stream_get().
- * Added the ability to retrieve an external object associated with the MRCP session through the log handler (apt_log_ext_handler_f).
- * Fixed the processing of a response to the SIP OPTIONS request used for resource discovery (Issue-112).
- * Added a new constructor function unimrcp_client_create2() which allows to pass the client XML configuration not by a file, but rather by a string parameter. Thanks Vali.
- * Fixed the processing of more than one pending application requests upon reception of a SIP BYE message from the server.
- * Fixed the loading of the client configuration parameter .
- * Respond to client user application requests with failure if a new session couldn't be created due to an error in initialization of the SIP stack (Issue-127).
- * When originating an offer from the client, take into account capabilities of an audio stream created by the client user application.
- * Added a new function to the client API to retrieve a SIP/RTSP response code received from the server (Issue-90). The support is incomplete.
-
- MRCP server library
-
- * Fixed an interoperability issue with AVP. The mid attribute is not required when the SDP contains only one m-line.
- * Fixed the build of C++ MRCP plugins for platforms other than Win32. Thanks Vali.
- * Added the ability to take and use parameters set by the plugin in a response to the GET-PARAMS request. Thanks Vali.
-
- Sofia-SIP module
-
- * Took out unused tags (variables) to compile with Sofia-SIP 1.12.11.
- * Added support for Sofia-SIP's TPTAG_LOG() and TPTAG_DUMP() tags which can be enabled from the client and server configuration to print out and/or dump SIP messages.
-
- PocketSphinx plugin
-
- * In the PocketSphinx plugin, instead of using one common timeout for detection of speech activity and inactivity, use two different timeouts: one for activity and the other for inactivity detection.
- * In the recognition results sent from the PocketSphinx plugin, set both and elements.
- * Fixed a race condition in the PocketSphinx plugin which caused the server to crash.
- * Fixed the use of recognition timer in the PocketSphinx plugin.
- * Set an MRCP version specific completion cause in the PocketSphinx plugin.
-
- UniMRCP server application
-
- * Enhanced the UniMRCP Windows service manager. Thanks Vali.
- * Corrected FileType in Windows resources from DLL to APP. Thanks Vali.
- * Added a Windows resource file for the unimrcpservice application.
-
- UMC sample application
-
- * Set the default profile name in umcscenarios.xml to "uni2".
- * Added sample 8kHz and 16 kHz voiceprints in the data directory which are used by the umc application for a sample verification scenario.
- * Added mandatory attributes for the SSML element in the sample speak.xml file.
- * Added support for a binary recognition grammar used in RecogScenario by the sample umc application. Thanks Vali.
- * Added a sample SRGS ABNF grammar to the data directory.
-
- Miscellaneous
-
- * Added init.d script. The script was originally submitted by pdeschen. Thanks.
- * Modified the "prepare" utility project to use the new location of PthreadVC2.dll which is now built from source with other dependencies.
- * Added support for Visual Studio 2010.
- * Modified the MPF test application to read a raw PCM data from one file, transmit it over RTP, and write the data back to another file.
- * Set the libtool parameters link_all_deplibs and link_all_deplibs_CXX to "yes" by default, with an option to disable them (--disable-interlib-deps), if ever needed. This fixes a link error on recent Debian/Ubuntu distributions.
- * Modified the apr.m4 and apu.m4 macros to use '--link-ld' instead of '--link-libtool --libs' for the APR library dependencies. This addresses the problem with a wrong -L path to the expat library.
- * Set prerequisite version for autoconf to 2.59.
- * Added a checking for pkg-config to the configure script.
- * Added a new option (-v or --version) to the unimrcpserver as well as the sample umc and unimrcpclient applications.
diff --git a/libs/unimrcp/INSTALL b/libs/unimrcp/INSTALL
deleted file mode 100644
index 2d4f0d8eec..0000000000
--- a/libs/unimrcp/INSTALL
+++ /dev/null
@@ -1,158 +0,0 @@
-BUILD REQUIREMENTS
-==================
-
-The UniMRCP project depends on a number of third party tools and libraries which must be installed first.
-
-All the required dependencies are available to download prepackaged for the UniMRCP use from the
-following location:
-
- http://www.unimrcp.org/downloads/dependencies
-
-Alternatively, original versions of the libraries as well as patches on them can be downloaded
-separately from the following location:
-
- http://www.unimrcp.org/dependencies
-
-References:
-
-1. Apache Portable Runtime [>=1.2.x] (http://apr.apache.org).
-In order to build any part of the UniMRCP project, the Apache Portable Runtime (APR) and
-the APR Utility (APR-util) libraries are required. The libraries provide a consistent interface to
-underlying platform-specific implementations.
-
-2. Sofia-SIP [>=1.12.6] (http://sofia-sip.sourceforge.net).
-Sofia-SIP is an open-source SIP User-Agent library, compliant with the IETF RFC3261 specification.
-The library is utilized for implementation of SIP signaling for MRCPv2. The SDP message parser is
-also used for both MRCPv2 (SIP/SDP) and MRCPv1 (RTSP/SDP).
-
-
-GNU BUILD
-=========
-
-Prerequisites:
-
- autoconf 2.59 or newer
- automake
- libtool 1.4 or newer
- gcc
- pkg-config
-
-
-Procedure:
-
-If the UniMRCP source is checked out from the repository, the "bootstrap" script must be run first
-in order to generate the "configure" script and other required files.
-
- ./bootstrap
-
-The usual "configure", "make", "make install" sequence of commands should follow in order to build
-and install the project from source.
-
- ./configure
- make
- make install
-
-As a result, the project will be installed in the directory "/usr/local/unimrcp" with the following
-layout:
-
- bin binaries (unimrcpserver, unimrcpclient, ...)
- conf configuration files (unimrcpserver.xml, unimrcpclient.xml, ...)
- data data files
- include header files
- lib shared (convenience) libraries
- log log files
- plugin run-time loadable modules
-
-There are a couple of options which can additionally be configured.
-In order to specify where to look for the APR and APR-util libraries, use the "--with-apr=" and
-"--with-apr-util=" options respectively. For example:
-
- ./configure --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr
-
-In order to specify where to look for the Sofia-SIP library, use the "--with-sofia-sip=" option.
-For example:
-
- ./configure --with-sofia-sip=/usr/local/sofia-sip
-
-In order to generate executables and shared libraries for x86-64 architecture, use the "-m64"
-option as follows:
-
- CFLAGS=-m64 CXXFLAGS=-m64 LDFLAGS=-m64 ./configure
-
-In order to generate executables and shared libraries for i386 architecture, use the "-m32" option
-as follows:
-
- CFLAGS=-m32 CXXFLAGS=-m32 LDFLAGS=-m32 ./configure
-
-In order to install the default configuration, use the following commands:
-
- cd conf
- make def-conf
-
-In order to install the default data files, use the following commands:
-
- cd data
- make def-data
-
-In order to build a Doxygen generated documentation, use the following command:
-
- make dox
-
-
-WINDOWS BUILD
-=============
-
-Prerequisites:
-
- Microsoft Visual Studio 2005 or 2010.
-
-One-time pre-build setup: [optional]
-
-This step can be skipped if the dependencies are installed in their default locations. Otherwise,
-the paths in the corresponding property sheets must be modified accordingly. Below is the content
-of property sheets for Visual Studio 2005, which are located in the directory "build/vsprops".
-Similarly, property sheets for Visual Studio 2010 can be found in the directory "build/props".
-
-apr.vsprops
-
-
-
-sofiasip.vsprops
-
-
-Procedure:
-
-1. Open one of the available solution files:
- * for Visual Studio 2005, use unimrcp.sln,
- * for Visual Studio 2010, use unimrcp-2010.sln.
-2. Choose a platform (Build -> Configuration Manager):
- * win32
- * x64.
-3. Choose a configuration (Build -> Configuration Manager):
- * Debug
- * Release.
-4. Build the solution (Build -> Build Solution).
-
-One-time output directory setup:
-
-Build the "prepare.vcproj" utility project by right clicking on the project icon from the Solution
-Explorer (tools->prepare) and selecting the Build command from the context menu. This routine will
-setup the output directory and copy all the required APR, APR-Util, and Sofia-SIP libraries as well
-as the default configuration and data files. As a result, the output directory layout will look
-like the following:
-
- bin binaries (unimrcpserver, unimrcpclient, ...) and all the required dlls
- conf configuration files (unimrcpserver.xml, unimrcpclient.xml, ...)
- data data files
- lib libraries
- log log files
- plugin run-time loadable modules
diff --git a/libs/unimrcp/LICENSE b/libs/unimrcp/LICENSE
deleted file mode 100644
index d645695673..0000000000
--- a/libs/unimrcp/LICENSE
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/libs/unimrcp/Makefile.am b/libs/unimrcp/Makefile.am
deleted file mode 100644
index caa6756c06..0000000000
--- a/libs/unimrcp/Makefile.am
+++ /dev/null
@@ -1,36 +0,0 @@
-macrodir = @ac_macro_dir@
-auxdir = @ac_aux_dir@
-
-AUX_DIST = $(auxdir)/compile \
- $(auxdir)/config.guess \
- $(auxdir)/config.sub \
- $(auxdir)/install-sh \
- $(auxdir)/ltconfig \
- $(auxdir)/ltmain.sh \
- $(auxdir)/depcomp \
- $(auxdir)/missing
-
-MACRO_DIST = $(macrodir)/libtool.m4 \
- $(macrodir)/ltoptions.m4 \
- $(macrodir)/ltsugar.m4 \
- $(macrodir)/ltversion.m4 \
- $(macrodir)/lt~obsolete.m4
-
-EXTRA_DIST = bootstrap
-
-AUTOMAKE_OPTIONS = foreign
-MAINTAINERCLEANFILES = Makefile.in aclocal.m4 configure config.nice $(AUX_DIST) $(MACRO_DIST)
-
-ACLOCAL = aclocal -I $(macrodir)
-
-SUBDIRS = build conf data libs modules plugins platforms
-if TEST_SUITES
-SUBDIRS += tests
-endif
-
-dox:
- doxygen $(top_srcdir)/docs/doxygen.conf
-
-install-data-local:
- test -d $(DESTDIR)$(logdir) || $(mkinstalldirs) $(DESTDIR)$(logdir)
- test -d $(DESTDIR)$(vardir) || $(mkinstalldirs) $(DESTDIR)$(vardir)
diff --git a/libs/unimrcp/NOTICE b/libs/unimrcp/NOTICE
deleted file mode 100644
index 37f1bf3c01..0000000000
--- a/libs/unimrcp/NOTICE
+++ /dev/null
@@ -1,47 +0,0 @@
-The UniMRCP Project (http://www.unimrcp.org)
-Copyright (C) 2008-2010 Arsen Chaloyan
-Licensed under the Apache License, Version 2.0 (the "License").
-
-This product includes a number of subcomponents with
-separate copyright notices and license terms.
-
-
-Notice for APR (Apache Portable Runtime) library
----------------------------------------------------
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
-Portions of this software were developed at the National Center
-for Supercomputing Applications (NCSA) at the University of
-Illinois at Urbana-Champaign.
-
-This software contains code derived from the RSA Data Security
-Inc. MD5 Message-Digest Algorithm.
----------------------------------------------------
-
-
-Notice for Sofia-SIP library
----------------------------------------------------
-Copyright (C) 2005-2006 Nokia Corporation and others (see the
-in individual files for a detailed list of copyright holders).
-Contact: Pekka Pessi
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public License
-as published by the Free Software Foundation; either version 2.1 of
-the License, or (at your option) any later version.
----------------------------------------------------
-
-
-Notice for G711 implementation
----------------------------------------------------
-g711.h/g711.c - A-law and u-law transcoding routines
-
-Written by Steve Underwood
-Copyright (C) 2006 Steve Underwood
-
-Despite my general liking of the GPL, I place this code in the
-public domain for the benefit of all mankind - even the slimy
-ones who might try to proprietize my work and use it to my
-detriment.
----------------------------------------------------
diff --git a/libs/unimrcp/README b/libs/unimrcp/README
deleted file mode 100644
index 55e84045be..0000000000
--- a/libs/unimrcp/README
+++ /dev/null
@@ -1,59 +0,0 @@
-INTRODUCTION
-============
-
-UniMRCP is an open source project compliant with the IETF RFC6787 (MRCPv2) and RFC4463 (MRCPv1)
-specifications.
-
-
-INSTALLATION
-============
-
-See the file "INSTALL" for installation tips.
-
-
-DOCUMENTATION
-=============
-
-Use the directory "docs/dox" for a documentation generated by Doxygen.
-Use the directory "docs/ea" for UML based design concepts, HTML pages generated by Enterpise Architect.
-
-
-REFERENCES
-==========
-
-Website:
- http://www.unimrcp.org
-
-Downloads:
- http://www.unimrcp.org/downloads
-
-Documentation:
- http://www.unimrcp.org/documentation
-
-Google Code:
- http://code.google.com/p/unimrcp
-
-Issue Tracker:
- http://code.google.com/p/unimrcp/issues/list
-
-Discussion Group:
- http://groups.google.com/group/unimrcp
-
-Version Control Repository (SVN):
- http://unimrcp.googlecode.com/svn/trunk
-
-UML Documentation File (Enterpise Architect):
- http://unimrcp.googlecode.com/svn/misc/unimrcp.eap
-
-Commit Monitor:
- http://code.google.com/p/unimrcp/source/list
- http://groups.google.com/group/unimrcp-svn-commits
-
-
-LICENSING
-=========
-
-UniMRCP is licensed under terms of the Apache License 2.0.
-See the file "LICENSE" for more information.
-
-Copyright 2008 - 2014 Arsen Chaloyan
diff --git a/libs/unimrcp/acinclude.m4 b/libs/unimrcp/acinclude.m4
deleted file mode 100644
index 14fa221614..0000000000
--- a/libs/unimrcp/acinclude.m4
+++ /dev/null
@@ -1,7 +0,0 @@
-m4_include([build/acmacros/apr.m4])
-m4_include([build/acmacros/find_apr.m4])
-m4_include([build/acmacros/find_apu.m4])
-m4_include([build/acmacros/sofia-sip.m4])
-m4_include([build/acmacros/ax_compiler_vendor.m4])
-m4_include([build/acmacros/apr_common.m4])
-m4_include([build/acmacros/uni_plugin.m4])
diff --git a/libs/unimrcp/bootstrap b/libs/unimrcp/bootstrap
deleted file mode 100755
index e037f546a3..0000000000
--- a/libs/unimrcp/bootstrap
+++ /dev/null
@@ -1,14 +0,0 @@
-#! /bin/sh
-
-case `uname` in
- Darwin) libtoolize=glibtoolize ;;
- *) libtoolize=libtoolize ;;
-esac
-
-set -x
-$libtoolize --force --automake --copy
-aclocal -I build/acmacros
-automake --foreign --add-missing --copy
-autoconf
-
-rm -rf autom4te.cache
diff --git a/libs/unimrcp/build/Makefile.am b/libs/unimrcp/build/Makefile.am
deleted file mode 100644
index 859d2a553f..0000000000
--- a/libs/unimrcp/build/Makefile.am
+++ /dev/null
@@ -1,5 +0,0 @@
-MAINTAINERCLEANFILES = Makefile.in
-
-SUBDIRS = pkgconfig
-
-include_HEADERS = uni_version.h uni_revision.h
diff --git a/libs/unimrcp/build/acmacros/apr.m4 b/libs/unimrcp/build/acmacros/apr.m4
deleted file mode 100644
index 0fc55215eb..0000000000
--- a/libs/unimrcp/build/acmacros/apr.m4
+++ /dev/null
@@ -1,79 +0,0 @@
-dnl
-dnl UNIMRCP_CHECK_APR
-dnl
-dnl This macro attempts to find APR and APR-util libraries and
-dnl set corresponding variables on exit.
-dnl
-AC_DEFUN([UNIMRCP_CHECK_APR],
-[
- AC_MSG_NOTICE([Apache Portable Runtime (APR) library configuration])
-
- APR_FIND_APR("", "", 1, 1)
-
- if test $apr_found = "no"; then
- AC_MSG_WARN([APR not found])
- UNIMRCP_DOWNLOAD_APR
- fi
-
- if test $apr_found = "reconfig"; then
- AC_MSG_WARN([APR reconfig])
- fi
-
- dnl check APR version number
- apr_version="`$apr_config --version`"
- AC_MSG_RESULT([$apr_version])
-
- dnl Get build information from APR
- APR_ADDTO(CPPFLAGS,`$apr_config --cppflags`)
- APR_ADDTO(CFLAGS,`$apr_config --cflags`)
- APR_ADDTO(LDFLAGS,`$apr_config --ldflags`)
-
- APR_ADDTO(UNIMRCP_APR_INCLUDES,`$apr_config --includes`)
- APR_ADDTO(UNIMRCP_APR_LIBS,`$apr_config --link-ld`)
-
- AC_MSG_NOTICE([Apache Portable Runtime Utility (APU) library configuration])
-
- APR_FIND_APU("", "", 1, 1)
-
- if test $apu_found = "no"; then
- AC_MSG_WARN([APU not found])
- UNIMRCP_DOWNLOAD_APU
- fi
-
- if test $apu_found = "reconfig"; then
- AC_MSG_WARN([APU reconfig])
- fi
-
- dnl check APU version number
- apu_version="`$apu_config --version`"
- AC_MSG_RESULT([$apu_version])
-
- dnl Get build information from APU
- APR_ADDTO(LDFLAGS,`$apu_config --ldflags`)
-
- APR_ADDTO(UNIMRCP_APR_INCLUDES,`$apu_config --includes`)
- APR_ADDTO(UNIMRCP_APR_LIBS,`$apu_config --link-ld`)
-
- AC_SUBST(UNIMRCP_APR_INCLUDES)
- AC_SUBST(UNIMRCP_APR_LIBS)
-])
-
-dnl UNIMRCP_DOWNLOAD_APR
-dnl no apr found, print out a message telling the user what to do
-AC_DEFUN([UNIMRCP_DOWNLOAD_APR],
-[
- echo "The Apache Portable Runtime (APR) library cannot be found."
- echo "Please install APR on this system and supply the appropriate"
- echo "--with-apr option to 'configure'"
- AC_MSG_ERROR([no suitable APR found])
-])
-
-dnl UNIMRCP_DOWNLOAD_APU
-dnl no apr-util found, print out a message telling the user what to do
-AC_DEFUN([UNIMRCP_DOWNLOAD_APU],
-[
- echo "The Apache Portable Runtime Utility (APU) library cannot be found."
- echo "Please install APRUTIL on this system and supply the appropriate"
- echo "--with-apr-util option to 'configure'"
- AC_MSG_ERROR([no suitable APU found])
-])
diff --git a/libs/unimrcp/build/acmacros/apr_common.m4 b/libs/unimrcp/build/acmacros/apr_common.m4
deleted file mode 100644
index 6b5c0f033b..0000000000
--- a/libs/unimrcp/build/acmacros/apr_common.m4
+++ /dev/null
@@ -1,990 +0,0 @@
-dnl -------------------------------------------------------- -*- autoconf -*-
-dnl Licensed to the Apache Software Foundation (ASF) under one or more
-dnl contributor license agreements. See the NOTICE file distributed with
-dnl this work for additional information regarding copyright ownership.
-dnl The ASF licenses this file to You under the Apache License, Version 2.0
-dnl (the "License"); you may not use this file except in compliance with
-dnl the License. You may obtain a copy of the License at
-dnl
-dnl http://www.apache.org/licenses/LICENSE-2.0
-dnl
-dnl Unless required by applicable law or agreed to in writing, software
-dnl distributed under the License is distributed on an "AS IS" BASIS,
-dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-dnl See the License for the specific language governing permissions and
-dnl limitations under the License.
-
-dnl
-dnl apr_common.m4: APR's general-purpose autoconf macros
-dnl
-
-dnl
-dnl APR_CONFIG_NICE(filename)
-dnl
-dnl Saves a snapshot of the configure command-line for later reuse
-dnl
-AC_DEFUN([APR_CONFIG_NICE], [
- rm -f $1
- cat >$1<> $1
- fi
- if test -n "$CFLAGS"; then
- echo "CFLAGS=\"$CFLAGS\"; export CFLAGS" >> $1
- fi
- if test -n "$CPPFLAGS"; then
- echo "CPPFLAGS=\"$CPPFLAGS\"; export CPPFLAGS" >> $1
- fi
- if test -n "$LDFLAGS"; then
- echo "LDFLAGS=\"$LDFLAGS\"; export LDFLAGS" >> $1
- fi
- if test -n "$LTFLAGS"; then
- echo "LTFLAGS=\"$LTFLAGS\"; export LTFLAGS" >> $1
- fi
- if test -n "$LIBS"; then
- echo "LIBS=\"$LIBS\"; export LIBS" >> $1
- fi
- if test -n "$INCLUDES"; then
- echo "INCLUDES=\"$INCLUDES\"; export INCLUDES" >> $1
- fi
- if test -n "$NOTEST_CFLAGS"; then
- echo "NOTEST_CFLAGS=\"$NOTEST_CFLAGS\"; export NOTEST_CFLAGS" >> $1
- fi
- if test -n "$NOTEST_CPPFLAGS"; then
- echo "NOTEST_CPPFLAGS=\"$NOTEST_CPPFLAGS\"; export NOTEST_CPPFLAGS" >> $1
- fi
- if test -n "$NOTEST_LDFLAGS"; then
- echo "NOTEST_LDFLAGS=\"$NOTEST_LDFLAGS\"; export NOTEST_LDFLAGS" >> $1
- fi
- if test -n "$NOTEST_LIBS"; then
- echo "NOTEST_LIBS=\"$NOTEST_LIBS\"; export NOTEST_LIBS" >> $1
- fi
-
- # Retrieve command-line arguments.
- eval "set x $[0] $ac_configure_args"
- shift
-
- for arg
- do
- APR_EXPAND_VAR(arg, $arg)
- echo "\"[$]arg\" \\" >> $1
- done
- echo '"[$]@"' >> $1
- chmod +x $1
-])dnl
-
-dnl APR_MKDIR_P_CHECK(fallback-mkdir-p)
-dnl checks whether mkdir -p works
-AC_DEFUN([APR_MKDIR_P_CHECK], [
- AC_CACHE_CHECK(for working mkdir -p, ac_cv_mkdir_p,[
- test -d conftestdir && rm -rf conftestdir
- mkdir -p conftestdir/somedir >/dev/null 2>&1
- if test -d conftestdir/somedir; then
- ac_cv_mkdir_p=yes
- else
- ac_cv_mkdir_p=no
- fi
- rm -rf conftestdir
- ])
- if test "$ac_cv_mkdir_p" = "yes"; then
- mkdir_p="mkdir -p"
- else
- mkdir_p="$1"
- fi
-])
-
-dnl
-dnl APR_SUBDIR_CONFIG(dir [, sub-package-cmdline-args, args-to-drop])
-dnl
-dnl dir: directory to find configure in
-dnl sub-package-cmdline-args: arguments to add to the invocation (optional)
-dnl args-to-drop: arguments to drop from the invocation (optional)
-dnl
-dnl Note: This macro relies on ac_configure_args being set properly.
-dnl
-dnl The args-to-drop argument is shoved into a case statement, so
-dnl multiple arguments can be separated with a |.
-dnl
-dnl Note: Older versions of autoconf do not single-quote args, while 2.54+
-dnl places quotes around every argument. So, if you want to drop the
-dnl argument called --enable-layout, you must pass the third argument as:
-dnl [--enable-layout=*|\'--enable-layout=*]
-dnl
-dnl Trying to optimize this is left as an exercise to the reader who wants
-dnl to put up with more autoconf craziness. I give up.
-dnl
-AC_DEFUN([APR_SUBDIR_CONFIG], [
- # save our work to this point; this allows the sub-package to use it
- AC_CACHE_SAVE
-
- echo "configuring package in $1 now"
- ac_popdir=`pwd`
- apr_config_subdirs="$1"
- test -d $1 || $mkdir_p $1
- ac_abs_srcdir=`(cd $srcdir/$1 && pwd)`
- cd $1
-
-changequote(, )dnl
- # A "../" for each directory in /$config_subdirs.
- ac_dots=`echo $apr_config_subdirs|sed -e 's%^\./%%' -e 's%[^/]$%&/%' -e 's%[^/]*/%../%g'`
-changequote([, ])dnl
-
- # Make the cache file pathname absolute for the subdirs
- # required to correctly handle subdirs that might actually
- # be symlinks
- case "$cache_file" in
- /*) # already absolute
- ac_sub_cache_file=$cache_file ;;
- *) # Was relative path.
- ac_sub_cache_file="$ac_popdir/$cache_file" ;;
- esac
-
- ifelse($3, [], [apr_configure_args=$ac_configure_args],[
- apr_configure_args=
- apr_sep=
- for apr_configure_arg in $ac_configure_args
- do
- case "$apr_configure_arg" in
- $3)
- continue ;;
- esac
- apr_configure_args="$apr_configure_args$apr_sep'$apr_configure_arg'"
- apr_sep=" "
- done
- ])
-
- dnl autoconf doesn't add --silent to ac_configure_args; explicitly pass it
- test "x$silent" = "xyes" && apr_configure_args="$apr_configure_args --silent"
-
- dnl AC_CONFIG_SUBDIRS silences option warnings, emulate this for 2.62
- apr_configure_args="--disable-option-checking $apr_configure_args"
-
- dnl The eval makes quoting arguments work - specifically the second argument
- dnl where the quoting mechanisms used is "" rather than [].
- dnl
- dnl We need to execute another shell because some autoconf/shell combinations
- dnl will choke after doing repeated APR_SUBDIR_CONFIG()s. (Namely Solaris
- dnl and autoconf-2.54+)
- if eval $SHELL $ac_abs_srcdir/configure $apr_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_abs_srcdir $2
- then :
- echo "$1 configured properly"
- else
- echo "configure failed for $1"
- exit 1
- fi
-
- cd $ac_popdir
-
- # grab any updates from the sub-package
- AC_CACHE_LOAD
-])dnl
-
-dnl
-dnl APR_SAVE_THE_ENVIRONMENT(variable_name)
-dnl
-dnl Stores the variable (usually a Makefile macro) for later restoration
-dnl
-AC_DEFUN([APR_SAVE_THE_ENVIRONMENT], [
- apr_ste_save_$1="$$1"
-])dnl
-
-dnl
-dnl APR_RESTORE_THE_ENVIRONMENT(variable_name, prefix_)
-dnl
-dnl Uses the previously saved variable content to figure out what configure
-dnl has added to the variable, moving the new bits to prefix_variable_name
-dnl and restoring the original variable contents. This makes it possible
-dnl for a user to override configure when it does something stupid.
-dnl
-AC_DEFUN([APR_RESTORE_THE_ENVIRONMENT], [
-dnl Check whether $apr_ste_save_$1 is empty or
-dnl only whitespace. The verbatim "X" is token number 1,
-dnl the following whitespace will be ignored.
-set X $apr_ste_save_$1
-if test ${#} -eq 1; then
- $2$1="$$1"
- $1=
-else
- if test "x$apr_ste_save_$1" = "x$$1"; then
- $2$1=
- else
- $2$1=`echo "$$1" | sed -e "s%${apr_ste_save_$1}%%"`
- $1="$apr_ste_save_$1"
- fi
-fi
-if test "x$silent" != "xyes"; then
- echo " restoring $1 to \"$$1\""
- echo " setting $2$1 to \"$$2$1\""
-fi
-AC_SUBST($2$1)
-])dnl
-
-dnl
-dnl APR_SETIFNULL(variable, value)
-dnl
-dnl Set variable iff it's currently null
-dnl
-AC_DEFUN([APR_SETIFNULL], [
- if test -z "$$1"; then
- test "x$silent" != "xyes" && echo " setting $1 to \"$2\""
- $1="$2"
- fi
-])dnl
-
-dnl
-dnl APR_SETVAR(variable, value)
-dnl
-dnl Set variable no matter what
-dnl
-AC_DEFUN([APR_SETVAR], [
- test "x$silent" != "xyes" && echo " forcing $1 to \"$2\""
- $1="$2"
-])dnl
-
-dnl
-dnl APR_ADDTO(variable, value)
-dnl
-dnl Add value to variable
-dnl
-AC_DEFUN([APR_ADDTO], [
- if test "x$$1" = "x"; then
- test "x$silent" != "xyes" && echo " setting $1 to \"$2\""
- $1="$2"
- else
- apr_addto_bugger="$2"
- for i in $apr_addto_bugger; do
- apr_addto_duplicate="0"
- for j in $$1; do
- if test "x$i" = "x$j"; then
- apr_addto_duplicate="1"
- break
- fi
- done
- if test $apr_addto_duplicate = "0"; then
- test "x$silent" != "xyes" && echo " adding \"$i\" to $1"
- $1="$$1 $i"
- fi
- done
- fi
-])dnl
-
-dnl
-dnl APR_REMOVEFROM(variable, value)
-dnl
-dnl Remove a value from a variable
-dnl
-AC_DEFUN([APR_REMOVEFROM], [
- if test "x$$1" = "x$2"; then
- test "x$silent" != "xyes" && echo " nulling $1"
- $1=""
- else
- apr_new_bugger=""
- apr_removed=0
- for i in $$1; do
- if test "x$i" != "x$2"; then
- apr_new_bugger="$apr_new_bugger $i"
- else
- apr_removed=1
- fi
- done
- if test $apr_removed = "1"; then
- test "x$silent" != "xyes" && echo " removed \"$2\" from $1"
- $1=$apr_new_bugger
- fi
- fi
-]) dnl
-
-dnl
-dnl APR_CHECK_DEFINE_FILES( symbol, header_file [header_file ...] )
-dnl
-AC_DEFUN([APR_CHECK_DEFINE_FILES], [
- AC_CACHE_CHECK([for $1 in $2],ac_cv_define_$1,[
- ac_cv_define_$1=no
- for curhdr in $2
- do
- AC_EGREP_CPP(YES_IS_DEFINED, [
-#include <$curhdr>
-#ifdef $1
-YES_IS_DEFINED
-#endif
- ], ac_cv_define_$1=yes)
- done
- ])
- if test "$ac_cv_define_$1" = "yes"; then
- AC_DEFINE(HAVE_$1, 1, [Define if $1 is defined])
- fi
-])
-
-
-dnl
-dnl APR_CHECK_DEFINE(symbol, header_file)
-dnl
-AC_DEFUN([APR_CHECK_DEFINE], [
- AC_CACHE_CHECK([for $1 in $2],ac_cv_define_$1,[
- AC_EGREP_CPP(YES_IS_DEFINED, [
-#include <$2>
-#ifdef $1
-YES_IS_DEFINED
-#endif
- ], ac_cv_define_$1=yes, ac_cv_define_$1=no)
- ])
- if test "$ac_cv_define_$1" = "yes"; then
- AC_DEFINE(HAVE_$1, 1, [Define if $1 is defined in $2])
- fi
-])
-
-dnl
-dnl APR_CHECK_APR_DEFINE( symbol )
-dnl
-AC_DEFUN([APR_CHECK_APR_DEFINE], [
-apr_old_cppflags=$CPPFLAGS
-CPPFLAGS="$CPPFLAGS $INCLUDES"
-AC_EGREP_CPP(YES_IS_DEFINED, [
-#include
-#if $1
-YES_IS_DEFINED
-#endif
-], ac_cv_define_$1=yes, ac_cv_define_$1=no)
-CPPFLAGS=$apr_old_cppflags
-])
-
-dnl APR_CHECK_FILE(filename); set ac_cv_file_filename to
-dnl "yes" if 'filename' is readable, else "no".
-dnl @deprecated! - use AC_CHECK_FILE instead
-AC_DEFUN([APR_CHECK_FILE], [
-dnl Pick a safe variable name
-define([apr_cvname], ac_cv_file_[]translit([$1], [./+-], [__p_]))
-AC_CACHE_CHECK([for $1], [apr_cvname],
-[if test -r $1; then
- apr_cvname=yes
- else
- apr_cvname=no
- fi])
-])
-
-define(APR_IFALLYES,[dnl
-ac_rc=yes
-for ac_spec in $1; do
- ac_type=`echo "$ac_spec" | sed -e 's/:.*$//'`
- ac_item=`echo "$ac_spec" | sed -e 's/^.*://'`
- case $ac_type in
- header )
- ac_item=`echo "$ac_item" | sed 'y%./+-%__p_%'`
- ac_var="ac_cv_header_$ac_item"
- ;;
- file )
- ac_item=`echo "$ac_item" | sed 'y%./+-%__p_%'`
- ac_var="ac_cv_file_$ac_item"
- ;;
- func ) ac_var="ac_cv_func_$ac_item" ;;
- struct ) ac_var="ac_cv_struct_$ac_item" ;;
- define ) ac_var="ac_cv_define_$ac_item" ;;
- custom ) ac_var="$ac_item" ;;
- esac
- eval "ac_val=\$$ac_var"
- if test ".$ac_val" != .yes; then
- ac_rc=no
- break
- fi
-done
-if test ".$ac_rc" = .yes; then
- :
- $2
-else
- :
- $3
-fi
-])
-
-
-define(APR_BEGIN_DECISION,[dnl
-ac_decision_item='$1'
-ac_decision_msg='FAILED'
-ac_decision=''
-])
-
-
-AC_DEFUN([APR_DECIDE],[dnl
-dnl Define the flag (or not) in apr_private.h via autoheader
-AH_TEMPLATE($1, [Define if $2 will be used])
-ac_decision='$1'
-ac_decision_msg='$2'
-ac_decision_$1=yes
-ac_decision_$1_msg='$2'
-])
-
-
-define(APR_DECISION_OVERRIDE,[dnl
- ac_decision=''
- for ac_item in $1; do
- eval "ac_decision_this=\$ac_decision_${ac_item}"
- if test ".$ac_decision_this" = .yes; then
- ac_decision=$ac_item
- eval "ac_decision_msg=\$ac_decision_${ac_item}_msg"
- fi
- done
-])
-
-
-define(APR_DECISION_FORCE,[dnl
-ac_decision="$1"
-eval "ac_decision_msg=\"\$ac_decision_${ac_decision}_msg\""
-])
-
-
-define(APR_END_DECISION,[dnl
-if test ".$ac_decision" = .; then
- echo "[$]0:Error: decision on $ac_decision_item failed" 1>&2
- exit 1
-else
- if test ".$ac_decision_msg" = .; then
- ac_decision_msg="$ac_decision"
- fi
- AC_DEFINE_UNQUOTED(${ac_decision_item})
- AC_MSG_RESULT([decision on $ac_decision_item... $ac_decision_msg])
-fi
-])
-
-
-dnl
-dnl APR_CHECK_SIZEOF_EXTENDED(INCLUDES, TYPE [, CROSS_SIZE])
-dnl
-dnl A variant of AC_CHECK_SIZEOF which allows the checking of
-dnl sizes of non-builtin types
-dnl
-AC_DEFUN([APR_CHECK_SIZEOF_EXTENDED],
-[changequote(<<, >>)dnl
-dnl The name to #define.
-define(<>, translit(sizeof_$2, [a-z *], [A-Z_P]))dnl
-dnl The cache variable name.
-define(<>, translit(ac_cv_sizeof_$2, [ *], [_p]))dnl
-changequote([, ])dnl
-AC_MSG_CHECKING(size of $2)
-AC_CACHE_VAL(AC_CV_NAME,
-[AC_TRY_RUN([#include
-$1
-#ifdef WIN32
-#define binmode "b"
-#else
-#define binmode
-#endif
-main()
-{
- FILE *f=fopen("conftestval", "w" binmode);
- if (!f) exit(1);
- fprintf(f, "%d\n", sizeof($2));
- exit(0);
-}], AC_CV_NAME=`cat conftestval`, AC_CV_NAME=0, ifelse([$3],,,
-AC_CV_NAME=$3))])dnl
-AC_MSG_RESULT($AC_CV_NAME)
-AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME, [The size of ]$2)
-undefine([AC_TYPE_NAME])dnl
-undefine([AC_CV_NAME])dnl
-])
-
-
-dnl
-dnl APR_TRY_COMPILE_NO_WARNING(INCLUDES, FUNCTION-BODY,
-dnl [ACTIONS-IF-NO-WARNINGS], [ACTIONS-IF-WARNINGS])
-dnl
-dnl Tries a compile test with warnings activated so that the result
-dnl is false if the code doesn't compile cleanly. For compilers
-dnl where it is not known how to activate a "fail-on-error" mode,
-dnl it is undefined which of the sets of actions will be run.
-dnl
-AC_DEFUN([APR_TRY_COMPILE_NO_WARNING],
-[apr_save_CFLAGS=$CFLAGS
- CFLAGS="$CFLAGS $CFLAGS_WARN"
- if test "$ac_cv_prog_gcc" = "yes"; then
- CFLAGS="$CFLAGS -Werror"
- fi
- AC_COMPILE_IFELSE(
- [AC_LANG_SOURCE(
- [#include "confdefs.h"
- ]
- [[$1]]
- [int main(int argc, const char *const *argv) {]
- [[$2]]
- [ return 0; }]
- )],
- [$3], [$4])
- CFLAGS=$apr_save_CFLAGS
-])
-
-dnl
-dnl APR_CHECK_STRERROR_R_RC
-dnl
-dnl Decide which style of retcode is used by this system's
-dnl strerror_r(). It either returns int (0 for success, -1
-dnl for failure), or it returns a pointer to the error
-dnl string.
-dnl
-dnl
-AC_DEFUN([APR_CHECK_STRERROR_R_RC], [
-AC_MSG_CHECKING(for type of return code from strerror_r)
-AC_TRY_RUN([
-#include
-#include
-#include
-main()
-{
- char buf[1024];
- if (strerror_r(ERANGE, buf, sizeof buf) < 1) {
- exit(0);
- }
- else {
- exit(1);
- }
-}], [
- ac_cv_strerror_r_rc_int=yes ], [
- ac_cv_strerror_r_rc_int=no ], [
- ac_cv_strerror_r_rc_int=no ] )
-if test "x$ac_cv_strerror_r_rc_int" = xyes; then
- AC_DEFINE(STRERROR_R_RC_INT, 1, [Define if strerror returns int])
- msg="int"
-else
- msg="pointer"
-fi
-AC_MSG_RESULT([$msg])
-] )
-
-dnl
-dnl APR_CHECK_DIRENT_INODE
-dnl
-dnl Decide if d_fileno or d_ino are available in the dirent
-dnl structure on this platform. Single UNIX Spec says d_ino,
-dnl BSD uses d_fileno. Undef to find the real beast.
-dnl
-AC_DEFUN([APR_CHECK_DIRENT_INODE], [
-AC_CACHE_CHECK([for inode member of struct dirent], apr_cv_dirent_inode, [
-apr_cv_dirent_inode=no
-AC_TRY_COMPILE([
-#include
-#include
-],[
-#ifdef d_ino
-#undef d_ino
-#endif
-struct dirent de; de.d_fileno;
-], apr_cv_dirent_inode=d_fileno)
-if test "$apr_cv_dirent_inode" = "no"; then
-AC_TRY_COMPILE([
-#include
-#include
-],[
-#ifdef d_fileno
-#undef d_fileno
-#endif
-struct dirent de; de.d_ino;
-], apr_cv_dirent_inode=d_ino)
-fi
-])
-if test "$apr_cv_dirent_inode" != "no"; then
- AC_DEFINE_UNQUOTED(DIRENT_INODE, $apr_cv_dirent_inode,
- [Define if struct dirent has an inode member])
-fi
-])
-
-dnl
-dnl APR_CHECK_DIRENT_TYPE
-dnl
-dnl Decide if d_type is available in the dirent structure
-dnl on this platform. Not part of the Single UNIX Spec.
-dnl Note that this is worthless without DT_xxx macros, so
-dnl look for one while we are at it.
-dnl
-AC_DEFUN([APR_CHECK_DIRENT_TYPE], [
-AC_CACHE_CHECK([for file type member of struct dirent], apr_cv_dirent_type,[
-apr_cv_dirent_type=no
-AC_TRY_COMPILE([
-#include
-#include
-],[
-struct dirent de; de.d_type = DT_REG;
-], apr_cv_dirent_type=d_type)
-])
-if test "$apr_cv_dirent_type" != "no"; then
- AC_DEFINE_UNQUOTED(DIRENT_TYPE, $apr_cv_dirent_type,
- [Define if struct dirent has a d_type member])
-fi
-])
-
-dnl the following is a newline, a space, a tab, and a backslash (the
-dnl backslash is used by the shell to skip newlines, but m4 sees it;
-dnl treat it like whitespace).
-dnl WARNING: don't reindent these lines, or the space/tab will be lost!
-define([apr_whitespace],[
- \])
-
-dnl
-dnl APR_COMMA_ARGS(ARG1 ...)
-dnl convert the whitespace-separated arguments into comman-separated
-dnl arguments.
-dnl
-dnl APR_FOREACH(CODE-BLOCK, ARG1, ARG2, ...)
-dnl subsitute CODE-BLOCK for each ARG[i]. "eachval" will be set to ARG[i]
-dnl within each iteration.
-dnl
-changequote({,})
-define({APR_COMMA_ARGS},{patsubst([$}{1],[[}apr_whitespace{]+],[,])})
-define({APR_FOREACH},
- {ifelse($}{2,,,
- [define([eachval],
- $}{2)$}{1[]APR_FOREACH([$}{1],
- builtin([shift],
- builtin([shift], $}{@)))])})
-changequote([,])
-
-dnl APR_FLAG_HEADERS(HEADER-FILE ... [, FLAG-TO-SET ] [, "yes" ])
-dnl we set FLAG-TO-SET to 1 if we find HEADER-FILE, otherwise we set to 0
-dnl if FLAG-TO-SET is null, we automagically determine it's name
-dnl by changing all "/" to "_" in the HEADER-FILE and dropping
-dnl all "." and "-" chars. If the 3rd parameter is "yes" then instead of
-dnl setting to 1 or 0, we set FLAG-TO-SET to yes or no.
-dnl
-AC_DEFUN([APR_FLAG_HEADERS], [
-AC_CHECK_HEADERS($1)
-for aprt_i in $1
-do
- ac_safe=`echo "$aprt_i" | sed 'y%./+-%__p_%'`
- aprt_2=`echo "$aprt_i" | sed -e 's%/%_%g' -e 's/\.//g' -e 's/-//g'`
- if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
- eval "ifelse($2,,$aprt_2,$2)=ifelse($3,yes,yes,1)"
- else
- eval "ifelse($2,,$aprt_2,$2)=ifelse($3,yes,no,0)"
- fi
-done
-])
-
-dnl APR_FLAG_FUNCS(FUNC ... [, FLAG-TO-SET] [, "yes" ])
-dnl if FLAG-TO-SET is null, we automagically determine it's name
-dnl prepending "have_" to the function name in FUNC, otherwise
-dnl we use what's provided as FLAG-TO-SET. If the 3rd parameter
-dnl is "yes" then instead of setting to 1 or 0, we set FLAG-TO-SET
-dnl to yes or no.
-dnl
-AC_DEFUN([APR_FLAG_FUNCS], [
-AC_CHECK_FUNCS($1)
-for aprt_j in $1
-do
- aprt_3="have_$aprt_j"
- if eval "test \"`echo '$ac_cv_func_'$aprt_j`\" = yes"; then
- eval "ifelse($2,,$aprt_3,$2)=ifelse($3,yes,yes,1)"
- else
- eval "ifelse($2,,$aprt_3,$2)=ifelse($3,yes,no,0)"
- fi
-done
-])
-
-dnl Iteratively interpolate the contents of the second argument
-dnl until interpolation offers no new result. Then assign the
-dnl final result to $1.
-dnl
-dnl Example:
-dnl
-dnl foo=1
-dnl bar='${foo}/2'
-dnl baz='${bar}/3'
-dnl APR_EXPAND_VAR(fraz, $baz)
-dnl $fraz is now "1/2/3"
-dnl
-AC_DEFUN([APR_EXPAND_VAR], [
-ap_last=
-ap_cur="$2"
-while test "x${ap_cur}" != "x${ap_last}";
-do
- ap_last="${ap_cur}"
- ap_cur=`eval "echo ${ap_cur}"`
-done
-$1="${ap_cur}"
-])
-
-dnl
-dnl Removes the value of $3 from the string in $2, strips of any leading
-dnl slashes, and returns the value in $1.
-dnl
-dnl Example:
-dnl orig_path="${prefix}/bar"
-dnl APR_PATH_RELATIVE(final_path, $orig_path, $prefix)
-dnl $final_path now contains "bar"
-AC_DEFUN([APR_PATH_RELATIVE], [
-ap_stripped=`echo $2 | sed -e "s#^$3##"`
-# check if the stripping was successful
-if test "x$2" != "x${ap_stripped}"; then
- # it was, so strip of any leading slashes
- $1="`echo ${ap_stripped} | sed -e 's#^/*##'`"
-else
- # it wasn't so return the original
- $1="$2"
-fi
-])
-
-dnl APR_HELP_STRING(LHS, RHS)
-dnl Autoconf 2.50 can not handle substr correctly. It does have
-dnl AC_HELP_STRING, so let's try to call it if we can.
-dnl Note: this define must be on one line so that it can be properly returned
-dnl as the help string. When using this macro with a multi-line RHS, ensure
-dnl that you surround the macro invocation with []s
-AC_DEFUN([APR_HELP_STRING], [ifelse(regexp(AC_ACVERSION, 2\.1), -1, AC_HELP_STRING([$1],[$2]),[ ][$1] substr([ ],len($1))[$2])])
-
-dnl
-dnl APR_LAYOUT(configlayout, layoutname [, extravars])
-dnl
-AC_DEFUN([APR_LAYOUT], [
- if test ! -f $srcdir/config.layout; then
- echo "** Error: Layout file $srcdir/config.layout not found"
- echo "** Error: Cannot use undefined layout '$LAYOUT'"
- exit 1
- fi
- # Catch layout names including a slash which will otherwise
- # confuse the heck out of the sed script.
- case $2 in
- */*)
- echo "** Error: $2 is not a valid layout name"
- exit 1 ;;
- esac
- pldconf=./config.pld
- changequote({,})
- sed -e "1s/[ ]*<[lL]ayout[ ]*$2[ ]*>[ ]*//;1t" \
- -e "1,/[ ]*<[lL]ayout[ ]*$2[ ]*>[ ]*/d" \
- -e '/[ ]*<\/Layout>[ ]*/,$d' \
- -e "s/^[ ]*//g" \
- -e "s/:[ ]*/=\'/g" \
- -e "s/[ ]*$/'/g" \
- $1 > $pldconf
- layout_name=$2
- if test ! -s $pldconf; then
- echo "** Error: unable to find layout $layout_name"
- exit 1
- fi
- . $pldconf
- rm $pldconf
- for var in prefix exec_prefix bindir sbindir libexecdir mandir \
- sysconfdir datadir includedir localstatedir runtimedir \
- logfiledir libdir installbuilddir libsuffix $3; do
- eval "val=\"\$$var\""
- case $val in
- *+)
- val=`echo $val | sed -e 's;\+$;;'`
- eval "$var=\"\$val\""
- autosuffix=yes
- ;;
- *)
- autosuffix=no
- ;;
- esac
- val=`echo $val | sed -e 's:\(.\)/*$:\1:'`
- val=`echo $val | sed -e 's:[\$]\([a-z_]*\):${\1}:g'`
- if test "$autosuffix" = "yes"; then
- if echo $val | grep apache >/dev/null; then
- addtarget=no
- else
- addtarget=yes
- fi
- if test "$addtarget" = "yes"; then
- val="$val/apache2"
- fi
- fi
- eval "$var='$val'"
- done
- changequote([,])
-])dnl
-
-dnl
-dnl APR_ENABLE_LAYOUT(default layout name [, extra vars])
-dnl
-AC_DEFUN([APR_ENABLE_LAYOUT], [
-AC_ARG_ENABLE(layout,
-[ --enable-layout=LAYOUT],[
- LAYOUT=$enableval
-])
-
-if test -z "$LAYOUT"; then
- LAYOUT="$1"
-fi
-APR_LAYOUT($srcdir/config.layout, $LAYOUT, $2)
-
-AC_MSG_CHECKING(for chosen layout)
-AC_MSG_RESULT($layout_name)
-])
-
-
-dnl
-dnl APR_PARSE_ARGUMENTS
-dnl a reimplementation of autoconf's argument parser,
-dnl used here to allow us to co-exist layouts and argument based
-dnl set ups.
-AC_DEFUN([APR_PARSE_ARGUMENTS], [
-ac_prev=
-# Retrieve the command-line arguments. The eval is needed because
-# the arguments are quoted to preserve accuracy.
-eval "set x $ac_configure_args"
-shift
-for ac_option
-do
- # If the previous option needs an argument, assign it.
- if test -n "$ac_prev"; then
- eval "$ac_prev=\$ac_option"
- ac_prev=
- continue
- fi
-
- ac_optarg=`expr "x$ac_option" : 'x[[^=]]*=\(.*\)'`
-
- case $ac_option in
-
- -bindir | --bindir | --bindi | --bind | --bin | --bi)
- ac_prev=bindir ;;
- -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
- bindir="$ac_optarg" ;;
-
- -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
- ac_prev=datadir ;;
- -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
- | --da=*)
- datadir="$ac_optarg" ;;
-
- -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
- | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
- | --exec | --exe | --ex)
- ac_prev=exec_prefix ;;
- -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
- | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
- | --exec=* | --exe=* | --ex=*)
- exec_prefix="$ac_optarg" ;;
-
- -includedir | --includedir | --includedi | --included | --include \
- | --includ | --inclu | --incl | --inc)
- ac_prev=includedir ;;
- -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
- | --includ=* | --inclu=* | --incl=* | --inc=*)
- includedir="$ac_optarg" ;;
-
- -infodir | --infodir | --infodi | --infod | --info | --inf)
- ac_prev=infodir ;;
- -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
- infodir="$ac_optarg" ;;
-
- -libdir | --libdir | --libdi | --libd)
- ac_prev=libdir ;;
- -libdir=* | --libdir=* | --libdi=* | --libd=*)
- libdir="$ac_optarg" ;;
-
- -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
- | --libexe | --libex | --libe)
- ac_prev=libexecdir ;;
- -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
- | --libexe=* | --libex=* | --libe=*)
- libexecdir="$ac_optarg" ;;
-
- -localstatedir | --localstatedir | --localstatedi | --localstated \
- | --localstate | --localstat | --localsta | --localst \
- | --locals | --local | --loca | --loc | --lo)
- ac_prev=localstatedir ;;
- -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
- | --localstate=* | --localstat=* | --localsta=* | --localst=* \
- | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
- localstatedir="$ac_optarg" ;;
-
- -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
- ac_prev=mandir ;;
- -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
- mandir="$ac_optarg" ;;
-
- -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
- ac_prev=prefix ;;
- -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
- prefix="$ac_optarg" ;;
-
- -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
- ac_prev=sbindir ;;
- -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
- | --sbi=* | --sb=*)
- sbindir="$ac_optarg" ;;
-
- -sharedstatedir | --sharedstatedir | --sharedstatedi \
- | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
- | --sharedst | --shareds | --shared | --share | --shar \
- | --sha | --sh)
- ac_prev=sharedstatedir ;;
- -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
- | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
- | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
- | --sha=* | --sh=*)
- sharedstatedir="$ac_optarg" ;;
-
- -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
- | --syscon | --sysco | --sysc | --sys | --sy)
- ac_prev=sysconfdir ;;
- -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
- | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
- sysconfdir="$ac_optarg" ;;
-
- esac
-done
-
-# Be sure to have absolute paths.
-for ac_var in exec_prefix prefix
-do
- eval ac_val=$`echo $ac_var`
- case $ac_val in
- [[\\/$]]* | ?:[[\\/]]* | NONE | '' ) ;;
- *) AC_MSG_ERROR([expected an absolute path for --$ac_var: $ac_val]);;
- esac
-done
-
-])dnl
-
-dnl
-dnl APR_CHECK_DEPEND
-dnl
-dnl Determine what program we can use to generate .deps-style dependencies
-dnl
-AC_DEFUN([APR_CHECK_DEPEND], [
-dnl Try to determine what depend program we can use
-dnl All GCC-variants should have -MM.
-dnl If not, then we can check on those, too.
-if test "$GCC" = "yes"; then
- MKDEP='$(CC) -MM'
-else
- rm -f conftest.c
-dnl should be available everywhere!
- cat > conftest.c <
- int main() { return 0; }
-EOF
- MKDEP="true"
- for i in "$CC -MM" "$CC -M" "$CPP -MM" "$CPP -M" "cpp -M"; do
- AC_MSG_CHECKING([if $i can create proper make dependencies])
- if $i conftest.c 2>/dev/null | grep 'conftest.o: conftest.c' >/dev/null; then
- MKDEP=$i
- AC_MSG_RESULT(yes)
- break;
- fi
- AC_MSG_RESULT(no)
- done
- rm -f conftest.c
-fi
-
-AC_SUBST(MKDEP)
-])
-
-dnl
-dnl APR_CHECK_TYPES_COMPATIBLE(TYPE-1, TYPE-2, [ACTION-IF-TRUE])
-dnl
-dnl Try to determine whether two types are the same. Only works
-dnl for gcc and icc.
-dnl
-AC_DEFUN([APR_CHECK_TYPES_COMPATIBLE], [
-define([apr_cvname], apr_cv_typematch_[]translit([$1], [ ], [_])_[]translit([$2], [ ], [_]))
-AC_CACHE_CHECK([whether $1 and $2 are the same], apr_cvname, [
-AC_TRY_COMPILE(AC_INCLUDES_DEFAULT, [
- int foo[0 - !__builtin_types_compatible_p($1, $2)];
-], [apr_cvname=yes
-$3], [apr_cvname=no])])
-])
diff --git a/libs/unimrcp/build/acmacros/apu.m4 b/libs/unimrcp/build/acmacros/apu.m4
deleted file mode 100644
index 0399751157..0000000000
--- a/libs/unimrcp/build/acmacros/apu.m4
+++ /dev/null
@@ -1,2 +0,0 @@
-dnl The macro UNIMRCP_CHECK_APU() has been merged with the macro UNIMRCP_CHECK_APR().
-dnl This file is no longer used and pending for removal.
diff --git a/libs/unimrcp/build/acmacros/ax_compiler_vendor.m4 b/libs/unimrcp/build/acmacros/ax_compiler_vendor.m4
deleted file mode 100644
index 2f8d080249..0000000000
--- a/libs/unimrcp/build/acmacros/ax_compiler_vendor.m4
+++ /dev/null
@@ -1,41 +0,0 @@
-dnl Determine the vendor of the C/C++ compiler, e.g., gnu, intel, ibm, sun,
-dnl hp, borland, comeau, dec, cray, kai, lcc, metrowerks, sgi, microsoft,
-dnl watcom, etc. The vendor is returned in the cache variable
-dnl $ax_cv_c_compiler_vendor for C and $ax_cv_cxx_compiler_vendor for C++.
-
-AC_DEFUN([AX_COMPILER_VENDOR],
-[AC_CACHE_CHECK([for _AC_LANG compiler vendor], ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor,
- [dnl note: don't check for gcc first since some other compilers define __GNUC__
- vendors="intel: __ICC,__ECC,__INTEL_COMPILER
- ibm: __xlc__,__xlC__,__IBMC__,__IBMCPP__
- pathscale: __PATHCC__,__PATHSCALE__
- clang: __clang__
- gnu: __GNUC__
- sun: __SUNPRO_C,__SUNPRO_CC
- hp: __HP_cc,__HP_aCC
- dec: __DECC,__DECCXX,__DECC_VER,__DECCXX_VER
- borland: __BORLANDC__,__TURBOC__
- comeau: __COMO__
- cray: _CRAYC
- kai: __KCC
- lcc: __LCC__
- sgi: __sgi,sgi
- microsoft: _MSC_VER
- metrowerks: __MWERKS__
- watcom: __WATCOMC__
- portland: __PGI
- unknown: UNKNOWN"
- for ventest in $vendors; do
- case $ventest in
- *:) vendor=$ventest; continue ;;
- *) vencpp="defined("`echo $ventest | sed 's/,/) || defined(/g'`")" ;;
- esac
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[
- #if !($vencpp)
- thisisanerror;
- #endif
- ])], [break])
- done
- ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor=`echo $vendor | cut -d: -f1`
- ])
-])
diff --git a/libs/unimrcp/build/acmacros/find_apr.m4 b/libs/unimrcp/build/acmacros/find_apr.m4
deleted file mode 100644
index 048cb7bfc8..0000000000
--- a/libs/unimrcp/build/acmacros/find_apr.m4
+++ /dev/null
@@ -1,167 +0,0 @@
-dnl -------------------------------------------------------- -*- autoconf -*-
-dnl Licensed to the Apache Software Foundation (ASF) under one or more
-dnl contributor license agreements. See the NOTICE file distributed with
-dnl this work for additional information regarding copyright ownership.
-dnl The ASF licenses this file to You under the Apache License, Version 2.0
-dnl (the "License"); you may not use this file except in compliance with
-dnl the License. You may obtain a copy of the License at
-dnl
-dnl http://www.apache.org/licenses/LICENSE-2.0
-dnl
-dnl Unless required by applicable law or agreed to in writing, software
-dnl distributed under the License is distributed on an "AS IS" BASIS,
-dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-dnl See the License for the specific language governing permissions and
-dnl limitations under the License.
-
-dnl
-dnl find_apr.m4 : locate the APR include files and libraries
-dnl
-dnl This macro file can be used by applications to find and use the APR
-dnl library. It provides a standardized mechanism for using APR. It supports
-dnl embedding APR into the application source, or locating an installed
-dnl copy of APR.
-dnl
-dnl APR_FIND_APR(srcdir, builddir, implicit-install-check, acceptable-majors)
-dnl
-dnl where srcdir is the location of the bundled APR source directory, or
-dnl empty if source is not bundled.
-dnl
-dnl where builddir is the location where the bundled APR will will be built,
-dnl or empty if the build will occur in the srcdir.
-dnl
-dnl where implicit-install-check set to 1 indicates if there is no
-dnl --with-apr option specified, we will look for installed copies.
-dnl
-dnl where acceptable-majors is a space separated list of acceptable major
-dnl version numbers. Often only a single major version will be acceptable.
-dnl If multiple versions are specified, and --with-apr=PREFIX or the
-dnl implicit installed search are used, then the first (leftmost) version
-dnl in the list that is found will be used. Currently defaults to [0 1].
-dnl
-dnl Sets the following variables on exit:
-dnl
-dnl apr_found : "yes", "no", "reconfig"
-dnl
-dnl apr_config : If the apr-config tool exists, this refers to it. If
-dnl apr_found is "reconfig", then the bundled directory
-dnl should be reconfigured *before* using apr_config.
-dnl
-dnl Note: this macro file assumes that apr-config has been installed; it
-dnl is normally considered a required part of an APR installation.
-dnl
-dnl If a bundled source directory is available and needs to be (re)configured,
-dnl then apr_found is set to "reconfig". The caller should reconfigure the
-dnl (passed-in) source directory, placing the result in the build directory,
-dnl as appropriate.
-dnl
-dnl If apr_found is "yes" or "reconfig", then the caller should use the
-dnl value of apr_config to fetch any necessary build/link information.
-dnl
-
-AC_DEFUN([APR_FIND_APR], [
- apr_found="no"
-
- if test "$target_os" = "os2-emx"; then
- # Scripts don't pass test -x on OS/2
- TEST_X="test -f"
- else
- TEST_X="test -x"
- fi
-
- ifelse([$4], [], [
- ifdef(AC_WARNING,AC_WARNING([$0: missing argument 4 (acceptable-majors): Defaulting to APR 0.x then APR 1.x]))
- acceptable_majors="0 1"],
- [acceptable_majors="$4"])
-
- apr_temp_acceptable_apr_config=""
- for apr_temp_major in $acceptable_majors
- do
- case $apr_temp_major in
- 0)
- apr_temp_acceptable_apr_config="$apr_temp_acceptable_apr_config apr-config"
- ;;
- *)
- apr_temp_acceptable_apr_config="$apr_temp_acceptable_apr_config apr-$apr_temp_major-config"
- ;;
- esac
- done
-
- AC_MSG_CHECKING(for APR)
- AC_ARG_WITH(apr,
- [ --with-apr=PATH prefix for installed APR, path to APR build tree,
- or the full path to apr-config],
- [
- if test "$withval" = "no" || test "$withval" = "yes"; then
- AC_MSG_ERROR([--with-apr requires a directory or file to be provided])
- fi
-
- for apr_temp_apr_config_file in $apr_temp_acceptable_apr_config
- do
- for lookdir in "$withval/bin" "$withval"
- do
- if $TEST_X "$lookdir/$apr_temp_apr_config_file"; then
- apr_found="yes"
- apr_config="$lookdir/$apr_temp_apr_config_file"
- break 2
- fi
- done
- done
-
- if test "$apr_found" != "yes" && $TEST_X "$withval" && $withval --help > /dev/null 2>&1 ; then
- apr_found="yes"
- apr_config="$withval"
- fi
-
- dnl if --with-apr is used, it is a fatal error for its argument
- dnl to be invalid
- if test "$apr_found" != "yes"; then
- AC_MSG_ERROR([the --with-apr parameter is incorrect. It must specify an install prefix, a build directory, or an apr-config file.])
- fi
- ],[
- dnl If we allow installed copies, check those before using bundled copy.
- if test -n "$3" && test "$3" = "1"; then
- for apr_temp_apr_config_file in $apr_temp_acceptable_apr_config
- do
- if $apr_temp_apr_config_file --help > /dev/null 2>&1 ; then
- apr_found="yes"
- apr_config="$apr_temp_apr_config_file"
- break
- else
- dnl look in some standard places
- for lookdir in /usr /usr/local /usr/local/apr /opt/apr; do
- if $TEST_X "$lookdir/bin/$apr_temp_apr_config_file"; then
- apr_found="yes"
- apr_config="$lookdir/bin/$apr_temp_apr_config_file"
- break 2
- fi
- done
- fi
- done
- fi
- dnl if we have not found anything yet and have bundled source, use that
- if test "$apr_found" = "no" && test -d "$1"; then
- apr_temp_abs_srcdir="`cd $1 && pwd`"
- apr_found="reconfig"
- apr_bundled_major="`sed -n '/#define.*APR_MAJOR_VERSION/s/^[^0-9]*\([0-9]*\).*$/\1/p' \"$1/include/apr_version.h\"`"
- case $apr_bundled_major in
- "")
- AC_MSG_ERROR([failed to find major version of bundled APR])
- ;;
- 0)
- apr_temp_apr_config_file="apr-config"
- ;;
- *)
- apr_temp_apr_config_file="apr-$apr_bundled_major-config"
- ;;
- esac
- if test -n "$2"; then
- apr_config="$2/$apr_temp_apr_config_file"
- else
- apr_config="$1/$apr_temp_apr_config_file"
- fi
- fi
- ])
-
- AC_MSG_RESULT($apr_found)
-])
diff --git a/libs/unimrcp/build/acmacros/find_apu.m4 b/libs/unimrcp/build/acmacros/find_apu.m4
deleted file mode 100644
index e29bc60923..0000000000
--- a/libs/unimrcp/build/acmacros/find_apu.m4
+++ /dev/null
@@ -1,176 +0,0 @@
-dnl -------------------------------------------------------- -*- autoconf -*-
-dnl Copyright 2002-2005 The Apache Software Foundation or its licensors, as
-dnl applicable.
-dnl
-dnl Licensed under the Apache License, Version 2.0 (the "License");
-dnl you may not use this file except in compliance with the License.
-dnl You may obtain a copy of the License at
-dnl
-dnl http://www.apache.org/licenses/LICENSE-2.0
-dnl
-dnl Unless required by applicable law or agreed to in writing, software
-dnl distributed under the License is distributed on an "AS IS" BASIS,
-dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-dnl See the License for the specific language governing permissions and
-dnl limitations under the License.
-
-dnl
-dnl find_apu.m4 : locate the APR-util (APU) include files and libraries
-dnl
-dnl This macro file can be used by applications to find and use the APU
-dnl library. It provides a standardized mechanism for using APU. It supports
-dnl embedding APU into the application source, or locating an installed
-dnl copy of APU.
-dnl
-dnl APR_FIND_APU(srcdir, builddir, implicit-install-check, acceptable-majors)
-dnl
-dnl where srcdir is the location of the bundled APU source directory, or
-dnl empty if source is not bundled.
-dnl
-dnl where builddir is the location where the bundled APU will be built,
-dnl or empty if the build will occur in the srcdir.
-dnl
-dnl where implicit-install-check set to 1 indicates if there is no
-dnl --with-apr-util option specified, we will look for installed copies.
-dnl
-dnl where acceptable-majors is a space separated list of acceptable major
-dnl version numbers. Often only a single major version will be acceptable.
-dnl If multiple versions are specified, and --with-apr-util=PREFIX or the
-dnl implicit installed search are used, then the first (leftmost) version
-dnl in the list that is found will be used. Currently defaults to [0 1].
-dnl
-dnl Sets the following variables on exit:
-dnl
-dnl apu_found : "yes", "no", "reconfig"
-dnl
-dnl apu_config : If the apu-config tool exists, this refers to it. If
-dnl apu_found is "reconfig", then the bundled directory
-dnl should be reconfigured *before* using apu_config.
-dnl
-dnl Note: this macro file assumes that apr-config has been installed; it
-dnl is normally considered a required part of an APR installation.
-dnl
-dnl Note: At this time, we cannot find *both* a source dir and a build dir.
-dnl If both are available, the build directory should be passed to
-dnl the --with-apr-util switch.
-dnl
-dnl Note: the installation layout is presumed to follow the standard
-dnl PREFIX/lib and PREFIX/include pattern. If the APU config file
-dnl is available (and can be found), then non-standard layouts are
-dnl possible, since it will be described in the config file.
-dnl
-dnl If a bundled source directory is available and needs to be (re)configured,
-dnl then apu_found is set to "reconfig". The caller should reconfigure the
-dnl (passed-in) source directory, placing the result in the build directory,
-dnl as appropriate.
-dnl
-dnl If apu_found is "yes" or "reconfig", then the caller should use the
-dnl value of apu_config to fetch any necessary build/link information.
-dnl
-
-AC_DEFUN([APR_FIND_APU], [
- apu_found="no"
-
- if test "$target_os" = "os2-emx"; then
- # Scripts don't pass test -x on OS/2
- TEST_X="test -f"
- else
- TEST_X="test -x"
- fi
-
- ifelse([$4], [],
- [
- ifdef(AC_WARNING,([$0: missing argument 4 (acceptable-majors): Defaulting to APU 0.x then APU 1.x]))
- acceptable_majors="0 1"
- ], [acceptable_majors="$4"])
-
- apu_temp_acceptable_apu_config=""
- for apu_temp_major in $acceptable_majors
- do
- case $apu_temp_major in
- 0)
- apu_temp_acceptable_apu_config="$apu_temp_acceptable_apu_config apu-config"
- ;;
- *)
- apu_temp_acceptable_apu_config="$apu_temp_acceptable_apu_config apu-$apu_temp_major-config"
- ;;
- esac
- done
-
- AC_MSG_CHECKING(for APR-util)
- AC_ARG_WITH(apr-util,
- [ --with-apr-util=PATH prefix for installed APU, path to APU build tree,
- or the full path to apu-config],
- [
- if test "$withval" = "no" || test "$withval" = "yes"; then
- AC_MSG_ERROR([--with-apr-util requires a directory or file to be provided])
- fi
-
- for apu_temp_apu_config_file in $apu_temp_acceptable_apu_config
- do
- for lookdir in "$withval/bin" "$withval"
- do
- if $TEST_X "$lookdir/$apu_temp_apu_config_file"; then
- apu_found="yes"
- apu_config="$lookdir/$apu_temp_apu_config_file"
- break 2
- fi
- done
- done
-
- if test "$apu_found" != "yes" && $TEST_X "$withval" && $withval --help > /dev/null 2>&1 ; then
- apu_found="yes"
- apu_config="$withval"
- fi
-
- dnl if --with-apr-util is used, it is a fatal error for its argument
- dnl to be invalid
- if test "$apu_found" != "yes"; then
- AC_MSG_ERROR([the --with-apr-util parameter is incorrect. It must specify an install prefix, a build directory, or an apu-config file.])
- fi
- ],[
- if test -n "$3" && test "$3" = "1"; then
- for apu_temp_apu_config_file in $apu_temp_acceptable_apu_config
- do
- if $apu_temp_apu_config_file --help > /dev/null 2>&1 ; then
- apu_found="yes"
- apu_config="$apu_temp_apu_config_file"
- break
- else
- dnl look in some standard places (apparently not in builtin/default)
- for lookdir in /usr /usr/local /usr/local/apr /opt/apr /usr/local/apache2 ; do
- if $TEST_X "$lookdir/bin/$apu_temp_apu_config_file"; then
- apu_found="yes"
- apu_config="$lookdir/bin/$apu_temp_apu_config_file"
- break 2
- fi
- done
- fi
- done
- fi
- dnl if we have not found anything yet and have bundled source, use that
- if test "$apu_found" = "no" && test -d "$1"; then
- apu_temp_abs_srcdir="`cd $1 && pwd`"
- apu_found="reconfig"
- apu_bundled_major="`sed -n '/#define.*APU_MAJOR_VERSION/s/^[^0-9]*\([0-9]*\).*$/\1/p' \"$1/include/apu_version.h\"`"
- case $apu_bundled_major in
- "")
- AC_MSG_ERROR([failed to find major version of bundled APU])
- ;;
- 0)
- apu_temp_apu_config_file="apu-config"
- ;;
- *)
- apu_temp_apu_config_file="apu-$apu_bundled_major-config"
- ;;
- esac
- if test -n "$2"; then
- apu_config="$2/$apu_temp_apu_config_file"
- else
- apu_config="$1/$apu_temp_apu_config_file"
- fi
- fi
- ])
-
- AC_MSG_RESULT($apu_found)
-])
diff --git a/libs/unimrcp/build/acmacros/sofia-sip.m4 b/libs/unimrcp/build/acmacros/sofia-sip.m4
deleted file mode 100644
index ef1dfcb8d9..0000000000
--- a/libs/unimrcp/build/acmacros/sofia-sip.m4
+++ /dev/null
@@ -1,85 +0,0 @@
-dnl
-dnl UNIMRCP_CHECK_SOFIA
-dnl
-dnl This macro attempts to find the Sofia-SIP library and
-dnl set corresponding variables on exit.
-dnl
-AC_DEFUN([UNIMRCP_CHECK_SOFIA],
-[
- AC_MSG_NOTICE([Sofia SIP library configuration])
-
- AC_MSG_CHECKING([for Sofia-SIP])
- AC_ARG_WITH(sofia-sip,
- [ --with-sofia-sip=PATH prefix for installed Sofia-SIP,
- path to Sofia-SIP source/build tree,
- or the full path to Sofia-SIP pkg-config],
- [sofia_path=$withval],
- [sofia_path="/usr/local"]
- )
-
- found_sofia="no"
-
- if test -n "$PKG_CONFIG"; then
- dnl Check for installed Sofia-SIP
- for dir in $sofia_path ; do
- sofia_config_path=$dir/lib/pkgconfig/sofia-sip-ua.pc
- if test -f "$sofia_config_path" && $PKG_CONFIG $sofia_config_path > /dev/null 2>&1; then
- found_sofia="yes"
- break
- fi
- done
-
- dnl Check for installed Sofia-SIP in PKG_CONFIG_PATH
- if test "$found_sofia" != "yes" && $PKG_CONFIG sofia-sip-ua > /dev/null 2>&1 ; then
- found_sofia="yes"
- sofia_config_path="sofia-sip-ua"
- fi
-
- dnl Check for full path to Sofia-SIP pkg-config file
- if test "$found_sofia" != "yes" && test -f "$sofia_path" && $PKG_CONFIG $sofia_path > /dev/null 2>&1 ; then
- found_sofia="yes"
- sofia_config_path=$sofia_path
- fi
-
- if test "$found_sofia" = "yes" ; then
- UNIMRCP_SOFIA_INCLUDES="`$PKG_CONFIG --cflags $sofia_config_path`"
- UNIMRCP_SOFIA_LIBS="`$PKG_CONFIG --libs $sofia_config_path`"
- sofia_version="`$PKG_CONFIG --modversion $sofia_config_path`"
- fi
- fi
-
- if test "$found_sofia" != "yes" ; then
- dnl Check for path to Sofia-SIP source/build tree
- for dir in $sofia_path ; do
- sofia_uadir="$dir/libsofia-sip-ua"
- if test -d "$sofia_uadir"; then
- found_sofia="yes"
- sofia_abs_uadir="`cd $sofia_uadir && pwd`"
- UNIMRCP_SOFIA_INCLUDES="-I$sofia_abs_uadir -I$sofia_abs_uadir/bnf -I$sofia_abs_uadir/features -I$sofia_abs_uadir/http -I$sofia_abs_uadir/ipt -I$sofia_abs_uadir/iptsec -I$sofia_abs_uadir/msg -I$sofia_abs_uadir/nea -I$sofia_abs_uadir/nta -I$sofia_abs_uadir/nth -I$sofia_abs_uadir/nua -I$sofia_abs_uadir/sdp -I$sofia_abs_uadir/sip -I$sofia_abs_uadir/soa -I$sofia_abs_uadir/sresolv -I$sofia_abs_uadir/stun -I$sofia_abs_uadir/su -I$sofia_abs_uadir/tport -I$sofia_abs_uadir/url"
- UNIMRCP_SOFIA_LIBS="$sofia_abs_uadir/libsofia-sip-ua.la"
- sofia_version="`sed -n 's/#define SOFIA_SIP_VERSION.* "\(.*\)"/\1/p' $sofia_uadir/features/sofia-sip/sofia_features.h`"
- break
- fi
- done
- fi
-
- if test $found_sofia != "yes" ; then
- if test -n "$PKG_CONFIG"; then
- AC_MSG_ERROR(Cannot find Sofia-SIP - looked for sofia-config and libsofia-sip-ua in $sofia_path)
- else
- AC_MSG_ERROR(Cannot find Sofia-SIP - pkg-config not available, looked for libsofia-sip-ua in $sofia_path)
- fi
- else
- AC_MSG_RESULT([$found_sofia])
- AC_MSG_RESULT([$sofia_version])
-
-case "$host" in
- *darwin*)
- UNIMRCP_SOFIA_LIBS="$UNIMRCP_SOFIA_LIBS -framework CoreFoundation -framework SystemConfiguration"
- ;;
-esac
-
- AC_SUBST(UNIMRCP_SOFIA_INCLUDES)
- AC_SUBST(UNIMRCP_SOFIA_LIBS)
- fi
-])
diff --git a/libs/unimrcp/build/acmacros/uni_plugin.m4 b/libs/unimrcp/build/acmacros/uni_plugin.m4
deleted file mode 100644
index 6a33b1b638..0000000000
--- a/libs/unimrcp/build/acmacros/uni_plugin.m4
+++ /dev/null
@@ -1,45 +0,0 @@
-dnl
-dnl UNI_PLUGIN_ENABLED(name)
-dnl
-dnl where name is the name of the plugin.
-dnl
-dnl This macro can be used for a plugin which must be enabled by default.
-dnl
-dnl Adds the following argument to the configure script:
-dnl
-dnl --disable-$1-plugin
-dnl
-dnl Sets the following variable on exit:
-dnl
-dnl enable_$1_plugin : "yes" or "no"
-dnl
-AC_DEFUN([UNI_PLUGIN_ENABLED],[
- AC_ARG_ENABLE(
- [$1-plugin],
- [AC_HELP_STRING([--disable-$1-plugin],[exclude $1 plugin from build])],
- [enable_$1_plugin="$enableval"],
- [enable_$1_plugin="yes"])
-])
-
-dnl
-dnl UNI_PLUGIN_DISABLED(name)
-dnl
-dnl where name is the name of the plugin.
-dnl
-dnl This macro can be used for a plugin which must be disabled by default.
-dnl
-dnl Adds the following argument to the configure script:
-dnl
-dnl --enable-$1-plugin
-dnl
-dnl Sets the following variable on exit:
-dnl
-dnl enable_$1_plugin : "yes" or "no"
-dnl
-AC_DEFUN([UNI_PLUGIN_DISABLED],[
- AC_ARG_ENABLE(
- [$1-plugin],
- [AC_HELP_STRING([--enable-$1-plugin],[include $1 plugin in build])],
- [enable_$1_plugin="$enableval"],
- [enable_$1_plugin="no"])
-])
diff --git a/libs/unimrcp/build/get-version.sh b/libs/unimrcp/build/get-version.sh
deleted file mode 100755
index fd685b22a8..0000000000
--- a/libs/unimrcp/build/get-version.sh
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/bin/sh
-#
-# extract version numbers from a header file
-#
-# USAGE: get-version.sh CMD VERSION_HEADER PREFIX
-# where CMD is one of: all, major, libtool
-# where PREFIX is the prefix to {MAJOR|MINOR|PATCH}_VERSION defines
-#
-# get-version.sh all returns a dotted version number
-# get-version.sh major returns just the major version number
-# get-version.sh libtool returns a version "libtool -version-info" format
-#
-
-if test $# != 3; then
- echo "USAGE: $0 CMD VERSION_HEADER PREFIX"
- echo " where CMD is one of: all, major, libtool"
- exit 1
-fi
-
-major_sed="/#define.*$3_MAJOR_VERSION/s/^[^0-9]*\([0-9]*\).*$/\1/p"
-minor_sed="/#define.*$3_MINOR_VERSION/s/^[^0-9]*\([0-9]*\).*$/\1/p"
-patch_sed="/#define.*$3_PATCH_VERSION/s/^[^0-9]*\([0-9]*\).*$/\1/p"
-major="`sed -n $major_sed $2`"
-minor="`sed -n $minor_sed $2`"
-patch="`sed -n $patch_sed $2`"
-
-if test "$1" = "all"; then
- echo ${major}.${minor}.${patch}
-elif test "$1" = "major"; then
- echo ${major}
-elif test "$1" = "libtool"; then
- # Yes, ${minor}:${patch}:${minor} is correct due to libtool idiocy.
- echo ${minor}:${patch}:${minor}
-else
- echo "ERROR: unknown version CMD ($1)"
- exit 1
-fi
diff --git a/libs/unimrcp/build/init.d/unimrcp-server b/libs/unimrcp/build/init.d/unimrcp-server
deleted file mode 100755
index 3518e23fa1..0000000000
--- a/libs/unimrcp/build/init.d/unimrcp-server
+++ /dev/null
@@ -1,270 +0,0 @@
-#!/bin/sh
-#
-# unimrcp-server This shell script takes care of starting and stopping the UniMRCP server.
-#
-# chkconfig: 2345 65 35
-# description: UniMRCP is an open source MRCP v1 & v2 server.
-
-# Some global variables
-
-# Application
-APP_NAME="unimrcpserver"
-APP_LONG_NAME="UniMRCP Server"
-UNIMRCP_DIR="/usr/local/unimrcp/"
-DAEMON_ARGS="-d -r ${UNIMRCP_DIR}"
-APP_ARGS="-o 2"
-
-EXEC="${UNIMRCP_DIR}bin/${APP_NAME}"
-
-# sudo user
-USERNAME=root
-
-# Priority at which to run the server. See "man nice" for valid priorities.
-# nice is only used if a priority is specified.
-PRIORITY=
-
-# Location of the pid file.
-PIDDIR="/var/run/"
-pid=
-
-if [ -e $PIDDIR ]; then
- echo
-else
- mkdir $PIDDIR
-fi
-
-# Allow configuration overrides in /etc/sysconfig/$APP_NAME
-CONFIGFILE=/etc/sysconfig/$APP_NAME
-
-[ -x $CONFIGFILE ] && . $CONFIGFILE
-
-# Do not modify anything beyond this point
-#-----------------------------------------------------------------------------
-
-# Get the fully qualified path to the script
-case $0 in
- /*)
- SCRIPT="$0"
- ;;
- *)
- PWD=`pwd`
- SCRIPT="$PWD/$0"
- ;;
-esac
-
-# Change spaces to ":" so the tokens can be parsed.
-SCRIPT=`echo $SCRIPT | sed -e 's; ;:;g'`
-# Get the real path to this script, resolving any symbolic links
-TOKENS=`echo $SCRIPT | sed -e 's;/; ;g'`
-REALPATH=
-for C in $TOKENS; do
- REALPATH="$REALPATH/$C"
- while [ -h "$REALPATH" ] ; do
- LS="`ls -ld "$REALPATH"`"
- LINK="`expr "$LS" : '.*-> \(.*\)$'`"
- if expr "$LINK" : '/.*' > /dev/null; then
- REALPATH="$LINK"
- else
- REALPATH="`dirname "$REALPATH"`""/$LINK"
- fi
- done
-done
-# Change ":" chars back to spaces.
-REALPATH=`echo $REALPATH | sed -e 's;:; ;g'`
-
-# Change the current directory to the location of the script
-cd "`dirname "$REALPATH"`"
-
-chown $USERNAME $PIDDIR
-
-# Process ID
-PIDFILE="$PIDDIR/$APP_NAME.pid"
-
-# Resolve the location of the 'ps' command
-PSEXE="/usr/bin/ps"
-if [ ! -x $PSEXE ]
-then
- PSEXE="/bin/ps"
- if [ ! -x $PSEXE ]
- then
- echo "Unable to locate 'ps'."
- echo "Please report this with the location on your system."
- exit 1
- fi
-fi
-
-# Build the nice clause
-if [ "X$PRIORITY" = "X" ]
-then
- CMDNICE=""
-else
- CMDNICE="nice -$PRIORITY"
-fi
-
-getpid() {
- if [ -f $PIDFILE ]
- then
- if [ -r $PIDFILE ]
- then
- pid=`cat $PIDFILE`
- if [ "X$pid" != "X" ]
- then
- # Verify that a process with this pid is still running.
- pid=`$PSEXE -p $pid | grep $pid | grep -v grep | awk '{print $1}' | tail -1`
- if [ "X$pid" = "X" ]
- then
- # This is a stale pid file.
- rm -f $PIDFILE
- echo "Removed stale pid file: $PIDFILE"
- fi
- fi
- else
- echo "Cannot read $PIDFILE."
- exit 1
- fi
- fi
-}
-
-testpid() {
- pid=`$PSEXE -p $pid | grep $pid | grep -v grep | awk '{print $1}' | tail -1`
- if [ "X$pid" = "X" ]
- then
- # Process is gone so remove the pid file.
- rm -f $PIDFILE
- fi
-}
-
-console() {
- echo "Running $APP_LONG_NAME..."
- getpid
- if [ "X$pid" = "X" ]
- then
- exec sudo -u $USERNAME $CMDNICE $EXEC $APP_ARGS
- echo $pid > $PIDFILE
- else
- echo "$APP_LONG_NAME is already running."
- exit 1
- fi
-}
-
-start() {
- echo "Starting $APP_LONG_NAME..."
- getpid
- if [ "X$pid" = "X" ]
- then
- sudo -u $USERNAME $CMDNICE $EXEC $DAEMON_ARGS $APP_ARGS
- pid=`$PSEXE -C $APP_NAME -o pid=`
- echo $pid > $PIDFILE
- else
- echo "$APP_LONG_NAME is already running."
- exit 1
- fi
-}
-
-stopit() {
- echo "Stopping $APP_LONG_NAME..."
- getpid
- if [ "X$pid" = "X" ]
- then
- echo "$APP_LONG_NAME was not running."
- else
- # Running so try to stop it.
- sudo -u $USERNAME kill $pid
- if [ $? -ne 0 ]
- then
- # An explanation for the failure should have been given
- echo "Unable to stop $APP_LONG_NAME."
- exit 1
- fi
-
- # We can not predict how long it will take for the wrapper to
- # actually stop as it depends on settings in wrapper.conf.
- # Loop until it does.
- savepid=$pid
- CNT=0
- TOTCNT=0
- while [ "X$pid" != "X" ]
- do
- # Loop for up to 5 minutes
- if [ "$TOTCNT" -lt "300" ]
- then
- if [ "$CNT" -lt "5" ]
- then
- CNT=`expr $CNT + 1`
- else
- echo "Waiting for $APP_LONG_NAME to exit..."
- CNT=0
- fi
- TOTCNT=`expr $TOTCNT + 1`
-
- sleep 1
-
- testpid
- else
- pid=
- fi
- done
-
- pid=$savepid
- testpid
- if [ "X$pid" != "X" ]
- then
- echo "Timed out waiting for $APP_LONG_NAME to exit."
- echo " Attempting a forced exit..."
- kill -9 $pid
- fi
-
- pid=$savepid
- testpid
- if [ "X$pid" != "X" ]
- then
- echo "Failed to stop $APP_LONG_NAME."
- exit 1
- else
- echo "Stopped $APP_LONG_NAME."
- fi
- fi
-}
-
-status() {
- getpid
- if [ "X$pid" = "X" ]
- then
- echo "$APP_LONG_NAME is not running."
- exit 1
- else
- echo "$APP_LONG_NAME is running ($pid)."
- exit 0
- fi
-}
-
-case "$1" in
-
- 'console')
- console
- ;;
-
- 'start')
- start
- ;;
-
- 'stop')
- stopit
- ;;
-
- 'restart')
- stopit
- start
- ;;
-
- 'status')
- status
- ;;
-
- *)
- echo "Usage: $0 { console | start | stop | restart | status }"
- exit 1
- ;;
-esac
-
-exit 0
diff --git a/libs/unimrcp/build/pkgconfig/Makefile.am b/libs/unimrcp/build/pkgconfig/Makefile.am
deleted file mode 100644
index ce3a063c05..0000000000
--- a/libs/unimrcp/build/pkgconfig/Makefile.am
+++ /dev/null
@@ -1,4 +0,0 @@
-MAINTAINERCLEANFILES = Makefile.in
-
-pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = unimrcpclient.pc unimrcpserver.pc unimrcpplugin.pc
diff --git a/libs/unimrcp/build/pkgconfig/unimrcpclient.pc.in b/libs/unimrcp/build/pkgconfig/unimrcpclient.pc.in
deleted file mode 100644
index 7fe3f1c130..0000000000
--- a/libs/unimrcp/build/pkgconfig/unimrcpclient.pc.in
+++ /dev/null
@@ -1,11 +0,0 @@
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@ @UNIMRCP_APR_INCLUDES@
-
-Name: unimrcpclient
-Description: UniMRCP Client Stack
-Requires:
-Version: @UNI_DOTTED_VERSION@
-Libs: -L${libdir} -lunimrcpclient
-Cflags: @CPPFLAGS@ @CFLAGS@ -I${includedir}
diff --git a/libs/unimrcp/build/pkgconfig/unimrcpplugin.pc.in b/libs/unimrcp/build/pkgconfig/unimrcpplugin.pc.in
deleted file mode 100644
index df78b8ea7f..0000000000
--- a/libs/unimrcp/build/pkgconfig/unimrcpplugin.pc.in
+++ /dev/null
@@ -1,11 +0,0 @@
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@ @UNIMRCP_APR_INCLUDES@
-
-Name: unimrcpplugin
-Description: UniMRCP Server Plugin
-Requires:
-Version: @UNI_DOTTED_VERSION@
-Libs: -L${libdir} -lunimrcpserver
-Cflags: @CPPFLAGS@ @CFLAGS@ -I${includedir}
diff --git a/libs/unimrcp/build/pkgconfig/unimrcpserver.pc.in b/libs/unimrcp/build/pkgconfig/unimrcpserver.pc.in
deleted file mode 100644
index 3ed91ecd02..0000000000
--- a/libs/unimrcp/build/pkgconfig/unimrcpserver.pc.in
+++ /dev/null
@@ -1,11 +0,0 @@
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@ @UNIMRCP_APR_INCLUDES@
-
-Name: unimrcpserver
-Description: UniMRCP Server Stack
-Requires:
-Version: @UNI_DOTTED_VERSION@
-Libs: -L${libdir} -lunimrcpserver
-Cflags: @CPPFLAGS@ @CFLAGS@ -I${includedir}
diff --git a/libs/unimrcp/build/props/apr.props b/libs/unimrcp/build/props/apr.props
deleted file mode 100644
index 8e3f475bb3..0000000000
--- a/libs/unimrcp/build/props/apr.props
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
-
-
-
-
- $(LibRootDir)libs\apr
- $(LibRootDir)libs\apr-util
- $(LibRootDir)libs\apr-iconv
-
-
- <_ProjectFileVersion>10.0.30319.1
-
-
- true
-
-
-
- $(AprDir)\include;$(AprUtilDir)\include;%(AdditionalIncludeDirectories)
-
-
-
-
- $(AprDir)
-
-
- $(AprUtilDir)
-
-
- $(AprIconvDir)
-
-
-
\ No newline at end of file
diff --git a/libs/unimrcp/build/props/apt.props b/libs/unimrcp/build/props/apt.props
deleted file mode 100644
index 89c5547c33..0000000000
--- a/libs/unimrcp/build/props/apt.props
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
-
-
- <_ProjectFileVersion>10.0.30319.1
-
-
- true
-
-
-
- $(ProjectRootDir)libs\apr-toolkit\include;%(AdditionalIncludeDirectories)
- APT_STATIC_LIB;%(PreprocessorDefinitions)
-
-
-
\ No newline at end of file
diff --git a/libs/unimrcp/build/props/mpf.props b/libs/unimrcp/build/props/mpf.props
deleted file mode 100644
index 8e46c5dd2a..0000000000
--- a/libs/unimrcp/build/props/mpf.props
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
-
-
- <_ProjectFileVersion>10.0.30319.1
-
-
- true
-
-
-
- $(ProjectRootDir)libs\mpf\include;%(AdditionalIncludeDirectories)
- MPF_STATIC_LIB;%(PreprocessorDefinitions)
-
-
-
\ No newline at end of file
diff --git a/libs/unimrcp/build/props/mrcp.props b/libs/unimrcp/build/props/mrcp.props
deleted file mode 100644
index 14f8a4683d..0000000000
--- a/libs/unimrcp/build/props/mrcp.props
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
-
-
- <_ProjectFileVersion>10.0.30319.1
-
-
- true
-
-
-
- $(ProjectRootDir)libs\mrcp\include;$(ProjectRootDir)libs\mrcp\message\include;$(ProjectRootDir)libs\mrcp\control\include;$(ProjectRootDir)libs\mrcp\resources\include;%(AdditionalIncludeDirectories)
- MRCP_STATIC_LIB;%(PreprocessorDefinitions)
-
-
-
\ No newline at end of file
diff --git a/libs/unimrcp/build/props/mrcpclient.props b/libs/unimrcp/build/props/mrcpclient.props
deleted file mode 100644
index 4e552bd3fd..0000000000
--- a/libs/unimrcp/build/props/mrcpclient.props
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
-
-
-
- <_ProjectFileVersion>10.0.30319.1
-
-
-
- $(ProjectRootDir)libs\mrcp-client\include;%(AdditionalIncludeDirectories)
-
-
-
\ No newline at end of file
diff --git a/libs/unimrcp/build/props/mrcpengine.props b/libs/unimrcp/build/props/mrcpengine.props
deleted file mode 100644
index 5b1ee1b5ca..0000000000
--- a/libs/unimrcp/build/props/mrcpengine.props
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
-
-
-
- <_ProjectFileVersion>10.0.30319.1
-
-
-
- $(ProjectRootDir)libs\mrcp-engine\include;%(AdditionalIncludeDirectories)
-
-
-
\ No newline at end of file
diff --git a/libs/unimrcp/build/props/mrcpserver.props b/libs/unimrcp/build/props/mrcpserver.props
deleted file mode 100644
index 94e5e8aef2..0000000000
--- a/libs/unimrcp/build/props/mrcpserver.props
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
-
-
-
-
- <_ProjectFileVersion>10.0.30319.1
-
-
-
- $(ProjectRootDir)libs\mrcp-server\include;%(AdditionalIncludeDirectories)
-
-
-
\ No newline at end of file
diff --git a/libs/unimrcp/build/props/mrcpsignaling.props b/libs/unimrcp/build/props/mrcpsignaling.props
deleted file mode 100644
index dbe9aa32cf..0000000000
--- a/libs/unimrcp/build/props/mrcpsignaling.props
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
-
-
-
- <_ProjectFileVersion>10.0.30319.1
-
-
-
- $(ProjectRootDir)libs\mrcp-signaling\include;%(AdditionalIncludeDirectories)
-
-
-
\ No newline at end of file
diff --git a/libs/unimrcp/build/props/mrcpv2transport.props b/libs/unimrcp/build/props/mrcpv2transport.props
deleted file mode 100644
index 8b65c83982..0000000000
--- a/libs/unimrcp/build/props/mrcpv2transport.props
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
- <_ProjectFileVersion>10.0.30319.1
-
-
-
- $(ProjectRootDir)libs\mrcpv2-transport\include;%(AdditionalIncludeDirectories)
-
-
-
\ No newline at end of file
diff --git a/libs/unimrcp/build/props/sdk/unimrcpclient.props b/libs/unimrcp/build/props/sdk/unimrcpclient.props
deleted file mode 100644
index b9e764ee52..0000000000
--- a/libs/unimrcp/build/props/sdk/unimrcpclient.props
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
-
-
-
- libunimrcpclient.lib mrcpsofiasip.lib mrcpunirtsp.lib unirtsp.lib mrcpclient.lib mrcpv2transport.lib mrcpsignaling.lib libsofia_sip_ua.lib ws2_32.lib winmm.lib;%(AdditionalDependencies)
-
-
-
-
\ No newline at end of file
diff --git a/libs/unimrcp/build/props/sdk/unimrcpplugin.props b/libs/unimrcp/build/props/sdk/unimrcpplugin.props
deleted file mode 100644
index 6d69aea52b..0000000000
--- a/libs/unimrcp/build/props/sdk/unimrcpplugin.props
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
-
-
-
- mrcpengine.lib;%(AdditionalDependencies)
-
-
-
-
\ No newline at end of file
diff --git a/libs/unimrcp/build/props/sdk/unimrcpsdk.props b/libs/unimrcp/build/props/sdk/unimrcpsdk.props
deleted file mode 100644
index 0334d6a0fe..0000000000
--- a/libs/unimrcp/build/props/sdk/unimrcpsdk.props
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-
-
- C:\Program Files\UniMRCP
-
-
-
-
- $(ProjectRootDir)\include;%(AdditionalIncludeDirectories)
- APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)
-
-
- $(ProjectRootDir)\lib;%(AdditionalLibraryDirectories)
- mrcp.lib;mpf.lib;aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies)
-
-
-
-
- $(ProjectRootDir)
-
-
-
\ No newline at end of file
diff --git a/libs/unimrcp/build/props/sdk/unimrcpserver.props b/libs/unimrcp/build/props/sdk/unimrcpserver.props
deleted file mode 100644
index 979a32781e..0000000000
--- a/libs/unimrcp/build/props/sdk/unimrcpserver.props
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
-
-
-
- libunimrcpserver.lib mrcpsofiasip.lib mrcpunirtsp.lib unirtsp.lib mrcpserver.lib mrcpv2transport.lib mrcpsignaling.lib mrcpengine.lib libsofia_sip_ua.lib ws2_32.lib winmm.lib;%(AdditionalDependencies)
-
-
-
-
\ No newline at end of file
diff --git a/libs/unimrcp/build/props/sofiasip.props b/libs/unimrcp/build/props/sofiasip.props
deleted file mode 100644
index 0620099b0c..0000000000
--- a/libs/unimrcp/build/props/sofiasip.props
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-
-
-
- $(LibRootDir)libs\sofia-sip
-
-
- <_ProjectFileVersion>10.0.30319.1
-
-
- true
-
-
-
- $(SofiaDir)\win32;$(SofiaDir)\libsofia-sip-ua\su;$(SofiaDir)\libsofia-sip-ua\nua;$(SofiaDir)\libsofia-sip-ua\url;$(SofiaDir)\libsofia-sip-ua\sip;$(SofiaDir)\libsofia-sip-ua\msg;$(SofiaDir)\libsofia-sip-ua\sdp;$(SofiaDir)\libsofia-sip-ua\nta;$(SofiaDir)\libsofia-sip-ua\nea;$(SofiaDir)\libsofia-sip-ua\soa;$(SofiaDir)\libsofia-sip-ua\iptsec;$(SofiaDir)\libsofia-sip-ua\bnf;$(SofiaDir)\libsofia-sip-ua\features;$(SofiaDir)\libsofia-sip-ua\tport;%(AdditionalIncludeDirectories)
-
-
-
-
- $(SofiaDir)
-
-
-
\ No newline at end of file
diff --git a/libs/unimrcp/build/props/unibase.props b/libs/unimrcp/build/props/unibase.props
deleted file mode 100644
index 2573021220..0000000000
--- a/libs/unimrcp/build/props/unibase.props
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
-
- $(ProjectDir)..\..\
- $(SolutionDir)
-
-
- <_ProjectFileVersion>10.0.30319.1
-
-
- true
-
-
-
- WIN32;%(PreprocessorDefinitions)
- Level4
- true
- 4100;%(DisableSpecificWarnings)
-
-
-
-
- $(ProjectRootDir)
-
-
- $(LibRootDir)
-
-
-
\ No newline at end of file
diff --git a/libs/unimrcp/build/props/unibin-x64.props b/libs/unimrcp/build/props/unibin-x64.props
deleted file mode 100644
index 0d5b4dda41..0000000000
--- a/libs/unimrcp/build/props/unibin-x64.props
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
-
-
-
-
- <_ProjectFileVersion>10.0.30319.1
- $(SolutionDir)$(PlatformName)\$(Configuration)\bin\
- $(PlatformName)\$(Configuration)\
-
-
-
- _WIN64;%(PreprocessorDefinitions)
-
-
- $(AprDir)\$(Platform)\$(Configuration);$(AprUtilDir)\$(Platform)\$(Configuration);$(SofiaDir)\win32\libsofia-sip-ua\$(Platform)\$(Configuration);$(SolutionDir)$(Platform)\$(Configuration)\lib;$(SolutionDir)$(Platform)\$(Configuration)\bin;%(AdditionalLibraryDirectories)
- MachineX64
-
-
-
\ No newline at end of file
diff --git a/libs/unimrcp/build/props/unibin.props b/libs/unimrcp/build/props/unibin.props
deleted file mode 100644
index bb83b9ed65..0000000000
--- a/libs/unimrcp/build/props/unibin.props
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
-
-
-
- <_ProjectFileVersion>10.0.30319.1
- $(SolutionDir)$(Configuration)\bin\
- $(Configuration)\
-
-
-
- $(AprDir)\$(Configuration);$(AprUtilDir)\$(Configuration);$(SofiaDir)\win32\libsofia-sip-ua\$(Configuration);$(SolutionDir)$(Configuration)\lib;$(SolutionDir)$(Configuration)\bin;%(AdditionalLibraryDirectories)
- MachineX86
-
-
-
\ No newline at end of file
diff --git a/libs/unimrcp/build/props/unidebug.props b/libs/unimrcp/build/props/unidebug.props
deleted file mode 100644
index 7c3d8d81fe..0000000000
--- a/libs/unimrcp/build/props/unidebug.props
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-
-
-
- <_ProjectFileVersion>10.0.30319.1
- true
-
-
-
- Disabled
- _DEBUG;%(PreprocessorDefinitions)
- true
- EnableFastChecks
- MultiThreadedDebugDLL
-
-
- ProgramDatabase
-
-
- true
-
-
-
\ No newline at end of file
diff --git a/libs/unimrcp/build/props/unilib-x64.props b/libs/unimrcp/build/props/unilib-x64.props
deleted file mode 100644
index e5e25acc2e..0000000000
--- a/libs/unimrcp/build/props/unilib-x64.props
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
- <_ProjectFileVersion>10.0.30319.1
- $(SolutionDir)$(PlatformName)\$(Configuration)\lib\
- $(PlatformName)\$(Configuration)\
-
-
-
- _WIN64;%(PreprocessorDefinitions)
-
-
-
\ No newline at end of file
diff --git a/libs/unimrcp/build/props/unilib.props b/libs/unimrcp/build/props/unilib.props
deleted file mode 100644
index c77e94699e..0000000000
--- a/libs/unimrcp/build/props/unilib.props
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
- <_ProjectFileVersion>10.0.30319.1
- $(SolutionDir)$(Configuration)\lib\
- $(Configuration)\
-
-
\ No newline at end of file
diff --git a/libs/unimrcp/build/props/unimrcpclient.props b/libs/unimrcp/build/props/unimrcpclient.props
deleted file mode 100644
index 78f2b87025..0000000000
--- a/libs/unimrcp/build/props/unimrcpclient.props
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-
-
-
-
-
- libunimrcpclient.lib;mrcpsofiasip.lib;mrcpunirtsp.lib;unirtsp.lib;mrcpclient.lib;mrcpv2transport.lib;mrcpsignaling.lib;mrcp.lib;mpf.lib;aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;libsofia_sip_ua.lib;ws2_32.lib;winmm.lib
-
-
- <_ProjectFileVersion>10.0.30319.1
-
-
-
- $(ProjectRootDir)platforms\libunimrcp-client\include;$(ProjectRootDir)build;%(AdditionalIncludeDirectories)
-
-
-
-
- $(UniMRCPClientLibs)
-
-
-
\ No newline at end of file
diff --git a/libs/unimrcp/build/props/unimrcpserver.props b/libs/unimrcp/build/props/unimrcpserver.props
deleted file mode 100644
index 97c0f9808f..0000000000
--- a/libs/unimrcp/build/props/unimrcpserver.props
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-
-
-
-
-
- libunimrcpserver.lib;mrcpsofiasip.lib;mrcpunirtsp.lib;unirtsp.lib;mrcpserver.lib;mrcpv2transport.lib;mrcpsignaling.lib;mrcpengine.lib;mrcp.lib;mpf.lib;aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;libsofia_sip_ua.lib;ws2_32.lib;winmm.lib
-
-
- <_ProjectFileVersion>10.0.30319.1
-
-
-
- $(ProjectRootDir)platforms\libunimrcp-server\include;$(ProjectRootDir)build;%(AdditionalIncludeDirectories)
-
-
-
-
- $(UniMRCPServerLibs)
-
-
-
\ No newline at end of file
diff --git a/libs/unimrcp/build/props/uniplugin-x64.props b/libs/unimrcp/build/props/uniplugin-x64.props
deleted file mode 100644
index 7dc181ca94..0000000000
--- a/libs/unimrcp/build/props/uniplugin-x64.props
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
-
-
-
- <_ProjectFileVersion>10.0.30319.1
- $(SolutionDir)$(PlatformName)\$(Configuration)\plugin\
- $(PlatformName)\$(Configuration)\
-
-
-
- _WIN64;%(PreprocessorDefinitions)
-
-
- $(AprDir)\$(Platform)\$(Configuration);$(AprUtilDir)\$(Platform)\$(Configuration);$(SolutionDir)$(Platform)\$(Configuration)\lib;%(AdditionalLibraryDirectories)
- mrcpengine.lib;mrcp.lib;mpf.lib;aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;ws2_32.lib;%(AdditionalDependencies)
- MachineX64
-
-
-
\ No newline at end of file
diff --git a/libs/unimrcp/build/props/uniplugin.props b/libs/unimrcp/build/props/uniplugin.props
deleted file mode 100644
index 09dbe53c17..0000000000
--- a/libs/unimrcp/build/props/uniplugin.props
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-
-
-
-
- <_ProjectFileVersion>10.0.30319.1
- $(SolutionDir)$(Configuration)\plugin\
- $(Configuration)\
-
-
-
- $(AprDir)\$(Configuration);$(AprUtilDir)\$(Configuration);$(SolutionDir)$(Configuration)\lib;%(AdditionalLibraryDirectories)
- mrcpengine.lib;mrcp.lib;mpf.lib;aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;ws2_32.lib;%(AdditionalDependencies)
- MachineX86
-
-
-
\ No newline at end of file
diff --git a/libs/unimrcp/build/props/unirelease.props b/libs/unimrcp/build/props/unirelease.props
deleted file mode 100644
index a2a832025a..0000000000
--- a/libs/unimrcp/build/props/unirelease.props
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
-
-
- <_ProjectFileVersion>10.0.30319.1
-
-
-
- NDEBUG;%(PreprocessorDefinitions)
- MultiThreadedDLL
-
-
- ProgramDatabase
-
-
-
\ No newline at end of file
diff --git a/libs/unimrcp/build/props/unirtsp.props b/libs/unimrcp/build/props/unirtsp.props
deleted file mode 100644
index c872838994..0000000000
--- a/libs/unimrcp/build/props/unirtsp.props
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
-
-
- <_ProjectFileVersion>10.0.30319.1
-
-
-
- $(ProjectRootDir)libs\uni-rtsp\include;%(AdditionalIncludeDirectories)
- RTSP_STATIC_LIB;%(PreprocessorDefinitions)
-
-
-
\ No newline at end of file
diff --git a/libs/unimrcp/build/rules/uniclientapp.am b/libs/unimrcp/build/rules/uniclientapp.am
deleted file mode 100644
index 2b1b97d1c3..0000000000
--- a/libs/unimrcp/build/rules/uniclientapp.am
+++ /dev/null
@@ -1,24 +0,0 @@
-MAINTAINERCLEANFILES = Makefile.in
-
-# Includes
-UNIMRCP_CLIENTAPP_INCLUDES = -I$(top_srcdir)/platforms/libunimrcp-client/include \
- -I$(top_srcdir)/libs/mrcp-client/include \
- -I$(top_srcdir)/libs/mrcp-signaling/include \
- -I$(top_srcdir)/libs/mrcpv2-transport/include \
- -I$(top_srcdir)/libs/mrcp/include \
- -I$(top_srcdir)/libs/mrcp/message/include \
- -I$(top_srcdir)/libs/mrcp/control/include \
- -I$(top_srcdir)/libs/mrcp/resources/include \
- -I$(top_srcdir)/libs/mpf/include \
- -I$(top_srcdir)/libs/apr-toolkit/include \
- -I$(top_srcdir)/build \
- $(UNIMRCP_APR_INCLUDES)
-
-# Libraries (LDADD)
-UNIMRCP_CLIENTAPP_LIBS = $(top_builddir)/platforms/libunimrcp-client/libunimrcpclient.la
-
-# Linker options (LDFLAGS)
-UNIMRCP_CLIENTAPP_OPTS =
-if ISMAC
-UNIMRCP_CLIENTAPP_OPTS += -framework CoreFoundation -framework SystemConfiguration
-endif
diff --git a/libs/unimrcp/build/rules/uniclientlib.am b/libs/unimrcp/build/rules/uniclientlib.am
deleted file mode 100644
index 89d173e61a..0000000000
--- a/libs/unimrcp/build/rules/uniclientlib.am
+++ /dev/null
@@ -1,30 +0,0 @@
-MAINTAINERCLEANFILES = Makefile.in
-
-# Includes
-UNIMRCP_CLIENTLIB_INCLUDES = -I$(top_srcdir)/modules/mrcp-sofiasip/include \
- -I$(top_srcdir)/modules/mrcp-unirtsp/include \
- -I$(top_srcdir)/libs/mrcp-client/include \
- -I$(top_srcdir)/libs/mrcp-signaling/include \
- -I$(top_srcdir)/libs/mrcpv2-transport/include \
- -I$(top_srcdir)/libs/mrcp/include \
- -I$(top_srcdir)/libs/mrcp/message/include \
- -I$(top_srcdir)/libs/mrcp/control/include \
- -I$(top_srcdir)/libs/mrcp/resources/include \
- -I$(top_srcdir)/libs/mpf/include \
- -I$(top_srcdir)/libs/apr-toolkit/include \
- -I$(top_srcdir)/build \
- $(UNIMRCP_APR_INCLUDES)
-
-# Libraries (LIBADD)
-UNIMRCP_CLIENTLIB_LIBS = $(top_builddir)/modules/mrcp-sofiasip/libmrcpsofiasip.la \
- $(top_builddir)/modules/mrcp-unirtsp/libmrcpunirtsp.la \
- $(top_builddir)/libs/mrcpv2-transport/libmrcpv2transport.la \
- $(top_builddir)/libs/mrcp-client/libmrcpclient.la \
- $(top_builddir)/libs/mrcp-signaling/libmrcpsignaling.la \
- $(top_builddir)/libs/mrcp/libmrcp.la \
- $(top_builddir)/libs/mpf/libmpf.la \
- $(top_builddir)/libs/apr-toolkit/libaprtoolkit.la \
- $(UNIMRCP_APR_LIBS) $(UNIMRCP_SOFIA_LIBS) -lm
-
-# Linker options (LDFLAGS)
-UNIMRCP_CLIENTLIB_OPTS = $(UNI_LT_VERSION)
diff --git a/libs/unimrcp/build/rules/uniplugin.am b/libs/unimrcp/build/rules/uniplugin.am
deleted file mode 100644
index caf0de48ad..0000000000
--- a/libs/unimrcp/build/rules/uniplugin.am
+++ /dev/null
@@ -1,14 +0,0 @@
-MAINTAINERCLEANFILES = Makefile.in
-
-# Includes
-UNIMRCP_PLUGIN_INCLUDES = -I$(top_srcdir)/libs/mrcp-engine/include \
- -I$(top_srcdir)/libs/mrcp/include \
- -I$(top_srcdir)/libs/mrcp/message/include \
- -I$(top_srcdir)/libs/mrcp/control/include \
- -I$(top_srcdir)/libs/mrcp/resources/include \
- -I$(top_srcdir)/libs/mpf/include \
- -I$(top_srcdir)/libs/apr-toolkit/include \
- $(UNIMRCP_APR_INCLUDES)
-
-# Linker options (LDFLAGS)
-UNIMRCP_PLUGIN_OPTS = -module $(PLUGIN_LT_VERSION)
diff --git a/libs/unimrcp/build/rules/uniserverapp.am b/libs/unimrcp/build/rules/uniserverapp.am
deleted file mode 100644
index 957b0e75cd..0000000000
--- a/libs/unimrcp/build/rules/uniserverapp.am
+++ /dev/null
@@ -1,25 +0,0 @@
-MAINTAINERCLEANFILES = Makefile.in
-
-# Includes
-UNIMRCP_SERVERAPP_INCLUDES = -I$(top_srcdir)/platforms/libunimrcp-server/include \
- -I$(top_srcdir)/libs/mrcp-server/include \
- -I$(top_srcdir)/libs/mrcp-engine/include \
- -I$(top_srcdir)/libs/mrcp-signaling/include \
- -I$(top_srcdir)/libs/mrcpv2-transport/include \
- -I$(top_srcdir)/libs/mrcp/include \
- -I$(top_srcdir)/libs/mrcp/message/include \
- -I$(top_srcdir)/libs/mrcp/control/include \
- -I$(top_srcdir)/libs/mrcp/resources/include \
- -I$(top_srcdir)/libs/mpf/include \
- -I$(top_srcdir)/libs/apr-toolkit/include \
- -I$(top_srcdir)/build \
- $(UNIMRCP_APR_INCLUDES)
-
-# Libraries (LDADD)
-UNIMRCP_SERVERAPP_LIBS = $(top_builddir)/platforms/libunimrcp-server/libunimrcpserver.la
-
-# Linker options (LDFLAGS)
-UNIMRCP_SERVERAPP_OPTS =
-if ISMAC
-UNIMRCP_SERVERAPP_OPTS += -framework CoreFoundation -framework SystemConfiguration
-endif
diff --git a/libs/unimrcp/build/rules/uniserverlib.am b/libs/unimrcp/build/rules/uniserverlib.am
deleted file mode 100644
index b933796e42..0000000000
--- a/libs/unimrcp/build/rules/uniserverlib.am
+++ /dev/null
@@ -1,32 +0,0 @@
-MAINTAINERCLEANFILES = Makefile.in
-
-# Includes
-UNIMRCP_SERVERLIB_INCLUDES = -I$(top_srcdir)/modules/mrcp-sofiasip/include \
- -I$(top_srcdir)/modules/mrcp-unirtsp/include \
- -I$(top_srcdir)/libs/mrcp-server/include \
- -I$(top_srcdir)/libs/mrcp-engine/include \
- -I$(top_srcdir)/libs/mrcp-signaling/include \
- -I$(top_srcdir)/libs/mrcpv2-transport/include \
- -I$(top_srcdir)/libs/mrcp/include \
- -I$(top_srcdir)/libs/mrcp/message/include \
- -I$(top_srcdir)/libs/mrcp/control/include \
- -I$(top_srcdir)/libs/mrcp/resources/include \
- -I$(top_srcdir)/libs/mpf/include \
- -I$(top_srcdir)/libs/apr-toolkit/include \
- -I$(top_srcdir)/build \
- $(UNIMRCP_APR_INCLUDES)
-
-# Libraries (LIBADD)
-UNIMRCP_SERVERLIB_LIBS = $(top_builddir)/modules/mrcp-sofiasip/libmrcpsofiasip.la \
- $(top_builddir)/modules/mrcp-unirtsp/libmrcpunirtsp.la \
- $(top_builddir)/libs/mrcp-server/libmrcpserver.la \
- $(top_builddir)/libs/mrcp-signaling/libmrcpsignaling.la \
- $(top_builddir)/libs/mrcpv2-transport/libmrcpv2transport.la \
- $(top_builddir)/libs/mrcp-engine/libmrcpengine.la \
- $(top_builddir)/libs/mrcp/libmrcp.la \
- $(top_builddir)/libs/mpf/libmpf.la \
- $(top_builddir)/libs/apr-toolkit/libaprtoolkit.la \
- $(UNIMRCP_APR_LIBS) $(UNIMRCP_SOFIA_LIBS) -lm
-
-# Linker options (LDFLAGS)
-UNIMRCP_SERVERLIB_OPTS = $(UNI_LT_VERSION)
diff --git a/libs/unimrcp/build/tools/prepare.vcproj b/libs/unimrcp/build/tools/prepare.vcproj
deleted file mode 100644
index 3b03c54a93..0000000000
--- a/libs/unimrcp/build/tools/prepare.vcproj
+++ /dev/null
@@ -1,122 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/libs/unimrcp/build/tools/prepare.vcxproj b/libs/unimrcp/build/tools/prepare.vcxproj
deleted file mode 100644
index b9ab80fc50..0000000000
--- a/libs/unimrcp/build/tools/prepare.vcxproj
+++ /dev/null
@@ -1,205 +0,0 @@
-
-
-
-
- Debug
- Win32
-
-
- Debug
- x64
-
-
- Release
- Win32
-
-
- Release
- x64
-
-
-
- {01D63BF5-7798-4746-852A-4B45229BB735}
- prepare
- Win32Proj
-
-
-
- Utility
- Unicode
- true
-
-
- Utility
- Unicode
-
-
- Utility
- Unicode
- true
-
-
- Utility
- Unicode
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <_ProjectFileVersion>10.0.30319.1
- $(SolutionDir)$(Configuration)\
- $(Configuration)\
- true
- $(SolutionDir)$(Platform)\$(Configuration)\
- $(Platform)\$(Configuration)\
- true
- $(SolutionDir)$(Configuration)\
- $(Configuration)\
- $(SolutionDir)$(Platform)\$(Configuration)\
- $(Platform)\$(Configuration)\
-
-
-
- xcopy "$(AprDir)\$(Configuration)\libapr-1.dll" "$(SolutionDir)$(Configuration)\bin\" /Y
-xcopy "$(AprUtilDir)\$(Configuration)\libaprutil-1.dll" "$(SolutionDir)$(Configuration)\bin\" /Y
-
-if exist "$(AprIconvDir)\$(Configuration)\libapriconv-1.dll" (
-xcopy "$(AprIconvDir)\$(Configuration)\libapriconv-1.dll" "$(SolutionDir)$(Configuration)\bin\" /Y
-if exist "$(AprIconvDir)\$(Configuration)\iconv" (
-if not exist "$(SolutionDir)$(Configuration)\bin\iconv" mkdir "$(SolutionDir)$(Configuration)\bin\iconv"
-xcopy "$(AprIconvDir)\$(Configuration)\iconv\*.so" "$(SolutionDir)$(Configuration)\bin\iconv\" /Y
-)
-)
-
-xcopy "$(SofiaDir)\win32\libsofia-sip-ua\$(Configuration)\libsofia_sip_ua.dll" "$(SolutionDir)$(Configuration)\bin\" /Y
-xcopy "$(SofiaDir)\win32\pthread\$(Configuration)\pthreadVC2.dll" "$(SolutionDir)$(Configuration)\bin\" /Y
-
-if not exist "$(SolutionDir)$(Configuration)\conf" (
-xcopy "$(SolutionDir)conf\*.xml" "$(SolutionDir)$(Configuration)\conf\" /Y
-xcopy "$(SolutionDir)conf\*.xsd" "$(SolutionDir)$(Configuration)\conf\" /Y
-xcopy "$(SolutionDir)conf\client-profiles\*.xml" "$(SolutionDir)$(Configuration)\conf\client-profiles\" /Y
-)
-
-if not exist "$(SolutionDir)$(Configuration)\data" xcopy "$(SolutionDir)data\*" "$(SolutionDir)$(Configuration)\data\" /Y
-if not exist "$(SolutionDir)$(Configuration)\log" mkdir "$(SolutionDir)$(Configuration)\log\"
-if not exist "$(SolutionDir)$(Configuration)\var" mkdir "$(SolutionDir)$(Configuration)\var\"
-
-
-
-
-
- xcopy "$(AprDir)\$(Platform)\$(Configuration)\libapr-1.dll" "$(SolutionDir)$(Platform)\$(Configuration)\bin\" /Y
-xcopy "$(AprUtilDir)\$(Platform)\$(Configuration)\libaprutil-1.dll" "$(SolutionDir)$(Platform)\$(Configuration)\bin\" /Y
-
-if exist "$(AprIconvDir)\$(Platform)\$(Configuration)\libapriconv-1.dll" (
-xcopy "$(AprIconvDir)\$(Platform)\$(Configuration)\libapriconv-1.dll" "$(SolutionDir)$(Platform)\$(Configuration)\bin\" /Y
-if exist "$(AprIconvDir)\$(Platform)\$(Configuration)\iconv" (
-if not exist "$(SolutionDir)$(Platform)\$(Configuration)\bin\iconv" mkdir "$(SolutionDir)$(Platform)\$(Configuration)\bin\iconv"
-xcopy "$(AprIconvDir)\$(Platform)\$(Configuration)\iconv\*.so" "$(SolutionDir)$(Platform)\$(Configuration)\bin\iconv\" /Y
-)
-)
-
-xcopy "$(SofiaDir)\win32\libsofia-sip-ua\$(Platform)\$(Configuration)\libsofia_sip_ua.dll" "$(SolutionDir)$(Platform)\$(Configuration)\bin\" /Y
-xcopy "$(SofiaDir)\win32\pthread\$(Platform)\$(Configuration)\pthreadVC2.dll" "$(SolutionDir)$(Platform)\$(Configuration)\bin\" /Y
-
-if not exist "$(SolutionDir)$(Platform)\$(Configuration)\conf" (
-xcopy "$(SolutionDir)conf\*.xml" "$(SolutionDir)$(Platform)\$(Configuration)\conf\" /Y
-xcopy "$(SolutionDir)conf\*.xsd" "$(SolutionDir)$(Platform)\$(Configuration)\conf\" /Y
-xcopy "$(SolutionDir)conf\client-profiles\*.xml" "$(SolutionDir)$(Platform)\$(Configuration)\conf\client-profiles\" /Y
-)
-
-if not exist "$(SolutionDir)$(Platform)\$(Configuration)\data" xcopy "$(SolutionDir)data\*" "$(SolutionDir)$(Platform)\$(Configuration)\data\" /Y
-if not exist "$(SolutionDir)$(Platform)\$(Configuration)\log" mkdir "$(SolutionDir)$(Platform)\$(Configuration)\log\"
-if not exist "$(SolutionDir)$(Platform)\$(Configuration)\var" mkdir "$(SolutionDir)$(Platform)\$(Configuration)\var\"
-
-
-
- X64
-
-
-
-
- xcopy "$(AprDir)\$(Configuration)\libapr-1.dll" "$(SolutionDir)$(Configuration)\bin\" /Y
-xcopy "$(AprUtilDir)\$(Configuration)\libaprutil-1.dll" "$(SolutionDir)$(Configuration)\bin\" /Y
-
-if exist "$(AprIconvDir)\$(Configuration)\libapriconv-1.dll" (
-xcopy "$(AprIconvDir)\$(Configuration)\libapriconv-1.dll" "$(SolutionDir)$(Configuration)\bin\" /Y
-if exist "$(AprIconvDir)\$(Configuration)\iconv" (
-if not exist "$(SolutionDir)$(Configuration)\bin\iconv" mkdir "$(SolutionDir)$(Configuration)\bin\iconv"
-xcopy "$(AprIconvDir)\$(Configuration)\iconv\*.so" "$(SolutionDir)$(Configuration)\bin\iconv\" /Y
-)
-)
-
-xcopy "$(SofiaDir)\win32\libsofia-sip-ua\$(Configuration)\libsofia_sip_ua.dll" "$(SolutionDir)$(Configuration)\bin\" /Y
-xcopy "$(SofiaDir)\win32\pthread\$(Configuration)\pthreadVC2.dll" "$(SolutionDir)$(Configuration)\bin\" /Y
-
-if not exist "$(SolutionDir)$(Configuration)\conf" (
-xcopy "$(SolutionDir)conf\*.xml" "$(SolutionDir)$(Configuration)\conf\" /Y
-xcopy "$(SolutionDir)conf\*.xsd" "$(SolutionDir)$(Configuration)\conf\" /Y
-xcopy "$(SolutionDir)conf\client-profiles\*.xml" "$(SolutionDir)$(Configuration)\conf\client-profiles\" /Y
-)
-
-if not exist "$(SolutionDir)$(Configuration)\data" xcopy "$(SolutionDir)data\*" "$(SolutionDir)$(Configuration)\data\" /Y
-if not exist "$(SolutionDir)$(Configuration)\log" mkdir "$(SolutionDir)$(Configuration)\log\"
-if not exist "$(SolutionDir)$(Configuration)\var" mkdir "$(SolutionDir)$(Configuration)\var\"
-
-
-
-
-
- xcopy "$(AprDir)\$(Platform)\$(Configuration)\libapr-1.dll" "$(SolutionDir)$(Platform)\$(Configuration)\bin\" /Y
-xcopy "$(AprUtilDir)\$(Platform)\$(Configuration)\libaprutil-1.dll" "$(SolutionDir)$(Platform)\$(Configuration)\bin\" /Y
-
-if exist "$(AprIconvDir)\$(Platform)\$(Configuration)\libapriconv-1.dll" (
-xcopy "$(AprIconvDir)\$(Platform)\$(Configuration)\libapriconv-1.dll" "$(SolutionDir)$(Platform)\$(Configuration)\bin\" /Y
-if exist "$(AprIconvDir)\$(Platform)\$(Configuration)\iconv" (
-if not exist "$(SolutionDir)$(Platform)\$(Configuration)\bin\iconv" mkdir "$(SolutionDir)$(Platform)\$(Configuration)\bin\iconv"
-xcopy "$(AprIconvDir)\$(Platform)\$(Configuration)\iconv\*.so" "$(SolutionDir)$(Platform)\$(Configuration)\bin\iconv\" /Y
-)
-)
-
-xcopy "$(SofiaDir)\win32\libsofia-sip-ua\$(Platform)\$(Configuration)\libsofia_sip_ua.dll" "$(SolutionDir)$(Platform)\$(Configuration)\bin\" /Y
-xcopy "$(SofiaDir)\win32\pthread\$(Platform)\$(Configuration)\pthreadVC2.dll" "$(SolutionDir)$(Platform)\$(Configuration)\bin\" /Y
-
-if not exist "$(SolutionDir)$(Platform)\$(Configuration)\conf" (
-xcopy "$(SolutionDir)conf\*.xml" "$(SolutionDir)$(Platform)\$(Configuration)\conf\" /Y
-xcopy "$(SolutionDir)conf\*.xsd" "$(SolutionDir)$(Platform)\$(Configuration)\conf\" /Y
-xcopy "$(SolutionDir)conf\client-profiles\*.xml" "$(SolutionDir)$(Platform)\$(Configuration)\conf\client-profiles\" /Y
-)
-
-if not exist "$(SolutionDir)$(Platform)\$(Configuration)\data" xcopy "$(SolutionDir)data\*" "$(SolutionDir)$(Platform)\$(Configuration)\data\" /Y
-if not exist "$(SolutionDir)$(Platform)\$(Configuration)\log" mkdir "$(SolutionDir)$(Platform)\$(Configuration)\log\"
-if not exist "$(SolutionDir)$(Platform)\$(Configuration)\var" mkdir "$(SolutionDir)$(Platform)\$(Configuration)\var\"
-
-
-
- X64
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/libs/unimrcp/build/tools/unimrcp_service.c b/libs/unimrcp/build/tools/unimrcp_service.c
deleted file mode 100644
index db2ed39bab..0000000000
--- a/libs/unimrcp/build/tools/unimrcp_service.c
+++ /dev/null
@@ -1,446 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: unimrcp_service.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include
-#include
-#include
-#include
-#include "apt.h"
-#include "apt_pool.h"
-
-#define WIN_SERVICE_NAME "unimrcp"
-
-/** UniMRCP service register command enumeration */
-typedef enum uni_service_register_e {
- USR_NONE, USR_REGISTER, USR_UNREGISTER
-} uni_service_register_e;
-
-/** UniMRCP service control command enumeration */
-typedef enum uni_service_control_e {
- USC_NONE, USC_START, USC_STOP
-} uni_service_control_e;
-
-
-/** Display error message with Windows error code and description */
-static void winerror(const char *msg)
-{
- char buf[128];
- DWORD err = GetLastError();
- int ret = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL,
- err,
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
- buf, sizeof(buf), NULL);
- printf("%s: %lu %.*s\n", msg, err, ret, buf);
-}
-
-/** Register/install service in SCM */
-static apt_bool_t uni_service_register(const char *root_dir_path, apr_pool_t *pool,
- const char *name,
- apt_bool_t autostart,
- unsigned long recover,
- int log_priority,
- const char *disp_name,
- const char *description)
-{
- apr_status_t status;
- char buf[4096];
- static const size_t len = sizeof(buf);
- size_t pos = 0;
- char *root_dir;
- SERVICE_DESCRIPTION desc;
- SC_HANDLE sch_service;
- SC_HANDLE sch_manager;
-
- /* Normalize root directory path and make it absolute */
- status = apr_filepath_merge(&root_dir, NULL, root_dir_path,
- APR_FILEPATH_NOTRELATIVE | APR_FILEPATH_NATIVE | APR_FILEPATH_TRUENAME, pool);
- if (status != APR_SUCCESS) {
- printf("Error making root directory absolute: %d %.512s\n", status,
- apr_strerror(status, buf, 512));
- return FALSE;
- }
- buf[pos++] = '"';
- pos = apr_cpystrn(buf + pos, root_dir, len - pos) - buf;
- if ((buf[pos - 1] != '\\') && (pos < len))
- /* Add trailing backslash */
- buf[pos++] = '\\';
- pos = apr_cpystrn(buf + pos, "bin\\unimrcpserver.exe\" --service -o 2", len - pos) - buf;
- if (log_priority >= 0) {
- pos = apr_cpystrn(buf + pos, " -l ", len - pos) - buf;
- if (pos < len - 34)
- pos += strlen(itoa(log_priority, buf + pos, 10));
- }
- if (name) {
- pos = apr_cpystrn(buf + pos, " --name \"", len - pos) - buf;
- pos = apr_cpystrn(buf + pos, name, len - pos) - buf;
- if ((buf[pos - 1] == '\\') && (pos < len))
- /* `\"' might be misinterpreted as escape, so replace `\' with `\\' */
- buf[pos++] = '\\';
- if (pos < len)
- buf[pos++] = '"';
- }
- pos = apr_cpystrn(buf + pos, " --root-dir \"", len - pos) - buf;
- pos = apr_cpystrn(buf + pos, root_dir, len - pos) - buf;
- if ((buf[pos - 1] == '\\') && (pos < len))
- /* `\"' might be misinterpreted as escape, so replace `\' with `\\' */
- buf[pos++] = '\\';
- if (pos < len)
- buf[pos++] = '"';
- if (pos < len)
- buf[pos] = 0;
- else {
- puts("Service Command Too Long");
- return FALSE;
- }
- if (!disp_name || !*disp_name) {
- if (name)
- disp_name = apr_pstrcat(pool, name, " ", "UniMRCP Server", NULL);
- else
- disp_name = "UniMRCP Server";
- }
- if (!description || !*description)
- description = "Launches UniMRCP Server";
-
- sch_manager = OpenSCManager(0,0,SC_MANAGER_ALL_ACCESS);
- if(!sch_manager) {
- winerror("Failed to Open SCManager");
- return FALSE;
- }
- sch_service = CreateService(
- sch_manager,
- name ? name : WIN_SERVICE_NAME,
- disp_name,
- GENERIC_EXECUTE | SERVICE_CHANGE_CONFIG,
- SERVICE_WIN32_OWN_PROCESS,
- autostart ? SERVICE_AUTO_START : SERVICE_DEMAND_START,
- SERVICE_ERROR_NORMAL,
- buf,0,0,0,0,0);
- if(!sch_service) {
- winerror("Failed to Create Service");
- CloseServiceHandle(sch_manager);
- return FALSE;
- }
-
- desc.lpDescription = (char *) description;
- if(!ChangeServiceConfig2(sch_service,SERVICE_CONFIG_DESCRIPTION,&desc)) {
- winerror("Failed to Set Service Description");
- }
-
- if (recover) {
- SERVICE_FAILURE_ACTIONS sfa;
- SC_ACTION action;
- sfa.dwResetPeriod = 0;
- sfa.lpCommand = "";
- sfa.lpRebootMsg = "";
- sfa.cActions = 1;
- sfa.lpsaActions = &action;
- action.Delay = recover * 1000;
- action.Type = SC_ACTION_RESTART;
- if (!ChangeServiceConfig2(sch_service,SERVICE_CONFIG_FAILURE_ACTIONS,&sfa)) {
- winerror("Failed to Set Service Restart on Failure");
- }
- }
-
- CloseServiceHandle(sch_service);
- CloseServiceHandle(sch_manager);
- printf("UniMRCP service %s registered\n", name ? name : WIN_SERVICE_NAME);
- return TRUE;
-}
-
-/** Unregister/uninstall service from SCM */
-static apt_bool_t uni_service_unregister(const char *name)
-{
- apt_bool_t status = TRUE;
- SERVICE_STATUS ss_status;
- SC_HANDLE sch_service;
- SC_HANDLE sch_manager = OpenSCManager(0,0,SC_MANAGER_ALL_ACCESS);
- if (!name) name = WIN_SERVICE_NAME;
- if(!sch_manager) {
- winerror("Failed to Open SCManager");
- return FALSE;
- }
-
- sch_service = OpenService(sch_manager,name,DELETE|SERVICE_STOP);
- if(!sch_service) {
- winerror("Failed to Open Service");
- CloseServiceHandle(sch_manager);
- return FALSE;
- }
-
- ControlService(sch_service,SERVICE_CONTROL_STOP,&ss_status);
- if(!DeleteService(sch_service)) {
- winerror("Failed to Delete Service");
- status = FALSE;
- } else
- printf("UniMRCP service %s unregistered\n", name);
- CloseServiceHandle(sch_service);
- CloseServiceHandle(sch_manager);
- return status;
-}
-
-/** Start service */
-static apt_bool_t uni_service_start(const char *name)
-{
- apt_bool_t status = TRUE;
- SC_HANDLE sch_service;
- SC_HANDLE sch_manager = OpenSCManager(0,0,SC_MANAGER_ALL_ACCESS);
- if (!name) name = WIN_SERVICE_NAME;
- if(!sch_manager) {
- winerror("Failed to Open SCManager");
- return FALSE;
- }
-
- sch_service = OpenService(sch_manager,name,SERVICE_START);
- if(!sch_service) {
- winerror("Failed to Open Service");
- CloseServiceHandle(sch_manager);
- return FALSE;
- }
-
- if(!StartService(sch_service,0,NULL)) {
- winerror("Failed to Start Service");
- status = FALSE;
- } else
- printf("UniMRCP service %s started\n", name);
- CloseServiceHandle(sch_service);
- CloseServiceHandle(sch_manager);
- return status;
-}
-
-/** Stop service */
-static apt_bool_t uni_service_stop(const char *name)
-{
- apt_bool_t status = TRUE;
- SERVICE_STATUS ss_status;
- SC_HANDLE sch_service;
- SC_HANDLE sch_manager = OpenSCManager(0,0,SC_MANAGER_ALL_ACCESS);
- if (!name) name = WIN_SERVICE_NAME;
- if(!sch_manager) {
- winerror("Failed to Open SCManager");
- return FALSE;
- }
-
- sch_service = OpenService(sch_manager,name,SERVICE_STOP);
- if(!sch_service) {
- winerror("Failed to Open Service");
- CloseServiceHandle(sch_manager);
- return FALSE;
- }
-
- if(!ControlService(sch_service,SERVICE_CONTROL_STOP,&ss_status)) {
- winerror("Failed to Stop Service");
- status = FALSE;
- } else
- printf("UniMRCP service %s stopped\n", name);
-
- CloseServiceHandle(sch_service);
- CloseServiceHandle(sch_manager);
- return status;
-}
-
-
-static void usage()
-{
- static apt_bool_t written = FALSE;
- if (written) return;
- printf(
- "\n"
- "Usage:\n"
- "\n"
- " unimrcpservice [options]\n"
- "\n"
- " Available options:\n"
- "\n"
- " -r [--register] rootdir : Register the Windows service.\n"
- "\n"
- " -u [--unregister] : Unregister the Windows service.\n"
- "\n"
- " -s [--start] : Start the Windows service.\n"
- "\n"
- " -t [--stop] : Stop the Windows service.\n"
- "\n"
- " -n [--name] svcname : Service name (default: unimrcp)\n"
- "\n"
- " -a [--autostart] : Start service after boot-up\n"
- "\n"
- " -f [--fail-restart] n : If crashed, restart after n secs\n"
- "\n"
- " -l [--log-prio] priority: Set the log priority.\n"
- " (0-emergency, ..., 7-debug)\n"
- " -p [--disp-name] title : Set service display name\n"
- " (default: [svcname] UniMRCP Server)\n"
- " -c [--description] desc : Set service description\n"
- " (default: Launches UniMRCP Server)\n"
- " -h [--help] : Show the help.\n"
- "\n");
- written = TRUE;
-}
-
-int main(int argc, const char * const *argv)
-{
- apr_pool_t *pool;
- apr_status_t rv;
- apr_getopt_t *opt;
- apt_bool_t ret = TRUE;
- uni_service_register_e reg = USR_NONE;
- uni_service_control_e control = USC_NONE;
- const char *root_dir = "..";
- const char *name = NULL;
- apt_bool_t autostart = FALSE;
- unsigned long recover = 0;
- int log_priority = -1;
- const char *disp_name = NULL;
- const char *description = NULL;
-
- static const apr_getopt_option_t opt_option[] = {
- /* long-option, short-option, has-arg flag, description */
- { "register", 'r', TRUE, "register service" }, /* -r or --register arg */
- { "unregister", 'u', FALSE, "unregister service" }, /* -u or --unregister */
- { "start", 's', FALSE, "start service" }, /* -s or --start */
- { "stop", 't', FALSE, "stop service" }, /* -t or --stop */
- { "name", 'n', TRUE, "service name" }, /* -n or --name arg */
- { "autostart", 'a', FALSE, "start automatically" },/* -a or --autostart */
- { "fail-restart",'f', TRUE, "restart if fails" }, /* -f or --fail-restart arg */
- { "log-prio", 'l', TRUE, "log priority" }, /* -l arg or --log-prio arg */
- { "disp-name", 'p', TRUE, "display name" }, /* -p arg or --disp-name arg */
- { "description", 'c', TRUE, "description" }, /* -c arg or --description arg */
- { "help", 'h', FALSE, "show help" }, /* -h or --help */
- { NULL, 0, 0, NULL }, /* end */
- };
-
- /* APR global initialization */
- if(apr_initialize() != APR_SUCCESS) {
- apr_terminate();
- return 1;
- }
-
- /* create APR pool */
- pool = apt_pool_create();
- if(!pool) {
- apr_terminate();
- return 1;
- }
-
- rv = apr_getopt_init(&opt, pool , argc, argv);
- if(rv == APR_SUCCESS) {
- int optch;
- const char *optarg;
- while((rv = apr_getopt_long(opt, opt_option, &optch, &optarg)) == APR_SUCCESS) {
- switch(optch) {
- case 'r':
- if ((reg == USR_NONE) || (reg == USR_REGISTER)) {
- reg = USR_REGISTER;
- root_dir = optarg;
- } else {
- puts("Incosistent arguments");
- ret = FALSE;
- }
- break;
- case 'u':
- if ((reg == USR_NONE) || (reg == USR_UNREGISTER))
- reg = USR_UNREGISTER;
- else {
- puts("Incosistent arguments");
- ret = FALSE;
- }
- break;
- case 's':
- if ((control == USC_NONE) || (control == USC_START))
- control = USC_START;
- else {
- puts("Incosistent arguments");
- ret = FALSE;
- }
- break;
- case 't':
- if ((control == USC_NONE) || (control == USC_STOP))
- control = USC_STOP;
- else {
- puts("Incosistent arguments");
- ret = FALSE;
- }
- break;
- case 'n':
- name = optarg;
- break;
- case 'a':
- autostart = TRUE;
- break;
- case 'f':
- if (sscanf(optarg, "%lu", &recover) != 1) {
- puts("Invalid value for param --fail-restart");
- ret = FALSE;
- }
- break;
- case 'l':
- if ((sscanf(optarg, "%d", &log_priority) != 1) ||
- (log_priority < 0) || (log_priority > 7))
- {
- puts("Invalid value for param --log-prio");
- ret = FALSE;
- }
- break;
- case 'p':
- disp_name = optarg;
- break;
- case 'c':
- description = optarg;
- break;
- case 'h':
- usage();
- break;
- }
- if (!ret) break;
- }
- if (ret &&
- (((reg == USR_REGISTER) && (control == USC_STOP)) ||
- ((reg == USR_UNREGISTER) && (control == USC_START)))) {
- ret = FALSE;
- puts("Inconsistent arguments");
- }
- if((rv != APR_EOF) || !ret || (!reg && !control)) {
- ret = FALSE;
- usage();
- }
- }
-
- while (ret) { /* No problem so far */
- if (reg == USR_REGISTER)
- ret = uni_service_register(root_dir, pool, name, autostart, recover, log_priority, disp_name, description);
- if (!ret) break;
-
- if (control == USC_START)
- ret = uni_service_start(name);
- if (!ret) break;
-
- if (control == USC_STOP)
- ret = uni_service_stop(name);
- /* Do not break here, stop failure should not matter before unregistration */
-
- if (reg == USR_UNREGISTER)
- ret = uni_service_unregister(name);
- break;
- }
-
- /* destroy APR pool */
- apr_pool_destroy(pool);
- /* APR global termination */
- apr_terminate();
- return ret ? 0 : 1;
-}
diff --git a/libs/unimrcp/build/tools/unimrcpservice.exe.manifest b/libs/unimrcp/build/tools/unimrcpservice.exe.manifest
deleted file mode 100644
index 3a14ebfb75..0000000000
--- a/libs/unimrcp/build/tools/unimrcpservice.exe.manifest
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
diff --git a/libs/unimrcp/build/tools/unimrcpservice.rc b/libs/unimrcp/build/tools/unimrcpservice.rc
deleted file mode 100644
index a9cebe94dc..0000000000
--- a/libs/unimrcp/build/tools/unimrcpservice.rc
+++ /dev/null
@@ -1,39 +0,0 @@
-#include "uni_version.h"
-
-1 VERSIONINFO
- FILEVERSION UNI_VERSION_STRING_CSV,0
- PRODUCTVERSION UNI_VERSION_STRING_CSV,0
- FILEFLAGSMASK 0x3fL
-#if defined(_DEBUG)
- FILEFLAGS 0x01L
-#else
- FILEFLAGS 0x00L
-#endif
-#if defined(WINNT) || defined(WIN64)
- FILEOS 0x40004L
-#else
- FILEOS 0x4L
-#endif
- FILETYPE 0x1L
- FILESUBTYPE 0x0L
-BEGIN
- BLOCK "StringFileInfo"
- BEGIN
- BLOCK "040904b0"
- BEGIN
- VALUE "Comments", UNI_LICENSE "\0"
- VALUE "CompanyName", "UniMRCP\0"
- VALUE "FileDescription", "UniMRCP Service Manager\0"
- VALUE "FileVersion", UNI_VERSION_STRING "\0"
- VALUE "InternalName", "unimrcpservice" "\0"
- VALUE "LegalCopyright", UNI_COPYRIGHT "\0"
- VALUE "OriginalFilename", "unimrcpservice.exe" "\0"
- VALUE "ProductName", "UniMRCP Project\0"
- VALUE "ProductVersion", UNI_VERSION_STRING "\0"
- END
- END
- BLOCK "VarFileInfo"
- BEGIN
- VALUE "Translation", 0x409, 1200
- END
-END
diff --git a/libs/unimrcp/build/tools/unimrcpservice.vcproj b/libs/unimrcp/build/tools/unimrcpservice.vcproj
deleted file mode 100644
index fec552b155..0000000000
--- a/libs/unimrcp/build/tools/unimrcpservice.vcproj
+++ /dev/null
@@ -1,326 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/libs/unimrcp/build/tools/unimrcpservice.vcxproj b/libs/unimrcp/build/tools/unimrcpservice.vcxproj
deleted file mode 100644
index 63e1324ba3..0000000000
--- a/libs/unimrcp/build/tools/unimrcpservice.vcxproj
+++ /dev/null
@@ -1,136 +0,0 @@
-
-
-
-
- Debug
- Win32
-
-
- Debug
- x64
-
-
- Release
- Win32
-
-
- Release
- x64
-
-
-
- {4714EF49-BFD5-4B22-95F7-95A07F1EAC25}
- unimrcpservice
-
-
-
- Application
-
-
- Application
-
-
- Application
-
-
- Application
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <_ProjectFileVersion>10.0.30319.1
- AllRules.ruleset
-
-
- AllRules.ruleset
-
-
- AllRules.ruleset
-
-
- AllRules.ruleset
-
-
-
-
-
- aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies)
- RequireAdministrator
-
-
-
-
- aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies)
- UseLinkTimeCodeGeneration
- RequireAdministrator
-
-
-
-
- X64
-
-
- ProgramDatabase
-
-
- aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies)
- RequireAdministrator
-
-
-
-
- X64
-
-
- aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies)
- UseLinkTimeCodeGeneration
- RequireAdministrator
-
-
-
-
-
-
-
- {13deeca0-bdd4-4744-a1a2-8eb0a44df3d2}
- false
-
-
-
-
- ..\..\build;%(AdditionalIncludeDirectories)
- ..\..\build;%(AdditionalIncludeDirectories)
- ..\..\build;%(AdditionalIncludeDirectories)
- ..\..\build;%(AdditionalIncludeDirectories)
-
-
-
-
-
-
\ No newline at end of file
diff --git a/libs/unimrcp/build/tools/unimrcpservice.vcxproj.filters b/libs/unimrcp/build/tools/unimrcpservice.vcxproj.filters
deleted file mode 100644
index 8a04533143..0000000000
--- a/libs/unimrcp/build/tools/unimrcpservice.vcxproj.filters
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-
-
- {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
- cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
-
-
-
-
- src
-
-
-
-
-
-
\ No newline at end of file
diff --git a/libs/unimrcp/build/uni_revision.h b/libs/unimrcp/build/uni_revision.h
deleted file mode 100644
index b7680b88cf..0000000000
--- a/libs/unimrcp/build/uni_revision.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an AS IS BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef UNI_REVISION_H
-#define UNI_REVISION_H
-
-/**
- * @file uni_revision.h
- * @brief UniMRCP Revision
- *
- * This file contains the revision base number and other relevant information.
- */
-
-/** Revision base number. */
-#define UNI_REVISION 2208
-
-/** Revision base string. */
-#define UNI_REVISION_STRING "2208"
-
-/** Revision base date. */
-#define UNI_REVISION_DATE "2014-10-31"
-
-/** Revision base stamp. */
-#define UNI_REVISION_STAMP 20141031L
-
-
-/** Check at compile time if the revision base number is at least a certain level. */
-#define UNI_REVISION_AT_LEAST(rev) ((rev) < UNI_REVISION)
-
-#endif /* UNI_REVISION_H */
diff --git a/libs/unimrcp/build/uni_version.h b/libs/unimrcp/build/uni_version.h
deleted file mode 100644
index 2e0edb9c30..0000000000
--- a/libs/unimrcp/build/uni_version.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: uni_version.h 2139 2014-07-07 05:06:19Z achaloyan@gmail.com $
- */
-
-#ifndef UNI_VERSION_H
-#define UNI_VERSION_H
-
-/**
- * @file uni_version.h
- * @brief UniMRCP Version
- *
- * UniMRCP uses a version numbering scheme derived from the APR project.
- *
- * APR's Version Numbering
- */
-
-/** major version
- * Major API changes that could cause compatibility problems for older
- * programs such as structure size changes. No binary compatibility is
- * possible across a change in the major version.
- */
-#define UNI_MAJOR_VERSION 1
-
-/** minor version
- * Minor API changes that do not cause binary compatibility problems.
- * Reset to 0 when upgrading UNI_MAJOR_VERSION.
- */
-#define UNI_MINOR_VERSION 2
-
-/** patch level
- * The Patch Level never includes API changes, simply bug fixes.
- * Reset to 0 when upgrading UNI_MINOR_VERSION.
- */
-#define UNI_PATCH_VERSION 0
-
-
-/** Check at compile time if the version of UniMRCP is at least a certain level. */
-#define UNI_VERSION_AT_LEAST(major,minor,patch) \
-(((major) < UNI_MAJOR_VERSION) \
- || ((major) == UNI_MAJOR_VERSION && (minor) < UNI_MINOR_VERSION) \
- || ((major) == UNI_MAJOR_VERSION && (minor) == UNI_MINOR_VERSION && (patch) <= UNI_PATCH_VERSION))
-
-/** Properly quote a value as a string in the C preprocessor. */
-#define UNI_STRINGIFY(n) UNI_STRINGIFY_HELPER(n)
-/** Helper macro for UNI_STRINGIFY. */
-#define UNI_STRINGIFY_HELPER(n) #n
-
-/** The formatted string of UniMRCP's version. */
-#define UNI_VERSION_STRING \
- UNI_STRINGIFY(UNI_MAJOR_VERSION) "." \
- UNI_STRINGIFY(UNI_MINOR_VERSION) "." \
- UNI_STRINGIFY(UNI_PATCH_VERSION)
-
-/** An alternative formatted string of UniMRCP's version
- macro for Win32 .rc files using numeric CSV representation. */
-#define UNI_VERSION_STRING_CSV UNI_MAJOR_VERSION ##, \
- ##UNI_MINOR_VERSION ##, \
- ##UNI_PATCH_VERSION
-
-/** The Copyright. */
-#define UNI_COPYRIGHT "Copyright 2008-2014 Arsen Chaloyan"
-
-/*
- * Use the brief description of the license for Win32 .rc files;
- * otherwise, use the full description.
- */
-#if defined(APSTUDIO_INVOKED) || defined(RC_INVOKED)
-/** The License (brief description). */
-#define UNI_LICENSE "The Apache License, Version 2.0"
-#else
-/** The License (full description). */
-#define UNI_LICENSE \
- " * Licensed under the Apache License, Version 2.0 (the ""License"");\n" \
- " * you may not use this file except in compliance with the License.\n" \
- " * You may obtain a copy of the License at\n" \
- " * \n" \
- " * http://www.apache.org/licenses/LICENSE-2.0 \n" \
- " * \n" \
- " * Unless required by applicable law or agreed to in writing, software\n" \
- " * distributed under the License is distributed on an ""AS IS"" BASIS,\n" \
- " * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n" \
- " * See the License for the specific language governing permissions and\n" \
- " * limitations under the License.\n"
-#endif /* APSTUDIO_INVOKED || RC_INVOKED */
-
-#endif /* UNI_VERSION_H */
diff --git a/libs/unimrcp/build/vsprops/apr.vsprops b/libs/unimrcp/build/vsprops/apr.vsprops
deleted file mode 100644
index a37045dcd8..0000000000
--- a/libs/unimrcp/build/vsprops/apr.vsprops
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
-
-
-
-
diff --git a/libs/unimrcp/build/vsprops/apt.vsprops b/libs/unimrcp/build/vsprops/apt.vsprops
deleted file mode 100644
index e5d8b57780..0000000000
--- a/libs/unimrcp/build/vsprops/apt.vsprops
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
diff --git a/libs/unimrcp/build/vsprops/mpf.vsprops b/libs/unimrcp/build/vsprops/mpf.vsprops
deleted file mode 100644
index 6e051d8607..0000000000
--- a/libs/unimrcp/build/vsprops/mpf.vsprops
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
diff --git a/libs/unimrcp/build/vsprops/mrcp.vsprops b/libs/unimrcp/build/vsprops/mrcp.vsprops
deleted file mode 100644
index c51b241a53..0000000000
--- a/libs/unimrcp/build/vsprops/mrcp.vsprops
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
diff --git a/libs/unimrcp/build/vsprops/mrcpclient.vsprops b/libs/unimrcp/build/vsprops/mrcpclient.vsprops
deleted file mode 100644
index 0a866442f2..0000000000
--- a/libs/unimrcp/build/vsprops/mrcpclient.vsprops
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
diff --git a/libs/unimrcp/build/vsprops/mrcpengine.vsprops b/libs/unimrcp/build/vsprops/mrcpengine.vsprops
deleted file mode 100644
index 5108cf30d3..0000000000
--- a/libs/unimrcp/build/vsprops/mrcpengine.vsprops
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
diff --git a/libs/unimrcp/build/vsprops/mrcpserver.vsprops b/libs/unimrcp/build/vsprops/mrcpserver.vsprops
deleted file mode 100644
index 11932f804c..0000000000
--- a/libs/unimrcp/build/vsprops/mrcpserver.vsprops
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
diff --git a/libs/unimrcp/build/vsprops/mrcpsignaling.vsprops b/libs/unimrcp/build/vsprops/mrcpsignaling.vsprops
deleted file mode 100644
index 170a8ea14d..0000000000
--- a/libs/unimrcp/build/vsprops/mrcpsignaling.vsprops
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
diff --git a/libs/unimrcp/build/vsprops/mrcpv2transport.vsprops b/libs/unimrcp/build/vsprops/mrcpv2transport.vsprops
deleted file mode 100644
index 88d046158d..0000000000
--- a/libs/unimrcp/build/vsprops/mrcpv2transport.vsprops
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
diff --git a/libs/unimrcp/build/vsprops/sdk/unimrcpclient.vsprops b/libs/unimrcp/build/vsprops/sdk/unimrcpclient.vsprops
deleted file mode 100644
index 09ca2cd194..0000000000
--- a/libs/unimrcp/build/vsprops/sdk/unimrcpclient.vsprops
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
diff --git a/libs/unimrcp/build/vsprops/sdk/unimrcpplugin.vsprops b/libs/unimrcp/build/vsprops/sdk/unimrcpplugin.vsprops
deleted file mode 100644
index 96fb0cfed1..0000000000
--- a/libs/unimrcp/build/vsprops/sdk/unimrcpplugin.vsprops
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
diff --git a/libs/unimrcp/build/vsprops/sdk/unimrcpsdk.vsprops b/libs/unimrcp/build/vsprops/sdk/unimrcpsdk.vsprops
deleted file mode 100644
index f5cd0d311a..0000000000
--- a/libs/unimrcp/build/vsprops/sdk/unimrcpsdk.vsprops
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
-
-
-
diff --git a/libs/unimrcp/build/vsprops/sdk/unimrcpserver.vsprops b/libs/unimrcp/build/vsprops/sdk/unimrcpserver.vsprops
deleted file mode 100644
index df5df74f97..0000000000
--- a/libs/unimrcp/build/vsprops/sdk/unimrcpserver.vsprops
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
diff --git a/libs/unimrcp/build/vsprops/sofiasip.vsprops b/libs/unimrcp/build/vsprops/sofiasip.vsprops
deleted file mode 100644
index 2b5b65653b..0000000000
--- a/libs/unimrcp/build/vsprops/sofiasip.vsprops
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
-
diff --git a/libs/unimrcp/build/vsprops/unibase.vsprops b/libs/unimrcp/build/vsprops/unibase.vsprops
deleted file mode 100644
index 2d64884ea8..0000000000
--- a/libs/unimrcp/build/vsprops/unibase.vsprops
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
-
-
diff --git a/libs/unimrcp/build/vsprops/unibin-x64.vsprops b/libs/unimrcp/build/vsprops/unibin-x64.vsprops
deleted file mode 100644
index 6348c8dac2..0000000000
--- a/libs/unimrcp/build/vsprops/unibin-x64.vsprops
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-
-
diff --git a/libs/unimrcp/build/vsprops/unibin.vsprops b/libs/unimrcp/build/vsprops/unibin.vsprops
deleted file mode 100644
index 016f9973db..0000000000
--- a/libs/unimrcp/build/vsprops/unibin.vsprops
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
diff --git a/libs/unimrcp/build/vsprops/unidebug.vsprops b/libs/unimrcp/build/vsprops/unidebug.vsprops
deleted file mode 100644
index 0cbede51a2..0000000000
--- a/libs/unimrcp/build/vsprops/unidebug.vsprops
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-
-
-
diff --git a/libs/unimrcp/build/vsprops/unilib-x64.vsprops b/libs/unimrcp/build/vsprops/unilib-x64.vsprops
deleted file mode 100644
index ba029c0699..0000000000
--- a/libs/unimrcp/build/vsprops/unilib-x64.vsprops
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-
-
-
diff --git a/libs/unimrcp/build/vsprops/unilib.vsprops b/libs/unimrcp/build/vsprops/unilib.vsprops
deleted file mode 100644
index 32ea070327..0000000000
--- a/libs/unimrcp/build/vsprops/unilib.vsprops
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
diff --git a/libs/unimrcp/build/vsprops/unimrcpclient.vsprops b/libs/unimrcp/build/vsprops/unimrcpclient.vsprops
deleted file mode 100644
index 8f1edceebd..0000000000
--- a/libs/unimrcp/build/vsprops/unimrcpclient.vsprops
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
-
diff --git a/libs/unimrcp/build/vsprops/unimrcpserver.vsprops b/libs/unimrcp/build/vsprops/unimrcpserver.vsprops
deleted file mode 100644
index 8f812676ea..0000000000
--- a/libs/unimrcp/build/vsprops/unimrcpserver.vsprops
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
-
diff --git a/libs/unimrcp/build/vsprops/uniplugin-x64.vsprops b/libs/unimrcp/build/vsprops/uniplugin-x64.vsprops
deleted file mode 100644
index 44f4057e3f..0000000000
--- a/libs/unimrcp/build/vsprops/uniplugin-x64.vsprops
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
-
-
diff --git a/libs/unimrcp/build/vsprops/uniplugin.vsprops b/libs/unimrcp/build/vsprops/uniplugin.vsprops
deleted file mode 100644
index a794952a06..0000000000
--- a/libs/unimrcp/build/vsprops/uniplugin.vsprops
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
diff --git a/libs/unimrcp/build/vsprops/unirelease.vsprops b/libs/unimrcp/build/vsprops/unirelease.vsprops
deleted file mode 100644
index bb1f511e93..0000000000
--- a/libs/unimrcp/build/vsprops/unirelease.vsprops
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
diff --git a/libs/unimrcp/build/vsprops/unirtsp.vsprops b/libs/unimrcp/build/vsprops/unirtsp.vsprops
deleted file mode 100644
index b46259472a..0000000000
--- a/libs/unimrcp/build/vsprops/unirtsp.vsprops
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
diff --git a/libs/unimrcp/conf/Makefile.am b/libs/unimrcp/conf/Makefile.am
deleted file mode 100644
index ca84a04bca..0000000000
--- a/libs/unimrcp/conf/Makefile.am
+++ /dev/null
@@ -1,31 +0,0 @@
-MAINTAINERCLEANFILES = Makefile.in
-
-CONFFILES = logger.xml dirlayout.xml
-
-if UNIMRCP_CLIENT_LIB
-CONFFILES += unimrcpclient.xml unimrcpclient.xsd
-endif
-
-if UNIMRCP_SERVER_LIB
-CONFFILES += unimrcpserver.xml unimrcpserver.xsd
-endif
-
-if UMC
-CONFFILES += umcscenarios.xml
-endif
-
-def-conf:
- test -d $(DESTDIR)$(sysconfdir) || $(mkinstalldirs) $(DESTDIR)$(sysconfdir)
- for conffile in $(CONFFILES) ; do \
- $(INSTALL) -m 644 $(top_srcdir)/conf/$$conffile $(DESTDIR)$(sysconfdir); \
- done
-if UNIMRCP_CLIENT_LIB
- test -d $(DESTDIR)$(sysconfdir)/client-profiles || $(mkinstalldirs) $(DESTDIR)$(sysconfdir)/client-profiles
- for conffile in `find $(top_srcdir)/conf/client-profiles/ -maxdepth 1 -name \*.xml -o -name \*.xsd` ; do \
- filename=`echo $$conffile | sed -e 's|^.*/||'`; \
- $(INSTALL) -m 644 $(top_srcdir)/conf/client-profiles/$$filename $(DESTDIR)$(sysconfdir)/client-profiles; \
- done
-endif
-
-install-data-local:
- test -d $(DESTDIR)$(sysconfdir) || $(MAKE) def-conf
diff --git a/libs/unimrcp/conf/client-profiles/lumenvox.xml b/libs/unimrcp/conf/client-profiles/lumenvox.xml
deleted file mode 100644
index 4b592a5450..0000000000
--- a/libs/unimrcp/conf/client-profiles/lumenvox.xml
+++ /dev/null
@@ -1,50 +0,0 @@
-
-
-
-
-
-
-
-
- 5060
-
-
-
-
-
-
-
- 554
-
-
-
-
-
-
-
-
-
-
-
- SIP-Agent-1
- MRCPv2-Agent-1
- Media-Engine-1
- RTP-Factory-1
- LumenVox-SIP-Settings
- RTP-Settings-1
-
-
-
-
- RTSP-Agent-1
- Media-Engine-1
- RTP-Factory-1
- LumenVox-RTSP-Settings
- RTP-Settings-1
-
-
-
-
-
diff --git a/libs/unimrcp/conf/client-profiles/nuance.xml b/libs/unimrcp/conf/client-profiles/nuance.xml
deleted file mode 100644
index 8725703ab0..0000000000
--- a/libs/unimrcp/conf/client-profiles/nuance.xml
+++ /dev/null
@@ -1,78 +0,0 @@
-
-
-
-
-
-
-
-
- 5060
-
-
-
-
-
-
-
-
- 4900
-
- media
-
-
-
-
-
-
-
-
-
- 1
- 50
- 600
- 1
-
- 20
- PCMU PCMA L16/96/8000 telephone-event/101/8000
-
-
-
- 2
-
- 5000
-
- 1000
-
-
-
-
-
-
-
-
- SIP-Agent-1
- MRCPv2-Agent-1
- Media-Engine-1
- RTP-Factory-1
- Nuance-SIP-Settings
- Nuance-RTP-Settings
-
-
-
-
- RTSP-Agent-1
- Media-Engine-1
- RTP-Factory-1
- Nuance-RTSP-Settings
- Nuance-RTP-Settings
-
-
-
-
-
diff --git a/libs/unimrcp/conf/client-profiles/speechpro.xml b/libs/unimrcp/conf/client-profiles/speechpro.xml
deleted file mode 100644
index 9f765bef61..0000000000
--- a/libs/unimrcp/conf/client-profiles/speechpro.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
-
-
-
-
-
-
- 8000
-
-
-
-
-
-
-
-
-
-
-
-
- RTSP-Agent-1
- Media-Engine-1
- RTP-Factory-1
- SpeechPro-RTSP-Settings
- RTP-Settings-1
-
-
-
-
-
diff --git a/libs/unimrcp/conf/client-profiles/unimrcp.xml b/libs/unimrcp/conf/client-profiles/unimrcp.xml
deleted file mode 100644
index e29d8784fd..0000000000
--- a/libs/unimrcp/conf/client-profiles/unimrcp.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-
-
-
-
-
-
-
-
- 8060
-
-
-
-
-
-
-
- 1554
-
- media
-
-
-
-
-
-
-
-
-
-
- SIP-Agent-1
- MRCPv2-Agent-1
- Media-Engine-1
- RTP-Factory-1
- UniMRCP-SIP-Settings
- RTP-Settings-1
-
-
-
-
- RTSP-Agent-1
- Media-Engine-1
- RTP-Factory-1
- UniMRCP-RTSP-Settings
- RTP-Settings-1
-
-
-
-
-
diff --git a/libs/unimrcp/conf/dirlayout.xml b/libs/unimrcp/conf/dirlayout.xml
deleted file mode 100644
index 45df55ba7e..0000000000
--- a/libs/unimrcp/conf/dirlayout.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-
-
- conf
- plugin
- log
- data
- var
-
diff --git a/libs/unimrcp/conf/logger.xml b/libs/unimrcp/conf/logger.xml
deleted file mode 100644
index 73ae9b5cac..0000000000
--- a/libs/unimrcp/conf/logger.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-
-
-
-
- INFO
-
-
-
-
-
- DATE,TIME,PRIORITY
-
-
- NONE
-
diff --git a/libs/unimrcp/conf/umcscenarios.xml b/libs/unimrcp/conf/umcscenarios.xml
deleted file mode 100644
index d5c713e201..0000000000
--- a/libs/unimrcp/conf/umcscenarios.xml
+++ /dev/null
@@ -1,117 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -->
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/libs/unimrcp/conf/unimrcpclient.xml b/libs/unimrcp/conf/unimrcpclient.xml
deleted file mode 100644
index cc23b9bc03..0000000000
--- a/libs/unimrcp/conf/unimrcpclient.xml
+++ /dev/null
@@ -1,111 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 8062
- udp
- UniMRCP SofiaSIP
- UniMRCPClient
-
-
-
-
-
-
-
-
-
-
- 100
-
- UniMRCPClient
-
-
-
-
- 100
- false
- 1024
- 1024
-
-
-
-
-
- 1
-
-
-
-
-
-
-
- 4000
- 5000
-
-
-
-
-
-
-
- 1
- 50
- 600
- 1
-
- 20
- PCMU PCMA L16/96/8000 telephone-event/101/8000
-
-
-
-
- 1
-
- 5000
-
- 1000
-
-
-
-
diff --git a/libs/unimrcp/conf/unimrcpclient.xsd b/libs/unimrcp/conf/unimrcpclient.xsd
deleted file mode 100644
index b8e53bbf1f..0000000000
--- a/libs/unimrcp/conf/unimrcpclient.xsd
+++ /dev/null
@@ -1,277 +0,0 @@
-
-
-
-
- UniMRCP client document
-
-
-
-
-
- Generic properties
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Common components
-
-
-
-
-
- Factory of MRCP resources
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SIP signaling agent
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- RTSP signaling agent
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- MRCPv2 connection agent
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Media processing engine
-
-
-
-
-
-
-
-
-
-
-
- Factory of RTP terminations
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Settings
-
-
-
-
-
- SIP settings
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- RTSP settings
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- RTP settings
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Profiles
-
-
-
-
-
- MRCPv2 profile
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- MRCPv1 profile
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/libs/unimrcp/conf/unimrcpserver.xml b/libs/unimrcp/conf/unimrcpserver.xml
deleted file mode 100644
index b431acf313..0000000000
--- a/libs/unimrcp/conf/unimrcpserver.xml
+++ /dev/null
@@ -1,166 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 8060
- udp,tcp
-
- UniMRCP SofiaSIP
- UniMRCPServer
-
-
-
-
-
-
-
-
-
-
-
-
-
- 1554
-
-
-
-
-
- 100
- UniMRCPServer
-
-
-
-
-
-
- 1544
- 100
- false
- 1024
- 1024
-
-
-
-
- 1
-
-
-
-
-
-
-
- 5000
- 6000
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 1
- 50
- 600
- 1
-
- 20
- PCMU PCMA L16/96/8000 telephone-event/101/8000
-
-
-
-
- 1
-
- 5000
-
- 1000
-
-
-
-
-
-
-
-
- SIP-Agent-1
- MRCPv2-Agent-1
- Media-Engine-1
- RTP-Factory-1
- RTP-Settings-1
-
-
-
-
-
-
- RTSP-Agent-1
- Media-Engine-1
- RTP-Factory-1
- RTP-Settings-1
-
-
-
-
-
diff --git a/libs/unimrcp/conf/unimrcpserver.xsd b/libs/unimrcp/conf/unimrcpserver.xsd
deleted file mode 100644
index f8222c84d5..0000000000
--- a/libs/unimrcp/conf/unimrcpserver.xsd
+++ /dev/null
@@ -1,277 +0,0 @@
-
-
-
-
- UniMRCP server document
-
-
-
-
-
- Generic properties
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Common components
-
-
-
-
-
- Factory of MRCP resources
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SIP signaling agent
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- RTSP signaling agent
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- MRCPv2 connection agent
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Media processing engine
-
-
-
-
-
-
-
-
-
-
-
- Factory of RTP terminations
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Factory of plugins (MRCP engines)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Settings
-
-
-
-
-
- RTP settings
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Profiles
-
-
-
-
-
- MRCPv2 profile
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- MRCPv1 profile
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/libs/unimrcp/config.layout b/libs/unimrcp/config.layout
deleted file mode 100644
index 1d3472c1e9..0000000000
--- a/libs/unimrcp/config.layout
+++ /dev/null
@@ -1,26 +0,0 @@
-##
-## config.layout -- Pre-defined Installation Path Layouts
-##
-## Hints:
-## - layouts can be loaded with configure's --enable-layout=ID option
-## - when no --enable-layout option is given, the default layout is `classic'
-
-# Classical UniMRCP path layout.
-
- prefix: /usr/local/unimrcp
- exec_prefix: ${prefix}
- bindir: ${exec_prefix}/bin
- sbindir: ${exec_prefix}/bin
- libdir: ${exec_prefix}/lib
- libexecdir: ${exec_prefix}/modules
- mandir: ${prefix}/man
- sysconfdir: ${prefix}/conf
- confdir: ${prefix}/conf
- datadir: ${prefix}/data
- plugindir: ${exec_prefix}/plugin
- logdir: ${exec_prefix}/log
- vardir: ${exec_prefix}/var
- installbuilddir: ${exec_prefix}/build
- includedir: ${prefix}/include
- localstatedir: ${prefix}
-
diff --git a/libs/unimrcp/configure.ac b/libs/unimrcp/configure.ac
deleted file mode 100644
index 851f56d71b..0000000000
--- a/libs/unimrcp/configure.ac
+++ /dev/null
@@ -1,285 +0,0 @@
-dnl
-dnl Autoconf configuration file for UniMRCP.
-dnl
-dnl Use ./bootstrap to produce a configure script.
-dnl
-
-AC_PREREQ(2.59)
-
-AC_INIT([unimrcp],[1.2.0])
-
-AC_CONFIG_AUX_DIR([build])
-AC_CONFIG_MACRO_DIR([build/acmacros])
-
-dnl Set ac_macro_dir variable manually for autoconf 2.61 and above.
-ac_macro_dir="build/acmacros"
-
-AC_SUBST(ac_aux_dir)
-AC_SUBST(ac_macro_dir)
-
-dnl Include m4 macros for libtool 2.
-sinclude(build/acmacros/libtool.m4)
-sinclude(build/acmacros/ltoptions.m4)
-sinclude(build/acmacros/ltsugar.m4)
-sinclude(build/acmacros/ltversion.m4)
-sinclude(build/acmacros/lt~obsolete.m4)
-
-AC_PREFIX_DEFAULT(/usr/local/unimrcp)
-
-dnl Define the directory layout.
-APR_ENABLE_LAYOUT(classic, [plugindir logdir vardir])
-AC_SUBST(plugindir)
-AC_SUBST(logdir)
-AC_SUBST(vardir)
-
-dnl Reparse the configure arguments.
-APR_PARSE_ARGUMENTS
-
-dnl Generate ./config.nice to reuse ./configure command-line.
-APR_CONFIG_NICE(config.nice)
-
-AM_INIT_AUTOMAKE([no-define nostdinc foreign subdir-objects])
-
-dnl Enable silent build rules available since automake 1.11.
-m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
-
-dnl Set default language.
-AC_LANG_C
-
-AC_PROG_CC
-AC_PROG_CXX
-AM_PROG_CC_C_O
-AC_PROG_INSTALL
-
-dnl Skip detection of Fortran.
-m4_undefine([AC_PROG_F77])
-m4_defun([AC_PROG_F77],[])
-AC_PROG_LIBTOOL
-
-dnl Do not use autoconf generated compiler DEFS.
-rm confdefs.h
-touch confdefs.h
-
-dnl Check for C compiler vendor.
-AX_COMPILER_VENDOR
-
-dnl Search for pkg-config.
-AC_PATH_PROG(PKG_CONFIG, pkg-config)
-
-dnl Get version information.
-get_version="$srcdir/build/get-version.sh"
-version_hdr="$srcdir/build/uni_version.h"
-plugin_version_hdr="$srcdir/libs/mrcp-engine/include/mrcp_engine_plugin.h"
-UNI_DOTTED_VERSION="`$get_version all $version_hdr UNI`"
-UNI_LT_VERSION="-version-info `$get_version libtool $version_hdr UNI`"
-PLUGIN_LT_VERSION="-version-info `$get_version libtool $plugin_version_hdr PLUGIN`"
-
-AC_SUBST(UNI_DOTTED_VERSION)
-AC_SUBST(UNI_LT_VERSION)
-AC_SUBST(PLUGIN_LT_VERSION)
-
-echo "UniMRCP Version: ${UNI_DOTTED_VERSION}"
-
-dnl Check for the APR and APR-util libraries.
-UNIMRCP_CHECK_APR
-dnl Check for the Sofia-SIP library.
-UNIMRCP_CHECK_SOFIA
-
-dnl Enable inter-library dependencies.
-AC_ARG_ENABLE(interlib-deps,
- [AC_HELP_STRING([--disable-interlib-deps ],[disable inter-library dependencies (might break builds)])],
- [enable_interlib_deps="$enableval"],
- [enable_interlib_deps="yes"])
-
-AC_MSG_NOTICE([enable inter-library dependencies: $enable_interlib_deps])
-if test "${enable_interlib_deps}" = "yes"; then
- link_all_deplibs=yes
- link_all_deplibs_CXX=yes
-else
- link_all_deplibs=no
- link_all_deplibs_CXX=no
-fi
-
-dnl Enable maintainer mode.
-AC_ARG_ENABLE(maintainer-mode,
- [AC_HELP_STRING([--enable-maintainer-mode ],[turn on debugging and compile time warnings])],
- [enable_maintainer_mode="$enableval"],
- [enable_maintainer_mode="no"])
-
-AC_MSG_NOTICE([enable maintainer mode: $enable_maintainer_mode])
-if test "${enable_maintainer_mode}" != "no"; then
- APR_ADDTO(CFLAGS,-g)
- if test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then
- APR_ADDTO(CFLAGS,-Wall -Werror)
- fi
-fi
-
-dnl UniMRCP client library.
-AC_ARG_ENABLE(client-lib,
- [AC_HELP_STRING([--disable-client-lib ],[exclude unimrcpclient lib from build])],
- [enable_client_lib="$enableval"],
- [enable_client_lib="yes"])
-
-AM_CONDITIONAL([UNIMRCP_CLIENT_LIB],[test "${enable_client_lib}" = "yes"])
-
-dnl Sample UniMRCP client application in C.
-AC_ARG_ENABLE(client-app,
- [AC_HELP_STRING([--disable-client-app ],[exclude sample unimrcpclient app from build])],
- [enable_client_app="$enableval"],
- [enable_client_app="yes"])
-
-AM_CONDITIONAL([UNIMRCP_CLIENT_APP],[test "${enable_client_lib}" = "yes" && test "${enable_client_app}" = "yes"])
-
-dnl Sample UniMRCP client application in C++.
-AC_ARG_ENABLE(umc,
- [AC_HELP_STRING([--disable-umc ],[exclude sample unimrcpclient C++ app from build])],
- [enable_umc="$enableval"],
- [enable_umc="yes"])
-
-AM_CONDITIONAL([UMC],[test "${enable_client_lib}" = "yes" && test "${enable_umc}" = "yes"])
-
-dnl Miscellaneous ASR client library and application.
-AC_ARG_ENABLE(asr-client,
- [AC_HELP_STRING([--disable-asr-client ],[exclude misc ASR client lib and app from build])],
- [enable_asr_client="$enableval"],
- [enable_asr_client="yes"])
-
-AM_CONDITIONAL([ASR_CLIENT],[test "${enable_client_lib}" = "yes" && test "${enable_asr_client}" = "yes"])
-
-AM_CONDITIONAL([COMMON_CLIENT_DATA],[test "${enable_client_app}" = "yes" || test "${enable_umc}" = "yes" ||test "${enable_asr_client}" = "yes"])
-
-dnl UniMRCP server library.
-AC_ARG_ENABLE(server-lib,
- [AC_HELP_STRING([--disable-server-lib ],[exclude unimrcpserver lib from build])],
- [enable_server_lib="$enableval"],
- [enable_server_lib="yes"])
-
-AM_CONDITIONAL([UNIMRCP_SERVER_LIB],[test "${enable_server_lib}" = "yes"])
-
-dnl UniMRCP server application.
-AC_ARG_ENABLE(server-app,
- [AC_HELP_STRING([--disable-server-app ],[exclude unimrcpserver app from build])],
- [enable_server_app="$enableval"],
- [enable_server_app="yes"])
-
-AM_CONDITIONAL([UNIMRCP_SERVER_APP],[test "${enable_server_lib}" = "yes" && test "${enable_server_app}" = "yes"])
-
-dnl Demo synthesizer plugin.
-UNI_PLUGIN_ENABLED(demosynth)
-
-AM_CONDITIONAL([DEMOSYNTH_PLUGIN],[test "${enable_demosynth_plugin}" = "yes"])
-
-dnl Demo recognizer plugin.
-UNI_PLUGIN_ENABLED(demorecog)
-
-AM_CONDITIONAL([DEMORECOG_PLUGIN],[test "${enable_demorecog_plugin}" = "yes"])
-
-dnl Demo verifier plugin.
-UNI_PLUGIN_ENABLED(demoverifier)
-
-AM_CONDITIONAL([DEMOVERIFIER_PLUGIN],[test "${enable_demoverifier_plugin}" = "yes"])
-
-dnl Recorder plugin.
-UNI_PLUGIN_ENABLED(recorder)
-
-AM_CONDITIONAL([RECORDER_PLUGIN],[test "${enable_recorder_plugin}" = "yes"])
-
-dnl Enable test suites.
-AC_ARG_ENABLE(test-suites,
- [AC_HELP_STRING([--enable-test-suites ],[build test suites])],
- [enable_test_suites="$enableval"],
- [enable_test_suites="no"])
-
-# Enable clang address sanitizer bit build
-AC_ARG_ENABLE(address_sanitizer,
- [AC_HELP_STRING([--enable-address-sanitizer],[build with address sanitizer])],
- [enable_address_sanitizer="$enable_address_sanitizer"],
- [enable_address_sanitizer="no"])
-
-if test "${enable_address_sanitizer}" = "yes"; then
- APR_ADDTO(CFLAGS, -fsanitize=address -fno-omit-frame-pointer)
- APR_ADDTO(CXXFLAGS, -fsanitize=address -fno-omit-frame-pointer)
- APR_ADDTO(LDFLAGS, -fsanitize=address)
-fi
-
-AM_CONDITIONAL([TEST_SUITES],[test "${enable_test_suites}" != "no"])
-
-AM_CONDITIONAL(ISMAC, [test `uname -s` = Darwin])
-
-AC_CONFIG_FILES([
- Makefile
- libs/Makefile
- libs/apr-toolkit/Makefile
- libs/mpf/Makefile
- libs/mrcp/Makefile
- libs/mrcp-signaling/Makefile
- libs/mrcpv2-transport/Makefile
- libs/mrcp-engine/Makefile
- libs/mrcp-server/Makefile
- libs/mrcp-client/Makefile
- libs/uni-rtsp/Makefile
- modules/Makefile
- modules/mrcp-sofiasip/Makefile
- modules/mrcp-unirtsp/Makefile
- plugins/Makefile
- plugins/mrcp-recorder/Makefile
- plugins/demo-synth/Makefile
- plugins/demo-recog/Makefile
- plugins/demo-verifier/Makefile
- platforms/Makefile
- platforms/libunimrcp-server/Makefile
- platforms/libunimrcp-client/Makefile
- platforms/unimrcp-server/Makefile
- platforms/unimrcp-client/Makefile
- platforms/libasr-client/Makefile
- platforms/asr-client/Makefile
- platforms/umc/Makefile
- tests/Makefile
- tests/apttest/Makefile
- tests/mpftest/Makefile
- tests/mrcptest/Makefile
- tests/rtsptest/Makefile
- tests/strtablegen/Makefile
- build/Makefile
- build/pkgconfig/Makefile
- build/pkgconfig/unimrcpclient.pc
- build/pkgconfig/unimrcpserver.pc
- build/pkgconfig/unimrcpplugin.pc
- conf/Makefile
- data/Makefile
- docs/doxygen.conf
-])
-
-AC_OUTPUT
-
-echo
-echo '****************************** REPORT ******************************'
-echo
-echo UniMRCP version............... : $UNI_DOTTED_VERSION
-echo
-echo APR version................... : $apr_version
-echo APR-util version.............. : $apu_version
-echo Sofia-SIP version............. : $sofia_version
-echo
-echo Compiler...................... : $CC
-echo Compiler flags................ : $CFLAGS
-echo Preprocessor definitions...... : $CPPFLAGS
-echo Linker flags.................. : $LDFLAGS
-echo
-echo UniMRCP client lib............ : $enable_client_lib
-echo Sample UniMRCP client app..... : $enable_client_app
-echo Sample UMC C++ client app..... : $enable_umc
-echo Misc ASR client lib and app... : $enable_asr_client
-echo
-echo UniMRCP server lib............ : $enable_server_lib
-echo UniMRCP server app............ : $enable_server_app
-echo
-echo Demo synthesizer plugin....... : $enable_demosynth_plugin
-echo Demo recognizer plugin........ : $enable_demorecog_plugin
-echo Demo verifier plugin.......... : $enable_demoverifier_plugin
-echo Recorder plugin............... : $enable_recorder_plugin
-echo
-echo Installation layout........... : $layout_name
-echo Installation directory........ : $prefix
-echo
-echo '********************************************************************'
diff --git a/libs/unimrcp/configure.gnu b/libs/unimrcp/configure.gnu
deleted file mode 100755
index eaca53b7f7..0000000000
--- a/libs/unimrcp/configure.gnu
+++ /dev/null
@@ -1,3 +0,0 @@
-#! /bin/sh
-srcpath=$(dirname $0 2>/dev/null ) || srcpath="."
-$srcpath/configure "$@" --with-apr=../apr --disable-shared --with-pic --with-apr-util=../apr-util --with-sofia-sip=/usr
diff --git a/libs/unimrcp/data/Makefile.am b/libs/unimrcp/data/Makefile.am
deleted file mode 100644
index 60b540646b..0000000000
--- a/libs/unimrcp/data/Makefile.am
+++ /dev/null
@@ -1,31 +0,0 @@
-MAINTAINERCLEANFILES = Makefile.in
-
-DATAFILES =
-
-if COMMON_CLIENT_DATA
-DATAFILES += grammar.jsgf grammar.mixed grammar.srgs grammar.xml \
- speak.txt speak.xml \
- one-16kHz.pcm one-8kHz.pcm \
- johnsmith-16kHz.pcm johnsmith-8kHz.pcm
-endif
-
-if DEMOSYNTH_PLUGIN
-DATAFILES += demo-16kHz.pcm demo-8kHz.pcm
-endif
-
-if DEMORECOG_PLUGIN
-DATAFILES += result.xml
-endif
-
-if DEMOVERIFIER_PLUGIN
-DATAFILES += result-verification.xml
-endif
-
-def-data:
- test -d $(DESTDIR)$(datadir) || $(mkinstalldirs) $(DESTDIR)$(datadir)
- for datafile in $(DATAFILES) ; do \
- $(INSTALL) -m 644 $(top_srcdir)/data/$$datafile $(DESTDIR)$(datadir); \
- done
-
-install-data-local:
- test -d $(DESTDIR)$(datadir) || $(MAKE) def-data
diff --git a/libs/unimrcp/data/demo-16kHz.pcm b/libs/unimrcp/data/demo-16kHz.pcm
deleted file mode 100644
index 5341461c25..0000000000
Binary files a/libs/unimrcp/data/demo-16kHz.pcm and /dev/null differ
diff --git a/libs/unimrcp/data/demo-8kHz.pcm b/libs/unimrcp/data/demo-8kHz.pcm
deleted file mode 100644
index 5121fdc483..0000000000
Binary files a/libs/unimrcp/data/demo-8kHz.pcm and /dev/null differ
diff --git a/libs/unimrcp/data/grammar.jsgf b/libs/unimrcp/data/grammar.jsgf
deleted file mode 100644
index 9257ecdca2..0000000000
--- a/libs/unimrcp/data/grammar.jsgf
+++ /dev/null
@@ -1,3 +0,0 @@
-#JSGF V1.0;
-grammar digits;
-public = (one | two | three);
diff --git a/libs/unimrcp/data/grammar.mixed b/libs/unimrcp/data/grammar.mixed
deleted file mode 100644
index dabe3a1c88..0000000000
--- a/libs/unimrcp/data/grammar.mixed
+++ /dev/null
@@ -1,19 +0,0 @@
-
---break
-Content-Type:text/uri-list
-Content-Length: 22
-
-builtin:grammar/digits
-
---break
-Content-Type:application/srgs+xml
-Content-Length: 230
-
-
-
-
- one two three four five
-
-
---break--
\ No newline at end of file
diff --git a/libs/unimrcp/data/grammar.srgs b/libs/unimrcp/data/grammar.srgs
deleted file mode 100644
index 6457d725d3..0000000000
--- a/libs/unimrcp/data/grammar.srgs
+++ /dev/null
@@ -1,4 +0,0 @@
-#ABNF 1.0;
-language en-US;
-mode voice;
-public $digit = one | two | three;
\ No newline at end of file
diff --git a/libs/unimrcp/data/grammar.xml b/libs/unimrcp/data/grammar.xml
deleted file mode 100644
index a6dbf88fa3..0000000000
--- a/libs/unimrcp/data/grammar.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
- one
- two
- three
-
-
-
\ No newline at end of file
diff --git a/libs/unimrcp/data/johnsmith-16kHz.pcm b/libs/unimrcp/data/johnsmith-16kHz.pcm
deleted file mode 100644
index 235338077d..0000000000
Binary files a/libs/unimrcp/data/johnsmith-16kHz.pcm and /dev/null differ
diff --git a/libs/unimrcp/data/johnsmith-8kHz.pcm b/libs/unimrcp/data/johnsmith-8kHz.pcm
deleted file mode 100644
index 8332f40732..0000000000
Binary files a/libs/unimrcp/data/johnsmith-8kHz.pcm and /dev/null differ
diff --git a/libs/unimrcp/data/one-16kHz.pcm b/libs/unimrcp/data/one-16kHz.pcm
deleted file mode 100644
index 44e0b3431a..0000000000
Binary files a/libs/unimrcp/data/one-16kHz.pcm and /dev/null differ
diff --git a/libs/unimrcp/data/one-8kHz.pcm b/libs/unimrcp/data/one-8kHz.pcm
deleted file mode 100644
index 92c1e92cf0..0000000000
Binary files a/libs/unimrcp/data/one-8kHz.pcm and /dev/null differ
diff --git a/libs/unimrcp/data/result-verification.xml b/libs/unimrcp/data/result-verification.xml
deleted file mode 100644
index 8ab8a32fb6..0000000000
--- a/libs/unimrcp/data/result-verification.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
-
-
- 500
- cellular-phone
- male
- accepted
- 0.85
-
-
- 1500
- cellular-phone
- male
- accepted
- 0.75
-
-
-
-
\ No newline at end of file
diff --git a/libs/unimrcp/data/result.xml b/libs/unimrcp/data/result.xml
deleted file mode 100644
index 74a1171e3c..0000000000
--- a/libs/unimrcp/data/result.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
- one
- one
-
-
\ No newline at end of file
diff --git a/libs/unimrcp/data/speak.txt b/libs/unimrcp/data/speak.txt
deleted file mode 100644
index 894d43a75f..0000000000
--- a/libs/unimrcp/data/speak.txt
+++ /dev/null
@@ -1 +0,0 @@
-Welcome to Uni MRCP.
\ No newline at end of file
diff --git a/libs/unimrcp/data/speak.xml b/libs/unimrcp/data/speak.xml
deleted file mode 100644
index 2a49ff048c..0000000000
--- a/libs/unimrcp/data/speak.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
- Welcome to Uni MRCP.
-
-
\ No newline at end of file
diff --git a/libs/unimrcp/docs/doxygen.conf.in b/libs/unimrcp/docs/doxygen.conf.in
deleted file mode 100644
index b405be48f0..0000000000
--- a/libs/unimrcp/docs/doxygen.conf.in
+++ /dev/null
@@ -1,34 +0,0 @@
-PROJECT_NAME="UniMRCP"
-PROJECT_NUMBER = @VERSION@
-
-INPUT=. docs/mainpage.docs
-QUIET=YES
-RECURSIVE=YES
-FILE_PATTERNS=*.h
-
-OUTPUT_DIRECTORY=docs/dox
-
-MACRO_EXPANSION=YES
-EXPAND_ONLY_PREDEF=YES
-
-PREDEFINED="APT_DECLARE(x)=x" \
- "MPF_DECLARE(x)=x" \
- "MRCP_DECLARE(x)=x" \
- "RTSP_DECLARE(x)=x"
-
-OPTIMIZE_OUTPUT_FOR_C=YES
-STRIP_CODE_COMMENTS=NO
-
-FULL_PATH_NAMES=NO
-CASE_SENSE_NAMES=NO
-
-EXCLUDE=platforms/umc platforms/libasr-client platforms/asr-client
-EXCLUDE_PATTERNS="*/acconfig.h" \
- "*/test/*" \
- "*/arch/*"
-
-GENERATE_HTML=YES
-GENERATE_LATEX=NO
-GENERATE_RTF=NO
-GENERATE_MAN=NO
-GENERATE_XML=NO
diff --git a/libs/unimrcp/docs/mainpage.docs b/libs/unimrcp/docs/mainpage.docs
deleted file mode 100644
index 7081702f57..0000000000
--- a/libs/unimrcp/docs/mainpage.docs
+++ /dev/null
@@ -1,71 +0,0 @@
-/**
-@mainpage UniMRCP API Reference
-
-
-@section Introduction
-
-UniMRCP is an open source project compliant with the IETF RFC6787 (MRCPv2) and RFC4463 (MRCPv1) specifications.
-The project encapsulates SIP, RTSP, SDP, MRCPv2, and RTP/RTCP stacks and provides integrators with a protocol version consistent interface.
-
-- Compliance: MRCPv1, MRCPv2 (client and server)
-- Resources: Synthesizer (TTS), Recognizer (ASR), Verifier (SVI), Recorder
-- License: Apache 2.0
-- OS: Cross-platform (Windows, Linux, ...)
-- Language: C, C++
-
-
-@section _ Source Tree Structure
-
-
-@subsection Libraries
-
-- apr-toolkit - Set of utilities built on top of the APR and APR-util libraries (task abstraction, logging, etc).
-- mpf - Media processing framework.
-- mrcp - Implementation of MRCP basics (message, parser, resources).
-- mrcpv2-transport - Implementation of the MRCPv2 transport layer.
-- mrcp-signaling - Abstract MRCP signaling (session management) interface.
-- mrcp-engine - Abstract resource engine interface.
-- mrcp-client - Implementation of an MRCP client stack based on the abstract signaling interface.
-- mrcp-server - Implementation of an MRCP server stack based on the abstract signaling and engine interfaces.
-- uni-rtsp - Implementation of a minimal RTSP stack required for MRCPv1.
-
-
-@subsection Modules
-
-- mrcp-sofiasip - Implementation of the abstract signaling interface using the SofiaSIP library.
-- mrcp-unirtsp - Implementation of the abstract signaling interface using the UniRTSP library.
-
-
-@subsection Plugins
-
-- demo-synth - Implementation of a TTS plugin which simulates synthesis.
-- demo-recog - Implementation of an ASR plugin which simulates recognition.
-- demo-verif - Implementation of an SVI plugin which simulates speaker verification.
-- mrcp-recorder - Implementation of a recorder plugin.
-
-
-@subsection Platforms
-
-- libunimrcpclient - The UniMRCP client stack built on top of the underlying mrcp-client library using the mrcp-sofiasip and mrcp-unirtsp modules.
-- libunimrcpserver - The UniMRCP server stack based on top of the underlying mrcp-server library using the mrcp-sofiasip and mrcp-unirtsp modules.
-- unimrcpclient - Sample C application based on the UniMRCP client stack.
-- umc - Sample C++ application based on the UniMRCP client stack.
-- unimrcpserver - The UniMRCP server application.
-
-
-@section Dependencies
-
-- APR - Apache Portable Runtime Library
-- Sofia-SIP - SIP User Agent Library
-
-
-@section Project Links
-
-- Website
-- Downloads
-- Documentation
-- Issue Tracker
-- Discussion Group
-
-
-*/
diff --git a/libs/unimrcp/libs/Makefile.am b/libs/unimrcp/libs/Makefile.am
deleted file mode 100644
index ce33be3016..0000000000
--- a/libs/unimrcp/libs/Makefile.am
+++ /dev/null
@@ -1,3 +0,0 @@
-MAINTAINERCLEANFILES = Makefile.in
-
-SUBDIRS = apr-toolkit mpf mrcp mrcp-signaling mrcpv2-transport mrcp-engine mrcp-server mrcp-client uni-rtsp
diff --git a/libs/unimrcp/libs/apr-toolkit/Makefile.am b/libs/unimrcp/libs/apr-toolkit/Makefile.am
deleted file mode 100644
index aed07a7fb2..0000000000
--- a/libs/unimrcp/libs/apr-toolkit/Makefile.am
+++ /dev/null
@@ -1,50 +0,0 @@
-MAINTAINERCLEANFILES = Makefile.in
-
-AM_CPPFLAGS = -I$(top_srcdir)/libs/apr-toolkit/include \
- $(UNIMRCP_APR_INCLUDES)
-
-noinst_LTLIBRARIES = libaprtoolkit.la
-
-include_HEADERS = include/apt.h \
- include/apt_obj_list.h \
- include/apt_cyclic_queue.h \
- include/apt_dir_layout.h \
- include/apt_task.h \
- include/apt_task_msg.h \
- include/apt_consumer_task.h \
- include/apt_pollset.h \
- include/apt_poller_task.h \
- include/apt_pool.h \
- include/apt_log.h \
- include/apt_pair.h \
- include/apt_string.h \
- include/apt_string_table.h \
- include/apt_header_field.h \
- include/apt_text_stream.h \
- include/apt_text_message.h \
- include/apt_net.h \
- include/apt_nlsml_doc.h \
- include/apt_multipart_content.h \
- include/apt_timer_queue.h \
- include/apt_test_suite.h
-
-libaprtoolkit_la_SOURCES = src/apt_obj_list.c \
- src/apt_cyclic_queue.c \
- src/apt_dir_layout.c \
- src/apt_task.c \
- src/apt_task_msg.c \
- src/apt_consumer_task.c \
- src/apt_pollset.c \
- src/apt_poller_task.c \
- src/apt_pool.c \
- src/apt_log.c \
- src/apt_pair.c \
- src/apt_string_table.c \
- src/apt_header_field.c \
- src/apt_text_stream.c \
- src/apt_text_message.c \
- src/apt_net.c \
- src/apt_nlsml_doc.c \
- src/apt_multipart_content.c \
- src/apt_timer_queue.c \
- src/apt_test_suite.c
diff --git a/libs/unimrcp/libs/apr-toolkit/aprtoolkit.2017.vcxproj b/libs/unimrcp/libs/apr-toolkit/aprtoolkit.2017.vcxproj
deleted file mode 100644
index 804f4ee41e..0000000000
--- a/libs/unimrcp/libs/apr-toolkit/aprtoolkit.2017.vcxproj
+++ /dev/null
@@ -1,167 +0,0 @@
-
-
-
-
- Debug
- Win32
-
-
- Debug
- x64
-
-
- Release
- Win32
-
-
- Release
- x64
-
-
-
- aprtoolkit
- {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}
- aprtoolkit
- Win32Proj
-
-
-
- StaticLibrary
- Unicode
- true
- $(DefaultPlatformToolset)
-
-
- StaticLibrary
- Unicode
- $(DefaultPlatformToolset)
-
-
- StaticLibrary
- Unicode
- true
- $(DefaultPlatformToolset)
-
-
- StaticLibrary
- Unicode
- $(DefaultPlatformToolset)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <_ProjectFileVersion>10.0.30319.1
- $(PlatformName)\$(Configuration)\
- $(PlatformName)\$(Configuration)\
- $(SolutionDir)$(PlatformName)\$(Configuration)\
- $(PlatformName)\$(Configuration)\
- $(PlatformName)\$(Configuration)\
- $(PlatformName)\$(Configuration)\
- $(SolutionDir)$(PlatformName)\$(Configuration)\
- $(PlatformName)\$(Configuration)\
-
-
-
- APT_STATIC_LIB;%(PreprocessorDefinitions)
-
-
-
-
- X64
-
-
- APT_STATIC_LIB;%(PreprocessorDefinitions)
- ProgramDatabase
-
-
-
-
- APT_STATIC_LIB;%(PreprocessorDefinitions)
-
-
-
-
- X64
-
-
- APT_STATIC_LIB;%(PreprocessorDefinitions)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {f057da7f-79e5-4b00-845c-ef446ef055e3}
- false
-
-
-
-
-
-
\ No newline at end of file
diff --git a/libs/unimrcp/libs/apr-toolkit/aprtoolkit.vcproj b/libs/unimrcp/libs/apr-toolkit/aprtoolkit.vcproj
deleted file mode 100644
index bb2746e815..0000000000
--- a/libs/unimrcp/libs/apr-toolkit/aprtoolkit.vcproj
+++ /dev/null
@@ -1,417 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/libs/unimrcp/libs/apr-toolkit/aprtoolkit.vcxproj b/libs/unimrcp/libs/apr-toolkit/aprtoolkit.vcxproj
deleted file mode 100644
index 29980e1941..0000000000
--- a/libs/unimrcp/libs/apr-toolkit/aprtoolkit.vcxproj
+++ /dev/null
@@ -1,139 +0,0 @@
-
-
-
-
- Debug
- Win32
-
-
- Debug
- x64
-
-
- Release
- Win32
-
-
- Release
- x64
-
-
-
- {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}
- aprtoolkit
- Win32Proj
-
-
-
- StaticLibrary
- Unicode
- true
-
-
- StaticLibrary
- Unicode
-
-
- StaticLibrary
- Unicode
- true
-
-
- StaticLibrary
- Unicode
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <_ProjectFileVersion>10.0.30319.1
- AllRules.ruleset
-
-
- AllRules.ruleset
-
-
- AllRules.ruleset
-
-
- AllRules.ruleset
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/libs/unimrcp/libs/apr-toolkit/aprtoolkit.vcxproj.filters b/libs/unimrcp/libs/apr-toolkit/aprtoolkit.vcxproj.filters
deleted file mode 100644
index 3a67d6084e..0000000000
--- a/libs/unimrcp/libs/apr-toolkit/aprtoolkit.vcxproj.filters
+++ /dev/null
@@ -1,143 +0,0 @@
-
-
-
-
- {93995380-89BD-4b04-88EB-625FBE52EBFB}
- h;hpp;hxx;hm;inl;inc;xsd
-
-
- {4e9335ac-20e8-4284-ad77-20ad9190c94d}
- cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
-
-
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
-
\ No newline at end of file
diff --git a/libs/unimrcp/libs/apr-toolkit/include/apt.h b/libs/unimrcp/libs/apr-toolkit/include/apt.h
deleted file mode 100644
index a25a6e28f1..0000000000
--- a/libs/unimrcp/libs/apr-toolkit/include/apt.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: apt.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef APT_H
-#define APT_H
-
-/**
- * @file apt.h
- * @brief APR Toolkit Definitions
- */
-
-#include
-#include
-#include
-
-#ifdef __cplusplus
-/** Begin of extern "C" block */
-#define APT_BEGIN_EXTERN_C extern "C" {
-/** End of extern "C" block */
-#define APT_END_EXTERN_C }
-#else
-/** Begin of extern "C" block */
-#define APT_BEGIN_EXTERN_C
-/** End of extern "C" block */
-#define APT_END_EXTERN_C
-#endif
-
-/** Lib export/import defines (win32) */
-#ifdef WIN32
-#ifdef APT_STATIC_LIB
-#define APT_DECLARE(type) type __stdcall
-#else
-#ifdef APT_LIB_EXPORT
-#define APT_DECLARE(type) __declspec(dllexport) type __stdcall
-#else
-#define APT_DECLARE(type) __declspec(dllimport) type __stdcall
-#endif
-#endif
-#else
-#define APT_DECLARE(type) type
-#endif
-
-/** Boolean value */
-typedef int apt_bool_t;
-
-#endif /* APT_H */
diff --git a/libs/unimrcp/libs/apr-toolkit/include/apt_consumer_task.h b/libs/unimrcp/libs/apr-toolkit/include/apt_consumer_task.h
deleted file mode 100644
index 2f33426737..0000000000
--- a/libs/unimrcp/libs/apr-toolkit/include/apt_consumer_task.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: apt_consumer_task.h 2175 2014-09-12 04:56:09Z achaloyan@gmail.com $
- */
-
-#ifndef APT_CONSUMER_TASK_H
-#define APT_CONSUMER_TASK_H
-
-/**
- * @file apt_consumer_task.h
- * @brief Consumer Task Definition
- */
-
-#include "apt_task.h"
-#include "apt_timer_queue.h"
-
-APT_BEGIN_EXTERN_C
-
-/** Opaque consumer task declaration */
-typedef struct apt_consumer_task_t apt_consumer_task_t;
-
-/**
- * Create consumer task.
- * @param obj the external object to associate with the task
- * @param msg_pool the pool of task messages
- * @param pool the pool to allocate memory from
- */
-APT_DECLARE(apt_consumer_task_t*) apt_consumer_task_create(
- void *obj,
- apt_task_msg_pool_t *msg_pool,
- apr_pool_t *pool);
-
-/**
- * Get task base.
- * @param task the consumer task to get base for
- */
-APT_DECLARE(apt_task_t*) apt_consumer_task_base_get(const apt_consumer_task_t *task);
-
-/**
- * Get task vtable.
- * @param task the consumer task to get vtable for
- */
-APT_DECLARE(apt_task_vtable_t*) apt_consumer_task_vtable_get(const apt_consumer_task_t *task);
-
-/**
- * Get consumer task object.
- * @param task the consumer task to get object from
- */
-APT_DECLARE(void*) apt_consumer_task_object_get(const apt_consumer_task_t *task);
-
-/**
- * Create timer.
- * @param task the consumer task to create timer for
- * @param proc the timer callback
- * @param obj the object to pass to callback
- * @param pool the pool to allocate memory from
- */
-APT_DECLARE(apt_timer_t*) apt_consumer_task_timer_create(
- apt_consumer_task_t *task,
- apt_timer_proc_f proc,
- void *obj,
- apr_pool_t *pool);
-
-APT_END_EXTERN_C
-
-#endif /* APT_CONSUMER_TASK_H */
diff --git a/libs/unimrcp/libs/apr-toolkit/include/apt_cyclic_queue.h b/libs/unimrcp/libs/apr-toolkit/include/apt_cyclic_queue.h
deleted file mode 100644
index bf803e2dde..0000000000
--- a/libs/unimrcp/libs/apr-toolkit/include/apt_cyclic_queue.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: apt_cyclic_queue.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef APT_CYCLIC_QUEUE_H
-#define APT_CYCLIC_QUEUE_H
-
-/**
- * @file apt_cyclic_queue.h
- * @brief Cyclic FIFO Queue of Opaque void* Objects
- */
-
-#include "apt.h"
-
-APT_BEGIN_EXTERN_C
-
-/** Default size (number of elements) of cyclic queue */
-#define CYCLIC_QUEUE_DEFAULT_SIZE 100
-
-/** Opaque cyclic queue declaration */
-typedef struct apt_cyclic_queue_t apt_cyclic_queue_t;
-
-/**
- * Create cyclic queue.
- * @param size the initial size of the queue
- * @return the created queue
- */
-APT_DECLARE(apt_cyclic_queue_t*) apt_cyclic_queue_create(apr_size_t size);
-
-/**
- * Destroy cyclic queue.
- * @param queue the queue to destroy
- */
-APT_DECLARE(void) apt_cyclic_queue_destroy(apt_cyclic_queue_t *queue);
-
-/**
- * Push object to the queue.
- * @param queue the queue to push object to
- * @param obj the object to push
- */
-APT_DECLARE(apt_bool_t) apt_cyclic_queue_push(apt_cyclic_queue_t *queue, void *obj);
-
-/**
- * Pop object from the queue.
- * @param queue the queue to pop message from
- */
-APT_DECLARE(void*) apt_cyclic_queue_pop(apt_cyclic_queue_t *queue);
-
-/**
- * Clear the queue (remove all the elements from the queue).
- * @param queue the queue to clear
- */
-APT_DECLARE(void) apt_cyclic_queue_clear(apt_cyclic_queue_t *queue);
-
-/**
- * Query whether the queue is empty.
- * @param queue the queue to query
- * @return TRUE if empty, otherwise FALSE
- */
-APT_DECLARE(apt_bool_t) apt_cyclic_queue_is_empty(const apt_cyclic_queue_t *queue);
-
-
-APT_END_EXTERN_C
-
-#endif /* APT_CYCLIC_QUEUE_H */
diff --git a/libs/unimrcp/libs/apr-toolkit/include/apt_dir_layout.h b/libs/unimrcp/libs/apr-toolkit/include/apt_dir_layout.h
deleted file mode 100644
index ba2fa16421..0000000000
--- a/libs/unimrcp/libs/apr-toolkit/include/apt_dir_layout.h
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: apt_dir_layout.h 2204 2014-10-31 01:01:42Z achaloyan@gmail.com $
- */
-
-#ifndef APT_DIR_LAYOUT_H
-#define APT_DIR_LAYOUT_H
-
-/**
- * @file apt_dir_layout.h
- * @brief Directories Layout
- */
-
-#include "apt.h"
-
-APT_BEGIN_EXTERN_C
-
-/*
- * This define allows user applications to support both the old interface,
- * where members of apt_dir_layout_t structure were accessable to the
- * application, and the new opaque interface, where OPAQUE_DIR_LAYOUT
- * is defined.
- */
-#define OPAQUE_DIR_LAYOUT
-
-/** Directories layout declaration */
-typedef struct apt_dir_layout_t apt_dir_layout_t;
-
-/** Enumeration of directories the layout is composed of */
-typedef enum {
- APT_LAYOUT_CONF_DIR, /**< configuration directory */
- APT_LAYOUT_PLUGIN_DIR, /**< plugin directory */
- APT_LAYOUT_LOG_DIR, /**< log directory */
- APT_LAYOUT_DATA_DIR, /**< data directory */
- APT_LAYOUT_VAR_DIR, /**< var directory */
-
- APT_LAYOUT_DIR_COUNT, /**< number of directories in the default layout */
-
- APT_LAYOUT_EXT_DIR = APT_LAYOUT_DIR_COUNT
-} apt_dir_entry_id;
-
-/**
- * Create the default directories layout based on the specified root directory.
- * @param root_dir_path the path to the root directory
- * @param pool the memory pool to use
- */
-APT_DECLARE(apt_dir_layout_t*) apt_default_dir_layout_create(const char *root_dir_path, apr_pool_t *pool);
-
-/**
- * Create a custom directories layout based on the specified individual directories.
- * @param conf_dir_path the path to the config dir
- * @param plugin_dir_path the path to the plugin dir
- * @param log_dir_path the path to the log dir
- * @param var_dir_path the path to the var dir
- * @param pool the memory pool to use
- */
-APT_DECLARE(apt_dir_layout_t*) apt_custom_dir_layout_create(
- const char *conf_dir_path,
- const char *plugin_dir_path,
- const char *log_dir_path,
- const char *data_dir_path,
- const char *var_dir_path,
- apr_pool_t *pool);
-
-/**
- * Create a bare directories layout.
- * @param pool the memory pool to use
- */
-APT_DECLARE(apt_dir_layout_t*) apt_dir_layout_create(apr_pool_t *pool);
-
-/**
- * Create am extended bare directories layout.
- * @param count the number of directories in the layout
- * @param pool the memory pool to use
- */
-APT_DECLARE(apt_dir_layout_t*) apt_dir_layout_create_ext(apr_size_t count, apr_pool_t *pool);
-
-/**
- * Load directories layout from the specified configuration file.
- * @param dir_layout the directory layout
- * @param config_file the path to the configuration file
- * @param pool the memory pool to use
- */
-APT_DECLARE(apt_bool_t) apt_dir_layout_load(apt_dir_layout_t *dir_layout, const char *config_file, apr_pool_t *pool);
-
-/**
- * Load directories layout from the specified configuration file using the provided labels.
- * @param dir_layout the directory layout
- * @param config_file the path to the configuration file
- * @param labels the array of directory labels (configuration entries)
- * @param count the number of labels (normally equals the number of directories in the layout)
- * @param pool the memory pool to use
- */
-APT_DECLARE(apt_bool_t) apt_dir_layout_load_ext(apt_dir_layout_t *dir_layout, const char *config_file, const char **labels, apr_size_t count, apr_pool_t *pool);
-
-/**
- * Set the path to the individual directory in the layout.
- * @param dir_layout the directory layout
- * @param dir_entry_id the directory id (apt_dir_entry_id)
- * @param path the directory path
- * @param pool the memory pool to use
- */
-APT_DECLARE(apt_bool_t) apt_dir_layout_path_set(apt_dir_layout_t *dir_layout, apr_size_t dir_entry_id, const char *path, apr_pool_t *pool);
-
-/**
- * Get the path to the individual directory in the layout.
- * @param dir_layout the directory layout
- * @param dir_entry_id the directory id (apt_dir_entry_id)
- */
-APT_DECLARE(const char*) apt_dir_layout_path_get(const apt_dir_layout_t *dir_layout, apr_size_t dir_entry_id);
-
-/**
- * Compose a file path relative to the specified directory in the layout.
- * @param dir_layout the directory layout
- * @param dir_entry_id the directory id (apt_dir_entry_id)
- * @param file_name the file name to append to the directory path
- * @param pool the memory pool to use
- */
-APT_DECLARE(char*) apt_dir_layout_path_compose(const apt_dir_layout_t *dir_layout, apr_size_t dir_entry_id, const char *file_name, apr_pool_t *pool);
-
-
-/**
- * Compose a file path relative to config dir.
- * @param dir_layout the directory layout
- * @param file_name the file name
- * @param pool the memory pool to use
- */
-APT_DECLARE(char*) apt_confdir_filepath_get(const apt_dir_layout_t *dir_layout, const char *file_name, apr_pool_t *pool);
-
-/**
- * Compose a file path relative to data dir.
- * @param dir_layout the directory layout
- * @param file_name the file name
- * @param pool the memory pool to use
- */
-APT_DECLARE(char*) apt_datadir_filepath_get(const apt_dir_layout_t *dir_layout, const char *file_name, apr_pool_t *pool);
-
-/**
- * Compose a file path relative to var dir.
- * @param dir_layout the directory layout
- * @param file_name the file name
- * @param pool the memory pool to use
- */
-APT_DECLARE(char*) apt_vardir_filepath_get(const apt_dir_layout_t *dir_layout, const char *file_name, apr_pool_t *pool);
-
-
-APT_END_EXTERN_C
-
-#endif /* APT_DIR_LAYOUT_H */
diff --git a/libs/unimrcp/libs/apr-toolkit/include/apt_header_field.h b/libs/unimrcp/libs/apr-toolkit/include/apt_header_field.h
deleted file mode 100644
index b2e7053748..0000000000
--- a/libs/unimrcp/libs/apr-toolkit/include/apt_header_field.h
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: apt_header_field.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef APT_HEADER_FIELD_H
-#define APT_HEADER_FIELD_H
-
-/**
- * @file apt_header_field.h
- * @brief Header Field Declaration (RFC5322)
- */
-
-#ifdef WIN32
-#pragma warning(disable: 4127)
-#endif
-#include
-#include "apt_string.h"
-
-APT_BEGIN_EXTERN_C
-
-/** Header field declaration */
-typedef struct apt_header_field_t apt_header_field_t;
-/** Header section declaration */
-typedef struct apt_header_section_t apt_header_section_t;
-
-/** Header field */
-struct apt_header_field_t {
- /** Ring entry */
- APR_RING_ENTRY(apt_header_field_t) link;
-
- /** Name of the header field */
- apt_str_t name;
- /** Value of the header field */
- apt_str_t value;
-
- /** Numeric identifier associated with name */
- apr_size_t id;
-};
-
-/**
- * Header section
- * @remark The header section is a collection of header fields.
- * The header fields are stored in both a ring and an array.
- * The goal is to ensure efficient access and manipulation on the header fields.
- */
-struct apt_header_section_t {
- /** List of header fields (name-value pairs) */
- APR_RING_HEAD(apt_head_t, apt_header_field_t) ring;
- /** Array of pointers to header fields */
- apt_header_field_t **arr;
- /** Max number of header fields */
- apr_size_t arr_size;
-};
-
-
-/**
- * Allocate an empty header field.
- * @param pool the pool to allocate memory from
- */
-APT_DECLARE(apt_header_field_t*) apt_header_field_alloc(apr_pool_t *pool);
-
-/**
- * Create a header field using given name and value APT strings.
- * @param name the name of the header field
- * @param value the value of the header field
- * @param pool the pool to allocate memory from
- */
-APT_DECLARE(apt_header_field_t*) apt_header_field_create(const apt_str_t *name, const apt_str_t *value, apr_pool_t *pool);
-
-/**
- * Create a header field using given name and value C strings.
- * @param name the name of the header field
- * @param value the value of the header field
- * @param pool the pool to allocate memory from
- */
-APT_DECLARE(apt_header_field_t*) apt_header_field_create_c(const char *name, const char *value, apr_pool_t *pool);
-
-/**
- * Create a header field from entire text line consisting of a name and value pair.
- * @param line the text line, which consists of a name and value pair
- * @param separator the name and value separator
- * @param pool the pool to allocate memory from
- */
-APT_DECLARE(apt_header_field_t*) apt_header_field_create_from_line(const apt_str_t *line, char separator, apr_pool_t *pool);
-
-/**
- * Copy specified header field.
- * @param src_header_field the header field to copy
- * @param pool the pool to allocate memory from
- */
-APT_DECLARE(apt_header_field_t*) apt_header_field_copy(const apt_header_field_t *src_header_field, apr_pool_t *pool);
-
-/**
- * Initialize header section (collection of header fields).
- * @param header the header section to initialize
- */
-APT_DECLARE(void) apt_header_section_init(apt_header_section_t *header);
-
-/**
- * Allocate header section to set/get header fields by numeric identifiers.
- * @param header the header section to allocate
- * @param max_field_count the max number of header fields in the section (protocol dependent)
- * @param pool the pool to allocate memory from
- */
-APT_DECLARE(apt_bool_t) apt_header_section_array_alloc(apt_header_section_t *header, apr_size_t max_field_count, apr_pool_t *pool);
-
-/**
- * Add (append) header field to header section.
- * @param header the header section to add field to
- * @param header_field the header field to add
- */
-APT_DECLARE(apt_bool_t) apt_header_section_field_add(apt_header_section_t *header, apt_header_field_t *header_field);
-
-/**
- * Insert header field to header section based on numreic identifier if specified.
- * @param header the header section to insert field into
- * @param header_field the header field to insert
- */
-APT_DECLARE(apt_bool_t) apt_header_section_field_insert(apt_header_section_t *header, apt_header_field_t *header_field);
-
-/**
- * Set header field in the array of header fields using associated numeric identifier.
- * @param header the header section to set field for
- * @param header_field the header field to set
- * @remark Typically, the header field should be already added to the header section using apt_header_section_field_add()
- */
-APT_DECLARE(apt_bool_t) apt_header_section_field_set(apt_header_section_t *header, apt_header_field_t *header_field);
-
-/**
- * Remove header field from header section.
- * @param header the header section to remove field from
- * @param header_field the header field to remove
- */
-APT_DECLARE(apt_bool_t) apt_header_section_field_remove(apt_header_section_t *header, apt_header_field_t *header_field);
-
-/**
- * Check whether specified header field is set.
- * @param header the header section to use
- * @param id the identifier associated with the header_field to check
- */
-static APR_INLINE apt_bool_t apt_header_section_field_check(const apt_header_section_t *header, apr_size_t id)
-{
- if(id < header->arr_size) {
- return header->arr[id] ? TRUE : FALSE;
- }
- return FALSE;
-}
-
-/**
- * Get header field by specified identifier.
- * @param header the header section to use
- * @param id the identifier associated with the header_field
- */
-static APR_INLINE apt_header_field_t* apt_header_section_field_get(const apt_header_section_t *header, apr_size_t id)
-{
- if(id < header->arr_size) {
- return header->arr[id];
- }
- return NULL;
-}
-
-APT_END_EXTERN_C
-
-#endif /* APT_HEADER_FIELD_H */
diff --git a/libs/unimrcp/libs/apr-toolkit/include/apt_log.h b/libs/unimrcp/libs/apr-toolkit/include/apt_log.h
deleted file mode 100644
index 9e022c3163..0000000000
--- a/libs/unimrcp/libs/apr-toolkit/include/apt_log.h
+++ /dev/null
@@ -1,274 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: apt_log.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef APT_LOG_H
-#define APT_LOG_H
-
-/**
- * @file apt_log.h
- * @brief Basic Logger
- */
-
-#include
-#include
-#include "apt.h"
-
-APT_BEGIN_EXTERN_C
-
-/** Default max size of the log file (8Mb) */
-#define MAX_LOG_FILE_SIZE (8 * 1024 * 1024)
-/** Default max number of log files used in rotation */
-#define MAX_LOG_FILE_COUNT 100
-
-/** File:line mark */
-#define APT_LOG_MARK __FILE__,__LINE__
-
-/*
- * Definition of common formats used with apt_log().
- *
- * Note that the generic %p format can not be used for pointers
- * since apr_vformatter doesn't accept it. The format %pp introduced
- * by apr_vformatter can not be used either since it breaks compatibility
- * with generic printf style loggers.
- */
-#if defined(WIN32) && APR_SIZEOF_VOIDP == 8
-/** Format to log pointer values on Win x64 */
-#define APT_PTR_FMT "0x%I64x"
-#else
-/** Format to log pointer values */
-#define APT_PTR_FMT "0x%lx"
-#endif
-/** Format to log string identifiers */
-#define APT_SID_FMT "<%s>"
-/** Format to log string identifiers and resources */
-#define APT_SIDRES_FMT "<%s@%s>"
-/** Format to log pointers and identifiers */
-#define APT_PTRSID_FMT APT_PTR_FMT" " APT_SID_FMT
-/** Format to log pointers and identifiers */
-#define APT_NAMESID_FMT "%s " APT_SID_FMT
-/** Format to log names, identifiers and resources */
-#define APT_NAMESIDRES_FMT "%s " APT_SIDRES_FMT
-
-/** Priority of log messages ordered from highest priority to lowest (rfc3164) */
-typedef enum {
- APT_PRIO_EMERGENCY, /**< system is unusable */
- APT_PRIO_ALERT, /**< action must be taken immediately */
- APT_PRIO_CRITICAL, /**< critical condition */
- APT_PRIO_ERROR, /**< error condition */
- APT_PRIO_WARNING, /**< warning condition */
- APT_PRIO_NOTICE, /**< normal, but significant condition */
- APT_PRIO_INFO, /**< informational message */
- APT_PRIO_DEBUG, /**< debug-level message */
-
- APT_PRIO_COUNT /**< number of priorities */
-} apt_log_priority_e;
-
-/** Header (format) of log messages */
-typedef enum {
- APT_LOG_HEADER_NONE = 0x00, /**< disable optional headers output */
- APT_LOG_HEADER_DATE = 0x01, /**< enable date output */
- APT_LOG_HEADER_TIME = 0x02, /**< enable time output */
- APT_LOG_HEADER_PRIORITY = 0x04, /**< enable priority name output */
- APT_LOG_HEADER_MARK = 0x08, /**< enable file:line mark output */
- APT_LOG_HEADER_THREAD = 0x10, /**< enable thread identifier output */
-
- APT_LOG_HEADER_DEFAULT = APT_LOG_HEADER_DATE | APT_LOG_HEADER_TIME | APT_LOG_HEADER_PRIORITY
-} apt_log_header_e;
-
-/** Mode of log output */
-typedef enum {
- APT_LOG_OUTPUT_NONE = 0x00, /**< disable logging */
- APT_LOG_OUTPUT_CONSOLE = 0x01, /**< enable console output */
- APT_LOG_OUTPUT_FILE = 0x02 /**< enable log file output */
-} apt_log_output_e;
-
-/** Masking mode of private data */
-typedef enum {
- APT_LOG_MASKING_NONE, /**< log everything as is */
- APT_LOG_MASKING_COMPLETE, /**< mask private data completely */
- APT_LOG_MASKING_ENCRYPTED /**< encrypt private data */
-} apt_log_masking_e;
-
-/** Opaque logger declaration */
-typedef struct apt_logger_t apt_logger_t;
-
-/** Prototype of extended log handler function */
-typedef apt_bool_t (*apt_log_ext_handler_f)(const char *file, int line,
- const char *obj, apt_log_priority_e priority,
- const char *format, va_list arg_ptr);
-
-/**
- * Create the singleton instance of the logger.
- * @param mode the log output mode
- * @param priority the log priority level
- * @param pool the memory pool to use
- */
-APT_DECLARE(apt_bool_t) apt_log_instance_create(apt_log_output_e mode, apt_log_priority_e priority, apr_pool_t *pool);
-
-/**
- * Create and load the singleton instance of the logger.
- * @param config_file the path to configuration file to load settings from
- * @param pool the memory pool to use
- */
-APT_DECLARE(apt_bool_t) apt_log_instance_load(const char *config_file, apr_pool_t *pool);
-
-/**
- * Destroy the singleton instance of the logger.
- */
-APT_DECLARE(apt_bool_t) apt_log_instance_destroy(void);
-
-/**
- * Get the singleton instance of the logger.
- */
-APT_DECLARE(apt_logger_t*) apt_log_instance_get(void);
-
-/**
- * Set the singleton instance of the logger.
- */
-APT_DECLARE(apt_bool_t) apt_log_instance_set(apt_logger_t *logger);
-
-/**
- * Open the log file.
- * @param dir_path the path to the log directory
- * @param file_name the name of the log file
- * @param max_file_size the max size of the log file
- * @param max_file_count the max number of files used in log rotation
- * @param append whether to append or to truncate (start over) the log file
- * @param pool the memory pool to use
- */
-APT_DECLARE(apt_bool_t) apt_log_file_open(
- const char *dir_path,
- const char *file_name,
- apr_size_t max_file_size,
- apr_size_t max_file_count,
- apt_bool_t append,
- apr_pool_t *pool);
-
-/**
- * Close the log file.
- */
-APT_DECLARE(apt_bool_t) apt_log_file_close(void);
-
-/**
- * Set the logging output mode.
- * @param mode the mode to set
- */
-APT_DECLARE(apt_bool_t) apt_log_output_mode_set(apt_log_output_e mode);
-
-/**
- * Check the logging output mode to be enabled (set) or not.
- * @param mode the mode to check
- */
-APT_DECLARE(apt_bool_t) apt_log_output_mode_check(apt_log_output_e mode);
-
-/**
- * Translate the output mode string to bitmask of apt_log_output_e values.
- * @param str the string to translate
- */
-APT_DECLARE(int) apt_log_output_mode_translate(char *str);
-
-/**
- * Set the logging priority (log level).
- * @param priority the priority to set
- */
-APT_DECLARE(apt_bool_t) apt_log_priority_set(apt_log_priority_e priority);
-
-/**
- * Translate the priority (log level) string to enum.
- * @param str the string to translate
- */
-APT_DECLARE(apt_log_priority_e) apt_log_priority_translate(const char *str);
-
-/**
- * Set the header (format) for log messages.
- * @param header the header to set (used as bitmask)
- */
-APT_DECLARE(apt_bool_t) apt_log_header_set(int header);
-
-/**
- * Translate the header string to bitmask of apt_log_header_e values.
- * @param str the string to translate
- */
-APT_DECLARE(int) apt_log_header_translate(char *str);
-
-/**
- * Set the masking mode of private data.
- * @param masking the masking mode to set
- */
-APT_DECLARE(apt_bool_t) apt_log_masking_set(apt_log_masking_e masking);
-
-/**
- * Get the current masking mode of private data.
- */
-APT_DECLARE(apt_log_masking_e) apt_log_masking_get(void);
-
-/**
- * Translate the masking mode string to enum.
- * @param str the string to translate
- */
-APT_DECLARE(apt_log_masking_e) apt_log_masking_translate(const char *str);
-
-/**
- * Mask private data based on the masking mode
- * @param data_in the data to mask
- * @param length the length of the data to mask on input, the length of the masked data on output
- * @param pool the memory pool to use if needed
- * @return The masked data.
- */
-APT_DECLARE(const char*) apt_log_data_mask(const char *data_in, apr_size_t *length, apr_pool_t *pool);
-
-/**
- * Set the extended external log handler.
- * @param handler the handler to pass log events to
- * @remark default logger is used to output the logs to stdout and/or log file,
- * if external log handler isn't set
- */
-APT_DECLARE(apt_bool_t) apt_log_ext_handler_set(apt_log_ext_handler_f handler);
-
-/**
- * Do logging.
- * @param file the file name log entry is generated from
- * @param line the line number log entry is generated from
- * @param priority the priority of the entire log entry
- * @param format the format of the entire log entry
- */
-APT_DECLARE(apt_bool_t) apt_log(const char *file, int line, apt_log_priority_e priority, const char *format, ...);
-
-/**
- * Do logging (this version uses an object externally associated with the logger).
- * @param file the file name log entry is generated from
- * @param line the line number log entry is generated from
- * @param priority the priority of the entire log entry
- * @param obj the associated object
- * @param format the format of the entire log entry
- */
-APT_DECLARE(apt_bool_t) apt_obj_log(const char *file, int line, apt_log_priority_e priority, void *obj, const char *format, ...);
-
-/**
- * Do logging (this version accepts va_list argument).
- * @param file the file name log entry is generated from
- * @param line the line number log entry is generated from
- * @param priority the priority of the entire log entry
- * @param format the format of the entire log entry
- * @param arg_ptr the arguments
- */
-APT_DECLARE(apt_bool_t) apt_va_log(const char *file, int line, apt_log_priority_e priority, const char *format, va_list arg_ptr);
-
-APT_END_EXTERN_C
-
-#endif /* APT_LOG_H */
diff --git a/libs/unimrcp/libs/apr-toolkit/include/apt_multipart_content.h b/libs/unimrcp/libs/apr-toolkit/include/apt_multipart_content.h
deleted file mode 100644
index dd4c646d83..0000000000
--- a/libs/unimrcp/libs/apr-toolkit/include/apt_multipart_content.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: apt_multipart_content.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef APT_MULTIPART_CONTENT_H
-#define APT_MULTIPART_CONTENT_H
-
-/**
- * @file apt_multipart_content.h
- * @brief Multipart Content Routine
- */
-
-#include "apt_header_field.h"
-
-APT_BEGIN_EXTERN_C
-
-/** Opaque multipart content declaration */
-typedef struct apt_multipart_content_t apt_multipart_content_t;
-
-/** Content part declaration */
-typedef struct apt_content_part_t apt_content_part_t;
-
-/** Content part */
-struct apt_content_part_t {
- /** Header section */
- apt_header_section_t header;
- /** Body */
- apt_str_t body;
-
- /** Pointer to parsed content-type header field */
- apt_str_t *type;
- /** Pointer to parsed content-id header field */
- apt_str_t *id;
- /** Pointer to parsed content-length header field */
- apt_str_t *length;
-};
-
-/**
- * Create an empty multipart content
- * @param max_content_size the max size of the content (body)
- * @param boundary the boundary to separate content parts
- * @param pool the pool to allocate memory from
- * @return an empty multipart content
- */
-APT_DECLARE(apt_multipart_content_t*) apt_multipart_content_create(apr_size_t max_content_size, const apt_str_t *boundary, apr_pool_t *pool);
-
-/**
- * Add content part to multipart content
- * @param multipart_content the multipart content to add content part to
- * @param content_part the content part to add
- * @return TRUE on success
- */
-APT_DECLARE(apt_bool_t) apt_multipart_content_add(apt_multipart_content_t *multipart_content, const apt_content_part_t *content_part);
-
-/**
- * Add content part to multipart content by specified header fields and body
- * @param multipart_content the multipart content to add content part to
- * @param content_type the type of content part
- * @param content_id the identifier of content part
- * @param body the body of content part
- * @return TRUE on success
- */
-APT_DECLARE(apt_bool_t) apt_multipart_content_add2(apt_multipart_content_t *multipart_content, const apt_str_t *content_type, const apt_str_t *content_id, const apt_str_t *body);
-
-/**
- * Finalize multipart content generation
- * @param multipart_content the multipart content to finalize
- * @return generated multipart content
- */
-APT_DECLARE(apt_str_t*) apt_multipart_content_finalize(apt_multipart_content_t *multipart_content);
-
-
-/**
- * Assign body to multipart content to get (parse) each content part from
- * @param body the body of multipart content to parse
- * @param boundary the boundary to separate content parts
- * @param pool the pool to allocate memory from
- * @return multipart content with assigned body
- */
-APT_DECLARE(apt_multipart_content_t*) apt_multipart_content_assign(const apt_str_t *body, const apt_str_t *boundary, apr_pool_t *pool);
-
-/**
- * Get the next content part
- * @param multipart_content the multipart content to get the next content part from
- * @param content_part the parsed content part
- * @param is_final indicates the final boundary is reached
- * @return TRUE on success
- */
-APT_DECLARE(apt_bool_t) apt_multipart_content_get(apt_multipart_content_t *multipart_content, apt_content_part_t *content_part, apt_bool_t *is_final);
-
-
-APT_END_EXTERN_C
-
-#endif /* APT_MULTIPART_CONTENT_H */
diff --git a/libs/unimrcp/libs/apr-toolkit/include/apt_net.h b/libs/unimrcp/libs/apr-toolkit/include/apt_net.h
deleted file mode 100644
index 6527c8fc7d..0000000000
--- a/libs/unimrcp/libs/apr-toolkit/include/apt_net.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: apt_net.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef APT_NET_H
-#define APT_NET_H
-
-/**
- * @file apt_net.h
- * @brief Network Utilities
- */
-
-#include "apt.h"
-
-APT_BEGIN_EXTERN_C
-
-/**
- * Get the IP address (in numeric address string format) by hostname.
- * @param addr the IP address to return
- * @param pool the pool to allocate memory from
- */
-apt_bool_t apt_ip_get(char **addr, apr_pool_t *pool);
-
-/**
- * Get the IP address (in numeric address string format) by network interface name.
- * @param iface_name the network interface name (eth0, Local Area Connection, etc)
- * @param addr the IP address to return
- * @param pool the pool to allocate memory from
- */
-apt_bool_t apt_ip_get_by_iface(const char *iface_name, char **addr, apr_pool_t *pool);
-
-/**
- * Get current NTP time
- * @param sec the seconds of the NTP time to return
- * @param frac the fractions of the NTP time to return
- */
-void apt_ntp_time_get(apr_uint32_t *sec, apr_uint32_t *frac);
-
-APT_END_EXTERN_C
-
-#endif /* APT_NET_H */
diff --git a/libs/unimrcp/libs/apr-toolkit/include/apt_nlsml_doc.h b/libs/unimrcp/libs/apr-toolkit/include/apt_nlsml_doc.h
deleted file mode 100644
index d6b87c87d9..0000000000
--- a/libs/unimrcp/libs/apr-toolkit/include/apt_nlsml_doc.h
+++ /dev/null
@@ -1,210 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: apt_nlsml_doc.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef APT_NLSML_DOC_H
-#define APT_NLSML_DOC_H
-
-/**
- * @file apt_nlsml_doc.h
- * @brief NLSML Result Handling
- * @remark This is an MRCP version independent and vendor consistent implementation
- * of the NSLML parser. The interface reflects the NLSML schema defined in
- * http://tools.ietf.org/html/rfc6787#section-16.1.
- */
-
-#include
-#include "apt.h"
-
-APT_BEGIN_EXTERN_C
-
-/* Forward declarations */
-typedef struct nlsml_result_t nlsml_result_t;
-typedef struct nlsml_interpretation_t nlsml_interpretation_t;
-typedef struct nlsml_enrollment_result_t nlsml_enrollment_result_t;
-typedef struct nlsml_verification_result_t nlsml_verification_result_t;
-typedef struct nlsml_instance_t nlsml_instance_t;
-typedef struct nlsml_input_t nlsml_input_t;
-
-/**
- * Parse NLSML result
- * @param data the data to parse
- * @param length the length of the data
- * @param pool the memory pool to use
- * @return the parsed NLSML result.
- */
-APT_DECLARE(nlsml_result_t*) nlsml_result_parse(const char *data, apr_size_t length, apr_pool_t *pool);
-
-/**
- * Trace parsed NLSML result (for debug purposes only)
- * @param result the parsed result to output
- * @param pool the memory pool to use
- */
-APT_DECLARE(void) nlsml_result_trace(const nlsml_result_t *result, apr_pool_t *pool);
-
-/*
- * Accessors of the NLSML element.
- * Each element may contain one or more , ,
- * elements, and an optional attribute.
- */
-
-/**
- * Get first interpretation
- * @param result the parsed NLSML result which holds the list of interpretation elements
- */
-APT_DECLARE(nlsml_interpretation_t*) nlsml_first_interpretation_get(const nlsml_result_t *result);
-
-/**
- * Get next interpretation
- * @param result the parsed NLSML result which holds the list of interpretation elements
- * @param interpretation the current interpretation element
- */
-APT_DECLARE(nlsml_interpretation_t*) nlsml_next_interpretation_get(const nlsml_result_t *result, const nlsml_interpretation_t *interpretation);
-
-/**
- * Get first enrollment result
- * @param result the parsed NLSML result which holds the list of enrollment-result elements
- */
-APT_DECLARE(nlsml_enrollment_result_t*) nlsml_first_enrollment_result_get(const nlsml_result_t *result);
-
-/**
- * Get next enrollment result
- * @param result the parsed NLSML result which holds the list of enrollment-result elements
- * @param enrollment_result the current enrollment-result element
- */
-APT_DECLARE(nlsml_enrollment_result_t*) nlsml_next_enrollment_result_get(const nlsml_result_t *result, const nlsml_enrollment_result_t *enrollment_result);
-
-/**
- * Get first verification result
- * @param result the parsed NLSML result which holds the list of verification-result elements
- */
-APT_DECLARE(nlsml_verification_result_t*) nlsml_first_verification_result_get(const nlsml_result_t *result);
-
-/**
- * Get next verification result
- * @param result the parsed NLSML result which holds the list of verification-result elements
- * @param verification_result the current verification-result element
- */
-APT_DECLARE(nlsml_verification_result_t*) nlsml_next_verification_result_get(const nlsml_result_t *result, const nlsml_verification_result_t *verification_result);
-
-/**
- * Get the grammar attribute of the NLSML result
- * @param result the parsed result
- */
-APT_DECLARE(const char*) nlsml_result_grammar_get(const nlsml_result_t *result);
-
-/*
- * Accessors of the element.
- */
-
-/**
- * Get first instance
- * @param interpretation the parsed interpretation element which holds the list of instance elements
- */
-APT_DECLARE(nlsml_instance_t*) nlsml_interpretation_first_instance_get(const nlsml_interpretation_t *interpretation);
-
-/**
- * Get next instance
- * @param interpretation the parsed interpretation element which holds the list of instance elements
- * @param instance the current instance element
- */
-APT_DECLARE(nlsml_instance_t*) nlsml_interpretation_next_instance_get(const nlsml_interpretation_t *interpretation, const nlsml_instance_t *instance);
-
-/**
- * Get input
- * @param interpretation the parsed interpretation element which may have 0 or 1 input elements
- */
-APT_DECLARE(nlsml_input_t*) nlsml_interpretation_input_get(const nlsml_interpretation_t *interpretation);
-
-/**
- * Get interpretation confidence
- * @param interpretation the parsed interpretation element
- * @remark the confidence is stored and returned as a float value for both MRCPv2 and MRCPv1
- */
-APT_DECLARE(float) nlsml_interpretation_confidence_get(const nlsml_interpretation_t *interpretation);
-
-/**
- * Get interpretation grammar
- * @param interpretation the parsed interpretation element
- */
-APT_DECLARE(const char*) nlsml_interpretation_grammar_get(const nlsml_interpretation_t *interpretation);
-
-/*
- * Accessors of the and elements.
- */
-
-/**
- * Get an XML representation of the instance element
- * @param instance the parsed instance element
- */
-APT_DECLARE(const apr_xml_elem*) nlsml_instance_elem_get(const nlsml_instance_t *instance);
-
-/**
- * Suppress SWI elements (normalize instance)
- * @param instance the parsed instance to suppress SWI sub-elements from
- */
-APT_DECLARE(apt_bool_t) nlsml_instance_swi_suppress(nlsml_instance_t *instance);
-
-/**
- * Generate a plain text content of the instance element
- * @param instance the parsed instance to generate content of
- * @param pool the memory pool to use
- */
-APT_DECLARE(const char*) nlsml_instance_content_generate(const nlsml_instance_t *instance, apr_pool_t *pool);
-
-/**
- * Get an XML representation of the input element
- * @param input the parsed input element
- */
-APT_DECLARE(const apr_xml_elem*) nlsml_input_elem_get(const nlsml_input_t *input);
-
-/**
- * Generate a plain text content of the input element
- * @param input the parsed input to generate content of
- * @param pool the memory pool to use
- */
-APT_DECLARE(const char*) nlsml_input_content_generate(const nlsml_input_t *input, apr_pool_t *pool);
-
-/**
- * Get input mode
- * @param input the parsed input element
- * @remark the input mode is either "speech" or "dtmf"
- */
-APT_DECLARE(const char*) nlsml_input_mode_get(const nlsml_input_t *input);
-
-/**
- * Get input confidence
- * @param input the parsed input element
- * @remark the confidence is stored and returned as a float value for both MRCPv2 and MRCPv1
- */
-APT_DECLARE(float) nlsml_input_confidence_get(const nlsml_input_t *input);
-
-/**
- * Get start of input timestamp
- * @param input the parsed input element
- */
-APT_DECLARE(const char*) nlsml_input_timestamp_start_get(const nlsml_input_t *input);
-
-/**
- * Get end of input timestamp
- * @param input the parsed input element
- */
-APT_DECLARE(const char*) nlsml_input_timestamp_end_get(const nlsml_input_t *input);
-
-APT_END_EXTERN_C
-
-#endif /* APT_NLSML_DOC_H */
diff --git a/libs/unimrcp/libs/apr-toolkit/include/apt_obj_list.h b/libs/unimrcp/libs/apr-toolkit/include/apt_obj_list.h
deleted file mode 100644
index 56a88d0d4b..0000000000
--- a/libs/unimrcp/libs/apr-toolkit/include/apt_obj_list.h
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: apt_obj_list.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef APT_OBJ_LIST_H
-#define APT_OBJ_LIST_H
-
-/**
- * @file apt_obj_list.h
- * @brief List of Opaque void* Objects
- */
-
-#include "apt.h"
-
-APT_BEGIN_EXTERN_C
-
-
-/** Opaque list declaration */
-typedef struct apt_obj_list_t apt_obj_list_t;
-/** Opaque list element declaration */
-typedef struct apt_list_elem_t apt_list_elem_t;
-
-/**
- * Create list.
- * @param pool the pool to allocate list from
- * @return the created list
- */
-APT_DECLARE(apt_obj_list_t*) apt_list_create(apr_pool_t *pool);
-
-/**
- * Destroy list.
- * @param list the list to destroy
- */
-APT_DECLARE(void) apt_list_destroy(apt_obj_list_t *list);
-
-/**
- * Push object to the list as first in, first out.
- * @param list the list to push object to
- * @param obj the object to push
- * @param pool the pool to allocate list element from
- * @return the inserted element
- */
-APT_DECLARE(apt_list_elem_t*) apt_list_push_back(apt_obj_list_t *list, void *obj, apr_pool_t *pool);
-
-/**
- * Pop object from the list as first in, first out.
- * @param list the list to pop message from
- * @return the popped object (if any)
- */
-APT_DECLARE(void*) apt_list_pop_front(apt_obj_list_t *list);
-
-/**
- * Retrieve object of the first element in the list.
- * @param list the list to retrieve from
- */
-APT_DECLARE(void*) apt_list_head(const apt_obj_list_t *list);
-
-/**
- * Retrieve object of the last element in the list.
- * @param list the list to retrieve from
- */
-APT_DECLARE(void*) apt_obj_list_tail(const apt_obj_list_t *list);
-
-
-/**
- * Retrieve the first element of the list.
- * @param list the list to retrieve from
- */
-APT_DECLARE(apt_list_elem_t*) apt_list_first_elem_get(const apt_obj_list_t *list);
-
-/**
- * Retrieve the last element of the list.
- * @param list the list to retrieve from
- */
-APT_DECLARE(apt_list_elem_t*) apt_list_last_elem_get(const apt_obj_list_t *list);
-
-/**
- * Retrieve the next element of the list.
- * @param list the list to retrieve from
- * @param elem the element to retrieve next element from
- */
-APT_DECLARE(apt_list_elem_t*) apt_list_next_elem_get(const apt_obj_list_t *list, apt_list_elem_t *elem);
-
-/**
- * Retrieve the prev element of the list.
- * @param list the list to retrieve from
- * @param elem the element to retrieve prev element from
- */
-APT_DECLARE(apt_list_elem_t*) apt_list_prev_elem_get(const apt_obj_list_t *list, apt_list_elem_t *elem);
-
-/**
- * Insert element to the list.
- * @param list the list to insert element to
- * @param elem the element to insert before
- * @param obj the object to insert
- * @param pool the pool to allocate list element from
- * @return the inserted element
- */
-APT_DECLARE(apt_list_elem_t*) apt_list_elem_insert(apt_obj_list_t *list, apt_list_elem_t *elem, void *obj, apr_pool_t *pool);
-
-/**
- * Remove element from the list.
- * @param list the list to remove element from
- * @param elem the element to remove
- * @return the next element (if any)
- */
-APT_DECLARE(apt_list_elem_t*) apt_list_elem_remove(apt_obj_list_t *list, apt_list_elem_t *elem);
-
-/**
- * Query whether the list is empty.
- * @param list the list to query
- * @return TRUE if empty, otherwise FALSE
- */
-APT_DECLARE(apt_bool_t) apt_list_is_empty(const apt_obj_list_t *list);
-
-/**
- * Retrieve the object associated with element.
- * @param elem the element to retrieve object from
- */
-APT_DECLARE(void*) apt_list_elem_object_get(const apt_list_elem_t *elem);
-
-
-APT_END_EXTERN_C
-
-#endif /* APT_OBJ_LIST_H */
diff --git a/libs/unimrcp/libs/apr-toolkit/include/apt_pair.h b/libs/unimrcp/libs/apr-toolkit/include/apt_pair.h
deleted file mode 100644
index 737cff2157..0000000000
--- a/libs/unimrcp/libs/apr-toolkit/include/apt_pair.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: apt_pair.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef APT_PAIR_H
-#define APT_PAIR_H
-
-/**
- * @file apt_pair.h
- * @brief Generic Name-Value Pair
- */
-
-#include
-#include "apt_string.h"
-
-APT_BEGIN_EXTERN_C
-
-/** Name-value declaration */
-typedef struct apt_pair_t apt_pair_t;
-
-/** Generic name-value pair definition ("name:value") */
-struct apt_pair_t {
- /** The name */
- apt_str_t name;
- /** The value */
- apt_str_t value;
-};
-
-/** Dynamic array of name-value pairs */
-typedef apr_array_header_t apt_pair_arr_t;
-
-/** Initialize name-value pair */
-static APR_INLINE void apt_pair_init(apt_pair_t *pair)
-{
- apt_string_reset(&pair->name);
- apt_string_reset(&pair->value);
-}
-
-/** Copy name-value pair */
-static APR_INLINE void apt_pair_copy(apt_pair_t *pair, const apt_pair_t *src_pair, apr_pool_t *pool)
-{
- apt_string_copy(&pair->name,&src_pair->name,pool);
- apt_string_copy(&pair->value,&src_pair->value,pool);
-}
-
-/** Create array of name-value pairs */
-APT_DECLARE(apt_pair_arr_t*) apt_pair_array_create(apr_size_t initial_size, apr_pool_t *pool);
-/** Copy array of name-value pairs */
-APT_DECLARE(apt_pair_arr_t*) apt_pair_array_copy(const apt_pair_arr_t *src, apr_pool_t *pool);
-/** Append name-value pair */
-APT_DECLARE(apt_bool_t) apt_pair_array_append(apt_pair_arr_t *arr, const apt_str_t *name, const apt_str_t *value, apr_pool_t *pool);
-/** Find name-value pair by name */
-APT_DECLARE(const apt_pair_t*) apt_pair_array_find(const apt_pair_arr_t *arr, const apt_str_t *name);
-/** Get size of pair array */
-APT_DECLARE(int) apt_pair_array_size_get(const apt_pair_arr_t *arr);
-/** Get name-value pair by id */
-APT_DECLARE(const apt_pair_t*) apt_pair_array_get(const apt_pair_arr_t *arr, int id);
-
-APT_END_EXTERN_C
-
-#endif /* APT_PAIR_H */
diff --git a/libs/unimrcp/libs/apr-toolkit/include/apt_poller_task.h b/libs/unimrcp/libs/apr-toolkit/include/apt_poller_task.h
deleted file mode 100644
index 3bb6052744..0000000000
--- a/libs/unimrcp/libs/apr-toolkit/include/apt_poller_task.h
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: apt_poller_task.h 2176 2014-09-12 05:00:23Z achaloyan@gmail.com $
- */
-
-#ifndef APT_POLLER_TASK_H
-#define APT_POLLER_TASK_H
-
-/**
- * @file apt_poller_task.h
- * @brief Poller Task
- */
-
-#include "apt_pollset.h"
-#include "apt_task.h"
-#include "apt_timer_queue.h"
-
-APT_BEGIN_EXTERN_C
-
-/** Opaque poller task declaration */
-typedef struct apt_poller_task_t apt_poller_task_t;
-
-/** Function prototype to handle signalled descripors */
-typedef apt_bool_t (*apt_poll_signal_f)(void *obj, const apr_pollfd_t *descriptor);
-
-
-/**
- * Create poller task.
- * @param max_pollset_size the maximum number of descriptors pollset can hold
- * @param signal_handler the handler of signalled descriptors
- * @param obj the external object to pass to callback
- * @param msg_pool the pool of task messages
- * @param pool the pool to allocate memory from
- */
-APT_DECLARE(apt_poller_task_t*) apt_poller_task_create(
- apr_size_t max_pollset_size,
- apt_poll_signal_f signal_handler,
- void *obj,
- apt_task_msg_pool_t *msg_pool,
- apr_pool_t *pool);
-
-/**
- * Destroy poller task.
- * @param task the task to destroy
- */
-APT_DECLARE(apt_bool_t) apt_poller_task_destroy(apt_poller_task_t *task);
-
-/**
- * Cleanup poller task.
- * @param task the task to cleanup
- *
- * @remark This function should be considered in protected scope.
- * It will be called on task destroy unless you override the behavior.
- */
-APT_DECLARE(void) apt_poller_task_cleanup(apt_poller_task_t *task);
-
-/**
- * Start poller task and wait for incoming messages.
- * @param task the task to start
- */
-APT_DECLARE(apt_bool_t) apt_poller_task_start(apt_poller_task_t *task);
-
-/**
- * Terminate poller task.
- * @param task the task to terminate
- */
-APT_DECLARE(apt_bool_t) apt_poller_task_terminate(apt_poller_task_t *task);
-
-/**
- * Get task base.
- * @param task the poller task to get task base from
- */
-APT_DECLARE(apt_task_t*) apt_poller_task_base_get(const apt_poller_task_t *task);
-
-/**
- * Get task vtable.
- * @param task the poller task to get vtable from
- */
-APT_DECLARE(apt_task_vtable_t*) apt_poller_task_vtable_get(const apt_poller_task_t *task);
-
-/**
- * Get external object.
- * @param task the poller task to get object from
- */
-APT_DECLARE(void*) apt_poller_task_object_get(const apt_poller_task_t *task);
-
-/**
- * Add descriptor to pollset.
- * @param task the task which holds the pollset
- * @param descriptor the descriptor to add
- */
-APT_DECLARE(apt_bool_t) apt_poller_task_descriptor_add(const apt_poller_task_t *task, const apr_pollfd_t *descriptor);
-
-/**
- * Remove descriptor from pollset.
- * @param task the task which holds the pollset
- * @param descriptor the descriptor to remove
- */
-APT_DECLARE(apt_bool_t) apt_poller_task_descriptor_remove(const apt_poller_task_t *task, const apr_pollfd_t *descriptor);
-
-/**
- * Create timer.
- * @param task the poller task to create timer in the scope of
- * @param proc the timer callback
- * @param obj the object to pass to callback
- * @param pool the pool to allocate memory from
- */
-APT_DECLARE(apt_timer_t*) apt_poller_task_timer_create(
- apt_poller_task_t *task,
- apt_timer_proc_f proc,
- void *obj,
- apr_pool_t *pool);
-
-
-APT_END_EXTERN_C
-
-#endif /* APT_POLLER_TASK_H */
diff --git a/libs/unimrcp/libs/apr-toolkit/include/apt_pollset.h b/libs/unimrcp/libs/apr-toolkit/include/apt_pollset.h
deleted file mode 100644
index 0d6a0ab356..0000000000
--- a/libs/unimrcp/libs/apr-toolkit/include/apt_pollset.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: apt_pollset.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef APT_POLLSET_H
-#define APT_POLLSET_H
-
-/**
- * @file apt_pollset.h
- * @brief Interruptable APR-Pollset
- */
-
-/**
- * Wakeup builtin API of the pollset is introduced only in APR-1.4
- * and it is not available for APR-1.2 and APR-1.3 versions. Thus
- * apt_pollset_t is an extension of apr_pollset_t and provides
- * pollset wakeup capabilities the similar way as it's implemented
- * in APR-1.4 trunk
- */
-
-#include
-#include "apt.h"
-
-APT_BEGIN_EXTERN_C
-
-/** Opaque pollset declaration */
-typedef struct apt_pollset_t apt_pollset_t;
-
-/**
- * Create interruptable pollset on top of APR pollset.
- * @param size the maximum number of descriptors pollset can hold
- * @param pool the pool to allocate memory from
- */
-APT_DECLARE(apt_pollset_t*) apt_pollset_create(apr_uint32_t size, apr_pool_t *pool);
-
-/**
- * Destroy pollset.
- * @param pollset the pollset to destroy
- */
-APT_DECLARE(apt_bool_t) apt_pollset_destroy(apt_pollset_t *pollset);
-
-/**
- * Add pollset descriptor to a pollset.
- * @param pollset the pollset to add the descriptor to
- * @param descriptor the descriptor to add
- */
-APT_DECLARE(apt_bool_t) apt_pollset_add(apt_pollset_t *pollset, const apr_pollfd_t *descriptor);
-
-/**
- * Remove pollset descriptor from a pollset.
- * @param pollset the pollset to remove the descriptor from
- * @param descriptor the descriptor to remove
- */
-APT_DECLARE(apt_bool_t) apt_pollset_remove(apt_pollset_t *pollset, const apr_pollfd_t *descriptor);
-
-/**
- * Block for activity on the descriptor(s) in a pollset.
- * @param pollset the pollset to use
- * @param timeout the timeout in microseconds
- * @param num the number of signalled descriptors (output parameter)
- * @param descriptors the array of signalled descriptors (output parameter)
- */
-APT_DECLARE(apr_status_t) apt_pollset_poll(
- apt_pollset_t *pollset,
- apr_interval_time_t timeout,
- apr_int32_t *num,
- const apr_pollfd_t **descriptors);
-
-/**
- * Interrupt the blocked poll call.
- * @param pollset the pollset to use
- */
-APT_DECLARE(apt_bool_t) apt_pollset_wakeup(apt_pollset_t *pollset);
-
-/**
- * Match against builtin wake up descriptor in a pollset.
- * @param pollset the pollset to use
- * @param descriptor the descriptor to match
- */
-APT_DECLARE(apt_bool_t) apt_pollset_is_wakeup(apt_pollset_t *pollset, const apr_pollfd_t *descriptor);
-
-APT_END_EXTERN_C
-
-#endif /* APT_POLLSET_H */
diff --git a/libs/unimrcp/libs/apr-toolkit/include/apt_pool.h b/libs/unimrcp/libs/apr-toolkit/include/apt_pool.h
deleted file mode 100644
index 56f10d4429..0000000000
--- a/libs/unimrcp/libs/apr-toolkit/include/apt_pool.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: apt_pool.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef APT_POOL_H
-#define APT_POOL_H
-
-/**
- * @file apt_pool.h
- * @brief APR pool management
- */
-
-/**
- * Wrappers around APR pool creation
- * allow to control memory allocation policy project uses
- */
-
-#include "apt.h"
-
-APT_BEGIN_EXTERN_C
-
-/**
- * Create APR pool
- */
-APT_DECLARE(apr_pool_t*) apt_pool_create(void);
-
-/**
- * Create APR subpool pool
- * @param parent the parent pool
- */
-APT_DECLARE(apr_pool_t*) apt_subpool_create(apr_pool_t *parent);
-
-APT_END_EXTERN_C
-
-#endif /* APT_POOL_H */
diff --git a/libs/unimrcp/libs/apr-toolkit/include/apt_string.h b/libs/unimrcp/libs/apr-toolkit/include/apt_string.h
deleted file mode 100644
index 4c919cedb6..0000000000
--- a/libs/unimrcp/libs/apr-toolkit/include/apt_string.h
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: apt_string.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef APT_STRING_H
-#define APT_STRING_H
-
-/**
- * @file apt_string.h
- * @brief String Representation
- */
-
-#include "apt.h"
-
-APT_BEGIN_EXTERN_C
-
-/** Empty string */
-#define APT_EMPTY_STRING ""
-
-/** String declaration */
-typedef struct apt_str_t apt_str_t;
-
-/** String representation */
-struct apt_str_t {
- /** String buffer (might be not NULL terminated) */
- char *buf;
- /** Length of the string (not counting terminating NULL character if exists) */
- apr_size_t length;
-};
-
-/** Reset string. */
-static APR_INLINE void apt_string_reset(apt_str_t *str)
-{
- str->buf = NULL;
- str->length = 0;
-}
-
-/** Get string buffer. */
-static APR_INLINE const char* apt_string_buffer_get(const apt_str_t *str)
-{
- if(str->buf) {
- return str->buf;
- }
- return APT_EMPTY_STRING;
-}
-
-/** Get string length. */
-static APR_INLINE apr_size_t apt_string_length_get(const apt_str_t *str)
-{
- return str->length;
-}
-
-/** Check whether string is empty. */
-static APR_INLINE apr_size_t apt_string_is_empty(const apt_str_t *str)
-{
- return str->length ? FALSE : TRUE;
-}
-
-/**
- * Set NULL terminated string.
- * @param str the destination string
- * @param src the NULL terminated string to set
- */
-static APR_INLINE void apt_string_set(apt_str_t *str, const char *src)
-{
- str->buf = (char*)src;
- str->length = src ? strlen(src) : 0;
-}
-
-/**
- * Assign (copy) NULL terminated string.
- * @param str the destination string
- * @param src the NULL terminated string to copy
- * @param pool the pool to allocate memory from
- */
-static APR_INLINE void apt_string_assign(apt_str_t *str, const char *src, apr_pool_t *pool)
-{
- str->buf = NULL;
- str->length = src ? strlen(src) : 0;
- if(str->length) {
- str->buf = apr_pstrmemdup(pool,src,str->length);
- }
-}
-
-/**
- * Assign (copy) n characters from the src string.
- * @param str the destination string
- * @param src the NULL terminated string to copy
- * @param pool the pool to allocate memory from
- */
-static APR_INLINE void apt_string_assign_n(apt_str_t *str, const char *src, apr_size_t length, apr_pool_t *pool)
-{
- str->buf = NULL;
- str->length = length;
- if(str->length) {
- str->buf = apr_pstrmemdup(pool,src,str->length);
- }
-}
-
-/**
- * Copy string.
- * @param dest_str the destination string
- * @param src_str the source string
- * @param pool the pool to allocate memory from
- */
-static APR_INLINE void apt_string_copy(apt_str_t *str, const apt_str_t *src_str, apr_pool_t *pool)
-{
- str->buf = NULL;
- str->length = src_str->length;
- if(str->length) {
- str->buf = apr_pstrmemdup(pool,src_str->buf,src_str->length);
- }
-}
-
-/**
- * Compare two strings (case insensitive).
- * @param str1 the string to compare
- * @param str2 the string to compare
- * @return TRUE if equal, FALSE otherwise
- */
-static APR_INLINE apt_bool_t apt_string_compare(const apt_str_t *str1, const apt_str_t *str2)
-{
- if(str1->length != str2->length || !str1->length) {
- return FALSE;
- }
- return (strncasecmp(str1->buf,str2->buf,str1->length) == 0) ? TRUE : FALSE;
-}
-
-/**
- * Represent string as iovec.
- * @param str the string to represent
- * @param vec the iovec to set
- */
-static APR_INLINE void apt_string_to_iovec(const apt_str_t *str, struct iovec *vec)
-{
- vec->iov_base = str->buf;
- vec->iov_len = str->length;
-}
-
-APT_END_EXTERN_C
-
-#endif /* APT_STRING_H */
diff --git a/libs/unimrcp/libs/apr-toolkit/include/apt_string_table.h b/libs/unimrcp/libs/apr-toolkit/include/apt_string_table.h
deleted file mode 100644
index 53ecc6e5aa..0000000000
--- a/libs/unimrcp/libs/apr-toolkit/include/apt_string_table.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: apt_string_table.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef APT_STRING_TABLE_H
-#define APT_STRING_TABLE_H
-
-/**
- * @file apt_string_table.h
- * @brief Generic String Table
- */
-
-#include "apt_string.h"
-
-APT_BEGIN_EXTERN_C
-
-
-/** String table item declaration */
-typedef struct apt_str_table_item_t apt_str_table_item_t;
-
-/** String table item definition */
-struct apt_str_table_item_t {
- /** String value associated with id */
- apt_str_t value;
- /** Index of the unique (key) character to compare */
- apr_size_t key;
-};
-
-
-/**
- * Get the string by a given id.
- * @param table the table to get string from
- * @param size the size of the table
- * @param id the id to get string by
- * @return the string associated with the id, or NULL if the id is invalid
- */
-APT_DECLARE(const apt_str_t*) apt_string_table_str_get(const apt_str_table_item_t table[], apr_size_t size, apr_size_t id);
-
-/**
- * Find the id associated with a given string.
- * @param table the table to search for the id
- * @param size the size of the table
- * @param value the string to search for
- * @return the id associated with the string, or invalid id if string cannot be matched
- */
-APT_DECLARE(apr_size_t) apt_string_table_id_find(const apt_str_table_item_t table[], apr_size_t size, const apt_str_t *value);
-
-
-APT_END_EXTERN_C
-
-#endif /* APT_STRING_TABLE_H */
diff --git a/libs/unimrcp/libs/apr-toolkit/include/apt_task.h b/libs/unimrcp/libs/apr-toolkit/include/apt_task.h
deleted file mode 100644
index 127529c95e..0000000000
--- a/libs/unimrcp/libs/apr-toolkit/include/apt_task.h
+++ /dev/null
@@ -1,262 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: apt_task.h 2180 2014-09-13 21:17:24Z achaloyan@gmail.com $
- */
-
-#ifndef APT_TASK_H
-#define APT_TASK_H
-
-/**
- * @file apt_task.h
- * @brief Thread Execution Abstraction
- */
-
-#include "apt.h"
-#include "apt_task_msg.h"
-
-APT_BEGIN_EXTERN_C
-
-/** Opaque task declaration */
-typedef struct apt_task_t apt_task_t;
-/** Opaque task virtual table declaration */
-typedef struct apt_task_vtable_t apt_task_vtable_t;
-/** Opaque task method declaration */
-typedef apt_bool_t (*apt_task_method_f)(apt_task_t *task);
-/** Opaque task event declaration */
-typedef void (*apt_task_event_f)(apt_task_t *task);
-
-
-/**
- * Create task.
- * @param obj the external object to associate with the task
- * @param msg_pool the pool of task messages
- * @param pool the pool to allocate memory from
- */
-APT_DECLARE(apt_task_t*) apt_task_create(
- void *obj,
- apt_task_msg_pool_t *msg_pool,
- apr_pool_t *pool);
-
-/**
- * Destroy task.
- * @param task the task to destroy
- */
-APT_DECLARE(apt_bool_t) apt_task_destroy(apt_task_t *task);
-
-/**
- * Add child task.
- * @param task the task to add child task to
- * @param child_task the child task to add
- */
-APT_DECLARE(apt_bool_t) apt_task_add(apt_task_t *task, apt_task_t *child_task);
-
-/**
- * Start task.
- * @param task the task to start
- */
-APT_DECLARE(apt_bool_t) apt_task_start(apt_task_t *task);
-
-/**
- * Take task offline.
- * @param task the task to take offline
- */
-APT_DECLARE(apt_bool_t) apt_task_offline(apt_task_t *task);
-
-/**
- * Bring task online.
- * @param task the task to bring online
- */
-APT_DECLARE(apt_bool_t) apt_task_online(apt_task_t *task);
-
-/**
- * Terminate task.
- * @param task the task to terminate
- * @param wait_till_complete whether to wait for task to complete or
- * process termination asynchronously
- */
-APT_DECLARE(apt_bool_t) apt_task_terminate(apt_task_t *task, apt_bool_t wait_till_complete);
-
-/**
- * Wait for task till complete.
- * @param task the task to wait for
- */
-APT_DECLARE(apt_bool_t) apt_task_wait_till_complete(apt_task_t *task);
-
-/**
- * Get (acquire) task message.
- * @param task the task to get task message from
- */
-APT_DECLARE(apt_task_msg_t*) apt_task_msg_get(apt_task_t *task);
-
-/**
- * Signal (post) message to the task.
- * @param task the task to signal message to
- * @param msg the message to signal
- */
-APT_DECLARE(apt_bool_t) apt_task_msg_signal(apt_task_t *task, apt_task_msg_t *msg);
-
-/**
- * Signal (post) message to the parent of the specified task.
- * @param task the task to signal message to
- * @param msg the message to signal
- */
-APT_DECLARE(apt_bool_t) apt_task_msg_parent_signal(apt_task_t *task, apt_task_msg_t *msg);
-
-/**
- * Process message signaled to the task.
- * @param task the task to process message
- * @param msg the message to process
- */
-APT_DECLARE(apt_bool_t) apt_task_msg_process(apt_task_t *task, apt_task_msg_t *msg);
-
-/**
- * Process task start request.
- * @param task the task being started
- */
-APT_DECLARE(apt_bool_t) apt_task_start_request_process(apt_task_t *task);
-
-/**
- * Process task termination request.
- * @param task the task being terminated
- */
-APT_DECLARE(apt_bool_t) apt_task_terminate_request_process(apt_task_t *task);
-
-
-/**
- * Get parent (master) task.
- * @param task the task to get parent from
- */
-APT_DECLARE(apt_task_t*) apt_task_parent_get(const apt_task_t *task);
-
-/**
- * Get memory pool associated with task.
- * @param task the task to get pool from
- */
-APT_DECLARE(apr_pool_t*) apt_task_pool_get(const apt_task_t *task);
-
-/**
- * Get external object associated with the task.
- * @param task the task to get object from
- */
-APT_DECLARE(void*) apt_task_object_get(const apt_task_t *task);
-
-/**
- * Get task vtable.
- * @param task the task to get vtable from
- */
-APT_DECLARE(apt_task_vtable_t*) apt_task_vtable_get(apt_task_t *task);
-
-/**
- * Give a name to the task.
- * @param task the task to give name for
- * @param name the name to set
- */
-APT_DECLARE(void) apt_task_name_set(apt_task_t *task, const char *name);
-
-/**
- * Get task name.
- * @param task the task to get name from
- */
-APT_DECLARE(const char*) apt_task_name_get(const apt_task_t *task);
-
-/**
- * Enable/disable auto ready mode.
- * @param task the task to set mode for
- * @param auto_ready the enabled/disabled auto ready mode
- */
-APT_DECLARE(void) apt_task_auto_ready_set(apt_task_t *task, apt_bool_t auto_ready);
-
-/**
- * Explicitly indicate task is ready to process messages.
- * @param task the task
- */
-APT_DECLARE(apt_bool_t) apt_task_ready(apt_task_t *task);
-
-/**
- * Get the running flag.
- * @param task the task
- */
-APT_DECLARE(apt_bool_t*) apt_task_running_flag_get(apt_task_t *task);
-
-/**
- * Add start request.
- * @param task the task
- */
-APT_DECLARE(apt_bool_t) apt_task_start_request_add(apt_task_t *task);
-
-/**
- * Remove start request.
- * @param task the task
- */
-APT_DECLARE(apt_bool_t) apt_task_start_request_remove(apt_task_t *task);
-
-/**
- * Add termination request.
- * @param task the task
- */
-APT_DECLARE(apt_bool_t) apt_task_terminate_request_add(apt_task_t *task);
-
-/**
- * Remove termination request.
- * @param task the task
- */
-APT_DECLARE(apt_bool_t) apt_task_terminate_request_remove(apt_task_t *task);
-
-/**
- * Hold task execution.
- * @param msec the time to hold
- */
-APT_DECLARE(void) apt_task_delay(apr_size_t msec);
-
-
-/** Table of task virtual methods */
-struct apt_task_vtable_t {
- /** Virtual destroy method */
- apt_task_method_f destroy;
- /** Virtual start method*/
- apt_task_method_f start;
- /** Virtual terminate method */
- apt_task_method_f terminate;
- /** Virtual run method*/
- apt_task_method_f run;
-
- /** Virtual signal_msg method */
- apt_bool_t (*signal_msg)(apt_task_t *task, apt_task_msg_t *msg);
- /** Virtual process_msg method */
- apt_bool_t (*process_msg)(apt_task_t *task, apt_task_msg_t *msg);
-
- /** Virtual process_start method */
- apt_bool_t (*process_start)(apt_task_t *task);
- /** Virtual process_terminate method */
- apt_bool_t (*process_terminate)(apt_task_t *task);
-
- /** Virtual pre-run event handler */
- apt_task_event_f on_pre_run;
- /** Virtual post-run event handler */
- apt_task_event_f on_post_run;
- /** Virtual start-complete event handler */
- apt_task_event_f on_start_complete;
- /** Virtual terminate-complete event handler */
- apt_task_event_f on_terminate_complete;
- /** Virtual take-offline-complete event handler */
- apt_task_event_f on_offline_complete;
- /** Virtual bring-online-complete event handler */
- apt_task_event_f on_online_complete;
-};
-
-APT_END_EXTERN_C
-
-#endif /* APT_TASK_H */
diff --git a/libs/unimrcp/libs/apr-toolkit/include/apt_task_msg.h b/libs/unimrcp/libs/apr-toolkit/include/apt_task_msg.h
deleted file mode 100644
index afb01d2cd6..0000000000
--- a/libs/unimrcp/libs/apr-toolkit/include/apt_task_msg.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: apt_task_msg.h 2180 2014-09-13 21:17:24Z achaloyan@gmail.com $
- */
-
-#ifndef APT_TASK_MSG_H
-#define APT_TASK_MSG_H
-
-/**
- * @file apt_task_msg.h
- * @brief Task Message Base Definition
- */
-
-#include "apt.h"
-
-APT_BEGIN_EXTERN_C
-
-/** Enumeration of task message types */
-typedef enum {
- TASK_MSG_CORE, /**< core task message type */
- TASK_MSG_USER /**< user defined task messages start from here */
-} apt_task_msg_type_e;
-
-/** Enumeration of core task messages */
-typedef enum {
- CORE_TASK_MSG_NONE, /**< indefinite message */
- CORE_TASK_MSG_START_COMPLETE, /**< start-complete message */
- CORE_TASK_MSG_TERMINATE_REQUEST, /**< terminate-request message */
- CORE_TASK_MSG_TERMINATE_COMPLETE, /**< terminate-complete message */
- CORE_TASK_MSG_TAKEOFFLINE_REQUEST, /**< take-offline-request message */
- CORE_TASK_MSG_TAKEOFFLINE_COMPLETE, /**< take-offline-complete message */
- CORE_TASK_MSG_BRINGONLINE_REQUEST, /**< bring-online-request message */
- CORE_TASK_MSG_BRINGONLINE_COMPLETE, /**< bring-online-complete message */
-} apt_core_task_msg_type_e;
-
-/** Opaque task message declaration */
-typedef struct apt_task_msg_t apt_task_msg_t;
-/** Opaque task message pool declaration */
-typedef struct apt_task_msg_pool_t apt_task_msg_pool_t;
-
-/** Task message is used for inter task communication */
-struct apt_task_msg_t {
- /** Message pool the task message is allocated from */
- apt_task_msg_pool_t *msg_pool;
- /** Task msg type */
- int type;
- /** Task msg sub type */
- int sub_type;
- /** Context specific data */
- char data[1];
-};
-
-
-/** Create pool of task messages with dynamic allocation of messages (no actual pool is created) */
-APT_DECLARE(apt_task_msg_pool_t*) apt_task_msg_pool_create_dynamic(apr_size_t msg_size, apr_pool_t *pool);
-
-/** Create pool of task messages with static allocation of messages */
-APT_DECLARE(apt_task_msg_pool_t*) apt_task_msg_pool_create_static(apr_size_t msg_size, apr_size_t msg_pool_size, apr_pool_t *pool);
-
-/** Destroy pool of task messages */
-APT_DECLARE(void) apt_task_msg_pool_destroy(apt_task_msg_pool_t *msg_pool);
-
-
-/** Acquire task message from task message pool */
-APT_DECLARE(apt_task_msg_t*) apt_task_msg_acquire(apt_task_msg_pool_t *task_msg_pool);
-
-/** Realese task message */
-APT_DECLARE(void) apt_task_msg_release(apt_task_msg_t *task_msg);
-
-
-APT_END_EXTERN_C
-
-#endif /* APT_TASK_MSG_H */
diff --git a/libs/unimrcp/libs/apr-toolkit/include/apt_test_suite.h b/libs/unimrcp/libs/apr-toolkit/include/apt_test_suite.h
deleted file mode 100644
index 13e9003302..0000000000
--- a/libs/unimrcp/libs/apr-toolkit/include/apt_test_suite.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: apt_test_suite.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef APT_TEST_SUITE_H
-#define APT_TEST_SUITE_H
-
-/**
- * @file apt_test_suite.h
- * @brief Test Suite and Framework Definitions
- */
-
-#include "apt_string.h"
-
-APT_BEGIN_EXTERN_C
-
-
-/** Opaque test suite declaration */
-typedef struct apt_test_suite_t apt_test_suite_t;
-
-/** Prototype of test function */
-typedef apt_bool_t (*apt_test_f)(apt_test_suite_t *suite, int argc, const char * const *argv);
-
-/** Test suite as a base for all kind of tests */
-struct apt_test_suite_t {
- /** Memory pool to allocate memory from */
- apr_pool_t *pool;
- /** Unique name of the test suite */
- apt_str_t name;
- /** External object associated with the test suite */
- void *obj;
- /** Test function to execute */
- apt_test_f tester;
-};
-
-/**
- * Create test suite.
- * @param pool the pool to allocate memory from
- * @param name the unique name of the test suite
- * @param obj the external object associated with the test suite
- * @param tester the test function to execute
- */
-APT_DECLARE(apt_test_suite_t*) apt_test_suite_create(apr_pool_t *pool, const char *name,
- void *obj, apt_test_f tester);
-
-
-
-
-
-/** Opaque test framework declaration */
-typedef struct apt_test_framework_t apt_test_framework_t;
-
-/**
- * Create test framework.
- */
-APT_DECLARE(apt_test_framework_t*) apt_test_framework_create(void);
-
-/**
- * Destroy test framework.
- * @param framework the test framework to destroy
- */
-APT_DECLARE(void) apt_test_framework_destroy(apt_test_framework_t *framework);
-
-/**
- * Add test suite to framework.
- * @param framework the test framework to add test suite to
- * @param suite the test suite to add
- */
-APT_DECLARE(apt_bool_t) apt_test_framework_suite_add(apt_test_framework_t *framework, apt_test_suite_t *suite);
-
-/**
- * Run test suites.
- * @param framework the test framework
- * @param argc the number of arguments
- * @param argv the array of arguments
- */
-APT_DECLARE(apt_bool_t) apt_test_framework_run(apt_test_framework_t *framework, int argc, const char * const *argv);
-
-/**
- * Retrieve the memory pool.
- * @param framework the test framework to retrieve memory pool from
- */
-APT_DECLARE(apr_pool_t*) apt_test_framework_pool_get(const apt_test_framework_t *framework);
-
-APT_END_EXTERN_C
-
-#endif /* APT_TEST_SUITE_H */
diff --git a/libs/unimrcp/libs/apr-toolkit/include/apt_text_message.h b/libs/unimrcp/libs/apr-toolkit/include/apt_text_message.h
deleted file mode 100644
index 48e2f7c4c0..0000000000
--- a/libs/unimrcp/libs/apr-toolkit/include/apt_text_message.h
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: apt_text_message.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef APT_TEXT_MESSAGE_H
-#define APT_TEXT_MESSAGE_H
-
-/**
- * @file apt_text_message.h
- * @brief Text Message Interface (RFC5322)
- */
-
-#include "apt_header_field.h"
-#include "apt_text_stream.h"
-
-APT_BEGIN_EXTERN_C
-
-/** Status of text message processing (parsing/generation) */
-typedef enum {
- APT_MESSAGE_STATUS_COMPLETE,
- APT_MESSAGE_STATUS_INCOMPLETE,
- APT_MESSAGE_STATUS_INVALID
-} apt_message_status_e;
-
-
-/** Opaque text message parser */
-typedef struct apt_message_parser_t apt_message_parser_t;
-/** Vtable of text message parser */
-typedef struct apt_message_parser_vtable_t apt_message_parser_vtable_t;
-
-/** Opaque text message generator */
-typedef struct apt_message_generator_t apt_message_generator_t;
-/** Vtable of text message generator */
-typedef struct apt_message_generator_vtable_t apt_message_generator_vtable_t;
-
-/** Temporary context associated with message and used for its parsing or generation */
-typedef struct apt_message_context_t apt_message_context_t;
-
-/** Create message parser */
-APT_DECLARE(apt_message_parser_t*) apt_message_parser_create(void *obj, const apt_message_parser_vtable_t *vtable, apr_pool_t *pool);
-
-/** Parse message by raising corresponding event handlers */
-APT_DECLARE(apt_message_status_e) apt_message_parser_run(apt_message_parser_t *parser, apt_text_stream_t *stream, void **message);
-
-/** Get external object associated with parser */
-APT_DECLARE(void*) apt_message_parser_object_get(apt_message_parser_t *parser);
-
-/** Set verbose mode for the parser */
-APT_DECLARE(void) apt_message_parser_verbose_set(apt_message_parser_t *parser, apt_bool_t verbose);
-
-
-/** Create message generator */
-APT_DECLARE(apt_message_generator_t*) apt_message_generator_create(void *obj, const apt_message_generator_vtable_t *vtable, apr_pool_t *pool);
-
-/** Generate message */
-APT_DECLARE(apt_message_status_e) apt_message_generator_run(apt_message_generator_t *generator, void *message, apt_text_stream_t *stream);
-
-/** Get external object associated with generator */
-APT_DECLARE(void*) apt_message_generator_object_get(apt_message_generator_t *generator);
-
-/** Set verbose mode for the parser */
-APT_DECLARE(void) apt_message_generator_verbose_set(apt_message_generator_t *generator, apt_bool_t verbose);
-
-
-/** Parse individual header field (name-value pair) */
-APT_DECLARE(apt_header_field_t*) apt_header_field_parse(apt_text_stream_t *stream, apr_pool_t *pool);
-
-/** Generate individual header field (name-value pair) */
-APT_DECLARE(apt_bool_t) apt_header_field_generate(const apt_header_field_t *header_field, apt_text_stream_t *stream);
-
-/** Parse header section */
-APT_DECLARE(apt_bool_t) apt_header_section_parse(apt_header_section_t *header, apt_text_stream_t *stream, apr_pool_t *pool);
-
-/** Generate header section */
-APT_DECLARE(apt_bool_t) apt_header_section_generate(const apt_header_section_t *header, apt_text_stream_t *stream);
-
-
-/** Temporary context associated with message and used for its parsing or generation */
-struct apt_message_context_t {
- /** Context or ptotocol specific message */
- void *message;
- /** Header section of the message */
- apt_header_section_t *header;
- /** Body or content of the message */
- apt_str_t *body;
-};
-
-/** Vtable of text message parser */
-struct apt_message_parser_vtable_t {
- /** Start new message parsing by associating corresponding context and reading its start-line if applicable */
- apt_bool_t (*on_start)(apt_message_parser_t *parser, apt_message_context_t *context, apt_text_stream_t *stream, apr_pool_t *pool);
- /** Header section handler is invoked when entire header section has been read and parsed into header fields */
- apt_bool_t (*on_header_complete)(apt_message_parser_t *parser, apt_message_context_t *context);
- /** Body handler is invoked when entire body has been read */
- apt_bool_t (*on_body_complete)(apt_message_parser_t *parser, apt_message_context_t *context);
-};
-
-/** Vtable of text message generator */
-struct apt_message_generator_vtable_t {
- /** Start message generation by associating corresponding context and generating message start-line if applicable */
- apt_bool_t (*on_start)(apt_message_generator_t *generator, apt_message_context_t *context, apt_text_stream_t *stream);
- /** Header section handler is invoked to notify header section has been generated */
- apt_bool_t (*on_header_complete)(apt_message_generator_t *generator, apt_message_context_t *context, apt_text_stream_t *stream);
- /** Body handler is invoked to notify body has been generated */
- apt_bool_t (*on_body_complete)(apt_message_generator_t *generator, apt_message_context_t *context, apt_text_stream_t *stream);
-};
-
-
-APT_END_EXTERN_C
-
-#endif /* APT_TEXT_MESSAGE_H */
diff --git a/libs/unimrcp/libs/apr-toolkit/include/apt_text_stream.h b/libs/unimrcp/libs/apr-toolkit/include/apt_text_stream.h
deleted file mode 100644
index 7510afd9bc..0000000000
--- a/libs/unimrcp/libs/apr-toolkit/include/apt_text_stream.h
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: apt_text_stream.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef APT_TEXT_STREAM_H
-#define APT_TEXT_STREAM_H
-
-/**
- * @file apt_text_stream.h
- * @brief Text Stream Parse/Generate Routine
- */
-
-#include "apt_string_table.h"
-#include "apt_pair.h"
-
-APT_BEGIN_EXTERN_C
-
-/** Space */
-#define APT_TOKEN_SP 0x20
-/** Horizontal tab */
-#define APT_TOKEN_HTAB 0x09
-/** Carrige return */
-#define APT_TOKEN_CR 0x0D
-/** Line feed */
-#define APT_TOKEN_LF 0x0A
-
-/** Text stream declaration */
-typedef struct apt_text_stream_t apt_text_stream_t;
-
-/** Text stream is used for message parsing and generation */
-struct apt_text_stream_t {
- /** Text stream */
- apt_str_t text;
-
- /** Current position in the stream */
- char *pos;
- /** End of stream pointer */
- const char *end;
- /** Is end of stream reached */
- apt_bool_t is_eos;
-};
-
-
-/**
- * Read entire line of the text stream.
- * @param stream the text stream to navigate on
- * @param line the read line to return
- * @return TRUE if the line is successfully read, otherwise FALSE
- * @remark To be used to navigate through the lines of the text stream (message).
- */
-APT_DECLARE(apt_bool_t) apt_text_line_read(apt_text_stream_t *stream, apt_str_t *line);
-
-/**
- * Read header field (name-value pair) of the text stream by scanning entire line.
- * @param stream the text stream to navigate
- * @param pair the read pair to return
- * @return TRUE if the header is successfully read, otherwise FALSE
- * @remark To be used to navigate through the lines and read header fields
- * (name:value pairs) of the text stream (message).
- */
-APT_DECLARE(apt_bool_t) apt_text_header_read(apt_text_stream_t *stream, apt_pair_t *pair);
-
-/**
- * Read the field terminated with specified separator.
- * @param stream the text stream to navigate
- * @param separator the field separator
- * @param skip_spaces whether to skip spaces or not
- * @param field the read field to return
- * @return TRUE if the read field isn't empty, otherwise FALSE
- * @remark To be used to navigate through the fields of the text stream (message).
- */
-APT_DECLARE(apt_bool_t) apt_text_field_read(apt_text_stream_t *stream, char separator, apt_bool_t skip_spaces, apt_str_t *field);
-
-/** Generate name-value pair line */
-APT_DECLARE(apt_bool_t) apt_text_name_value_insert(apt_text_stream_t *stream, const apt_str_t *name, const apt_str_t *value);
-
-/** Generate only the name ("name:") of the header field */
-APT_DECLARE(apt_bool_t) apt_text_header_name_insert(apt_text_stream_t *stream, const apt_str_t *name);
-
-/** Parse array of name-value pairs */
-APT_DECLARE(apt_bool_t) apt_pair_array_parse(apt_pair_arr_t *arr, const apt_str_t *value, apr_pool_t *pool);
-/** Generate array of name-value pairs */
-APT_DECLARE(apt_bool_t) apt_pair_array_generate(const apt_pair_arr_t *arr, apt_str_t *str, apr_pool_t *pool);
-
-
-/** Parse boolean-value */
-APT_DECLARE(apt_bool_t) apt_boolean_value_parse(const apt_str_t *str, apt_bool_t *value);
-/** Generate apr_size_t value from pool (buffer is allocated from pool) */
-APT_DECLARE(apt_bool_t) apt_boolean_value_generate(apt_bool_t value, apt_str_t *str, apr_pool_t *pool);
-
-/** Parse apr_size_t value */
-APT_DECLARE(apr_size_t) apt_size_value_parse(const apt_str_t *str);
-/** Generate apr_size_t value from pool (buffer is allocated from pool) */
-APT_DECLARE(apt_bool_t) apt_size_value_generate(apr_size_t value, apt_str_t *str, apr_pool_t *pool);
-
-/** Insert apr_size_t value */
-APT_DECLARE(apt_bool_t) apt_text_size_value_insert(apt_text_stream_t *stream, apr_size_t value);
-
-/** Parse float value */
-APT_DECLARE(float) apt_float_value_parse(const apt_str_t *str);
-/** Generate float value (buffer is allocated from pool) */
-APT_DECLARE(apt_bool_t) apt_float_value_generate(float value, apt_str_t *str, apr_pool_t *pool);
-
-/** Insert float value */
-APT_DECLARE(apt_bool_t) apt_text_float_value_insert(apt_text_stream_t *stream, float value);
-/** Insert string value */
-APT_DECLARE(apt_bool_t) apt_text_string_insert(apt_text_stream_t *stream, const apt_str_t *str);
-
-/** Reset navigation related data of the text stream */
-static APR_INLINE void apt_text_stream_reset(apt_text_stream_t *stream)
-{
- stream->pos = stream->text.buf;
- stream->end = stream->text.buf + stream->text.length;
- stream->is_eos = FALSE;
-}
-
-/** Initialize text stream */
-static APR_INLINE void apt_text_stream_init(apt_text_stream_t *stream, char *buffer, apr_size_t size)
-{
- stream->text.buf = buffer;
- stream->text.length = size;
- apt_text_stream_reset(stream);
-}
-
-/** Insert end of the line symbol(s) */
-static APR_INLINE apt_bool_t apt_text_eol_insert(apt_text_stream_t *stream)
-{
- if(stream->pos + 2 < stream->end) {
- *stream->pos++ = APT_TOKEN_CR;
- *stream->pos++ = APT_TOKEN_LF;
- return TRUE;
- }
- return FALSE;
-}
-
-/** Insert character */
-static APR_INLINE apt_bool_t apt_text_char_insert(apt_text_stream_t *stream, char ch)
-{
- if(stream->pos + 1 < stream->end) {
- *stream->pos++ = ch;
- return TRUE;
- }
- return FALSE;
-}
-
-/** Insert space */
-static APR_INLINE apt_bool_t apt_text_space_insert(apt_text_stream_t *stream)
-{
- return apt_text_char_insert(stream,APT_TOKEN_SP);
-}
-
-/** Insert space */
-static APR_INLINE apt_bool_t apt_text_htab_insert(apt_text_stream_t *stream)
-{
- return apt_text_char_insert(stream,APT_TOKEN_HTAB);
-}
-
-/** Check whether specified character is a white space (WSP = SP / HTAB) */
-static APR_INLINE apt_bool_t apt_text_is_wsp(char ch)
-{
- return (ch == APT_TOKEN_SP || ch == APT_TOKEN_HTAB) ? TRUE : FALSE;
-}
-
-/** Skip sequence of spaces */
-static APR_INLINE void apt_text_spaces_skip(apt_text_stream_t *stream)
-{
- while(stream->pos < stream->end && *stream->pos == APT_TOKEN_SP)
- stream->pos++;
-}
-
-/** Skip sequence of white spaces (WSP = SP / HTAB) */
-static APR_INLINE void apt_text_white_spaces_skip(apt_text_stream_t *stream)
-{
- while(stream->pos < stream->end && apt_text_is_wsp(*stream->pos) == TRUE)
- stream->pos++;
-}
-
-/** Skip specified character */
-static APR_INLINE void apt_text_char_skip(apt_text_stream_t *stream, char ch)
-{
- if(stream->pos < stream->end && *stream->pos == ch) stream->pos++;
-}
-
-/** Skip sequence of specified characters */
-static APR_INLINE void apt_text_chars_skip(apt_text_stream_t *stream, char ch)
-{
- while(stream->pos < stream->end && *stream->pos == ch) stream->pos++;
-}
-
-/** Skip to specified character */
-static APR_INLINE void apt_text_skip_to_char(apt_text_stream_t *stream, char ch)
-{
- while(stream->pos < stream->end && *stream->pos != ch) stream->pos++;
-}
-
-/** Check whether end of stream is reached */
-static APR_INLINE apt_bool_t apt_text_is_eos(const apt_text_stream_t *stream)
-{
- return (stream->pos >= stream->end || stream->is_eos == TRUE) ? TRUE : FALSE;
-}
-
-/** Scroll text stream */
-APT_DECLARE(apt_bool_t) apt_text_stream_scroll(apt_text_stream_t *stream);
-
-/** Parse id at resource string */
-APT_DECLARE(apt_bool_t) apt_id_resource_parse(const apt_str_t *str, char separator, apt_str_t *id, apt_str_t *resource, apr_pool_t *pool);
-/** Generate id at resource string */
-APT_DECLARE(apt_bool_t) apt_id_resource_generate(const apt_str_t *id, const apt_str_t *resource, char separator, apt_str_t *str, apr_pool_t *pool);
-
-/** Generate value plus the length (number of digits) of the value itself */
-APT_DECLARE(apt_bool_t) apt_var_length_value_generate(apr_size_t *value, apr_size_t max_count, apt_str_t *str);
-
-/** Generate completion-cause */
-APT_DECLARE(apt_bool_t) apt_completion_cause_generate(const apt_str_table_item_t table[], apr_size_t size, apr_size_t cause, apt_str_t *str, apr_pool_t *pool);
-
-/**
- * Generate unique identifier (hex string)
- * @param id the id to generate
- * @param length the length of hex string to generate
- * @param pool the pool to allocate memory from
- */
-APT_DECLARE(apt_bool_t) apt_unique_id_generate(apt_str_t *id, apr_size_t length, apr_pool_t *pool);
-
-
-APT_END_EXTERN_C
-
-#endif /* APT_TEXT_STREAM_H */
diff --git a/libs/unimrcp/libs/apr-toolkit/include/apt_timer_queue.h b/libs/unimrcp/libs/apr-toolkit/include/apt_timer_queue.h
deleted file mode 100644
index ed04dd6514..0000000000
--- a/libs/unimrcp/libs/apr-toolkit/include/apt_timer_queue.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: apt_timer_queue.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef APT_TIMER_QUEUE_H
-#define APT_TIMER_QUEUE_H
-
-/**
- * @file apt_timer_queue.h
- * @brief Timer Queue
- */
-
-#include "apt.h"
-
-APT_BEGIN_EXTERN_C
-
-/** Opaque timer declaration */
-typedef struct apt_timer_t apt_timer_t;
-/** Opaque timer queue declaration */
-typedef struct apt_timer_queue_t apt_timer_queue_t;
-
-/** Prototype of timer callback */
-typedef void (*apt_timer_proc_f)(apt_timer_t *timer, void *obj);
-
-
-/** Create timer queue */
-APT_DECLARE(apt_timer_queue_t*) apt_timer_queue_create(apr_pool_t *pool);
-
-/** Destroy timer queue */
-APT_DECLARE(void) apt_timer_queue_destroy(apt_timer_queue_t *timer_queue);
-
-/** Advance scheduled timers */
-APT_DECLARE(void) apt_timer_queue_advance(apt_timer_queue_t *timer_queue, apr_uint32_t elapsed_time);
-
-/** Is timer queue empty */
-APT_DECLARE(apt_bool_t) apt_timer_queue_is_empty(const apt_timer_queue_t *timer_queue);
-
-/** Get current timeout */
-APT_DECLARE(apt_bool_t) apt_timer_queue_timeout_get(const apt_timer_queue_t *timer_queue, apr_uint32_t *timeout);
-
-
-/** Create timer */
-APT_DECLARE(apt_timer_t*) apt_timer_create(apt_timer_queue_t *timer_queue, apt_timer_proc_f proc, void *obj, apr_pool_t *pool);
-
-/** Set one-shot timer */
-APT_DECLARE(apt_bool_t) apt_timer_set(apt_timer_t *timer, apr_uint32_t timeout);
-
-/** Kill timer */
-APT_DECLARE(apt_bool_t) apt_timer_kill(apt_timer_t *timer);
-
-
-APT_END_EXTERN_C
-
-#endif /* APT_TIMER_QUEUE_H */
diff --git a/libs/unimrcp/libs/apr-toolkit/src/apt_consumer_task.c b/libs/unimrcp/libs/apr-toolkit/src/apt_consumer_task.c
deleted file mode 100644
index 67a9ea70dd..0000000000
--- a/libs/unimrcp/libs/apr-toolkit/src/apt_consumer_task.c
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: apt_consumer_task.c 2224 2014-11-12 00:41:45Z achaloyan@gmail.com $
- */
-
-#include
-#include
-#include "apt_consumer_task.h"
-#include "apt_log.h"
-
-struct apt_consumer_task_t {
- void *obj;
- apt_task_t *base;
- apr_queue_t *msg_queue;
-#if APR_HAS_QUEUE_TIMEOUT
- apt_timer_queue_t *timer_queue;
-#endif
-};
-
-static apt_bool_t apt_consumer_task_msg_signal(apt_task_t *task, apt_task_msg_t *msg);
-static apt_bool_t apt_consumer_task_run(apt_task_t *task);
-
-APT_DECLARE(apt_consumer_task_t*) apt_consumer_task_create(
- void *obj,
- apt_task_msg_pool_t *msg_pool,
- apr_pool_t *pool)
-{
- apt_task_vtable_t *vtable;
- apt_consumer_task_t *consumer_task = apr_palloc(pool,sizeof(apt_consumer_task_t));
- consumer_task->obj = obj;
- consumer_task->msg_queue = NULL;
- if(apr_queue_create(&consumer_task->msg_queue,1024,pool) != APR_SUCCESS) {
- return NULL;
- }
-
- consumer_task->base = apt_task_create(consumer_task,msg_pool,pool);
- if(!consumer_task->base) {
- return NULL;
- }
-
- vtable = apt_task_vtable_get(consumer_task->base);
- if(vtable) {
- vtable->run = apt_consumer_task_run;
- vtable->signal_msg = apt_consumer_task_msg_signal;
- }
-
-#if APR_HAS_QUEUE_TIMEOUT
- consumer_task->timer_queue = apt_timer_queue_create(pool);
-#endif
-
- return consumer_task;
-}
-
-APT_DECLARE(apt_task_t*) apt_consumer_task_base_get(const apt_consumer_task_t *task)
-{
- return task->base;
-}
-
-APT_DECLARE(apt_task_vtable_t*) apt_consumer_task_vtable_get(const apt_consumer_task_t *task)
-{
- return apt_task_vtable_get(task->base);
-}
-
-APT_DECLARE(void*) apt_consumer_task_object_get(const apt_consumer_task_t *task)
-{
- return task->obj;
-}
-
-APT_DECLARE(apt_timer_t*) apt_consumer_task_timer_create(
- apt_consumer_task_t *task,
- apt_timer_proc_f proc,
- void *obj,
- apr_pool_t *pool)
-{
-#if APR_HAS_QUEUE_TIMEOUT
- return apt_timer_create(task->timer_queue,proc,obj,pool);
-#else
- return NULL;
-#endif
-}
-
-static apt_bool_t apt_consumer_task_msg_signal(apt_task_t *task, apt_task_msg_t *msg)
-{
- apt_consumer_task_t *consumer_task = apt_task_object_get(task);
- return (apr_queue_push(consumer_task->msg_queue,msg) == APR_SUCCESS) ? TRUE : FALSE;
-}
-
-static apt_bool_t apt_consumer_task_run(apt_task_t *task)
-{
- apr_status_t rv;
- void *msg;
- apt_bool_t *running;
- apt_consumer_task_t *consumer_task;
-#if APR_HAS_QUEUE_TIMEOUT
- apr_interval_time_t timeout;
- apr_uint32_t queue_timeout;
- apr_time_t time_now, time_last = 0;
-#endif
- const char *task_name;
-
- consumer_task = apt_task_object_get(task);
- if(!consumer_task) {
- return FALSE;
- }
- task_name = apt_task_name_get(consumer_task->base),
-
- running = apt_task_running_flag_get(task);
- if(!running) {
- return FALSE;
- }
-
- while(*running) {
-#if APR_HAS_QUEUE_TIMEOUT
- if(apt_timer_queue_timeout_get(consumer_task->timer_queue,&queue_timeout) == TRUE) {
- timeout = (apr_interval_time_t)queue_timeout * 1000;
- time_last = apr_time_now();
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Wait for Messages [%s] timeout [%u]",
- task_name, queue_timeout);
- rv = apr_queue_timedpop(consumer_task->msg_queue,timeout,&msg);
- }
- else
- {
- timeout = -1;
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Wait for Messages [%s]",task_name);
- rv = apr_queue_pop(consumer_task->msg_queue,&msg);
- }
-#else
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Wait for Messages [%s]",task_name);
- rv = apr_queue_pop(consumer_task->msg_queue,&msg);
-#endif
- if(rv == APR_SUCCESS) {
- if(msg) {
- apt_task_msg_t *task_msg = msg;
- apt_task_msg_process(consumer_task->base,task_msg);
- }
- }
- else if(rv != APR_TIMEUP) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Pop Message [%s] status: %d",task_name,rv);
- }
-
-#if APR_HAS_QUEUE_TIMEOUT
- if(timeout != -1) {
- time_now = apr_time_now();
- if(time_now > time_last) {
- apt_timer_queue_advance(consumer_task->timer_queue,(apr_uint32_t)((time_now - time_last)/1000));
- }
- }
-#endif
- }
- return TRUE;
-}
diff --git a/libs/unimrcp/libs/apr-toolkit/src/apt_cyclic_queue.c b/libs/unimrcp/libs/apr-toolkit/src/apt_cyclic_queue.c
deleted file mode 100644
index 896a9f66fb..0000000000
--- a/libs/unimrcp/libs/apr-toolkit/src/apt_cyclic_queue.c
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: apt_cyclic_queue.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include
-#include "apt_cyclic_queue.h"
-
-struct apt_cyclic_queue_t {
- void **data;
- apr_size_t max_size;
- apr_size_t actual_size;
- apr_size_t head;
- apr_size_t tail;
-};
-
-static apt_bool_t apt_cyclic_queue_resize(apt_cyclic_queue_t *queue);
-
-
-APT_DECLARE(apt_cyclic_queue_t*) apt_cyclic_queue_create(apr_size_t size)
-{
- apt_cyclic_queue_t *queue = malloc(sizeof(apt_cyclic_queue_t));
- queue->max_size = size;
- queue->actual_size = 0;
- queue->data = malloc(sizeof(void*) * queue->max_size);
- queue->head = queue->tail = 0;
- return queue;
-}
-
-APT_DECLARE(void) apt_cyclic_queue_destroy(apt_cyclic_queue_t *queue)
-{
- if(queue->data) {
- free(queue->data);
- queue->data = NULL;
- }
- free(queue);
-}
-
-APT_DECLARE(apt_bool_t) apt_cyclic_queue_push(apt_cyclic_queue_t *queue, void *obj)
-{
- if(queue->actual_size >= queue->max_size) {
- if(apt_cyclic_queue_resize(queue) != TRUE) {
- return FALSE;
- }
- }
-
- queue->data[queue->head] = obj;
- queue->head = (queue->head + 1) % queue->max_size;
- queue->actual_size++;
- return TRUE;
-}
-
-APT_DECLARE(void*) apt_cyclic_queue_pop(apt_cyclic_queue_t *queue)
-{
- void *obj = NULL;
- if(queue->actual_size) {
- obj = queue->data[queue->tail];
- queue->tail = (queue->tail + 1) % queue->max_size;
- queue->actual_size--;
- }
- return obj;
-}
-
-APT_DECLARE(void) apt_cyclic_queue_clear(apt_cyclic_queue_t *queue)
-{
- queue->actual_size = 0;
- queue->head = queue->tail = 0;
-}
-
-APT_DECLARE(apt_bool_t) apt_cyclic_queue_is_empty(const apt_cyclic_queue_t *queue)
-{
- return queue->actual_size ? TRUE : FALSE;
-}
-
-static apt_bool_t apt_cyclic_queue_resize(apt_cyclic_queue_t *queue)
-{
- apr_size_t new_size = queue->max_size + queue->max_size/2;
- void **new_data = malloc(sizeof(void*) * new_size);
- apr_size_t offset;
-
- offset = queue->max_size - queue->head;
- memcpy(new_data, queue->data + queue->head, sizeof(void*) * offset);
- if(queue->head) {
- memcpy(new_data + offset, queue->data, sizeof(void*) * queue->head);
- }
-
- queue->tail = 0;
- queue->head = queue->max_size;
- queue->max_size = new_size;
- free(queue->data);
- queue->data = new_data;
- return TRUE;
-}
diff --git a/libs/unimrcp/libs/apr-toolkit/src/apt_dir_layout.c b/libs/unimrcp/libs/apr-toolkit/src/apt_dir_layout.c
deleted file mode 100644
index 4fe3f4a120..0000000000
--- a/libs/unimrcp/libs/apr-toolkit/src/apt_dir_layout.c
+++ /dev/null
@@ -1,317 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: apt_dir_layout.c 2204 2014-10-31 01:01:42Z achaloyan@gmail.com $
- */
-
-#include
-#include
-#include "apt_dir_layout.h"
-
-/** Directories layout */
-struct apt_dir_layout_t {
- /** Array of the directory paths the layout is composed of */
- const char **paths;
- /** Number of directories in the layout */
- apr_size_t count;
-};
-
-/** Default labels matching the entries in configuration */
-static const char *default_labels[APT_LAYOUT_DIR_COUNT] = {
- "confdir", /* APT_LAYOUT_CONF_DIR */
- "plugindir", /* APT_LAYOUT_PLUGIN_DIR */
- "logdir", /* APT_LAYOUT_LOG_DIR */
- "datadir", /* APT_LAYOUT_DATA_DIR */
- "vardir", /* APT_LAYOUT_VAR_DIR */
-};
-
-static const char* apt_default_root_dir_path_get(apr_pool_t *pool)
-{
- char *root_dir_path;
- char *cur_dir_path;
- /* Get the current directory */
- if(apr_filepath_get(&cur_dir_path,APR_FILEPATH_NATIVE,pool) != APR_SUCCESS)
- return NULL;
-
- /* Root directory is supposed to be one level up by default */
- if(apr_filepath_merge(&root_dir_path,cur_dir_path,"../",APR_FILEPATH_NATIVE,pool) != APR_SUCCESS)
- return FALSE;
-
- return root_dir_path;
-}
-
-static apt_bool_t apt_dir_layout_path_set_internal(apt_dir_layout_t *dir_layout, apr_size_t dir_entry_id, const char *path)
-{
- if(dir_entry_id >= dir_layout->count)
- return FALSE;
-
- dir_layout->paths[dir_entry_id] = path;
- return TRUE;
-}
-
-APT_DECLARE(apt_dir_layout_t*) apt_dir_layout_create(apr_pool_t *pool)
-{
- return apt_dir_layout_create_ext(APT_LAYOUT_DIR_COUNT,pool);
-}
-
-APT_DECLARE(apt_dir_layout_t*) apt_dir_layout_create_ext(apr_size_t count, apr_pool_t *pool)
-{
- apt_dir_layout_t *dir_layout = (apt_dir_layout_t*) apr_palloc(pool,sizeof(apt_dir_layout_t));
- dir_layout->count = count;
- dir_layout->paths = apr_pcalloc(pool,count*sizeof(char*));
- return dir_layout;
-}
-
-APT_DECLARE(apt_dir_layout_t*) apt_default_dir_layout_create(const char *root_dir_path, apr_pool_t *pool)
-{
- apt_dir_layout_t *dir_layout = apt_dir_layout_create_ext(APT_LAYOUT_DIR_COUNT,pool);
-
- if(!root_dir_path) {
- /* If root dir path is not specified, get the default one */
- root_dir_path = apt_default_root_dir_path_get(pool);
- }
-
- if(root_dir_path) {
- char *path;
-
- apr_filepath_merge(&path,root_dir_path,"conf",APR_FILEPATH_NATIVE,pool);
- apt_dir_layout_path_set_internal(dir_layout,APT_LAYOUT_CONF_DIR,path);
-
- apr_filepath_merge(&path,root_dir_path,"plugin",APR_FILEPATH_NATIVE,pool);
- apt_dir_layout_path_set_internal(dir_layout,APT_LAYOUT_PLUGIN_DIR,path);
-
- apr_filepath_merge(&path,root_dir_path,"log",APR_FILEPATH_NATIVE,pool);
- apt_dir_layout_path_set_internal(dir_layout,APT_LAYOUT_LOG_DIR,path);
-
- apr_filepath_merge(&path,root_dir_path,"data",APR_FILEPATH_NATIVE,pool);
- apt_dir_layout_path_set_internal(dir_layout,APT_LAYOUT_DATA_DIR,path);
-
- apr_filepath_merge(&path,root_dir_path,"var",APR_FILEPATH_NATIVE,pool);
- apt_dir_layout_path_set_internal(dir_layout,APT_LAYOUT_VAR_DIR,path);
- }
- return dir_layout;
-}
-
-APT_DECLARE(apt_dir_layout_t*) apt_custom_dir_layout_create(
- const char *conf_dir_path,
- const char *plugin_dir_path,
- const char *log_dir_path,
- const char *data_dir_path,
- const char *var_dir_path,
- apr_pool_t *pool)
-{
- apt_dir_layout_t *dir_layout = apt_dir_layout_create_ext(APT_LAYOUT_DIR_COUNT,pool);
-
- apt_dir_layout_path_set(dir_layout,APT_LAYOUT_CONF_DIR,conf_dir_path,pool);
- apt_dir_layout_path_set(dir_layout,APT_LAYOUT_PLUGIN_DIR,plugin_dir_path,pool);
- apt_dir_layout_path_set(dir_layout,APT_LAYOUT_LOG_DIR,log_dir_path,pool);
- apt_dir_layout_path_set(dir_layout,APT_LAYOUT_DATA_DIR,data_dir_path,pool);
- apt_dir_layout_path_set(dir_layout,APT_LAYOUT_VAR_DIR,log_dir_path,pool);
-
- return dir_layout;
-}
-
-static apt_bool_t apt_dir_entry_id_by_label(const char **labels, apr_size_t count, const char *name, apr_size_t *id)
-{
- apr_size_t i;
- for(i=0; ifirst_cdata.first || !elem->first_cdata.first->text) {
- return NULL;
- }
-
- path = apr_pstrdup(pool,elem->first_cdata.first->text);
- apr_collapse_spaces(path,path);
-
- /* Check if path is absolute or relative */
- status = apt_dir_is_path_absolute(path,pool);
- if(status == APR_SUCCESS) {
- /* Absolute path specified */
- return path;
- }
- else if (status == APR_ERELATIVE) {
- /* Relative path specified -> merge it with the root path */
- if(apr_filepath_merge(&full_path,root_dir_path,path,APR_FILEPATH_NATIVE,pool) == APR_SUCCESS) {
- return full_path;
- }
- }
-
- /* WARNING: invalid path specified */
- return NULL;
-}
-
-APT_DECLARE(apt_bool_t) apt_dir_layout_load(apt_dir_layout_t *dir_layout, const char *config_file, apr_pool_t *pool)
-{
- return apt_dir_layout_load_ext(dir_layout,config_file,default_labels,APT_LAYOUT_DIR_COUNT,pool);
-}
-
-APT_DECLARE(apt_bool_t) apt_dir_layout_load_ext(apt_dir_layout_t *dir_layout, const char *config_file, const char **labels, apr_size_t count, apr_pool_t *pool)
-{
- apr_xml_doc *doc;
- const apr_xml_elem *elem;
- const apr_xml_elem *root;
- const apr_xml_attr *xml_attr;
- char *path;
- const char *root_dir_path = NULL;
- apr_size_t id;
-
- if(!dir_layout || !config_file || !labels || !count) {
- return FALSE;
- }
-
- /* Parse XML document */
- doc = apt_dir_layout_doc_parse(config_file,pool);
- if(!doc) {
- return FALSE;
- }
-
- root = doc->root;
-
- /* Match document name */
- if(!root || strcasecmp(root->name,"dirlayout") != 0) {
- /* Unknown document */
- return FALSE;
- }
-
- /* Find rootdir attribute */
- for(xml_attr = root->attr; xml_attr; xml_attr = xml_attr->next) {
- if(strcasecmp(xml_attr->name, "rootdir") == 0) {
- root_dir_path = xml_attr->value;
- break;
- }
- }
-
- if(root_dir_path) {
- /* If root dir path is specified, check if it is absolute or relative */
- apr_status_t status = apt_dir_is_path_absolute(root_dir_path,pool);
- if(status == APR_ERELATIVE) {
- /* Relative path specified -> make it absolute */
- char *full_path;
- char *cur_dir_path;
- /* Get the current directory */
- if(apr_filepath_get(&cur_dir_path,APR_FILEPATH_NATIVE,pool) != APR_SUCCESS)
- return FALSE;
-
- /* Merge it with path specified */
- if(apr_filepath_merge(&full_path,cur_dir_path,root_dir_path,APR_FILEPATH_NATIVE,pool) != APR_SUCCESS)
- return FALSE;
- root_dir_path = full_path;
- }
- }
- else {
- /* If root dir path is not specified, get the default one */
- root_dir_path = apt_default_root_dir_path_get(pool);
- }
-
- /* Navigate through document */
- for(elem = root->first_child; elem; elem = elem->next) {
- if(apt_dir_entry_id_by_label(labels,dir_layout->count,elem->name,&id) == TRUE) {
- path = apt_dir_layout_subdir_parse(root_dir_path,elem,pool);
- if(path) {
- apt_dir_layout_path_set_internal(dir_layout,id,path);
- }
- }
- else {
- /* Unknown element */
- }
- }
- return TRUE;
-}
-
-APT_DECLARE(apt_bool_t) apt_dir_layout_path_set(apt_dir_layout_t *dir_layout, apr_size_t dir_entry_id, const char *path, apr_pool_t *pool)
-{
- if(!dir_layout || dir_entry_id >= dir_layout->count || !path)
- return FALSE;
-
- dir_layout->paths[dir_entry_id] = apr_pstrdup(pool,path);
- return TRUE;
-}
-
-APT_DECLARE(const char*) apt_dir_layout_path_get(const apt_dir_layout_t *dir_layout, apr_size_t dir_entry_id)
-{
- if(!dir_layout || dir_entry_id >= dir_layout->count)
- return NULL;
-
- return dir_layout->paths[dir_entry_id];
-}
-
-APT_DECLARE(char*) apt_dir_layout_path_compose(const apt_dir_layout_t *dir_layout, apr_size_t dir_entry_id, const char *file_name, apr_pool_t *pool)
-{
- char *file_path;
- if(!dir_layout || dir_entry_id >= dir_layout->count)
- return NULL;
-
- if(apr_filepath_merge(&file_path,dir_layout->paths[dir_entry_id],file_name,APR_FILEPATH_NATIVE,pool) == APR_SUCCESS) {
- return file_path;
- }
- return NULL;
-}
-
-APT_DECLARE(char*) apt_confdir_filepath_get(const apt_dir_layout_t *dir_layout, const char *file_name, apr_pool_t *pool)
-{
- return apt_dir_layout_path_compose(dir_layout,APT_LAYOUT_CONF_DIR,file_name,pool);
-}
-
-APT_DECLARE(char*) apt_datadir_filepath_get(const apt_dir_layout_t *dir_layout, const char *file_name, apr_pool_t *pool)
-{
- return apt_dir_layout_path_compose(dir_layout,APT_LAYOUT_DATA_DIR,file_name,pool);
-}
-
-APT_DECLARE(char*) apt_vardir_filepath_get(const apt_dir_layout_t *dir_layout, const char *file_name, apr_pool_t *pool)
-{
- return apt_dir_layout_path_compose(dir_layout,APT_LAYOUT_VAR_DIR,file_name,pool);
-}
diff --git a/libs/unimrcp/libs/apr-toolkit/src/apt_header_field.c b/libs/unimrcp/libs/apr-toolkit/src/apt_header_field.c
deleted file mode 100644
index a00fcb5ec5..0000000000
--- a/libs/unimrcp/libs/apr-toolkit/src/apt_header_field.c
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: apt_header_field.c 2223 2014-11-12 00:37:40Z achaloyan@gmail.com $
- */
-
-#include "apt_header_field.h"
-#include "apt_text_stream.h"
-
-#define UNKNOWN_HEADER_FIELD_ID (apr_size_t)-1
-
-/** Allocate an empty header field */
-APT_DECLARE(apt_header_field_t*) apt_header_field_alloc(apr_pool_t *pool)
-{
- apt_header_field_t *header_field = apr_palloc(pool,sizeof(apt_header_field_t));
- apt_string_reset(&header_field->name);
- apt_string_reset(&header_field->value);
- header_field->id = UNKNOWN_HEADER_FIELD_ID;
- APR_RING_ELEM_INIT(header_field,link);
- return header_field;
-}
-
-/** Create a header field using given name and value APT strings */
-APT_DECLARE(apt_header_field_t*) apt_header_field_create(const apt_str_t *name, const apt_str_t *value, apr_pool_t *pool)
-{
- apt_header_field_t *header_field;
- if(!name || !value) {
- return NULL;
- }
- header_field = apr_palloc(pool,sizeof(apt_header_field_t));
- apt_string_copy(&header_field->name,name,pool);
- apt_string_copy(&header_field->value,value,pool);
- header_field->id = UNKNOWN_HEADER_FIELD_ID;
- APR_RING_ELEM_INIT(header_field,link);
- return header_field;
-}
-
-/** Create a header field using given name and value C strings */
-APT_DECLARE(apt_header_field_t*) apt_header_field_create_c(const char *name, const char *value, apr_pool_t *pool)
-{
- apt_header_field_t *header_field;
- if(!name || !value) {
- return NULL;
- }
- header_field = apr_palloc(pool,sizeof(apt_header_field_t));
- apt_string_assign(&header_field->name,name,pool);
- apt_string_assign(&header_field->value,value,pool);
- header_field->id = UNKNOWN_HEADER_FIELD_ID;
- APR_RING_ELEM_INIT(header_field,link);
- return header_field;
-}
-
-/* Create a header field from entire text line consisting of a name and value pair */
-APT_DECLARE(apt_header_field_t*) apt_header_field_create_from_line(const apt_str_t *line, char separator, apr_pool_t *pool)
-{
- apt_str_t item;
- apt_text_stream_t stream;
- apt_header_field_t *header_field;
- if(!line) {
- return NULL;
- }
-
- header_field = apr_palloc(pool,sizeof(apt_header_field_t));
- stream.text = *line;
- apt_text_stream_reset(&stream);
-
- /* read name */
- if(apt_text_field_read(&stream,separator,TRUE,&item) == FALSE) {
- return NULL;
- }
- apt_string_copy(&header_field->name,&item,pool);
-
- /* read value */
- if(apt_text_field_read(&stream,0,TRUE,&item) == TRUE) {
- apt_string_copy(&header_field->value,&item,pool);
- }
- else {
- apt_string_reset(&header_field->value);
- }
-
- header_field->id = UNKNOWN_HEADER_FIELD_ID;
- APR_RING_ELEM_INIT(header_field,link);
- return header_field;
-}
-
-/** Copy specified header field */
-APT_DECLARE(apt_header_field_t*) apt_header_field_copy(const apt_header_field_t *src_header_field, apr_pool_t *pool)
-{
- apt_header_field_t *header_field = apr_palloc(pool,sizeof(apt_header_field_t));
- apt_string_copy(&header_field->name,&src_header_field->name,pool);
- apt_string_copy(&header_field->value,&src_header_field->value,pool);
- header_field->id = src_header_field->id;
- APR_RING_ELEM_INIT(header_field,link);
- return header_field;
-}
-
-/** Initialize header section (collection of header fields) */
-APT_DECLARE(void) apt_header_section_init(apt_header_section_t *header)
-{
- APR_RING_INIT(&header->ring, apt_header_field_t, link);
- header->arr = NULL;
- header->arr_size = 0;
-}
-
-/** Allocate header section to set/get header fields by numeric identifiers */
-APT_DECLARE(apt_bool_t) apt_header_section_array_alloc(apt_header_section_t *header, apr_size_t max_field_count, apr_pool_t *pool)
-{
- if(!max_field_count) {
- return FALSE;
- }
-
- header->arr = (apt_header_field_t**)apr_pcalloc(pool,sizeof(apt_header_field_t*) * max_field_count);
- header->arr_size = max_field_count;
- return TRUE;
-}
-
-/** Add (append) header field to header section */
-APT_DECLARE(apt_bool_t) apt_header_section_field_add(apt_header_section_t *header, apt_header_field_t *header_field)
-{
- if(header_field->id < header->arr_size) {
- if(header->arr[header_field->id]) {
- return FALSE;
- }
- header->arr[header_field->id] = header_field;
- }
- APR_RING_INSERT_TAIL(&header->ring,header_field,apt_header_field_t,link);
- return TRUE;
-}
-
-/** Insert header field to header section based on numreic identifier if specified */
-APT_DECLARE(apt_bool_t) apt_header_section_field_insert(apt_header_section_t *header, apt_header_field_t *header_field)
-{
- apt_header_field_t *it;
- if(header_field->id < header->arr_size) {
- if(header->arr[header_field->id]) {
- return FALSE;
- }
- header->arr[header_field->id] = header_field;
-
- for(it = APR_RING_FIRST(&header->ring);
- it != APR_RING_SENTINEL(&header->ring, apt_header_field_t, link);
- it = APR_RING_NEXT(it, link)) {
- if(header_field->id < it->id) {
- APR_RING_INSERT_BEFORE(it,header_field,link);
- return TRUE;
- }
- }
- }
-
- APR_RING_INSERT_TAIL(&header->ring,header_field,apt_header_field_t,link);
- return TRUE;
-}
-
-/** Set header field in the array of header fields using associated numeric identifier */
-APT_DECLARE(apt_bool_t) apt_header_section_field_set(apt_header_section_t *header, apt_header_field_t *header_field)
-{
- if(header_field->id >= header->arr_size) {
- return FALSE;
- }
- if(header->arr[header_field->id]) {
- return FALSE;
- }
- header->arr[header_field->id] = header_field;
- return TRUE;
-}
-
-/** Remove header field from header section */
-APT_DECLARE(apt_bool_t) apt_header_section_field_remove(apt_header_section_t *header, apt_header_field_t *header_field)
-{
- if(header_field->id < header->arr_size) {
- header->arr[header_field->id] = NULL;
- }
- APR_RING_REMOVE(header_field,link);
- return TRUE;
-}
diff --git a/libs/unimrcp/libs/apr-toolkit/src/apt_log.c b/libs/unimrcp/libs/apr-toolkit/src/apt_log.c
deleted file mode 100644
index 844946cf46..0000000000
--- a/libs/unimrcp/libs/apr-toolkit/src/apt_log.c
+++ /dev/null
@@ -1,627 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: apt_log.c 2198 2014-10-16 01:41:19Z achaloyan@gmail.com $
- */
-
-#include
-#include
-#include
-#include
-#include "apt_log.h"
-
-#define MAX_LOG_ENTRY_SIZE 4096
-#define MAX_PRIORITY_NAME_LENGTH 9
-
-static const char priority_snames[APT_PRIO_COUNT][MAX_PRIORITY_NAME_LENGTH+1] =
-{
- "[EMERG] ",
- "[ALERT] ",
- "[CRITIC] ",
- "[ERROR] ",
- "[WARN] ",
- "[NOTICE] ",
- "[INFO] ",
- "[DEBUG] "
-};
-
-typedef struct apt_log_file_data_t apt_log_file_data_t;
-
-struct apt_log_file_data_t {
- const char *log_dir_path;
- const char *log_file_name;
- FILE *file;
- apr_size_t cur_size;
- apr_size_t max_size;
- apr_size_t cur_file_index;
- apr_size_t max_file_count;
- apt_bool_t append;
- apr_thread_mutex_t *mutex;
- apr_pool_t *pool;
-};
-
-struct apt_logger_t {
- apt_log_output_e mode;
- apt_log_priority_e priority;
- int header;
- apt_log_ext_handler_f ext_handler;
- apt_log_file_data_t *file_data;
- apt_log_masking_e masking;
-};
-
-static apt_logger_t *apt_logger = NULL;
-
-static apt_bool_t apt_do_log(const char *file, int line, apt_log_priority_e priority, const char *format, va_list arg_ptr);
-
-static const char* apt_log_file_path_make(apt_log_file_data_t *file_data);
-static apt_bool_t apt_log_file_dump(apt_log_file_data_t *file_data, const char *log_entry, apr_size_t size);
-static apr_xml_doc* apt_log_doc_parse(const char *file_path, apr_pool_t *pool);
-static apr_size_t apt_log_file_get_size(apt_log_file_data_t *file_data);
-static apr_byte_t apt_log_file_exist(apt_log_file_data_t *file_data);
-
-static apt_logger_t* apt_log_instance_alloc(apr_pool_t *pool)
-{
- apt_logger_t *logger = apr_palloc(pool,sizeof(apt_logger_t));
- logger->mode = APT_LOG_OUTPUT_CONSOLE;
- logger->priority = APT_PRIO_INFO;
- logger->header = APT_LOG_HEADER_DEFAULT;
- logger->ext_handler = NULL;
- logger->file_data = NULL;
- logger->masking = APT_LOG_MASKING_NONE;
- return logger;
-}
-
-APT_DECLARE(apt_bool_t) apt_log_instance_create(apt_log_output_e mode, apt_log_priority_e priority, apr_pool_t *pool)
-{
- if(apt_logger) {
- return FALSE;
- }
- apt_logger = apt_log_instance_alloc(pool);
- apt_logger->mode = mode;
- apt_logger->priority = priority;
- return TRUE;
-}
-
-APT_DECLARE(apt_bool_t) apt_log_instance_load(const char *config_file, apr_pool_t *pool)
-{
- apr_xml_doc *doc;
- const apr_xml_elem *elem;
- const apr_xml_elem *root;
- char *text;
-
- if(apt_logger) {
- return FALSE;
- }
- apt_logger = apt_log_instance_alloc(pool);
-
- /* Parse XML document */
- doc = apt_log_doc_parse(config_file,pool);
- if(!doc) {
- return FALSE;
- }
-
- root = doc->root;
-
- /* Match document name */
- if(!root || strcasecmp(root->name,"aptlogger") != 0) {
- /* Unknown document */
- return FALSE;
- }
-
- /* Navigate through document */
- for(elem = root->first_child; elem; elem = elem->next) {
- if(!elem->first_cdata.first || !elem->first_cdata.first->text)
- continue;
-
- text = apr_pstrdup(pool,elem->first_cdata.first->text);
- apr_collapse_spaces(text,text);
-
- if(strcasecmp(elem->name,"priority") == 0) {
- apt_logger->priority = apt_log_priority_translate(text);
- }
- else if(strcasecmp(elem->name,"output") == 0) {
- apt_logger->mode = apt_log_output_mode_translate(text);
- }
- else if(strcasecmp(elem->name,"headers") == 0) {
- apt_logger->header = apt_log_header_translate(text);
- }
- else if(strcasecmp(elem->name,"masking") == 0) {
- apt_logger->masking = apt_log_masking_translate(text);
- }
- else {
- /* Unknown element */
- }
- }
- return TRUE;
-}
-
-APT_DECLARE(apt_bool_t) apt_log_instance_destroy()
-{
- if(!apt_logger) {
- return FALSE;
- }
-
- if(apt_logger->file_data) {
- apt_log_file_close();
- }
- apt_logger = NULL;
- return TRUE;
-}
-
-APT_DECLARE(apt_logger_t*) apt_log_instance_get()
-{
- return apt_logger;
-}
-
-APT_DECLARE(apt_bool_t) apt_log_instance_set(apt_logger_t *logger)
-{
- if(apt_logger){
- return FALSE;
- }
- apt_logger = logger;
- return TRUE;
-}
-
-APT_DECLARE(apt_bool_t) apt_log_file_open(
- const char *dir_path,
- const char *file_name,
- apr_size_t max_file_size,
- apr_size_t max_file_count,
- apt_bool_t append,
- apr_pool_t *pool)
-{
- const char *log_file_path;
- apt_log_file_data_t *file_data;
- if(!apt_logger || !dir_path || !file_name) {
- return FALSE;
- }
-
- if(apt_logger->file_data) {
- return FALSE;
- }
-
- file_data = apr_palloc(pool,sizeof(apt_log_file_data_t));
- file_data->log_dir_path = apr_pstrdup(pool,dir_path);
- file_data->log_file_name = apr_pstrdup(pool,file_name);
- file_data->cur_file_index = 0;
- file_data->cur_size = 0;
- file_data->max_file_count = max_file_count;
- file_data->max_size = max_file_size;
- file_data->append = append;
- file_data->mutex = NULL;
- file_data->pool = pool;
-
- if(!file_data->max_size) {
- file_data->max_size = MAX_LOG_FILE_SIZE;
- }
- if(!file_data->max_file_count) {
- file_data->max_file_count = MAX_LOG_FILE_COUNT;
- }
-
- if(file_data->append == TRUE) {
- /* iteratively find the last created file */
- while(file_data->cur_file_indexmax_file_count)
- {
- if(apt_log_file_exist(file_data) == 0)
- {
- if(file_data->cur_file_index > 0)
- file_data->cur_file_index--;
- file_data->cur_size = apt_log_file_get_size(file_data);
- break;
- }
- file_data->cur_file_index++;
- }
-
- /* if all the files have been created start rewriting from beginning */
- if(file_data->cur_file_index>=file_data->max_file_count)
- {
- file_data->cur_file_index=0;
- file_data->cur_size=0;
- log_file_path = apt_log_file_path_make(file_data);
- file_data->file = fopen(log_file_path,"wb"); /* truncate the first file to zero length */
- fclose(file_data->file);
- }
- }
-
- /* create mutex */
- if(apr_thread_mutex_create(&file_data->mutex,APR_THREAD_MUTEX_DEFAULT,pool) != APR_SUCCESS) {
- return FALSE;
- }
- /* open log file */
- log_file_path = apt_log_file_path_make(file_data);
- file_data->file = fopen(log_file_path,file_data->append == TRUE ? "ab" : "wb");
- if(!file_data->file) {
- apr_thread_mutex_destroy(file_data->mutex);
- return FALSE;
- }
-
- apt_logger->file_data = file_data;
- return TRUE;
-}
-
-APT_DECLARE(apt_bool_t) apt_log_file_close()
-{
- apt_log_file_data_t *file_data;
- if(!apt_logger || !apt_logger->file_data) {
- return FALSE;
- }
- file_data = apt_logger->file_data;
- if(file_data->file) {
- /* close log file */
- fclose(file_data->file);
- file_data->file = NULL;
- /* destroy mutex */
- apr_thread_mutex_destroy(file_data->mutex);
- file_data->mutex = NULL;
- }
- apt_logger->file_data = NULL;
- return TRUE;
-}
-
-APT_DECLARE(apt_bool_t) apt_log_output_mode_set(apt_log_output_e mode)
-{
- if(!apt_logger) {
- return FALSE;
- }
- apt_logger->mode = mode;
- return TRUE;
-}
-
-APT_DECLARE(apt_bool_t) apt_log_output_mode_check(apt_log_output_e mode)
-{
- if(!apt_logger) {
- return FALSE;
- }
- return (apt_logger->mode & mode) ? TRUE : FALSE;
-}
-
-APT_DECLARE(int) apt_log_output_mode_translate(char *str)
-{
- int mode = APT_LOG_OUTPUT_NONE;
- char *name;
- char *last;
- name = apr_strtok(str, ",", &last);
- while(name) {
- if(strcasecmp(name, "CONSOLE") == 0)
- mode |= APT_LOG_OUTPUT_CONSOLE;
- else if(strcasecmp(name, "FILE") == 0)
- mode |= APT_LOG_OUTPUT_FILE;
-
- name = apr_strtok(NULL, ",", &last);
- }
- return mode;
-}
-
-APT_DECLARE(apt_bool_t) apt_log_priority_set(apt_log_priority_e priority)
-{
- if(!apt_logger || priority >= APT_PRIO_COUNT) {
- return FALSE;
- }
- apt_logger->priority = priority;
- return TRUE;
-}
-
-APT_DECLARE(apt_log_priority_e) apt_log_priority_translate(const char *str)
-{
- if(strcasecmp(str, "EMERGENCY") == 0)
- return APT_PRIO_EMERGENCY;
- else if(strcasecmp(str, "ALERT") == 0)
- return APT_PRIO_ALERT;
- else if(strcasecmp(str, "CRITICAL") == 0)
- return APT_PRIO_CRITICAL;
- else if(strcasecmp(str, "ERROR") == 0)
- return APT_PRIO_ERROR;
- else if(strcasecmp(str, "WARNING") == 0)
- return APT_PRIO_WARNING;
- else if(strcasecmp(str, "NOTICE") == 0)
- return APT_PRIO_NOTICE;
- else if(strcasecmp(str, "INFO") == 0)
- return APT_PRIO_INFO;
- else if(strcasecmp(str, "DEBUG") == 0)
- return APT_PRIO_DEBUG;
-
- return APT_PRIO_DEBUG;
-}
-
-APT_DECLARE(apt_bool_t) apt_log_header_set(int header)
-{
- if(!apt_logger) {
- return FALSE;
- }
- apt_logger->header = header;
- return TRUE;
-}
-
-APT_DECLARE(int) apt_log_header_translate(char *str)
-{
- int header = APT_LOG_OUTPUT_NONE;
- char *name;
- char *last;
- name = apr_strtok(str, ",", &last);
- while(name) {
- if(strcasecmp(name, "DATE") == 0)
- header |= APT_LOG_HEADER_DATE;
- else if(strcasecmp(name, "TIME") == 0)
- header |= APT_LOG_HEADER_TIME;
- else if(strcasecmp(name, "PRIORITY") == 0)
- header |= APT_LOG_HEADER_PRIORITY;
- else if(strcasecmp(name, "MARK") == 0)
- header |= APT_LOG_HEADER_MARK;
- else if(strcasecmp(name, "THREAD") == 0)
- header |= APT_LOG_HEADER_THREAD;
-
- name = apr_strtok(NULL, ",", &last);
- }
- return header;
-}
-
-APT_DECLARE(apt_bool_t) apt_log_masking_set(apt_log_masking_e masking)
-{
- if(!apt_logger) {
- return FALSE;
- }
- apt_logger->masking = masking;
- return TRUE;
-}
-
-APT_DECLARE(apt_log_masking_e) apt_log_masking_get(void)
-{
- if(!apt_logger) {
- return APT_LOG_MASKING_NONE;
- }
- return apt_logger->masking;
-}
-
-APT_DECLARE(apt_log_masking_e) apt_log_masking_translate(const char *str)
-{
- if(strcasecmp(str, "COMPLETE") == 0)
- return APT_LOG_MASKING_COMPLETE;
- else if(strcasecmp(str, "ENCRYPTED") == 0)
- return APT_LOG_MASKING_ENCRYPTED;
- return APT_LOG_MASKING_NONE;
-}
-
-#define APT_MASKED_CONTENT "*** masked ***"
-
-APT_DECLARE(const char*) apt_log_data_mask(const char *data_in, apr_size_t *length, apr_pool_t *pool)
-{
- if(!apt_logger) {
- return NULL;
- }
- if(apt_logger->masking == APT_LOG_MASKING_COMPLETE) {
- *length = sizeof(APT_MASKED_CONTENT) - 1;
- return APT_MASKED_CONTENT;
- }
- return data_in;
-}
-
-APT_DECLARE(apt_bool_t) apt_log_ext_handler_set(apt_log_ext_handler_f handler)
-{
- if(!apt_logger) {
- return FALSE;
- }
- apt_logger->ext_handler = handler;
- return TRUE;
-}
-
-APT_DECLARE(apt_bool_t) apt_log(const char *file, int line, apt_log_priority_e priority, const char *format, ...)
-{
- apt_bool_t status = TRUE;
- if(!apt_logger) {
- return FALSE;
- }
- if(priority <= apt_logger->priority) {
- va_list arg_ptr;
- va_start(arg_ptr, format);
- if(apt_logger->ext_handler) {
- status = apt_logger->ext_handler(file,line,NULL,priority,format,arg_ptr);
- }
- else {
- status = apt_do_log(file,line,priority,format,arg_ptr);
- }
- va_end(arg_ptr);
- }
- return status;
-}
-
-APT_DECLARE(apt_bool_t) apt_obj_log(const char *file, int line, apt_log_priority_e priority, void *obj, const char *format, ...)
-{
- apt_bool_t status = TRUE;
- if(!apt_logger) {
- return FALSE;
- }
- if(priority <= apt_logger->priority) {
- va_list arg_ptr;
- va_start(arg_ptr, format);
- if(apt_logger->ext_handler) {
- status = apt_logger->ext_handler(file,line,obj,priority,format,arg_ptr);
- }
- else {
- status = apt_do_log(file,line,priority,format,arg_ptr);
- }
- va_end(arg_ptr);
- }
- return status;
-}
-
-APT_DECLARE(apt_bool_t) apt_va_log(const char *file, int line, apt_log_priority_e priority, const char *format, va_list arg_ptr)
-{
- apt_bool_t status = TRUE;
- if(!apt_logger) {
- return FALSE;
- }
- if(priority <= apt_logger->priority) {
- if(apt_logger->ext_handler) {
- status = apt_logger->ext_handler(file,line,NULL,priority,format,arg_ptr);
- }
- else {
- status = apt_do_log(file,line,priority,format,arg_ptr);
- }
- }
- return status;
-}
-
-static APR_INLINE unsigned long apt_thread_id_get(void)
-{
-#ifdef WIN32
- return (unsigned long) GetCurrentThreadId();
-#else
- return (unsigned long) apr_os_thread_current();
-#endif
-}
-
-static apt_bool_t apt_do_log(const char *file, int line, apt_log_priority_e priority, const char *format, va_list arg_ptr)
-{
- char log_entry[MAX_LOG_ENTRY_SIZE];
- apr_size_t max_size = MAX_LOG_ENTRY_SIZE - 2;
- apr_size_t offset = 0;
- apr_time_exp_t result;
- apr_time_t now = apr_time_now();
- apr_time_exp_lt(&result,now);
-
- if(apt_logger->header & APT_LOG_HEADER_DATE) {
- offset += apr_snprintf(log_entry+offset,max_size-offset,"%4d-%02d-%02d ",
- result.tm_year+1900,
- result.tm_mon+1,
- result.tm_mday);
- }
- if(apt_logger->header & APT_LOG_HEADER_TIME) {
- offset += apr_snprintf(log_entry+offset,max_size-offset,"%02d:%02d:%02d:%06d ",
- result.tm_hour,
- result.tm_min,
- result.tm_sec,
- result.tm_usec);
- }
- if(apt_logger->header & APT_LOG_HEADER_MARK) {
- offset += apr_snprintf(log_entry+offset,max_size-offset,"%s:%03d ",file,line);
- }
- if(apt_logger->header & APT_LOG_HEADER_THREAD) {
- offset += apr_snprintf(log_entry+offset,max_size-offset,"%05lu ",apt_thread_id_get());
- }
- if(apt_logger->header & APT_LOG_HEADER_PRIORITY) {
- memcpy(log_entry+offset,priority_snames[priority],MAX_PRIORITY_NAME_LENGTH);
- offset += MAX_PRIORITY_NAME_LENGTH;
- }
-
- offset += apr_vsnprintf(log_entry+offset,max_size-offset,format,arg_ptr);
- log_entry[offset++] = '\n';
- log_entry[offset] = '\0';
- if((apt_logger->mode & APT_LOG_OUTPUT_CONSOLE) == APT_LOG_OUTPUT_CONSOLE) {
- fwrite(log_entry,offset,1,stdout);
- }
-
- if((apt_logger->mode & APT_LOG_OUTPUT_FILE) == APT_LOG_OUTPUT_FILE && apt_logger->file_data) {
- apt_log_file_dump(apt_logger->file_data,log_entry,offset);
- }
- return TRUE;
-}
-
-static const char* apt_log_file_path_make(apt_log_file_data_t *file_data)
-{
- char *log_file_path = NULL;
- const char *log_file_name = apr_psprintf(file_data->pool,"%s-%.2"APR_SIZE_T_FMT".log",
- file_data->log_file_name,
- file_data->cur_file_index);
- apr_filepath_merge(&log_file_path,
- file_data->log_dir_path,
- log_file_name,
- APR_FILEPATH_NATIVE,
- file_data->pool);
- return log_file_path;
-}
-
-static apr_size_t apt_log_file_get_size(apt_log_file_data_t *file_data)
-{
- FILE* fp;
- const char *log_file_path;
- apr_size_t ret;
-
- log_file_path = apt_log_file_path_make(file_data);
- fp = fopen(log_file_path,"rb");
-
- if(!fp) return 0;
-
- fseek(fp,0,SEEK_END);
- ret = ftell(fp);
-
- fclose(fp);
-
- return ret;
-}
-
-static apr_byte_t apt_log_file_exist(apt_log_file_data_t *file_data)
-{
- FILE* fp;
- const char *log_file_path;
-
- log_file_path = apt_log_file_path_make(file_data);
- fp = fopen(log_file_path,"rb");
-
- if(!fp) return 0;
-
- fclose(fp);
-
- return 1;
-}
-
-static apt_bool_t apt_log_file_dump(apt_log_file_data_t *file_data, const char *log_entry, apr_size_t size)
-{
- apr_thread_mutex_lock(file_data->mutex);
-
- file_data->cur_size += size;
- if(file_data->cur_size > file_data->max_size) {
- const char *log_file_path;
- /* close current log file */
- fclose(file_data->file);
- /* roll over the next log file */
- file_data->cur_file_index++;
- file_data->cur_file_index %= file_data->max_file_count;
- /* open log file */
- log_file_path = apt_log_file_path_make(file_data);
- file_data->file = fopen(log_file_path,"wb");
- if(!file_data->file) {
- return FALSE;
- }
-
- file_data->cur_size = size;
- }
- /* write to log file */
- fwrite(log_entry,1,size,file_data->file);
- fflush(file_data->file);
-
- apr_thread_mutex_unlock(file_data->mutex);
- return TRUE;
-}
-
-static apr_xml_doc* apt_log_doc_parse(const char *file_path, apr_pool_t *pool)
-{
- apr_xml_parser *parser = NULL;
- apr_xml_doc *xml_doc = NULL;
- apr_file_t *fd = NULL;
- apr_status_t rv;
-
- rv = apr_file_open(&fd,file_path,APR_READ|APR_BINARY,0,pool);
- if(rv != APR_SUCCESS) {
- return NULL;
- }
-
- rv = apr_xml_parse_file(pool,&parser,&xml_doc,fd,2000);
- if(rv != APR_SUCCESS) {
- xml_doc = NULL;
- }
-
- apr_file_close(fd);
- return xml_doc;
-}
diff --git a/libs/unimrcp/libs/apr-toolkit/src/apt_multipart_content.c b/libs/unimrcp/libs/apr-toolkit/src/apt_multipart_content.c
deleted file mode 100644
index 46254723ab..0000000000
--- a/libs/unimrcp/libs/apr-toolkit/src/apt_multipart_content.c
+++ /dev/null
@@ -1,312 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: apt_multipart_content.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include
-#include "apt_multipart_content.h"
-#include "apt_text_stream.h"
-#include "apt_text_message.h"
-
-#define CONTENT_LENGTH_HEADER "Content-Length"
-#define CONTENT_TYPE_HEADER "Content-Type"
-#define CONTENT_ID_HEADER "Content-Id"
-
-#define DEFAULT_BOUNDARY "break"
-#define DEFAULT_HYPHENS "--"
-
-#define DEFAULT_MULTIPART_CONTENT_SIZE 4096
-
-/** Multipart content */
-struct apt_multipart_content_t {
- apr_pool_t *pool;
- apt_text_stream_t stream;
-
- apt_str_t boundary;
- apt_str_t hyphens;
-};
-
-/** Create an empty multipart content */
-APT_DECLARE(apt_multipart_content_t*) apt_multipart_content_create(apr_size_t max_content_size, const apt_str_t *boundary, apr_pool_t *pool)
-{
- char *buffer;
- apt_multipart_content_t *multipart_content = apr_palloc(pool,sizeof(apt_multipart_content_t));
- multipart_content->pool = pool;
-
- if(max_content_size == 0) {
- max_content_size = DEFAULT_MULTIPART_CONTENT_SIZE;
- }
-
- if(boundary) {
- multipart_content->boundary = *boundary;
- }
- else {
- multipart_content->boundary.buf = DEFAULT_BOUNDARY;
- multipart_content->boundary.length = sizeof(DEFAULT_BOUNDARY)-1;
- }
-
- multipart_content->hyphens.buf = DEFAULT_HYPHENS;
- multipart_content->hyphens.length = sizeof(DEFAULT_HYPHENS)-1;
-
- buffer = apr_palloc(pool,max_content_size+1);
- apt_text_stream_init(&multipart_content->stream,buffer,max_content_size);
- return multipart_content;
-}
-
-/** Initialize content part generation */
-static apt_bool_t apt_multipart_content_initialize(apt_multipart_content_t *multipart_content)
-{
- /* insert preceding end-of-line */
- if(apt_text_eol_insert(&multipart_content->stream) == FALSE) {
- return FALSE;
- }
- /* insert hyphens */
- if(apt_text_string_insert(&multipart_content->stream,&multipart_content->hyphens) == FALSE) {
- return FALSE;
- }
- /* insert boundary */
- if(apt_text_string_insert(&multipart_content->stream,&multipart_content->boundary) == FALSE) {
- return FALSE;
- }
- return apt_text_eol_insert(&multipart_content->stream);
-}
-
-/** Add content part to multipart content */
-APT_DECLARE(apt_bool_t) apt_multipart_content_add(apt_multipart_content_t *multipart_content, const apt_content_part_t *content_part)
-{
- if(!content_part) {
- return FALSE;
- }
-
- /* insert preceding eol, hyppens and boudnary */
- if(apt_multipart_content_initialize(multipart_content) == FALSE) {
- return FALSE;
- }
-
- /* insert header fields */
- if(apt_header_section_generate(&content_part->header,&multipart_content->stream) == FALSE) {
- return FALSE;
- }
-
- /* insert body */
- return apt_text_string_insert(&multipart_content->stream,&content_part->body);
-}
-
-/** Add content part to multipart content by specified header fields and body */
-APT_DECLARE(apt_bool_t) apt_multipart_content_add2(apt_multipart_content_t *multipart_content, const apt_str_t *content_type, const apt_str_t *content_id, const apt_str_t *body)
-{
- /* insert preceding eol, hyppens and boudnary */
- if(apt_multipart_content_initialize(multipart_content) == FALSE) {
- return FALSE;
- }
-
- /* insert content-type */
- if(content_type) {
- apt_str_t name = {CONTENT_TYPE_HEADER,sizeof(CONTENT_TYPE_HEADER)-1};
- if(apt_text_name_value_insert(&multipart_content->stream,&name,content_type) == FALSE) {
- return FALSE;
- }
- }
-
- /* insert content-id */
- if(content_id) {
- apt_str_t name = {CONTENT_ID_HEADER,sizeof(CONTENT_ID_HEADER)-1};
- if(apt_text_name_value_insert(&multipart_content->stream,&name,content_id) == FALSE) {
- return FALSE;
- }
- }
-
- /* insert content-length */
- if(body) {
- apt_str_t name = {CONTENT_LENGTH_HEADER,sizeof(CONTENT_LENGTH_HEADER)-1};
- if(apt_text_header_name_insert(&multipart_content->stream,&name) == FALSE) {
- return FALSE;
- }
- if(apt_text_size_value_insert(&multipart_content->stream,body->length) == FALSE) {
- return FALSE;
- }
- if(apt_text_eol_insert(&multipart_content->stream) == FALSE) {
- return FALSE;
- }
- }
-
- /* insert empty line */
- if(apt_text_eol_insert(&multipart_content->stream) == FALSE) {
- return FALSE;
- }
-
- /* insert body */
- if(body) {
- if(apt_text_string_insert(&multipart_content->stream,body) == FALSE) {
- return FALSE;
- }
- }
- return TRUE;
-}
-
-/** Finalize multipart content generation */
-APT_DECLARE(apt_str_t*) apt_multipart_content_finalize(apt_multipart_content_t *multipart_content)
-{
- apt_text_stream_t *stream = &multipart_content->stream;
- /* insert preceding end-of-line */
- if(apt_text_eol_insert(&multipart_content->stream) == FALSE) {
- return NULL;
- }
- /* insert hyphens */
- if(apt_text_string_insert(&multipart_content->stream,&multipart_content->hyphens) == FALSE) {
- return NULL;
- }
- /* insert boundary */
- if(apt_text_string_insert(&multipart_content->stream,&multipart_content->boundary) == FALSE) {
- return NULL;
- }
- /* insert final hyphens */
- if(apt_text_string_insert(&multipart_content->stream,&multipart_content->hyphens) == FALSE) {
- return NULL;
- }
- if(apt_text_eol_insert(&multipart_content->stream) == FALSE) {
- return NULL;
- }
-
- stream->text.length = stream->pos - stream->text.buf;
- stream->text.buf[stream->text.length] = '\0';
- return &stream->text;
-}
-
-
-/** Assign body to multipart content to get (parse) each content part from */
-APT_DECLARE(apt_multipart_content_t*) apt_multipart_content_assign(const apt_str_t *body, const apt_str_t *boundary, apr_pool_t *pool)
-{
- apt_multipart_content_t *multipart_content = apr_palloc(pool,sizeof(apt_multipart_content_t));
- multipart_content->pool = pool;
-
- if(!body) {
- return FALSE;
- }
-
- if(boundary) {
- multipart_content->boundary = *boundary;
- }
- else {
- apt_string_reset(&multipart_content->boundary);
- }
-
- apt_string_reset(&multipart_content->hyphens);
- apt_text_stream_init(&multipart_content->stream,body->buf,body->length);
- return multipart_content;
-}
-
-static APR_INLINE void apt_content_part_reset(apt_content_part_t *content_part)
-{
- apt_header_section_init(&content_part->header);
- apt_string_reset(&content_part->body);
- content_part->type = NULL;
- content_part->id = NULL;
- content_part->length = NULL;
-}
-
-/** Get the next content part */
-APT_DECLARE(apt_bool_t) apt_multipart_content_get(apt_multipart_content_t *multipart_content, apt_content_part_t *content_part, apt_bool_t *is_final)
-{
- apt_str_t boundary;
- apt_header_field_t *header_field;
- apt_text_stream_t *stream = &multipart_content->stream;
-
- if(!content_part || !is_final) {
- return FALSE;
- }
- *is_final = FALSE;
- apt_content_part_reset(content_part);
-
- /* skip preamble */
- apt_text_skip_to_char(stream,'-');
- if(apt_text_is_eos(stream) == TRUE) {
- return FALSE;
- }
-
- /* skip initial hyphens */
- apt_text_chars_skip(stream,'-');
- if(apt_text_is_eos(stream) == TRUE) {
- return FALSE;
- }
-
- /* read line and the boundary */
- if(apt_text_line_read(stream,&boundary) == FALSE) {
- return FALSE;
- }
-
- /* remove optional trailing spaces */
- while(boundary.length && boundary.buf[boundary.length-1] == APT_TOKEN_SP) boundary.length--;
-
- /* check whether this is the final boundary */
- if(boundary.length >= 2) {
- if(boundary.buf[boundary.length-1] == '-' && boundary.buf[boundary.length-2] == '-') {
- /* final boundary */
- boundary.length -= 2;
- *is_final = TRUE;
- }
- }
-
- /* compare boundaries */
- if(apt_string_is_empty(&multipart_content->boundary) == TRUE) {
- /* no boundary was specified from user space,
- learn boundary from the content */
- multipart_content->boundary = boundary;
- }
- else {
- if(apt_string_compare(&multipart_content->boundary,&boundary) == FALSE) {
- /* invalid boundary */
- return FALSE;
- }
- }
-
- if(*is_final == TRUE) {
- /* final boundary => return TRUE, content remains empty */
- return TRUE;
- }
-
- /* read header fields */
- if(apt_header_section_parse(&content_part->header,stream,multipart_content->pool) == FALSE) {
- return FALSE;
- }
-
- for(header_field = APR_RING_FIRST(&content_part->header.ring);
- header_field != APR_RING_SENTINEL(&content_part->header.ring, apt_header_field_t, link);
- header_field = APR_RING_NEXT(header_field, link)) {
- if(strncmp(header_field->name.buf,CONTENT_LENGTH_HEADER,header_field->name.length) == 0) {
- content_part->length = &header_field->value;
- }
- else if(strncmp(header_field->name.buf,CONTENT_TYPE_HEADER,header_field->name.length) == 0) {
- content_part->type = &header_field->value;
- }
- else if(strncmp(header_field->name.buf,CONTENT_ID_HEADER,header_field->name.length) == 0) {
- content_part->id = &header_field->value;
- }
- }
-
- if(content_part->length && apt_string_is_empty(content_part->length) == FALSE) {
- apr_size_t length = atoi(content_part->length->buf);
- if(length + stream->pos > stream->end) {
- return FALSE;
- }
-
- /* read content */
- apt_string_assign_n(&content_part->body,stream->pos,length,multipart_content->pool);
- stream->pos += length;
- }
-
- return TRUE;
-}
diff --git a/libs/unimrcp/libs/apr-toolkit/src/apt_net.c b/libs/unimrcp/libs/apr-toolkit/src/apt_net.c
deleted file mode 100644
index 398c71a99c..0000000000
--- a/libs/unimrcp/libs/apr-toolkit/src/apt_net.c
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: apt_net.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include
-#include "apt_net.h"
-#include "apt_log.h"
-
-/** Get the IP address (in numeric address string format) by hostname */
-apt_bool_t apt_ip_get(char **addr, apr_pool_t *pool)
-{
- apr_sockaddr_t *sockaddr = NULL;
- char hostname[APRMAXHOSTLEN+1];
- if(apr_gethostname(hostname,sizeof(hostname),pool) != APR_SUCCESS) {
- return FALSE;
- }
- if(apr_sockaddr_info_get(&sockaddr,hostname,APR_INET,0,0,pool) != APR_SUCCESS) {
- return FALSE;
- }
- if(apr_sockaddr_ip_get(addr,sockaddr) != APR_SUCCESS) {
- return FALSE;
- }
- return TRUE;
-}
-
-#ifdef WIN32
-#include
-#pragma comment(lib, "IPHLPAPI.lib")
-#else
-#include
-#include
-#endif
-
-/** Get the IP address (in numeric address string format) by network interface name */
-apt_bool_t apt_ip_get_by_iface(const char *iface_name, char **addr, apr_pool_t *pool)
-{
- apt_bool_t status = FALSE;
-#ifdef WIN32
- /* See the usage of GetAdaptersInfo().
- * http://msdn.microsoft.com/en-us/library/windows/desktop/aa366314%28v=vs.85%29.aspx
- */
- IP_ADAPTER_INFO *pAdapterInfo;
- PIP_ADAPTER_INFO pAdapter;
- ULONG ulOutBufLen;
- DWORD dwRetVal;
-
- pAdapterInfo = (IP_ADAPTER_INFO *) malloc(sizeof(IP_ADAPTER_INFO));
- ulOutBufLen = sizeof(IP_ADAPTER_INFO);
-
- /* Make an initial call to GetAdaptersInfo to get the size needed into the ulOutBufLen variable. */
- if(GetAdaptersInfo(pAdapterInfo, &ulOutBufLen) != ERROR_SUCCESS) {
- free(pAdapterInfo);
- pAdapterInfo = (IP_ADAPTER_INFO *) malloc(ulOutBufLen);
- }
-
- /* Make a second call to GetAdaptersInfo, passing pAdapterInfo and ulOutBufLen as parameters. */
- if((dwRetVal = GetAdaptersInfo(pAdapterInfo, &ulOutBufLen)) != ERROR_SUCCESS) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Get Adapters Info %d", dwRetVal);
- return FALSE;
- }
-
- /* Walk through linked list, maintaining head pointer. */
- pAdapter = pAdapterInfo;
- while(pAdapter) {
- /* Match human readable description with specified name. */
- if(strcasecmp(pAdapter->Description,iface_name) == 0) {
- *addr = apr_pstrdup(pool,pAdapter->IpAddressList.IpAddress.String);
- status = TRUE;
- break;
- }
-
- pAdapter = pAdapter->Next;
- }
-
- if (pAdapterInfo)
- free(pAdapterInfo);
-
-#else
-
- struct ifaddrs *ifaddr, *ifa;
- int family, n;
- char host[NI_MAXHOST];
-
- if(getifaddrs(&ifaddr) == -1) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Get Interfaces");
- return FALSE;
- }
-
- /* Walk through linked list, maintaining head pointer. */
- for(ifa = ifaddr, n = 0; ifa != NULL; ifa = ifa->ifa_next, n++) {
- if(ifa->ifa_addr == NULL) continue;
-
- family = ifa->ifa_addr->sa_family;
- if(family == AF_INET || family == AF_INET6) {
- if(strcasecmp(ifa->ifa_name,iface_name) == 0) {
- if(getnameinfo(ifa->ifa_addr,
- (family == AF_INET) ? sizeof(struct sockaddr_in) :
- sizeof(struct sockaddr_in6),
- host, NI_MAXHOST,
- NULL, 0, NI_NUMERICHOST) == 0) {
- *addr = apr_pstrdup(pool,host);
- status = TRUE;
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Get Name Info");
- }
- break;
- }
- }
- }
-
- freeifaddrs(ifaddr);
-#endif
-
- if(status == TRUE) {
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Found Address %s by Interface [%s]", *addr, iface_name);
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"No Such Interface Found [%s]", iface_name);
- }
- return status;
-}
-
-/** Seconds from Jan 1 1900 to Jan 1 1970 */
-#define NTP_TIME_OFFSET 2208988800UL
-
-/** Get current NTP time */
-void apt_ntp_time_get(apr_uint32_t *sec, apr_uint32_t *frac)
-{
- apr_uint32_t t;
- apr_uint32_t usec;
-
- apr_time_t now = apr_time_now();
- *sec = (apr_uint32_t)apr_time_sec(now) + NTP_TIME_OFFSET;
-
- usec = (apr_uint32_t) apr_time_usec(now);
- t = (usec * 1825) >> 5;
- *frac = ((usec << 12) + (usec << 8) - t);
-}
diff --git a/libs/unimrcp/libs/apr-toolkit/src/apt_nlsml_doc.c b/libs/unimrcp/libs/apr-toolkit/src/apt_nlsml_doc.c
deleted file mode 100644
index d6c866c0b6..0000000000
--- a/libs/unimrcp/libs/apr-toolkit/src/apt_nlsml_doc.c
+++ /dev/null
@@ -1,569 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: apt_nlsml_doc.c 2177 2014-09-12 05:36:20Z achaloyan@gmail.com $
- */
-
-#include
-#ifdef WIN32
-#pragma warning(disable: 4127)
-#endif
-#include
-
-#include "apt_nlsml_doc.h"
-#include "apt_log.h"
-
-/** NLSML result */
-struct nlsml_result_t
-{
- /** List of interpretations */
- APR_RING_HEAD(apt_ir_head_t, nlsml_interpretation_t) interpretations;
- /** List of enrollment results */
- APR_RING_HEAD(apt_er_head_t, nlsml_enrollment_result_t) enrollment_results;
- /** List of verification results */
- APR_RING_HEAD(apt_vr_head_t, nlsml_verification_result_t) verification_results;
-
- /** Optional grammar attribute */
- const char *grammar;
-};
-
-/** NLSML instance */
-struct nlsml_instance_t
-{
- /** Ring entry */
- APR_RING_ENTRY(nlsml_instance_t) link;
-
- /** Instance element */
- apr_xml_elem *elem;
-};
-
-/** NLSML input */
-struct nlsml_input_t
-{
- /** Input element */
- apr_xml_elem *elem;
- /** Input mode attribute [default: "speech"] */
- const char *mode;
- /** Confidence attribute [default: 1.0] */
- float confidence;
- /** Timestamp-start attribute */
- const char *timestamp_start;
- /** Timestamp-end attribute */
- const char *timestamp_end;
-};
-
-/** NLSML interpretation */
-struct nlsml_interpretation_t
-{
- /** Ring entry */
- APR_RING_ENTRY(nlsml_interpretation_t) link;
-
- /** List of instances */
- APR_RING_HEAD(apt_head_t, nlsml_instance_t) instances;
- /** Input [0..1] */
- nlsml_input_t *input;
-
- /** Confidence attribute [default: 1.0] */
- float confidence;
- /** Optional grammar attribute */
- const char *grammar;
-};
-
-struct nlsml_enrollment_result_t
-{
- /** Ring entry */
- APR_RING_ENTRY(nlsml_enrollment_result_t) link;
-};
-
-struct nlsml_verification_result_t
-{
- /** Ring entry */
- APR_RING_ENTRY(nlsml_verification_result_t) link;
-};
-
-/** Load NLSML document */
-static apr_xml_doc* nlsml_doc_load(const char *data, apr_size_t length, apr_pool_t *pool)
-{
- apr_xml_parser *parser;
- apr_xml_doc *doc = NULL;
- const apr_xml_elem *root;
-
- if(!data || !length) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"No NLSML data available");
- return NULL;
- }
-
- /* create XML parser */
- parser = apr_xml_parser_create(pool);
- if(apr_xml_parser_feed(parser,data,length) != APR_SUCCESS) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to feed NLSML input to the parser");
- return NULL;
- }
-
- /* done with XML tree creation */
- if(apr_xml_parser_done(parser,&doc) != APR_SUCCESS) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to terminate NLSML parsing");
- return NULL;
- }
-
- if(!doc || !doc->root) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"No NLSML root element");
- return NULL;
- }
- root = doc->root;
-
- /* NLSML validity check: root element must be */
- if(strcmp(root->name,"result") != 0) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unexpected NLSML root element <%s>",root->name);
- return NULL;
- }
-
- return doc;
-}
-
-/** Parse confidence value */
-static float nlsml_confidence_parse(const char *str)
-{
- float confidence = (float) atof(str);
- if(confidence > 1.0)
- confidence /= 100;
-
- return confidence;
-}
-
-/** Parse element */
-static nlsml_instance_t* nlsml_instance_parse(apr_xml_elem *elem, apr_pool_t *pool)
-{
- /* Initialize instance */
- nlsml_instance_t *instance = apr_palloc(pool, sizeof(*instance));
- APR_RING_ELEM_INIT(instance,link);
- instance->elem = elem;
-
- return instance;
-}
-
-/** Parse element */
-static nlsml_input_t* nlsml_input_parse(apr_xml_elem *elem, apr_pool_t *pool)
-{
- const apr_xml_attr *xml_attr;
- /* Initialize input */
- nlsml_input_t *input = apr_palloc(pool, sizeof(*input));
- input->elem = elem;
- input->mode = "speech";
- input->confidence = 1.0;
- input->timestamp_start = NULL;
- input->timestamp_end = NULL;
-
- /* Find input attributes */
- for(xml_attr = elem->attr; xml_attr; xml_attr = xml_attr->next) {
- if(strcasecmp(xml_attr->name, "mode") == 0) {
- input->mode = xml_attr->value;
- }
- else if(strcasecmp(xml_attr->name, "confidence") == 0) {
- input->confidence = nlsml_confidence_parse(xml_attr->value);
- }
- else if(strcasecmp(xml_attr->name, "timestamp-start") == 0) {
- input->timestamp_start = xml_attr->value;
- }
- else if(strcasecmp(xml_attr->name, "timestamp-end") == 0) {
- input->timestamp_end = xml_attr->value;
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown attribute '%s' for <%s>", xml_attr->name, elem->name);
- }
- }
-
- return input;
-}
-
-/** Parse element */
-static nlsml_interpretation_t* nlsml_interpretation_parse(apr_xml_elem *elem, apr_pool_t *pool)
-{
- apr_xml_elem *child_elem;
- const apr_xml_attr *xml_attr;
- nlsml_instance_t *instance;
- nlsml_input_t *input;
-
- /* Initialize interpretation */
- nlsml_interpretation_t *interpretation = apr_palloc(pool, sizeof(*interpretation));
- APR_RING_ELEM_INIT(interpretation,link);
- interpretation->grammar = NULL;
- interpretation->confidence = 1.0;
- interpretation->input = NULL;
- APR_RING_INIT(&interpretation->instances, nlsml_instance_t, link);
-
- /* Find optional grammar and confidence attributes */
- for(xml_attr = elem->attr; xml_attr; xml_attr = xml_attr->next) {
- if(strcasecmp(xml_attr->name, "grammar") == 0) {
- interpretation->grammar = xml_attr->value;
- }
- else if(strcasecmp(xml_attr->name, "confidence") == 0) {
- interpretation->confidence = nlsml_confidence_parse(xml_attr->value);
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown attribute '%s' for <%s>", xml_attr->name, elem->name);
- }
- }
-
- /* Find input and instance elements */
- for(child_elem = elem->first_child; child_elem; child_elem = child_elem->next) {
- if(strcasecmp(child_elem->name, "input") == 0) {
- input = nlsml_input_parse(child_elem, pool);
- if(input) {
- interpretation->input = input;
- }
- }
- else if(strcasecmp(child_elem->name, "instance") == 0) {
- instance = nlsml_instance_parse(child_elem, pool);
- if(instance) {
- APR_RING_INSERT_TAIL(&interpretation->instances, instance, nlsml_instance_t, link);
- }
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown child element <%s> for <%s>", child_elem->name, elem->name);
- }
- }
-
- return interpretation;
-}
-
-/** Parse element */
-static nlsml_enrollment_result_t* nlsml_enrollment_result_parse(const apr_xml_elem *elem, apr_pool_t *pool)
-{
- /* To be done */
- return NULL;
-}
-
-/** Parse element */
-static nlsml_verification_result_t* nlsml_verification_result_parse(const apr_xml_elem *elem, apr_pool_t *pool)
-{
- /* To be done */
- return NULL;
-}
-
-/** Parse NLSML result */
-APT_DECLARE(nlsml_result_t*) nlsml_result_parse(const char *data, apr_size_t length, apr_pool_t *pool)
-{
- nlsml_result_t *result;
- apr_xml_elem *root;
- apr_xml_elem *child_elem;
- const apr_xml_attr *xml_attr;
- nlsml_interpretation_t *interpretation;
- nlsml_enrollment_result_t *enrollment_result;
- nlsml_verification_result_t *verification_result;
- apr_xml_doc *doc;
- /* Load XML document */
- doc = nlsml_doc_load(data, length, pool);
- if(!doc)
- return NULL;
-
- root = doc->root;
-
- /* Initialize result */
- result = apr_palloc(pool, sizeof(*result));
- APR_RING_INIT(&result->interpretations, nlsml_interpretation_t, link);
- APR_RING_INIT(&result->enrollment_results, nlsml_enrollment_result_t, link);
- APR_RING_INIT(&result->verification_results, nlsml_verification_result_t, link);
- result->grammar = NULL;
-
- /* Find optional grammar attribute */
- for(xml_attr = root->attr; xml_attr; xml_attr = xml_attr->next) {
- if(strcasecmp(xml_attr->name, "grammar") == 0) {
- result->grammar = xml_attr->value;
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown attribute '%s' for <%s>", xml_attr->name, root->name);
- }
- }
-
- /* Find interpretation, enrollment-result, or verification-result elements */
- for(child_elem = root->first_child; child_elem; child_elem = child_elem->next) {
- if(strcasecmp(child_elem->name, "interpretation") == 0) {
- interpretation = nlsml_interpretation_parse(child_elem, pool);
- if(interpretation) {
- APR_RING_INSERT_TAIL(&result->interpretations, interpretation, nlsml_interpretation_t, link);
- }
- }
- else if(strcasecmp(child_elem->name, "enrollment-result") == 0) {
- enrollment_result = nlsml_enrollment_result_parse(child_elem, pool);
- if(enrollment_result) {
- APR_RING_INSERT_TAIL(&result->enrollment_results, enrollment_result, nlsml_enrollment_result_t, link);
- }
- }
- else if(strcasecmp(child_elem->name, "verification-result") == 0) {
- verification_result = nlsml_verification_result_parse(child_elem, pool);
- if(verification_result) {
- APR_RING_INSERT_TAIL(&result->verification_results, verification_result, nlsml_verification_result_t, link);
- }
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown child element <%s> for <%s>", child_elem->name, root->name);
- }
- }
-
- if(APR_RING_EMPTY(&result->interpretations, nlsml_interpretation_t, link) &&
- APR_RING_EMPTY(&result->enrollment_results, nlsml_enrollment_result_t, link) &&
- APR_RING_EMPTY(&result->verification_results, nlsml_verification_result_t, link)) {
- /* at least one of , , MUST be specified */
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Invalid NLSML document: at least one child element MUST be specified for <%s>", root->name);
- }
-
- return result;
-}
-
-/** Trace NLSML result (for debug purposes only) */
-APT_DECLARE(void) nlsml_result_trace(const nlsml_result_t *result, apr_pool_t *pool)
-{
- int interpretation_count;
- nlsml_interpretation_t *interpretation;
- int instance_count;
- nlsml_instance_t *instance;
- nlsml_input_t *input;
- const char *instance_data;
- const char *input_data;
- const char *timestamp_start;
- const char *timestamp_end;
-
- if(result->grammar)
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Result.grammar: %s", result->grammar);
-
- interpretation_count = 0;
- interpretation = nlsml_first_interpretation_get(result);
- while(interpretation) {
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Interpretation[%d].confidence: %.2f", interpretation_count, nlsml_interpretation_confidence_get(interpretation));
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Interpretation[%d].grammar: %s", interpretation_count, nlsml_interpretation_grammar_get(interpretation));
-
- instance_count = 0;
- instance = nlsml_interpretation_first_instance_get(interpretation);
- while(instance) {
- nlsml_instance_swi_suppress(instance);
- instance_data = nlsml_instance_content_generate(instance,pool);
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Interpretation[%d].instance[%d]: %s", interpretation_count, instance_count, instance_data);
-
- instance_count++;
- instance = nlsml_interpretation_next_instance_get(interpretation, instance);
- }
-
- input = nlsml_interpretation_input_get(interpretation);
- if(input) {
- input_data = nlsml_input_content_generate(input,pool);
- timestamp_start = nlsml_input_timestamp_start_get(input);
- timestamp_end = nlsml_input_timestamp_end_get(input);
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Interpretation[%d].input: %s", interpretation_count, input_data);
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Interpretation[%d].input.mode: %s", interpretation_count, nlsml_input_mode_get(input));
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Interpretation[%d].input.confidence: %.2f", interpretation_count, nlsml_input_confidence_get(input));
- if(timestamp_start)
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Interpretation[%d].input.timestamp-start: %s", interpretation_count, timestamp_start);
- if(timestamp_end)
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Interpretation[%d].input.timestamp-end: %s", interpretation_count, timestamp_end);
- }
-
- interpretation_count++;
- interpretation = nlsml_next_interpretation_get(result, interpretation);
- }
-}
-
-/** Get first interpretation */
-APT_DECLARE(nlsml_interpretation_t*) nlsml_first_interpretation_get(const nlsml_result_t *result)
-{
- nlsml_interpretation_t *first_interpretation = APR_RING_FIRST(&result->interpretations);
- if(first_interpretation == APR_RING_SENTINEL(&result->interpretations, nlsml_interpretation_t, link))
- return NULL;
- return first_interpretation;
-}
-
-/** Get next interpretation */
-APT_DECLARE(nlsml_interpretation_t*) nlsml_next_interpretation_get(const nlsml_result_t *result, const nlsml_interpretation_t *interpretation)
-{
- nlsml_interpretation_t *next_interpretation = APR_RING_NEXT(interpretation, link);
- if(next_interpretation == APR_RING_SENTINEL(&result->interpretations, nlsml_interpretation_t, link))
- return NULL;
- return next_interpretation;
-}
-
-/** Get first enrollment result */
-APT_DECLARE(nlsml_enrollment_result_t*) nlsml_first_enrollment_result_get(const nlsml_result_t *result)
-{
- nlsml_enrollment_result_t *first_enrollment_result = APR_RING_FIRST(&result->enrollment_results);
- if(first_enrollment_result == APR_RING_SENTINEL(&result->enrollment_results, nlsml_enrollment_result_t, link))
- return NULL;
- return first_enrollment_result;
-}
-
-/** Get next enrollment result */
-APT_DECLARE(nlsml_enrollment_result_t*) nlsml_next_enrollment_result_get(const nlsml_result_t *result, const nlsml_enrollment_result_t *enrollment_result)
-{
- nlsml_enrollment_result_t *next_enrollment_result = APR_RING_NEXT(enrollment_result, link);
- if(next_enrollment_result == APR_RING_SENTINEL(&result->enrollment_results, nlsml_enrollment_result_t, link))
- return NULL;
- return next_enrollment_result;
-}
-
-/** Get first verification result */
-APT_DECLARE(nlsml_verification_result_t*) nlsml_first_verification_result_get(const nlsml_result_t *result)
-{
- nlsml_verification_result_t *first_verification_result = APR_RING_FIRST(&result->verification_results);
- if(first_verification_result == APR_RING_SENTINEL(&result->verification_results, nlsml_verification_result_t, link))
- return NULL;
- return first_verification_result;
-}
-
-/** Get next verification result */
-APT_DECLARE(nlsml_verification_result_t*) nlsml_next_verification_result_get(const nlsml_result_t *result, const nlsml_verification_result_t *verification_result)
-{
- nlsml_verification_result_t *next_verification_result = APR_RING_NEXT(verification_result, link);
- if(next_verification_result == APR_RING_SENTINEL(&result->verification_results, nlsml_verification_result_t, link))
- return NULL;
- return next_verification_result;
-}
-
-/** Get grammar attribute of NLSML result */
-APT_DECLARE(const char*) nlsml_result_grammar_get(const nlsml_result_t *result)
-{
- return result->grammar;
-}
-
-/** Get first instance */
-APT_DECLARE(nlsml_instance_t*) nlsml_interpretation_first_instance_get(const nlsml_interpretation_t *interpretation)
-{
- nlsml_instance_t *first_instance = APR_RING_FIRST(&interpretation->instances);
- if(first_instance == APR_RING_SENTINEL(&interpretation->instances, nlsml_instance_t, link))
- return NULL;
- return first_instance;
-}
-
-/** Get next instance */
-APT_DECLARE(nlsml_instance_t*) nlsml_interpretation_next_instance_get(const nlsml_interpretation_t *interpretation, const nlsml_instance_t *instance)
-{
- nlsml_instance_t *next_instance = APR_RING_NEXT(instance, link);
- if(next_instance == APR_RING_SENTINEL(&interpretation->instances, nlsml_instance_t, link))
- return NULL;
- return next_instance;
-}
-
-/** Get input */
-APT_DECLARE(nlsml_input_t*) nlsml_interpretation_input_get(const nlsml_interpretation_t *interpretation)
-{
- return interpretation->input;
-}
-
-/** Get interpretation confidence */
-APT_DECLARE(float) nlsml_interpretation_confidence_get(const nlsml_interpretation_t *interpretation)
-{
- return interpretation->confidence;
-}
-
-/** Get interpretation grammar */
-APT_DECLARE(const char*) nlsml_interpretation_grammar_get(const nlsml_interpretation_t *interpretation)
-{
- return interpretation->grammar;
-}
-
-/** Get instance element */
-APT_DECLARE(const apr_xml_elem*) nlsml_instance_elem_get(const nlsml_instance_t *instance)
-{
- return instance->elem;
-}
-
-/** Suppress SWI elements (normalize instance) */
-APT_DECLARE(apt_bool_t) nlsml_instance_swi_suppress(nlsml_instance_t *instance)
-{
- apr_xml_elem *child_elem;
- apr_xml_elem *prev_elem = NULL;
- apr_xml_elem *swi_literal = NULL;
- apt_bool_t remove;
- if(!instance->elem)
- return FALSE;
-
- for(child_elem = instance->elem->first_child; child_elem; child_elem = child_elem->next) {
- remove = FALSE;
- if(strcasecmp(child_elem->name,"SWI_literal") == 0) {
- swi_literal = child_elem;
- remove = TRUE;
- }
- else if(strcasecmp(child_elem->name,"SWI_meaning") == 0) {
- remove = TRUE;
- }
-
- if(remove == TRUE) {
- if(child_elem == instance->elem->first_child) {
- instance->elem->first_child = child_elem->next;
- }
- else if(prev_elem) {
- prev_elem->next = child_elem->next;
- }
- }
-
- prev_elem = child_elem;
- }
-
- if(APR_XML_ELEM_IS_EMPTY(instance->elem) && swi_literal) {
- instance->elem->first_cdata = swi_literal->first_cdata;
- }
-
- return TRUE;
-}
-
-/** Generate a plain text content of the instance element */
-APT_DECLARE(const char*) nlsml_instance_content_generate(const nlsml_instance_t *instance, apr_pool_t *pool)
-{
- const char *buf = NULL;
- if(instance->elem) {
- apr_size_t size;
- apr_xml_to_text(pool, instance->elem, APR_XML_X2T_INNER, NULL, NULL, &buf, &size);
- }
- return buf;
-}
-
-/** Get input element */
-APT_DECLARE(const apr_xml_elem*) nlsml_input_elem_get(const nlsml_input_t *input)
-{
- return input->elem;
-}
-
-/** Generate a plain text content of the input element */
-APT_DECLARE(const char*) nlsml_input_content_generate(const nlsml_input_t *input, apr_pool_t *pool)
-{
- const char *buf = NULL;
- if(input->elem) {
- apr_size_t size;
- apr_xml_to_text(pool, input->elem, APR_XML_X2T_INNER, NULL, NULL, &buf, &size);
- }
- return buf;
-}
-
-/** Get input mode */
-APT_DECLARE(const char*) nlsml_input_mode_get(const nlsml_input_t *input)
-{
- return input->mode;
-}
-
-/** Get input confidence */
-APT_DECLARE(float) nlsml_input_confidence_get(const nlsml_input_t *input)
-{
- return input->confidence;
-}
-
-/** Get start of input timestamp */
-APT_DECLARE(const char*) nlsml_input_timestamp_start_get(const nlsml_input_t *input)
-{
- return input->timestamp_start;
-}
-
-/** Get end of input timestamp */
-APT_DECLARE(const char*) nlsml_input_timestamp_end_get(const nlsml_input_t *input)
-{
- return input->timestamp_end;
-}
diff --git a/libs/unimrcp/libs/apr-toolkit/src/apt_obj_list.c b/libs/unimrcp/libs/apr-toolkit/src/apt_obj_list.c
deleted file mode 100644
index 83f64b0c71..0000000000
--- a/libs/unimrcp/libs/apr-toolkit/src/apt_obj_list.c
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: apt_obj_list.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifdef WIN32
-#pragma warning(disable: 4127)
-#endif
-#include
-#include "apt_obj_list.h"
-
-struct apt_list_elem_t {
- APR_RING_ENTRY(apt_list_elem_t) link;
- void *obj;
-};
-
-struct apt_obj_list_t {
- APR_RING_HEAD(apt_list_head_t, apt_list_elem_t) head;
- apr_pool_t *pool;
-};
-
-
-
-APT_DECLARE(apt_obj_list_t*) apt_list_create(apr_pool_t *pool)
-{
- apt_obj_list_t *list = apr_palloc(pool, sizeof(apt_obj_list_t));
- list->pool = pool;
- APR_RING_INIT(&list->head, apt_list_elem_t, link);
- return list;
-}
-
-APT_DECLARE(void) apt_list_destroy(apt_obj_list_t *list)
-{
- /* nothing to do, the list is allocated from the pool */
-}
-
-APT_DECLARE(apt_list_elem_t*) apt_list_push_back(apt_obj_list_t *list, void *obj, apr_pool_t *pool)
-{
- apt_list_elem_t *elem = apr_palloc(pool,sizeof(apt_list_elem_t));
- elem->obj = obj;
-
- APR_RING_INSERT_TAIL(&list->head,elem,apt_list_elem_t,link);
- return elem;
-}
-
-APT_DECLARE(void*) apt_list_pop_front(apt_obj_list_t *list)
-{
- apt_list_elem_t *elem;
- if(APR_RING_EMPTY(&list->head,apt_list_elem_t,link)) {
- return NULL;
- }
- elem = APR_RING_FIRST(&list->head);
- APR_RING_REMOVE(elem,link);
- return elem->obj;
-}
-
-APT_DECLARE(void*) apt_list_head(const apt_obj_list_t *list)
-{
- apt_list_elem_t *elem;
- if(APR_RING_EMPTY(&list->head,apt_list_elem_t,link)) {
- return NULL;
- }
- elem = APR_RING_FIRST(&list->head);
- return elem->obj;
-}
-
-APT_DECLARE(void*) apt_obj_list_tail(const apt_obj_list_t *list)
-{
- apt_list_elem_t *elem;
- if(APR_RING_EMPTY(&list->head,apt_list_elem_t,link)) {
- return NULL;
- }
- elem = APR_RING_LAST(&list->head);
- return elem->obj;
-}
-
-APT_DECLARE(apt_list_elem_t*) apt_list_first_elem_get(const apt_obj_list_t *list)
-{
- if(APR_RING_EMPTY(&list->head,apt_list_elem_t,link)) {
- return NULL;
- }
- return APR_RING_FIRST(&list->head);
-}
-
-APT_DECLARE(apt_list_elem_t*) apt_list_last_elem_get(const apt_obj_list_t *list)
-{
- if(APR_RING_EMPTY(&list->head,apt_list_elem_t,link)) {
- return NULL;
- }
- return APR_RING_LAST(&list->head);
-}
-
-APT_DECLARE(apt_list_elem_t*) apt_list_next_elem_get(const apt_obj_list_t *list, apt_list_elem_t *elem)
-{
- apt_list_elem_t *next_elem = APR_RING_NEXT(elem,link);
- if(next_elem == APR_RING_SENTINEL(&list->head,apt_list_elem_t,link)) {
- next_elem = NULL;
- }
- return next_elem;
-}
-
-APT_DECLARE(apt_list_elem_t*) apt_list_prev_elem_get(const apt_obj_list_t *list, apt_list_elem_t *elem)
-{
- apt_list_elem_t *prev_elem = APR_RING_PREV(elem,link);
- if(prev_elem == APR_RING_SENTINEL(&list->head,apt_list_elem_t,link)) {
- prev_elem = NULL;
- }
- return prev_elem;
-}
-
-APT_DECLARE(apt_list_elem_t*) apt_list_elem_insert(apt_obj_list_t *list, apt_list_elem_t *elem, void *obj, apr_pool_t *pool)
-{
- apt_list_elem_t *new_elem = apr_palloc(pool,sizeof(apt_list_elem_t));
- new_elem->obj = obj;
- APR_RING_INSERT_BEFORE(elem,new_elem,link);
- return new_elem;
-}
-
-APT_DECLARE(apt_list_elem_t*) apt_list_elem_remove(apt_obj_list_t *list, apt_list_elem_t *elem)
-{
- apt_list_elem_t *next_elem = APR_RING_NEXT(elem,link);
- APR_RING_REMOVE(elem,link);
- if(next_elem == APR_RING_SENTINEL(&list->head,apt_list_elem_t,link)) {
- next_elem = NULL;
- }
- return next_elem;
-}
-
-APT_DECLARE(apt_bool_t) apt_list_is_empty(const apt_obj_list_t *list)
-{
- if(APR_RING_EMPTY(&list->head,apt_list_elem_t,link)) {
- return TRUE;
- }
- return FALSE;
-}
-
-APT_DECLARE(void*) apt_list_elem_object_get(const apt_list_elem_t *elem)
-{
- return elem->obj;
-}
diff --git a/libs/unimrcp/libs/apr-toolkit/src/apt_pair.c b/libs/unimrcp/libs/apr-toolkit/src/apt_pair.c
deleted file mode 100644
index d14ef5be98..0000000000
--- a/libs/unimrcp/libs/apr-toolkit/src/apt_pair.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: apt_pair.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include "apt_pair.h"
-
-/** Create array of name-value pairs */
-APT_DECLARE(apt_pair_arr_t*) apt_pair_array_create(apr_size_t initial_size, apr_pool_t *pool)
-{
- return apr_array_make(pool,(int)initial_size,sizeof(apt_pair_t));
-}
-
-/** Copy array of name-value pairs */
-APT_DECLARE(apt_pair_arr_t*) apt_pair_array_copy(const apt_pair_arr_t *src_arr, apr_pool_t *pool)
-{
- int i;
- const apt_pair_t *src_pair;
- apt_pair_t *pair;
- apt_pair_arr_t *arr;
- if(!src_arr) {
- return NULL;
- }
- arr = apr_array_copy(pool,src_arr);
- for(i=0; inelts; i++) {
- pair = &APR_ARRAY_IDX(arr,i,apt_pair_t);
- src_pair = &APR_ARRAY_IDX(src_arr,i,const apt_pair_t);
- apt_pair_copy(pair,src_pair,pool);
- }
- return arr;
-}
-
-
-/** Append name-value pair */
-APT_DECLARE(apt_bool_t) apt_pair_array_append(apt_pair_arr_t *arr, const apt_str_t *name, const apt_str_t *value, apr_pool_t *pool)
-{
- apt_pair_t *pair = apr_array_push(arr);
- apt_pair_init(pair);
- if(name) {
- apt_string_copy(&pair->name,name,pool);
- }
- if(value) {
- apt_string_copy(&pair->value,value,pool);
- }
- return TRUE;
-}
-
-/** Find name-value pair by name */
-APT_DECLARE(const apt_pair_t*) apt_pair_array_find(const apt_pair_arr_t *arr, const apt_str_t *name)
-{
- int i;
- apt_pair_t *pair;
- for(i=0; inelts; i++) {
- pair = &APR_ARRAY_IDX(arr,i,apt_pair_t);
- if(apt_string_compare(&pair->name,name) == TRUE) {
- return pair;
- }
- }
- return NULL;
-}
-
-/** Get size of pair array */
-APT_DECLARE(int) apt_pair_array_size_get(const apt_pair_arr_t *arr)
-{
- return arr->nelts;
-}
-
-/** Get name-value pair by id */
-APT_DECLARE(const apt_pair_t*) apt_pair_array_get(const apt_pair_arr_t *arr, int id)
-{
- if(id < arr->nelts) {
- return &APR_ARRAY_IDX(arr,id,apt_pair_t);
- }
- return NULL;
-}
diff --git a/libs/unimrcp/libs/apr-toolkit/src/apt_poller_task.c b/libs/unimrcp/libs/apr-toolkit/src/apt_poller_task.c
deleted file mode 100644
index 3a20231d20..0000000000
--- a/libs/unimrcp/libs/apr-toolkit/src/apt_poller_task.c
+++ /dev/null
@@ -1,296 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: apt_poller_task.c 2224 2014-11-12 00:41:45Z achaloyan@gmail.com $
- */
-
-#include "apt_poller_task.h"
-#include "apt_task.h"
-#include "apt_pool.h"
-#include "apt_cyclic_queue.h"
-#include "apt_log.h"
-
-
-/** Poller task */
-struct apt_poller_task_t {
- apr_pool_t *pool;
- apt_task_t *base;
-
- void *obj;
- apt_poll_signal_f signal_handler;
-
- apr_thread_mutex_t *guard;
- apt_cyclic_queue_t *msg_queue;
- apt_pollset_t *pollset;
- apt_timer_queue_t *timer_queue;
-
- apr_pollfd_t *desc_arr;
- apr_int32_t desc_count;
- apr_int32_t desc_index;
-
-};
-
-static apt_bool_t apt_poller_task_msg_signal(apt_task_t *task, apt_task_msg_t *msg);
-static apt_bool_t apt_poller_task_run(apt_task_t *task);
-static apt_bool_t apt_poller_task_on_destroy(apt_task_t *task);
-
-
-/** Create poller task */
-APT_DECLARE(apt_poller_task_t*) apt_poller_task_create(
- apr_size_t max_pollset_size,
- apt_poll_signal_f signal_handler,
- void *obj,
- apt_task_msg_pool_t *msg_pool,
- apr_pool_t *pool)
-{
- apt_task_vtable_t *vtable;
- apt_poller_task_t *task;
-
- if(!signal_handler) {
- return NULL;
- }
-
- task = apr_palloc(pool,sizeof(apt_poller_task_t));
- task->pool = pool;
- task->obj = obj;
- task->pollset = NULL;
- task->signal_handler = signal_handler;
-
- task->pollset = apt_pollset_create((apr_uint32_t)max_pollset_size,pool);
- if(!task->pollset) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Pollset");
- return NULL;
- }
-
- task->base = apt_task_create(task,msg_pool,pool);
- if(!task->base) {
- apt_pollset_destroy(task->pollset);
- return NULL;
- }
-
- vtable = apt_task_vtable_get(task->base);
- if(vtable) {
- vtable->run = apt_poller_task_run;
- vtable->destroy = apt_poller_task_on_destroy;
- vtable->signal_msg = apt_poller_task_msg_signal;
- }
- apt_task_auto_ready_set(task->base,FALSE);
-
- task->msg_queue = apt_cyclic_queue_create(CYCLIC_QUEUE_DEFAULT_SIZE);
- apr_thread_mutex_create(&task->guard,APR_THREAD_MUTEX_UNNESTED,pool);
-
- task->timer_queue = apt_timer_queue_create(pool);
- task->desc_arr = NULL;
- task->desc_count = 0;
- task->desc_index = 0;
- return task;
-}
-
-/** Destroy poller task */
-APT_DECLARE(apt_bool_t) apt_poller_task_destroy(apt_poller_task_t *task)
-{
- return apt_task_destroy(task->base);
-}
-
-/** Cleanup poller task */
-APT_DECLARE(void) apt_poller_task_cleanup(apt_poller_task_t *task)
-{
- if(task->pollset) {
- apt_pollset_destroy(task->pollset);
- task->pollset = NULL;
- }
- if(task->guard) {
- apr_thread_mutex_destroy(task->guard);
- task->guard = NULL;
- }
- if(task->msg_queue) {
- apt_cyclic_queue_destroy(task->msg_queue);
- task->msg_queue = NULL;
- }
-}
-
-/** Virtual destroy handler */
-static apt_bool_t apt_poller_task_on_destroy(apt_task_t *base)
-{
- apt_poller_task_t *task = apt_task_object_get(base);
- apt_poller_task_cleanup(task);
- return TRUE;
-}
-
-
-/** Start poller task */
-APT_DECLARE(apt_bool_t) apt_poller_task_start(apt_poller_task_t *task)
-{
- return apt_task_start(task->base);
-}
-
-/** Terminate poller task */
-APT_DECLARE(apt_bool_t) apt_poller_task_terminate(apt_poller_task_t *task)
-{
- return apt_task_terminate(task->base,TRUE);
-}
-
-/** Get task */
-APT_DECLARE(apt_task_t*) apt_poller_task_base_get(const apt_poller_task_t *task)
-{
- return task->base;
-}
-
-/** Get task vtable */
-APT_DECLARE(apt_task_vtable_t*) apt_poller_task_vtable_get(const apt_poller_task_t *task)
-{
- return apt_task_vtable_get(task->base);
-}
-
-/** Get external object */
-APT_DECLARE(void*) apt_poller_task_object_get(const apt_poller_task_t *task)
-{
- return task->obj;
-}
-
-/** Add descriptor to pollset */
-APT_DECLARE(apt_bool_t) apt_poller_task_descriptor_add(const apt_poller_task_t *task, const apr_pollfd_t *descriptor)
-{
- if(task->pollset) {
- return apt_pollset_add(task->pollset,descriptor);
- }
- return FALSE;
-}
-
-/** Remove descriptor from pollset */
-APT_DECLARE(apt_bool_t) apt_poller_task_descriptor_remove(const apt_poller_task_t *task, const apr_pollfd_t *descriptor)
-{
- if(task->pollset) {
- apr_int32_t i = task->desc_index + 1;
- for(; i < task->desc_count; i++) {
- apr_pollfd_t *cur_descriptor = &task->desc_arr[i];
- if(cur_descriptor->client_data == descriptor->client_data) {
- cur_descriptor->client_data = NULL;
- }
- }
- return apt_pollset_remove(task->pollset,descriptor);
- }
- return FALSE;
-}
-
-/** Create timer */
-APT_DECLARE(apt_timer_t*) apt_poller_task_timer_create(
- apt_poller_task_t *task,
- apt_timer_proc_f proc,
- void *obj,
- apr_pool_t *pool)
-{
- return apt_timer_create(task->timer_queue,proc,obj,pool);
-}
-
-static apt_bool_t apt_poller_task_wakeup_process(apt_poller_task_t *task)
-{
- apt_bool_t running = TRUE;
- apt_task_msg_t *msg;
-
- do {
- apr_thread_mutex_lock(task->guard);
- msg = apt_cyclic_queue_pop(task->msg_queue);
- apr_thread_mutex_unlock(task->guard);
- if(msg) {
- apt_task_msg_process(task->base,msg);
- }
- else {
- running = FALSE;
- }
- }
- while(running == TRUE);
- return TRUE;
-}
-
-static apt_bool_t apt_poller_task_run(apt_task_t *base)
-{
- apt_poller_task_t *task = apt_task_object_get(base);
- apt_bool_t *running;
- apr_status_t status;
- apr_interval_time_t timeout;
- apr_uint32_t queue_timeout;
- apr_time_t time_now, time_last = 0;
- const char *task_name;
-
- if(!task) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Start Poller Task");
- return FALSE;
- }
- task_name = apt_task_name_get(task->base);
-
- running = apt_task_running_flag_get(task->base);
- if(!running) {
- return FALSE;
- }
-
- /* explicitly indicate task is ready to process messages */
- apt_task_ready(task->base);
-
- while(*running) {
- if(apt_timer_queue_timeout_get(task->timer_queue,&queue_timeout) == TRUE) {
- timeout = (apr_interval_time_t)queue_timeout * 1000;
- time_last = apr_time_now();
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Wait for Messages [%s] timeout [%u]",
- task_name, queue_timeout);
- }
- else {
- timeout = -1;
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Wait for Messages [%s]",task_name);
- }
- status = apt_pollset_poll(task->pollset, timeout, &task->desc_count, (const apr_pollfd_t **) &task->desc_arr);
- if(status != APR_SUCCESS && status != APR_TIMEUP) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Poll [%s] status: %d",task_name,status);
- continue;
- }
- for(task->desc_index = 0; task->desc_index < task->desc_count; task->desc_index++) {
- const apr_pollfd_t *descriptor = &task->desc_arr[task->desc_index];
- if(apt_pollset_is_wakeup(task->pollset,descriptor)) {
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Process Poller Wakeup [%s]",task_name);
- apt_poller_task_wakeup_process(task);
- if(*running == FALSE) {
- break;
- }
- continue;
- }
-
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Process Signalled Descriptor [%s]",task_name);
- task->signal_handler(task->obj,descriptor);
- }
-
- if(timeout != -1) {
- time_now = apr_time_now();
- if(time_now > time_last) {
- apt_timer_queue_advance(task->timer_queue,(apr_uint32_t)((time_now - time_last)/1000));
- }
- }
- }
-
- return TRUE;
-}
-
-static apt_bool_t apt_poller_task_msg_signal(apt_task_t *base, apt_task_msg_t *msg)
-{
- apt_bool_t status;
- apt_poller_task_t *task = apt_task_object_get(base);
- apr_thread_mutex_lock(task->guard);
- status = apt_cyclic_queue_push(task->msg_queue,msg);
- apr_thread_mutex_unlock(task->guard);
- if(apt_pollset_wakeup(task->pollset) != TRUE) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Signal Control Message");
- status = FALSE;
- }
- return status;
-}
diff --git a/libs/unimrcp/libs/apr-toolkit/src/apt_pollset.c b/libs/unimrcp/libs/apr-toolkit/src/apt_pollset.c
deleted file mode 100644
index b7d8358d36..0000000000
--- a/libs/unimrcp/libs/apr-toolkit/src/apt_pollset.c
+++ /dev/null
@@ -1,325 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: apt_pollset.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include
-#include "apt_pollset.h"
-#include "apt_log.h"
-
-struct apt_pollset_t {
- /** APR pollset */
- apr_pollset_t *base;
-#ifdef WIN32
- /** Socket descriptors used for wakeup */
- apr_socket_t *wakeup_pipe[2];
-#else
- /** Pipe descriptors used for wakeup */
- apr_file_t *wakeup_pipe[2];
-#endif
- /** Builtin wakeup poll descriptor */
- apr_pollfd_t wakeup_pfd;
-
- /** Pool to allocate memory from */
- apr_pool_t *pool;
-};
-
-static apt_bool_t apt_wakeup_pipe_create(apt_pollset_t *pollset);
-static apt_bool_t apt_wakeup_pipe_destroy(apt_pollset_t *pollset);
-
-/** Create interruptable pollset on top of APR pollset */
-APT_DECLARE(apt_pollset_t*) apt_pollset_create(apr_uint32_t size, apr_pool_t *pool)
-{
- apt_pollset_t *pollset = apr_palloc(pool,sizeof(apt_pollset_t));
- pollset->pool = pool;
- memset(&pollset->wakeup_pfd,0,sizeof(pollset->wakeup_pfd));
-
- /* create pollset with max number of descriptors size+1,
- where +1 is builtin wakeup descriptor */
- if(apr_pollset_create(&pollset->base,size+1,pool,0) != APR_SUCCESS) {
- return NULL;
- }
-
- /* create wakeup pipe */
- if(apt_wakeup_pipe_create(pollset) != TRUE) {
- apr_pollset_destroy(pollset->base);
- return NULL;
- }
-
- /* add wakeup pipe to pollset */
- if(apr_pollset_add(pollset->base,&pollset->wakeup_pfd) != APR_SUCCESS) {
- apt_wakeup_pipe_destroy(pollset);
- apr_pollset_destroy(pollset->base);
- return NULL;
- }
- return pollset;
-}
-
-/** Destroy pollset */
-APT_DECLARE(apt_bool_t) apt_pollset_destroy(apt_pollset_t *pollset)
-{
- /* remove wakeup pipe from pollset */
- apr_pollset_remove(pollset->base,&pollset->wakeup_pfd);
- /* destroy wakeup pipe */
- apt_wakeup_pipe_destroy(pollset);
- /* destroy pollset */
- apr_pollset_destroy(pollset->base);
- return TRUE;
-}
-
-/** Add pollset descriptor to a pollset */
-APT_DECLARE(apt_bool_t) apt_pollset_add(apt_pollset_t *pollset, const apr_pollfd_t *descriptor)
-{
- return (apr_pollset_add(pollset->base,descriptor) == APR_SUCCESS) ? TRUE : FALSE;
-}
-
-/** Remove pollset descriptor from a pollset */
-APT_DECLARE(apt_bool_t) apt_pollset_remove(apt_pollset_t *pollset, const apr_pollfd_t *descriptor)
-{
- return (apr_pollset_remove(pollset->base,descriptor) == APR_SUCCESS) ? TRUE : FALSE;
-}
-
-/** Block for activity on the descriptor(s) in a pollset */
-APT_DECLARE(apr_status_t) apt_pollset_poll(
- apt_pollset_t *pollset,
- apr_interval_time_t timeout,
- apr_int32_t *num,
- const apr_pollfd_t **descriptors)
-{
- return apr_pollset_poll(pollset->base,timeout,num,descriptors);
-}
-
-/** Interrupt the blocked poll call */
-APT_DECLARE(apt_bool_t) apt_pollset_wakeup(apt_pollset_t *pollset)
-{
- apt_bool_t status = TRUE;
-#ifdef WIN32
- char tmp = 0;
- apr_size_t len = sizeof(tmp);
- if(apr_socket_send(pollset->wakeup_pipe[1],&tmp,&len) != APR_SUCCESS) {
- status = FALSE;
- }
-#else
- if(apr_file_putc(1, pollset->wakeup_pipe[1]) != APR_SUCCESS) {
- status = FALSE;
- }
-#endif
- return status;
-}
-
-/** Match against builtin wake up descriptor in a pollset */
-APT_DECLARE(apt_bool_t) apt_pollset_is_wakeup(apt_pollset_t *pollset, const apr_pollfd_t *descriptor)
-{
- apt_bool_t status = FALSE;
-#ifdef WIN32
- if(descriptor->desc.s == pollset->wakeup_pipe[0]) {
- char rb[512];
- apr_size_t nr = sizeof(rb);
-
- /* simply read out from the input side of the pipe all the data. */
- while(apr_socket_recv(pollset->wakeup_pipe[0], rb, &nr) == APR_SUCCESS) {
- if(nr != sizeof(rb)) {
- break;
- }
- }
- status = TRUE;
- }
-#else
- if(descriptor->desc.f == pollset->wakeup_pipe[0]) {
- char rb[512];
- apr_size_t nr = sizeof(rb);
-
- /* simply read out from the input side of the pipe all the data. */
- while(apr_file_read(pollset->wakeup_pipe[0], rb, &nr) == APR_SUCCESS) {
- if(nr != sizeof(rb)) {
- break;
- }
- }
- status = TRUE;
- }
-#endif
- return status;
-}
-
-#ifdef WIN32
-static apr_status_t socket_pipe_create(apr_socket_t **rd, apr_socket_t **wr, apr_pool_t *pool)
-{
- static int id = 0;
-
- apr_socket_t *ls = NULL;
- apr_sockaddr_t *pa = NULL;
- apr_sockaddr_t *ca = NULL;
- apr_size_t nrd;
- int uid[2];
- int iid[2];
-
- /* Create the unique socket identifier
- * so that we know the connection originated
- * from us.
- */
- uid[0] = getpid();
- uid[1] = id++;
- if(apr_socket_create(&ls, AF_INET, SOCK_STREAM, APR_PROTO_TCP, pool) != APR_SUCCESS) {
- return apr_get_netos_error();
- }
- apr_socket_opt_set(ls, APR_SO_REUSEADDR, 1);
-
- if(apr_sockaddr_info_get(&pa,"127.0.0.1",APR_INET,0,0,pool) != APR_SUCCESS) {
- apr_socket_close(ls);
- return apr_get_netos_error();
- }
-
- if(apr_socket_bind(ls, pa) != APR_SUCCESS) {
- apr_socket_close(ls);
- return apr_get_netos_error();
- }
-
- if(apr_socket_addr_get(&ca,APR_LOCAL,ls) != APR_SUCCESS) {
- apr_socket_close(ls);
- return apr_get_netos_error();
- }
-
- if(apr_socket_listen(ls,1) != APR_SUCCESS) {
- apr_socket_close(ls);
- return apr_get_netos_error();
- }
-
- if(apr_socket_create(wr, AF_INET, SOCK_STREAM, APR_PROTO_TCP, pool) != APR_SUCCESS) {
- apr_socket_close(ls);
- return apr_get_netos_error();
- }
- apr_socket_opt_set(*wr, APR_SO_REUSEADDR, 1);
-
- if(apr_socket_connect(*wr, ca) != APR_SUCCESS) {
- apr_socket_close(ls);
- apr_socket_close(*wr);
- return apr_get_netos_error();
- }
- nrd = sizeof(uid);
- if(apr_socket_send(*wr, (char *)uid, &nrd) != APR_SUCCESS) {
- apr_socket_close(ls);
- apr_socket_close(*wr);
- return apr_get_netos_error();
- }
-
- apr_socket_opt_set(ls, APR_SO_NONBLOCK, 0);
- /* Listening socket is blocking by now. The accept should
- * return immediatelly because we connected already.
- */
- if(apr_socket_accept(rd, ls, pool) != APR_SUCCESS) {
- apr_socket_close(ls);
- apr_socket_close(*wr);
- return apr_get_netos_error();
- }
-
- /* Put read side of the pipe to the blocking mode */
- apr_socket_opt_set(*rd, APR_SO_NONBLOCK, 0);
-
- for (;;) {
- /* Verify the connection by reading the sent identification */
- nrd = sizeof(iid);
- if(apr_socket_recv(*rd, (char *)iid, &nrd) != APR_SUCCESS) {
- apr_socket_close(ls);
- apr_socket_close(*wr);
- apr_socket_close(*rd);
- return apr_get_netos_error();
- }
- if(nrd == sizeof(iid)) {
- if(memcmp(uid, iid, sizeof(uid)) == 0) {
- /* Wow, we recived what we sent */
- break;
- }
- }
- }
-
- /* We don't need the listening socket any more */
- apr_socket_close(ls);
- return APR_SUCCESS;
-}
-
-/** Create a dummy wakeup pipe for interrupting the poller */
-static apt_bool_t apt_wakeup_pipe_create(apt_pollset_t *pollset)
-{
- apr_socket_t *rd = NULL;
- apr_socket_t *wr = NULL;
- apr_status_t rv;
- rv = socket_pipe_create(&rd,&wr,pollset->pool);
- if(rv != APR_SUCCESS) {
- char err_str[256];
- apr_strerror(rv,err_str,sizeof(err_str));
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Wakeup Pipe: %s",err_str);
- return FALSE;
- }
- pollset->wakeup_pfd.reqevents = APR_POLLIN;
- pollset->wakeup_pfd.desc_type = APR_POLL_SOCKET;
- pollset->wakeup_pfd.desc.s = rd;
-
- pollset->wakeup_pipe[0] = rd;
- pollset->wakeup_pipe[1] = wr;
- return TRUE;
-}
-
-/** Destroy wakeup pipe */
-static apt_bool_t apt_wakeup_pipe_destroy(apt_pollset_t *pollset)
-{
- /* Close both sides of the wakeup pipe */
- if(pollset->wakeup_pipe[0]) {
- apr_socket_close(pollset->wakeup_pipe[0]);
- pollset->wakeup_pipe[0] = NULL;
- }
- if(pollset->wakeup_pipe[1]) {
- apr_socket_close(pollset->wakeup_pipe[1]);
- pollset->wakeup_pipe[1] = NULL;
- }
- return TRUE;
-}
-
-#else
-
-/** Create a dummy wakeup pipe for interrupting the poller */
-static apt_bool_t apt_wakeup_pipe_create(apt_pollset_t *pollset)
-{
- apr_file_t *file_in = NULL;
- apr_file_t *file_out = NULL;
-
- if(apr_file_pipe_create(&file_in,&file_out,pollset->pool) != APR_SUCCESS) {
- return FALSE;
- }
- pollset->wakeup_pfd.reqevents = APR_POLLIN;
- pollset->wakeup_pfd.desc_type = APR_POLL_FILE;
- pollset->wakeup_pfd.desc.f = file_in;
-
- pollset->wakeup_pipe[0] = file_in;
- pollset->wakeup_pipe[1] = file_out;
- return TRUE;
-}
-
-/** Destroy wakeup pipe */
-static apt_bool_t apt_wakeup_pipe_destroy(apt_pollset_t *pollset)
-{
- /* Close both sides of the wakeup pipe */
- if(pollset->wakeup_pipe[0]) {
- apr_file_close(pollset->wakeup_pipe[0]);
- pollset->wakeup_pipe[0] = NULL;
- }
- if(pollset->wakeup_pipe[1]) {
- apr_file_close(pollset->wakeup_pipe[1]);
- pollset->wakeup_pipe[1] = NULL;
- }
- return TRUE;
-}
-
-#endif
diff --git a/libs/unimrcp/libs/apr-toolkit/src/apt_pool.c b/libs/unimrcp/libs/apr-toolkit/src/apt_pool.c
deleted file mode 100644
index 48ce662903..0000000000
--- a/libs/unimrcp/libs/apr-toolkit/src/apt_pool.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: apt_pool.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include "apt_pool.h"
-#include "apt_log.h"
-
-#define OWN_ALLOCATOR_PER_POOL
-
-static int apt_abort_fn(int retcode)
-{
- apt_log(APT_LOG_MARK,APT_PRIO_CRITICAL,"APR Abort Called [%d]", retcode);
- return 0;
-}
-
-APT_DECLARE(apr_pool_t*) apt_pool_create()
-{
- apr_pool_t *pool = NULL;
-
-#ifdef OWN_ALLOCATOR_PER_POOL
- apr_allocator_t *allocator = NULL;
- apr_thread_mutex_t *mutex = NULL;
-
- if(apr_allocator_create(&allocator) == APR_SUCCESS) {
- if(apr_pool_create_ex(&pool,NULL,apt_abort_fn,allocator) == APR_SUCCESS) {
- apr_allocator_owner_set(allocator,pool);
- apr_thread_mutex_create(&mutex,APR_THREAD_MUTEX_NESTED,pool);
- apr_allocator_mutex_set(allocator,mutex);
- apr_pool_mutex_set(pool,mutex);
- }
- }
-#else
- apr_pool_create(&pool,NULL);
-#endif
- return pool;
-}
-
-APT_DECLARE(apr_pool_t*) apt_subpool_create(apr_pool_t *parent)
-{
- apr_pool_t *pool = NULL;
- apr_pool_create(&pool,parent);
- return pool;
-}
diff --git a/libs/unimrcp/libs/apr-toolkit/src/apt_string_table.c b/libs/unimrcp/libs/apr-toolkit/src/apt_string_table.c
deleted file mode 100644
index 5928e38c13..0000000000
--- a/libs/unimrcp/libs/apr-toolkit/src/apt_string_table.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: apt_string_table.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include
-#include "apt_string_table.h"
-
-/* Get the string by a given id. */
-APT_DECLARE(const apt_str_t*) apt_string_table_str_get(const apt_str_table_item_t table[], apr_size_t size, apr_size_t id)
-{
- if(id < size) {
- return &table[id].value;
- }
- return NULL;
-}
-
-/* Find the id associated with a given string from the table */
-APT_DECLARE(apr_size_t) apt_string_table_id_find(const apt_str_table_item_t table[], apr_size_t size, const apt_str_t *value)
-{
- /* Key character is stored within each apt_string_table_item.
- At first, key characters must be matched in a loop crossing the items.
- Then whole strings should be compared only for the matched item.
- Key characters should be automatically generated once for a given string table. */
-
- apr_size_t i;
- const apt_str_table_item_t *item;
- for(i=0; ivalue.length != value->length) {
- /* lengths of th strings differ, just contninue */
- continue;
- }
- /* check whether key is available */
- if(item->key < value->length) {
- /* check whether values are matched by key (using no case compare) */
- if(value->length == item->value.length &&
- tolower(item->value.buf[item->key]) == tolower(value->buf[item->key])) {
- /* whole strings must be compared to ensure, should be done only once for each lookup */
- if(apt_string_compare(&item->value,value) == TRUE) {
- return i;
- }
- }
- }
- else {
- /* no key available, just compare whole strings */
- if(apt_string_compare(&item->value,value) == TRUE) {
- return i;
- }
- }
- }
-
- /* no match found, return invalid id */
- return size;
-}
diff --git a/libs/unimrcp/libs/apr-toolkit/src/apt_task.c b/libs/unimrcp/libs/apr-toolkit/src/apt_task.c
deleted file mode 100644
index 83e04c963c..0000000000
--- a/libs/unimrcp/libs/apr-toolkit/src/apt_task.c
+++ /dev/null
@@ -1,623 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: apt_task.c 2219 2014-11-11 02:35:14Z achaloyan@gmail.com $
- */
-
-#ifdef WIN32
-#pragma warning(disable: 4127)
-#endif
-#include
-#include
-#include
-#include
-#include "apt_task.h"
-#include "apt_log.h"
-
-/** Internal states of the task */
-typedef enum {
- TASK_STATE_IDLE, /**< no task activity */
- TASK_STATE_START_REQUESTED, /**< start of the task has been requested, but it's not running yet */
- TASK_STATE_RUNNING, /**< task is running */
- TASK_STATE_TERMINATE_REQUESTED /**< termination of the task has been requested, but it's still running */
-} apt_task_state_e;
-
-struct apt_task_t {
- APR_RING_ENTRY(apt_task_t) link; /* entry to parent task ring */
- APR_RING_HEAD(apt_task_head_t, apt_task_t) head; /* head of child tasks ring */
-
- const char *name; /* name of the task */
- void *obj; /* external object associated with the task */
- apr_pool_t *pool; /* memory pool to allocate task data from */
- apt_task_msg_pool_t *msg_pool; /* message pool to allocate task messages from */
- apr_thread_mutex_t *data_guard; /* mutex to protect task data */
- apr_thread_t *thread_handle; /* thread handle */
- apt_task_state_e state; /* current task state */
- apt_task_vtable_t vtable; /* table of virtual methods */
- apt_task_t *parent_task; /* parent (master) task */
- apr_size_t pending_start; /* number of pending start requests */
- apr_size_t pending_term; /* number of pending terminate requests */
- apr_size_t pending_off; /* number of pending taking-offline requests */
- apr_size_t pending_on; /* number of pending bringing-online requests */
- apt_bool_t running; /* task is running (TRUE if even terminate has already been requested) */
- apt_bool_t auto_ready; /* if TRUE, task is implicitly ready to process messages */
-};
-
-static void* APR_THREAD_FUNC apt_task_run(apr_thread_t *thread_handle, void *data);
-static APR_INLINE void apt_task_vtable_reset(apt_task_vtable_t *vtable);
-
-static apt_bool_t apt_task_core_msg_signal(apt_task_t *task, apt_task_msg_pool_t *msg_pool, apt_core_task_msg_type_e type);
-
-static apt_bool_t apt_task_terminate_request(apt_task_t *task);
-
-static apt_bool_t apt_task_start_process_internal(apt_task_t *task);
-static apt_bool_t apt_task_terminate_process_internal(apt_task_t *task);
-static apt_bool_t apt_task_offline_request_process(apt_task_t *task);
-static apt_bool_t apt_task_online_request_process(apt_task_t *task);
-
-static apt_bool_t apt_task_offline_request_complete(apt_task_t *task);
-static apt_bool_t apt_task_online_request_complete(apt_task_t *task);
-
-static void apt_task_start_complete_raise(apt_task_t *task);
-static void apt_task_terminate_complete_raise(apt_task_t *task);
-static void apt_task_offline_complete_raise(apt_task_t *task);
-static void apt_task_online_complete_raise(apt_task_t *task);
-
-
-APT_DECLARE(apt_task_t*) apt_task_create(
- void *obj,
- apt_task_msg_pool_t *msg_pool,
- apr_pool_t *pool)
-{
- apt_task_t *task = apr_palloc(pool,sizeof(apt_task_t));
- task->obj = obj;
- task->pool = pool;
- task->msg_pool = msg_pool;
-
- if(!task->msg_pool) {
- task->msg_pool = apt_task_msg_pool_create_dynamic(0,pool);
- }
-
- task->state = TASK_STATE_IDLE;
- task->thread_handle = NULL;
- if(apr_thread_mutex_create(&task->data_guard, APR_THREAD_MUTEX_DEFAULT, task->pool) != APR_SUCCESS) {
- return NULL;
- }
-
- /* reset vtable */
- apt_task_vtable_reset(&task->vtable);
- task->vtable.terminate = apt_task_terminate_request;
- task->vtable.process_start = apt_task_start_process_internal;
- task->vtable.process_terminate = apt_task_terminate_process_internal;
-
- APR_RING_ELEM_INIT(task, link);
- APR_RING_INIT(&task->head, apt_task_t, link);
-
- task->parent_task = NULL;
- task->pending_start = 0;
- task->pending_term = 0;
- task->pending_off = 0;
- task->pending_on = 0;
- task->auto_ready = TRUE;
- task->name = "Task";
- return task;
-}
-
-APT_DECLARE(apt_bool_t) apt_task_destroy(apt_task_t *task)
-{
- apt_task_t *child_task;
- APR_RING_FOREACH(child_task, &task->head, apt_task_t, link) {
- apt_task_destroy(child_task);
- }
-
- if(task->state != TASK_STATE_IDLE) {
- apt_task_wait_till_complete(task);
- }
-
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Destroy Task [%s]",task->name);
- if(task->vtable.destroy) {
- task->vtable.destroy(task);
- }
-
- apr_thread_mutex_destroy(task->data_guard);
- return TRUE;
-}
-
-APT_DECLARE(apt_bool_t) apt_task_add(apt_task_t *task, apt_task_t *child_task)
-{
- if(!child_task)
- return FALSE;
-
- child_task->parent_task = task;
- APR_RING_INSERT_TAIL(&task->head,child_task,apt_task_t,link);
- return TRUE;
-}
-
-APT_DECLARE(apt_bool_t) apt_task_start(apt_task_t *task)
-{
- apt_bool_t status = TRUE;
- apr_thread_mutex_lock(task->data_guard);
- if(task->state == TASK_STATE_IDLE) {
- apr_status_t rv;
- task->state = TASK_STATE_START_REQUESTED;
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Start Task [%s]",task->name);
- if(task->vtable.start) {
- /* invoke virtual start method */
- task->vtable.start(task);
- }
- else {
- /* start new thread by default */
- rv = apr_thread_create(&task->thread_handle,NULL,apt_task_run,task,task->pool);
- if(rv != APR_SUCCESS) {
- task->state = TASK_STATE_IDLE;
- status = FALSE;
- }
- }
- }
- else {
- status = FALSE;
- }
- apr_thread_mutex_unlock(task->data_guard);
- return status;
-}
-
-APT_DECLARE(apt_bool_t) apt_task_offline(apt_task_t *task)
-{
- return apt_task_core_msg_signal(task,task->msg_pool,CORE_TASK_MSG_TAKEOFFLINE_REQUEST);
-}
-
-APT_DECLARE(apt_bool_t) apt_task_online(apt_task_t *task)
-{
- return apt_task_core_msg_signal(task,task->msg_pool,CORE_TASK_MSG_BRINGONLINE_REQUEST);
-}
-
-APT_DECLARE(apt_bool_t) apt_task_terminate(apt_task_t *task, apt_bool_t wait_till_complete)
-{
- apt_bool_t status = FALSE;
- apr_thread_mutex_lock(task->data_guard);
- if(task->state == TASK_STATE_START_REQUESTED || task->state == TASK_STATE_RUNNING) {
- task->state = TASK_STATE_TERMINATE_REQUESTED;
- }
- apr_thread_mutex_unlock(task->data_guard);
-
- if(task->state == TASK_STATE_TERMINATE_REQUESTED) {
- /* invoke virtual terminate method */
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Terminate Task [%s]",task->name);
- if(task->vtable.terminate) {
- status = task->vtable.terminate(task);
- }
-
- if(wait_till_complete == TRUE && status == TRUE) {
- apt_task_wait_till_complete(task);
- }
- }
-
- return status;
-}
-
-APT_DECLARE(apt_bool_t) apt_task_wait_till_complete(apt_task_t *task)
-{
- if(task->thread_handle) {
- apr_status_t s;
- apr_thread_join(&s,task->thread_handle);
- task->thread_handle = NULL;
- }
- return TRUE;
-}
-
-APT_DECLARE(void) apt_task_delay(apr_size_t msec)
-{
- apr_sleep(1000*msec);
-}
-
-APT_DECLARE(apt_task_t*) apt_task_parent_get(const apt_task_t *task)
-{
- return task->parent_task;
-}
-
-APT_DECLARE(apr_pool_t*) apt_task_pool_get(const apt_task_t *task)
-{
- return task->pool;
-}
-
-APT_DECLARE(void*) apt_task_object_get(const apt_task_t *task)
-{
- return task->obj;
-}
-
-APT_DECLARE(apt_task_vtable_t*) apt_task_vtable_get(apt_task_t *task)
-{
- return &task->vtable;
-}
-
-APT_DECLARE(void) apt_task_name_set(apt_task_t *task, const char *name)
-{
- task->name = name;
-}
-
-APT_DECLARE(const char*) apt_task_name_get(const apt_task_t *task)
-{
- return task->name;
-}
-
-APT_DECLARE(apt_task_msg_t*) apt_task_msg_get(apt_task_t *task)
-{
- if(task->msg_pool) {
- return apt_task_msg_acquire(task->msg_pool);
- }
- return NULL;
-}
-
-APT_DECLARE(apt_bool_t) apt_task_msg_signal(apt_task_t *task, apt_task_msg_t *msg)
-{
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Signal Message to [%s] ["APT_PTR_FMT";%d;%d]",
- task->name, msg, msg->type, msg->sub_type);
- if(task->vtable.signal_msg) {
- if(task->vtable.signal_msg(task,msg) == TRUE) {
- return TRUE;
- }
- }
-
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Signal Task Message [%s] [0x%x;%d;%d]",
- task->name, msg, msg->type, msg->sub_type);
- apt_task_msg_release(msg);
- return FALSE;
-}
-
-APT_DECLARE(apt_bool_t) apt_task_msg_parent_signal(apt_task_t *task, apt_task_msg_t *msg)
-{
- apt_task_t *parent_task = task->parent_task;
- if(parent_task) {
- return apt_task_msg_signal(parent_task,msg);
- }
-
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Null Parent Task [%s]",task->name);
- apt_task_msg_release(msg);
- return FALSE;
-}
-
-static apt_bool_t apt_task_core_msg_signal(apt_task_t *task, apt_task_msg_pool_t *msg_pool, apt_core_task_msg_type_e type)
-{
- if(task && msg_pool) {
- apt_task_msg_t *msg = apt_task_msg_acquire(msg_pool);
- /* signal core task message */
- msg->type = TASK_MSG_CORE;
- msg->sub_type = type;
- return apt_task_msg_signal(task,msg);
- }
- return FALSE;
-}
-
-static apt_bool_t apt_core_task_msg_process(apt_task_t *task, apt_task_msg_t *msg)
-{
- switch(msg->sub_type) {
- case CORE_TASK_MSG_START_COMPLETE:
- apt_task_start_request_remove(task);
- break;
- case CORE_TASK_MSG_TERMINATE_REQUEST:
- if(task->vtable.process_terminate) {
- task->vtable.process_terminate(task);
- }
- break;
- case CORE_TASK_MSG_TERMINATE_COMPLETE:
- apt_task_terminate_request_remove(task);
- break;
- case CORE_TASK_MSG_TAKEOFFLINE_REQUEST:
- apt_task_offline_request_process(task);
- break;
- case CORE_TASK_MSG_TAKEOFFLINE_COMPLETE:
- apt_task_offline_request_complete(task);
- break;
- case CORE_TASK_MSG_BRINGONLINE_REQUEST:
- apt_task_online_request_process(task);
- break;
- case CORE_TASK_MSG_BRINGONLINE_COMPLETE:
- apt_task_online_request_complete(task);
- break;
- default: break;
- }
- return TRUE;
-}
-
-APT_DECLARE(apt_bool_t) apt_task_msg_process(apt_task_t *task, apt_task_msg_t *msg)
-{
- apt_bool_t status = FALSE;
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Process Message [%s] ["APT_PTR_FMT";%d;%d]",
- task->name, msg, msg->type, msg->sub_type);
- if(msg->type == TASK_MSG_CORE) {
- status = apt_core_task_msg_process(task,msg);
- }
- else {
- if(task->vtable.process_msg) {
- status = task->vtable.process_msg(task,msg);
- }
- }
-
- apt_task_msg_release(msg);
- return status;
-}
-
-static apt_bool_t apt_task_terminate_request(apt_task_t *task)
-{
- return apt_task_core_msg_signal(task,task->msg_pool,CORE_TASK_MSG_TERMINATE_REQUEST);
-}
-
-APT_DECLARE(apt_bool_t) apt_task_start_request_process(apt_task_t *task)
-{
- return apt_task_start_process_internal(task);
-}
-
-static apt_bool_t apt_task_start_process_internal(apt_task_t *task)
-{
- apt_task_t *child_task;
- APR_RING_FOREACH(child_task, &task->head, apt_task_t, link) {
- if(apt_task_start(child_task) == TRUE) {
- task->pending_start++;
- }
- }
-
- if(!task->pending_start) {
- /* no child task to start, just raise start-complete event */
- apt_task_start_complete_raise(task);
- }
- return TRUE;
-}
-
-APT_DECLARE(apt_bool_t) apt_task_terminate_request_process(apt_task_t *task)
-{
- return apt_task_terminate_process_internal(task);
-}
-
-static apt_bool_t apt_task_terminate_process_internal(apt_task_t *task)
-{
- apt_task_t *child_task;
- APR_RING_FOREACH(child_task, &task->head, apt_task_t, link) {
-#ifdef ENABLE_SIMULT_TASK_TERMINATION
- if(child_task->thread_handle) {
- apr_thread_detach(child_task->thread_handle);
- child_task->thread_handle = NULL;
- }
- if(apt_task_terminate(child_task,FALSE) == TRUE) {
- task->pending_term++;
- }
-#else
- apt_task_terminate(child_task,TRUE);
-#endif
- }
-
- if(!task->pending_term) {
- /* no child task to terminate, just raise terminate-complete event */
- apt_task_terminate_complete_raise(task);
- task->running = FALSE;
- }
- return TRUE;
-}
-
-static apt_bool_t apt_task_offline_request_process(apt_task_t *task)
-{
- apt_task_t *child_task;
- APR_RING_FOREACH(child_task, &task->head, apt_task_t, link) {
- if(apt_task_offline(child_task) == TRUE) {
- task->pending_off++;
- }
- }
-
- if(!task->pending_off) {
- /* no child task, just raise offline-complete event */
- apt_task_offline_complete_raise(task);
- }
- return TRUE;
-}
-
-static apt_bool_t apt_task_online_request_process(apt_task_t *task)
-{
- apt_task_t *child_task;
- APR_RING_FOREACH(child_task, &task->head, apt_task_t, link) {
- if(apt_task_online(child_task) == TRUE) {
- task->pending_on++;
- }
- }
-
- if(!task->pending_on) {
- /* no child task, just raise online-complete event */
- apt_task_online_complete_raise(task);
- }
- return TRUE;
-}
-
-APT_DECLARE(void) apt_task_auto_ready_set(apt_task_t *task, apt_bool_t auto_ready)
-{
- task->auto_ready = auto_ready;
-}
-
-APT_DECLARE(apt_bool_t) apt_task_ready(apt_task_t *task)
-{
- if(task->auto_ready == TRUE) {
- return FALSE;
- }
-
- /* start child tasks (if any) */
- if(task->vtable.process_start) {
- task->vtable.process_start(task);
- }
- return TRUE;
-}
-
-APT_DECLARE(apt_bool_t*) apt_task_running_flag_get(apt_task_t *task)
-{
- return &task->running;
-}
-
-APT_DECLARE(apt_bool_t) apt_task_start_request_add(apt_task_t *task)
-{
- task->pending_start++;
- return TRUE;
-}
-
-APT_DECLARE(apt_bool_t) apt_task_start_request_remove(apt_task_t *task)
-{
- if(!task->pending_start) {
- /* error case, no pending start */
- return FALSE;
- }
- task->pending_start--;
- if(!task->pending_start) {
- apt_task_start_complete_raise(task);
- }
- return TRUE;
-}
-
-APT_DECLARE(apt_bool_t) apt_task_terminate_request_add(apt_task_t *task)
-{
- task->pending_term++;
- return TRUE;
-}
-
-APT_DECLARE(apt_bool_t) apt_task_terminate_request_remove(apt_task_t *task)
-{
- if(!task->pending_term) {
- /* error case, no pending terminate */
- return FALSE;
- }
- task->pending_term--;
- if(!task->pending_term) {
- apt_task_terminate_complete_raise(task);
- task->running = FALSE;
- }
- return TRUE;
-}
-
-static apt_bool_t apt_task_offline_request_complete(apt_task_t *task)
-{
- if(!task->pending_off) {
- /* error case, no pending request */
- return FALSE;
- }
- task->pending_off--;
- if(!task->pending_off) {
- apt_task_offline_complete_raise(task);
- }
- return TRUE;
-}
-
-static apt_bool_t apt_task_online_request_complete(apt_task_t *task)
-{
- if(!task->pending_on) {
- /* error case, no pending request */
- return FALSE;
- }
- task->pending_on--;
- if(!task->pending_on) {
- apt_task_online_complete_raise(task);
- }
- return TRUE;
-}
-
-static void apt_task_start_complete_raise(apt_task_t *task)
-{
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Task Started [%s]",task->name);
- if(task->vtable.on_start_complete) {
- task->vtable.on_start_complete(task);
- }
- apt_task_core_msg_signal(task->parent_task,task->msg_pool,CORE_TASK_MSG_START_COMPLETE);
-}
-
-static void apt_task_terminate_complete_raise(apt_task_t *task)
-{
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Task Terminated [%s]",task->name);
- if(task->vtable.on_terminate_complete) {
- task->vtable.on_terminate_complete(task);
- }
-#ifdef ENABLE_SIMULT_TASK_TERMINATION
- apt_task_core_msg_signal(task->parent_task,task->msg_pool,CORE_TASK_MSG_TERMINATE_COMPLETE);
-#endif
-}
-
-static void apt_task_offline_complete_raise(apt_task_t *task)
-{
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Task Taken Offline [%s]",task->name);
- if(task->vtable.on_offline_complete) {
- task->vtable.on_offline_complete(task);
- }
- apt_task_core_msg_signal(task->parent_task,task->msg_pool,CORE_TASK_MSG_TAKEOFFLINE_COMPLETE);
-}
-
-static void apt_task_online_complete_raise(apt_task_t *task)
-{
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Task Brought Online [%s]",task->name);
- if(task->vtable.on_online_complete) {
- task->vtable.on_online_complete(task);
- }
- apt_task_core_msg_signal(task->parent_task,task->msg_pool,CORE_TASK_MSG_BRINGONLINE_COMPLETE);
-}
-
-static void* APR_THREAD_FUNC apt_task_run(apr_thread_t *thread_handle, void *data)
-{
- apt_task_t *task = data;
-
-#if APR_HAS_SETTHREADNAME
- apr_thread_name_set(task->name);
-#endif
- /* raise pre-run event */
- if(task->vtable.on_pre_run) {
- task->vtable.on_pre_run(task);
- }
- apr_thread_mutex_lock(task->data_guard);
- task->state = TASK_STATE_RUNNING;
- task->running = TRUE;
- apr_thread_mutex_unlock(task->data_guard);
-
- if(task->auto_ready == TRUE) {
- /* start child tasks (if any) */
- if(task->vtable.process_start) {
- task->vtable.process_start(task);
- }
- }
-
- /* run task */
- if(task->vtable.run) {
- task->vtable.run(task);
- }
-
- apr_thread_mutex_lock(task->data_guard);
- task->state = TASK_STATE_IDLE;
- task->running = FALSE;
- apr_thread_mutex_unlock(task->data_guard);
- /* raise post-run event */
- if(task->vtable.on_post_run) {
- task->vtable.on_post_run(task);
- }
-
- apr_thread_exit(thread_handle,APR_SUCCESS);
- return NULL;
-}
-
-static APR_INLINE void apt_task_vtable_reset(apt_task_vtable_t *vtable)
-{
- vtable->destroy = NULL;
- vtable->start = NULL;
- vtable->terminate = NULL;
- vtable->run = NULL;
- vtable->signal_msg = NULL;
- vtable->process_msg = NULL;
- vtable->process_start = NULL;
- vtable->process_terminate = NULL;
- vtable->on_pre_run = NULL;
- vtable->on_post_run = NULL;
- vtable->on_start_complete = NULL;
- vtable->on_terminate_complete = NULL;
- vtable->on_offline_complete = NULL;
- vtable->on_online_complete = NULL;
-}
diff --git a/libs/unimrcp/libs/apr-toolkit/src/apt_task_msg.c b/libs/unimrcp/libs/apr-toolkit/src/apt_task_msg.c
deleted file mode 100644
index d593e26eb0..0000000000
--- a/libs/unimrcp/libs/apr-toolkit/src/apt_task_msg.c
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: apt_task_msg.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include
-#include "apt_task_msg.h"
-
-/** Abstract pool of task messages to allocate task messages from */
-struct apt_task_msg_pool_t {
- void (*destroy)(apt_task_msg_pool_t *pool);
-
- apt_task_msg_t* (*acquire_msg)(apt_task_msg_pool_t *pool);
- void (*release_msg)(apt_task_msg_t *task_msg);
-
- void *obj;
- apr_pool_t *pool;
-};
-
-
-/** Dynamic allocation of messages (no actual pool exist)*/
-typedef struct apt_msg_pool_dynamic_t apt_msg_pool_dynamic_t;
-
-struct apt_msg_pool_dynamic_t {
- apr_size_t size;
-};
-
-static apt_task_msg_t* dynamic_pool_acquire_msg(apt_task_msg_pool_t *task_msg_pool)
-{
- apt_msg_pool_dynamic_t *dynamic_pool = task_msg_pool->obj;
- apt_task_msg_t *task_msg = malloc(dynamic_pool->size);
- task_msg->msg_pool = task_msg_pool;
- task_msg->type = TASK_MSG_USER;
- task_msg->sub_type = 0;
- return task_msg;
-}
-
-static void dynamic_pool_release_msg(apt_task_msg_t *task_msg)
-{
- if(task_msg) {
- free(task_msg);
- }
-}
-
-static void dynamic_pool_destroy(apt_task_msg_pool_t *task_msg_pool)
-{
- /* nothing to do */
-}
-
-APT_DECLARE(apt_task_msg_pool_t*) apt_task_msg_pool_create_dynamic(apr_size_t msg_size, apr_pool_t *pool)
-{
- apt_task_msg_pool_t *task_msg_pool = apr_palloc(pool,sizeof(apt_task_msg_pool_t));
- apt_msg_pool_dynamic_t *dynamic_pool = apr_palloc(pool,sizeof(apt_msg_pool_dynamic_t));
- dynamic_pool->size = msg_size + sizeof(apt_task_msg_t) - 1;
-
- task_msg_pool->pool = pool;
- task_msg_pool->obj = dynamic_pool;
- task_msg_pool->acquire_msg = dynamic_pool_acquire_msg;
- task_msg_pool->release_msg = dynamic_pool_release_msg;
- task_msg_pool->destroy = dynamic_pool_destroy;
- return task_msg_pool;
-}
-
-
-/** Static allocation of messages from message pool (not implemented yet) */
-APT_DECLARE(apt_task_msg_pool_t*) apt_task_msg_pool_create_static(apr_size_t msg_size, apr_size_t pool_size, apr_pool_t *pool)
-{
- return NULL;
-}
-
-
-
-APT_DECLARE(void) apt_task_msg_pool_destroy(apt_task_msg_pool_t *msg_pool)
-{
- if(msg_pool->destroy) {
- msg_pool->destroy(msg_pool);
- }
-}
-
-APT_DECLARE(apt_task_msg_t*) apt_task_msg_acquire(apt_task_msg_pool_t *task_msg_pool)
-{
- if(!task_msg_pool->acquire_msg)
- return NULL;
- return task_msg_pool->acquire_msg(task_msg_pool);
-}
-
-APT_DECLARE(void) apt_task_msg_release(apt_task_msg_t *task_msg)
-{
- apt_task_msg_pool_t *task_msg_pool = task_msg->msg_pool;
- if(task_msg_pool->release_msg)
- task_msg_pool->release_msg(task_msg);
-}
diff --git a/libs/unimrcp/libs/apr-toolkit/src/apt_test_suite.c b/libs/unimrcp/libs/apr-toolkit/src/apt_test_suite.c
deleted file mode 100644
index 4704235079..0000000000
--- a/libs/unimrcp/libs/apr-toolkit/src/apt_test_suite.c
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: apt_test_suite.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include "apt_pool.h"
-#include "apt_obj_list.h"
-#include "apt_test_suite.h"
-#include "apt_log.h"
-
-struct apt_test_framework_t{
- apr_pool_t *pool;
- apt_obj_list_t *suites;
-};
-
-APT_DECLARE(apt_test_suite_t*) apt_test_suite_create(apr_pool_t *pool, const char *name,
- void *obj, apt_test_f tester)
-{
- apt_test_suite_t *suite = apr_palloc(pool,sizeof(apt_test_suite_t));
- suite->pool = pool;
- apt_string_assign(&suite->name,name,pool);
- suite->obj = obj;
- suite->tester = tester;
- return suite;
-}
-
-APT_DECLARE(apt_test_framework_t*) apt_test_framework_create()
-{
- apt_test_framework_t *framework;
- apr_pool_t* pool = apt_pool_create();
- framework = apr_palloc(pool,sizeof(apt_test_framework_t));
- framework->pool = pool;
- framework->suites = apt_list_create(pool);
-
- apt_log_instance_create(APT_LOG_OUTPUT_CONSOLE,APT_PRIO_INFO,pool);
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create Test Framework");
- return framework;
-}
-
-APT_DECLARE(void) apt_test_framework_destroy(apt_test_framework_t *framework)
-{
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Destroy Test Framework");
- apt_log_instance_destroy();
- apr_pool_destroy(framework->pool);
-}
-
-APT_DECLARE(apt_bool_t) apt_test_framework_suite_add(apt_test_framework_t *framework, apt_test_suite_t *suite)
-{
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Add Test Suite [%s]",suite->name.buf);
- return (apt_list_push_back(framework->suites,suite,suite->pool) ? TRUE : FALSE);
-}
-
-APT_DECLARE(apr_pool_t*) apt_test_framework_pool_get(const apt_test_framework_t *framework)
-{
- return framework->pool;
-}
-
-static apt_bool_t apt_test_framework_suite_run(apt_test_framework_t *framework, apt_test_suite_t *suite,
- int argc, const char * const *argv)
-{
- apt_bool_t status = FALSE;
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"----- Run Test Suite [%s] -----",suite->name.buf);
- if(suite->tester) {
- status = suite->tester(suite,argc,argv);
- }
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"---- Status [%s] ----\n",(status == TRUE) ? "OK" : "Failure");
- return status;
-}
-
-APT_DECLARE(apt_bool_t) apt_test_framework_run(apt_test_framework_t *framework, int argc, const char * const *argv)
-{
- apt_test_suite_t *suite = NULL;
- apt_list_elem_t *elem = apt_list_first_elem_get(framework->suites);
- if(argc == 1) {
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Run All Test Suites");
- /* walk through the list of test suites and run all of them */
- while(elem) {
- suite = apt_list_elem_object_get(elem);
- if(suite) {
- /* run test suite with the default arguments */
- apt_test_framework_suite_run(framework,suite,0,NULL);
- }
- elem = apt_list_next_elem_get(framework->suites,elem);
- }
- }
- else {
- /* walk through the list of test suites find appropriate one and run it */
- apt_bool_t found = FALSE;
- apt_str_t name;
- apt_string_set(&name,argv[1]);
- while(elem) {
- suite = apt_list_elem_object_get(elem);
- if(suite && apt_string_compare(&suite->name,&name) == TRUE) {
- found = TRUE;
- break;
- }
- elem = apt_list_next_elem_get(framework->suites,elem);
- }
- if(found == TRUE) {
- /* run test suite with remaining arguments */
- apt_test_framework_suite_run(framework,suite,argc-2,&argv[2]);
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"No Such Test Suite [%s] to Run", argv[1]);
- }
- }
- return TRUE;
-}
diff --git a/libs/unimrcp/libs/apr-toolkit/src/apt_text_message.c b/libs/unimrcp/libs/apr-toolkit/src/apt_text_message.c
deleted file mode 100644
index 4a9db353df..0000000000
--- a/libs/unimrcp/libs/apr-toolkit/src/apt_text_message.c
+++ /dev/null
@@ -1,451 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: apt_text_message.c 2218 2014-11-11 02:28:58Z achaloyan@gmail.com $
- */
-
-#include "apt_text_message.h"
-#include "apt_log.h"
-
-/** Stage of text message processing (parsing/generation) */
-typedef enum {
- APT_MESSAGE_STAGE_START_LINE,
- APT_MESSAGE_STAGE_HEADER,
- APT_MESSAGE_STAGE_BODY
-} apt_message_stage_e;
-
-
-/** Text message parser */
-struct apt_message_parser_t {
- const apt_message_parser_vtable_t *vtable;
- void *obj;
- apr_pool_t *pool;
- apt_message_context_t context;
- apr_size_t content_length;
- apt_message_stage_e stage;
- apt_bool_t skip_lf;
- apt_bool_t verbose;
-};
-
-/** Text message generator */
-struct apt_message_generator_t {
- const apt_message_generator_vtable_t *vtable;
- void *obj;
- apr_pool_t *pool;
- apt_message_context_t context;
- apr_size_t content_length;
- apt_message_stage_e stage;
- apt_bool_t verbose;
-};
-
-/** Parse individual header field (name-value pair) */
-APT_DECLARE(apt_header_field_t*) apt_header_field_parse(apt_text_stream_t *stream, apr_pool_t *pool)
-{
- apr_size_t folding_length = 0;
- apr_array_header_t *folded_lines = NULL;
- apt_header_field_t *header_field;
- apt_str_t temp_line;
- apt_str_t *line;
- apt_pair_t pair;
- /* read name-value pair */
- if(apt_text_header_read(stream,&pair) == FALSE) {
- return NULL;
- }
-
- /* check folding lines (value spanning multiple lines) */
- while(stream->pos < stream->end) {
- if(apt_text_is_wsp(*stream->pos) == FALSE) {
- break;
- }
-
- stream->pos++;
-
- /* skip further white spaces (if any) */
- apt_text_white_spaces_skip(stream);
-
- if(!folded_lines) {
- folded_lines = apr_array_make(pool,1,sizeof(apt_str_t));
- }
- if(apt_text_line_read(stream,&temp_line) == TRUE) {
- line = apr_array_push(folded_lines);
- *line = temp_line;
- folding_length += line->length;
- }
- };
-
- header_field = apt_header_field_alloc(pool);
- /* copy parsed name of the header field */
- header_field->name.length = pair.name.length;
- header_field->name.buf = apr_palloc(pool, pair.name.length + 1);
- if(pair.name.length) {
- memcpy(header_field->name.buf, pair.name.buf, pair.name.length);
- }
- header_field->name.buf[header_field->name.length] = '\0';
-
- /* copy parsed value of the header field */
- header_field->value.length = pair.value.length + folding_length;
- header_field->value.buf = apr_palloc(pool, header_field->value.length + 1);
- if(pair.value.length) {
- memcpy(header_field->value.buf, pair.value.buf, pair.value.length);
- }
-
- if(folding_length) {
- int i;
- char *pos = header_field->value.buf + pair.value.length;
- /* copy parsed folding lines */
- for(i=0; inelts; i++) {
- line = &APR_ARRAY_IDX(folded_lines,i,apt_str_t);
-
- memcpy(pos,line->buf,line->length);
- pos += line->length;
- }
- }
- header_field->value.buf[header_field->value.length] = '\0';
-
- return header_field;
-}
-
-/** Generate individual header field (name-value pair) */
-APT_DECLARE(apt_bool_t) apt_header_field_generate(const apt_header_field_t *header_field, apt_text_stream_t *stream)
-{
- return apt_text_name_value_insert(stream,&header_field->name,&header_field->value);
-}
-
-/** Parse header section */
-APT_DECLARE(apt_bool_t) apt_header_section_parse(apt_header_section_t *header, apt_text_stream_t *stream, apr_pool_t *pool)
-{
- apt_header_field_t *header_field;
- apt_bool_t result = FALSE;
-
- do {
- header_field = apt_header_field_parse(stream,pool);
- if(header_field) {
- if(apt_string_is_empty(&header_field->name) == FALSE) {
- /* normal header */
- apt_header_section_field_add(header,header_field);
- }
- else {
- /* empty header => exit */
- result = TRUE;
- break;
- }
- }
- else {
- /* malformed header => skip to the next one */
- }
- }
- while(apt_text_is_eos(stream) == FALSE);
-
- return result;
-}
-
-/** Generate header section */
-APT_DECLARE(apt_bool_t) apt_header_section_generate(const apt_header_section_t *header, apt_text_stream_t *stream)
-{
- apt_header_field_t *header_field;
- for(header_field = APR_RING_FIRST(&header->ring);
- header_field != APR_RING_SENTINEL(&header->ring, apt_header_field_t, link);
- header_field = APR_RING_NEXT(header_field, link)) {
- apt_header_field_generate(header_field,stream);
- }
-
- return apt_text_eol_insert(stream);
-}
-
-static apt_bool_t apt_message_body_read(apt_message_parser_t *parser, apt_text_stream_t *stream)
-{
- apt_bool_t status = TRUE;
- apt_str_t *body = parser->context.body;
- if(body->buf) {
- /* stream length available to read */
- apr_size_t stream_length = stream->text.length - (stream->pos - stream->text.buf);
- /* required/remaining length to read */
- apr_size_t required_length = parser->content_length - body->length;
- if(required_length > stream_length) {
- required_length = stream_length;
- /* incomplete */
- status = FALSE;
- }
- memcpy(body->buf + body->length, stream->pos, required_length);
- body->length += required_length;
- stream->pos += required_length;
- if(parser->verbose == TRUE) {
- apr_size_t length = required_length;
- const char *masked_data = apt_log_data_mask(stream->pos,&length,parser->pool);
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Parsed Message Body [%"APR_SIZE_T_FMT" bytes]\n%.*s",
- required_length, length, masked_data);
- }
- }
-
- return status;
-}
-
-static apt_bool_t apt_message_body_write(apt_message_generator_t *generator, apt_text_stream_t *stream)
-{
- apt_bool_t status = TRUE;
- apt_str_t *body = generator->context.body;
- if(body && body->length < generator->content_length) {
- /* stream length available to write */
- apr_size_t stream_length = stream->text.length - (stream->pos - stream->text.buf);
- /* required/remaining length to write */
- apr_size_t required_length = generator->content_length - body->length;
- if(required_length > stream_length) {
- required_length = stream_length;
- /* incomplete */
- status = FALSE;
- }
-
- memcpy(stream->pos, body->buf + body->length, required_length);
-
- if(generator->verbose == TRUE) {
- apr_size_t length = required_length;
- const char *masked_data = apt_log_data_mask(stream->pos,&length,generator->pool);
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Generated Message Body [%"APR_SIZE_T_FMT" bytes]\n%.*s",
- required_length, length, masked_data);
- }
-
- body->length += required_length;
- stream->pos += required_length;
- }
-
- return status;
-}
-
-
-/** Create message parser */
-APT_DECLARE(apt_message_parser_t*) apt_message_parser_create(void *obj, const apt_message_parser_vtable_t *vtable, apr_pool_t *pool)
-{
- apt_message_parser_t *parser = apr_palloc(pool,sizeof(apt_message_parser_t));
- parser->obj = obj;
- parser->vtable = vtable;
- parser->pool = pool;
- parser->context.message = NULL;
- parser->context.body = NULL;
- parser->context.header = NULL;
- parser->content_length = 0;
- parser->stage = APT_MESSAGE_STAGE_START_LINE;
- parser->skip_lf = FALSE;
- parser->verbose = FALSE;
- return parser;
-}
-
-static APR_INLINE void apt_crlf_segmentation_test(apt_message_parser_t *parser, apt_text_stream_t *stream)
-{
- /* in the worst case message segmentation may occur between and */
- if(stream->pos == stream->end && *(stream->pos-1)== APT_TOKEN_CR) {
- /* if this is the case be prepared to skip with the next attempt */
- parser->skip_lf = TRUE;
- }
-}
-
-/** Parse message by raising corresponding event handlers */
-APT_DECLARE(apt_message_status_e) apt_message_parser_run(apt_message_parser_t *parser, apt_text_stream_t *stream, void **message)
-{
- const char *pos;
- apt_message_status_e status = APT_MESSAGE_STATUS_INCOMPLETE;
- if(parser->skip_lf == TRUE) {
- /* skip occurred as a result of message segmentation between and */
- apt_text_char_skip(stream,APT_TOKEN_LF);
- parser->skip_lf = FALSE;
- }
- if(message) {
- *message = NULL;
- }
-
- do {
- pos = stream->pos;
- if(parser->stage == APT_MESSAGE_STAGE_START_LINE) {
- if(parser->vtable->on_start(parser,&parser->context,stream,parser->pool) == FALSE) {
- if(apt_text_is_eos(stream) == FALSE) {
- status = APT_MESSAGE_STATUS_INVALID;
- }
- break;
- }
-
- apt_crlf_segmentation_test(parser,stream);
-
- parser->stage = APT_MESSAGE_STAGE_HEADER;
- }
-
- if(parser->stage == APT_MESSAGE_STAGE_HEADER) {
- /* read header section */
- apt_bool_t res = apt_header_section_parse(parser->context.header,stream,parser->pool);
- if(parser->verbose == TRUE) {
- apr_size_t length = stream->pos - pos;
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Parsed Message Header [%"APR_SIZE_T_FMT" bytes]\n%.*s",
- length, length, pos);
- }
-
- apt_crlf_segmentation_test(parser,stream);
-
- if(res == FALSE) {
- break;
- }
-
- if(parser->vtable->on_header_complete) {
- if(parser->vtable->on_header_complete(parser,&parser->context) == FALSE) {
- status = APT_MESSAGE_STATUS_INVALID;
- break;
- }
- }
-
- if(parser->context.body && parser->context.body->length) {
- apt_str_t *body = parser->context.body;
- parser->content_length = body->length;
- body->buf = apr_palloc(parser->pool,parser->content_length+1);
- body->buf[parser->content_length] = '\0';
- body->length = 0;
- parser->stage = APT_MESSAGE_STAGE_BODY;
- }
- else {
- status = APT_MESSAGE_STATUS_COMPLETE;
- if(message) {
- *message = parser->context.message;
- }
- parser->stage = APT_MESSAGE_STAGE_START_LINE;
- break;
- }
- }
-
- if(parser->stage == APT_MESSAGE_STAGE_BODY) {
- if(apt_message_body_read(parser,stream) == FALSE) {
- break;
- }
-
- if(parser->vtable->on_body_complete) {
- parser->vtable->on_body_complete(parser,&parser->context);
- }
- status = APT_MESSAGE_STATUS_COMPLETE;
- if(message) {
- *message = parser->context.message;
- }
- parser->stage = APT_MESSAGE_STAGE_START_LINE;
- break;
- }
- }
- while(apt_text_is_eos(stream) == FALSE);
-
- return status;
-}
-
-/** Get external object associated with parser */
-APT_DECLARE(void*) apt_message_parser_object_get(apt_message_parser_t *parser)
-{
- return parser->obj;
-}
-
-/** Set verbose mode for the parser */
-APT_DECLARE(void) apt_message_parser_verbose_set(apt_message_parser_t *parser, apt_bool_t verbose)
-{
- parser->verbose = verbose;
-}
-
-
-/** Create message generator */
-APT_DECLARE(apt_message_generator_t*) apt_message_generator_create(void *obj, const apt_message_generator_vtable_t *vtable, apr_pool_t *pool)
-{
- apt_message_generator_t *generator = apr_palloc(pool,sizeof(apt_message_generator_t));
- generator->obj = obj;
- generator->vtable = vtable;
- generator->pool = pool;
- generator->context.message = NULL;
- generator->context.header = NULL;
- generator->context.body = NULL;
- generator->content_length = 0;
- generator->stage = APT_MESSAGE_STAGE_START_LINE;
- generator->verbose = FALSE;
- return generator;
-}
-
-static apt_message_status_e apt_message_generator_break(apt_message_generator_t *generator, apt_text_stream_t *stream)
-{
- /* failed to generate message */
- if(apt_text_is_eos(stream) == TRUE) {
- /* end of stream reached */
- return APT_MESSAGE_STATUS_INCOMPLETE;
- }
-
- /* error case */
- return APT_MESSAGE_STATUS_INVALID;
-}
-
-/** Generate message */
-APT_DECLARE(apt_message_status_e) apt_message_generator_run(apt_message_generator_t *generator, void *message, apt_text_stream_t *stream)
-{
- if(!message) {
- return APT_MESSAGE_STATUS_INVALID;
- }
-
- if(message != generator->context.message) {
- generator->stage = APT_MESSAGE_STAGE_START_LINE;
- generator->context.message = message;
- generator->context.header = NULL;
- generator->context.body = NULL;
- }
-
- if(generator->stage == APT_MESSAGE_STAGE_START_LINE) {
- /* generate start-line */
- if(generator->vtable->on_start(generator,&generator->context,stream) == FALSE) {
- return apt_message_generator_break(generator,stream);
- }
-
- if(!generator->context.header || !generator->context.body) {
- return APT_MESSAGE_STATUS_INVALID;
- }
-
- /* generate header */
- if(apt_header_section_generate(generator->context.header,stream) == FALSE) {
- return apt_message_generator_break(generator,stream);
- }
-
- if(generator->vtable->on_header_complete) {
- generator->vtable->on_header_complete(generator,&generator->context,stream);
- }
- if(generator->verbose == TRUE) {
- apr_size_t length = stream->pos - stream->text.buf;
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Generated Message Header [%"APR_SIZE_T_FMT" bytes]\n%.*s",
- length, length, stream->text.buf);
- }
-
- generator->stage = APT_MESSAGE_STAGE_START_LINE;
- generator->content_length = generator->context.body->length;
- if(generator->content_length) {
- generator->context.body->length = 0;
- generator->stage = APT_MESSAGE_STAGE_BODY;
- }
- }
-
- if(generator->stage == APT_MESSAGE_STAGE_BODY) {
- if(apt_message_body_write(generator,stream) == FALSE) {
- return apt_message_generator_break(generator,stream);
- }
-
- generator->stage = APT_MESSAGE_STAGE_START_LINE;
- }
-
- return APT_MESSAGE_STATUS_COMPLETE;
-}
-
-/** Get external object associated with generator */
-APT_DECLARE(void*) apt_message_generator_object_get(apt_message_generator_t *generator)
-{
- return generator->obj;
-}
-
-/** Set verbose mode for the parser */
-APT_DECLARE(void) apt_message_generator_verbose_set(apt_message_generator_t *generator, apt_bool_t verbose)
-{
- generator->verbose = verbose;
-}
diff --git a/libs/unimrcp/libs/apr-toolkit/src/apt_text_stream.c b/libs/unimrcp/libs/apr-toolkit/src/apt_text_stream.c
deleted file mode 100644
index 1df0509ef2..0000000000
--- a/libs/unimrcp/libs/apr-toolkit/src/apt_text_stream.c
+++ /dev/null
@@ -1,554 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: apt_text_stream.c 2223 2014-11-12 00:37:40Z achaloyan@gmail.com $
- */
-
-#include
-#include
-#include
-#include "apt_text_stream.h"
-
-#define TOKEN_TRUE "true"
-#define TOKEN_FALSE "false"
-#define TOKEN_TRUE_LENGTH (sizeof(TOKEN_TRUE)-1)
-#define TOKEN_FALSE_LENGTH (sizeof(TOKEN_FALSE)-1)
-
-#if _MSC_VER >= 1900
-#pragma warning(disable: 4477)
-// 'sprintf' : format string '%d' requires an argument of type 'int', but variadic argument 1 has type 'apr_size_t' apt_text_stream.c 495
-// 'sprintf' : format string '%03d' requires an argument of type 'int', but variadic argument 1 has type 'apr_size_t' apt_text_stream.c 515
-#endif
-
-
-/** Navigate through the lines of the text stream (message) */
-APT_DECLARE(apt_bool_t) apt_text_line_read(apt_text_stream_t *stream, apt_str_t *line)
-{
- char *pos = stream->pos;
- apt_bool_t status = FALSE;
- line->length = 0;
- line->buf = pos;
- /* while not end of stream */
- while(pos < stream->end) {
- if(*pos == APT_TOKEN_CR) {
- /* end of line detected */
- line->length = pos - line->buf;
- pos++;
- if(pos < stream->end && *pos == APT_TOKEN_LF) {
- pos++;
- }
- status = TRUE;
- break;
- }
- else if(*pos == APT_TOKEN_LF) {
- /* end of line detected */
- line->length = pos - line->buf;
- pos++;
- status = TRUE;
- break;
- }
- pos++;
- }
-
- if(status == TRUE) {
- /* advance stream pos */
- stream->pos = pos;
- }
- else {
- /* end of stream is reached, do not advance stream pos, but set is_eos flag */
- stream->is_eos = TRUE;
- line->length = pos - line->buf;
- }
- return status;
-}
-
-/** To be used to navigate through the header fields (name:value pairs) of the text stream (message)
- Valid header fields are:
- name:value
- name: value
- name: value
- name: value
- name: (only name, no value)
- (empty header)
- Malformed header fields are:
- name:value (missing end of line )
- name (missing separator ':')
-*/
-APT_DECLARE(apt_bool_t) apt_text_header_read(apt_text_stream_t *stream, apt_pair_t *pair)
-{
- char *pos = stream->pos;
- apt_bool_t status = FALSE;
- apt_string_reset(&pair->name);
- apt_string_reset(&pair->value);
- /* while not end of stream */
- while(pos < stream->end) {
- if(*pos == APT_TOKEN_CR) {
- /* end of line detected */
- if(pair->value.buf) {
- /* set length of the value */
- pair->value.length = pos - pair->value.buf;
- }
- pos++;
- if(pos < stream->end && *pos == APT_TOKEN_LF) {
- pos++;
- }
- status = TRUE;
- break;
- }
- else if(*pos == APT_TOKEN_LF) {
- /* end of line detected */
- if(pair->value.buf) {
- /* set length of the value */
- pair->value.length = pos - pair->value.buf;
- }
- pos++;
- status = TRUE;
- break;
- }
- else if(!pair->name.length) {
- /* skip preceding white spaces (SHOULD NOT be any WSP, though) and read name */
- if(!pair->name.buf && apt_text_is_wsp(*pos) == FALSE) {
- pair->name.buf = pos;
- }
- if(*pos == ':') {
- /* set length of the name */
- pair->name.length = pos - pair->name.buf;
- }
- }
- else if(!pair->value.length) {
- /* skip preceding white spaces and read value */
- if(!pair->value.buf && apt_text_is_wsp(*pos) == FALSE) {
- pair->value.buf = pos;
- }
- }
- pos++;
- }
-
- if(status == TRUE) {
- /* advance stream pos regardless it's a valid header or not */
- stream->pos = pos;
-
- /* if length == 0 && buf => header is malformed */
- if(!pair->name.length && pair->name.buf) {
- status = FALSE;
- }
- }
- else {
- /* end of stream is reached, do not advance stream pos, but set is_eos flag */
- stream->is_eos = TRUE;
- }
-
- return status;
-}
-
-
-/** Navigate through the fields of the line */
-APT_DECLARE(apt_bool_t) apt_text_field_read(apt_text_stream_t *stream, char separator, apt_bool_t skip_spaces, apt_str_t *field)
-{
- char *pos = stream->pos;
- if(skip_spaces == TRUE) {
- while(pos < stream->end && *pos == APT_TOKEN_SP) pos++;
- }
-
- field->buf = pos;
- field->length = 0;
- while(pos < stream->end && *pos != separator) pos++;
-
- field->length = pos - field->buf;
- if(pos < stream->end) {
- /* skip the separator */
- pos++;
- }
-
- stream->pos = pos;
- return field->length ? TRUE : FALSE;
-}
-
-/** Scroll text stream */
-APT_DECLARE(apt_bool_t) apt_text_stream_scroll(apt_text_stream_t *stream)
-{
- if(stream->pos == stream->end) {
- stream->pos = stream->text.buf;
- }
- else {
- apr_size_t remaining_length = stream->text.buf + stream->text.length - stream->pos;
- if(!remaining_length || remaining_length == stream->text.length) {
- stream->pos = stream->text.buf + remaining_length;
- return FALSE;
- }
- memmove(stream->text.buf,stream->pos,remaining_length);
- stream->pos = stream->text.buf + remaining_length;
- stream->text.length = remaining_length;
- }
- *stream->pos = '\0';
- return TRUE;
-}
-
-/** Parse id@resource string */
-APT_DECLARE(apt_bool_t) apt_id_resource_parse(const apt_str_t *str, char separator, apt_str_t *id, apt_str_t *resource, apr_pool_t *pool)
-{
- apt_str_t field = *str;
- const char *pos = strchr(str->buf,separator);
- if(!pos) {
- return FALSE;
- }
-
- field.length = pos - field.buf;
- if(field.length >= str->length) {
- return FALSE;
- }
- apt_string_copy(id,&field,pool);
- field.buf += field.length + 1;
- field.length = str->length - (field.length + 1);
- apt_string_copy(resource,&field,pool);
- return TRUE;
-}
-
-/** Generate id@resource string */
-APT_DECLARE(apt_bool_t) apt_id_resource_generate(const apt_str_t *id, const apt_str_t *resource, char separator, apt_str_t *str, apr_pool_t *pool)
-{
- apr_size_t length = id->length+resource->length+1;
- char *buf = apr_palloc(pool,length+1);
- memcpy(buf,id->buf,id->length);
- buf[id->length] = separator;
- memcpy(buf+id->length+1,resource->buf,resource->length);
- buf[length] = '\0';
- str->buf = buf;
- str->length = length;
- return TRUE;
-}
-
-/** Generate name-value pair line */
-APT_DECLARE(apt_bool_t) apt_text_name_value_insert(apt_text_stream_t *stream, const apt_str_t *name, const apt_str_t *value)
-{
- char *pos = stream->pos;
- if(pos + name->length + value->length + 2 >= stream->end) {
- return FALSE;
- }
- memcpy(pos,name->buf,name->length);
- pos += name->length;
- *pos++ = ':';
- *pos++ = APT_TOKEN_SP;
- if(apt_string_is_empty(value) == FALSE) {
- memcpy(pos,value->buf,value->length);
- pos += value->length;
- }
- stream->pos = pos;
- return apt_text_eol_insert(stream);
-}
-
-/** Generate only the name ("name":) of the header field */
-APT_DECLARE(apt_bool_t) apt_text_header_name_insert(apt_text_stream_t *stream, const apt_str_t *name)
-{
- char *pos = stream->pos;
- if(pos + name->length + 2 >= stream->end) {
- return FALSE;
- }
- memcpy(pos,name->buf,name->length);
- pos += name->length;
- *pos++ = ':';
- *pos++ = APT_TOKEN_SP;
- stream->pos = pos;
- return TRUE;
-}
-
-/** Parse name=value pair */
-static apt_bool_t apt_pair_parse(apt_pair_t *pair, const apt_str_t *field, apr_pool_t *pool)
-{
- apt_text_stream_t stream;
- apt_str_t item;
- stream.text = *field;
- apt_text_stream_reset(&stream);
-
- /* read name */
- if(apt_text_field_read(&stream,'=',TRUE,&item) == FALSE) {
- return FALSE;
- }
- apt_string_copy(&pair->name,&item,pool);
-
- /* read value */
- if(apt_text_field_read(&stream,';',TRUE,&item) == TRUE) {
- apt_string_copy(&pair->value,&item,pool);
- }
- else {
- apt_string_reset(&pair->value);
- }
- return TRUE;
-}
-
-/** Parse array of name-value pairs */
-APT_DECLARE(apt_bool_t) apt_pair_array_parse(apt_pair_arr_t *arr, const apt_str_t *value, apr_pool_t *pool)
-{
- apt_str_t field;
- apt_pair_t *pair;
- apt_text_stream_t stream;
- if(!arr || !value) {
- return FALSE;
- }
-
- stream.text = *value;
- apt_text_stream_reset(&stream);
- /* read name-value pairs */
- while(apt_text_field_read(&stream,';',TRUE,&field) == TRUE) {
- pair = apr_array_push(arr);
- apt_pair_parse(pair,&field,pool);
- }
- return TRUE;
-}
-
-/** Generate array of name-value pairs */
-APT_DECLARE(apt_bool_t) apt_pair_array_generate(const apt_pair_arr_t *arr, apt_str_t *str, apr_pool_t *pool)
-{
- int i;
- char *pos;
- apt_pair_t *pair;
- if(!arr || !str) {
- return FALSE;
- }
-
- /* Compute length of string being generated */
- str->length = 0;
- for(i=0; inelts; i++) {
- pair = (apt_pair_t*)arr->elts + i;
- /* name */
- str->length += pair->name.length;
- if(pair->value.length) {
- /* =value */
- str->length += 1 + pair->value.length;
- }
- }
- if(arr->nelts) {
- /* ; */
- str->length += arr->nelts - 1;
- }
-
- /* Allocate required string */
- str->buf = apr_palloc(pool, str->length + 1);
-
- /* Copy pairs into allocated string */
- pos = str->buf;
- for(i=0; inelts; i++) {
- pair = (apt_pair_t*)arr->elts + i;
- if(i != 0) {
- *pos++ = ';';
- }
- if(pair->name.length) {
- memcpy(pos,pair->name.buf,pair->name.length);
- pos += pair->name.length;
- if(pair->value.length) {
- *pos++ = '=';
- memcpy(pos,pair->value.buf,pair->value.length);
- pos += pair->value.length;
- }
- }
- }
- *pos = '\0';
- return TRUE;
-}
-
-/** Parse boolean-value */
-APT_DECLARE(apt_bool_t) apt_boolean_value_parse(const apt_str_t *str, apt_bool_t *value)
-{
- if(!str->buf) {
- return FALSE;
- }
- if(strncasecmp(str->buf,TOKEN_TRUE,TOKEN_TRUE_LENGTH) == 0) {
- *value = TRUE;
- return TRUE;
- }
- if(strncasecmp(str->buf,TOKEN_FALSE,TOKEN_FALSE_LENGTH) == 0) {
- *value = FALSE;
- return TRUE;
- }
- return FALSE;
-}
-
-/** Generate apr_size_t value from pool (buffer is allocated from pool) */
-APT_DECLARE(apt_bool_t) apt_boolean_value_generate(apt_bool_t value, apt_str_t *str, apr_pool_t *pool)
-{
- if(value == TRUE) {
- str->length = TOKEN_TRUE_LENGTH;
- str->buf = apr_palloc(pool,str->length);
- memcpy(str->buf,TOKEN_TRUE,str->length);
- }
- else {
- str->length = TOKEN_FALSE_LENGTH;
- str->buf = apr_palloc(pool,str->length);
- memcpy(str->buf,TOKEN_FALSE,str->length);
- }
- return TRUE;
-}
-
-
-/** Parse size_t value */
-APT_DECLARE(apr_size_t) apt_size_value_parse(const apt_str_t *str)
-{
- return str->buf ? atol(str->buf) : 0;
-}
-
-/** Generate apr_size_t value (buffer is allocated from pool) */
-APT_DECLARE(apt_bool_t) apt_size_value_generate(apr_size_t value, apt_str_t *str, apr_pool_t *pool)
-{
- str->buf = apr_psprintf(pool, "%"APR_SIZE_T_FMT, value);
- str->length = strlen(str->buf);
- return TRUE;
-}
-
-/** Insert apr_size_t value */
-APT_DECLARE(apt_bool_t) apt_text_size_value_insert(apt_text_stream_t *stream, apr_size_t value)
-{
- int length = apr_snprintf(stream->pos, stream->end - stream->pos, "%"APR_SIZE_T_FMT, value);
- if(length <= 0) {
- return FALSE;
- }
- stream->pos += length;
- return TRUE;
-}
-
-
-/** Parse float value */
-APT_DECLARE(float) apt_float_value_parse(const apt_str_t *str)
-{
- return str->buf ? (float)atof(str->buf) : 0;
-}
-
-/** Generate float value (buffer is allocated from pool) */
-APT_DECLARE(apt_bool_t) apt_float_value_generate(float value, apt_str_t *str, apr_pool_t *pool)
-{
- char *end;
- str->buf = apr_psprintf(pool,"%f",value);
- str->length = strlen(str->buf);
-
- /* remove trailing 0s (if any) */
- end = str->buf + str->length - 1;
- while(*end == 0x30 && end != str->buf && *(end - 1) != '.') end--;
-
- str->length = end - str->buf + 1;
- return TRUE;
-}
-
-/** Generate float value */
-APT_DECLARE(apt_bool_t) apt_text_float_value_insert(apt_text_stream_t *stream, float value)
-{
- char *end;
- int length = apr_snprintf(stream->pos, stream->end - stream->pos, "%f", value);
- if(length <= 0) {
- return FALSE;
- }
-
- /* remove trailing 0s (if any) */
- end = stream->pos + length - 1;
- while(*end == 0x30 && end != stream->pos && *(end - 1) != '.') end--;
-
- stream->pos = end + 1;
- return TRUE;
-}
-
-/** Insert string value */
-APT_DECLARE(apt_bool_t) apt_text_string_insert(apt_text_stream_t *stream, const apt_str_t *str)
-{
- if(stream->pos + str->length >= stream->end) {
- return FALSE;
- }
- if(str->length) {
- memcpy(stream->pos,str->buf,str->length);
- stream->pos += str->length;
- }
- return TRUE;
-}
-
-/** Generate value plus the length (number of digits) of the value itself. */
-APT_DECLARE(apt_bool_t) apt_var_length_value_generate(apr_size_t *value, apr_size_t max_count, apt_str_t *str)
-{
- /* (N >= (10^M-M)) ? N+M+1 : N+M */
- apr_size_t temp;
- apr_size_t count; /* M */
- apr_size_t bounds; /* 10^M */
- int length;
-
- /* calculate count */
- temp = *value;
- count = 0;
- do{count++; temp /= 10;} while(temp);
-
- /* calculate bounds */
- temp = count;
- bounds = 1;
- do{bounds *= 10; temp--;} while(temp);
-
- if(*value >= bounds - count) {
- count++;
- }
-
- *value += count;
- if(count > max_count) {
- return FALSE;
- }
-
- str->length = 0;
- length = sprintf(str->buf, "%"APR_SIZE_T_FMT, *value);
- if(length <= 0) {
- return FALSE;
- }
- str->length = length;
- return TRUE;
-}
-
-/** Generate completion-cause */
-APT_DECLARE(apt_bool_t) apt_completion_cause_generate(const apt_str_table_item_t table[], apr_size_t size, apr_size_t cause, apt_str_t *str, apr_pool_t *pool)
-{
- const apt_str_t *name = apt_string_table_str_get(table,size,cause);
- if(!name) {
- return FALSE;
- }
-
- /* 3 digits + 1 space + name->length */
- str->length = 4 + name->length;
- str->buf = apr_palloc(pool,str->length + 1);
-
- if(sprintf(str->buf,"%03"APR_SIZE_T_FMT" ",cause) != 4) {
- return FALSE;
- }
-
- memcpy(str->buf+4,name->buf,name->length);
- str->buf[str->length] = '\0';
- return TRUE;
-}
-
-
-/** Generate unique identifier (hex string) */
-APT_DECLARE(apt_bool_t) apt_unique_id_generate(apt_str_t *id, apr_size_t length, apr_pool_t *pool)
-{
- char *hex_str;
- apr_size_t i;
- apr_size_t count;
- apr_uuid_t uuid;
- apr_uuid_get(&uuid);
-
- hex_str = apr_palloc(pool,length+1);
-
- count = length / 2;
- if(count > sizeof(uuid)) {
- count = sizeof(uuid);
- }
- for(i=0; ibuf = hex_str;
- id->length = length;
- return TRUE;
-}
diff --git a/libs/unimrcp/libs/apr-toolkit/src/apt_timer_queue.c b/libs/unimrcp/libs/apr-toolkit/src/apt_timer_queue.c
deleted file mode 100644
index 05638260b9..0000000000
--- a/libs/unimrcp/libs/apr-toolkit/src/apt_timer_queue.c
+++ /dev/null
@@ -1,229 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: apt_timer_queue.c 2174 2014-09-12 03:33:16Z achaloyan@gmail.com $
- */
-
-#ifdef WIN32
-#pragma warning(disable: 4127)
-#endif
-#include
-#include "apt_timer_queue.h"
-#include "apt_log.h"
-
-/** Timer queue */
-struct apt_timer_queue_t {
- /** Ring head */
- APR_RING_HEAD(apt_timer_head_t, apt_timer_t) head;
-
- /** Elapsed time */
- apr_uint32_t elapsed_time;
-};
-
-/** Timer */
-struct apt_timer_t {
- /** Ring entry */
- APR_RING_ENTRY(apt_timer_t) link;
-
- /** Back pointer to queue */
- apt_timer_queue_t *queue;
- /** Time next report is scheduled at */
- apr_uint32_t scheduled_time;
-
- /** Timer proc */
- apt_timer_proc_f proc;
- /** Timer object */
- void *obj;
-};
-
-static apt_bool_t apt_timer_insert(apt_timer_queue_t *timer_queue, apt_timer_t *timer);
-static apt_bool_t apt_timer_remove(apt_timer_queue_t *timer_queue, apt_timer_t *timer);
-static void apt_timers_reschedule(apt_timer_queue_t *timer_queue);
-
-/** Create timer queue */
-APT_DECLARE(apt_timer_queue_t*) apt_timer_queue_create(apr_pool_t *pool)
-{
- apt_timer_queue_t *timer_queue = apr_palloc(pool,sizeof(apt_timer_queue_t));
- APR_RING_INIT(&timer_queue->head, apt_timer_t, link);
- timer_queue->elapsed_time = 0;
- return timer_queue;
-}
-
-/** Destroy timer queue */
-APT_DECLARE(void) apt_timer_queue_destroy(apt_timer_queue_t *timer_queue)
-{
- /* nothing to destroy */
-}
-
-/** Advance scheduled timers */
-APT_DECLARE(void) apt_timer_queue_advance(apt_timer_queue_t *timer_queue, apr_uint32_t elapsed_time)
-{
- apt_timer_t *timer;
-
- if(APR_RING_EMPTY(&timer_queue->head, apt_timer_t, link)) {
- /* just return, nothing to do */
- return;
- }
-
- /* increment elapsed time */
- timer_queue->elapsed_time += elapsed_time;
- if(timer_queue->elapsed_time >= 0xFFFF) {
-#ifdef APT_TIMER_DEBUG
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Reschedule Timers [%u]",timer_queue->elapsed_time);
-#endif
- apt_timers_reschedule(timer_queue);
- }
-
- /* process timers */
- do {
- /* get first node (timer) */
- timer = APR_RING_FIRST(&timer_queue->head);
-
- if(timer->scheduled_time > timer_queue->elapsed_time) {
- /* scheduled time is not elapsed yet */
- break;
- }
-
-#ifdef APT_TIMER_DEBUG
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Timer Elapsed 0x%x [%u]",timer,timer->scheduled_time);
-#endif
- /* remove the elapsed timer from the list */
- APR_RING_REMOVE(timer, link);
- timer->scheduled_time = 0;
- /* process the elapsed timer */
- timer->proc(timer,timer->obj);
- }
- while(!APR_RING_EMPTY(&timer_queue->head, apt_timer_t, link));
-}
-
-/** Is timer queue empty */
-APT_DECLARE(apt_bool_t) apt_timer_queue_is_empty(const apt_timer_queue_t *timer_queue)
-{
- return APR_RING_EMPTY(&timer_queue->head, apt_timer_t, link) ? TRUE : FALSE;
-}
-
-/** Get current timeout */
-APT_DECLARE(apt_bool_t) apt_timer_queue_timeout_get(const apt_timer_queue_t *timer_queue, apr_uint32_t *timeout)
-{
- apt_timer_t *timer;
- /* is queue empty */
- if(APR_RING_EMPTY(&timer_queue->head, apt_timer_t, link)) {
- return FALSE;
- }
-
- /* get first node (timer) */
- timer = APR_RING_FIRST(&timer_queue->head);
- if(!timer) {
- return FALSE;
- }
-
- *timeout = timer->scheduled_time - timer_queue->elapsed_time;
- return TRUE;
-}
-
-/** Create timer */
-APT_DECLARE(apt_timer_t*) apt_timer_create(apt_timer_queue_t *timer_queue, apt_timer_proc_f proc, void *obj, apr_pool_t *pool)
-{
- apt_timer_t *timer = apr_palloc(pool,sizeof(apt_timer_t));
- APR_RING_ELEM_INIT(timer,link);
- timer->queue = timer_queue;
- timer->scheduled_time = 0;
- timer->proc = proc;
- timer->obj = obj;
- return timer;
-}
-
-/** Set one-shot timer */
-APT_DECLARE(apt_bool_t) apt_timer_set(apt_timer_t *timer, apr_uint32_t timeout)
-
-{
- apt_timer_queue_t *queue = timer->queue;
-
- if(timeout <= 0 || !timer->proc) {
- return FALSE;
- }
-
- if(timer->scheduled_time) {
- /* remove timer first */
- apt_timer_remove(queue,timer);
- }
-
- /* calculate time to elapse */
- timer->scheduled_time = queue->elapsed_time + timeout;
-#ifdef APT_TIMER_DEBUG
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Set Timer 0x%x [%u]",timer,timer->scheduled_time);
-#endif
- if(APR_RING_EMPTY(&queue->head, apt_timer_t, link)) {
- APR_RING_INSERT_TAIL(&queue->head,timer,apt_timer_t,link);
- return TRUE;
- }
-
- /* insert new node (timer) to sorted by scheduled time list */
- return apt_timer_insert(queue,timer);
-}
-
-/** Kill timer */
-APT_DECLARE(apt_bool_t) apt_timer_kill(apt_timer_t *timer)
-{
- if(!timer->scheduled_time) {
- return FALSE;
- }
-
-#ifdef APT_TIMER_DEBUG
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Kill Timer 0x%x [%u]",timer,timer->scheduled_time);
-#endif
- return apt_timer_remove(timer->queue,timer);
-}
-
-static apt_bool_t apt_timer_insert(apt_timer_queue_t *timer_queue, apt_timer_t *timer)
-{
- apt_timer_t *it;
- for(it = APR_RING_LAST(&timer_queue->head);
- it != APR_RING_SENTINEL(&timer_queue->head, apt_timer_t, link);
- it = APR_RING_PREV(it, link)) {
-
- if(it->scheduled_time <= timer->scheduled_time) {
- APR_RING_INSERT_AFTER(it,timer,link);
- return TRUE;
- }
- }
- APR_RING_INSERT_HEAD(&timer_queue->head,timer,apt_timer_t,link);
- return TRUE;
-}
-
-static apt_bool_t apt_timer_remove(apt_timer_queue_t *timer_queue, apt_timer_t *timer)
-{
- /* remove node (timer) from the list */
- APR_RING_REMOVE(timer,link);
- timer->scheduled_time = 0;
-
- if(APR_RING_EMPTY(&timer_queue->head, apt_timer_t, link)) {
- /* reset elapsed time if no timers set */
- timer_queue->elapsed_time = 0;
- }
- return TRUE;
-}
-
-static void apt_timers_reschedule(apt_timer_queue_t *timer_queue)
-{
- apt_timer_t *it;
- for(it = APR_RING_LAST(&timer_queue->head);
- it != APR_RING_SENTINEL(&timer_queue->head, apt_timer_t, link);
- it = APR_RING_PREV(it, link)) {
-
- it->scheduled_time -= timer_queue->elapsed_time;
- }
- timer_queue->elapsed_time = 0;
-}
diff --git a/libs/unimrcp/libs/mpf/Makefile.am b/libs/unimrcp/libs/mpf/Makefile.am
deleted file mode 100644
index f877596a41..0000000000
--- a/libs/unimrcp/libs/mpf/Makefile.am
+++ /dev/null
@@ -1,82 +0,0 @@
-MAINTAINERCLEANFILES = Makefile.in
-
-AM_CPPFLAGS = -I$(top_srcdir)/libs/mpf/codecs \
- -I$(top_srcdir)/libs/mpf/include \
- -I$(top_srcdir)/libs/apr-toolkit/include \
- $(UNIMRCP_APR_INCLUDES)
-
-noinst_LTLIBRARIES = libmpf.la
-
-include_HEADERS = codecs/g711/g711.h \
- include/mpf.h \
- include/mpf_activity_detector.h \
- include/mpf_audio_file_descriptor.h \
- include/mpf_audio_file_stream.h \
- include/mpf_bridge.h \
- include/mpf_buffer.h \
- include/mpf_codec.h \
- include/mpf_codec_descriptor.h \
- include/mpf_codec_manager.h \
- include/mpf_context.h \
- include/mpf_dtmf_detector.h \
- include/mpf_dtmf_generator.h \
- include/mpf_engine.h \
- include/mpf_engine_factory.h \
- include/mpf_frame.h \
- include/mpf_frame_buffer.h \
- include/mpf_message.h \
- include/mpf_mixer.h \
- include/mpf_multiplier.h \
- include/mpf_named_event.h \
- include/mpf_object.h \
- include/mpf_stream.h \
- include/mpf_stream_descriptor.h \
- include/mpf_termination.h \
- include/mpf_termination_factory.h \
- include/mpf_rtp_termination_factory.h \
- include/mpf_file_termination_factory.h \
- include/mpf_scheduler.h \
- include/mpf_types.h \
- include/mpf_encoder.h \
- include/mpf_decoder.h \
- include/mpf_jitter_buffer.h \
- include/mpf_rtp_header.h \
- include/mpf_rtp_descriptor.h \
- include/mpf_rtp_stream.h \
- include/mpf_rtp_stat.h \
- include/mpf_rtp_defs.h \
- include/mpf_rtp_attribs.h \
- include/mpf_rtp_pt.h \
- include/mpf_rtcp_packet.h \
- include/mpf_resampler.h
-
-libmpf_la_SOURCES = codecs/g711/g711.c \
- src/mpf_activity_detector.c \
- src/mpf_audio_file_stream.c \
- src/mpf_bridge.c \
- src/mpf_buffer.c \
- src/mpf_codec_descriptor.c \
- src/mpf_codec_g711.c \
- src/mpf_codec_linear.c \
- src/mpf_codec_manager.c \
- src/mpf_context.c \
- src/mpf_dtmf_detector.c \
- src/mpf_dtmf_generator.c \
- src/mpf_engine.c \
- src/mpf_engine_factory.c \
- src/mpf_mixer.c \
- src/mpf_multiplier.c \
- src/mpf_named_event.c \
- src/mpf_termination.c \
- src/mpf_termination_factory.c \
- src/mpf_rtp_termination_factory.c \
- src/mpf_file_termination_factory.c \
- src/mpf_frame_buffer.c \
- src/mpf_scheduler.c \
- src/mpf_encoder.c \
- src/mpf_decoder.c \
- src/mpf_jitter_buffer.c \
- src/mpf_rtp_stream.c \
- src/mpf_rtp_attribs.c \
- src/mpf_resampler.c \
- src/mpf_stream.c
diff --git a/libs/unimrcp/libs/mpf/codecs/g711/g711.c b/libs/unimrcp/libs/mpf/codecs/g711/g711.c
deleted file mode 100644
index 1d2a079152..0000000000
--- a/libs/unimrcp/libs/mpf/codecs/g711/g711.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * SpanDSP - a series of DSP components for telephony
- *
- * g711.c - A-law and u-law transcoding routines
- *
- * Written by Steve Underwood
- *
- * Copyright (C) 2006 Steve Underwood
- *
- * Despite my general liking of the GPL, I place this code in the
- * public domain for the benefit of all mankind - even the slimy
- * ones who might try to proprietize my work and use it to my
- * detriment.
- *
- */
-
-#include "g711.h"
-
-/* Copied from the CCITT G.711 specification */
-static const apr_byte_t ulaw_to_alaw_table[256] =
-{
- 42, 43, 40, 41, 46, 47, 44, 45, 34, 35, 32, 33, 38, 39, 36, 37,
- 58, 59, 56, 57, 62, 63, 60, 61, 50, 51, 48, 49, 54, 55, 52, 53,
- 10, 11, 8, 9, 14, 15, 12, 13, 2, 3, 0, 1, 6, 7, 4, 26,
- 27, 24, 25, 30, 31, 28, 29, 18, 19, 16, 17, 22, 23, 20, 21, 106,
- 104, 105, 110, 111, 108, 109, 98, 99, 96, 97, 102, 103, 100, 101, 122, 120,
- 126, 127, 124, 125, 114, 115, 112, 113, 118, 119, 116, 117, 75, 73, 79, 77,
- 66, 67, 64, 65, 70, 71, 68, 69, 90, 91, 88, 89, 94, 95, 92, 93,
- 82, 82, 83, 83, 80, 80, 81, 81, 86, 86, 87, 87, 84, 84, 85, 85,
- 170, 171, 168, 169, 174, 175, 172, 173, 162, 163, 160, 161, 166, 167, 164, 165,
- 186, 187, 184, 185, 190, 191, 188, 189, 178, 179, 176, 177, 182, 183, 180, 181,
- 138, 139, 136, 137, 142, 143, 140, 141, 130, 131, 128, 129, 134, 135, 132, 154,
- 155, 152, 153, 158, 159, 156, 157, 146, 147, 144, 145, 150, 151, 148, 149, 234,
- 232, 233, 238, 239, 236, 237, 226, 227, 224, 225, 230, 231, 228, 229, 250, 248,
- 254, 255, 252, 253, 242, 243, 240, 241, 246, 247, 244, 245, 203, 201, 207, 205,
- 194, 195, 192, 193, 198, 199, 196, 197, 218, 219, 216, 217, 222, 223, 220, 221,
- 210, 210, 211, 211, 208, 208, 209, 209, 214, 214, 215, 215, 212, 212, 213, 213
-};
-
-/* These transcoding tables are copied from the CCITT G.711 specification. To achieve
- optimal results, do not change them. */
-static const apr_byte_t alaw_to_ulaw_table[256] =
-{
- 42, 43, 40, 41, 46, 47, 44, 45, 34, 35, 32, 33, 38, 39, 36, 37,
- 57, 58, 55, 56, 61, 62, 59, 60, 49, 50, 47, 48, 53, 54, 51, 52,
- 10, 11, 8, 9, 14, 15, 12, 13, 2, 3, 0, 1, 6, 7, 4, 5,
- 26, 27, 24, 25, 30, 31, 28, 29, 18, 19, 16, 17, 22, 23, 20, 21,
- 98, 99, 96, 97, 102, 103, 100, 101, 93, 93, 92, 92, 95, 95, 94, 94,
- 116, 118, 112, 114, 124, 126, 120, 122, 106, 107, 104, 105, 110, 111, 108, 109,
- 72, 73, 70, 71, 76, 77, 74, 75, 64, 65, 63, 63, 68, 69, 66, 67,
- 86, 87, 84, 85, 90, 91, 88, 89, 79, 79, 78, 78, 82, 83, 80, 81,
- 170, 171, 168, 169, 174, 175, 172, 173, 162, 163, 160, 161, 166, 167, 164, 165,
- 185, 186, 183, 184, 189, 190, 187, 188, 177, 178, 175, 176, 181, 182, 179, 180,
- 138, 139, 136, 137, 142, 143, 140, 141, 130, 131, 128, 129, 134, 135, 132, 133,
- 154, 155, 152, 153, 158, 159, 156, 157, 146, 147, 144, 145, 150, 151, 148, 149,
- 226, 227, 224, 225, 230, 231, 228, 229, 221, 221, 220, 220, 223, 223, 222, 222,
- 244, 246, 240, 242, 252, 254, 248, 250, 234, 235, 232, 233, 238, 239, 236, 237,
- 200, 201, 198, 199, 204, 205, 202, 203, 192, 193, 191, 191, 196, 197, 194, 195,
- 214, 215, 212, 213, 218, 219, 216, 217, 207, 207, 206, 206, 210, 211, 208, 209
-};
-
-apr_byte_t alaw_to_ulaw(apr_byte_t alaw)
-{
- return alaw_to_ulaw_table[alaw];
-}
-/*- End of function --------------------------------------------------------*/
-
-apr_byte_t ulaw_to_alaw(apr_byte_t ulaw)
-{
- return ulaw_to_alaw_table[ulaw];
-}
-/*- End of function --------------------------------------------------------*/
-/*- End of file ------------------------------------------------------------*/
diff --git a/libs/unimrcp/libs/mpf/codecs/g711/g711.h b/libs/unimrcp/libs/mpf/codecs/g711/g711.h
deleted file mode 100644
index 3814dd79dc..0000000000
--- a/libs/unimrcp/libs/mpf/codecs/g711/g711.h
+++ /dev/null
@@ -1,374 +0,0 @@
-/*
- * SpanDSP - a series of DSP components for telephony
- *
- * g711.h - In line A-law and u-law conversion routines
- *
- * Written by Steve Underwood
- *
- * Copyright (C) 2001 Steve Underwood
- *
- * Despite my general liking of the GPL, I place this code in the
- * public domain for the benefit of all mankind - even the slimy
- * ones who might try to proprietize my work and use it to my
- * detriment.
- *
- */
-
-/* g711_page A-law and mu-law handling
-Lookup tables for A-law and u-law look attractive, until you consider the impact
-on the CPU cache. If it causes a substantial area of your processor cache to get
-hit too often, cache sloshing will severely slow things down. The main reason
-these routines are slow in C, is the lack of direct access to the CPU's "find
-the first 1" instruction. A little in-line assembler fixes that, and the
-conversion routines can be faster than lookup tables, in most real world usage.
-A "find the first 1" instruction is available on most modern CPUs, and is a
-much underused feature.
-
-If an assembly language method of bit searching is not available, these routines
-revert to a method that can be a little slow, so the cache thrashing might not
-seem so bad :(
-
-Feel free to submit patches to add fast "find the first 1" support for your own
-favourite processor.
-
-Look up tables are used for transcoding between A-law and u-law, since it is
-difficult to achieve the precise transcoding procedure laid down in the G.711
-specification by other means.
-*/
-
-#ifndef MPF_G711_H
-#define MPF_G711_H
-
-/**
- * @file g711.h
- * @brief A-law and u-law conversion routines
- */
-
-#include "mpf.h"
-
-APT_BEGIN_EXTERN_C
-
-#if defined(__i386__)
-/*! \brief Find the bit position of the highest set bit in a word
- \param bits The word to be searched
- \return The bit number of the highest set bit, or -1 if the word is zero. */
-static APR_INLINE int top_bit(unsigned int bits)
-{
- int res;
-
- __asm__ __volatile__(" movl $-1,%%edx;\n"
- " bsrl %%eax,%%edx;\n"
- : "=d" (res)
- : "a" (bits));
- return res;
-}
-/*- End of function --------------------------------------------------------*/
-
-/*! \brief Find the bit position of the lowest set bit in a word
- \param bits The word to be searched
- \return The bit number of the lowest set bit, or -1 if the word is zero. */
-static APR_INLINE int bottom_bit(unsigned int bits)
-{
- int res;
-
- __asm__ __volatile__(" movl $-1,%%edx;\n"
- " bsfl %%eax,%%edx;\n"
- : "=d" (res)
- : "a" (bits));
- return res;
-}
-/*- End of function --------------------------------------------------------*/
-#elif defined(__x86_64__)
-static APR_INLINE int top_bit(unsigned int bits)
-{
- int res;
-
- __asm__ __volatile__(" movq $-1,%%rdx;\n"
- " bsrq %%rax,%%rdx;\n"
- : "=d" (res)
- : "a" (bits));
- return res;
-}
-/*- End of function --------------------------------------------------------*/
-
-static APR_INLINE int bottom_bit(unsigned int bits)
-{
- int res;
-
- __asm__ __volatile__(" movq $-1,%%rdx;\n"
- " bsfq %%rax,%%rdx;\n"
- : "=d" (res)
- : "a" (bits));
- return res;
-}
-/*- End of function --------------------------------------------------------*/
-#else
-static APR_INLINE int top_bit(unsigned int bits)
-{
- int i;
-
- if (bits == 0)
- return -1;
- i = 0;
- if (bits & 0xFFFF0000)
- {
- bits &= 0xFFFF0000;
- i += 16;
- }
- if (bits & 0xFF00FF00)
- {
- bits &= 0xFF00FF00;
- i += 8;
- }
- if (bits & 0xF0F0F0F0)
- {
- bits &= 0xF0F0F0F0;
- i += 4;
- }
- if (bits & 0xCCCCCCCC)
- {
- bits &= 0xCCCCCCCC;
- i += 2;
- }
- if (bits & 0xAAAAAAAA)
- {
- bits &= 0xAAAAAAAA;
- i += 1;
- }
- return i;
-}
-/*- End of function --------------------------------------------------------*/
-
-static APR_INLINE int bottom_bit(unsigned int bits)
-{
- int i;
-
- if (bits == 0)
- return -1;
- i = 32;
- if (bits & 0x0000FFFF)
- {
- bits &= 0x0000FFFF;
- i -= 16;
- }
- if (bits & 0x00FF00FF)
- {
- bits &= 0x00FF00FF;
- i -= 8;
- }
- if (bits & 0x0F0F0F0F)
- {
- bits &= 0x0F0F0F0F;
- i -= 4;
- }
- if (bits & 0x33333333)
- {
- bits &= 0x33333333;
- i -= 2;
- }
- if (bits & 0x55555555)
- {
- bits &= 0x55555555;
- i -= 1;
- }
- return i;
-}
-/*- End of function --------------------------------------------------------*/
-#endif
-
-/* N.B. It is tempting to use look-up tables for A-law and u-law conversion.
- * However, you should consider the cache footprint.
- *
- * A 64K byte table for linear to x-law and a 512 byte table for x-law to
- * linear sound like peanuts these days, and shouldn't an array lookup be
- * real fast? No! When the cache sloshes as badly as this one will, a tight
- * calculation may be better. The messiest part is normally finding the
- * segment, but a little inline assembly can fix that on an i386, x86_64 and
- * many other modern processors.
- */
-
-/*
- * Mu-law is basically as follows:
- *
- * Biased Linear Input Code Compressed Code
- * ------------------------ ---------------
- * 00000001wxyza 000wxyz
- * 0000001wxyzab 001wxyz
- * 000001wxyzabc 010wxyz
- * 00001wxyzabcd 011wxyz
- * 0001wxyzabcde 100wxyz
- * 001wxyzabcdef 101wxyz
- * 01wxyzabcdefg 110wxyz
- * 1wxyzabcdefgh 111wxyz
- *
- * Each biased linear code has a leading 1 which identifies the segment
- * number. The value of the segment number is equal to 7 minus the number
- * of leading 0's. The quantization interval is directly available as the
- * four bits wxyz. * The trailing bits (a - h) are ignored.
- *
- * Ordinarily the complement of the resulting code word is used for
- * transmission, and so the code word is complemented before it is returned.
- *
- * For further information see John C. Bellamy's Digital Telephony, 1982,
- * John Wiley & Sons, pps 98-111 and 472-476.
- */
-
-//#define ULAW_ZEROTRAP /* turn on the trap as per the MIL-STD */
-#define ULAW_BIAS 0x84 /* Bias for linear code. */
-
-/*! \brief Encode a linear sample to u-law
- \param linear The sample to encode.
- \return The u-law value.
-*/
-static APR_INLINE apr_byte_t linear_to_ulaw(int linear)
-{
- apr_byte_t u_val;
- int mask;
- int seg;
-
- /* Get the sign and the magnitude of the value. */
- if (linear < 0)
- {
- linear = ULAW_BIAS - linear - 1;
- mask = 0x7F;
- }
- else
- {
- linear = ULAW_BIAS + linear;
- mask = 0xFF;
- }
-
- seg = top_bit(linear | 0xFF) - 7;
-
- /*
- * Combine the sign, segment, quantization bits,
- * and complement the code word.
- */
- if (seg >= 8)
- u_val = (apr_byte_t) (0x7F ^ mask);
- else
- u_val = (apr_byte_t) (((seg << 4) | ((linear >> (seg + 3)) & 0xF)) ^ mask);
-#ifdef ULAW_ZEROTRAP
- /* Optional ITU trap */
- if (u_val == 0)
- u_val = 0x02;
-#endif
- return u_val;
-}
-/*- End of function --------------------------------------------------------*/
-
-/*! \brief Decode an u-law sample to a linear value.
- \param ulaw The u-law sample to decode.
- \return The linear value.
-*/
-static APR_INLINE apr_int16_t ulaw_to_linear(apr_byte_t ulaw)
-{
- int t;
-
- /* Complement to obtain normal u-law value. */
- ulaw = ~ulaw;
- /*
- * Extract and bias the quantization bits. Then
- * shift up by the segment number and subtract out the bias.
- */
- t = (((ulaw & 0x0F) << 3) + ULAW_BIAS) << (((int) ulaw & 0x70) >> 4);
- return (apr_int16_t) ((ulaw & 0x80) ? (ULAW_BIAS - t) : (t - ULAW_BIAS));
-}
-/*- End of function --------------------------------------------------------*/
-
-/*
- * A-law is basically as follows:
- *
- * Linear Input Code Compressed Code
- * ----------------- ---------------
- * 0000000wxyza 000wxyz
- * 0000001wxyza 001wxyz
- * 000001wxyzab 010wxyz
- * 00001wxyzabc 011wxyz
- * 0001wxyzabcd 100wxyz
- * 001wxyzabcde 101wxyz
- * 01wxyzabcdef 110wxyz
- * 1wxyzabcdefg 111wxyz
- *
- * For further information see John C. Bellamy's Digital Telephony, 1982,
- * John Wiley & Sons, pps 98-111 and 472-476.
- */
-
-#define ALAW_AMI_MASK 0x55
-
-/*! \brief Encode a linear sample to A-law
- \param linear The sample to encode.
- \return The A-law value.
-*/
-static APR_INLINE apr_byte_t linear_to_alaw(int linear)
-{
- int mask;
- int seg;
-
- if (linear >= 0)
- {
- /* Sign (bit 7) bit = 1 */
- mask = ALAW_AMI_MASK | 0x80;
- }
- else
- {
- /* Sign (bit 7) bit = 0 */
- mask = ALAW_AMI_MASK;
- linear = -linear - 1;
- }
-
- /* Convert the scaled magnitude to segment number. */
- seg = top_bit(linear | 0xFF) - 7;
- if (seg >= 8)
- {
- if (linear >= 0)
- {
- /* Out of range. Return maximum value. */
- return (apr_byte_t) (0x7F ^ mask);
- }
-#if 0 /* This code is no longer reachable, since linear must be at least 0. */
- /* We must be just a tiny step below zero */
- return (apr_byte_t) (0x00 ^ mask);
-#endif
- }
- /* Combine the sign, segment, and quantization bits. */
- return (apr_byte_t) (((seg << 4) | ((linear >> ((seg) ? (seg + 3) : 4)) & 0x0F)) ^ mask);
-}
-/*- End of function --------------------------------------------------------*/
-
-/*! \brief Decode an A-law sample to a linear value.
- \param alaw The A-law sample to decode.
- \return The linear value.
-*/
-static APR_INLINE apr_int16_t alaw_to_linear(apr_byte_t alaw)
-{
- int i;
- int seg;
-
- alaw ^= ALAW_AMI_MASK;
- i = ((alaw & 0x0F) << 4);
- seg = (((int) alaw & 0x70) >> 4);
- if (seg)
- i = (i + 0x108) << (seg - 1);
- else
- i += 8;
- return (apr_int16_t) ((alaw & 0x80) ? i : -i);
-}
-/*- End of function --------------------------------------------------------*/
-
-/*! \brief Transcode from A-law to u-law, using the procedure defined in G.711.
- \param alaw The A-law sample to transcode.
- \return The best matching u-law value.
-*/
-apr_byte_t alaw_to_ulaw(apr_byte_t alaw);
-
-/*! \brief Transcode from u-law to A-law, using the procedure defined in G.711.
- \param alaw The u-law sample to transcode.
- \return The best matching A-law value.
-*/
-apr_byte_t ulaw_to_alaw(apr_byte_t ulaw);
-
-APT_END_EXTERN_C
-
-#endif /* MPF_G711_H */
-/*- End of file ------------------------------------------------------------*/
diff --git a/libs/unimrcp/libs/mpf/include/mpf.h b/libs/unimrcp/libs/mpf/include/mpf.h
deleted file mode 100644
index a435893595..0000000000
--- a/libs/unimrcp/libs/mpf/include/mpf.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mpf.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MPF_H
-#define MPF_H
-
-/**
- * @file mpf.h
- * @brief Media Processing Framework Definitions
- */
-
-#include
-
-/** lib export/import defines (win32) */
-#ifdef WIN32
-#ifdef MPF_STATIC_LIB
-#define MPF_DECLARE(type) type __stdcall
-#else
-#ifdef MPF_LIB_EXPORT
-#define MPF_DECLARE(type) __declspec(dllexport) type __stdcall
-#else
-#define MPF_DECLARE(type) __declspec(dllimport) type __stdcall
-#endif
-#endif
-#else
-#define MPF_DECLARE(type) type
-#endif
-
-#endif /* MPF_H */
diff --git a/libs/unimrcp/libs/mpf/include/mpf_activity_detector.h b/libs/unimrcp/libs/mpf/include/mpf_activity_detector.h
deleted file mode 100644
index fe2f15cec0..0000000000
--- a/libs/unimrcp/libs/mpf/include/mpf_activity_detector.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mpf_activity_detector.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MPF_ACTIVITY_DETECTOR_H
-#define MPF_ACTIVITY_DETECTOR_H
-
-/**
- * @file mpf_activity_detector.h
- * @brief MPF Voice Activity Detector
- */
-
-#include "mpf_frame.h"
-#include "mpf_codec_descriptor.h"
-
-APT_BEGIN_EXTERN_C
-
-/** Opaque (voice) activity detector */
-typedef struct mpf_activity_detector_t mpf_activity_detector_t;
-
-/** Events of activity detector */
-typedef enum {
- MPF_DETECTOR_EVENT_NONE, /**< no event occurred */
- MPF_DETECTOR_EVENT_ACTIVITY, /**< voice activity (transition to activity from inactivity state) */
- MPF_DETECTOR_EVENT_INACTIVITY, /**< voice inactivity (transition to inactivity from activity state) */
- MPF_DETECTOR_EVENT_NOINPUT /**< noinput event occurred */
-} mpf_detector_event_e;
-
-
-/** Create activity detector */
-MPF_DECLARE(mpf_activity_detector_t*) mpf_activity_detector_create(apr_pool_t *pool);
-
-/** Reset activity detector */
-MPF_DECLARE(void) mpf_activity_detector_reset(mpf_activity_detector_t *detector);
-
-/** Set threshold of voice activity (silence) level */
-MPF_DECLARE(void) mpf_activity_detector_level_set(mpf_activity_detector_t *detector, apr_size_t level_threshold);
-
-/** Set noinput timeout */
-MPF_DECLARE(void) mpf_activity_detector_noinput_timeout_set(mpf_activity_detector_t *detector, apr_size_t noinput_timeout);
-
-/** Set timeout required to trigger speech (transition from inactive to active state) */
-MPF_DECLARE(void) mpf_activity_detector_speech_timeout_set(mpf_activity_detector_t *detector, apr_size_t speech_timeout);
-
-/** Set timeout required to trigger silence (transition from active to inactive state) */
-MPF_DECLARE(void) mpf_activity_detector_silence_timeout_set(mpf_activity_detector_t *detector, apr_size_t silence_timeout);
-
-/** Process current frame, return detected event if any */
-MPF_DECLARE(mpf_detector_event_e) mpf_activity_detector_process(mpf_activity_detector_t *detector, const mpf_frame_t *frame);
-
-
-APT_END_EXTERN_C
-
-#endif /* MPF_ACTIVITY_DETECTOR_H */
diff --git a/libs/unimrcp/libs/mpf/include/mpf_audio_file_descriptor.h b/libs/unimrcp/libs/mpf/include/mpf_audio_file_descriptor.h
deleted file mode 100644
index d7673004ea..0000000000
--- a/libs/unimrcp/libs/mpf/include/mpf_audio_file_descriptor.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mpf_audio_file_descriptor.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MPF_AUDIO_FILE_DESCRIPTOR_H
-#define MPF_AUDIO_FILE_DESCRIPTOR_H
-
-/**
- * @file mpf_audio_file_descriptor.h
- * @brief MPF Audio File Descriptor
- */
-
-#include
-#include "mpf_stream_descriptor.h"
-
-APT_BEGIN_EXTERN_C
-
-/** FILE_READER defined as a stream source */
-#define FILE_READER STREAM_DIRECTION_RECEIVE
-/** FILE_WRITER defined as a stream sink */
-#define FILE_WRITER STREAM_DIRECTION_SEND
-
-/** Audio file descriptor declaration */
-typedef struct mpf_audio_file_descriptor_t mpf_audio_file_descriptor_t;
-
-/** Audio file descriptor */
-struct mpf_audio_file_descriptor_t {
- /** Indicate descriptor type (reader and/or writer) */
- mpf_stream_direction_e mask;
- /** Codec descriptor to use for audio file read/write */
- mpf_codec_descriptor_t *codec_descriptor;
- /** File handle to read audio stream */
- FILE *read_handle;
- /** File handle to write audio stream */
- FILE *write_handle;
- /** Max size of file */
- apr_size_t max_write_size;
-};
-
-APT_END_EXTERN_C
-
-#endif /* MPF_AUDIO_FILE_DESCRIPTOR_H */
diff --git a/libs/unimrcp/libs/mpf/include/mpf_audio_file_stream.h b/libs/unimrcp/libs/mpf/include/mpf_audio_file_stream.h
deleted file mode 100644
index 92da4bead0..0000000000
--- a/libs/unimrcp/libs/mpf/include/mpf_audio_file_stream.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mpf_audio_file_stream.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MPF_AUDIO_FILE_STREAM_H
-#define MPF_AUDIO_FILE_STREAM_H
-
-/**
- * @file mpf_audio_file_stream.h
- * @brief MPF Audio FIle Stream
- */
-
-#include "mpf_stream.h"
-#include "mpf_audio_file_descriptor.h"
-
-APT_BEGIN_EXTERN_C
-
-/**
- * Create file stream.
- * @param termination the back pointer to hold
- * @param pool the pool to allocate memory from
- */
-MPF_DECLARE(mpf_audio_stream_t*) mpf_file_stream_create(mpf_termination_t *termination, apr_pool_t *pool);
-
-/**
- * Modify file stream.
- * @param stream file stream to modify
- * @param descriptor the descriptor to modify stream according
- */
-MPF_DECLARE(apt_bool_t) mpf_file_stream_modify(mpf_audio_stream_t *stream, mpf_audio_file_descriptor_t *descriptor);
-
-APT_END_EXTERN_C
-
-#endif /* MPF_AUDIO_FILE_STREAM_H */
diff --git a/libs/unimrcp/libs/mpf/include/mpf_bridge.h b/libs/unimrcp/libs/mpf/include/mpf_bridge.h
deleted file mode 100644
index 2cde68194d..0000000000
--- a/libs/unimrcp/libs/mpf/include/mpf_bridge.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mpf_bridge.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MPF_BRIDGE_H
-#define MPF_BRIDGE_H
-
-/**
- * @file mpf_bridge.h
- * @brief MPF Stream Bridge
- */
-
-#include "mpf_object.h"
-
-APT_BEGIN_EXTERN_C
-
-/**
- * Create bridge of audio streams.
- * @param source the source audio stream
- * @param sink the sink audio stream
- * @param codec_manager the codec manager
- * @param name the informative name used for debugging
- * @param pool the pool to allocate memory from
- */
-MPF_DECLARE(mpf_object_t*) mpf_bridge_create(
- mpf_audio_stream_t *source,
- mpf_audio_stream_t *sink,
- const mpf_codec_manager_t *codec_manager,
- const char *name,
- apr_pool_t *pool);
-
-
-APT_END_EXTERN_C
-
-#endif /* MPF_BRIDGE_H */
diff --git a/libs/unimrcp/libs/mpf/include/mpf_buffer.h b/libs/unimrcp/libs/mpf/include/mpf_buffer.h
deleted file mode 100644
index bb82f24ade..0000000000
--- a/libs/unimrcp/libs/mpf/include/mpf_buffer.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mpf_buffer.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MPF_BUFFER_H
-#define MPF_BUFFER_H
-
-/**
- * @file mpf_buffer.h
- * @brief Buffer of Media Chunks
- */
-
-#include "mpf_frame.h"
-
-APT_BEGIN_EXTERN_C
-
-/** Opaque media buffer declaration */
-typedef struct mpf_buffer_t mpf_buffer_t;
-
-
-/** Create buffer */
-mpf_buffer_t* mpf_buffer_create(apr_pool_t *pool);
-
-/** Destroy buffer */
-void mpf_buffer_destroy(mpf_buffer_t *buffer);
-
-/** Restart buffer */
-apt_bool_t mpf_buffer_restart(mpf_buffer_t *buffer);
-
-/** Write audio chunk to buffer */
-apt_bool_t mpf_buffer_audio_write(mpf_buffer_t *buffer, void *data, apr_size_t size);
-
-/** Write event to buffer */
-apt_bool_t mpf_buffer_event_write(mpf_buffer_t *buffer, mpf_frame_type_e event_type);
-
-/** Read media frame from buffer */
-apt_bool_t mpf_buffer_frame_read(mpf_buffer_t *buffer, mpf_frame_t *media_frame);
-
-/** Get size of buffer **/
-apr_size_t mpf_buffer_get_size(const mpf_buffer_t *buffer);
-
-APT_END_EXTERN_C
-
-#endif /* MPF_BUFFER_H */
diff --git a/libs/unimrcp/libs/mpf/include/mpf_codec.h b/libs/unimrcp/libs/mpf/include/mpf_codec.h
deleted file mode 100644
index b34a53aaa0..0000000000
--- a/libs/unimrcp/libs/mpf/include/mpf_codec.h
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mpf_codec.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MPF_CODEC_H
-#define MPF_CODEC_H
-
-/**
- * @file mpf_codec.h
- * @brief MPF Codec
- */
-
-#include "mpf_codec_descriptor.h"
-
-APT_BEGIN_EXTERN_C
-
-/** Codec virtual table declaration */
-typedef struct mpf_codec_vtable_t mpf_codec_vtable_t;
-/** Codec declaration*/
-typedef struct mpf_codec_t mpf_codec_t;
-
-/** Codec */
-struct mpf_codec_t {
- /** Codec manipulators (encode, decode, dissect) */
- const mpf_codec_vtable_t *vtable;
- /** Codec attributes (capabilities) */
- const mpf_codec_attribs_t *attribs;
- /** Optional static codec descriptor (pt < 96) */
- const mpf_codec_descriptor_t *static_descriptor;
-};
-
-/** Table of codec virtual methods */
-struct mpf_codec_vtable_t {
- /** Virtual open method */
- apt_bool_t (*open)(mpf_codec_t *codec);
- /** Virtual close method */
- apt_bool_t (*close)(mpf_codec_t *codec);
-
- /** Virtual encode method */
- apt_bool_t (*encode)(mpf_codec_t *codec, const mpf_codec_frame_t *frame_in, mpf_codec_frame_t *frame_out);
- /** Virtual decode method */
- apt_bool_t (*decode)(mpf_codec_t *codec, const mpf_codec_frame_t *frame_in, mpf_codec_frame_t *frame_out);
-
- /** Virtual dissect method */
- apt_bool_t (*dissect)(mpf_codec_t *codec, void **buffer, apr_size_t *size, mpf_codec_frame_t *frame);
-
- /** Virtual initialize method */
- apt_bool_t (*initialize)(mpf_codec_t *codec, mpf_codec_frame_t *frame_out);
-};
-
-/**
- * Create codec.
- * @param vtable the table of virtual mthods
- * @param attribs the codec attributes
- * @param descriptor the codec descriptor
- * @param pool the pool to allocate memory from
- */
-static APR_INLINE mpf_codec_t* mpf_codec_create(
- const mpf_codec_vtable_t *vtable,
- const mpf_codec_attribs_t *attribs,
- const mpf_codec_descriptor_t *descriptor,
- apr_pool_t *pool)
-{
- mpf_codec_t *codec = (mpf_codec_t*)apr_palloc(pool,sizeof(mpf_codec_t));
- codec->vtable = vtable;
- codec->attribs = attribs;
- codec->static_descriptor = descriptor;
- return codec;
-}
-
-/**
- * Clone codec.
- * @param src_codec the source (original) codec to clone
- * @param pool the pool to allocate memory from
- */
-static APR_INLINE mpf_codec_t* mpf_codec_clone(mpf_codec_t *src_codec, apr_pool_t *pool)
-{
- mpf_codec_t *codec = (mpf_codec_t*)apr_palloc(pool,sizeof(mpf_codec_t));
- codec->vtable = src_codec->vtable;
- codec->attribs = src_codec->attribs;
- codec->static_descriptor = src_codec->static_descriptor;
- return codec;
-}
-
-/** Open codec */
-static APR_INLINE apt_bool_t mpf_codec_open(mpf_codec_t *codec)
-{
- apt_bool_t rv = TRUE;
- if(codec->vtable->open) {
- rv = codec->vtable->open(codec);
- }
- return rv;
-}
-
-/** Close codec */
-static APR_INLINE apt_bool_t mpf_codec_close(mpf_codec_t *codec)
-{
- apt_bool_t rv = TRUE;
- if(codec->vtable->close) {
- rv = codec->vtable->close(codec);
- }
- return rv;
-}
-
-/** Encode codec frame */
-static APR_INLINE apt_bool_t mpf_codec_encode(mpf_codec_t *codec, const mpf_codec_frame_t *frame_in, mpf_codec_frame_t *frame_out)
-{
- apt_bool_t rv = TRUE;
- if(codec->vtable->encode) {
- rv = codec->vtable->encode(codec,frame_in,frame_out);
- }
- return rv;
-}
-
-/** Decode codec frame */
-static APR_INLINE apt_bool_t mpf_codec_decode(mpf_codec_t *codec, const mpf_codec_frame_t *frame_in, mpf_codec_frame_t *frame_out)
-{
- apt_bool_t rv = TRUE;
- if(codec->vtable->decode) {
- rv = codec->vtable->decode(codec,frame_in,frame_out);
- }
- return rv;
-}
-
-/** Dissect codec frame (navigate through codec frames in a buffer, which may contain multiple frames) */
-static APR_INLINE apt_bool_t mpf_codec_dissect(mpf_codec_t *codec, void **buffer, apr_size_t *size, mpf_codec_frame_t *frame)
-{
- apt_bool_t rv = TRUE;
- if(codec->vtable->dissect) {
- /* custom dissector for codecs like G.729, G.723 */
- rv = codec->vtable->dissect(codec,buffer,size,frame);
- }
- else {
- /* default dissector */
- if(*size >= frame->size && frame->size) {
- memcpy(frame->buffer,*buffer,frame->size);
-
- *buffer = (apr_byte_t*)*buffer + frame->size;
- *size = *size - frame->size;
- }
- else {
- rv = FALSE;
- }
- }
- return rv;
-}
-
-/** Initialize (fill) codec frame with silence */
-static APR_INLINE apt_bool_t mpf_codec_initialize(mpf_codec_t *codec, mpf_codec_frame_t *frame_out)
-{
- apt_bool_t rv = TRUE;
- if(codec->vtable->initialize) {
- rv = codec->vtable->initialize(codec,frame_out);
- }
- else {
- memset(frame_out->buffer,0,frame_out->size);
- }
- return rv;
-}
-
-APT_END_EXTERN_C
-
-#endif /* MPF_CODEC_H */
diff --git a/libs/unimrcp/libs/mpf/include/mpf_codec_descriptor.h b/libs/unimrcp/libs/mpf/include/mpf_codec_descriptor.h
deleted file mode 100644
index f4ed54e322..0000000000
--- a/libs/unimrcp/libs/mpf/include/mpf_codec_descriptor.h
+++ /dev/null
@@ -1,283 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mpf_codec_descriptor.h 2239 2014-11-12 01:52:59Z achaloyan@gmail.com $
- */
-
-#ifndef MPF_CODEC_DESCRIPTOR_H
-#define MPF_CODEC_DESCRIPTOR_H
-
-/**
- * @file mpf_codec_descriptor.h
- * @brief MPF Codec Descriptor
- */
-
-#include
-#include "apt_string.h"
-#include "mpf.h"
-
-APT_BEGIN_EXTERN_C
-
-/** Codec frame time base in msec */
-#define CODEC_FRAME_TIME_BASE 10
-/** Bytes per sample for linear pcm */
-#define BYTES_PER_SAMPLE 2
-/** Bits per sample for linear pcm */
-#define BITS_PER_SAMPLE 16
-
-/** Supported sampling rates */
-typedef enum {
- MPF_SAMPLE_RATE_NONE = 0x00,
- MPF_SAMPLE_RATE_8000 = 0x01,
- MPF_SAMPLE_RATE_16000 = 0x02,
- MPF_SAMPLE_RATE_32000 = 0x04,
- MPF_SAMPLE_RATE_48000 = 0x08,
-
- MPF_SAMPLE_RATE_SUPPORTED = MPF_SAMPLE_RATE_8000 | MPF_SAMPLE_RATE_16000 |
- MPF_SAMPLE_RATE_32000 | MPF_SAMPLE_RATE_48000
-} mpf_sample_rates_e;
-
-/** Codec descriptor declaration */
-typedef struct mpf_codec_descriptor_t mpf_codec_descriptor_t;
-/** Codec attributes declaration */
-typedef struct mpf_codec_attribs_t mpf_codec_attribs_t;
-/** Codec list declaration */
-typedef struct mpf_codec_list_t mpf_codec_list_t;
-/** Codec capabilities declaration */
-typedef struct mpf_codec_capabilities_t mpf_codec_capabilities_t;
-/** Codec frame declaration */
-typedef struct mpf_codec_frame_t mpf_codec_frame_t;
-
-
-/** Codec descriptor */
-struct mpf_codec_descriptor_t {
- /** Payload type used in RTP packet */
- apr_byte_t payload_type;
- /** Codec name */
- apt_str_t name;
- /** Sampling rate */
- apr_uint16_t sampling_rate;
- /** Channel count */
- apr_byte_t channel_count;
- /** Codec dependent additional format */
- apt_str_t format;
- /** Enabled/disabled state */
- apt_bool_t enabled;
-};
-
-/** List of codec descriptors */
-struct mpf_codec_list_t {
- /** Dynamic array of codec descriptors (mpf_codec_descriptor_t) */
- apr_array_header_t *descriptor_arr;
- /** Preffered primary (audio/video codec) descriptor from descriptor_arr */
- mpf_codec_descriptor_t *primary_descriptor;
- /** Preffered named event (telephone-event) descriptor from descriptor_arr */
- mpf_codec_descriptor_t *event_descriptor;
-};
-
-/** Codec attributes */
-struct mpf_codec_attribs_t {
- /** Codec name */
- apt_str_t name;
- /** Bits per sample */
- apr_byte_t bits_per_sample;
- /** Supported sampling rates (mpf_sample_rates_e) */
- int sample_rates;
-};
-
-/** List of codec attributes (capabilities) */
-struct mpf_codec_capabilities_t {
- /** Dynamic array of codec attributes (mpf_codec_attrribs_t) */
- apr_array_header_t *attrib_arr;
- /** Allow/support named events */
- apt_bool_t allow_named_events;
-};
-
-/** Codec frame */
-struct mpf_codec_frame_t {
- /** Raw buffer, which may contain encoded or decoded data */
- void *buffer;
- /** Buffer size */
- apr_size_t size;
-};
-
-
-/** Initialize codec descriptor */
-static APR_INLINE void mpf_codec_descriptor_init(mpf_codec_descriptor_t *descriptor)
-{
- descriptor->payload_type = 0;
- apt_string_reset(&descriptor->name);
- descriptor->sampling_rate = 0;
- descriptor->channel_count = 0;
- apt_string_reset(&descriptor->format);
- descriptor->enabled = TRUE;
-}
-
-/** Initialize codec descriptor */
-static APR_INLINE mpf_codec_descriptor_t* mpf_codec_descriptor_create(apr_pool_t *pool)
-{
- mpf_codec_descriptor_t *descriptor = (mpf_codec_descriptor_t*) apr_palloc(pool,sizeof(mpf_codec_descriptor_t));
- mpf_codec_descriptor_init(descriptor);
- return descriptor;
-}
-
-/** Calculate encoded frame size in bytes */
-static APR_INLINE apr_size_t mpf_codec_frame_size_calculate(const mpf_codec_descriptor_t *descriptor, const mpf_codec_attribs_t *attribs)
-{
- return (size_t) descriptor->channel_count * attribs->bits_per_sample * CODEC_FRAME_TIME_BASE *
- descriptor->sampling_rate / 1000 / 8; /* 1000 - msec per sec, 8 - bits per byte */
-}
-
-/** Calculate samples of the frame (ts) */
-static APR_INLINE apr_size_t mpf_codec_frame_samples_calculate(const mpf_codec_descriptor_t *descriptor)
-{
- return (size_t) descriptor->channel_count * CODEC_FRAME_TIME_BASE * descriptor->sampling_rate / 1000;
-}
-
-/** Calculate linear frame size in bytes */
-static APR_INLINE apr_size_t mpf_codec_linear_frame_size_calculate(apr_uint16_t sampling_rate, apr_byte_t channel_count)
-{
- return (size_t) channel_count * BYTES_PER_SAMPLE * CODEC_FRAME_TIME_BASE * sampling_rate / 1000;
-}
-
-
-
-/** Reset list of codec descriptors */
-static APR_INLINE void mpf_codec_list_reset(mpf_codec_list_t *codec_list)
-{
- codec_list->descriptor_arr = NULL;
- codec_list->primary_descriptor = NULL;
- codec_list->event_descriptor = NULL;
-}
-
-/** Initialize list of codec descriptors */
-static APR_INLINE void mpf_codec_list_init(mpf_codec_list_t *codec_list, apr_size_t initial_count, apr_pool_t *pool)
-{
- codec_list->descriptor_arr = apr_array_make(pool,(int)initial_count, sizeof(mpf_codec_descriptor_t));
- codec_list->primary_descriptor = NULL;
- codec_list->event_descriptor = NULL;
-}
-
-/** Copy list of codec descriptors */
-static APR_INLINE void mpf_codec_list_copy(mpf_codec_list_t *codec_list, const mpf_codec_list_t *src_codec_list, apr_pool_t *pool)
-{
- codec_list->descriptor_arr = apr_array_copy(pool,src_codec_list->descriptor_arr);
-}
-
-/** Increment number of codec descriptors in the list and return the descriptor to fill */
-static APR_INLINE mpf_codec_descriptor_t* mpf_codec_list_add(mpf_codec_list_t *codec_list)
-{
- mpf_codec_descriptor_t *descriptor = (mpf_codec_descriptor_t*)apr_array_push(codec_list->descriptor_arr);
- mpf_codec_descriptor_init(descriptor);
- return descriptor;
-}
-
-/** Determine if codec list is empty */
-static APR_INLINE apt_bool_t mpf_codec_list_is_empty(const mpf_codec_list_t *codec_list)
-{
- return apr_is_empty_array(codec_list->descriptor_arr);
-}
-
-/** Get codec descriptor by index */
-static APR_INLINE mpf_codec_descriptor_t* mpf_codec_list_descriptor_get(const mpf_codec_list_t *codec_list, apr_size_t id)
-{
- if(id >= (apr_size_t)codec_list->descriptor_arr->nelts) {
- return NULL;
- }
- return &APR_ARRAY_IDX(codec_list->descriptor_arr,id,mpf_codec_descriptor_t);
-}
-
-/** Create linear PCM descriptor */
-MPF_DECLARE(mpf_codec_descriptor_t*) mpf_codec_lpcm_descriptor_create(apr_uint16_t sampling_rate, apr_byte_t channel_count, apr_pool_t *pool);
-
-/** Create codec descriptor by capabilities */
-MPF_DECLARE(mpf_codec_descriptor_t*) mpf_codec_descriptor_create_by_capabilities(const mpf_codec_capabilities_t *capabilities, const mpf_codec_descriptor_t *peer, apr_pool_t *pool);
-
-/** Match two codec descriptors */
-MPF_DECLARE(apt_bool_t) mpf_codec_descriptors_match(const mpf_codec_descriptor_t *descriptor1, const mpf_codec_descriptor_t *descriptor2);
-
-/** Match specified codec descriptor and the default lpcm one */
-MPF_DECLARE(apt_bool_t) mpf_codec_lpcm_descriptor_match(const mpf_codec_descriptor_t *descriptor);
-
-/** Match codec descriptor by attribs specified */
-MPF_DECLARE(apt_bool_t) mpf_codec_descriptor_match_by_attribs(mpf_codec_descriptor_t *descriptor, const mpf_codec_descriptor_t *static_descriptor, const mpf_codec_attribs_t *attribs);
-
-
-
-/** Initialize codec capabilities */
-static APR_INLINE void mpf_codec_capabilities_init(mpf_codec_capabilities_t *capabilities, apr_size_t initial_count, apr_pool_t *pool)
-{
- capabilities->attrib_arr = apr_array_make(pool,(int)initial_count, sizeof(mpf_codec_attribs_t));
- capabilities->allow_named_events = TRUE;
-}
-
-/** Clone codec capabilities */
-static APR_INLINE void mpf_codec_capabilities_clone(mpf_codec_capabilities_t *capabilities, const mpf_codec_capabilities_t *src_capabilities, apr_pool_t *pool)
-{
- capabilities->attrib_arr = apr_array_copy(pool,src_capabilities->attrib_arr);
- capabilities->allow_named_events = src_capabilities->allow_named_events;
-}
-
-/** Merge codec capabilities */
-static APR_INLINE apt_bool_t mpf_codec_capabilities_merge(mpf_codec_capabilities_t *capabilities, const mpf_codec_capabilities_t *src_capabilities, apr_pool_t *pool)
-{
- if(capabilities->allow_named_events == FALSE && src_capabilities->allow_named_events == TRUE) {
- capabilities->allow_named_events = src_capabilities->allow_named_events;
- }
- capabilities->attrib_arr = apr_array_append(pool,capabilities->attrib_arr,src_capabilities->attrib_arr);
- return TRUE;
-}
-
-/** Add codec capabilities */
-static APR_INLINE apt_bool_t mpf_codec_capabilities_add(mpf_codec_capabilities_t *capabilities, int sample_rates, const char *codec_name)
-{
- mpf_codec_attribs_t *attribs = (mpf_codec_attribs_t*)apr_array_push(capabilities->attrib_arr);
- apt_string_assign(&attribs->name,codec_name,capabilities->attrib_arr->pool);
- attribs->sample_rates = sample_rates;
- attribs->bits_per_sample = 0;
- return TRUE;
-}
-
-/** Add default (linear PCM) capabilities */
-MPF_DECLARE(apt_bool_t) mpf_codec_default_capabilities_add(mpf_codec_capabilities_t *capabilities);
-
-/** Validate codec capabilities */
-static APR_INLINE apt_bool_t mpf_codec_capabilities_validate(mpf_codec_capabilities_t *capabilities)
-{
- if(apr_is_empty_array(capabilities->attrib_arr) == TRUE) {
- mpf_codec_default_capabilities_add(capabilities);
- }
- return TRUE;
-}
-
-
-
-/** Find matched descriptor in codec list */
-MPF_DECLARE(mpf_codec_descriptor_t*) mpf_codec_list_descriptor_find(const mpf_codec_list_t *codec_list, const mpf_codec_descriptor_t *descriptor);
-
-/** Match codec list with specified capabilities */
-MPF_DECLARE(apt_bool_t) mpf_codec_list_match(mpf_codec_list_t *codec_list, const mpf_codec_capabilities_t *capabilities);
-
-/** Intersect two codec lists */
-MPF_DECLARE(apt_bool_t) mpf_codec_lists_intersect(mpf_codec_list_t *codec_list1, mpf_codec_list_t *codec_list2);
-
-
-/** Get sampling rate mask (mpf_sample_rate_e) by integer value */
-MPF_DECLARE(int) mpf_sample_rate_mask_get(apr_uint16_t sampling_rate);
-
-
-APT_END_EXTERN_C
-
-#endif /* MPF_CODEC_DESCRIPTOR_H */
diff --git a/libs/unimrcp/libs/mpf/include/mpf_codec_manager.h b/libs/unimrcp/libs/mpf/include/mpf_codec_manager.h
deleted file mode 100644
index 919d5112bb..0000000000
--- a/libs/unimrcp/libs/mpf/include/mpf_codec_manager.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mpf_codec_manager.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MPF_CODEC_MANAGER_H
-#define MPF_CODEC_MANAGER_H
-
-/**
- * @file mpf_codec_manager.h
- * @brief MPF Codec Manager
- */
-
-#include "mpf_types.h"
-#include "mpf_codec.h"
-
-APT_BEGIN_EXTERN_C
-
-/** Create codec manager */
-MPF_DECLARE(mpf_codec_manager_t*) mpf_codec_manager_create(apr_size_t codec_count, apr_pool_t *pool);
-
-/** Destroy codec manager */
-MPF_DECLARE(void) mpf_codec_manager_destroy(mpf_codec_manager_t *codec_manager);
-
-/** Register codec in codec manager */
-MPF_DECLARE(apt_bool_t) mpf_codec_manager_codec_register(mpf_codec_manager_t *codec_manager, mpf_codec_t *codec);
-
-/** Get (allocate) codec by codec descriptor */
-MPF_DECLARE(mpf_codec_t*) mpf_codec_manager_codec_get(const mpf_codec_manager_t *codec_manager, mpf_codec_descriptor_t *descriptor, apr_pool_t *pool);
-
-/** Get (allocate) list of available codecs */
-MPF_DECLARE(apt_bool_t) mpf_codec_manager_codec_list_get(const mpf_codec_manager_t *codec_manager, mpf_codec_list_t *codec_list, apr_pool_t *pool);
-
-/** Load (allocate) list of codecs */
-MPF_DECLARE(apt_bool_t) mpf_codec_manager_codec_list_load(const mpf_codec_manager_t *codec_manager, mpf_codec_list_t *codec_list, const char *str, apr_pool_t *pool);
-
-/** Find codec by name */
-MPF_DECLARE(const mpf_codec_t*) mpf_codec_manager_codec_find(const mpf_codec_manager_t *codec_manager, const apt_str_t *codec_name);
-
-APT_END_EXTERN_C
-
-#endif /* MPF_CODEC_MANAGER_H */
diff --git a/libs/unimrcp/libs/mpf/include/mpf_context.h b/libs/unimrcp/libs/mpf/include/mpf_context.h
deleted file mode 100644
index 24e519ab81..0000000000
--- a/libs/unimrcp/libs/mpf/include/mpf_context.h
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mpf_context.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MPF_CONTEXT_H
-#define MPF_CONTEXT_H
-
-/**
- * @file mpf_context.h
- * @brief MPF Context
- */
-
-#include "mpf_types.h"
-
-APT_BEGIN_EXTERN_C
-
-/** Opaque factory of media contexts */
-typedef struct mpf_context_factory_t mpf_context_factory_t;
-
-/**
- * Create factory of media contexts.
- */
-MPF_DECLARE(mpf_context_factory_t*) mpf_context_factory_create(apr_pool_t *pool);
-
-/**
- * Destroy factory of media contexts.
- */
-MPF_DECLARE(void) mpf_context_factory_destroy(mpf_context_factory_t *factory);
-
-/**
- * Process factory of media contexts.
- */
-MPF_DECLARE(apt_bool_t) mpf_context_factory_process(mpf_context_factory_t *factory);
-
-/**
- * Create MPF context.
- * @param factory the factory context belongs to
- * @param name the informative name of the context
- * @param obj the external object associated with context
- * @param max_termination_count the max number of terminations in context
- * @param pool the pool to allocate memory from
- */
-MPF_DECLARE(mpf_context_t*) mpf_context_create(
- mpf_context_factory_t *factory,
- const char *name,
- void *obj,
- apr_size_t max_termination_count,
- apr_pool_t *pool);
-
-/**
- * Destroy MPF context.
- * @param context the context to destroy
- */
-MPF_DECLARE(apt_bool_t) mpf_context_destroy(mpf_context_t *context);
-
-/**
- * Get external object associated with MPF context.
- * @param context the context to get object from
- */
-MPF_DECLARE(void*) mpf_context_object_get(const mpf_context_t *context);
-
-/**
- * Add termination to context.
- * @param context the context to add termination to
- * @param termination the termination to add
- */
-MPF_DECLARE(apt_bool_t) mpf_context_termination_add(mpf_context_t *context, mpf_termination_t *termination);
-
-/**
- * Subtract termination from context.
- * @param context the context to subtract termination from
- * @param termination the termination to subtract
- */
-MPF_DECLARE(apt_bool_t) mpf_context_termination_subtract(mpf_context_t *context, mpf_termination_t *termination);
-
-/**
- * Add association between specified terminations.
- * @param context the context to add association in the scope of
- * @param termination1 the first termination to associate
- * @param termination2 the second termination to associate
- */
-MPF_DECLARE(apt_bool_t) mpf_context_association_add(mpf_context_t *context, mpf_termination_t *termination1, mpf_termination_t *termination2);
-
-/**
- * Remove association between specified terminations.
- * @param context the context to remove association in the scope of
- * @param termination1 the first termination
- * @param termination2 the second termination
- */
-MPF_DECLARE(apt_bool_t) mpf_context_association_remove(mpf_context_t *context, mpf_termination_t *termination1, mpf_termination_t *termination2);
-
-/**
- * Reset assigned associations and destroy applied topology.
- * @param context the context to reset associations for
- */
-MPF_DECLARE(apt_bool_t) mpf_context_associations_reset(mpf_context_t *context);
-
-/**
- * Apply topology.
- * @param context the context to apply topology for
- */
-MPF_DECLARE(apt_bool_t) mpf_context_topology_apply(mpf_context_t *context);
-
-/**
- * Destroy topology.
- * @param context the context to destroy topology for
- */
-MPF_DECLARE(apt_bool_t) mpf_context_topology_destroy(mpf_context_t *context);
-
-/**
- * Process context.
- * @param context the context to process
- */
-MPF_DECLARE(apt_bool_t) mpf_context_process(mpf_context_t *context);
-
-
-APT_END_EXTERN_C
-
-#endif /* MPF_CONTEXT_H */
diff --git a/libs/unimrcp/libs/mpf/include/mpf_decoder.h b/libs/unimrcp/libs/mpf/include/mpf_decoder.h
deleted file mode 100644
index 930b1dcb6b..0000000000
--- a/libs/unimrcp/libs/mpf/include/mpf_decoder.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mpf_decoder.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MPF_DECODER_H
-#define MPF_DECODER_H
-
-/**
- * @file mpf_decoder.h
- * @brief MPF Stream Decoder
- */
-
-#include "mpf_stream.h"
-
-APT_BEGIN_EXTERN_C
-
-/**
- * Create audio stream decoder.
- * @param source the source to get encoded stream from
- * @param codec the codec to use for decode
- * @param pool the pool to allocate memory from
- */
-MPF_DECLARE(mpf_audio_stream_t*) mpf_decoder_create(mpf_audio_stream_t *source, mpf_codec_t *codec, apr_pool_t *pool);
-
-
-APT_END_EXTERN_C
-
-#endif /* MPF_ENCODER_H */
diff --git a/libs/unimrcp/libs/mpf/include/mpf_dtmf_detector.h b/libs/unimrcp/libs/mpf/include/mpf_dtmf_detector.h
deleted file mode 100644
index 4108e3bd9b..0000000000
--- a/libs/unimrcp/libs/mpf/include/mpf_dtmf_detector.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright 2009-2010 Tomas Valenta, Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mpf_dtmf_detector.h 1474 2010-02-07 20:51:47Z achaloyan $
- */
-
-#ifndef MPF_DTMF_DETECTOR_H
-#define MPF_DTMF_DETECTOR_H
-
-/**
- * @file mpf_dtmf_detector.h
- * @brief DTMF detector
- *
- * Detector of DTMF tones sent both out-of-band (RFC4733) and in-band (audio).
- */
-
-#include "apr.h"
-#include "apr_pools.h"
-#include "apt.h"
-#include "mpf_frame.h"
-#include "mpf_stream.h"
-
-APT_BEGIN_EXTERN_C
-
-/** DTMF detector band */
-typedef enum mpf_dtmf_detector_band_e {
- /** Detect tones in-band */
- MPF_DTMF_DETECTOR_INBAND = 0x1,
- /** Detect named events out-of-band */
- MPF_DTMF_DETECTOR_OUTBAND = 0x2,
- /** Detect both in-band and out-of-band digits */
- MPF_DTMF_DETECTOR_BOTH = MPF_DTMF_DETECTOR_INBAND | MPF_DTMF_DETECTOR_OUTBAND
-} mpf_dtmf_detector_band_e;
-
-/** Opaque MPF DTMF detector structure definition */
-typedef struct mpf_dtmf_detector_t mpf_dtmf_detector_t;
-
-
-/**
- * Create MPF DTMF detector (advanced).
- * @param stream A stream to get digits from.
- * @param band One of:
- * - MPF_DTMF_DETECTOR_INBAND: detect audible tones only
- * - MPF_DTMF_DETECTOR_OUTBAND: detect out-of-band named-events only
- * - MPF_DTMF_DETECTOR_BOTH: detect digits in both bands if supported by
- * stream. When out-of-band digit arrives, in-band detection is turned off.
- * @param pool Memory pool to allocate DTMF detector from.
- * @return The object or NULL on error.
- * @see mpf_dtmf_detector_create
- */
-MPF_DECLARE(struct mpf_dtmf_detector_t *) mpf_dtmf_detector_create_ex(
- const struct mpf_audio_stream_t *stream,
- enum mpf_dtmf_detector_band_e band,
- struct apr_pool_t *pool);
-
-/**
- * Create MPF DTMF detector (simple). Calls mpf_dtmf_detector_create_ex
- * with band = MPF_DTMF_DETECTOR_BOTH if out-of-band supported by the stream,
- * MPF_DTMF_DETECTOR_INBAND otherwise.
- * @param stream A stream to get digits from.
- * @param pool Memory pool to allocate DTMF detector from.
- * @return The object or NULL on error.
- * @see mpf_dtmf_detector_create_ex
- */
-static APR_INLINE struct mpf_dtmf_detector_t *mpf_dtmf_detector_create(
- const struct mpf_audio_stream_t *stream,
- struct apr_pool_t *pool)
-{
- return mpf_dtmf_detector_create_ex(stream,
- stream->tx_event_descriptor ? MPF_DTMF_DETECTOR_BOTH : MPF_DTMF_DETECTOR_INBAND,
- pool);
-}
-
-/**
- * Get DTMF digit from buffer of digits detected so far and remove it.
- * @param detector The detector.
- * @return DTMF character [0-9*#A-D] or NUL if the buffer is empty.
- */
-MPF_DECLARE(char) mpf_dtmf_detector_digit_get(struct mpf_dtmf_detector_t *detector);
-
-/**
- * Retrieve how many digits was lost due to full buffer.
- * @param detector The detector.
- * @return Number of lost digits.
- */
-MPF_DECLARE(apr_size_t) mpf_dtmf_detector_digits_lost(const struct mpf_dtmf_detector_t *detector);
-
-/**
- * Empty the buffer and reset detection states.
- * @param detector The detector.
- */
-MPF_DECLARE(void) mpf_dtmf_detector_reset(struct mpf_dtmf_detector_t *detector);
-
-/**
- * Detect DTMF digits in the frame.
- * @param detector The detector.
- * @param frame Frame object passed in stream_write().
- */
-MPF_DECLARE(void) mpf_dtmf_detector_get_frame(
- struct mpf_dtmf_detector_t *detector,
- const struct mpf_frame_t *frame);
-
-/**
- * Free all resources associated with the detector.
- * @param detector The detector.
- */
-MPF_DECLARE(void) mpf_dtmf_detector_destroy(struct mpf_dtmf_detector_t *detector);
-
-APT_END_EXTERN_C
-
-#endif /* MPF_DTMF_DETECTOR_H */
diff --git a/libs/unimrcp/libs/mpf/include/mpf_dtmf_generator.h b/libs/unimrcp/libs/mpf/include/mpf_dtmf_generator.h
deleted file mode 100644
index ea28bba432..0000000000
--- a/libs/unimrcp/libs/mpf/include/mpf_dtmf_generator.h
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Copyright 2009-2010 Tomas Valenta, Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef MPF_DTMF_GENERATOR_H
-#define MPF_DTMF_GENERATOR_H
-
-/**
- * @file mpf_dtmf_generator.h
- * @brief DTMF generator
- *
- * Generator used to send DTMF tones. Capable to send digits
- * either in-band as audible tones or out-of-band according
- * to RFC4733.
- */
-
-#include "apr_pools.h"
-#include "apt.h"
-#include "mpf_frame.h"
-#include "mpf_stream.h"
-
-APT_BEGIN_EXTERN_C
-
-/** DTMF generator band */
-typedef enum mpf_dtmf_generator_band_e {
- /** Generate tones in-band */
- MPF_DTMF_GENERATOR_INBAND = 0x1,
- /** Generate named events out-of-band */
- MPF_DTMF_GENERATOR_OUTBAND = 0x2,
- /** Generate both tones and named events */
- MPF_DTMF_GENERATOR_BOTH = MPF_DTMF_GENERATOR_INBAND | MPF_DTMF_GENERATOR_OUTBAND
-} mpf_dtmf_generator_band_e;
-
-/** Opaque MPF DTMF generator structure definition */
-typedef struct mpf_dtmf_generator_t mpf_dtmf_generator_t;
-
-
-/**
- * Create MPF DTMF generator (advanced).
- * @param stream A stream to transport digits via.
- * @param band MPF_DTMF_GENERATOR_INBAND or MPF_DTMF_GENERATOR_OUTBAND
- * @param tone_ms Tone duration in milliseconds.
- * @param silence_ms Inter-digit silence in milliseconds.
- * @param pool Memory pool to allocate DTMF generator from.
- * @return The object or NULL on error.
- * @see mpf_dtmf_generator_create
- */
-MPF_DECLARE(struct mpf_dtmf_generator_t *) mpf_dtmf_generator_create_ex(
- const struct mpf_audio_stream_t *stream,
- enum mpf_dtmf_generator_band_e band,
- apr_uint32_t tone_ms,
- apr_uint32_t silence_ms,
- struct apr_pool_t *pool);
-
-/**
- * Create MPF DTMF generator (simple). Calls mpf_dtmf_generator_create_ex
- * with band = MPF_DTMF_GENERATOR_OUTBAND if supported by the stream or
- * MPF_DTMF_GENERATOR_INBAND otherwise, tone_ms = 70, silence_ms = 50.
- * @param stream A stream to transport digits via.
- * @param pool Memory pool to allocate DTMF generator from.
- * @return The object or NULL on error.
- * @see mpf_dtmf_generator_create_ex
- */
-static APR_INLINE struct mpf_dtmf_generator_t *mpf_dtmf_generator_create(
- const struct mpf_audio_stream_t *stream,
- struct apr_pool_t *pool)
-{
- return mpf_dtmf_generator_create_ex(stream,
- stream->rx_event_descriptor ? MPF_DTMF_GENERATOR_OUTBAND : MPF_DTMF_GENERATOR_INBAND,
- 70, 50, pool);
-}
-
-/**
- * Add DTMF digits to the queue.
- * @param generator The generator.
- * @param digits DTMF character sequence [0-9*#A-D].
- * @return TRUE if ok, FALSE if there are too many digits.
- */
-MPF_DECLARE(apt_bool_t) mpf_dtmf_generator_enqueue(
- struct mpf_dtmf_generator_t *generator,
- const char *digits);
-
-/**
- * Empty the queue and immediately stop generating.
- * @param generator The generator.
- */
-MPF_DECLARE(void) mpf_dtmf_generator_reset(struct mpf_dtmf_generator_t *generator);
-
-/**
- * Check state of the generator.
- * @param generator The generator.
- * @return TRUE if generating a digit or there are digits waiting in queue.
- * FALSE if the queue is empty or generating silence after the last digit.
- */
-MPF_DECLARE(apt_bool_t) mpf_dtmf_generator_sending(const struct mpf_dtmf_generator_t *generator);
-
-/**
- * Put frame into the stream.
- * @param generator The generator.
- * @param frame Frame object passed in stream_read().
- * @return TRUE if frame with tone (both in-band and out-of-band) was generated,
- * FALSE otherwise. In contrast to mpf_dtmf_generator_sending, returns FALSE even
- * if generating inter-digit silence. In other words returns TRUE iff the frame
- * object was filled with data. This method MUST be called for each frame for
- * proper timing.
- */
-MPF_DECLARE(apt_bool_t) mpf_dtmf_generator_put_frame(
- struct mpf_dtmf_generator_t *generator,
- struct mpf_frame_t *frame);
-
-/**
- * Free all resources associated with the generator.
- * @param generator The generator.
- */
-MPF_DECLARE(void) mpf_dtmf_generator_destroy(struct mpf_dtmf_generator_t *generator);
-
-APT_END_EXTERN_C
-
-#endif /* MPF_DTMF_GENERATOR_H */
diff --git a/libs/unimrcp/libs/mpf/include/mpf_encoder.h b/libs/unimrcp/libs/mpf/include/mpf_encoder.h
deleted file mode 100644
index 21e49120db..0000000000
--- a/libs/unimrcp/libs/mpf/include/mpf_encoder.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mpf_encoder.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MPF_ENCODER_H
-#define MPF_ENCODER_H
-
-/**
- * @file mpf_encoder.h
- * @brief MPF Stream Encoder
- */
-
-#include "mpf_stream.h"
-
-APT_BEGIN_EXTERN_C
-
-/**
- * Create audio stream encoder.
- * @param sink the sink to write encoded stream to
- * @param codec the codec to use for encode
- * @param pool the pool to allocate memory from
- */
-MPF_DECLARE(mpf_audio_stream_t*) mpf_encoder_create(mpf_audio_stream_t *sink, mpf_codec_t *codec, apr_pool_t *pool);
-
-
-APT_END_EXTERN_C
-
-#endif /* MPF_ENCODER_H */
diff --git a/libs/unimrcp/libs/mpf/include/mpf_engine.h b/libs/unimrcp/libs/mpf/include/mpf_engine.h
deleted file mode 100644
index 4192ccf33b..0000000000
--- a/libs/unimrcp/libs/mpf/include/mpf_engine.h
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mpf_engine.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MPF_ENGINE_H
-#define MPF_ENGINE_H
-
-/**
- * @file mpf_engine.h
- * @brief Media Processing Framework Engine
- */
-
-#include "apt_task.h"
-#include "mpf_message.h"
-
-APT_BEGIN_EXTERN_C
-
-/** MPF task message definition */
-typedef apt_task_msg_t mpf_task_msg_t;
-
-/**
- * Create MPF engine.
- * @param id the identifier of the engine
- * @param pool the pool to allocate memory from
- */
-MPF_DECLARE(mpf_engine_t*) mpf_engine_create(const char *id, apr_pool_t *pool);
-
-/**
- * Create MPF codec manager.
- * @param pool the pool to allocate memory from
- */
-MPF_DECLARE(mpf_codec_manager_t*) mpf_engine_codec_manager_create(apr_pool_t *pool);
-
-/**
- * Register MPF codec manager.
- * @param engine the engine to register codec manager for
- * @param codec_manager the codec manager to register
- */
-MPF_DECLARE(apt_bool_t) mpf_engine_codec_manager_register(mpf_engine_t *engine, const mpf_codec_manager_t *codec_manager);
-
-/**
- * Create MPF context.
- * @param engine the engine to create context for
- * @param name the informative name of the context
- * @param obj the external object associated with context
- * @param max_termination_count the max number of terminations in context
- * @param pool the pool to allocate memory from
- */
-MPF_DECLARE(mpf_context_t*) mpf_engine_context_create(
- mpf_engine_t *engine,
- const char *name,
- void *obj,
- apr_size_t max_termination_count,
- apr_pool_t *pool);
-
-/**
- * Destroy MPF context.
- * @param context the context to destroy
- */
-MPF_DECLARE(apt_bool_t) mpf_engine_context_destroy(mpf_context_t *context);
-
-/**
- * Get external object associated with MPF context.
- * @param context the context to get object from
- */
-MPF_DECLARE(void*) mpf_engine_context_object_get(const mpf_context_t *context);
-
-/**
- * Get task.
- * @param engine the engine to get task from
- */
-MPF_DECLARE(apt_task_t*) mpf_task_get(const mpf_engine_t *engine);
-
-/**
- * Set task msg type to send responses and events with.
- * @param engine the engine to set task msg type for
- * @param type the type to set
- */
-MPF_DECLARE(void) mpf_engine_task_msg_type_set(mpf_engine_t *engine, apt_task_msg_type_e type);
-
-/**
- * Create task message(if not created) and add MPF termination message to it.
- * @param engine the engine task message belongs to
- * @param command_id the MPF command identifier
- * @param context the context to add termination to
- * @param termination the termination to add
- * @param descriptor the termination dependent descriptor
- * @param task_msg the task message to create and add constructed MPF message to
- */
-MPF_DECLARE(apt_bool_t) mpf_engine_termination_message_add(
- mpf_engine_t *engine,
- mpf_command_type_e command_id,
- mpf_context_t *context,
- mpf_termination_t *termination,
- void *descriptor,
- mpf_task_msg_t **task_msg);
-
-/**
- * Create task message(if not created) and add MPF association message to it.
- * @param engine the engine task message belongs to
- * @param command_id the MPF command identifier
- * @param context the context to add association of terminations for
- * @param termination the termination to associate
- * @param assoc_termination the termination to associate
- * @param task_msg the task message to create and add constructed MPF message to
- */
-MPF_DECLARE(apt_bool_t) mpf_engine_assoc_message_add(
- mpf_engine_t *engine,
- mpf_command_type_e command_id,
- mpf_context_t *context,
- mpf_termination_t *termination,
- mpf_termination_t *assoc_termination,
- mpf_task_msg_t **task_msg);
-
-/**
- * Create task message(if not created) and add MPF topology message to it.
- * @param engine the engine task message belongs to
- * @param command_id the MPF command identifier
- * @param context the context to modify topology for
- * @param task_msg the task message to create and add constructed MPF message to
- */
-MPF_DECLARE(apt_bool_t) mpf_engine_topology_message_add(
- mpf_engine_t *engine,
- mpf_command_type_e command_id,
- mpf_context_t *context,
- mpf_task_msg_t **task_msg);
-
-/**
- * Send MPF task message.
- * @param engine the engine to send task message to
- * @param task_msg the task message to send
- */
-MPF_DECLARE(apt_bool_t) mpf_engine_message_send(mpf_engine_t *engine, mpf_task_msg_t **task_msg);
-
-/**
- * Set scheduler rate.
- * @param engine the engine to set rate for
- * @param rate the rate (n times faster than real-time)
- */
-MPF_DECLARE(apt_bool_t) mpf_engine_scheduler_rate_set(mpf_engine_t *engine, unsigned long rate);
-
-/**
- * Get the identifier of the engine .
- * @param engine the engine to get name of
- */
-MPF_DECLARE(const char*) mpf_engine_id_get(const mpf_engine_t *engine);
-
-
-APT_END_EXTERN_C
-
-#endif /* MPF_ENGINE_H */
diff --git a/libs/unimrcp/libs/mpf/include/mpf_engine_factory.h b/libs/unimrcp/libs/mpf/include/mpf_engine_factory.h
deleted file mode 100644
index d53607e2a4..0000000000
--- a/libs/unimrcp/libs/mpf/include/mpf_engine_factory.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mpf_engine_factory.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MPF_ENGINE_FACTORY_H
-#define MPF_ENGINE_FACTORY_H
-
-/**
- * @file mpf_engine.h
- * @brief Factory of Media Processing Engines
- */
-
-#include "mpf_types.h"
-
-APT_BEGIN_EXTERN_C
-
-/** Create factory of media engines. */
-MPF_DECLARE(mpf_engine_factory_t*) mpf_engine_factory_create(apr_pool_t *pool);
-
-/** Add media engine to factory. */
-MPF_DECLARE(apt_bool_t) mpf_engine_factory_engine_add(mpf_engine_factory_t *mpf_factory, mpf_engine_t *media_engine);
-
-/** Determine whether factory is empty. */
-MPF_DECLARE(apt_bool_t) mpf_engine_factory_is_empty(const mpf_engine_factory_t *mpf_factory);
-
-/** Select next available media engine. */
-MPF_DECLARE(mpf_engine_t*) mpf_engine_factory_engine_select(mpf_engine_factory_t *mpf_factory);
-
-/** Associate media engines with RTP termination factory. */
-MPF_DECLARE(apt_bool_t) mpf_engine_factory_rtp_factory_assign(mpf_engine_factory_t *mpf_factory, mpf_termination_factory_t *rtp_factory);
-
-APT_END_EXTERN_C
-
-#endif /* MPF_ENGINE_FACTORY_H */
diff --git a/libs/unimrcp/libs/mpf/include/mpf_file_termination_factory.h b/libs/unimrcp/libs/mpf/include/mpf_file_termination_factory.h
deleted file mode 100644
index f1c9cbe99b..0000000000
--- a/libs/unimrcp/libs/mpf/include/mpf_file_termination_factory.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mpf_file_termination_factory.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MPF_FILE_TERMINATION_FACTORY_H
-#define MPF_FILE_TERMINATION_FACTORY_H
-
-/**
- * @file mpf_file_termination_factory.h
- * @brief MPF File Termination Factory
- */
-
-#include "mpf_termination_factory.h"
-
-APT_BEGIN_EXTERN_C
-
-/**
- * Create file termination factory.
- */
-MPF_DECLARE(mpf_termination_factory_t*) mpf_file_termination_factory_create(apr_pool_t *pool);
-
-
-APT_END_EXTERN_C
-
-#endif /* MPF_RTP_TERMINATION_FACTORY_H */
diff --git a/libs/unimrcp/libs/mpf/include/mpf_frame.h b/libs/unimrcp/libs/mpf/include/mpf_frame.h
deleted file mode 100644
index af37459962..0000000000
--- a/libs/unimrcp/libs/mpf/include/mpf_frame.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mpf_frame.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MPF_FRAME_H
-#define MPF_FRAME_H
-
-/**
- * @file mpf_frame.h
- * @brief MPF Audio/Video/Named-event Frame
- */
-
-#include "mpf_codec_descriptor.h"
-#include "mpf_named_event.h"
-
-APT_BEGIN_EXTERN_C
-
-/** Media frame types */
-typedef enum {
- MEDIA_FRAME_TYPE_NONE = 0x0, /**< none */
- MEDIA_FRAME_TYPE_AUDIO = 0x1, /**< audio frame */
- MEDIA_FRAME_TYPE_VIDEO = 0x2, /**< video frame */
- MEDIA_FRAME_TYPE_EVENT = 0x4 /**< named event frame (RFC4733/RFC2833) */
-} mpf_frame_type_e;
-
-/** Media frame marker */
-typedef enum {
- MPF_MARKER_NONE, /**< none */
- MPF_MARKER_START_OF_EVENT, /**< start of event */
- MPF_MARKER_END_OF_EVENT, /**< end of event */
- MPF_MARKER_NEW_SEGMENT /**< start of new segment (long-lasting events) */
-} mpf_frame_marker_e;
-
-/** Media frame declaration */
-typedef struct mpf_frame_t mpf_frame_t;
-
-/** Media frame */
-struct mpf_frame_t {
- /** frame type (audio/video/named-event) mpf_frame_type_e */
- int type;
- /** frame marker (start-of-event,end-of-event) mpf_frame_marker_e */
- int marker;
- /** codec frame */
- mpf_codec_frame_t codec_frame;
- /** named-event frame */
- mpf_named_event_frame_t event_frame;
-};
-
-
-APT_END_EXTERN_C
-
-#endif /* MPF_FRAME_H */
diff --git a/libs/unimrcp/libs/mpf/include/mpf_frame_buffer.h b/libs/unimrcp/libs/mpf/include/mpf_frame_buffer.h
deleted file mode 100644
index 749479fe22..0000000000
--- a/libs/unimrcp/libs/mpf/include/mpf_frame_buffer.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mpf_frame_buffer.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MPF_FRAME_BUFFER_H
-#define MPF_FRAME_BUFFER_H
-
-/**
- * @file mpf_frame_buffer.h
- * @brief Buffer of Media Frames
- */
-
-#include "mpf_frame.h"
-
-APT_BEGIN_EXTERN_C
-
-/** Opaque frame buffer declaration */
-typedef struct mpf_frame_buffer_t mpf_frame_buffer_t;
-
-
-/** Create frame buffer */
-mpf_frame_buffer_t* mpf_frame_buffer_create(apr_size_t frame_size, apr_size_t frame_count, apr_pool_t *pool);
-
-/** Destroy frame buffer */
-void mpf_frame_buffer_destroy(mpf_frame_buffer_t *buffer);
-
-/** Restart frame buffer */
-apt_bool_t mpf_frame_buffer_restart(mpf_frame_buffer_t *buffer);
-
-/** Write frame to buffer */
-apt_bool_t mpf_frame_buffer_write(mpf_frame_buffer_t *buffer, const mpf_frame_t *frame);
-
-/** Read frame from buffer */
-apt_bool_t mpf_frame_buffer_read(mpf_frame_buffer_t *buffer, mpf_frame_t *frame);
-
-#ifdef MPF_FRAME_BUFFER_DEBUG
-apt_bool_t mpf_frame_buffer_file_open(mpf_frame_buffer_t *buffer, const char *utt_file_in, const char *utt_file_out);
-#endif
-
-APT_END_EXTERN_C
-
-#endif /* MPF_FRAME_BUFFER_H */
diff --git a/libs/unimrcp/libs/mpf/include/mpf_jitter_buffer.h b/libs/unimrcp/libs/mpf/include/mpf_jitter_buffer.h
deleted file mode 100644
index 5b483607fb..0000000000
--- a/libs/unimrcp/libs/mpf/include/mpf_jitter_buffer.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mpf_jitter_buffer.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MPF_JITTER_BUFFER_H
-#define MPF_JITTER_BUFFER_H
-
-/**
- * @file mpf_jitter_buffer.h
- * @brief Jitter Buffer
- */
-
-#include "mpf_frame.h"
-#include "mpf_codec.h"
-#include "mpf_rtp_descriptor.h"
-
-APT_BEGIN_EXTERN_C
-
-/** Jitter buffer write result */
-typedef enum {
- JB_OK, /**< successful write */
- JB_DISCARD_NOT_ALLIGNED, /**< discarded write (frame isn't alligned to CODEC_FRAME_TIME_BASE) */
- JB_DISCARD_TOO_LATE, /**< discarded write (frame is arrived too late) */
- JB_DISCARD_TOO_EARLY, /**< discarded write (frame is arrived too early, buffer is full) */
-} jb_result_t;
-
-/** Opaque jitter buffer declaration */
-typedef struct mpf_jitter_buffer_t mpf_jitter_buffer_t;
-
-
-/** Create jitter buffer */
-mpf_jitter_buffer_t* mpf_jitter_buffer_create(mpf_jb_config_t *jb_config, mpf_codec_descriptor_t *descriptor, mpf_codec_t *codec, apr_pool_t *pool);
-
-/** Destroy jitter buffer */
-void mpf_jitter_buffer_destroy(mpf_jitter_buffer_t *jb);
-
-/** Restart jitter buffer */
-apt_bool_t mpf_jitter_buffer_restart(mpf_jitter_buffer_t *jb);
-
-/** Write audio data to jitter buffer */
-jb_result_t mpf_jitter_buffer_write(mpf_jitter_buffer_t *jb, void *buffer, apr_size_t size, apr_uint32_t ts, apr_byte_t marker);
-
-/** Write named event to jitter buffer */
-jb_result_t mpf_jitter_buffer_event_write(mpf_jitter_buffer_t *jb, const mpf_named_event_frame_t *named_event, apr_uint32_t ts, apr_byte_t marker);
-
-/** Read media frame from jitter buffer */
-apt_bool_t mpf_jitter_buffer_read(mpf_jitter_buffer_t *jb, mpf_frame_t *media_frame);
-
-/** Get current playout delay */
-apr_uint32_t mpf_jitter_buffer_playout_delay_get(const mpf_jitter_buffer_t *jb);
-
-APT_END_EXTERN_C
-
-#endif /* MPF_JITTER_BUFFER_H */
diff --git a/libs/unimrcp/libs/mpf/include/mpf_message.h b/libs/unimrcp/libs/mpf/include/mpf_message.h
deleted file mode 100644
index 91db7f0946..0000000000
--- a/libs/unimrcp/libs/mpf/include/mpf_message.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mpf_message.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MPF_MESSAGE_H
-#define MPF_MESSAGE_H
-
-/**
- * @file mpf_message.h
- * @brief Media Processing Framework Message Definitions
- */
-
-#include "mpf_types.h"
-
-APT_BEGIN_EXTERN_C
-
-/** Max number of messages grouped in a container */
-#define MAX_MPF_MESSAGE_COUNT 5
-
-/** Enumeration of MPF message types */
-typedef enum {
- MPF_MESSAGE_TYPE_REQUEST, /**< request message */
- MPF_MESSAGE_TYPE_RESPONSE, /**< response message */
- MPF_MESSAGE_TYPE_EVENT /**< event message */
-} mpf_message_type_e;
-
-/** Enumeration of MPF status codes */
-typedef enum {
- MPF_STATUS_CODE_SUCCESS, /**< indicates success */
- MPF_STATUS_CODE_FAILURE /**< indicates failure */
-} mpf_status_code_e;
-
-
-/** Enumeration of MPF commands */
-typedef enum {
- MPF_ADD_TERMINATION, /**< add termination to context */
- MPF_MODIFY_TERMINATION, /**< modify termination properties */
- MPF_SUBTRACT_TERMINATION,/**< subtract termination from context */
- MPF_ADD_ASSOCIATION, /**< add association between terminations */
- MPF_REMOVE_ASSOCIATION, /**< remove association between terminations */
- MPF_RESET_ASSOCIATIONS, /**< reset associations among terminations (also destroy topology) */
- MPF_APPLY_TOPOLOGY, /**< apply topology based on assigned associations */
- MPF_DESTROY_TOPOLOGY /**< destroy applied topology */
-} mpf_command_type_e;
-
-/** MPF message declaration */
-typedef struct mpf_message_t mpf_message_t;
-/** MPF message container declaration */
-typedef struct mpf_message_container_t mpf_message_container_t;
-
-/** MPF message definition */
-struct mpf_message_t {
- /** Message type (request/response/event) */
- mpf_message_type_e message_type;
- /** Command identifier (add, modify, subtract, ...) */
- mpf_command_type_e command_id;
- /** Status code used in responses */
- mpf_status_code_e status_code;
-
- /** Context */
- mpf_context_t *context;
- /** Termination */
- mpf_termination_t *termination;
- /** Associated termination */
- mpf_termination_t *assoc_termination;
- /** Termination type dependent descriptor */
- void *descriptor;
-};
-
-/** MPF message container definition */
-struct mpf_message_container_t {
- /** Number of actual messages */
- apr_size_t count;
- /** Array of messages */
- mpf_message_t messages[MAX_MPF_MESSAGE_COUNT];
-};
-
-APT_END_EXTERN_C
-
-#endif /* MPF_MESSAGE_H */
diff --git a/libs/unimrcp/libs/mpf/include/mpf_mixer.h b/libs/unimrcp/libs/mpf/include/mpf_mixer.h
deleted file mode 100644
index c4e66542d2..0000000000
--- a/libs/unimrcp/libs/mpf/include/mpf_mixer.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mpf_mixer.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MPF_MIXER_H
-#define MPF_MIXER_H
-
-/**
- * @file mpf_mixer.h
- * @brief MPF Stream Mixer (n-sources, 1-sink)
- */
-
-#include "mpf_object.h"
-
-APT_BEGIN_EXTERN_C
-
-/**
- * Create audio stream mixer.
- * @param source_arr the array of audio sources
- * @param source_count the number of audio sources
- * @param sink the audio sink
- * @param codec_manager the codec manager
- * @param name the informative name used for debugging
- * @param pool the pool to allocate memory from
- */
-MPF_DECLARE(mpf_object_t*) mpf_mixer_create(
- mpf_audio_stream_t **source_arr,
- apr_size_t source_count,
- mpf_audio_stream_t *sink,
- const mpf_codec_manager_t *codec_manager,
- const char *name,
- apr_pool_t *pool);
-
-
-APT_END_EXTERN_C
-
-#endif /* MPF_MIXER_H */
diff --git a/libs/unimrcp/libs/mpf/include/mpf_multiplier.h b/libs/unimrcp/libs/mpf/include/mpf_multiplier.h
deleted file mode 100644
index 04d36469eb..0000000000
--- a/libs/unimrcp/libs/mpf/include/mpf_multiplier.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mpf_multiplier.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MPF_MULTIPLIER_H
-#define MPF_MULTIPLIER_H
-
-/**
- * @file mpf_multiplier.h
- * @brief MPF Stream Multiplier (1-source, n-sinks)
- */
-
-#include "mpf_object.h"
-
-APT_BEGIN_EXTERN_C
-
-/**
- * Create audio stream multiplier.
- * @param source the audio source
- * @param sink_arr the array of audio sinks
- * @param sink_count the number of audio sinks
- * @param codec_manager the codec manager
- * @param name the informative name used for debugging
- * @param pool the pool to allocate memory from
- */
-MPF_DECLARE(mpf_object_t*) mpf_multiplier_create(
- mpf_audio_stream_t *source,
- mpf_audio_stream_t **sink_arr,
- apr_size_t sink_count,
- const mpf_codec_manager_t *codec_manager,
- const char *name,
- apr_pool_t *pool);
-
-
-APT_END_EXTERN_C
-
-#endif /* MPF_MULTIPLIER_H */
diff --git a/libs/unimrcp/libs/mpf/include/mpf_named_event.h b/libs/unimrcp/libs/mpf/include/mpf_named_event.h
deleted file mode 100644
index 1ffc71fc2b..0000000000
--- a/libs/unimrcp/libs/mpf/include/mpf_named_event.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mpf_named_event.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MPF_NAMED_EVENT_H
-#define MPF_NAMED_EVENT_H
-
-/**
- * @file mpf_named_event.h
- * @brief MPF Named Events (RFC4733/RFC2833)
- */
-
-#include "mpf_codec_descriptor.h"
-
-APT_BEGIN_EXTERN_C
-
-/** Named event declaration */
-typedef struct mpf_named_event_frame_t mpf_named_event_frame_t;
-
-
-/** Named event (RFC4733/RFC2833, out-of-band DTMF) */
-struct mpf_named_event_frame_t {
- /** event (DTMF, tone) identifier */
- apr_uint32_t event_id: 8;
-#if (APR_IS_BIGENDIAN == 1)
- /** end of event */
- apr_uint32_t edge: 1;
- /** reserved */
- apr_uint32_t reserved: 1;
- /** tone volume */
- apr_uint32_t volume: 6;
-#else
- /** tone volume */
- apr_uint32_t volume: 6;
- /** reserved */
- apr_uint32_t reserved: 1;
- /** end of event */
- apr_uint32_t edge: 1;
-#endif
- /** event duration */
- apr_uint32_t duration: 16;
-};
-
-/** Create named event descriptor */
-MPF_DECLARE(mpf_codec_descriptor_t*) mpf_event_descriptor_create(apr_uint16_t sampling_rate, apr_pool_t *pool);
-
-/** Check whether the specified descriptor is named event one */
-MPF_DECLARE(apt_bool_t) mpf_event_descriptor_check(const mpf_codec_descriptor_t *descriptor);
-
-/** Convert DTMF character to event identifier */
-MPF_DECLARE(apr_uint32_t) mpf_dtmf_char_to_event_id(const char dtmf_char);
-
-/** Convert event identifier to DTMF character */
-MPF_DECLARE(char) mpf_event_id_to_dtmf_char(const apr_uint32_t event_id);
-
-
-APT_END_EXTERN_C
-
-#endif /* MPF_NAMED_EVENT_H */
diff --git a/libs/unimrcp/libs/mpf/include/mpf_object.h b/libs/unimrcp/libs/mpf/include/mpf_object.h
deleted file mode 100644
index 2e8db829b5..0000000000
--- a/libs/unimrcp/libs/mpf/include/mpf_object.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mpf_object.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MPF_OBJECT_H
-#define MPF_OBJECT_H
-
-/**
- * @file mpf_object.h
- * @brief Media Processing Object Base (bridge, multiplexor, mixer, ...)
- */
-
-#include "mpf_types.h"
-
-APT_BEGIN_EXTERN_C
-
-/** MPF object declaration */
-typedef struct mpf_object_t mpf_object_t;
-
-/** Media processing objects base */
-struct mpf_object_t {
- /** Informative name used for debugging */
- const char *name;
- /** Virtual destroy */
- apt_bool_t (*destroy)(mpf_object_t *object);
- /** Virtual process */
- apt_bool_t (*process)(mpf_object_t *object);
- /** Virtual trace of media path */
- void (*trace)(mpf_object_t *object);
-};
-
-/** Initialize object */
-static APR_INLINE void mpf_object_init(mpf_object_t *object, const char *name)
-{
- object->name = name;
- object->destroy = NULL;
- object->process = NULL;
- object->trace = NULL;
-}
-
-/** Destroy object */
-static APR_INLINE void mpf_object_destroy(mpf_object_t *object)
-{
- if(object->destroy)
- object->destroy(object);
-}
-
-/** Process object */
-static APR_INLINE void mpf_object_process(mpf_object_t *object)
-{
- if(object->process)
- object->process(object);
-}
-
-/** Trace media path */
-static APR_INLINE void mpf_object_trace(mpf_object_t *object)
-{
- if(object->trace)
- object->trace(object);
-}
-
-
-APT_END_EXTERN_C
-
-#endif /* MPF_OBJECT_H */
diff --git a/libs/unimrcp/libs/mpf/include/mpf_resampler.h b/libs/unimrcp/libs/mpf/include/mpf_resampler.h
deleted file mode 100644
index 13e0e59143..0000000000
--- a/libs/unimrcp/libs/mpf/include/mpf_resampler.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mpf_resampler.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MPF_RESAMPLER_H
-#define MPF_RESAMPLER_H
-
-/**
- * @file mpf_resampler.h
- * @brief MPF Stream Resampler
- */
-
-#include "mpf_stream.h"
-
-APT_BEGIN_EXTERN_C
-
-/**
- * Create audio stream resampler.
- * @param source the source stream to resample
- * @param sink the sink stream to resample to
- * @param pool the pool to allocate memory from
- */
-MPF_DECLARE(mpf_audio_stream_t*) mpf_resampler_create(mpf_audio_stream_t *source, mpf_audio_stream_t *sink, apr_pool_t *pool);
-
-
-APT_END_EXTERN_C
-
-#endif /* MPF_RESAMPLER_H */
diff --git a/libs/unimrcp/libs/mpf/include/mpf_rtcp_packet.h b/libs/unimrcp/libs/mpf/include/mpf_rtcp_packet.h
deleted file mode 100644
index 7afa55ede1..0000000000
--- a/libs/unimrcp/libs/mpf/include/mpf_rtcp_packet.h
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mpf_rtcp_packet.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MPF_RTCP_PACKET_H
-#define MPF_RTCP_PACKET_H
-
-/**
- * @file mpf_rtcp_packet.h
- * @brief RTCP Packet Definition
- */
-
-#include "mpf_rtp_stat.h"
-
-APT_BEGIN_EXTERN_C
-
-
-/** RTCP payload (packet) types */
-typedef enum {
- RTCP_SR = 200,
- RTCP_RR = 201,
- RTCP_SDES = 202,
- RTCP_BYE = 203,
- RTCP_APP = 204
-} rtcp_type_e;
-
-/** RTCP SDES types */
-typedef enum {
- RTCP_SDES_END = 0,
- RTCP_SDES_CNAME = 1,
- RTCP_SDES_NAME = 2,
- RTCP_SDES_EMAIL = 3,
- RTCP_SDES_PHONE = 4,
- RTCP_SDES_LOC = 5,
- RTCP_SDES_TOOL = 6,
- RTCP_SDES_NOTE = 7,
- RTCP_SDES_PRIV = 8
-} rtcp_sdes_type_e;
-
-/** RTCP header declaration */
-typedef struct rtcp_header_t rtcp_header_t;
-/** RTCP packet declaration */
-typedef struct rtcp_packet_t rtcp_packet_t;
-/** SDES item declaration*/
-typedef struct rtcp_sdes_item_t rtcp_sdes_item_t;
-
-
-/** RTCP header */
-struct rtcp_header_t {
-#if (APR_IS_BIGENDIAN == 1)
- /** protocol version */
- unsigned int version: 2;
- /** padding flag */
- unsigned int padding: 1;
- /** varies by packet type */
- unsigned int count: 5;
- /** packet type */
- unsigned int pt: 8;
-#else
- /** varies by packet type */
- unsigned int count: 5;
- /** padding flag */
- unsigned int padding: 1;
- /** protocol version */
- unsigned int version: 2;
- /** packet type */
- unsigned int pt: 8;
-#endif
-
- /** packet length in words, w/o this word */
- unsigned int length: 16;
-};
-
-/** SDES item */
-struct rtcp_sdes_item_t {
- /** type of item (rtcp_sdes_type_t) */
- apr_byte_t type;
- /** length of item (in octets) */
- apr_byte_t length;
- /** text, not null-terminated */
- char data[1];
-};
-
-/** RTCP packet */
-struct rtcp_packet_t {
- /** common header */
- rtcp_header_t header;
- /** union of RTCP reports */
- union {
- /** sender report (SR) */
- struct {
- /** sr stat */
- rtcp_sr_stat_t sr_stat;
- /** variable-length list rr stats */
- rtcp_rr_stat_t rr_stat[1];
- } sr;
-
- /** reception report (RR) */
- struct {
- /** receiver generating this report */
- apr_uint32_t ssrc;
- /** variable-length list rr stats */
- rtcp_rr_stat_t rr_stat[1];
- } rr;
-
- /** source description (SDES) */
- struct {
- /** first SSRC/CSRC */
- apr_uint32_t ssrc;
- /** list of SDES items */
- rtcp_sdes_item_t item[1];
- } sdes;
-
- /** BYE */
- struct {
- /** list of sources */
- apr_uint32_t ssrc[1];
- /* optional length of reason string (in octets) */
- apr_byte_t length;
- /* optional reason string, not null-terminated */
- char data[1];
- } bye;
- } r;
-};
-
-/** Initialize RTCP header */
-static APR_INLINE void rtcp_header_init(rtcp_header_t *header, rtcp_type_e pt)
-{
- header->version = RTP_VERSION;
- header->padding = 0;
- header->count = 0;
- header->pt = pt;
- header->length = 0;
-}
-
-static APR_INLINE void rtcp_header_length_set(rtcp_header_t *header, apr_size_t length)
-{
- header->length = htons((apr_uint16_t)length / 4 - 1);
-}
-
-static APR_INLINE void rtcp_sr_hton(rtcp_sr_stat_t *sr_stat)
-{
- sr_stat->ssrc = htonl(sr_stat->ssrc);
- sr_stat->ntp_sec = htonl(sr_stat->ntp_sec);
- sr_stat->ntp_frac = htonl(sr_stat->ntp_frac);
- sr_stat->rtp_ts = htonl(sr_stat->rtp_ts);
- sr_stat->sent_packets = htonl(sr_stat->sent_packets);
- sr_stat->sent_octets = htonl(sr_stat->sent_octets);
-}
-
-static APR_INLINE void rtcp_sr_ntoh(rtcp_sr_stat_t *sr_stat)
-{
- sr_stat->ssrc = ntohl(sr_stat->ssrc);
- sr_stat->ntp_sec = ntohl(sr_stat->ntp_sec);
- sr_stat->ntp_frac = ntohl(sr_stat->ntp_frac);
- sr_stat->rtp_ts = ntohl(sr_stat->rtp_ts);
- sr_stat->sent_packets = ntohl(sr_stat->sent_packets);
- sr_stat->sent_octets = ntohl(sr_stat->sent_octets);
-}
-
-static APR_INLINE void rtcp_rr_hton(rtcp_rr_stat_t *rr_stat)
-{
- rr_stat->ssrc = htonl(rr_stat->ssrc);
- rr_stat->last_seq = htonl(rr_stat->last_seq);
- rr_stat->jitter = htonl(rr_stat->jitter);
-
-#if (APR_IS_BIGENDIAN == 0)
- rr_stat->lost = ((rr_stat->lost >> 16) & 0x000000ff) |
- (rr_stat->lost & 0x0000ff00) |
- ((rr_stat->lost << 16) & 0x00ff0000);
-#endif
-}
-
-static APR_INLINE void rtcp_rr_ntoh(rtcp_rr_stat_t *rr_stat)
-{
- rr_stat->ssrc = ntohl(rr_stat->ssrc);
- rr_stat->last_seq = ntohl(rr_stat->last_seq);
- rr_stat->jitter = ntohl(rr_stat->jitter);
-
-#if (APR_IS_BIGENDIAN == 0)
- rr_stat->lost = ((rr_stat->lost >> 16) & 0x000000ff) |
- (rr_stat->lost & 0x0000ff00) |
- ((rr_stat->lost << 16) & 0x00ff0000);
-#endif
-}
-
-APT_END_EXTERN_C
-
-#endif /* MPF_RTCP_PACKET_H */
diff --git a/libs/unimrcp/libs/mpf/include/mpf_rtp_attribs.h b/libs/unimrcp/libs/mpf/include/mpf_rtp_attribs.h
deleted file mode 100644
index 033e198851..0000000000
--- a/libs/unimrcp/libs/mpf/include/mpf_rtp_attribs.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mpf_rtp_attribs.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MPF_RTP_ATTRIBS_H
-#define MPF_RTP_ATTRIBS_H
-
-/**
- * @file mpf_rtp_attribs.h
- * @brief RTP Attributes (SDP)
- */
-
-#include "mpf_rtp_descriptor.h"
-
-APT_BEGIN_EXTERN_C
-
-/** RTP attributes */
-typedef enum {
- RTP_ATTRIB_RTPMAP,
- RTP_ATTRIB_SENDONLY,
- RTP_ATTRIB_RECVONLY,
- RTP_ATTRIB_SENDRECV,
- RTP_ATTRIB_MID,
- RTP_ATTRIB_PTIME,
-
- RTP_ATTRIB_COUNT,
- RTP_ATTRIB_UNKNOWN = RTP_ATTRIB_COUNT
-} mpf_rtp_attrib_e;
-
-
-/** Get audio media attribute name by attribute identifier */
-MPF_DECLARE(const apt_str_t*) mpf_rtp_attrib_str_get(mpf_rtp_attrib_e attrib_id);
-
-/** Find audio media attribute identifier by attribute name */
-MPF_DECLARE(mpf_rtp_attrib_e) mpf_rtp_attrib_id_find(const apt_str_t *attrib);
-
-/** Get string by RTP direction (send/receive) */
-MPF_DECLARE(const apt_str_t*) mpf_rtp_direction_str_get(mpf_stream_direction_e direction);
-
-APT_END_EXTERN_C
-
-#endif /* MPF_RTP_ATTRIBS_H */
diff --git a/libs/unimrcp/libs/mpf/include/mpf_rtp_defs.h b/libs/unimrcp/libs/mpf/include/mpf_rtp_defs.h
deleted file mode 100644
index 6ea541862a..0000000000
--- a/libs/unimrcp/libs/mpf/include/mpf_rtp_defs.h
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mpf_rtp_defs.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MPF_RTP_DEFS_H
-#define MPF_RTP_DEFS_H
-
-/**
- * @file mpf_rtp_defs.h
- * @brief Internal RTP Definitions
- */
-
-#include "mpf_rtp_stat.h"
-#include "mpf_jitter_buffer.h"
-
-APT_BEGIN_EXTERN_C
-
-/** Used to calculate actual number of received packets (32bit) in
- * case seq number (16bit) wrapped around */
-#define RTP_SEQ_MOD (1 << 16)
-/** Number of max dropout packets (seq numbers) is used to trigger
- * either a drift in the seq numbers or a misorder packet */
-#define MAX_DROPOUT 3000
-/** Number of max misorder packets (seq numbers) is used to
- * differentiate a drift in the seq numbers from a misorder packet */
-#define MAX_MISORDER 100
-/** Restart receiver if threshold is reached */
-#define DISCARDED_TO_RECEIVED_RATIO_THRESHOLD 30 /* 30% */
-/** Deviation threshold is used to trigger a drift in timestamps */
-#define DEVIATION_THRESHOLD 4000
-/** This threshold is used to detect a new talkspurt */
-#define INTER_TALKSPURT_GAP 1000 /* msec */
-
-/** RTP receiver history declaration */
-typedef struct rtp_rx_history_t rtp_rx_history_t;
-/** RTP receiver periodic history declaration */
-typedef struct rtp_rx_periodic_history_t rtp_rx_periodic_history_t;
-/** RTP receiver declaration */
-typedef struct rtp_receiver_t rtp_receiver_t;
-/** RTP transmitter declaration */
-typedef struct rtp_transmitter_t rtp_transmitter_t;
-
-/** History of RTP receiver */
-struct rtp_rx_history_t {
- /** Updated on every seq num wrap around */
- apr_uint32_t seq_cycles;
-
- /** First seq num received */
- apr_uint16_t seq_num_base;
- /** Max seq num received */
- apr_uint16_t seq_num_max;
-
- /** Last timestamp received */
- apr_uint32_t ts_last;
- /** Local time measured on last packet received */
- apr_time_t time_last;
-
- /** New ssrc, which is in probation */
- apr_uint32_t ssrc_new;
- /** Period of ssrc probation */
- apr_byte_t ssrc_probation;
-};
-
-/** Periodic history of RTP receiver (initialized after every N packets) */
-struct rtp_rx_periodic_history_t {
- /** Number of packets received */
- apr_uint32_t received_prior;
- /** Number of packets expected */
- apr_uint32_t expected_prior;
- /** Number of packets discarded */
- apr_uint32_t discarded_prior;
-
- /** Min jitter */
- apr_uint32_t jitter_min;
- /** Max jitter */
- apr_uint32_t jitter_max;
-};
-
-/** Reset RTP receiver history */
-static APR_INLINE void mpf_rtp_rx_history_reset(rtp_rx_history_t *rx_history)
-{
- memset(rx_history,0,sizeof(rtp_rx_history_t));
-}
-
-/** Reset RTP receiver periodic history */
-static APR_INLINE void mpf_rtp_rx_periodic_history_reset(rtp_rx_periodic_history_t *rx_periodic_history)
-{
- memset(rx_periodic_history,0,sizeof(rtp_rx_periodic_history_t));
-}
-
-/** RTP receiver */
-struct rtp_receiver_t {
- /** Jitter buffer */
- mpf_jitter_buffer_t *jb;
-
- /** RTCP statistics used in RR */
- rtcp_rr_stat_t rr_stat;
- /** RTP receiver statistics */
- rtp_rx_stat_t stat;
- /** RTP history */
- rtp_rx_history_t history;
- /** RTP periodic history */
- rtp_rx_periodic_history_t periodic_history;
-};
-
-
-/** RTP transmitter */
-struct rtp_transmitter_t {
- /** Packetization time in msec */
- apr_uint16_t ptime;
-
- /** Number of frames in a packet */
- apr_uint16_t packet_frames;
- /** Current number of frames */
- apr_uint16_t current_frames;
- /** Samples in frames in timestamp units */
- apr_uint32_t samples_per_frame;
-
- /** Indicate silence period among the talkspurts */
- apr_byte_t inactivity;
- /** Last seq number sent */
- apr_uint16_t last_seq_num;
- /** Current timestamp (samples processed) */
- apr_uint32_t timestamp;
- /** Event timestamp base */
- apr_uint32_t timestamp_base;
-
- /** RTP packet payload */
- char *packet_data;
- /** RTP packet payload size */
- apr_size_t packet_size;
-
- /** RTCP statistics used in SR */
- rtcp_sr_stat_t sr_stat;
-};
-
-
-/** Initialize RTP receiver */
-static APR_INLINE void rtp_receiver_init(rtp_receiver_t *receiver)
-{
- receiver->jb = NULL;
-
- mpf_rtcp_rr_stat_reset(&receiver->rr_stat);
- mpf_rtp_rx_stat_reset(&receiver->stat);
- mpf_rtp_rx_history_reset(&receiver->history);
- mpf_rtp_rx_periodic_history_reset(&receiver->periodic_history);
-}
-
-/** Initialize RTP transmitter */
-static APR_INLINE void rtp_transmitter_init(rtp_transmitter_t *transmitter)
-{
- transmitter->ptime = 0;
-
- transmitter->packet_frames = 0;
- transmitter->current_frames = 0;
- transmitter->samples_per_frame = 0;
-
- transmitter->inactivity = 0;
- transmitter->last_seq_num = 0;
- transmitter->timestamp = 0;
- transmitter->timestamp_base = 0;
-
- transmitter->packet_data = NULL;
- transmitter->packet_size = 0;
-
- mpf_rtcp_sr_stat_reset(&transmitter->sr_stat);
-}
-
-APT_END_EXTERN_C
-
-#endif /* MPF_RTP_DEFS_H */
diff --git a/libs/unimrcp/libs/mpf/include/mpf_rtp_descriptor.h b/libs/unimrcp/libs/mpf/include/mpf_rtp_descriptor.h
deleted file mode 100644
index 60fac7aefa..0000000000
--- a/libs/unimrcp/libs/mpf/include/mpf_rtp_descriptor.h
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mpf_rtp_descriptor.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MPF_RTP_DESCRIPTOR_H
-#define MPF_RTP_DESCRIPTOR_H
-
-/**
- * @file mpf_rtp_descriptor.h
- * @brief MPF RTP Stream Descriptor
- */
-
-#include
-#include "apt_string.h"
-#include "mpf_stream_descriptor.h"
-
-APT_BEGIN_EXTERN_C
-
-/** RTP media descriptor declaration */
-typedef struct mpf_rtp_media_descriptor_t mpf_rtp_media_descriptor_t;
-/** RTP stream descriptor declaration */
-typedef struct mpf_rtp_stream_descriptor_t mpf_rtp_stream_descriptor_t;
-/** RTP termination descriptor declaration */
-typedef struct mpf_rtp_termination_descriptor_t mpf_rtp_termination_descriptor_t;
-/** RTP configuration declaration */
-typedef struct mpf_rtp_config_t mpf_rtp_config_t;
-/** RTP settings declaration */
-typedef struct mpf_rtp_settings_t mpf_rtp_settings_t;
-/** Jitter buffer configuration declaration */
-typedef struct mpf_jb_config_t mpf_jb_config_t;
-
-/** MPF media state */
-typedef enum {
- MPF_MEDIA_DISABLED, /**< disabled media */
- MPF_MEDIA_ENABLED /**< enabled media */
-} mpf_media_state_e;
-
-/** RTP media (local/remote) descriptor */
-struct mpf_rtp_media_descriptor_t {
- /** Media state (disabled/enabled)*/
- mpf_media_state_e state;
- /** Ip address */
- apt_str_t ip;
- /** External (NAT) Ip address */
- apt_str_t ext_ip;
- /** Port */
- apr_port_t port;
- /** Stream mode (send/receive) */
- mpf_stream_direction_e direction;
- /** Packetization time */
- apr_uint16_t ptime;
- /** Codec list */
- mpf_codec_list_t codec_list;
- /** Media identifier */
- apr_size_t mid;
- /** Position, order in SDP message (0,1,...) */
- apr_size_t id;
-};
-
-/** RTP stream descriptor */
-struct mpf_rtp_stream_descriptor_t {
- /** Stream capabilities */
- mpf_stream_capabilities_t *capabilities;
- /** Local media descriptor */
- mpf_rtp_media_descriptor_t *local;
- /** Remote media descriptor */
- mpf_rtp_media_descriptor_t *remote;
- /** Settings loaded from config */
- mpf_rtp_settings_t *settings;
-};
-
-/** RTP termination descriptor */
-struct mpf_rtp_termination_descriptor_t {
- /** Audio stream descriptor */
- mpf_rtp_stream_descriptor_t audio;
- /** Video stream descriptor */
- mpf_rtp_stream_descriptor_t video;
-};
-
-/** Jitter buffer configuration */
-struct mpf_jb_config_t {
- /** Min playout delay in msec */
- apr_uint32_t min_playout_delay;
- /** Initial playout delay in msec */
- apr_uint32_t initial_playout_delay;
- /** Max playout delay in msec */
- apr_uint32_t max_playout_delay;
- /** Mode of operation of the jitter buffer: static - 0, adaptive - 1 */
- apr_byte_t adaptive;
- /** Enable/disable time skew detection */
- apr_byte_t time_skew_detection;
-};
-
-/** RTCP BYE transmission policy */
-typedef enum {
- RTCP_BYE_DISABLE, /**< disable RTCP BYE transmission */
- RTCP_BYE_PER_SESSION, /**< transmit RTCP BYE at the end of session */
- RTCP_BYE_PER_TALKSPURT /**< transmit RTCP BYE at the end of each talkspurt (input) */
-} rtcp_bye_policy_e;
-
-/** RTP factory config */
-struct mpf_rtp_config_t {
- /** Local IP address to bind to */
- apt_str_t ip;
- /** External (NAT) IP address */
- apt_str_t ext_ip;
- /** Min RTP port */
- apr_port_t rtp_port_min;
- /** Max RTP port */
- apr_port_t rtp_port_max;
- /** Current RTP port */
- apr_port_t rtp_port_cur;
-};
-
-/** RTP settings */
-struct mpf_rtp_settings_t {
- /** Packetization time */
- apr_uint16_t ptime;
- /** Codec list */
- mpf_codec_list_t codec_list;
- /** Preference in offer/anwser: 1 - own(local) preference, 0 - remote preference */
- apt_bool_t own_preferrence;
- /** Enable/disable RTCP support */
- apt_bool_t rtcp;
- /** RTCP BYE policy */
- rtcp_bye_policy_e rtcp_bye_policy;
- /** RTCP report transmission interval */
- apr_uint16_t rtcp_tx_interval;
- /** RTCP rx resolution (timeout to check for a new RTCP message) */
- apr_uint16_t rtcp_rx_resolution;
- /** Jitter buffer config */
- mpf_jb_config_t jb_config;
-};
-
-/** Initialize media descriptor */
-static APR_INLINE void mpf_rtp_media_descriptor_init(mpf_rtp_media_descriptor_t *media)
-{
- media->state = MPF_MEDIA_DISABLED;
- apt_string_reset(&media->ip);
- apt_string_reset(&media->ext_ip);
- media->port = 0;
- media->direction = STREAM_DIRECTION_NONE;
- media->ptime = 0;
- mpf_codec_list_reset(&media->codec_list);
- media->mid = 0;
- media->id = 0;
-}
-
-/** Initialize stream descriptor */
-static APR_INLINE void mpf_rtp_stream_descriptor_init(mpf_rtp_stream_descriptor_t *descriptor)
-{
- descriptor->capabilities = NULL;
- descriptor->local = NULL;
- descriptor->remote = NULL;
- descriptor->settings = NULL;
-}
-
-/** Initialize RTP termination descriptor */
-static APR_INLINE void mpf_rtp_termination_descriptor_init(mpf_rtp_termination_descriptor_t *rtp_descriptor)
-{
- mpf_rtp_stream_descriptor_init(&rtp_descriptor->audio);
- mpf_rtp_stream_descriptor_init(&rtp_descriptor->video);
-}
-
-/** Initialize JB config */
-static APR_INLINE void mpf_jb_config_init(mpf_jb_config_t *jb_config)
-{
- jb_config->adaptive = 0;
- jb_config->initial_playout_delay = 0;
- jb_config->min_playout_delay = 0;
- jb_config->max_playout_delay = 0;
- jb_config->time_skew_detection = 1;
-}
-
-/** Allocate RTP config */
-static APR_INLINE mpf_rtp_config_t* mpf_rtp_config_alloc(apr_pool_t *pool)
-{
- mpf_rtp_config_t *rtp_config = (mpf_rtp_config_t*)apr_palloc(pool,sizeof(mpf_rtp_config_t));
- apt_string_reset(&rtp_config->ip);
- apt_string_reset(&rtp_config->ext_ip);
- rtp_config->rtp_port_cur = 0;
- rtp_config->rtp_port_min = 0;
- rtp_config->rtp_port_max = 0;
- return rtp_config;
-}
-
-/** Allocate RTP settings */
-static APR_INLINE mpf_rtp_settings_t* mpf_rtp_settings_alloc(apr_pool_t *pool)
-{
- mpf_rtp_settings_t *rtp_settings = (mpf_rtp_settings_t*)apr_palloc(pool,sizeof(mpf_rtp_settings_t));
- rtp_settings->ptime = 0;
- mpf_codec_list_init(&rtp_settings->codec_list,0,pool);
- rtp_settings->own_preferrence = FALSE;
- rtp_settings->rtcp = FALSE;
- rtp_settings->rtcp_bye_policy = RTCP_BYE_DISABLE;
- rtp_settings->rtcp_tx_interval = 0;
- rtp_settings->rtcp_rx_resolution = 0;
- mpf_jb_config_init(&rtp_settings->jb_config);
- return rtp_settings;
-}
-
-
-APT_END_EXTERN_C
-
-#endif /* MPF_RTP_DESCRIPTOR_H */
diff --git a/libs/unimrcp/libs/mpf/include/mpf_rtp_header.h b/libs/unimrcp/libs/mpf/include/mpf_rtp_header.h
deleted file mode 100644
index 36c50c0b42..0000000000
--- a/libs/unimrcp/libs/mpf/include/mpf_rtp_header.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mpf_rtp_header.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MPF_RTP_HEADER_H
-#define MPF_RTP_HEADER_H
-
-/**
- * @file mpf_rtp_header.h
- * @brief RTP Header Definition
- */
-
-#include "mpf.h"
-
-APT_BEGIN_EXTERN_C
-
-/** Protocol version */
-#define RTP_VERSION 2
-
-/** RTP header declaration */
-typedef struct rtp_header_t rtp_header_t;
-/** RTP extension header declaration */
-typedef struct rtp_extension_header_t rtp_extension_header_t;
-
-
-/** RTP header */
-struct rtp_header_t {
-#if (APR_IS_BIGENDIAN == 1)
- /** protocol version */
- apr_uint32_t version: 2;
- /** padding flag */
- apr_uint32_t padding: 1;
- /** header extension flag */
- apr_uint32_t extension: 1;
- /** CSRC count */
- apr_uint32_t count: 4;
- /** marker bit */
- apr_uint32_t marker: 1;
- /** payload type */
- apr_uint32_t type: 7;
-#else
- /** CSRC count */
- apr_uint32_t count: 4;
- /** header extension flag */
- apr_uint32_t extension: 1;
- /** padding flag */
- apr_uint32_t padding: 1;
- /** protocol version */
- apr_uint32_t version: 2;
- /** payload type */
- apr_uint32_t type: 7;
- /** marker bit */
- apr_uint32_t marker: 1;
-#endif
-
- /** sequence number */
- apr_uint32_t sequence: 16;
- /** timestamp */
- apr_uint32_t timestamp;
- /** synchronization source */
- apr_uint32_t ssrc;
-};
-
-/** RTP extension header */
-struct rtp_extension_header_t {
- /** profile */
- apr_uint16_t profile;
- /** length */
- apr_uint16_t length;
-};
-
-APT_END_EXTERN_C
-
-#endif /* MPF_RTP_HEADER_H */
diff --git a/libs/unimrcp/libs/mpf/include/mpf_rtp_pt.h b/libs/unimrcp/libs/mpf/include/mpf_rtp_pt.h
deleted file mode 100644
index 2d01346308..0000000000
--- a/libs/unimrcp/libs/mpf/include/mpf_rtp_pt.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mpf_rtp_pt.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MPF_RTP_PT_H
-#define MPF_RTP_PT_H
-
-/**
- * @file mpf_rtp_pt.h
- * @brief RTP Payload Types (RFC3551)
- */
-
-#include "mpf.h"
-
-APT_BEGIN_EXTERN_C
-
-/** RTP payload types */
-typedef enum {
- RTP_PT_PCMU = 0, /**< PCMU Audio 8kHz 1 */
- RTP_PT_PCMA = 8, /**< PCMA Audio 8kHz 1 */
-
- RTP_PT_CN = 13, /**< Comfort Noise Audio 8kHz 1 */
-
- RTP_PT_RESERVED = 19, /**< Not used for any particular codec */
-
- RTP_PT_DYNAMIC = 96, /**< Start of dynamic payload types */
- RTP_PT_DYNAMIC_MAX = 127, /**< End of dynamic payload types */
-
- RTP_PT_UNKNOWN = 128 /**< Unknown (invalid) payload type */
-} mpf_rtp_pt_e;
-
-APT_END_EXTERN_C
-
-#endif /* MPF_RTP_PT_H */
diff --git a/libs/unimrcp/libs/mpf/include/mpf_rtp_stat.h b/libs/unimrcp/libs/mpf/include/mpf_rtp_stat.h
deleted file mode 100644
index d312e75be5..0000000000
--- a/libs/unimrcp/libs/mpf/include/mpf_rtp_stat.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mpf_rtp_stat.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MPF_RTP_STAT_H
-#define MPF_RTP_STAT_H
-
-/**
- * @file mpf_rtp_stat.h
- * @brief RTP/RTCP Statistics
- */
-
-#include "mpf.h"
-
-APT_BEGIN_EXTERN_C
-
-/** RTP receiver statistics */
-typedef struct rtp_rx_stat_t rtp_rx_stat_t;
-
-/** RTCP statistics used in Sender Report (SR) */
-typedef struct rtcp_sr_stat_t rtcp_sr_stat_t;
-/** RTCP statistics used in Receiver Report (RR) */
-typedef struct rtcp_rr_stat_t rtcp_rr_stat_t;
-
-
-/** RTP receiver statistics */
-struct rtp_rx_stat_t {
- /** number of valid RTP packets received */
- apr_uint32_t received_packets;
- /** number of invalid RTP packets received */
- apr_uint32_t invalid_packets;
-
- /** number of discarded in jitter buffer packets */
- apr_uint32_t discarded_packets;
- /** number of ignored packets */
- apr_uint32_t ignored_packets;
-
- /** number of lost in network packets */
- apr_uint32_t lost_packets;
-
- /** number of restarts */
- apr_byte_t restarts;
-};
-
-/** RTCP statistics used in Sender Report (SR) */
-struct rtcp_sr_stat_t {
- /** sender source identifier */
- apr_uint32_t ssrc;
- /** NTP timestamp (seconds) */
- apr_uint32_t ntp_sec;
- /** NTP timestamp (fractions) */
- apr_uint32_t ntp_frac;
- /** RTP timestamp */
- apr_uint32_t rtp_ts;
- /** packets sent */
- apr_uint32_t sent_packets;
- /** octets (bytes) sent */
- apr_uint32_t sent_octets;
-};
-
-/** RTCP statistics used in Receiver Report (RR) */
-struct rtcp_rr_stat_t {
- /** source identifier of RTP stream being received */
- apr_uint32_t ssrc;
- /** fraction lost since last SR/RR */
- apr_uint32_t fraction:8;
- /** cumulative number of packets lost (signed!) */
- apr_int32_t lost:24;
- /** extended last sequence number received */
- apr_uint32_t last_seq;
- /** interarrival jitter (RFC3550) */
- apr_uint32_t jitter;
- /** last SR packet from this source */
- apr_uint32_t lsr;
- /** delay since last SR packet */
- apr_uint32_t dlsr;
-};
-
-
-
-/** Reset RTCP SR statistics */
-static APR_INLINE void mpf_rtcp_sr_stat_reset(rtcp_sr_stat_t *sr_stat)
-{
- memset(sr_stat,0,sizeof(rtcp_sr_stat_t));
-}
-
-/** Reset RTCP RR statistics */
-static APR_INLINE void mpf_rtcp_rr_stat_reset(rtcp_rr_stat_t *rr_stat)
-{
- memset(rr_stat,0,sizeof(rtcp_rr_stat_t));
-}
-
-/** Reset RTP receiver statistics */
-static APR_INLINE void mpf_rtp_rx_stat_reset(rtp_rx_stat_t *rx_stat)
-{
- memset(rx_stat,0,sizeof(rtp_rx_stat_t));
-}
-
-APT_END_EXTERN_C
-
-#endif /* MPF_RTP_STAT_H */
diff --git a/libs/unimrcp/libs/mpf/include/mpf_rtp_stream.h b/libs/unimrcp/libs/mpf/include/mpf_rtp_stream.h
deleted file mode 100644
index 00e6baf557..0000000000
--- a/libs/unimrcp/libs/mpf/include/mpf_rtp_stream.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mpf_rtp_stream.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MPF_RTP_STREAM_H
-#define MPF_RTP_STREAM_H
-
-/**
- * @file mpf_rtp_stream.h
- * @brief MPF RTP Stream
- */
-
-#include "mpf_stream.h"
-#include "mpf_rtp_descriptor.h"
-
-APT_BEGIN_EXTERN_C
-
-/**
- * Create RTP stream.
- * @param termination the back pointer to hold
- * @param config the configuration of RTP factory
- * @param settings the settings to use
- * @param pool the pool to allocate memory from
- */
-MPF_DECLARE(mpf_audio_stream_t*) mpf_rtp_stream_create(mpf_termination_t *termination, mpf_rtp_config_t *config, mpf_rtp_settings_t *settings, apr_pool_t *pool);
-
-/**
- * Add/enable RTP stream.
- * @param stream RTP stream to add
- */
-MPF_DECLARE(apt_bool_t) mpf_rtp_stream_add(mpf_audio_stream_t *stream);
-
-/**
- * Subtract/disable RTP stream.
- * @param stream RTP stream to subtract
- */
-MPF_DECLARE(apt_bool_t) mpf_rtp_stream_remove(mpf_audio_stream_t *stream);
-
-/**
- * Modify RTP stream.
- * @param stream RTP stream to modify
- * @param descriptor the descriptor to modify stream according
- */
-MPF_DECLARE(apt_bool_t) mpf_rtp_stream_modify(mpf_audio_stream_t *stream, mpf_rtp_stream_descriptor_t *descriptor);
-
-APT_END_EXTERN_C
-
-#endif /* MPF_RTP_STREAM_H */
diff --git a/libs/unimrcp/libs/mpf/include/mpf_rtp_termination_factory.h b/libs/unimrcp/libs/mpf/include/mpf_rtp_termination_factory.h
deleted file mode 100644
index f639f261b9..0000000000
--- a/libs/unimrcp/libs/mpf/include/mpf_rtp_termination_factory.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mpf_rtp_termination_factory.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MPF_RTP_TERMINATION_FACTORY_H
-#define MPF_RTP_TERMINATION_FACTORY_H
-
-/**
- * @file mpf_rtp_termination_factory.h
- * @brief MPF RTP Termination Factory
- */
-
-#include "mpf_termination_factory.h"
-#include "mpf_rtp_descriptor.h"
-
-APT_BEGIN_EXTERN_C
-
-/**
- * Create RTP termination factory.
- */
-MPF_DECLARE(mpf_termination_factory_t*) mpf_rtp_termination_factory_create(
- mpf_rtp_config_t *rtp_config,
- apr_pool_t *pool);
-
-
-APT_END_EXTERN_C
-
-#endif /* MPF_RTP_TERMINATION_FACTORY_H */
diff --git a/libs/unimrcp/libs/mpf/include/mpf_scheduler.h b/libs/unimrcp/libs/mpf/include/mpf_scheduler.h
deleted file mode 100644
index fe8e79af46..0000000000
--- a/libs/unimrcp/libs/mpf/include/mpf_scheduler.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mpf_scheduler.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MPF_SCHEDULER_H
-#define MPF_SCHEDULER_H
-
-/**
- * @file mpf_scheduler.h
- * @brief MPF Scheduler (High Resolution Clock for Media Processing and Timer)
- */
-
-#include "mpf_types.h"
-
-APT_BEGIN_EXTERN_C
-
-/** Prototype of scheduler callback */
-typedef void (*mpf_scheduler_proc_f)(mpf_scheduler_t *scheduler, void *obj);
-
-/** Create scheduler */
-MPF_DECLARE(mpf_scheduler_t*) mpf_scheduler_create(apr_pool_t *pool);
-
-/** Destroy scheduler */
-MPF_DECLARE(void) mpf_scheduler_destroy(mpf_scheduler_t *scheduler);
-
-/** Set media processing clock */
-MPF_DECLARE(apt_bool_t) mpf_scheduler_media_clock_set(
- mpf_scheduler_t *scheduler,
- unsigned long resolution,
- mpf_scheduler_proc_f proc,
- void *obj);
-
-/** Set timer clock */
-MPF_DECLARE(apt_bool_t) mpf_scheduler_timer_clock_set(
- mpf_scheduler_t *scheduler,
- unsigned long resolution,
- mpf_scheduler_proc_f proc,
- void *obj);
-
-/** Set scheduler rate (n times faster than real-time) */
-MPF_DECLARE(apt_bool_t) mpf_scheduler_rate_set(
- mpf_scheduler_t *scheduler,
- unsigned long rate);
-
-/** Start scheduler */
-MPF_DECLARE(apt_bool_t) mpf_scheduler_start(mpf_scheduler_t *scheduler);
-
-/** Stop scheduler */
-MPF_DECLARE(apt_bool_t) mpf_scheduler_stop(mpf_scheduler_t *scheduler);
-
-
-APT_END_EXTERN_C
-
-#endif /* MPF_SCHEDULER_H */
diff --git a/libs/unimrcp/libs/mpf/include/mpf_stream.h b/libs/unimrcp/libs/mpf/include/mpf_stream.h
deleted file mode 100644
index 33276aa7b7..0000000000
--- a/libs/unimrcp/libs/mpf/include/mpf_stream.h
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mpf_stream.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MPF_STREAM_H
-#define MPF_STREAM_H
-
-/**
- * @file mpf_stream.h
- * @brief MPF Bidirectional Stream
- */
-
-#include "mpf_types.h"
-#include "mpf_frame.h"
-#include "mpf_stream_descriptor.h"
-#include "mpf_codec.h"
-#include "apt_text_stream.h"
-
-APT_BEGIN_EXTERN_C
-
-/** Declaration of virtual table of audio stream */
-typedef struct mpf_audio_stream_vtable_t mpf_audio_stream_vtable_t;
-
-/** Audio stream */
-struct mpf_audio_stream_t {
- /** External object */
- void *obj;
- /** Table of virtual methods */
- const mpf_audio_stream_vtable_t *vtable;
- /** Back pointer */
- mpf_termination_t *termination;
-
- /** Stream capabilities */
- const mpf_stream_capabilities_t *capabilities;
-
- /** Stream direction send/receive (bitmask of mpf_stream_direction_e) */
- mpf_stream_direction_e direction;
- /** Rx codec descriptor */
- mpf_codec_descriptor_t *rx_descriptor;
- /** Rx event descriptor */
- mpf_codec_descriptor_t *rx_event_descriptor;
- /** Tx codec descriptor */
- mpf_codec_descriptor_t *tx_descriptor;
- /** Tx event descriptor */
- mpf_codec_descriptor_t *tx_event_descriptor;
-};
-
-/** Video stream */
-struct mpf_video_stream_t {
- /** Back pointer */
- mpf_termination_t *termination;
- /** Stream direction send/receive (bitmask of mpf_stream_direction_e) */
- mpf_stream_direction_e direction;
-};
-
-/** Table of audio stream virtual methods */
-struct mpf_audio_stream_vtable_t {
- /** Virtual destroy method */
- apt_bool_t (*destroy)(mpf_audio_stream_t *stream);
-
- /** Virtual open receiver method */
- apt_bool_t (*open_rx)(mpf_audio_stream_t *stream, mpf_codec_t *codec);
- /** Virtual close receiver method */
- apt_bool_t (*close_rx)(mpf_audio_stream_t *stream);
- /** Virtual read frame method */
- apt_bool_t (*read_frame)(mpf_audio_stream_t *stream, mpf_frame_t *frame);
-
- /** Virtual open transmitter method */
- apt_bool_t (*open_tx)(mpf_audio_stream_t *stream, mpf_codec_t *codec);
- /** Virtual close transmitter method */
- apt_bool_t (*close_tx)(mpf_audio_stream_t *stream);
- /** Virtual write frame method */
- apt_bool_t (*write_frame)(mpf_audio_stream_t *stream, const mpf_frame_t *frame);
-
- /** Virtual trace method */
- void (*trace)(mpf_audio_stream_t *stream, mpf_stream_direction_e direction, apt_text_stream_t *output);
-};
-
-/** Create audio stream */
-MPF_DECLARE(mpf_audio_stream_t*) mpf_audio_stream_create(void *obj, const mpf_audio_stream_vtable_t *vtable, const mpf_stream_capabilities_t *capabilities, apr_pool_t *pool);
-
-/** Validate audio stream receiver */
-MPF_DECLARE(apt_bool_t) mpf_audio_stream_rx_validate(
- mpf_audio_stream_t *stream,
- const mpf_codec_descriptor_t *descriptor,
- const mpf_codec_descriptor_t *event_descriptor,
- apr_pool_t *pool);
-
-/** Validate audio stream transmitter */
-MPF_DECLARE(apt_bool_t) mpf_audio_stream_tx_validate(
- mpf_audio_stream_t *stream,
- const mpf_codec_descriptor_t *descriptor,
- const mpf_codec_descriptor_t *event_descriptor,
- apr_pool_t *pool);
-
-/** Destroy audio stream */
-static APR_INLINE apt_bool_t mpf_audio_stream_destroy(mpf_audio_stream_t *stream)
-{
- if(stream->vtable->destroy)
- return stream->vtable->destroy(stream);
- return TRUE;
-}
-
-/** Open audio stream receiver */
-static APR_INLINE apt_bool_t mpf_audio_stream_rx_open(mpf_audio_stream_t *stream, mpf_codec_t *codec)
-{
- if(stream->vtable->open_rx)
- return stream->vtable->open_rx(stream,codec);
- return TRUE;
-}
-
-/** Close audio stream receiver */
-static APR_INLINE apt_bool_t mpf_audio_stream_rx_close(mpf_audio_stream_t *stream)
-{
- if(stream->vtable->close_rx)
- return stream->vtable->close_rx(stream);
- return TRUE;
-}
-
-/** Read frame */
-static APR_INLINE apt_bool_t mpf_audio_stream_frame_read(mpf_audio_stream_t *stream, mpf_frame_t *frame)
-{
- if(stream->vtable->read_frame)
- return stream->vtable->read_frame(stream,frame);
- return TRUE;
-}
-
-/** Open audio stream transmitter */
-static APR_INLINE apt_bool_t mpf_audio_stream_tx_open(mpf_audio_stream_t *stream, mpf_codec_t *codec)
-{
- if(stream->vtable->open_tx)
- return stream->vtable->open_tx(stream,codec);
- return TRUE;
-}
-
-/** Close audio stream transmitter */
-static APR_INLINE apt_bool_t mpf_audio_stream_tx_close(mpf_audio_stream_t *stream)
-{
- if(stream->vtable->close_tx)
- return stream->vtable->close_tx(stream);
- return TRUE;
-}
-
-/** Write frame */
-static APR_INLINE apt_bool_t mpf_audio_stream_frame_write(mpf_audio_stream_t *stream, const mpf_frame_t *frame)
-{
- if(stream->vtable->write_frame)
- return stream->vtable->write_frame(stream,frame);
- return TRUE;
-}
-
-/** Trace media path */
-MPF_DECLARE(void) mpf_audio_stream_trace(mpf_audio_stream_t *stream, mpf_stream_direction_e direction, apt_text_stream_t *output);
-
-APT_END_EXTERN_C
-
-#endif /* MPF_STREAM_H */
diff --git a/libs/unimrcp/libs/mpf/include/mpf_stream_descriptor.h b/libs/unimrcp/libs/mpf/include/mpf_stream_descriptor.h
deleted file mode 100644
index d91f5166eb..0000000000
--- a/libs/unimrcp/libs/mpf/include/mpf_stream_descriptor.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mpf_stream_descriptor.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MPF_STREAM_DESCRIPTOR_H
-#define MPF_STREAM_DESCRIPTOR_H
-
-/**
- * @file mpf_stream_descriptor.h
- * @brief MPF Stream Descriptor
- */
-
-#include "mpf_codec_descriptor.h"
-
-APT_BEGIN_EXTERN_C
-
-/** Stream capabilities declaration */
-typedef struct mpf_stream_capabilities_t mpf_stream_capabilities_t;
-
-/** Stream directions (none, send, receive, duplex) */
-typedef enum {
- STREAM_DIRECTION_NONE = 0x0, /**< none */
- STREAM_DIRECTION_SEND = 0x1, /**< send (sink) */
- STREAM_DIRECTION_RECEIVE = 0x2, /**< receive (source) */
-
- STREAM_DIRECTION_DUPLEX = STREAM_DIRECTION_SEND | STREAM_DIRECTION_RECEIVE /**< duplex */
-} mpf_stream_direction_e;
-
-
-/** Stream capabilities */
-struct mpf_stream_capabilities_t {
- /** Supported directions either send, receive or bidirectional stream (bitmask of mpf_stream_direction_e) */
- mpf_stream_direction_e direction;
- /** Codec capabilities (supported codecs and named events) */
- mpf_codec_capabilities_t codecs;
-};
-
-/** Create stream capabilities */
-MPF_DECLARE(mpf_stream_capabilities_t*) mpf_stream_capabilities_create(mpf_stream_direction_e directions, apr_pool_t *pool);
-
-/** Create source stream capabilities */
-static APR_INLINE mpf_stream_capabilities_t* mpf_source_stream_capabilities_create(apr_pool_t *pool)
-{
- return mpf_stream_capabilities_create(STREAM_DIRECTION_RECEIVE,pool);
-}
-
-/** Create sink stream capabilities */
-static APR_INLINE mpf_stream_capabilities_t* mpf_sink_stream_capabilities_create(apr_pool_t *pool)
-{
- return mpf_stream_capabilities_create(STREAM_DIRECTION_SEND,pool);
-}
-
-/** Clone stream capabilities */
-MPF_DECLARE(mpf_stream_capabilities_t*) mpf_stream_capabilities_clone(const mpf_stream_capabilities_t *src_capabilities, apr_pool_t *pool);
-
-/** Merge stream capabilities */
-MPF_DECLARE(apt_bool_t) mpf_stream_capabilities_merge(mpf_stream_capabilities_t *capabilities, const mpf_stream_capabilities_t *src_capabilities, apr_pool_t *pool);
-
-
-/** Get reverse direction */
-static APR_INLINE mpf_stream_direction_e mpf_stream_reverse_direction_get(mpf_stream_direction_e direction)
-{
- mpf_stream_direction_e rev_direction = direction;
- if(rev_direction == STREAM_DIRECTION_SEND) {
- rev_direction = STREAM_DIRECTION_RECEIVE;
- }
- else if(rev_direction == STREAM_DIRECTION_RECEIVE) {
- rev_direction = STREAM_DIRECTION_SEND;
- }
- return rev_direction;
-}
-
-
-APT_END_EXTERN_C
-
-#endif /* MPF_STREAM_DESCRIPTOR_H */
diff --git a/libs/unimrcp/libs/mpf/include/mpf_termination.h b/libs/unimrcp/libs/mpf/include/mpf_termination.h
deleted file mode 100644
index 6d45aeeddb..0000000000
--- a/libs/unimrcp/libs/mpf/include/mpf_termination.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mpf_termination.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MPF_TERMINATION_H
-#define MPF_TERMINATION_H
-
-/**
- * @file mpf_termination.h
- * @brief MPF Termination
- */
-
-#include "mpf_types.h"
-#include "apt_timer_queue.h"
-
-APT_BEGIN_EXTERN_C
-
-/** Prototype of termination event handler */
-typedef apt_bool_t (*mpf_termination_event_handler_f)(mpf_termination_t *termination, int event_id, void *descriptor);
-
-/** Termination vtable declaration */
-typedef struct mpf_termination_vtable_t mpf_termination_vtable_t;
-
-/** Table of termination virtual methods */
-struct mpf_termination_vtable_t {
- /** Virtual termination destroy method */
- apt_bool_t (*destroy)(mpf_termination_t *termination);
-
- /** Virtual termination add method */
- apt_bool_t (*add)(mpf_termination_t *termination, void *descriptor);
- /** Virtual termination modify method */
- apt_bool_t (*modify)(mpf_termination_t *termination, void *descriptor);
- /** Virtual termination subtract method */
- apt_bool_t (*subtract)(mpf_termination_t *termination);
-};
-
-
-/** MPF Termination */
-struct mpf_termination_t {
- /** Pool to allocate memory from */
- apr_pool_t *pool;
- /** Informative name used for debugging */
- const char *name;
- /** External object */
- void *obj;
- /** Media engine to send events to */
- void *media_engine;
- /** Event handler */
- mpf_termination_event_handler_f event_handler;
- /** Codec manager */
- const mpf_codec_manager_t *codec_manager;
- /** Timer queue */
- apt_timer_queue_t *timer_queue;
- /** Termination factory entire termination created by */
- mpf_termination_factory_t *termination_factory;
- /** Table of virtual methods */
- const mpf_termination_vtable_t *vtable;
- /** Slot in context */
- apr_size_t slot;
-
- /** Audio stream */
- mpf_audio_stream_t *audio_stream;
- /** Video stream */
- mpf_video_stream_t *video_stream;
-};
-
-/**
- * Create MPF termination base.
- * @param termination_factory the termination factory
- * @param obj the external object associated with termination
- * @param vtable the table of virtual functions of termination
- * @param audio_stream the audio stream
- * @param video_stream the video stream
- * @param pool the pool to allocate memory from
- */
-MPF_DECLARE(mpf_termination_t*) mpf_termination_base_create(
- mpf_termination_factory_t *termination_factory,
- void *obj,
- const mpf_termination_vtable_t *vtable,
- mpf_audio_stream_t *audio_stream,
- mpf_video_stream_t *video_stream,
- apr_pool_t *pool);
-
-/**
- * Add MPF termination.
- * @param termination the termination to add
- * @param descriptor the termination specific descriptor
- */
-MPF_DECLARE(apt_bool_t) mpf_termination_add(mpf_termination_t *termination, void *descriptor);
-
-/**
- * Modify MPF termination.
- * @param termination the termination to modify
- * @param descriptor the termination specific descriptor
- */
-MPF_DECLARE(apt_bool_t) mpf_termination_modify(mpf_termination_t *termination, void *descriptor);
-
-/**
- * Subtract MPF termination.
- * @param termination the termination to subtract
- */
-MPF_DECLARE(apt_bool_t) mpf_termination_subtract(mpf_termination_t *termination);
-
-
-APT_END_EXTERN_C
-
-#endif /* MPF_TERMINATION_H */
diff --git a/libs/unimrcp/libs/mpf/include/mpf_termination_factory.h b/libs/unimrcp/libs/mpf/include/mpf_termination_factory.h
deleted file mode 100644
index 08d46fc64f..0000000000
--- a/libs/unimrcp/libs/mpf/include/mpf_termination_factory.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mpf_termination_factory.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MPF_TERMINATION_FACTORY_H
-#define MPF_TERMINATION_FACTORY_H
-
-/**
- * @file mpf_termination_factory.h
- * @brief MPF Termination Factory
- */
-
-#include "mpf_types.h"
-
-APT_BEGIN_EXTERN_C
-
-/** MPF termination factory */
-struct mpf_termination_factory_t {
- /** Virtual create */
- mpf_termination_t* (*create_termination)(mpf_termination_factory_t *factory, void *obj, apr_pool_t *pool);
- /** Virtual assign engine */
- apt_bool_t (*assign_engine)(mpf_termination_factory_t *factory, mpf_engine_t *media_engine);
-};
-
-/**
- * Assign media engine to termination factory.
- * @param termination_factory the termination factory to assign media engine to
- * @param media_engine the media engine to assign
- */
-MPF_DECLARE(apt_bool_t) mpf_termination_factory_engine_assign(
- mpf_termination_factory_t *termination_factory,
- mpf_engine_t *media_engine);
-
-/**
- * Create MPF termination from termination factory.
- * @param termination_factory the termination factory to create termination from
- * @param obj the external object associated with termination
- * @param pool the pool to allocate memory from
- */
-MPF_DECLARE(mpf_termination_t*) mpf_termination_create(
- mpf_termination_factory_t *termination_factory,
- void *obj,
- apr_pool_t *pool);
-
-/**
- * Create raw MPF termination.
- * @param obj the external object associated with termination
- * @param audio_stream the audio stream of the termination
- * @param video_stream the video stream of the termination
- * @param pool the pool to allocate memory from
- */
-MPF_DECLARE(mpf_termination_t*) mpf_raw_termination_create(
- void *obj,
- mpf_audio_stream_t *audio_stream,
- mpf_video_stream_t *video_stream,
- apr_pool_t *pool);
-
-/**
- * Destroy MPF termination.
- * @param termination the termination to destroy
- */
-MPF_DECLARE(apt_bool_t) mpf_termination_destroy(mpf_termination_t *termination);
-
-/**
- * Get termination name.
- * @param termination the termination to get name of
- */
-MPF_DECLARE(const char*) mpf_termination_name_get(const mpf_termination_t *termination);
-
-/**
- * Get associated object.
- * @param termination the termination to get object from
- */
-MPF_DECLARE(void*) mpf_termination_object_get(const mpf_termination_t *termination);
-
-/**
- * Get audio stream.
- * @param termination the termination to get audio stream from
- */
-MPF_DECLARE(mpf_audio_stream_t*) mpf_termination_audio_stream_get(const mpf_termination_t *termination);
-
-/**
- * Get video stream.
- * @param termination the termination to get video stream from
- */
-MPF_DECLARE(mpf_video_stream_t*) mpf_termination_video_stream_get(const mpf_termination_t *termination);
-
-
-APT_END_EXTERN_C
-
-#endif /* MPF_TERMINATION_FACTORY_H */
diff --git a/libs/unimrcp/libs/mpf/include/mpf_trace.h b/libs/unimrcp/libs/mpf/include/mpf_trace.h
deleted file mode 100644
index 323cc034ba..0000000000
--- a/libs/unimrcp/libs/mpf/include/mpf_trace.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: apt_log.h 1792 2011-01-10 21:08:52Z achaloyan $
- */
-
-#ifndef MPF_TRACE_H
-#define MPF_TRACE_H
-
-/**
- * @file mpf_trace.h
- * @brief MPF Tracer
- */
-
-#include
-#include "mpf.h"
-
-APT_BEGIN_EXTERN_C
-
-#ifdef WIN32
-static void mpf_debug_output_trace(const char* format, ...)
-{
- char buf[1024];
- va_list arg;
- va_start(arg, format);
- apr_vsnprintf(buf, sizeof(buf), format, arg);
- va_end(arg);
-
- OutputDebugStringA(buf);
-}
-#else
-static APR_INLINE void mpf_debug_output_trace() {}
-#endif
-
-static APR_INLINE void mpf_null_trace() {}
-
-APT_END_EXTERN_C
-
-#endif /* MPF_TRACE_H */
diff --git a/libs/unimrcp/libs/mpf/include/mpf_types.h b/libs/unimrcp/libs/mpf/include/mpf_types.h
deleted file mode 100644
index 3b8637eaba..0000000000
--- a/libs/unimrcp/libs/mpf/include/mpf_types.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mpf_types.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MPF_TYPES_H
-#define MPF_TYPES_H
-
-/**
- * @file mpf_types.h
- * @brief MPF Types Declarations
- */
-
-#include "mpf.h"
-
-APT_BEGIN_EXTERN_C
-
-/** Opaque MPF engine declaration */
-typedef struct mpf_engine_t mpf_engine_t;
-
-/** Opaque MPF engine factory declaration */
-typedef struct mpf_engine_factory_t mpf_engine_factory_t;
-
-/** Opaque MPF scheduler declaration */
-typedef struct mpf_scheduler_t mpf_scheduler_t;
-
-/** Opaque codec manager declaration */
-typedef struct mpf_codec_manager_t mpf_codec_manager_t;
-
-/** Opaque MPF context declaration */
-typedef struct mpf_context_t mpf_context_t;
-
-/** Opaque MPF termination declaration */
-typedef struct mpf_termination_t mpf_termination_t;
-
-/** Opaque MPF termination factory declaration */
-typedef struct mpf_termination_factory_t mpf_termination_factory_t;
-
-/** Opaque MPF audio stream declaration */
-typedef struct mpf_audio_stream_t mpf_audio_stream_t;
-
-/** Opaque MPF video stream declaration */
-typedef struct mpf_video_stream_t mpf_video_stream_t;
-
-
-APT_END_EXTERN_C
-
-#endif /* MPF_TYPES_H */
diff --git a/libs/unimrcp/libs/mpf/mpf.2010.vcxproj.filters b/libs/unimrcp/libs/mpf/mpf.2010.vcxproj.filters
deleted file mode 100644
index d79e3f31a4..0000000000
--- a/libs/unimrcp/libs/mpf/mpf.2010.vcxproj.filters
+++ /dev/null
@@ -1,236 +0,0 @@
-
-
-
-
- {3d69fc35-a195-4376-9508-ef77d7b27e71}
-
-
- {81e2eace-c57a-4135-92cd-cc3575dfb088}
-
-
- {93995380-89BD-4b04-88EB-625FBE52EBFB}
- h;hpp;hxx;hm;inl;inc;xsd
-
-
- {6fc3533a-b688-477d-914d-e0ffb15aa9a9}
- cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
-
-
-
-
- codecs\g711
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
-
-
- codecs\g711
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
-
\ No newline at end of file
diff --git a/libs/unimrcp/libs/mpf/mpf.2017.vcxproj b/libs/unimrcp/libs/mpf/mpf.2017.vcxproj
deleted file mode 100644
index 4cd900b2df..0000000000
--- a/libs/unimrcp/libs/mpf/mpf.2017.vcxproj
+++ /dev/null
@@ -1,201 +0,0 @@
-
-
-
-
- Debug
- Win32
-
-
- Debug
- x64
-
-
- Release
- Win32
-
-
- Release
- x64
-
-
-
- mpf
- {B5A00BFA-6083-4FAE-A097-71642D6473B5}
- mpf
- Win32Proj
-
-
-
- StaticLibrary
- Unicode
- true
- $(DefaultPlatformToolset)
-
-
- StaticLibrary
- Unicode
- $(DefaultPlatformToolset)
-
-
- StaticLibrary
- Unicode
- true
- $(DefaultPlatformToolset)
-
-
- StaticLibrary
- Unicode
- $(DefaultPlatformToolset)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <_ProjectFileVersion>10.0.30319.1
- $(PlatformName)\$(Configuration)\
- $(PlatformName)\$(Configuration)\
- $(PlatformName)\$(Configuration)\
- $(PlatformName)\$(Configuration)\
- $(PlatformName)\$(Configuration)\
- $(PlatformName)\$(Configuration)\
- $(SolutionDir)$(PlatformName)\$(Configuration)\
- $(PlatformName)\$(Configuration)\
-
-
-
- codecs;%(AdditionalIncludeDirectories)
- APT_STATIC_LIB;MPF_STATIC_LIB;%(PreprocessorDefinitions)
-
-
-
-
- X64
-
-
- codecs;%(AdditionalIncludeDirectories)
- APT_STATIC_LIB;MPF_STATIC_LIB;%(PreprocessorDefinitions)
- false
- ProgramDatabase
-
-
-
-
- codecs;%(AdditionalIncludeDirectories)
- APT_STATIC_LIB;MPF_STATIC_LIB;%(PreprocessorDefinitions)
-
-
-
-
- X64
-
-
- codecs;%(AdditionalIncludeDirectories)
- APT_STATIC_LIB;MPF_STATIC_LIB;%(PreprocessorDefinitions)
- false
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {f6c55d93-b927-4483-bb69-15aef3dd2dff}
-
-
-
-
-
-
\ No newline at end of file
diff --git a/libs/unimrcp/libs/mpf/mpf.vcproj b/libs/unimrcp/libs/mpf/mpf.vcproj
deleted file mode 100644
index 043486d580..0000000000
--- a/libs/unimrcp/libs/mpf/mpf.vcproj
+++ /dev/null
@@ -1,552 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/libs/unimrcp/libs/mpf/mpf.vcxproj b/libs/unimrcp/libs/mpf/mpf.vcxproj
deleted file mode 100644
index 6bbb3f5371..0000000000
--- a/libs/unimrcp/libs/mpf/mpf.vcxproj
+++ /dev/null
@@ -1,200 +0,0 @@
-
-
-
-
- Debug
- Win32
-
-
- Debug
- x64
-
-
- Release
- Win32
-
-
- Release
- x64
-
-
-
- {B5A00BFA-6083-4FAE-A097-71642D6473B5}
- mpf
- Win32Proj
-
-
-
- StaticLibrary
- Unicode
- true
-
-
- StaticLibrary
- Unicode
-
-
- StaticLibrary
- Unicode
- true
-
-
- StaticLibrary
- Unicode
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <_ProjectFileVersion>10.0.30319.1
- AllRules.ruleset
-
-
- AllRules.ruleset
-
-
- AllRules.ruleset
-
-
- AllRules.ruleset
-
-
-
-
-
- codecs;%(AdditionalIncludeDirectories)
-
-
-
-
- codecs;%(AdditionalIncludeDirectories)
-
-
-
-
- X64
-
-
- codecs;%(AdditionalIncludeDirectories)
- ProgramDatabase
-
-
-
-
- X64
-
-
- codecs;%(AdditionalIncludeDirectories)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {13deeca0-bdd4-4744-a1a2-8eb0a44df3d2}
- false
-
-
-
-
-
-
\ No newline at end of file
diff --git a/libs/unimrcp/libs/mpf/mpf.vcxproj.filters b/libs/unimrcp/libs/mpf/mpf.vcxproj.filters
deleted file mode 100644
index 16ecf0e62f..0000000000
--- a/libs/unimrcp/libs/mpf/mpf.vcxproj.filters
+++ /dev/null
@@ -1,239 +0,0 @@
-
-
-
-
- {33a3a10a-4697-4720-8c24-20340757326e}
-
-
- {148f1b8f-859b-4dd9-96b0-0474d7bb875b}
-
-
- {93995380-89BD-4b04-88EB-625FBE52EBFB}
- h;hpp;hxx;hm;inl;inc;xsd
-
-
- {35011b8a-6a42-4e9f-b55b-a84db1d929a8}
- cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
-
-
-
-
- codecs\g711
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
-
-
- codecs\g711
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
-
\ No newline at end of file
diff --git a/libs/unimrcp/libs/mpf/src/mpf_activity_detector.c b/libs/unimrcp/libs/mpf/src/mpf_activity_detector.c
deleted file mode 100644
index 09b1a813a3..0000000000
--- a/libs/unimrcp/libs/mpf/src/mpf_activity_detector.c
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mpf_activity_detector.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include "mpf_activity_detector.h"
-#include "apt_log.h"
-
-/** Detector states */
-typedef enum {
- DETECTOR_STATE_INACTIVITY, /**< inactivity detected */
- DETECTOR_STATE_ACTIVITY_TRANSITION, /**< activity detection is in-progress */
- DETECTOR_STATE_ACTIVITY, /**< activity detected */
- DETECTOR_STATE_INACTIVITY_TRANSITION /**< inactivity detection is in-progress */
-} mpf_detector_state_e;
-
-/** Activity detector */
-struct mpf_activity_detector_t {
- /* voice activity (silence) level threshold */
- apr_size_t level_threshold;
-
- /* period of activity required to complete transition to active state */
- apr_size_t speech_timeout;
- /* period of inactivity required to complete transition to inactive state */
- apr_size_t silence_timeout;
- /* noinput timeout */
- apr_size_t noinput_timeout;
-
- /* current state */
- mpf_detector_state_e state;
- /* duration spent in current state */
- apr_size_t duration;
-};
-
-/** Create activity detector */
-MPF_DECLARE(mpf_activity_detector_t*) mpf_activity_detector_create(apr_pool_t *pool)
-{
- mpf_activity_detector_t *detector = apr_palloc(pool,sizeof(mpf_activity_detector_t));
- detector->level_threshold = 2; /* 0 .. 255 */
- detector->speech_timeout = 300; /* 0.3 s */
- detector->silence_timeout = 300; /* 0.3 s */
- detector->noinput_timeout = 5000; /* 5 s */
- detector->duration = 0;
- detector->state = DETECTOR_STATE_INACTIVITY;
- return detector;
-}
-
-/** Reset activity detector */
-MPF_DECLARE(void) mpf_activity_detector_reset(mpf_activity_detector_t *detector)
-{
- detector->duration = 0;
- detector->state = DETECTOR_STATE_INACTIVITY;
-}
-
-/** Set threshold of voice activity (silence) level */
-MPF_DECLARE(void) mpf_activity_detector_level_set(mpf_activity_detector_t *detector, apr_size_t level_threshold)
-{
- detector->level_threshold = level_threshold;
-}
-
-/** Set noinput timeout */
-MPF_DECLARE(void) mpf_activity_detector_noinput_timeout_set(mpf_activity_detector_t *detector, apr_size_t noinput_timeout)
-{
- detector->noinput_timeout = noinput_timeout;
-}
-
-/** Set timeout required to trigger speech (transition from inactive to active state) */
-MPF_DECLARE(void) mpf_activity_detector_speech_timeout_set(mpf_activity_detector_t *detector, apr_size_t speech_timeout)
-{
- detector->speech_timeout = speech_timeout;
-}
-
-/** Set timeout required to trigger silence (transition from active to inactive state) */
-MPF_DECLARE(void) mpf_activity_detector_silence_timeout_set(mpf_activity_detector_t *detector, apr_size_t silence_timeout)
-{
- detector->silence_timeout = silence_timeout;
-}
-
-
-static APR_INLINE void mpf_activity_detector_state_change(mpf_activity_detector_t *detector, mpf_detector_state_e state)
-{
- detector->duration = 0;
- detector->state = state;
-}
-
-static apr_size_t mpf_activity_detector_level_calculate(const mpf_frame_t *frame)
-{
- apr_size_t sum = 0;
- apr_size_t count = frame->codec_frame.size/2;
- const apr_int16_t *cur = frame->codec_frame.buffer;
- const apr_int16_t *end = cur + count;
-
- for(; cur < end; cur++) {
- if(*cur < 0) {
- sum -= *cur;
- }
- else {
- sum += *cur;
- }
- }
-
- return sum / count;
-}
-
-/** Process current frame */
-MPF_DECLARE(mpf_detector_event_e) mpf_activity_detector_process(mpf_activity_detector_t *detector, const mpf_frame_t *frame)
-{
- mpf_detector_event_e det_event = MPF_DETECTOR_EVENT_NONE;
- apr_size_t level = 0;
- if((frame->type & MEDIA_FRAME_TYPE_AUDIO) == MEDIA_FRAME_TYPE_AUDIO) {
- /* first, calculate current activity level of processed frame */
- level = mpf_activity_detector_level_calculate(frame);
-#if 0
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Activity Detector [%"APR_SIZE_T_FMT"]",level);
-#endif
- }
-
- if(detector->state == DETECTOR_STATE_INACTIVITY) {
- if(level >= detector->level_threshold) {
- /* start to detect activity */
- mpf_activity_detector_state_change(detector,DETECTOR_STATE_ACTIVITY_TRANSITION);
- }
- else {
- detector->duration += CODEC_FRAME_TIME_BASE;
- if(detector->duration >= detector->noinput_timeout) {
- /* detected noinput */
- det_event = MPF_DETECTOR_EVENT_NOINPUT;
- }
- }
- }
- else if(detector->state == DETECTOR_STATE_ACTIVITY_TRANSITION) {
- if(level >= detector->level_threshold) {
- detector->duration += CODEC_FRAME_TIME_BASE;
- if(detector->duration >= detector->speech_timeout) {
- /* finally detected activity */
- det_event = MPF_DETECTOR_EVENT_ACTIVITY;
- mpf_activity_detector_state_change(detector,DETECTOR_STATE_ACTIVITY);
- }
- }
- else {
- /* fallback to inactivity */
- mpf_activity_detector_state_change(detector,DETECTOR_STATE_INACTIVITY);
- }
- }
- else if(detector->state == DETECTOR_STATE_ACTIVITY) {
- if(level >= detector->level_threshold) {
- detector->duration += CODEC_FRAME_TIME_BASE;
- }
- else {
- /* start to detect inactivity */
- mpf_activity_detector_state_change(detector,DETECTOR_STATE_INACTIVITY_TRANSITION);
- }
- }
- else if(detector->state == DETECTOR_STATE_INACTIVITY_TRANSITION) {
- if(level >= detector->level_threshold) {
- /* fallback to activity */
- mpf_activity_detector_state_change(detector,DETECTOR_STATE_ACTIVITY);
- }
- else {
- detector->duration += CODEC_FRAME_TIME_BASE;
- if(detector->duration >= detector->silence_timeout) {
- /* detected inactivity */
- det_event = MPF_DETECTOR_EVENT_INACTIVITY;
- mpf_activity_detector_state_change(detector,DETECTOR_STATE_INACTIVITY);
- }
- }
- }
-
- return det_event;
-}
diff --git a/libs/unimrcp/libs/mpf/src/mpf_audio_file_stream.c b/libs/unimrcp/libs/mpf/src/mpf_audio_file_stream.c
deleted file mode 100644
index 5c168ebf00..0000000000
--- a/libs/unimrcp/libs/mpf/src/mpf_audio_file_stream.c
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mpf_audio_file_stream.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include "mpf_audio_file_stream.h"
-#include "mpf_termination.h"
-#include "mpf_frame.h"
-#include "mpf_codec_manager.h"
-#include "apt_log.h"
-
-/** Audio file stream */
-typedef struct mpf_audio_file_stream_t mpf_audio_file_stream_t;
-struct mpf_audio_file_stream_t {
- mpf_audio_stream_t *audio_stream;
-
- FILE *read_handle;
- FILE *write_handle;
-
- apt_bool_t eof;
- apr_size_t max_write_size;
- apr_size_t cur_write_size;
-};
-
-static APR_INLINE void mpf_audio_file_event_raise(mpf_audio_stream_t *stream, int event_id, void *descriptor);
-
-
-static apt_bool_t mpf_audio_file_destroy(mpf_audio_stream_t *stream)
-{
- mpf_audio_file_stream_t *file_stream = stream->obj;
- if(file_stream->read_handle) {
- fclose(file_stream->read_handle);
- file_stream->read_handle = NULL;
- }
- if(file_stream->write_handle) {
- fclose(file_stream->write_handle);
- file_stream->write_handle = NULL;
- }
- return TRUE;
-}
-
-static apt_bool_t mpf_audio_file_reader_open(mpf_audio_stream_t *stream, mpf_codec_t *codec)
-{
- return TRUE;
-}
-
-static apt_bool_t mpf_audio_file_reader_close(mpf_audio_stream_t *stream)
-{
- return TRUE;
-}
-
-static apt_bool_t mpf_audio_file_frame_read(mpf_audio_stream_t *stream, mpf_frame_t *frame)
-{
- mpf_audio_file_stream_t *file_stream = stream->obj;
- if(file_stream->read_handle && file_stream->eof == FALSE) {
- if(fread(frame->codec_frame.buffer,1,frame->codec_frame.size,file_stream->read_handle) == frame->codec_frame.size) {
- frame->type = MEDIA_FRAME_TYPE_AUDIO;
- }
- else {
- file_stream->eof = TRUE;
- mpf_audio_file_event_raise(stream,0,NULL);
- }
- }
- return TRUE;
-}
-
-
-static apt_bool_t mpf_audio_file_writer_open(mpf_audio_stream_t *stream, mpf_codec_t *codec)
-{
- return TRUE;
-}
-
-static apt_bool_t mpf_audio_file_writer_close(mpf_audio_stream_t *stream)
-{
- return TRUE;
-}
-
-static apt_bool_t mpf_audio_file_frame_write(mpf_audio_stream_t *stream, const mpf_frame_t *frame)
-{
- mpf_audio_file_stream_t *file_stream = stream->obj;
- if(file_stream->write_handle &&
- (!file_stream->max_write_size || file_stream->cur_write_size < file_stream->max_write_size)) {
- file_stream->cur_write_size += fwrite(
- frame->codec_frame.buffer,
- 1,
- frame->codec_frame.size,
- file_stream->write_handle);
- if(file_stream->cur_write_size >= file_stream->max_write_size) {
- mpf_audio_file_event_raise(stream,0,NULL);
- }
- }
- return TRUE;
-}
-
-static const mpf_audio_stream_vtable_t vtable = {
- mpf_audio_file_destroy,
- mpf_audio_file_reader_open,
- mpf_audio_file_reader_close,
- mpf_audio_file_frame_read,
- mpf_audio_file_writer_open,
- mpf_audio_file_writer_close,
- mpf_audio_file_frame_write,
- NULL /* mpf_audio_file_trace */
-};
-
-MPF_DECLARE(mpf_audio_stream_t*) mpf_file_stream_create(mpf_termination_t *termination, apr_pool_t *pool)
-{
- mpf_audio_file_stream_t *file_stream = apr_palloc(pool,sizeof(mpf_audio_file_stream_t));
- mpf_stream_capabilities_t *capabilities = mpf_stream_capabilities_create(STREAM_DIRECTION_DUPLEX,pool);
- mpf_audio_stream_t *audio_stream = mpf_audio_stream_create(file_stream,&vtable,capabilities,pool);
- if(!audio_stream) {
- return NULL;
- }
- audio_stream->termination = termination;
-
- file_stream->audio_stream = audio_stream;
- file_stream->write_handle = NULL;
- file_stream->read_handle = NULL;
- file_stream->eof = FALSE;
- file_stream->max_write_size = 0;
- file_stream->cur_write_size = 0;
-
- return audio_stream;
-}
-
-MPF_DECLARE(apt_bool_t) mpf_file_stream_modify(mpf_audio_stream_t *stream, mpf_audio_file_descriptor_t *descriptor)
-{
- mpf_audio_file_stream_t *file_stream = stream->obj;
- if(descriptor->mask & FILE_READER) {
- if(file_stream->read_handle) {
- fclose(file_stream->read_handle);
- }
- file_stream->read_handle = descriptor->read_handle;
- file_stream->eof = FALSE;
- stream->direction |= FILE_READER;
-
- stream->rx_descriptor = descriptor->codec_descriptor;
- }
- if(descriptor->mask & FILE_WRITER) {
- if(file_stream->write_handle) {
- fclose(file_stream->write_handle);
- }
- file_stream->write_handle = descriptor->write_handle;
- file_stream->max_write_size = descriptor->max_write_size;
- file_stream->cur_write_size = 0;
- stream->direction |= FILE_WRITER;
-
- stream->tx_descriptor = descriptor->codec_descriptor;
- }
- return TRUE;
-}
-
-static APR_INLINE void mpf_audio_file_event_raise(mpf_audio_stream_t *stream, int event_id, void *descriptor)
-{
- if(stream->termination->event_handler) {
- stream->termination->event_handler(stream->termination,event_id,descriptor);
- }
-}
diff --git a/libs/unimrcp/libs/mpf/src/mpf_bridge.c b/libs/unimrcp/libs/mpf/src/mpf_bridge.c
deleted file mode 100644
index 0daf11caee..0000000000
--- a/libs/unimrcp/libs/mpf/src/mpf_bridge.c
+++ /dev/null
@@ -1,230 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mpf_bridge.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include "mpf_bridge.h"
-#include "mpf_encoder.h"
-#include "mpf_decoder.h"
-#include "mpf_resampler.h"
-#include "mpf_codec_manager.h"
-#include "apt_log.h"
-
-typedef struct mpf_bridge_t mpf_bridge_t;
-
-/** MPF bridge derived from MPF object */
-struct mpf_bridge_t {
- /** MPF bridge base */
- mpf_object_t base;
- /** Audio stream source */
- mpf_audio_stream_t *source;
- /** Audio stream sink */
- mpf_audio_stream_t *sink;
- /** Codec used in case of null bridge */
- mpf_codec_t *codec;
- /** Media frame used to read data from source and write it to sink */
- mpf_frame_t frame;
-};
-
-static apt_bool_t mpf_bridge_process(mpf_object_t *object)
-{
- mpf_bridge_t *bridge = (mpf_bridge_t*) object;
- bridge->frame.type = MEDIA_FRAME_TYPE_NONE;
- bridge->frame.marker = MPF_MARKER_NONE;
- bridge->source->vtable->read_frame(bridge->source,&bridge->frame);
-
- if((bridge->frame.type & MEDIA_FRAME_TYPE_AUDIO) == 0) {
- memset( bridge->frame.codec_frame.buffer,
- 0,
- bridge->frame.codec_frame.size);
- }
-
- bridge->sink->vtable->write_frame(bridge->sink,&bridge->frame);
- return TRUE;
-}
-
-static apt_bool_t mpf_null_bridge_process(mpf_object_t *object)
-{
- mpf_bridge_t *bridge = (mpf_bridge_t*) object;
- bridge->frame.type = MEDIA_FRAME_TYPE_NONE;
- bridge->frame.marker = MPF_MARKER_NONE;
- bridge->source->vtable->read_frame(bridge->source,&bridge->frame);
-
- if((bridge->frame.type & MEDIA_FRAME_TYPE_AUDIO) == 0) {
- /* generate silence frame */
- mpf_codec_initialize(bridge->codec,&bridge->frame.codec_frame);
- }
-
- bridge->sink->vtable->write_frame(bridge->sink,&bridge->frame);
- return TRUE;
-}
-
-static void mpf_bridge_trace(mpf_object_t *object)
-{
- mpf_bridge_t *bridge = (mpf_bridge_t*) object;
- char buf[1024];
- apr_size_t offset;
-
- apt_text_stream_t output;
- apt_text_stream_init(&output,buf,sizeof(buf)-1);
-
- mpf_audio_stream_trace(bridge->source,STREAM_DIRECTION_RECEIVE,&output);
-
- offset = output.pos - output.text.buf;
- output.pos += apr_snprintf(output.pos, output.text.length - offset,
- "->Bridge->");
-
- mpf_audio_stream_trace(bridge->sink,STREAM_DIRECTION_SEND,&output);
-
- *output.pos = '\0';
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Media Path %s %s",object->name,output.text.buf);
-}
-
-
-static apt_bool_t mpf_bridge_destroy(mpf_object_t *object)
-{
- mpf_bridge_t *bridge = (mpf_bridge_t*) object;
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Destroy Audio Bridge %s",object->name);
- mpf_audio_stream_rx_close(bridge->source);
- mpf_audio_stream_tx_close(bridge->sink);
- return TRUE;
-}
-
-static mpf_bridge_t* mpf_bridge_base_create(mpf_audio_stream_t *source, mpf_audio_stream_t *sink, const char *name, apr_pool_t *pool)
-{
- mpf_bridge_t *bridge;
- if(!source || !sink) {
- return NULL;
- }
-
- bridge = apr_palloc(pool,sizeof(mpf_bridge_t));
- bridge->source = source;
- bridge->sink = sink;
- bridge->codec = NULL;
- mpf_object_init(&bridge->base,name);
- bridge->base.destroy = mpf_bridge_destroy;
- bridge->base.process = mpf_bridge_process;
- bridge->base.trace = mpf_bridge_trace;
- return bridge;
-}
-
-static mpf_object_t* mpf_linear_bridge_create(mpf_audio_stream_t *source, mpf_audio_stream_t *sink, const mpf_codec_manager_t *codec_manager, const char *name, apr_pool_t *pool)
-{
- mpf_codec_descriptor_t *descriptor;
- apr_size_t frame_size;
- mpf_bridge_t *bridge;
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Create Linear Audio Bridge %s",name);
- bridge = mpf_bridge_base_create(source,sink,name,pool);
- if(!bridge) {
- return NULL;
- }
-
- descriptor = source->rx_descriptor;
- frame_size = mpf_codec_linear_frame_size_calculate(descriptor->sampling_rate,descriptor->channel_count);
- bridge->frame.codec_frame.size = frame_size;
- bridge->frame.codec_frame.buffer = apr_palloc(pool,frame_size);
-
- if(mpf_audio_stream_rx_open(source,NULL) == FALSE) {
- return NULL;
- }
- if(mpf_audio_stream_tx_open(sink,NULL) == FALSE) {
- mpf_audio_stream_rx_close(source);
- return NULL;
- }
- return &bridge->base;
-}
-
-static mpf_object_t* mpf_null_bridge_create(mpf_audio_stream_t *source, mpf_audio_stream_t *sink, const mpf_codec_manager_t *codec_manager, const char *name, apr_pool_t *pool)
-{
- mpf_codec_t *codec;
- apr_size_t frame_size;
- mpf_bridge_t *bridge;
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Create Null Audio Bridge %s",name);
- bridge = mpf_bridge_base_create(source,sink,name,pool);
- if(!bridge) {
- return NULL;
- }
- bridge->base.process = mpf_null_bridge_process;
-
- codec = mpf_codec_manager_codec_get(codec_manager,source->rx_descriptor,pool);
- if(!codec) {
- return NULL;
- }
-
- frame_size = mpf_codec_frame_size_calculate(source->rx_descriptor,codec->attribs);
- bridge->codec = codec;
- bridge->frame.codec_frame.size = frame_size;
- bridge->frame.codec_frame.buffer = apr_palloc(pool,frame_size);
-
- if(mpf_audio_stream_rx_open(source,codec) == FALSE) {
- return NULL;
- }
- if(mpf_audio_stream_tx_open(sink,codec) == FALSE) {
- mpf_audio_stream_rx_close(source);
- return NULL;
- }
- return &bridge->base;
-}
-
-MPF_DECLARE(mpf_object_t*) mpf_bridge_create(
- mpf_audio_stream_t *source,
- mpf_audio_stream_t *sink,
- const mpf_codec_manager_t *codec_manager,
- const char *name,
- apr_pool_t *pool)
-{
- if(!source || !sink) {
- return NULL;
- }
-
- if(mpf_audio_stream_rx_validate(source,sink->tx_descriptor,sink->tx_event_descriptor,pool) == FALSE ||
- mpf_audio_stream_tx_validate(sink,source->rx_descriptor,source->rx_event_descriptor,pool) == FALSE) {
- return NULL;
- }
-
- if(mpf_codec_descriptors_match(source->rx_descriptor,sink->tx_descriptor) == TRUE) {
- return mpf_null_bridge_create(source,sink,codec_manager,name,pool);
- }
-
- if(mpf_codec_lpcm_descriptor_match(source->rx_descriptor) == FALSE) {
- mpf_codec_t *codec = mpf_codec_manager_codec_get(codec_manager,source->rx_descriptor,pool);
- if(codec) {
- /* set decoder before bridge */
- mpf_audio_stream_t *decoder = mpf_decoder_create(source,codec,pool);
- source = decoder;
- }
- }
-
- if(mpf_codec_lpcm_descriptor_match(sink->tx_descriptor) == FALSE) {
- mpf_codec_t *codec = mpf_codec_manager_codec_get(codec_manager,sink->tx_descriptor,pool);
- if(codec) {
- /* set encoder after bridge */
- mpf_audio_stream_t *encoder = mpf_encoder_create(sink,codec,pool);
- sink = encoder;
- }
- }
-
- if(source->rx_descriptor->sampling_rate != sink->tx_descriptor->sampling_rate) {
- /* set resampler before bridge */
- mpf_audio_stream_t *resampler = mpf_resampler_create(source,sink,pool);
- if(!resampler) {
- return NULL;
- }
- source = resampler;
- }
-
- return mpf_linear_bridge_create(source,sink,codec_manager,name,pool);
-}
diff --git a/libs/unimrcp/libs/mpf/src/mpf_buffer.c b/libs/unimrcp/libs/mpf/src/mpf_buffer.c
deleted file mode 100644
index 8db46d0a91..0000000000
--- a/libs/unimrcp/libs/mpf/src/mpf_buffer.c
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mpf_buffer.c 2181 2014-09-14 04:29:38Z achaloyan@gmail.com $
- */
-
-#ifdef WIN32
-#pragma warning(disable: 4127)
-#endif
-#include
-#include "mpf_buffer.h"
-
-typedef struct mpf_chunk_t mpf_chunk_t;
-
-struct mpf_chunk_t {
- APR_RING_ENTRY(mpf_chunk_t) link;
- mpf_frame_t frame;
-};
-
-struct mpf_buffer_t {
- APR_RING_HEAD(mpf_chunk_head_t, mpf_chunk_t) head;
- mpf_chunk_t *cur_chunk;
- apr_size_t remaining_chunk_size;
- apr_thread_mutex_t *guard;
- apr_pool_t *pool;
- apr_size_t size; /* total size */
-};
-
-mpf_buffer_t* mpf_buffer_create(apr_pool_t *pool)
-{
- mpf_buffer_t *buffer = apr_palloc(pool,sizeof(mpf_buffer_t));
- buffer->pool = pool;
- buffer->cur_chunk = NULL;
- buffer->remaining_chunk_size = 0;
- buffer->size = 0;
- APR_RING_INIT(&buffer->head, mpf_chunk_t, link);
- apr_thread_mutex_create(&buffer->guard,APR_THREAD_MUTEX_UNNESTED,pool);
- return buffer;
-}
-
-void mpf_buffer_destroy(mpf_buffer_t *buffer)
-{
- if(buffer->guard) {
- apr_thread_mutex_destroy(buffer->guard);
- buffer->guard = NULL;
- }
-}
-
-apt_bool_t mpf_buffer_restart(mpf_buffer_t *buffer)
-{
- apr_thread_mutex_lock(buffer->guard);
- APR_RING_INIT(&buffer->head, mpf_chunk_t, link);
- apr_thread_mutex_unlock(buffer->guard);
- return TRUE;
-}
-
-static APR_INLINE apt_bool_t mpf_buffer_chunk_write(mpf_buffer_t *buffer, mpf_chunk_t *chunk)
-{
- APR_RING_INSERT_TAIL(&buffer->head,chunk,mpf_chunk_t,link);
- return TRUE;
-}
-
-static APR_INLINE mpf_chunk_t* mpf_buffer_chunk_read(mpf_buffer_t *buffer)
-{
- mpf_chunk_t *chunk = NULL;
- if(!APR_RING_EMPTY(&buffer->head,mpf_chunk_t,link)) {
- chunk = APR_RING_FIRST(&buffer->head);
- APR_RING_REMOVE(chunk,link);
- }
- return chunk;
-}
-
-apt_bool_t mpf_buffer_audio_write(mpf_buffer_t *buffer, void *data, apr_size_t size)
-{
- mpf_chunk_t *chunk;
- apt_bool_t status;
- apr_thread_mutex_lock(buffer->guard);
-
- chunk = apr_palloc(buffer->pool,sizeof(mpf_chunk_t));
- APR_RING_ELEM_INIT(chunk,link);
- chunk->frame.codec_frame.buffer = apr_palloc(buffer->pool,size);
- memcpy(chunk->frame.codec_frame.buffer,data,size);
- chunk->frame.codec_frame.size = size;
- chunk->frame.type = MEDIA_FRAME_TYPE_AUDIO;
- status = mpf_buffer_chunk_write(buffer,chunk);
-
- buffer->size += size;
- apr_thread_mutex_unlock(buffer->guard);
- return status;
-}
-
-apt_bool_t mpf_buffer_event_write(mpf_buffer_t *buffer, mpf_frame_type_e event_type)
-{
- mpf_chunk_t *chunk;
- apt_bool_t status;
- apr_thread_mutex_lock(buffer->guard);
-
- chunk = apr_palloc(buffer->pool,sizeof(mpf_chunk_t));
- APR_RING_ELEM_INIT(chunk,link);
- chunk->frame.codec_frame.buffer = NULL;
- chunk->frame.codec_frame.size = 0;
- chunk->frame.type = event_type;
- status = mpf_buffer_chunk_write(buffer,chunk);
-
- apr_thread_mutex_unlock(buffer->guard);
- return status;
-}
-
-apt_bool_t mpf_buffer_frame_read(mpf_buffer_t *buffer, mpf_frame_t *media_frame)
-{
- mpf_codec_frame_t *dest;
- mpf_codec_frame_t *src;
- apr_size_t remaining_frame_size = media_frame->codec_frame.size;
- apr_thread_mutex_lock(buffer->guard);
- do {
- if(!buffer->cur_chunk) {
- buffer->cur_chunk = mpf_buffer_chunk_read(buffer);
- if(!buffer->cur_chunk) {
- /* buffer is empty */
- break;
- }
- buffer->remaining_chunk_size = buffer->cur_chunk->frame.codec_frame.size;
- }
-
- dest = &media_frame->codec_frame;
- src = &buffer->cur_chunk->frame.codec_frame;
- media_frame->type |= buffer->cur_chunk->frame.type;
- if(remaining_frame_size < buffer->remaining_chunk_size) {
- /* copy remaining_frame_size */
- memcpy(
- (char*)dest->buffer + dest->size - remaining_frame_size,
- (char*)src->buffer + src->size - buffer->remaining_chunk_size,
- remaining_frame_size);
- buffer->remaining_chunk_size -= remaining_frame_size;
- buffer->size -= remaining_frame_size;
- remaining_frame_size = 0;
- }
- else {
- /* copy remaining_chunk_size and proceed to the next chunk */
- memcpy(
- (char*)dest->buffer + dest->size - remaining_frame_size,
- (char*)src->buffer + src->size - buffer->remaining_chunk_size,
- buffer->remaining_chunk_size);
- remaining_frame_size -= buffer->remaining_chunk_size;
- buffer->size -= buffer->remaining_chunk_size;
- buffer->remaining_chunk_size = 0;
- buffer->cur_chunk = NULL;
- }
- }
- while(remaining_frame_size);
-
- if(remaining_frame_size) {
- apr_size_t offset = media_frame->codec_frame.size - remaining_frame_size;
- memset((char*)media_frame->codec_frame.buffer + offset, 0, remaining_frame_size);
- }
- apr_thread_mutex_unlock(buffer->guard);
- return TRUE;
-}
-
-apr_size_t mpf_buffer_get_size(const mpf_buffer_t *buffer)
-{
- return buffer->size;
-}
diff --git a/libs/unimrcp/libs/mpf/src/mpf_codec_descriptor.c b/libs/unimrcp/libs/mpf/src/mpf_codec_descriptor.c
deleted file mode 100644
index ca9b903d26..0000000000
--- a/libs/unimrcp/libs/mpf/src/mpf_codec_descriptor.c
+++ /dev/null
@@ -1,279 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mpf_codec_descriptor.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include "mpf_codec_descriptor.h"
-#include "mpf_named_event.h"
-#include "mpf_rtp_pt.h"
-
-/* linear PCM (host horder) */
-#define LPCM_CODEC_NAME "LPCM"
-#define LPCM_CODEC_NAME_LENGTH (sizeof(LPCM_CODEC_NAME)-1)
-
-/* linear PCM atrributes */
-static const mpf_codec_attribs_t lpcm_attribs = {
- {LPCM_CODEC_NAME, LPCM_CODEC_NAME_LENGTH}, /* codec name */
- 16, /* bits per sample */
- MPF_SAMPLE_RATE_8000 | MPF_SAMPLE_RATE_16000 |
- MPF_SAMPLE_RATE_32000 | MPF_SAMPLE_RATE_48000 /* supported sampling rates */
-};
-
-/** Find matched attribs in codec capabilities by descriptor specified */
-static mpf_codec_attribs_t* mpf_codec_capabilities_attribs_find(const mpf_codec_capabilities_t *capabilities, const mpf_codec_descriptor_t *descriptor);
-
-
-/** Get sampling rate mask (mpf_sample_rate_e) by integer value */
-MPF_DECLARE(int) mpf_sample_rate_mask_get(apr_uint16_t sampling_rate)
-{
- switch(sampling_rate) {
- case 8000:
- return MPF_SAMPLE_RATE_8000;
- case 16000:
- return MPF_SAMPLE_RATE_16000;
- case 32000:
- return MPF_SAMPLE_RATE_32000;
- case 48000:
- return MPF_SAMPLE_RATE_48000;
- }
- return MPF_SAMPLE_RATE_NONE;
-}
-
-static APR_INLINE apt_bool_t mpf_sampling_rate_check(apr_uint16_t sampling_rate, int mask)
-{
- return (mpf_sample_rate_mask_get(sampling_rate) & mask) ? TRUE : FALSE;
-}
-
-MPF_DECLARE(mpf_codec_descriptor_t*) mpf_codec_lpcm_descriptor_create(apr_uint16_t sampling_rate, apr_byte_t channel_count, apr_pool_t *pool)
-{
- mpf_codec_descriptor_t *descriptor = mpf_codec_descriptor_create(pool);
- descriptor->payload_type = RTP_PT_UNKNOWN;
- descriptor->name = lpcm_attribs.name;
- descriptor->sampling_rate = sampling_rate;
- descriptor->channel_count = channel_count;
- return descriptor;
-}
-
-/** Create codec descriptor by capabilities */
-MPF_DECLARE(mpf_codec_descriptor_t*) mpf_codec_descriptor_create_by_capabilities(const mpf_codec_capabilities_t *capabilities, const mpf_codec_descriptor_t *peer, apr_pool_t *pool)
-{
- mpf_codec_descriptor_t *descriptor;
- mpf_codec_attribs_t *attribs = NULL;
- if(capabilities && peer) {
- attribs = mpf_codec_capabilities_attribs_find(capabilities,peer);
- }
-
- if(!attribs) {
- return mpf_codec_lpcm_descriptor_create(8000,1,pool);
- }
-
- descriptor = mpf_codec_descriptor_create(pool);
- *descriptor = *peer;
- if(apt_string_compare(&peer->name,&attribs->name) == FALSE) {
- descriptor->payload_type = RTP_PT_UNKNOWN;
- descriptor->name = attribs->name;
- }
- return descriptor;
-}
-
-/** Match two codec descriptors */
-MPF_DECLARE(apt_bool_t) mpf_codec_descriptors_match(const mpf_codec_descriptor_t *descriptor1, const mpf_codec_descriptor_t *descriptor2)
-{
- apt_bool_t match = FALSE;
- if(descriptor1->payload_type < RTP_PT_DYNAMIC && descriptor2->payload_type < RTP_PT_DYNAMIC) {
- if(descriptor1->payload_type == descriptor2->payload_type) {
- match = TRUE;
- }
- }
- else {
- if(apt_string_compare(&descriptor1->name,&descriptor2->name) == TRUE) {
- if(descriptor1->sampling_rate == descriptor2->sampling_rate &&
- descriptor1->channel_count == descriptor2->channel_count) {
- match = TRUE;
- }
- }
- }
- return match;
-}
-
-/** Match specified codec descriptor and the default lpcm one */
-MPF_DECLARE(apt_bool_t) mpf_codec_lpcm_descriptor_match(const mpf_codec_descriptor_t *descriptor)
-{
- return apt_string_compare(&descriptor->name,&lpcm_attribs.name);
-}
-
-/** Add default (linear PCM) capabilities */
-MPF_DECLARE(apt_bool_t) mpf_codec_default_capabilities_add(mpf_codec_capabilities_t *capabilities)
-{
- return mpf_codec_capabilities_add(capabilities,MPF_SAMPLE_RATE_8000,lpcm_attribs.name.buf);
-}
-
-/** Match codec descriptors by attribs specified */
-MPF_DECLARE(apt_bool_t) mpf_codec_descriptor_match_by_attribs(mpf_codec_descriptor_t *descriptor, const mpf_codec_descriptor_t *static_descriptor, const mpf_codec_attribs_t *attribs)
-{
- apt_bool_t match = FALSE;
- if(descriptor->payload_type < RTP_PT_DYNAMIC) {
- if(static_descriptor && static_descriptor->payload_type == descriptor->payload_type) {
- descriptor->name = static_descriptor->name;
- descriptor->sampling_rate = static_descriptor->sampling_rate;
- descriptor->channel_count = static_descriptor->channel_count;
- match = TRUE;
- }
- }
- else {
- if(apt_string_compare(&attribs->name,&descriptor->name) == TRUE) {
- if(mpf_sampling_rate_check(descriptor->sampling_rate,attribs->sample_rates) == TRUE) {
- match = TRUE;
- }
- }
- }
- return match;
-}
-
-/** Find matched descriptor in codec list */
-MPF_DECLARE(mpf_codec_descriptor_t*) mpf_codec_list_descriptor_find(const mpf_codec_list_t *codec_list, const mpf_codec_descriptor_t *descriptor)
-{
- int i;
- mpf_codec_descriptor_t *matched_descriptor;
- for(i=0; idescriptor_arr->nelts; i++) {
- matched_descriptor = &APR_ARRAY_IDX(codec_list->descriptor_arr,i,mpf_codec_descriptor_t);
- if(mpf_codec_descriptors_match(descriptor,matched_descriptor) == TRUE) {
- return matched_descriptor;
- }
- }
- return NULL;
-}
-
-/** Find matched attribs in codec capabilities by descriptor specified */
-static mpf_codec_attribs_t* mpf_codec_capabilities_attribs_find(const mpf_codec_capabilities_t *capabilities, const mpf_codec_descriptor_t *descriptor)
-{
- int i;
- mpf_codec_attribs_t *attribs;
- for(i=0; iattrib_arr->nelts; i++) {
- attribs = &APR_ARRAY_IDX(capabilities->attrib_arr,i,mpf_codec_attribs_t);
- if(mpf_sampling_rate_check(descriptor->sampling_rate,attribs->sample_rates) == TRUE) {
- return attribs;
- }
- }
- return NULL;
-}
-
-/** Match codec list with specified capabilities */
-MPF_DECLARE(apt_bool_t) mpf_codec_list_match(mpf_codec_list_t *codec_list, const mpf_codec_capabilities_t *capabilities)
-{
- int i;
- mpf_codec_descriptor_t *descriptor;
- apt_bool_t status = FALSE;
- if(!capabilities) {
- return FALSE;
- }
-
- for(i=0; idescriptor_arr->nelts; i++) {
- descriptor = &APR_ARRAY_IDX(codec_list->descriptor_arr,i,mpf_codec_descriptor_t);
- if(descriptor->enabled == FALSE) continue;
-
- /* match capabilities */
- if(mpf_codec_capabilities_attribs_find(capabilities,descriptor)) {
- /* at least one codec descriptor matches */
- status = TRUE;
- }
- else {
- descriptor->enabled = FALSE;
- }
- }
-
- return status;
-}
-
-/** Intersect two codec lists */
-MPF_DECLARE(apt_bool_t) mpf_codec_lists_intersect(mpf_codec_list_t *codec_list1, mpf_codec_list_t *codec_list2)
-{
- int i;
- mpf_codec_descriptor_t *descriptor1;
- mpf_codec_descriptor_t *descriptor2;
- codec_list1->primary_descriptor = NULL;
- codec_list1->event_descriptor = NULL;
- codec_list2->primary_descriptor = NULL;
- codec_list2->event_descriptor = NULL;
- /* find only one match for primary and named event descriptors,
- set the matched descriptors as preffered, disable the others */
- for(i=0; idescriptor_arr->nelts; i++) {
- descriptor1 = &APR_ARRAY_IDX(codec_list1->descriptor_arr,i,mpf_codec_descriptor_t);
- if(descriptor1->enabled == FALSE) {
- /* this descriptor has been already disabled, process only enabled ones */
- continue;
- }
-
- /* check whether this is a named event descriptor */
- if(mpf_event_descriptor_check(descriptor1) == TRUE) {
- /* named event descriptor */
- if(codec_list1->event_descriptor) {
- /* named event descriptor has been already set, disable this one */
- descriptor1->enabled = FALSE;
- }
- else {
- /* find if there is a match */
- descriptor2 = mpf_codec_list_descriptor_find(codec_list2,descriptor1);
- if(descriptor2 && descriptor2->enabled == TRUE) {
- descriptor1->enabled = TRUE;
- codec_list1->event_descriptor = descriptor1;
- codec_list2->event_descriptor = descriptor2;
- }
- else {
- /* no match found, disable this descriptor */
- descriptor1->enabled = FALSE;
- }
- }
- }
- else {
- /* primary descriptor */
- if(codec_list1->primary_descriptor) {
- /* primary descriptor has been already set, disable this one */
- descriptor1->enabled = FALSE;
- }
- else {
- /* find if there is a match */
- descriptor2 = mpf_codec_list_descriptor_find(codec_list2,descriptor1);
- if(descriptor2 && descriptor2->enabled == TRUE) {
- descriptor1->enabled = TRUE;
- codec_list1->primary_descriptor = descriptor1;
- codec_list2->primary_descriptor = descriptor2;
- }
- else {
- /* no match found, disable this descriptor */
- descriptor1->enabled = FALSE;
- }
- }
- }
- }
-
- for(i=0; idescriptor_arr->nelts; i++) {
- descriptor2 = &APR_ARRAY_IDX(codec_list2->descriptor_arr,i,mpf_codec_descriptor_t);
- if(descriptor2 == codec_list2->primary_descriptor || descriptor2 == codec_list2->event_descriptor) {
- descriptor2->enabled = TRUE;
- }
- else {
- descriptor2->enabled = FALSE;
- }
- }
-
- /* if primary descriptor is disabled or not set, return FALSE */
- if(!codec_list1->primary_descriptor || codec_list1->primary_descriptor->enabled == FALSE) {
- return FALSE;
- }
-
- return TRUE;
-}
diff --git a/libs/unimrcp/libs/mpf/src/mpf_codec_g711.c b/libs/unimrcp/libs/mpf/src/mpf_codec_g711.c
deleted file mode 100644
index 0a3bda25dc..0000000000
--- a/libs/unimrcp/libs/mpf/src/mpf_codec_g711.c
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mpf_codec_g711.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include "mpf_codec.h"
-#include "mpf_rtp_pt.h"
-#include "g711/g711.h"
-
-#define G711u_CODEC_NAME "PCMU"
-#define G711u_CODEC_NAME_LENGTH (sizeof(G711u_CODEC_NAME)-1)
-
-#define G711a_CODEC_NAME "PCMA"
-#define G711a_CODEC_NAME_LENGTH (sizeof(G711a_CODEC_NAME)-1)
-
-static apt_bool_t g711_open(mpf_codec_t *codec)
-{
- return TRUE;
-}
-
-static apt_bool_t g711_close(mpf_codec_t *codec)
-{
- return TRUE;
-}
-
-static apt_bool_t g711u_encode(mpf_codec_t *codec, const mpf_codec_frame_t *frame_in, mpf_codec_frame_t *frame_out)
-{
- const apr_int16_t *decode_buf;
- unsigned char *encode_buf;
- apr_size_t i;
-
- decode_buf = frame_in->buffer;
- encode_buf = frame_out->buffer;
-
- frame_out->size = frame_in->size / sizeof(apr_int16_t);
-
- for(i=0; isize; i++) {
- encode_buf[i] = linear_to_ulaw(decode_buf[i]);
- }
-
- return TRUE;
-}
-
-static apt_bool_t g711u_decode(mpf_codec_t *codec, const mpf_codec_frame_t *frame_in, mpf_codec_frame_t *frame_out)
-{
- apr_int16_t *decode_buf;
- const unsigned char *encode_buf;
- apr_size_t i;
-
- decode_buf = frame_out->buffer;
- encode_buf = frame_in->buffer;
-
- frame_out->size = frame_in->size * sizeof(apr_int16_t);
-
- for(i=0; isize; i++) {
- decode_buf[i] = ulaw_to_linear(encode_buf[i]);
- }
-
- return TRUE;
-}
-
-static apt_bool_t g711u_init(mpf_codec_t *codec, mpf_codec_frame_t *frame_out)
-{
- apr_size_t i;
- unsigned char *encode_buf = frame_out->buffer;
- for(i=0; isize; i++) {
- encode_buf[i] = linear_to_ulaw(0);
- }
-
- return TRUE;
-}
-
-static apt_bool_t g711a_encode(mpf_codec_t *codec, const mpf_codec_frame_t *frame_in, mpf_codec_frame_t *frame_out)
-{
- const apr_int16_t *decode_buf;
- unsigned char *encode_buf;
- apr_size_t i;
-
- decode_buf = frame_in->buffer;
- encode_buf = frame_out->buffer;
-
- frame_out->size = frame_in->size / sizeof(apr_int16_t);
-
- for(i=0; isize; i++) {
- encode_buf[i] = linear_to_alaw(decode_buf[i]);
- }
-
- return TRUE;
-}
-
-static apt_bool_t g711a_decode(mpf_codec_t *codec, const mpf_codec_frame_t *frame_in, mpf_codec_frame_t *frame_out)
-{
- apr_int16_t *decode_buf;
- const unsigned char *encode_buf;
- apr_size_t i;
-
- decode_buf = frame_out->buffer;
- encode_buf = frame_in->buffer;
-
- frame_out->size = frame_in->size * sizeof(apr_int16_t);
-
- for(i=0; isize; i++) {
- decode_buf[i] = alaw_to_linear(encode_buf[i]);
- }
-
- return TRUE;
-}
-
-static apt_bool_t g711a_init(mpf_codec_t *codec, mpf_codec_frame_t *frame_out)
-{
- apr_size_t i;
- unsigned char *encode_buf = frame_out->buffer;
- for(i=0; isize; i++) {
- encode_buf[i] = linear_to_alaw(0);
- }
-
- return TRUE;
-}
-
-static const mpf_codec_vtable_t g711u_vtable = {
- g711_open,
- g711_close,
- g711u_encode,
- g711u_decode,
- NULL,
- g711u_init
-};
-
-static const mpf_codec_vtable_t g711a_vtable = {
- g711_open,
- g711_close,
- g711a_encode,
- g711a_decode,
- NULL,
- g711a_init
-};
-
-static const mpf_codec_descriptor_t g711u_descriptor = {
- RTP_PT_PCMU,
- {G711u_CODEC_NAME, G711u_CODEC_NAME_LENGTH},
- 8000,
- 1,
- {NULL, 0},
- TRUE
-};
-
-static const mpf_codec_descriptor_t g711a_descriptor = {
- RTP_PT_PCMA,
- {G711a_CODEC_NAME, G711a_CODEC_NAME_LENGTH},
- 8000,
- 1,
- {NULL,0},
- TRUE
-};
-
-static const mpf_codec_attribs_t g711u_attribs = {
- {G711u_CODEC_NAME, G711u_CODEC_NAME_LENGTH}, /* codec name */
- 8, /* bits per sample */
- MPF_SAMPLE_RATE_8000 | MPF_SAMPLE_RATE_16000 |
- MPF_SAMPLE_RATE_32000 | MPF_SAMPLE_RATE_48000 /* supported sampling rates */
-};
-
-static const mpf_codec_attribs_t g711a_attribs = {
- {G711a_CODEC_NAME, G711a_CODEC_NAME_LENGTH}, /* codec name */
- 8, /* bits per sample */
- MPF_SAMPLE_RATE_8000 | MPF_SAMPLE_RATE_16000 |
- MPF_SAMPLE_RATE_32000 | MPF_SAMPLE_RATE_48000 /* supported sampling rates */
-};
-
-mpf_codec_t* mpf_codec_g711u_create(apr_pool_t *pool)
-{
- return mpf_codec_create(&g711u_vtable,&g711u_attribs,&g711u_descriptor,pool);
-}
-
-mpf_codec_t* mpf_codec_g711a_create(apr_pool_t *pool)
-{
- return mpf_codec_create(&g711a_vtable,&g711a_attribs,&g711a_descriptor,pool);
-}
diff --git a/libs/unimrcp/libs/mpf/src/mpf_codec_linear.c b/libs/unimrcp/libs/mpf/src/mpf_codec_linear.c
deleted file mode 100644
index 78a817df03..0000000000
--- a/libs/unimrcp/libs/mpf/src/mpf_codec_linear.c
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mpf_codec_linear.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#define APR_WANT_BYTEFUNC
-#include
-#include "mpf_codec.h"
-#include "mpf_rtp_pt.h"
-
-/* linear 16-bit PCM (RFC3551) */
-#define L16_CODEC_NAME "L16"
-#define L16_CODEC_NAME_LENGTH (sizeof(L16_CODEC_NAME)-1)
-
-
-static apt_bool_t l16_open(mpf_codec_t *codec)
-{
- return TRUE;
-}
-
-static apt_bool_t l16_close(mpf_codec_t *codec)
-{
- return TRUE;
-}
-
-static apt_bool_t l16_encode(mpf_codec_t *codec, const mpf_codec_frame_t *frame_in, mpf_codec_frame_t *frame_out)
-{
- apr_uint32_t i;
- const apr_int16_t *buf_in = frame_in->buffer;
- apr_int16_t *buf_out = frame_out->buffer;
- apr_size_t samples = frame_in->size / sizeof(apr_int16_t);
-
- frame_out->size = frame_in->size;
-
- for(i=0; ibuffer;
- apr_int16_t *buf_out = frame_out->buffer;
- apr_size_t samples = frame_in->size / sizeof(apr_int16_t);
-
- frame_out->size = frame_in->size;
-
- for(i=0; i
-#include "mpf_codec_manager.h"
-#include "mpf_rtp_pt.h"
-#include "mpf_named_event.h"
-#include "apt_log.h"
-
-
-struct mpf_codec_manager_t {
- /** Memory pool */
- apr_pool_t *pool;
-
- /** Dynamic (resizable) array of codecs (mpf_codec_t*) */
- apr_array_header_t *codec_arr;
- /** Default named event descriptor */
- mpf_codec_descriptor_t *event_descriptor;
-};
-
-
-MPF_DECLARE(mpf_codec_manager_t*) mpf_codec_manager_create(apr_size_t codec_count, apr_pool_t *pool)
-{
- mpf_codec_manager_t *codec_manager = apr_palloc(pool,sizeof(mpf_codec_manager_t));
- codec_manager->pool = pool;
- codec_manager->codec_arr = apr_array_make(pool,(int)codec_count,sizeof(mpf_codec_t*));
- codec_manager->event_descriptor = mpf_event_descriptor_create(8000,pool);
- return codec_manager;
-}
-
-MPF_DECLARE(void) mpf_codec_manager_destroy(mpf_codec_manager_t *codec_manager)
-{
- /* nothing to do */
-}
-
-MPF_DECLARE(apt_bool_t) mpf_codec_manager_codec_register(mpf_codec_manager_t *codec_manager, mpf_codec_t *codec)
-{
- if(!codec || !codec->attribs || !codec->attribs->name.buf) {
- return FALSE;
- }
-
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Register Codec [%s]",codec->attribs->name.buf);
-
- APR_ARRAY_PUSH(codec_manager->codec_arr,mpf_codec_t*) = codec;
- return TRUE;
-}
-
-MPF_DECLARE(mpf_codec_t*) mpf_codec_manager_codec_get(const mpf_codec_manager_t *codec_manager, mpf_codec_descriptor_t *descriptor, apr_pool_t *pool)
-{
- int i;
- mpf_codec_t *codec;
- if(!descriptor) {
- return NULL;
- }
-
- for(i=0; icodec_arr->nelts; i++) {
- codec = APR_ARRAY_IDX(codec_manager->codec_arr,i,mpf_codec_t*);
- if(mpf_codec_descriptor_match_by_attribs(descriptor,codec->static_descriptor,codec->attribs) == TRUE) {
- return mpf_codec_clone(codec,pool);
- }
- }
-
- return NULL;
-}
-
-MPF_DECLARE(apt_bool_t) mpf_codec_manager_codec_list_get(const mpf_codec_manager_t *codec_manager, mpf_codec_list_t *codec_list, apr_pool_t *pool)
-{
- const mpf_codec_descriptor_t *static_descriptor;
- mpf_codec_descriptor_t *descriptor;
- int i;
- mpf_codec_t *codec;
-
- mpf_codec_list_init(codec_list,codec_manager->codec_arr->nelts,pool);
- for(i=0; icodec_arr->nelts; i++) {
- codec = APR_ARRAY_IDX(codec_manager->codec_arr,i,mpf_codec_t*);
- static_descriptor = codec->static_descriptor;
- if(static_descriptor) {
- descriptor = mpf_codec_list_add(codec_list);
- if(descriptor) {
- *descriptor = *static_descriptor;
- }
- }
- }
- if(codec_manager->event_descriptor) {
- descriptor = mpf_codec_list_add(codec_list);
- if(descriptor) {
- *descriptor = *codec_manager->event_descriptor;
- }
- }
- return TRUE;
-}
-
-static apt_bool_t mpf_codec_manager_codec_parse(const mpf_codec_manager_t *codec_manager, mpf_codec_list_t *codec_list, char *codec_desc_str, apr_pool_t *pool)
-{
- const mpf_codec_t *codec;
- mpf_codec_descriptor_t *descriptor;
- const char *separator = "/";
- char *state;
- /* parse codec name */
- char *str = apr_strtok(codec_desc_str, separator, &state);
- codec_desc_str = NULL; /* make sure we pass NULL on subsequent calls of apr_strtok() */
- if(str) {
- apt_str_t name;
- apt_string_assign(&name,str,pool);
- /* find codec by name */
- codec = mpf_codec_manager_codec_find(codec_manager,&name);
- if(codec) {
- descriptor = mpf_codec_list_add(codec_list);
- descriptor->name = name;
-
- /* set default attributes */
- if(codec->static_descriptor) {
- descriptor->payload_type = codec->static_descriptor->payload_type;
- descriptor->sampling_rate = codec->static_descriptor->sampling_rate;
- descriptor->channel_count = codec->static_descriptor->channel_count;
- }
- else {
- descriptor->payload_type = RTP_PT_DYNAMIC;
- descriptor->sampling_rate = 8000;
- descriptor->channel_count = 1;
- }
- }
- else {
- mpf_codec_descriptor_t *event_descriptor = codec_manager->event_descriptor;
- if(event_descriptor && apt_string_compare(&event_descriptor->name,&name) == TRUE) {
- descriptor = mpf_codec_list_add(codec_list);
- *descriptor = *event_descriptor;
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"No Such Codec [%s]",str);
- return FALSE;
- }
- }
-
-
- /* parse optional payload type */
- str = apr_strtok(codec_desc_str, separator, &state);
- if(str) {
- descriptor->payload_type = (apr_byte_t)atol(str);
-
- /* parse optional sampling rate */
- str = apr_strtok(codec_desc_str, separator, &state);
- if(str) {
- descriptor->sampling_rate = (apr_uint16_t)atol(str);
-
- /* parse optional channel count */
- str = apr_strtok(codec_desc_str, separator, &state);
- if(str) {
- descriptor->channel_count = (apr_byte_t)atol(str);
- }
- }
- }
- }
- return TRUE;
-}
-
-MPF_DECLARE(apt_bool_t) mpf_codec_manager_codec_list_load(const mpf_codec_manager_t *codec_manager, mpf_codec_list_t *codec_list, const char *str, apr_pool_t *pool)
-{
- char *codec_desc_str;
- char *state;
- char *codec_list_str = apr_pstrdup(pool,str);
- do {
- codec_desc_str = apr_strtok(codec_list_str, " ", &state);
- if(codec_desc_str) {
- mpf_codec_manager_codec_parse(codec_manager,codec_list,codec_desc_str,pool);
- }
- codec_list_str = NULL; /* make sure we pass NULL on subsequent calls of apr_strtok() */
- }
- while(codec_desc_str);
- return TRUE;
-}
-
-MPF_DECLARE(const mpf_codec_t*) mpf_codec_manager_codec_find(const mpf_codec_manager_t *codec_manager, const apt_str_t *codec_name)
-{
- int i;
- mpf_codec_t *codec;
- for(i=0; icodec_arr->nelts; i++) {
- codec = APR_ARRAY_IDX(codec_manager->codec_arr,i,mpf_codec_t*);
- if(apt_string_compare(&codec->attribs->name,codec_name) == TRUE) {
- return codec;
- }
- }
- return NULL;
-}
diff --git a/libs/unimrcp/libs/mpf/src/mpf_context.c b/libs/unimrcp/libs/mpf/src/mpf_context.c
deleted file mode 100644
index e0c35cce81..0000000000
--- a/libs/unimrcp/libs/mpf/src/mpf_context.c
+++ /dev/null
@@ -1,548 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mpf_context.c 2181 2014-09-14 04:29:38Z achaloyan@gmail.com $
- */
-
-#ifdef WIN32
-#pragma warning(disable: 4127)
-#endif
-#include
-#include "mpf_context.h"
-#include "mpf_termination.h"
-#include "mpf_stream.h"
-#include "mpf_bridge.h"
-#include "mpf_multiplier.h"
-#include "mpf_mixer.h"
-#include "apt_log.h"
-
-/** Item of the association matrix */
-typedef struct {
- unsigned char on;
-} matrix_item_t;
-
-/** Item of the association matrix header */
-typedef struct {
- mpf_termination_t *termination;
- unsigned char tx_count;
- unsigned char rx_count;
-} header_item_t;
-
-/** Media processing context */
-struct mpf_context_t {
- /** Ring entry */
- APR_RING_ENTRY(mpf_context_t) link;
- /** Back pointer to the context factory */
- mpf_context_factory_t *factory;
- /** Pool to allocate memory from */
- apr_pool_t *pool;
- /** Informative name of the context used for debugging */
- const char *name;
- /** External object */
- void *obj;
-
- /** Max number of terminations in the context */
- apr_size_t capacity;
- /** Current number of terminations in the context */
- apr_size_t count;
- /** Header of the association matrix */
- header_item_t *header;
- /** Association matrix, which represents the topology */
- matrix_item_t **matrix;
-
- /** Array of media processing objects constructed while
- applying topology based on association matrix */
- apr_array_header_t *mpf_objects;
-};
-
-/** Factory of media contexts */
-struct mpf_context_factory_t {
- /** Ring head */
- APR_RING_HEAD(mpf_context_head_t, mpf_context_t) head;
-};
-
-
-static APR_INLINE apt_bool_t stream_direction_compatibility_check(mpf_termination_t *termination1, mpf_termination_t *termination2);
-static mpf_object_t* mpf_context_bridge_create(mpf_context_t *context, apr_size_t i);
-static mpf_object_t* mpf_context_multiplier_create(mpf_context_t *context, apr_size_t i);
-static mpf_object_t* mpf_context_mixer_create(mpf_context_t *context, apr_size_t j);
-
-
-MPF_DECLARE(mpf_context_factory_t*) mpf_context_factory_create(apr_pool_t *pool)
-{
- mpf_context_factory_t *factory = apr_palloc(pool, sizeof(mpf_context_factory_t));
- APR_RING_INIT(&factory->head, mpf_context_t, link);
- return factory;
-}
-
-MPF_DECLARE(void) mpf_context_factory_destroy(mpf_context_factory_t *factory)
-{
- mpf_context_t *context;
- while(!APR_RING_EMPTY(&factory->head, mpf_context_t, link)) {
- context = APR_RING_FIRST(&factory->head);
- mpf_context_destroy(context);
- APR_RING_REMOVE(context, link);
- }
-}
-
-MPF_DECLARE(apt_bool_t) mpf_context_factory_process(mpf_context_factory_t *factory)
-{
- mpf_context_t *context;
- for(context = APR_RING_FIRST(&factory->head);
- context != APR_RING_SENTINEL(&factory->head, mpf_context_t, link);
- context = APR_RING_NEXT(context, link)) {
-
- mpf_context_process(context);
- }
-
- return TRUE;
-}
-
-
-MPF_DECLARE(mpf_context_t*) mpf_context_create(
- mpf_context_factory_t *factory,
- const char *name,
- void *obj,
- apr_size_t max_termination_count,
- apr_pool_t *pool)
-{
- apr_size_t i,j;
- matrix_item_t *matrix_item;
- header_item_t *header_item;
- mpf_context_t *context = apr_palloc(pool,sizeof(mpf_context_t));
- APR_RING_ELEM_INIT(context,link);
- context->factory = factory;
- context->obj = obj;
- context->pool = pool;
- context->name = name;
- if(!context->name) {
- context->name = apr_psprintf(pool,"0x%pp",context);
- }
- context->capacity = max_termination_count;
- context->count = 0;
- context->mpf_objects = apr_array_make(pool,1,sizeof(mpf_object_t*));
- context->header = apr_palloc(pool,context->capacity * sizeof(header_item_t));
- context->matrix = apr_palloc(pool,context->capacity * sizeof(matrix_item_t*));
- for(i=0; icapacity; i++) {
- header_item = &context->header[i];
- header_item->termination = NULL;
- header_item->tx_count = 0;
- header_item->rx_count = 0;
- context->matrix[i] = apr_palloc(pool,context->capacity * sizeof(matrix_item_t));
- for(j=0; jcapacity; j++) {
- matrix_item = &context->matrix[i][j];
- matrix_item->on = 0;
- }
- }
-
- return context;
-}
-
-MPF_DECLARE(apt_bool_t) mpf_context_destroy(mpf_context_t *context)
-{
- apr_size_t i;
- mpf_termination_t *termination;
- for(i=0; icapacity; i++){
- termination = context->header[i].termination;
- if(termination) {
- mpf_context_termination_subtract(context,termination);
- mpf_termination_subtract(termination);
- }
- }
- return TRUE;
-}
-
-MPF_DECLARE(void*) mpf_context_object_get(const mpf_context_t *context)
-{
- return context->obj;
-}
-
-MPF_DECLARE(apt_bool_t) mpf_context_termination_add(mpf_context_t *context, mpf_termination_t *termination)
-{
- apr_size_t i;
- header_item_t *header_item;
- for(i=0; icapacity; i++) {
- header_item = &context->header[i];
- if(header_item->termination) {
- continue;
- }
- if(!context->count) {
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Add Media Context %s",context->name);
- APR_RING_INSERT_TAIL(&context->factory->head,context,mpf_context_t,link);
- }
-
- header_item->termination = termination;
- header_item->tx_count = 0;
- header_item->rx_count = 0;
-
- termination->slot = i;
- context->count++;
- return TRUE;
- }
- return FALSE;
-}
-
-MPF_DECLARE(apt_bool_t) mpf_context_termination_subtract(mpf_context_t *context, mpf_termination_t *termination)
-{
- header_item_t *header_item1;
- header_item_t *header_item2;
- matrix_item_t *item;
- apr_size_t j,k;
- apr_size_t i = termination->slot;
- if(i >= context->capacity) {
- return FALSE;
- }
- header_item1 = &context->header[i];
- if(header_item1->termination != termination) {
- return FALSE;
- }
-
- for(j=0,k=0; jcapacity && kcount; j++) {
- header_item2 = &context->header[j];
- if(!header_item2->termination) {
- continue;
- }
- k++;
-
- item = &context->matrix[i][j];
- if(item->on) {
- item->on = 0;
- header_item1->tx_count--;
- header_item2->rx_count--;
- }
-
- item = &context->matrix[j][i];
- if(item->on) {
- item->on = 0;
- header_item2->tx_count--;
- header_item1->rx_count--;
- }
- }
- header_item1->termination = NULL;
-
- termination->slot = (apr_size_t)-1;
- context->count--;
- if(!context->count) {
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Remove Media Context %s",context->name);
- APR_RING_REMOVE(context,link);
- }
- return TRUE;
-}
-
-MPF_DECLARE(apt_bool_t) mpf_context_association_add(mpf_context_t *context, mpf_termination_t *termination1, mpf_termination_t *termination2)
-{
- header_item_t *header_item1;
- matrix_item_t *matrix_item1;
- header_item_t *header_item2;
- matrix_item_t *matrix_item2;
- apr_size_t i = termination1->slot;
- apr_size_t j = termination2->slot;
- if(i >= context->capacity || j >= context->capacity) {
- return FALSE;
- }
-
- header_item1 = &context->header[i];
- header_item2 = &context->header[j];
-
- if(header_item1->termination != termination1 || header_item2->termination != termination2) {
- return FALSE;
- }
-
- matrix_item1 = &context->matrix[i][j];
- matrix_item2 = &context->matrix[j][i];
-
- /* 1 -> 2 */
- if(!matrix_item1->on) {
- if(stream_direction_compatibility_check(header_item1->termination,header_item2->termination) == TRUE) {
- matrix_item1->on = 1;
- header_item1->tx_count ++;
- header_item2->rx_count ++;
- }
- }
-
- /* 2 -> 1 */
- if(!matrix_item2->on) {
- if(stream_direction_compatibility_check(header_item2->termination,header_item1->termination) == TRUE) {
- matrix_item2->on = 1;
- header_item2->tx_count ++;
- header_item1->rx_count ++;
- }
- }
- return TRUE;
-}
-
-MPF_DECLARE(apt_bool_t) mpf_context_association_remove(mpf_context_t *context, mpf_termination_t *termination1, mpf_termination_t *termination2)
-{
- header_item_t *header_item1;
- matrix_item_t *matrix_item1;
- header_item_t *header_item2;
- matrix_item_t *matrix_item2;
- apr_size_t i = termination1->slot;
- apr_size_t j = termination2->slot;
- if(i >= context->capacity || j >= context->capacity) {
- return FALSE;
- }
-
- header_item1 = &context->header[i];
- header_item2 = &context->header[j];
-
- if(header_item1->termination != termination1 || header_item2->termination != termination2) {
- return FALSE;
- }
-
- matrix_item1 = &context->matrix[i][j];
- matrix_item2 = &context->matrix[j][i];
-
- /* 1 -> 2 */
- if(matrix_item1->on == 1) {
- matrix_item1->on = 0;
- header_item1->tx_count --;
- header_item2->rx_count --;
- }
-
- /* 2 -> 1 */
- if(matrix_item2->on == 1) {
- matrix_item2->on = 0;
- header_item2->tx_count --;
- header_item1->rx_count --;
- }
- return TRUE;
-}
-
-MPF_DECLARE(apt_bool_t) mpf_context_associations_reset(mpf_context_t *context)
-{
- apr_size_t i,j,k;
- header_item_t *header_item1;
- header_item_t *header_item2;
- matrix_item_t *item;
-
- /* destroy existing topology / if any */
- mpf_context_topology_destroy(context);
-
- /* reset assigned associations */
- for(i=0,k=0; icapacity && kcount; i++) {
- header_item1 = &context->header[i];
- if(!header_item1->termination) {
- continue;
- }
- k++;
-
- if(!header_item1->tx_count && !header_item1->rx_count) {
- continue;
- }
-
- for(j=i; jcapacity; j++) {
- header_item2 = &context->header[j];
- if(!header_item2->termination) {
- continue;
- }
-
- item = &context->matrix[i][j];
- if(item->on) {
- item->on = 0;
- header_item1->tx_count--;
- header_item2->rx_count--;
- }
-
- item = &context->matrix[j][i];
- if(item->on) {
- item->on = 0;
- header_item2->tx_count--;
- header_item1->rx_count--;
- }
- }
- }
- return TRUE;
-}
-
-static apt_bool_t mpf_context_object_add(mpf_context_t *context, mpf_object_t *object)
-{
- if(!object) {
- return FALSE;
- }
-
- APR_ARRAY_PUSH(context->mpf_objects, mpf_object_t*) = object;
-#if 1
- mpf_object_trace(object);
-#endif
- return TRUE;
-}
-
-MPF_DECLARE(apt_bool_t) mpf_context_topology_apply(mpf_context_t *context)
-{
- apr_size_t i,k;
- header_item_t *header_item;
- mpf_object_t *object;
-
- /* first destroy existing topology / if any */
- mpf_context_topology_destroy(context);
-
- for(i=0,k=0; icapacity && kcount; i++) {
- header_item = &context->header[i];
- if(!header_item->termination) {
- continue;
- }
- k++;
-
- if(header_item->tx_count > 0) {
- object = NULL;
- if(header_item->tx_count == 1) {
- object = mpf_context_bridge_create(context,i);
- }
- else { /* tx_count > 1 */
- object = mpf_context_multiplier_create(context,i);
- }
-
- mpf_context_object_add(context,object);
- }
- if(header_item->rx_count > 1) {
- object = mpf_context_mixer_create(context,i);
- mpf_context_object_add(context,object);
- }
- }
-
- return TRUE;
-}
-
-MPF_DECLARE(apt_bool_t) mpf_context_topology_destroy(mpf_context_t *context)
-{
- if(context->mpf_objects->nelts) {
- int i;
- mpf_object_t *object;
- for(i=0; impf_objects->nelts; i++) {
- object = APR_ARRAY_IDX(context->mpf_objects,i,mpf_object_t*);
- mpf_object_destroy(object);
- }
- apr_array_clear(context->mpf_objects);
- }
- return TRUE;
-}
-
-MPF_DECLARE(apt_bool_t) mpf_context_process(mpf_context_t *context)
-{
- int i;
- mpf_object_t *object;
- for(i=0; impf_objects->nelts; i++) {
- object = APR_ARRAY_IDX(context->mpf_objects,i,mpf_object_t*);
- if(object && object->process) {
- object->process(object);
- }
- }
- return TRUE;
-}
-
-
-static mpf_object_t* mpf_context_bridge_create(mpf_context_t *context, apr_size_t i)
-{
- header_item_t *header_item1 = &context->header[i];
- header_item_t *header_item2;
- matrix_item_t *item;
- apr_size_t j;
- for(j=0; jcapacity; j++) {
- header_item2 = &context->header[j];
- if(!header_item2->termination) {
- continue;
- }
- item = &context->matrix[i][j];
- if(!item->on) {
- continue;
- }
-
- if(header_item2->rx_count > 1) {
- /* mixer will be created instead */
- return NULL;
- }
-
- /* create bridge i -> j */
- if(header_item1->termination && header_item2->termination) {
- return mpf_bridge_create(
- header_item1->termination->audio_stream,
- header_item2->termination->audio_stream,
- header_item1->termination->codec_manager,
- context->name,
- context->pool);
- }
- }
- return NULL;
-}
-
-static mpf_object_t* mpf_context_multiplier_create(mpf_context_t *context, apr_size_t i)
-{
- mpf_audio_stream_t **sink_arr;
- header_item_t *header_item1 = &context->header[i];
- header_item_t *header_item2;
- matrix_item_t *item;
- apr_size_t j,k;
- sink_arr = apr_palloc(context->pool,header_item1->tx_count * sizeof(mpf_audio_stream_t*));
- for(j=0,k=0; jcapacity && ktx_count; j++) {
- header_item2 = &context->header[j];
- if(!header_item2->termination) {
- continue;
- }
- item = &context->matrix[i][j];
- if(!item->on) {
- continue;
- }
- sink_arr[k] = header_item2->termination->audio_stream;
- k++;
- }
- return mpf_multiplier_create(
- header_item1->termination->audio_stream,
- sink_arr,
- header_item1->tx_count,
- header_item1->termination->codec_manager,
- context->name,
- context->pool);
-}
-
-static mpf_object_t* mpf_context_mixer_create(mpf_context_t *context, apr_size_t j)
-{
- mpf_audio_stream_t **source_arr;
- header_item_t *header_item1 = &context->header[j];
- header_item_t *header_item2;
- matrix_item_t *item;
- apr_size_t i,k;
- source_arr = apr_palloc(context->pool,header_item1->rx_count * sizeof(mpf_audio_stream_t*));
- for(i=0,k=0; icapacity && krx_count; i++) {
- header_item2 = &context->header[i];
- if(!header_item2->termination) {
- continue;
- }
- item = &context->matrix[i][j];
- if(!item->on) {
- continue;
- }
- source_arr[k] = header_item2->termination->audio_stream;
- k++;
- }
- return mpf_mixer_create(
- source_arr,
- header_item1->rx_count,
- header_item1->termination->audio_stream,
- header_item1->termination->codec_manager,
- context->name,
- context->pool);
-}
-
-static APR_INLINE apt_bool_t stream_direction_compatibility_check(mpf_termination_t *termination1, mpf_termination_t *termination2)
-{
- mpf_audio_stream_t *source = termination1->audio_stream;
- mpf_audio_stream_t *sink = termination2->audio_stream;
- if(source && (source->direction & STREAM_DIRECTION_RECEIVE) == STREAM_DIRECTION_RECEIVE &&
- sink && (sink->direction & STREAM_DIRECTION_SEND) == STREAM_DIRECTION_SEND) {
- return TRUE;
- }
- return FALSE;
-}
diff --git a/libs/unimrcp/libs/mpf/src/mpf_decoder.c b/libs/unimrcp/libs/mpf/src/mpf_decoder.c
deleted file mode 100644
index f27467101f..0000000000
--- a/libs/unimrcp/libs/mpf/src/mpf_decoder.c
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mpf_decoder.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include "mpf_decoder.h"
-#include "apt_log.h"
-
-typedef struct mpf_decoder_t mpf_decoder_t;
-
-struct mpf_decoder_t {
- mpf_audio_stream_t *base;
- mpf_audio_stream_t *source;
- mpf_codec_t *codec;
- mpf_frame_t frame_in;
-};
-
-
-static apt_bool_t mpf_decoder_destroy(mpf_audio_stream_t *stream)
-{
- mpf_decoder_t *decoder = stream->obj;
- return mpf_audio_stream_destroy(decoder->source);
-}
-
-static apt_bool_t mpf_decoder_open(mpf_audio_stream_t *stream, mpf_codec_t *codec)
-{
- mpf_decoder_t *decoder = stream->obj;
- mpf_codec_open(decoder->codec);
- return mpf_audio_stream_rx_open(decoder->source,decoder->codec);
-}
-
-static apt_bool_t mpf_decoder_close(mpf_audio_stream_t *stream)
-{
- mpf_decoder_t *decoder = stream->obj;
- mpf_codec_close(decoder->codec);
- return mpf_audio_stream_rx_close(decoder->source);
-}
-
-static apt_bool_t mpf_decoder_process(mpf_audio_stream_t *stream, mpf_frame_t *frame)
-{
- mpf_decoder_t *decoder = stream->obj;
- decoder->frame_in.type = MEDIA_FRAME_TYPE_NONE;
- decoder->frame_in.marker = MPF_MARKER_NONE;
- if(mpf_audio_stream_frame_read(decoder->source,&decoder->frame_in) != TRUE) {
- return FALSE;
- }
-
- frame->type = decoder->frame_in.type;
- frame->marker = decoder->frame_in.marker;
- if((frame->type & MEDIA_FRAME_TYPE_EVENT) == MEDIA_FRAME_TYPE_EVENT) {
- frame->event_frame = decoder->frame_in.event_frame;
- }
- if((frame->type & MEDIA_FRAME_TYPE_AUDIO) == MEDIA_FRAME_TYPE_AUDIO) {
- mpf_codec_decode(decoder->codec,&decoder->frame_in.codec_frame,&frame->codec_frame);
- }
- return TRUE;
-}
-
-static void mpf_decoder_trace(mpf_audio_stream_t *stream, mpf_stream_direction_e direction, apt_text_stream_t *output)
-{
- apr_size_t offset;
- mpf_codec_descriptor_t *descriptor;
- mpf_decoder_t *decoder = stream->obj;
-
- mpf_audio_stream_trace(decoder->source,direction,output);
-
- descriptor = decoder->base->rx_descriptor;
- if(descriptor) {
- offset = output->pos - output->text.buf;
- output->pos += apr_snprintf(output->pos, output->text.length - offset,
- "->Decoder->[%s/%d/%d]",
- descriptor->name.buf,
- descriptor->sampling_rate,
- descriptor->channel_count);
- }
-}
-
-static const mpf_audio_stream_vtable_t vtable = {
- mpf_decoder_destroy,
- mpf_decoder_open,
- mpf_decoder_close,
- mpf_decoder_process,
- NULL,
- NULL,
- NULL,
- mpf_decoder_trace
-};
-
-MPF_DECLARE(mpf_audio_stream_t*) mpf_decoder_create(mpf_audio_stream_t *source, mpf_codec_t *codec, apr_pool_t *pool)
-{
- apr_size_t frame_size;
- mpf_decoder_t *decoder;
- mpf_stream_capabilities_t *capabilities;
- if(!source || !codec) {
- return NULL;
- }
- decoder = apr_palloc(pool,sizeof(mpf_decoder_t));
- capabilities = mpf_stream_capabilities_create(STREAM_DIRECTION_RECEIVE,pool);
- decoder->base = mpf_audio_stream_create(decoder,&vtable,capabilities,pool);
- if(!decoder->base) {
- return NULL;
- }
- decoder->base->rx_descriptor = mpf_codec_lpcm_descriptor_create(
- source->rx_descriptor->sampling_rate,
- source->rx_descriptor->channel_count,
- pool);
- decoder->base->rx_event_descriptor = source->rx_event_descriptor;
-
- decoder->source = source;
- decoder->codec = codec;
-
- frame_size = mpf_codec_frame_size_calculate(source->rx_descriptor,codec->attribs);
- decoder->frame_in.codec_frame.size = frame_size;
- decoder->frame_in.codec_frame.buffer = apr_palloc(pool,frame_size);
- return decoder->base;
-}
diff --git a/libs/unimrcp/libs/mpf/src/mpf_dtmf_detector.c b/libs/unimrcp/libs/mpf/src/mpf_dtmf_detector.c
deleted file mode 100644
index 58ca1916fd..0000000000
--- a/libs/unimrcp/libs/mpf/src/mpf_dtmf_detector.c
+++ /dev/null
@@ -1,302 +0,0 @@
-/*
- * Copyright 2009-2010 Tomas Valenta, Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mpf_dtmf_detector.c 2227 2014-11-12 01:10:18Z achaloyan@gmail.com $
- */
-
-#include "mpf_dtmf_detector.h"
-#include "apr_thread_mutex.h"
-#include "apt_log.h"
-#include "mpf_named_event.h"
-#include
-
-#ifndef M_PI
-# define M_PI 3.141592653589793238462643
-#endif
-
-/** Max detected DTMF digits buffer length */
-#define MPF_DTMFDET_BUFFER_LEN 32
-
-/** Number of DTMF frequencies */
-#define DTMF_FREQUENCIES 8
-
-/** Window length in samples (at 8kHz) for Goertzel's frequency analysis */
-#define GOERTZEL_SAMPLES_8K 102
-
-/** See RFC4733 */
-#define DTMF_EVENT_ID_MAX 15 /* 0123456789*#ABCD */
-
-/**
- * Goertzel frequency detector (second-order IIR filter) state:
- *
- * s(t) = x(t) + coef * s(t-1) - s(t-2), where s(0)=0; s(1) = 0;
- * x(t) is the input signal
- *
- * Then energy of frequency f in the signal is:
- * X(f)X'(f) = s(t-2)^2 + s(t-1)^2 - coef*s(t-2)*s(t-1)
- */
-typedef struct goertzel_state_t {
- /** coef = cos(2*pi*f_tone/f_sampling) */
- double coef;
- /** s(t-2) or resulting energy @see goertzel_state_t */
- double s1;
- /** s(t-1) @see goertzel_state_t */
- double s2;
-} goertzel_state_t;
-
-/** DTMF frequencies */
-static const double dtmf_freqs[DTMF_FREQUENCIES] = {
- 697, 770, 852, 941, /* Row frequencies */
- 1209, 1336, 1477, 1633}; /* Col frequencies */
-
-/** [row, col] major frequency to digit mapping */
-static const char freq2digits[DTMF_FREQUENCIES/2][DTMF_FREQUENCIES/2] =
- { { '1', '2', '3', 'A' },
- { '4', '5', '6', 'B' },
- { '7', '8', '9', 'C' },
- { '*', '0', '#', 'D' } };
-
-/** Media Processing Framework's Dual Tone Multiple Frequncy detector */
-struct mpf_dtmf_detector_t {
- /** Mutex to guard the buffer */
- struct apr_thread_mutex_t *mutex;
- /** Recognizer band */
- enum mpf_dtmf_detector_band_e band;
- /** Detected digits buffer */
- char buf[MPF_DTMFDET_BUFFER_LEN+1];
- /** Number of digits in the buffer */
- apr_size_t digits;
- /** Number of lost digits due to full buffer */
- apr_size_t lost_digits;
- /** Frequency analyzators */
- struct goertzel_state_t energies[DTMF_FREQUENCIES];
- /** Total energy of signal */
- double totenergy;
- /** Number of samples in a window */
- apr_size_t wsamples;
- /** Number of samples processed */
- apr_size_t nsamples;
- /** Previously detected and last reported digits */
- char last1, last2, curr;
-};
-
-
-MPF_DECLARE(struct mpf_dtmf_detector_t *) mpf_dtmf_detector_create_ex(
- const struct mpf_audio_stream_t *stream,
- enum mpf_dtmf_detector_band_e band,
- struct apr_pool_t *pool)
-{
- apr_status_t status;
- struct mpf_dtmf_detector_t *det;
- int flg_band = band;
-
- if (!stream->tx_descriptor) flg_band &= ~MPF_DTMF_DETECTOR_INBAND;
-/*
- Event descriptor is not important actually
- if (!stream->tx_event_descriptor) flg_band &= ~MPF_DTMF_DETECTOR_OUTBAND;
-*/
- if (!flg_band) return NULL;
-
- det = apr_palloc(pool, sizeof(mpf_dtmf_detector_t));
- if (!det) return NULL;
- status = apr_thread_mutex_create(&det->mutex, APR_THREAD_MUTEX_DEFAULT, pool);
- if (status != APR_SUCCESS) return NULL;
-
- det->band = (enum mpf_dtmf_detector_band_e) flg_band;
- det->buf[0] = 0;
- det->digits = 0;
- det->lost_digits = 0;
-
- if (det->band & MPF_DTMF_DETECTOR_INBAND) {
- apr_size_t i;
- for (i = 0; i < DTMF_FREQUENCIES; i++) {
- det->energies[i].coef = 2 * cos(2 * M_PI * dtmf_freqs[i] /
- stream->tx_descriptor->sampling_rate);
- det->energies[i].s1 = 0;
- det->energies[i].s2 = 0;
- }
- det->nsamples = 0;
- det->wsamples = GOERTZEL_SAMPLES_8K * (stream->tx_descriptor->sampling_rate / 8000);
- det->last1 = det->last2 = det->curr = 0;
- det->totenergy = 0;
- }
-
- return det;
-}
-
-MPF_DECLARE(char) mpf_dtmf_detector_digit_get(struct mpf_dtmf_detector_t *detector)
-{
- char digit;
- apr_thread_mutex_lock(detector->mutex);
- digit = detector->buf[0];
- if (digit) {
- memmove(detector->buf, detector->buf + 1, strlen(detector->buf));
- detector->digits--;
- }
- apr_thread_mutex_unlock(detector->mutex);
- return digit;
-}
-
-MPF_DECLARE(apr_size_t) mpf_dtmf_detector_digits_lost(const struct mpf_dtmf_detector_t *detector)
-{
- return detector->lost_digits;
-}
-
-MPF_DECLARE(void) mpf_dtmf_detector_reset(struct mpf_dtmf_detector_t *detector)
-{
- apr_thread_mutex_lock(detector->mutex);
- detector->buf[0] = 0;
- detector->lost_digits = 0;
- detector->digits = 0;
- detector->curr = detector->last1 = detector->last2 = 0;
- detector->nsamples = 0;
- detector->totenergy = 0;
- apr_thread_mutex_unlock(detector->mutex);
-}
-
-static APR_INLINE void mpf_dtmf_detector_add_digit(
- struct mpf_dtmf_detector_t *detector,
- char digit)
-{
- if (!digit) return;
- apr_thread_mutex_lock(detector->mutex);
- if (detector->digits < MPF_DTMFDET_BUFFER_LEN) {
- detector->buf[detector->digits++] = digit;
- detector->buf[detector->digits] = 0;
- } else
- detector->lost_digits++;
- apr_thread_mutex_unlock(detector->mutex);
-}
-
-static APR_INLINE void goertzel_sample(
- struct mpf_dtmf_detector_t *detector,
- apr_int16_t sample)
-{
- apr_size_t i;
- double s;
- for (i = 0; i < DTMF_FREQUENCIES; i++) {
- s = detector->energies[i].s1;
- detector->energies[i].s1 = detector->energies[i].s2;
- detector->energies[i].s2 = sample +
- detector->energies[i].coef * detector->energies[i].s1 - s;
- }
- detector->totenergy += sample * sample;
-}
-
-static void goertzel_energies_digit(struct mpf_dtmf_detector_t *detector)
-{
- apr_size_t i, rmax = 0, cmax = 0;
- double reng = 0, ceng = 0;
- char digit = 0;
-
- /* Calculate energies and maxims */
- for (i = 0; i < DTMF_FREQUENCIES; i++) {
- double eng = detector->energies[i].s1 * detector->energies[i].s1 +
- detector->energies[i].s2 * detector->energies[i].s2 -
- detector->energies[i].coef * detector->energies[i].s1 * detector->energies[i].s2;
- if (i < DTMF_FREQUENCIES/2) {
- if (eng > reng) {
- rmax = i;
- reng = eng;
- }
- } else {
- if (eng > ceng) {
- cmax = i;
- ceng = eng;
- }
- }
- }
-
- if ((reng < 8.0e10 * detector->wsamples / GOERTZEL_SAMPLES_8K) ||
- (ceng < 8.0e10 * detector->wsamples / GOERTZEL_SAMPLES_8K))
- {
- /* energy not high enough */
- } else if ((ceng > reng) && (reng < ceng * 0.398)) { /* twist > 4dB, error */
- /* Twist check
- * CEPT => twist < 6dB
- * AT&T => forward twist < 4dB and reverse twist < 8dB
- * -ndB < 10 log10( v1 / v2 ), where v1 < v2
- * -4dB < 10 log10( v1 / v2 )
- * -0.4 < log10( v1 / v2 )
- * 0.398 < v1 / v2
- * 0.398 * v2 < v1
- */
- } else if ((ceng < reng) && (ceng < reng * 0.158)) { /* twist > 8db, error */
- /* Reverse twist check failed */
- } else if (0.25 * detector->totenergy > (reng + ceng)) { /* 16db */
- /* Signal energy to total energy ratio test failed */
- } else {
- if (cmax >= DTMF_FREQUENCIES/2 && cmax < DTMF_FREQUENCIES)
- digit = freq2digits[rmax][cmax - DTMF_FREQUENCIES/2];
- }
-
- /* Three successive detections will trigger the detection */
- if (digit != detector->curr) {
- if (digit && ((detector->last1 == digit) && (detector->last2 == digit))) {
- detector->curr = digit;
- mpf_dtmf_detector_add_digit(detector, digit);
- } else if ((detector->last1 != detector->curr) && (detector->last2 != detector->curr)) {
- detector->curr = 0;
- }
- }
- detector->last1 = detector->last2;
- detector->last2 = digit;
-
- /* Reset Goertzel's detectors */
- for (i = 0; i < DTMF_FREQUENCIES; i++) {
- detector->energies[i].s1 = 0;
- detector->energies[i].s2 = 0;
- }
- detector->totenergy = 0;
-}
-
-MPF_DECLARE(void) mpf_dtmf_detector_get_frame(
- struct mpf_dtmf_detector_t *detector,
- const struct mpf_frame_t *frame)
-{
- if ((detector->band & MPF_DTMF_DETECTOR_OUTBAND) &&
- (frame->type & MEDIA_FRAME_TYPE_EVENT) &&
- (frame->event_frame.event_id <= DTMF_EVENT_ID_MAX) &&
- (frame->marker == MPF_MARKER_START_OF_EVENT))
- {
- if (detector->band & MPF_DTMF_DETECTOR_INBAND) {
- detector->band &= ~MPF_DTMF_DETECTOR_INBAND;
- apt_log(APT_LOG_MARK, APT_PRIO_INFO, "Out-of-band digit arrived, turning "
- "in-band DTMF detector off");
- }
- mpf_dtmf_detector_add_digit(detector, mpf_event_id_to_dtmf_char(
- frame->event_frame.event_id));
- return;
- }
-
- if ((detector->band & MPF_DTMF_DETECTOR_INBAND) && (frame->type & MEDIA_FRAME_TYPE_AUDIO)) {
- apr_int16_t *samples = frame->codec_frame.buffer;
- apr_size_t i;
-
- for (i = 0; i < frame->codec_frame.size / 2; i++) {
- goertzel_sample(detector, samples[i]);
- if (++detector->nsamples >= detector->wsamples) {
- goertzel_energies_digit(detector);
- detector->nsamples = 0;
- }
- }
- }
-}
-
-MPF_DECLARE(void) mpf_dtmf_detector_destroy(struct mpf_dtmf_detector_t *detector)
-{
- apr_thread_mutex_destroy(detector->mutex);
- detector->mutex = NULL;
-}
diff --git a/libs/unimrcp/libs/mpf/src/mpf_dtmf_generator.c b/libs/unimrcp/libs/mpf/src/mpf_dtmf_generator.c
deleted file mode 100644
index b4671adaf1..0000000000
--- a/libs/unimrcp/libs/mpf/src/mpf_dtmf_generator.c
+++ /dev/null
@@ -1,349 +0,0 @@
-/*
- * Copyright 2009-2010 Tomas Valenta, Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mpf_dtmf_generator.c 2227 2014-11-12 01:10:18Z achaloyan@gmail.com $
- */
-
-#include "mpf_dtmf_generator.h"
-#include "apr.h"
-#include "apr_thread_mutex.h"
-#include "apt_log.h"
-#include "mpf_named_event.h"
-#include
-
-#ifndef M_PI
-# define M_PI 3.141592653589793238462643
-#endif
-
-/** Max DTMF digits waiting to be sent */
-#define MPF_DTMFGEN_QUEUE_LEN 32
-
-/** See RFC4733 */
-#define DTMF_EVENT_ID_MAX 15 /* 0123456789*#ABCD */
-
-/** See RFC4733 */
-#define DTMF_EVENT_VOLUME 10
-
-/** Amplitude of single sine wave from tone generator */
-#define DTMF_SINE_AMPLITUDE 12288
-
-/** State of the DTMF generator */
-typedef enum mpf_dtmf_generator_state_e {
- /** Ready to generate next digit in queue */
- DTMF_GEN_STATE_IDLE,
- /** Generating tone */
- DTMF_GEN_STATE_TONE,
- /** Retransmitting final RTP packet */
- DTMF_GEN_STATE_ENDING,
- /** Generating silence between tones */
- DTMF_GEN_STATE_SILENCE
-} mpf_dtmf_generator_state_e;
-
-/**
- * Sine wave generator (second-order IIR filter) state:
- *
- * s(t) = Amp*sin(2*pi*f_tone/f_sampling*t)
- *
- * s(t) = coef * s(t-1) - s(t-2); s(0)=0; s(1)=Amp*sin(2*pi*f_tone/f_sampling)
- */
-typedef struct sine_state_t {
- /** coef = cos(2*pi*f_tone/f_sampling) */
- double coef;
- /** s(t-2) @see sine_state_t */
- double s1;
- /** s(t-1) @see sine_state_t */
- double s2;
-} sine_state_t;
-
-/** Mapping event_id to frequency pair */
-static const double dtmf_freq[DTMF_EVENT_ID_MAX+1][2] = {
- {941, 1336}, /* 0 */
- {697, 1209}, /* 1 */
- {697, 1336}, /* 2 */
- {697, 1477}, /* 3 */
- {770, 1209}, /* 4 */
- {770, 1336}, /* 5 */
- {770, 1477}, /* 6 */
- {852, 1209}, /* 7 */
- {852, 1336}, /* 8 */
- {852, 1477}, /* 9 */
- {941, 1209}, /* * */
- {941, 1477}, /* # */
- {697, 1633}, /* A */
- {770, 1633}, /* B */
- {852, 1633}, /* C */
- {941, 1633} /* D */
-};
-
-/** Media Processing Framework's Dual Tone Multiple Frequncy generator */
-struct mpf_dtmf_generator_t {
- /** Generator state */
- enum mpf_dtmf_generator_state_e state;
- /** In-band or out-of-band */
- enum mpf_dtmf_generator_band_e band;
- /** Mutex to guard the queue */
- struct apr_thread_mutex_t *mutex;
- /** Queue of digits to generate */
- char queue[MPF_DTMFGEN_QUEUE_LEN+1];
- /** DTMF event_id according to RFC4733 */
- apr_byte_t event_id;
- /** Duration in RTP units: (sample_rate / 1000) * milliseconds */
- apr_uint32_t tone_duration;
- /** Duration of inter-digit silence @see tone_duration */
- apr_uint32_t silence_duration;
- /** Multipurpose counter; mostly in RTP time units */
- apr_uint32_t counter;
- /** Frame duration in RTP units */
- apr_uint32_t frame_duration;
- /** RTP named event duration (0..0xFFFF) */
- apr_uint32_t event_duration;
- /** Set MPF_MARKER_NEW_SEGMENT in the next event frame */
- apt_bool_t new_segment;
- /** Lower frequency generator */
- struct sine_state_t sine1;
- /** Higher frequency generator */
- struct sine_state_t sine2;
- /** Sampling rate of audio in Hz; used in tone generator */
- apr_uint32_t sample_rate_audio;
- /** Sampling rate of telephone-events in Hz; used for timing */
- apr_uint32_t sample_rate_events;
- /** How often to issue event packet */
- apr_uint32_t events_ptime;
- /** Milliseconds elapsed since last event packet */
- apr_uint32_t since_last_event;
-};
-
-
-MPF_DECLARE(struct mpf_dtmf_generator_t *) mpf_dtmf_generator_create_ex(
- const struct mpf_audio_stream_t *stream,
- enum mpf_dtmf_generator_band_e band,
- apr_uint32_t tone_ms,
- apr_uint32_t silence_ms,
- struct apr_pool_t *pool)
-{
- struct mpf_dtmf_generator_t *gen;
- apr_status_t status;
- int flg_band = band;
-
- if (!stream->rx_descriptor) flg_band &= ~MPF_DTMF_GENERATOR_INBAND;
- if (!stream->rx_event_descriptor) flg_band &= ~MPF_DTMF_GENERATOR_OUTBAND;
- if (!flg_band) return NULL;
-
- gen = apr_palloc(pool, sizeof(struct mpf_dtmf_generator_t));
- if (!gen) return NULL;
- status = apr_thread_mutex_create(&gen->mutex, APR_THREAD_MUTEX_DEFAULT, pool);
- if (status != APR_SUCCESS) return NULL;
- gen->band = (enum mpf_dtmf_generator_band_e) flg_band;
- gen->queue[0] = 0;
- gen->state = DTMF_GEN_STATE_IDLE;
- if (stream->rx_descriptor)
- gen->sample_rate_audio = stream->rx_descriptor->sampling_rate;
- gen->sample_rate_events = stream->rx_event_descriptor ?
- stream->rx_event_descriptor->sampling_rate : gen->sample_rate_audio;
- gen->frame_duration = gen->sample_rate_events / 1000 * CODEC_FRAME_TIME_BASE;
- gen->tone_duration = gen->sample_rate_events / 1000 * tone_ms;
- gen->silence_duration = gen->sample_rate_events / 1000 * silence_ms;
- gen->events_ptime = CODEC_FRAME_TIME_BASE; /* Should be got from event_descriptor */
- return gen;
-}
-
-
-MPF_DECLARE(apt_bool_t) mpf_dtmf_generator_enqueue(
- struct mpf_dtmf_generator_t *generator,
- const char *digits)
-{
- apr_size_t qlen, dlen;
- apt_bool_t ret;
-
- dlen = strlen(digits);
- apr_thread_mutex_lock(generator->mutex);
- qlen = strlen(generator->queue);
- if (qlen + dlen > MPF_DTMFGEN_QUEUE_LEN) {
- ret = FALSE;
- apt_log(APT_LOG_MARK, APT_PRIO_WARNING, "DTMF queue too short (%d), "
- "cannot add %"APR_SIZE_T_FMT" digit%s, already has %"APR_SIZE_T_FMT,
- MPF_DTMFGEN_QUEUE_LEN, dlen, dlen > 1 ? "s" : "", qlen);
- } else {
- strcpy(generator->queue + qlen, digits);
- ret = TRUE;
- }
- apr_thread_mutex_unlock(generator->mutex);
- return ret;
-}
-
-
-MPF_DECLARE(void) mpf_dtmf_generator_reset(struct mpf_dtmf_generator_t *generator)
-{
- apr_thread_mutex_lock(generator->mutex);
- generator->state = DTMF_GEN_STATE_IDLE;
- generator->queue[0] = 0;
- apr_thread_mutex_unlock(generator->mutex);
-}
-
-
-MPF_DECLARE(apt_bool_t) mpf_dtmf_generator_sending(const struct mpf_dtmf_generator_t *generator)
-{
- return *generator->queue || ((generator->state != DTMF_GEN_STATE_IDLE) &&
- (generator->state != DTMF_GEN_STATE_SILENCE));
-}
-
-
-MPF_DECLARE(apt_bool_t) mpf_dtmf_generator_put_frame(
- struct mpf_dtmf_generator_t *generator,
- struct mpf_frame_t *frame)
-{
- apr_thread_mutex_lock(generator->mutex);
- if ((generator->state == DTMF_GEN_STATE_IDLE) && *generator->queue) {
- /* Get next valid digit from queue */
- do {
- generator->event_id = (apr_byte_t) mpf_dtmf_char_to_event_id(*generator->queue);
- memmove(generator->queue, generator->queue + 1, strlen(generator->queue));
- } while (*generator->queue && (generator->event_id > DTMF_EVENT_ID_MAX));
- /* Reset state */
- if (generator->event_id <= DTMF_EVENT_ID_MAX) {
- generator->state = DTMF_GEN_STATE_TONE;
- generator->counter = 0;
- generator->event_duration = 0;
- generator->since_last_event = generator->events_ptime;
- generator->new_segment = FALSE;
- /* Initialize tone generator */
- if (generator->band & MPF_DTMF_GENERATOR_INBAND) {
- double omega;
-
- omega = 2 * M_PI * dtmf_freq[generator->event_id][0] / generator->sample_rate_audio;
- generator->sine1.s1 = 0;
- generator->sine1.s2 = DTMF_SINE_AMPLITUDE * sin(omega);
- generator->sine1.coef = 2 * cos(omega);
-
- omega = 2 * M_PI * dtmf_freq[generator->event_id][1] / generator->sample_rate_audio;
- generator->sine2.s1 = 0;
- generator->sine2.s2 = DTMF_SINE_AMPLITUDE * sin(omega);
- generator->sine2.coef = 2 * cos(omega);
- }
- }
- }
- apr_thread_mutex_unlock(generator->mutex);
- if (generator->state == DTMF_GEN_STATE_IDLE) return FALSE;
-
- if (generator->state == DTMF_GEN_STATE_TONE) {
- generator->counter += generator->frame_duration;
- generator->event_duration += generator->frame_duration;
- if (generator->band & MPF_DTMF_GENERATOR_INBAND) {
- apr_size_t i;
- apr_int16_t *samples = (apr_int16_t *) frame->codec_frame.buffer;
- double s;
-
- frame->type |= MEDIA_FRAME_TYPE_AUDIO;
- /* Tone generator */
- for (i = 0; i < frame->codec_frame.size / 2; i++) {
- s = generator->sine1.s1;
- generator->sine1.s1 = generator->sine1.s2;
- generator->sine1.s2 = generator->sine1.coef * generator->sine1.s1 - s;
- samples[i] = (apr_int16_t) (s + generator->sine2.s1);
- s = generator->sine2.s1;
- generator->sine2.s1 = generator->sine2.s2;
- generator->sine2.s2 = generator->sine2.coef * generator->sine2.s1 - s;
- }
- }
- if (generator->band & MPF_DTMF_GENERATOR_OUTBAND) {
- generator->since_last_event += CODEC_FRAME_TIME_BASE;
- if (generator->since_last_event >= generator->events_ptime)
- generator->since_last_event = 0;
- else
- return TRUE;
- frame->type |= MEDIA_FRAME_TYPE_EVENT;
- frame->event_frame.reserved = 0;
- frame->event_frame.event_id = generator->event_id;
- frame->event_frame.volume = DTMF_EVENT_VOLUME;
- if (generator->counter >= generator->tone_duration) {
- generator->state = DTMF_GEN_STATE_ENDING;
- generator->counter = 0;
- frame->event_frame.edge = 1;
- frame->marker = MPF_MARKER_END_OF_EVENT;
- if (generator->event_duration > 0xFFFF) {
- /* Shorten the tone a bit instead of lenghtening */
- generator->new_segment = TRUE;
- frame->event_frame.duration = 0xFFFF;
- generator->event_duration = 0;
- } else
- frame->event_frame.duration = generator->event_duration;
- } else {
- frame->event_frame.edge = 0;
- if (generator->counter == generator->frame_duration) /* First chunk of event */
- frame->marker = MPF_MARKER_START_OF_EVENT;
- else if (generator->new_segment) {
- frame->marker = MPF_MARKER_NEW_SEGMENT;
- generator->new_segment = FALSE;
- } else
- frame->marker = MPF_MARKER_NONE;
- if (generator->event_duration > 0xFFFF) {
- frame->event_frame.duration = 0xFFFF;
- generator->event_duration = 0;
- generator->new_segment = TRUE;
- } else
- frame->event_frame.duration = generator->event_duration;
- }
- return TRUE;
- } /* MPF_DTMF_GENERATOR_OUTBAND */
- if (generator->counter >= generator->tone_duration) {
- generator->state = DTMF_GEN_STATE_SILENCE;
- generator->counter = 0;
- }
- return TRUE;
- }
- else if (generator->state == DTMF_GEN_STATE_ENDING) {
- generator->since_last_event += CODEC_FRAME_TIME_BASE;
- if (generator->since_last_event >= generator->events_ptime)
- generator->since_last_event = 0;
- else
- return TRUE;
- generator->counter++;
- frame->type |= MEDIA_FRAME_TYPE_EVENT;
- frame->marker = MPF_MARKER_END_OF_EVENT;
- frame->event_frame.event_id = generator->event_id;
- frame->event_frame.volume = DTMF_EVENT_VOLUME;
- frame->event_frame.reserved = 0;
- frame->event_frame.edge = 1;
- if (generator->new_segment)
- /* Tone was shortened a little bit */
- frame->event_frame.duration = 0xFFFF;
- else
- frame->event_frame.duration = generator->event_duration;
- if (generator->counter >= 2) {
- generator->state = DTMF_GEN_STATE_SILENCE;
- generator->counter *= generator->frame_duration;
- }
- if (generator->band & MPF_DTMF_GENERATOR_INBAND) {
- frame->type |= MEDIA_FRAME_TYPE_AUDIO;
- memset(frame->codec_frame.buffer, 0, frame->codec_frame.size);
- }
- return TRUE;
- }
- else if (generator->state == DTMF_GEN_STATE_SILENCE) {
- generator->counter += generator->frame_duration;
- if (generator->counter >= generator->silence_duration)
- generator->state = DTMF_GEN_STATE_IDLE;
- }
-
- return FALSE;
-}
-
-
-MPF_DECLARE(void) mpf_dtmf_generator_destroy(struct mpf_dtmf_generator_t *generator)
-{
- mpf_dtmf_generator_reset(generator);
- apr_thread_mutex_destroy(generator->mutex);
- generator->mutex = NULL;
-}
diff --git a/libs/unimrcp/libs/mpf/src/mpf_encoder.c b/libs/unimrcp/libs/mpf/src/mpf_encoder.c
deleted file mode 100644
index cd5837725e..0000000000
--- a/libs/unimrcp/libs/mpf/src/mpf_encoder.c
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mpf_encoder.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include "mpf_encoder.h"
-#include "apt_log.h"
-
-typedef struct mpf_encoder_t mpf_encoder_t;
-
-struct mpf_encoder_t {
- mpf_audio_stream_t *base;
- mpf_audio_stream_t *sink;
- mpf_codec_t *codec;
- mpf_frame_t frame_out;
-};
-
-
-static apt_bool_t mpf_encoder_destroy(mpf_audio_stream_t *stream)
-{
- mpf_encoder_t *encoder = stream->obj;
- return mpf_audio_stream_destroy(encoder->sink);
-}
-
-static apt_bool_t mpf_encoder_open(mpf_audio_stream_t *stream, mpf_codec_t *codec)
-{
- mpf_encoder_t *encoder = stream->obj;
- mpf_codec_open(encoder->codec);
- return mpf_audio_stream_tx_open(encoder->sink,encoder->codec);
-}
-
-static apt_bool_t mpf_encoder_close(mpf_audio_stream_t *stream)
-{
- mpf_encoder_t *encoder = stream->obj;
- mpf_codec_close(encoder->codec);
- return mpf_audio_stream_tx_close(encoder->sink);
-}
-
-static apt_bool_t mpf_encoder_process(mpf_audio_stream_t *stream, const mpf_frame_t *frame)
-{
- mpf_encoder_t *encoder = stream->obj;
-
- encoder->frame_out.type = frame->type;
- encoder->frame_out.marker = frame->marker;
- if((frame->type & MEDIA_FRAME_TYPE_EVENT) == MEDIA_FRAME_TYPE_EVENT) {
- encoder->frame_out.event_frame = frame->event_frame;
- }
- if((frame->type & MEDIA_FRAME_TYPE_AUDIO) == MEDIA_FRAME_TYPE_AUDIO) {
- mpf_codec_encode(encoder->codec,&frame->codec_frame,&encoder->frame_out.codec_frame);
- }
- return mpf_audio_stream_frame_write(encoder->sink,&encoder->frame_out);
-}
-
-static void mpf_encoder_trace(mpf_audio_stream_t *stream, mpf_stream_direction_e direction, apt_text_stream_t *output)
-{
- apr_size_t offset;
- mpf_codec_descriptor_t *descriptor;
- mpf_encoder_t *encoder = stream->obj;
-
- descriptor = encoder->base->tx_descriptor;
- if(descriptor) {
- offset = output->pos - output->text.buf;
- output->pos += apr_snprintf(output->pos, output->text.length - offset,
- "[%s/%d/%d]->Encoder->",
- descriptor->name.buf,
- descriptor->sampling_rate,
- descriptor->channel_count);
- }
-
- mpf_audio_stream_trace(encoder->sink,direction,output);
-}
-
-
-static const mpf_audio_stream_vtable_t vtable = {
- mpf_encoder_destroy,
- NULL,
- NULL,
- NULL,
- mpf_encoder_open,
- mpf_encoder_close,
- mpf_encoder_process,
- mpf_encoder_trace
-};
-
-MPF_DECLARE(mpf_audio_stream_t*) mpf_encoder_create(mpf_audio_stream_t *sink, mpf_codec_t *codec, apr_pool_t *pool)
-{
- apr_size_t frame_size;
- mpf_encoder_t *encoder;
- mpf_stream_capabilities_t *capabilities;
- if(!sink || !codec) {
- return NULL;
- }
- encoder = apr_palloc(pool,sizeof(mpf_encoder_t));
- capabilities = mpf_stream_capabilities_create(STREAM_DIRECTION_SEND,pool);
- encoder->base = mpf_audio_stream_create(encoder,&vtable,capabilities,pool);
- if(!encoder->base) {
- return NULL;
- }
- encoder->base->tx_descriptor = mpf_codec_lpcm_descriptor_create(
- sink->tx_descriptor->sampling_rate,
- sink->tx_descriptor->channel_count,
- pool);
- encoder->base->tx_event_descriptor = sink->tx_event_descriptor;
-
- encoder->sink = sink;
- encoder->codec = codec;
-
- frame_size = mpf_codec_frame_size_calculate(sink->tx_descriptor,codec->attribs);
- encoder->frame_out.codec_frame.size = frame_size;
- encoder->frame_out.codec_frame.buffer = apr_palloc(pool,frame_size);
- return encoder->base;
-}
diff --git a/libs/unimrcp/libs/mpf/src/mpf_engine.c b/libs/unimrcp/libs/mpf/src/mpf_engine.c
deleted file mode 100644
index 60240cb9bb..0000000000
--- a/libs/unimrcp/libs/mpf/src/mpf_engine.c
+++ /dev/null
@@ -1,453 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mpf_engine.c 2226 2014-11-12 00:47:40Z achaloyan@gmail.com $
- */
-
-#include "mpf_engine.h"
-#include "mpf_context.h"
-#include "mpf_termination.h"
-#include "mpf_stream.h"
-#include "mpf_scheduler.h"
-#include "mpf_codec_descriptor.h"
-#include "mpf_codec_manager.h"
-#include "apt_obj_list.h"
-#include "apt_cyclic_queue.h"
-#include "apt_log.h"
-
-#define MPF_TIMER_RESOLUTION 100 /* 100 ms */
-
-struct mpf_engine_t {
- apr_pool_t *pool;
- apt_task_t *task;
- apt_task_msg_type_e task_msg_type;
- apr_thread_mutex_t *request_queue_guard;
- apt_cyclic_queue_t *request_queue;
- mpf_context_factory_t *context_factory;
- mpf_scheduler_t *scheduler;
- apt_timer_queue_t *timer_queue;
- const mpf_codec_manager_t *codec_manager;
-};
-
-static void mpf_engine_main(mpf_scheduler_t *scheduler, void *obj);
-static void mpf_engine_timer_proc(mpf_scheduler_t *scheduler, void *obj);
-static apt_bool_t mpf_engine_destroy(apt_task_t *task);
-static apt_bool_t mpf_engine_start(apt_task_t *task);
-static apt_bool_t mpf_engine_terminate(apt_task_t *task);
-static apt_bool_t mpf_engine_msg_signal(apt_task_t *task, apt_task_msg_t *msg);
-static apt_bool_t mpf_engine_msg_process(apt_task_t *task, apt_task_msg_t *msg);
-
-
-mpf_codec_t* mpf_codec_l16_create(apr_pool_t *pool);
-mpf_codec_t* mpf_codec_g711u_create(apr_pool_t *pool);
-mpf_codec_t* mpf_codec_g711a_create(apr_pool_t *pool);
-
-MPF_DECLARE(mpf_engine_t*) mpf_engine_create(const char *id, apr_pool_t *pool)
-{
- apt_task_vtable_t *vtable;
- apt_task_msg_pool_t *msg_pool;
- mpf_engine_t *engine = apr_palloc(pool,sizeof(mpf_engine_t));
- engine->pool = pool;
- engine->request_queue = NULL;
- engine->context_factory = NULL;
- engine->codec_manager = NULL;
-
- msg_pool = apt_task_msg_pool_create_dynamic(sizeof(mpf_message_container_t),pool);
-
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create Media Engine [%s]",id);
- engine->task = apt_task_create(engine,msg_pool,pool);
- if(!engine->task) {
- return NULL;
- }
-
- apt_task_name_set(engine->task,id);
-
- vtable = apt_task_vtable_get(engine->task);
- if(vtable) {
- vtable->destroy = mpf_engine_destroy;
- vtable->start = mpf_engine_start;
- vtable->terminate = mpf_engine_terminate;
- vtable->signal_msg = mpf_engine_msg_signal;
- vtable->process_msg = mpf_engine_msg_process;
- }
-
- engine->task_msg_type = TASK_MSG_USER;
-
- engine->context_factory = mpf_context_factory_create(engine->pool);
- engine->request_queue = apt_cyclic_queue_create(CYCLIC_QUEUE_DEFAULT_SIZE);
- apr_thread_mutex_create(&engine->request_queue_guard,APR_THREAD_MUTEX_UNNESTED,engine->pool);
-
- engine->scheduler = mpf_scheduler_create(engine->pool);
- mpf_scheduler_media_clock_set(engine->scheduler,CODEC_FRAME_TIME_BASE,mpf_engine_main,engine);
-
- engine->timer_queue = apt_timer_queue_create(engine->pool);
- mpf_scheduler_timer_clock_set(engine->scheduler,MPF_TIMER_RESOLUTION,mpf_engine_timer_proc,engine);
- return engine;
-}
-
-MPF_DECLARE(mpf_context_t*) mpf_engine_context_create(
- mpf_engine_t *engine,
- const char *name,
- void *obj,
- apr_size_t max_termination_count,
- apr_pool_t *pool)
-{
- return mpf_context_create(engine->context_factory,name,obj,max_termination_count,pool);
-}
-
-MPF_DECLARE(apt_bool_t) mpf_engine_context_destroy(mpf_context_t *context)
-{
- return mpf_context_destroy(context);
-}
-
-MPF_DECLARE(void*) mpf_engine_context_object_get(const mpf_context_t *context)
-{
- return mpf_context_object_get(context);
-}
-
-MPF_DECLARE(apt_task_t*) mpf_task_get(const mpf_engine_t *engine)
-{
- return engine->task;
-}
-
-MPF_DECLARE(void) mpf_engine_task_msg_type_set(mpf_engine_t *engine, apt_task_msg_type_e type)
-{
- engine->task_msg_type = type;
-}
-
-static mpf_message_t* mpf_engine_message_get(mpf_engine_t *engine, mpf_task_msg_t **task_msg)
-{
- mpf_message_container_t *container;
- mpf_message_t *mpf_message;
- if(*task_msg) {
- container = (mpf_message_container_t*) (*task_msg)->data;
- if(container->count >= MAX_MPF_MESSAGE_COUNT) {
- /* container has been already filled,
- implicitly send the requests and get new task message */
- mpf_engine_message_send(engine,task_msg);
- return mpf_engine_message_get(engine,task_msg);
- }
- }
- else {
- *task_msg = apt_task_msg_get(engine->task);
- container = (mpf_message_container_t*) (*task_msg)->data;
- container->count = 0;
- }
-
- mpf_message = &container->messages[container->count];
- container->count++;
- return mpf_message;
-}
-
-
-MPF_DECLARE(apt_bool_t) mpf_engine_termination_message_add(
- mpf_engine_t *engine,
- mpf_command_type_e command_id,
- mpf_context_t *context,
- mpf_termination_t *termination,
- void *descriptor,
- mpf_task_msg_t **task_msg)
-{
- mpf_message_t *mpf_message = mpf_engine_message_get(engine,task_msg);
- if(!mpf_message) {
- return FALSE;
- }
- mpf_message->message_type = MPF_MESSAGE_TYPE_REQUEST;
- mpf_message->command_id = command_id;
- mpf_message->context = context;
- mpf_message->termination = termination;
- mpf_message->assoc_termination = NULL;
- mpf_message->descriptor = descriptor;
- return TRUE;
-}
-
-MPF_DECLARE(apt_bool_t) mpf_engine_assoc_message_add(
- mpf_engine_t *engine,
- mpf_command_type_e command_id,
- mpf_context_t *context,
- mpf_termination_t *termination,
- mpf_termination_t *assoc_termination,
- mpf_task_msg_t **task_msg)
-{
- mpf_message_t *mpf_message = mpf_engine_message_get(engine,task_msg);
- if(!mpf_message) {
- return FALSE;
- }
- mpf_message->message_type = MPF_MESSAGE_TYPE_REQUEST;
- mpf_message->command_id = command_id;
- mpf_message->context = context;
- mpf_message->termination = termination;
- mpf_message->assoc_termination = assoc_termination;
- mpf_message->descriptor = NULL;
- return TRUE;
-}
-
-MPF_DECLARE(apt_bool_t) mpf_engine_topology_message_add(
- mpf_engine_t *engine,
- mpf_command_type_e command_id,
- mpf_context_t *context,
- mpf_task_msg_t **task_msg)
-{
- mpf_message_t *mpf_message = mpf_engine_message_get(engine,task_msg);
- if(!mpf_message) {
- return FALSE;
- }
- mpf_message->message_type = MPF_MESSAGE_TYPE_REQUEST;
- mpf_message->command_id = command_id;
- mpf_message->context = context;
- mpf_message->termination = NULL;
- mpf_message->assoc_termination = NULL;
- mpf_message->descriptor = NULL;
- return TRUE;
-}
-
-MPF_DECLARE(apt_bool_t) mpf_engine_message_send(mpf_engine_t *engine, mpf_task_msg_t **task_msg)
-{
- apt_bool_t status = FALSE;
- if(*task_msg) {
- status = apt_task_msg_signal(engine->task,*task_msg);
- *task_msg = NULL;
- }
- return status;
-}
-
-static apt_bool_t mpf_engine_destroy(apt_task_t *task)
-{
- mpf_engine_t *engine = apt_task_object_get(task);
-
- apt_timer_queue_destroy(engine->timer_queue);
- mpf_scheduler_destroy(engine->scheduler);
- mpf_context_factory_destroy(engine->context_factory);
- apt_cyclic_queue_destroy(engine->request_queue);
- apr_thread_mutex_destroy(engine->request_queue_guard);
- return TRUE;
-}
-
-static apt_bool_t mpf_engine_start(apt_task_t *task)
-{
- mpf_engine_t *engine = apt_task_object_get(task);
-
- mpf_scheduler_start(engine->scheduler);
- apt_task_start_request_process(task);
- return TRUE;
-}
-
-static apt_bool_t mpf_engine_terminate(apt_task_t *task)
-{
- mpf_engine_t *engine = apt_task_object_get(task);
-
- mpf_scheduler_stop(engine->scheduler);
- apt_task_terminate_request_process(task);
- return TRUE;
-}
-
-static apt_bool_t mpf_engine_event_raise(mpf_termination_t *termination, int event_id, void *descriptor)
-{
- apt_task_msg_t *task_msg;
- mpf_message_container_t *event_msg;
- mpf_message_t *mpf_message;
- mpf_engine_t *engine;
- engine = termination->media_engine;
- if(!engine) {
- return FALSE;
- }
-
- task_msg = apt_task_msg_get(engine->task);
- if(!task_msg) {
- return FALSE;
- }
- task_msg->type = engine->task_msg_type;
- event_msg = (mpf_message_container_t*) task_msg->data;
- mpf_message = event_msg->messages;
- event_msg->count = 1;
-
- mpf_message->command_id = event_id;
- mpf_message->message_type = MPF_MESSAGE_TYPE_EVENT;
- mpf_message->status_code = MPF_STATUS_CODE_SUCCESS;
- mpf_message->context = NULL;
- mpf_message->termination = termination;
- mpf_message->descriptor = descriptor;
-
- return apt_task_msg_parent_signal(engine->task,task_msg);
-}
-
-static apt_bool_t mpf_engine_msg_signal(apt_task_t *task, apt_task_msg_t *msg)
-{
- mpf_engine_t *engine = apt_task_object_get(task);
-
- apr_thread_mutex_lock(engine->request_queue_guard);
- if(apt_cyclic_queue_push(engine->request_queue,msg) == FALSE) {
- apt_log(APT_LOG_MARK,APT_PRIO_ERROR,"MPF Request Queue is Full [%s]",apt_task_name_get(task));
- }
- apr_thread_mutex_unlock(engine->request_queue_guard);
- return TRUE;
-}
-
-static apt_bool_t mpf_engine_msg_process(apt_task_t *task, apt_task_msg_t *msg)
-{
- apr_size_t i;
- mpf_engine_t *engine = apt_task_object_get(task);
- apt_task_msg_t *response_msg;
- mpf_message_container_t *response;
- mpf_message_t *mpf_response;
- mpf_context_t *context;
- mpf_termination_t *termination;
- const mpf_message_t *mpf_request;
- const mpf_message_container_t *request = (const mpf_message_container_t*) msg->data;
-
- response_msg = apt_task_msg_get(engine->task);
- if(!response_msg) {
- return FALSE;
- }
- response_msg->type = engine->task_msg_type;
- response = (mpf_message_container_t*) response_msg->data;
- *response = *request;
- for(i=0; icount; i++) {
- mpf_request = &request->messages[i];
- mpf_response = &response->messages[i];
-
- if(mpf_request->message_type != MPF_MESSAGE_TYPE_REQUEST) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Invalid MPF Message Type [%d]",mpf_request->message_type);
- continue;
- }
-
- mpf_response->message_type = MPF_MESSAGE_TYPE_RESPONSE;
- mpf_response->status_code = MPF_STATUS_CODE_SUCCESS;
- context = mpf_request->context;
- termination = mpf_request->termination;
- switch(mpf_request->command_id) {
- case MPF_ADD_TERMINATION:
- {
- termination->media_engine = engine;
- termination->event_handler = mpf_engine_event_raise;
- termination->codec_manager = engine->codec_manager;
- termination->timer_queue = engine->timer_queue;
-
- mpf_termination_add(termination,mpf_request->descriptor);
- if(mpf_context_termination_add(context,termination) == FALSE) {
- mpf_termination_subtract(termination);
- mpf_response->status_code = MPF_STATUS_CODE_FAILURE;
- break;
- }
- break;
- }
- case MPF_MODIFY_TERMINATION:
- {
- mpf_termination_modify(termination,mpf_request->descriptor);
- break;
- }
- case MPF_SUBTRACT_TERMINATION:
- {
- if(mpf_context_termination_subtract(context,termination) == FALSE) {
- mpf_response->status_code = MPF_STATUS_CODE_FAILURE;
- break;
- }
- mpf_termination_subtract(termination);
- break;
- }
- case MPF_ADD_ASSOCIATION:
- {
- mpf_context_association_add(context,termination,mpf_request->assoc_termination);
- break;
- }
- case MPF_REMOVE_ASSOCIATION:
- {
- mpf_context_association_remove(context,termination,mpf_request->assoc_termination);
- break;
- }
- case MPF_RESET_ASSOCIATIONS:
- {
- mpf_context_associations_reset(context);
- break;
- }
- case MPF_APPLY_TOPOLOGY:
- {
- mpf_context_topology_apply(context);
- break;
- }
- case MPF_DESTROY_TOPOLOGY:
- {
- mpf_context_topology_destroy(context);
- break;
- }
- default:
- {
- mpf_response->status_code = MPF_STATUS_CODE_FAILURE;
- }
- }
- }
-
- return apt_task_msg_parent_signal(engine->task,response_msg);
-}
-
-static void mpf_engine_main(mpf_scheduler_t *scheduler, void *obj)
-{
- mpf_engine_t *engine = obj;
- apt_task_msg_t *msg;
-
- /* process request queue */
- apr_thread_mutex_lock(engine->request_queue_guard);
- msg = apt_cyclic_queue_pop(engine->request_queue);
- while(msg) {
- apr_thread_mutex_unlock(engine->request_queue_guard);
- apt_task_msg_process(engine->task,msg);
- apr_thread_mutex_lock(engine->request_queue_guard);
- msg = apt_cyclic_queue_pop(engine->request_queue);
- }
- apr_thread_mutex_unlock(engine->request_queue_guard);
-
- /* process factory of media contexts */
- mpf_context_factory_process(engine->context_factory);
-}
-
-static void mpf_engine_timer_proc(mpf_scheduler_t *scheduler, void *obj)
-{
- mpf_engine_t *engine = obj;
- apt_timer_queue_advance(engine->timer_queue,MPF_TIMER_RESOLUTION);
-}
-
-MPF_DECLARE(mpf_codec_manager_t*) mpf_engine_codec_manager_create(apr_pool_t *pool)
-{
- mpf_codec_manager_t *codec_manager = mpf_codec_manager_create(4,pool);
- if(codec_manager) {
- mpf_codec_t *codec;
-
- codec = mpf_codec_g711u_create(pool);
- mpf_codec_manager_codec_register(codec_manager,codec);
-
- codec = mpf_codec_g711a_create(pool);
- mpf_codec_manager_codec_register(codec_manager,codec);
-
- codec = mpf_codec_l16_create(pool);
- mpf_codec_manager_codec_register(codec_manager,codec);
- }
- return codec_manager;
-}
-
-MPF_DECLARE(apt_bool_t) mpf_engine_codec_manager_register(mpf_engine_t *engine, const mpf_codec_manager_t *codec_manager)
-{
- engine->codec_manager = codec_manager;
- return TRUE;
-}
-
-MPF_DECLARE(apt_bool_t) mpf_engine_scheduler_rate_set(mpf_engine_t *engine, unsigned long rate)
-{
- return mpf_scheduler_rate_set(engine->scheduler,rate);
-}
-
-MPF_DECLARE(const char*) mpf_engine_id_get(const mpf_engine_t *engine)
-{
- return apt_task_name_get(engine->task);
-}
diff --git a/libs/unimrcp/libs/mpf/src/mpf_engine_factory.c b/libs/unimrcp/libs/mpf/src/mpf_engine_factory.c
deleted file mode 100644
index 91174dce94..0000000000
--- a/libs/unimrcp/libs/mpf/src/mpf_engine_factory.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mpf_engine_factory.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include
-#include "mpf_engine_factory.h"
-#include "mpf_termination_factory.h"
-
-/** Factory of media engines */
-struct mpf_engine_factory_t {
- /** Array of pointers to media engines */
- apr_array_header_t *engines_arr;
- /** Index of the current engine */
- int index;
-};
-
-/** Create factory of media engines. */
-MPF_DECLARE(mpf_engine_factory_t*) mpf_engine_factory_create(apr_pool_t *pool)
-{
- mpf_engine_factory_t *mpf_factory = apr_palloc(pool,sizeof(mpf_engine_factory_t));
- mpf_factory->engines_arr = apr_array_make(pool,1,sizeof(mpf_engine_t*));
- mpf_factory->index = 0;
- return mpf_factory;
-}
-
-/** Add media engine to factory. */
-MPF_DECLARE(apt_bool_t) mpf_engine_factory_engine_add(mpf_engine_factory_t *mpf_factory, mpf_engine_t *media_engine)
-{
- mpf_engine_t **slot;
- if(!media_engine)
- return FALSE;
-
- slot = apr_array_push(mpf_factory->engines_arr);
- *slot = media_engine;
- return TRUE;
-}
-
-/** Determine whether factory is empty. */
-MPF_DECLARE(apt_bool_t) mpf_engine_factory_is_empty(const mpf_engine_factory_t *mpf_factory)
-{
- return apr_is_empty_array(mpf_factory->engines_arr);
-}
-
-/** Select next available media engine. */
-MPF_DECLARE(mpf_engine_t*) mpf_engine_factory_engine_select(mpf_engine_factory_t *mpf_factory)
-{
- mpf_engine_t *media_engine = APR_ARRAY_IDX(mpf_factory->engines_arr, mpf_factory->index, mpf_engine_t*);
- if(++mpf_factory->index == mpf_factory->engines_arr->nelts) {
- mpf_factory->index = 0;
- }
- return media_engine;
-}
-
-/** Associate media engines with RTP termination factory. */
-MPF_DECLARE(apt_bool_t) mpf_engine_factory_rtp_factory_assign(mpf_engine_factory_t *mpf_factory, mpf_termination_factory_t *rtp_factory)
-{
- int i;
- mpf_engine_t *media_engine;
- for(i=0; iengines_arr->nelts; i++) {
- media_engine = APR_ARRAY_IDX(mpf_factory->engines_arr, i, mpf_engine_t*);
- mpf_termination_factory_engine_assign(rtp_factory,media_engine);
- }
- return TRUE;
-}
diff --git a/libs/unimrcp/libs/mpf/src/mpf_file_termination_factory.c b/libs/unimrcp/libs/mpf/src/mpf_file_termination_factory.c
deleted file mode 100644
index e6170a6aa8..0000000000
--- a/libs/unimrcp/libs/mpf/src/mpf_file_termination_factory.c
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mpf_file_termination_factory.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include "mpf_termination.h"
-#include "mpf_file_termination_factory.h"
-#include "mpf_audio_file_stream.h"
-
-static apt_bool_t mpf_file_termination_destroy(mpf_termination_t *termination)
-{
- return TRUE;
-}
-
-static apt_bool_t mpf_file_termination_add(mpf_termination_t *termination, void *descriptor)
-{
- apt_bool_t status = TRUE;
- mpf_audio_stream_t *audio_stream = termination->audio_stream;
- if(!audio_stream) {
- audio_stream = mpf_file_stream_create(termination,termination->pool);
- if(!audio_stream) {
- return FALSE;
- }
- termination->audio_stream = audio_stream;
- }
-
- if(descriptor) {
- status = mpf_file_stream_modify(audio_stream,descriptor);
- }
- return status;
-}
-
-static apt_bool_t mpf_file_termination_modify(mpf_termination_t *termination, void *descriptor)
-{
- apt_bool_t status = TRUE;
- mpf_audio_stream_t *audio_stream = termination->audio_stream;
- if(!audio_stream) {
- return FALSE;
- }
-
- if(descriptor) {
- status = mpf_file_stream_modify(audio_stream,descriptor);
- }
- return status;
-}
-
-static apt_bool_t mpf_file_termination_subtract(mpf_termination_t *termination)
-{
- return TRUE;
-}
-
-static const mpf_termination_vtable_t file_vtable = {
- mpf_file_termination_destroy,
- mpf_file_termination_add,
- mpf_file_termination_modify,
- mpf_file_termination_subtract
-};
-
-static mpf_termination_t* mpf_file_termination_create(
- mpf_termination_factory_t *termination_factory,
- void *obj,
- apr_pool_t *pool)
-{
- return mpf_termination_base_create(termination_factory,obj,&file_vtable,NULL,NULL,pool);
-}
-
-MPF_DECLARE(mpf_termination_factory_t*) mpf_file_termination_factory_create(apr_pool_t *pool)
-{
- mpf_termination_factory_t *file_termination_factory = apr_palloc(pool,sizeof(mpf_termination_factory_t));
- file_termination_factory->create_termination = mpf_file_termination_create;
- file_termination_factory->assign_engine = NULL;
- return file_termination_factory;
-}
diff --git a/libs/unimrcp/libs/mpf/src/mpf_frame_buffer.c b/libs/unimrcp/libs/mpf/src/mpf_frame_buffer.c
deleted file mode 100644
index 3669db37c2..0000000000
--- a/libs/unimrcp/libs/mpf/src/mpf_frame_buffer.c
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mpf_frame_buffer.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include "mpf_frame_buffer.h"
-
-struct mpf_frame_buffer_t {
- apr_byte_t *raw_data;
- mpf_frame_t *frames;
- apr_size_t frame_count;
- apr_size_t frame_size;
-
- apr_size_t write_pos;
- apr_size_t read_pos;
-
- apr_thread_mutex_t *guard;
- apr_pool_t *pool;
-
-#ifdef MPF_FRAME_BUFFER_DEBUG
- FILE *utt_in;
- FILE *utt_out;
-#endif
-};
-
-
-mpf_frame_buffer_t* mpf_frame_buffer_create(apr_size_t frame_size, apr_size_t frame_count, apr_pool_t *pool)
-{
- apr_size_t i;
- mpf_frame_t *frame;
- mpf_frame_buffer_t *buffer = apr_palloc(pool,sizeof(mpf_frame_buffer_t));
- buffer->pool = pool;
-
- buffer->frame_size = frame_size;
- buffer->frame_count = frame_count;
- buffer->raw_data = apr_palloc(pool,buffer->frame_size*buffer->frame_count);
- buffer->frames = apr_palloc(pool,sizeof(mpf_frame_t)*buffer->frame_count);
- for(i=0; iframe_count; i++) {
- frame = &buffer->frames[i];
- frame->type = MEDIA_FRAME_TYPE_NONE;
- frame->marker = MPF_MARKER_NONE;
- frame->codec_frame.buffer = buffer->raw_data + i*buffer->frame_size;
- }
-
- buffer->write_pos = buffer->read_pos = 0;
- apr_thread_mutex_create(&buffer->guard,APR_THREAD_MUTEX_UNNESTED,pool);
-
-#ifdef MPF_FRAME_BUFFER_DEBUG
- buffer->utt_in = NULL;
- buffer->utt_out = NULL;
-#endif
- return buffer;
-}
-
-#ifdef MPF_FRAME_BUFFER_DEBUG
-static apr_status_t mpf_frame_buffer_file_close(void *obj)
-{
- mpf_frame_buffer_t *buffer = obj;
- if(buffer->utt_out) {
- fclose(buffer->utt_out);
- buffer->utt_out = NULL;
- }
- if(buffer->utt_in) {
- fclose(buffer->utt_in);
- buffer->utt_in = NULL;
- }
- return APR_SUCCESS;
-}
-
-apt_bool_t mpf_frame_buffer_file_open(mpf_frame_buffer_t *buffer, const char *utt_file_in, const char *utt_file_out)
-{
- buffer->utt_in = fopen(utt_file_in,"wb");
- if(!buffer->utt_in)
- return FALSE;
-
- buffer->utt_out = fopen(utt_file_out,"wb");
- if(!buffer->utt_out)
- return FALSE;
-
- apr_pool_cleanup_register(buffer->pool,buffer,mpf_frame_buffer_file_close,NULL);
- return TRUE;
-}
-#endif
-
-void mpf_frame_buffer_destroy(mpf_frame_buffer_t *buffer)
-{
- if(buffer->guard) {
- apr_thread_mutex_destroy(buffer->guard);
- buffer->guard = NULL;
- }
-}
-
-apt_bool_t mpf_frame_buffer_restart(mpf_frame_buffer_t *buffer)
-{
- buffer->write_pos = buffer->read_pos;
- return TRUE;
-}
-
-static APR_INLINE mpf_frame_t* mpf_frame_buffer_frame_get(mpf_frame_buffer_t *buffer, apr_size_t pos)
-{
- apr_size_t index = pos % buffer->frame_count;
- return &buffer->frames[index];
-}
-
-apt_bool_t mpf_frame_buffer_write(mpf_frame_buffer_t *buffer, const mpf_frame_t *frame)
-{
- mpf_frame_t *write_frame;
- void *data = frame->codec_frame.buffer;
- apr_size_t size = frame->codec_frame.size;
-
-#ifdef MPF_FRAME_BUFFER_DEBUG
- if(buffer->utt_in) {
- fwrite(data,1,size,buffer->utt_in);
- }
-#endif
-
- apr_thread_mutex_lock(buffer->guard);
- while(buffer->write_pos - buffer->read_pos < buffer->frame_count && size >= buffer->frame_size) {
- write_frame = mpf_frame_buffer_frame_get(buffer,buffer->write_pos);
- write_frame->type = frame->type;
- write_frame->codec_frame.size = buffer->frame_size;
- memcpy(
- write_frame->codec_frame.buffer,
- data,
- write_frame->codec_frame.size);
-
- data = (char*)data + buffer->frame_size;
- size -= buffer->frame_size;
- buffer->write_pos ++;
- }
-
- apr_thread_mutex_unlock(buffer->guard);
- /* if size != 0 => non frame alligned or buffer is full */
- return size == 0 ? TRUE : FALSE;
-}
-
-apt_bool_t mpf_frame_buffer_read(mpf_frame_buffer_t *buffer, mpf_frame_t *media_frame)
-{
- apr_thread_mutex_lock(buffer->guard);
- if(buffer->write_pos > buffer->read_pos) {
- /* normal read */
- mpf_frame_t *src_media_frame = mpf_frame_buffer_frame_get(buffer,buffer->read_pos);
- media_frame->type = src_media_frame->type;
- media_frame->marker = src_media_frame->marker;
- if(media_frame->type & MEDIA_FRAME_TYPE_AUDIO) {
- media_frame->codec_frame.size = src_media_frame->codec_frame.size;
- memcpy(
- media_frame->codec_frame.buffer,
- src_media_frame->codec_frame.buffer,
- media_frame->codec_frame.size);
-#ifdef MPF_FRAME_BUFFER_DEBUG
- if(buffer->utt_out) {
- fwrite(media_frame->codec_frame.buffer,1,media_frame->codec_frame.size,buffer->utt_out);
- }
-#endif
- }
- if(media_frame->type & MEDIA_FRAME_TYPE_EVENT) {
- media_frame->event_frame = src_media_frame->event_frame;
- }
- src_media_frame->type = MEDIA_FRAME_TYPE_NONE;
- src_media_frame->marker = MPF_MARKER_NONE;
- buffer->read_pos ++;
- }
- else {
- /* underflow */
- media_frame->type = MEDIA_FRAME_TYPE_NONE;
- media_frame->marker = MPF_MARKER_NONE;
- }
- apr_thread_mutex_unlock(buffer->guard);
- return TRUE;
-}
diff --git a/libs/unimrcp/libs/mpf/src/mpf_jitter_buffer.c b/libs/unimrcp/libs/mpf/src/mpf_jitter_buffer.c
deleted file mode 100644
index f84521a336..0000000000
--- a/libs/unimrcp/libs/mpf/src/mpf_jitter_buffer.c
+++ /dev/null
@@ -1,510 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mpf_jitter_buffer.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include "mpf_jitter_buffer.h"
-#include "mpf_trace.h"
-
-#if ENABLE_JB_TRACE == 1
-#define JB_TRACE printf
-#elif ENABLE_JB_TRACE == 2
-#define JB_TRACE mpf_debug_output_trace
-#else
-#define JB_TRACE mpf_null_trace
-#endif
-
-struct mpf_jitter_buffer_t {
- /* jitter buffer config */
- mpf_jb_config_t *config;
- /* codec to be used to dissect payload */
- mpf_codec_t *codec;
-
- /* cyclic raw data */
- apr_byte_t *raw_data;
- /* frames (out of raw data) */
- mpf_frame_t *frames;
- /* number of frames */
- apr_size_t frame_count;
- /* frame timestamp units (samples) */
- apr_uint32_t frame_ts;
- /* frame size in bytes */
- apr_size_t frame_size;
-
- /* playout delay in timetsamp units */
- apr_uint32_t playout_delay_ts;
- /* max playout delay in timetsamp units */
- apr_uint32_t max_playout_delay_ts;
-
- /* write should be synchronized (offset calculated) */
- apr_byte_t write_sync;
- /* write timestamp offset */
- apr_int32_t write_ts_offset;
-
- /* write pointer in timestamp units */
- apr_uint32_t write_ts;
- /* read pointer in timestamp units */
- apr_uint32_t read_ts;
-
- /* min length of the buffer in timestamp units */
- apr_int32_t min_length_ts;
- /* max length of the buffer in timestamp units */
- apr_int32_t max_length_ts;
- /* number of statistical measurements made */
- apr_uint32_t measurment_count;
-
- /* timestamp event starts at */
- apr_uint32_t event_write_base_ts;
- /* the first (base) frame of the event */
- mpf_named_event_frame_t event_write_base;
- /* the last received update for the event */
- const mpf_named_event_frame_t *event_write_update;
-};
-
-
-mpf_jitter_buffer_t* mpf_jitter_buffer_create(mpf_jb_config_t *jb_config, mpf_codec_descriptor_t *descriptor, mpf_codec_t *codec, apr_pool_t *pool)
-{
- size_t i;
- mpf_frame_t *frame;
- mpf_jitter_buffer_t *jb = apr_palloc(pool,sizeof(mpf_jitter_buffer_t));
- if(!jb_config) {
- /* create default jb config */
- jb_config = apr_palloc(pool,sizeof(mpf_jb_config_t));
- mpf_jb_config_init(jb_config);
- }
- /* validate jb config */
- if(jb_config->min_playout_delay > jb_config->initial_playout_delay) {
- jb_config->min_playout_delay = jb_config->initial_playout_delay;
- }
- if(jb_config->max_playout_delay < jb_config->initial_playout_delay) {
- jb_config->max_playout_delay = 2 * jb_config->initial_playout_delay;
- }
- if(jb_config->max_playout_delay == 0) {
- jb_config->max_playout_delay = 600; /* ms */
- }
-
- jb->config = jb_config;
- jb->codec = codec;
-
- /* calculate and allocate frame related data */
- jb->frame_ts = (apr_uint32_t)mpf_codec_frame_samples_calculate(descriptor);
- jb->frame_size = mpf_codec_frame_size_calculate(descriptor,codec->attribs);
- jb->frame_count = jb->config->max_playout_delay / CODEC_FRAME_TIME_BASE;
- jb->raw_data = apr_palloc(pool,jb->frame_size*jb->frame_count);
- jb->frames = apr_palloc(pool,sizeof(mpf_frame_t)*jb->frame_count);
- for(i=0; iframe_count; i++) {
- frame = &jb->frames[i];
- frame->type = MEDIA_FRAME_TYPE_NONE;
- frame->marker = MPF_MARKER_NONE;
- frame->codec_frame.buffer = jb->raw_data + i*jb->frame_size;
- }
-
- if(jb->config->initial_playout_delay % CODEC_FRAME_TIME_BASE != 0) {
- jb->config->initial_playout_delay += CODEC_FRAME_TIME_BASE - jb->config->initial_playout_delay % CODEC_FRAME_TIME_BASE;
- }
-
- /* calculate playout delay in timestamp units */
- jb->playout_delay_ts = jb->frame_ts * jb->config->initial_playout_delay / CODEC_FRAME_TIME_BASE;
- jb->max_playout_delay_ts = jb->frame_ts * jb->config->max_playout_delay / CODEC_FRAME_TIME_BASE;
-
- jb->write_sync = 1;
- jb->write_ts_offset = 0;
- jb->write_ts = jb->read_ts = 0;
-
- jb->min_length_ts = jb->max_length_ts = 0;
- jb->measurment_count = 0;
-
- jb->event_write_base_ts = 0;
- memset(&jb->event_write_base,0,sizeof(mpf_named_event_frame_t));
- jb->event_write_update = NULL;
-
- return jb;
-}
-
-void mpf_jitter_buffer_destroy(mpf_jitter_buffer_t *jb)
-{
-}
-
-apt_bool_t mpf_jitter_buffer_restart(mpf_jitter_buffer_t *jb)
-{
- jb->write_sync = 1;
- jb->write_ts_offset = 0;
- jb->write_ts = jb->read_ts;
-
- jb->event_write_base_ts = 0;
- memset(&jb->event_write_base,0,sizeof(mpf_named_event_frame_t));
- jb->event_write_update = NULL;
-
- if(jb->config->adaptive && jb->playout_delay_ts == jb->max_playout_delay_ts) {
- jb->playout_delay_ts = jb->frame_ts * jb->config->initial_playout_delay / CODEC_FRAME_TIME_BASE;
- }
-
- JB_TRACE("JB restart\n");
- return TRUE;
-}
-
-static APR_INLINE mpf_frame_t* mpf_jitter_buffer_frame_get(mpf_jitter_buffer_t *jb, apr_size_t ts)
-{
- apr_size_t index = (ts / jb->frame_ts) % jb->frame_count;
- return &jb->frames[index];
-}
-
-static APR_INLINE void mpf_jitter_buffer_stat_update(mpf_jitter_buffer_t *jb)
-{
- apr_int32_t length_ts;
-
- if(jb->measurment_count == 50) {
- /* start over after every N measurements */
- apr_int32_t mean_length_ts = jb->min_length_ts + (jb->max_length_ts - jb->min_length_ts) / 2;
- JB_TRACE("JB stat length [%d : %d] playout delay=%u\n",
- jb->min_length_ts,jb->max_length_ts,jb->playout_delay_ts);
- jb->min_length_ts = jb->max_length_ts = mean_length_ts;
- jb->measurment_count = 0;
- }
-
- /* calculate current length of the buffer */
- length_ts = jb->write_ts - jb->read_ts;
- if(length_ts > jb->max_length_ts) {
- /* update max length */
- jb->max_length_ts = length_ts;
- }
- else if(length_ts < jb->min_length_ts) {
- /* update min length */
- jb->min_length_ts = length_ts;
- }
- /* increment the counter after every stat update */
- jb->measurment_count++;
-}
-
-static APR_INLINE void mpf_jitter_buffer_frame_allign(mpf_jitter_buffer_t *jb, apr_uint32_t *ts)
-{
- if(*ts % jb->frame_ts != 0)
- *ts -= *ts % jb->frame_ts;
-}
-
-static APR_INLINE jb_result_t mpf_jitter_buffer_write_prepare(mpf_jitter_buffer_t *jb, apr_uint32_t ts, apr_uint32_t *write_ts)
-{
- if(jb->write_sync) {
- JB_TRACE("JB write sync playout delay=%u\n",jb->playout_delay_ts);
- /* calculate the offset */
- jb->write_ts_offset = ts - jb->read_ts;
- jb->write_sync = 0;
-
- if(jb->config->time_skew_detection) {
- /* reset the statistics */
- jb->min_length_ts = jb->max_length_ts = jb->playout_delay_ts;
- jb->measurment_count = 0;
- }
- }
-
- /* calculate the write pos taking into account current offset and playout delay */
- *write_ts = ts - jb->write_ts_offset + jb->playout_delay_ts;
- if(*write_ts % jb->frame_ts != 0) {
- /* allign with frame_ts */
- apr_uint32_t delta_ts = *write_ts % jb->frame_ts;
- JB_TRACE("JB write allign ts=%u delta_ts=-%u\n",*write_ts,delta_ts);
- *write_ts -= delta_ts;
- }
- return JB_OK;
-}
-
-jb_result_t mpf_jitter_buffer_write(mpf_jitter_buffer_t *jb, void *buffer, apr_size_t size, apr_uint32_t ts, apr_byte_t marker)
-{
- mpf_frame_t *media_frame;
- apr_uint32_t write_ts;
- apr_size_t available_frame_count;
- jb_result_t result;
-
- if(marker) {
- JB_TRACE("JB marker\n");
- /* new talkspurt detected => test whether the buffer is empty */
- if(jb->write_ts <= jb->read_ts) {
- /* resync */
- jb->write_sync = 1;
- }
- }
-
- /* calculate write_ts */
- result = mpf_jitter_buffer_write_prepare(jb,ts,&write_ts);
- if(result != JB_OK) {
- return result;
- }
-
- if(write_ts >= jb->read_ts) {
- if(write_ts >= jb->write_ts) {
- /* normal order */
- }
- else {
- /* out of order */
- }
- }
- else {
- apr_uint32_t delta_ts;
- /* packet arrived too late */
- if(write_ts < jb->write_ts) {
- /* out of order => discard */
- JB_TRACE("JB write ts=%u out of order, too late => discard\n",write_ts);
- return JB_DISCARD_TOO_LATE;
- }
-
- /* calculate a minimal adjustment needed in order to place the packet into the buffer */
- delta_ts = jb->read_ts - write_ts;
-
- if(jb->config->time_skew_detection) {
- JB_TRACE("JB stat length [%d : %d] playout delay=%u delta=%u\n",
- jb->min_length_ts,jb->max_length_ts,jb->playout_delay_ts,delta_ts);
-
- if((apr_uint32_t)(jb->max_length_ts - jb->min_length_ts) > jb->playout_delay_ts + delta_ts) {
- /* update the adjustment based on the collected statistics */
- delta_ts = (apr_uint32_t)(jb->max_length_ts - jb->min_length_ts) - jb->playout_delay_ts;
- mpf_jitter_buffer_frame_allign(jb,&delta_ts);
- }
-
- /* determine if there might be a time skew or not */
- if(jb->max_length_ts > 0 && (apr_uint32_t)jb->max_length_ts < jb->playout_delay_ts) {
- /* calculate the time skew */
- apr_uint32_t skew_ts = jb->playout_delay_ts - jb->max_length_ts;
- mpf_jitter_buffer_frame_allign(jb,&skew_ts);
- JB_TRACE("JB time skew detected offset=%u\n",skew_ts);
-
- /* adjust the offset and write pos */
- jb->write_ts_offset -= skew_ts;
- write_ts = ts - jb->write_ts_offset + jb->playout_delay_ts;
-
- /* adjust the statistics */
- jb->min_length_ts += skew_ts;
- jb->max_length_ts += skew_ts;
-
- if(skew_ts < delta_ts) {
- delta_ts -= skew_ts;
- }
- else {
- delta_ts = 0;
- }
- }
- }
-
- if(delta_ts) {
- if(jb->config->adaptive == 0) {
- /* jitter buffer is not adaptive => discard the packet */
- JB_TRACE("JB write ts=%u too late => discard\n",write_ts);
- return JB_DISCARD_TOO_LATE;
- }
-
- if(jb->playout_delay_ts + delta_ts > jb->max_playout_delay_ts) {
- /* max playout delay will be reached => discard the packet */
- JB_TRACE("JB write ts=%u max playout delay reached => discard\n",write_ts);
- return JB_DISCARD_TOO_LATE;
- }
-
- /* adjust the playout delay */
- jb->playout_delay_ts += delta_ts;
- write_ts += delta_ts;
- JB_TRACE("JB adjust playout delay=%u delta=%u\n",jb->playout_delay_ts,delta_ts);
-
- if(jb->config->time_skew_detection) {
- /* adjust the statistics */
- jb->min_length_ts += delta_ts;
- jb->max_length_ts += delta_ts;
- }
- }
- }
-
- /* get number of frames available to write */
- available_frame_count = jb->frame_count - (write_ts - jb->read_ts)/jb->frame_ts;
- if(available_frame_count <= 0) {
- /* too early */
- JB_TRACE("JB write ts=%u too early => discard\n",write_ts);
- return JB_DISCARD_TOO_EARLY;
- }
-
- JB_TRACE("JB write ts=%u size=%"APR_SIZE_T_FMT"\n",write_ts,size);
- while(available_frame_count && size) {
- media_frame = mpf_jitter_buffer_frame_get(jb,write_ts);
- media_frame->codec_frame.size = jb->frame_size;
- if(mpf_codec_dissect(jb->codec,&buffer,&size,&media_frame->codec_frame) == FALSE) {
- break;
- }
-
- media_frame->type |= MEDIA_FRAME_TYPE_AUDIO;
- write_ts += jb->frame_ts;
- available_frame_count--;
- }
-
- if(size) {
- /* no frame available to write, but some data remains in buffer (partialy too early) */
- }
-
- if(write_ts > jb->write_ts) {
- /* advance write pos */
- jb->write_ts = write_ts;
- }
- return result;
-}
-
-jb_result_t mpf_jitter_buffer_event_write(mpf_jitter_buffer_t *jb, const mpf_named_event_frame_t *named_event, apr_uint32_t ts, apr_byte_t marker)
-{
- mpf_frame_t *media_frame;
- apr_uint32_t write_ts;
- jb_result_t result = mpf_jitter_buffer_write_prepare(jb,ts,&write_ts);
- if(result != JB_OK) {
- return result;
- }
-
- /* new event detection */
- if(!marker) {
- if(jb->event_write_base.event_id != named_event->event_id || !jb->event_write_update) {
- /* new event detected, marker is missing though */
- marker = 1;
- }
- else if(jb->event_write_base_ts != write_ts) {
- /* detect whether this is a new segment of the same event or new event with missing marker
- assuming a threshold which equals to 4 frames */
- if(write_ts > jb->event_write_base_ts + jb->event_write_update->duration + 4*jb->frame_ts) {
- /* new event detected, marker is missing though */
- marker = 1;
- }
- else {
- /* new segment of the same long-lasting event detected */
- jb->event_write_base = *named_event;
- jb->event_write_update = &jb->event_write_base;
- jb->event_write_base_ts = write_ts;
- }
- }
- }
- if(marker) {
- /* new event */
- jb->event_write_base = *named_event;
- jb->event_write_update = &jb->event_write_base;
- jb->event_write_base_ts = write_ts;
- }
- else {
- /* an update */
- if(named_event->duration < jb->event_write_update->duration) {
- /* ignore this update, it's something from the past, which makes no sense now */
- return JB_OK;
- }
- else if(named_event->duration == jb->event_write_update->duration) {
- /* this should be a retransmission, let it go through only if it contains new data */
- if(jb->event_write_update->edge == 1 || jb->event_write_update->edge == named_event->edge) {
- /* ignore this update since either the end of event marker has already been set,
- or the current event provides no updates */
- return JB_OK;
- }
- }
-
- /* calculate position in jitter buffer considering the last received event (update) */
- write_ts += jb->event_write_update->duration;
- }
-
- if(write_ts < jb->read_ts) {
- /* too late */
- apr_uint32_t delta_ts;
- if(jb->config->adaptive == 0) {
- /* jitter buffer is not adaptive => discard the packet */
- JB_TRACE("JB write ts=%u event=%d duration=%d too late => discard\n",
- write_ts,named_event->event_id,named_event->duration);
- return JB_DISCARD_TOO_LATE;
- }
-
- /* calculate a minimal adjustment needed in order to place the packet into the buffer */
- delta_ts = jb->read_ts - write_ts;
-
- if(jb->playout_delay_ts + delta_ts > jb->max_playout_delay_ts) {
- /* max playout delay will be reached => discard the packet */
- JB_TRACE("JB write ts=%u event=%d duration=%d max playout delay reached => discard\n",
- write_ts,named_event->event_id,named_event->duration);
- return JB_DISCARD_TOO_LATE;
- }
-
- /* adjust the playout delay */
- jb->playout_delay_ts += delta_ts;
- write_ts += delta_ts;
- if(marker) {
- jb->event_write_base_ts = write_ts;
- }
- JB_TRACE("JB adjust playout delay=%u delta=%u\n",jb->playout_delay_ts,delta_ts);
- }
- else if( (write_ts - jb->read_ts)/jb->frame_ts >= jb->frame_count) {
- /* too early */
- JB_TRACE("JB write ts=%u event=%d duration=%d too early => discard\n",
- write_ts,named_event->event_id,named_event->duration);
- return JB_DISCARD_TOO_EARLY;
- }
-
- media_frame = mpf_jitter_buffer_frame_get(jb,write_ts);
- media_frame->event_frame = *named_event;
- media_frame->type |= MEDIA_FRAME_TYPE_EVENT;
- if(marker) {
- media_frame->marker = MPF_MARKER_START_OF_EVENT;
- }
- else if(named_event->edge == 1) {
- media_frame->marker = MPF_MARKER_END_OF_EVENT;
- }
- JB_TRACE("JB write ts=%u event=%d duration=%d marker=%d\n",
- write_ts,named_event->event_id,named_event->duration,media_frame->marker);
- jb->event_write_update = &media_frame->event_frame;
-
- write_ts += jb->frame_ts;
- if(write_ts > jb->write_ts) {
- /* advance write pos */
- jb->write_ts = write_ts;
- }
- return result;
-}
-
-apt_bool_t mpf_jitter_buffer_read(mpf_jitter_buffer_t *jb, mpf_frame_t *media_frame)
-{
- mpf_frame_t *src_media_frame = mpf_jitter_buffer_frame_get(jb,jb->read_ts);
- if(jb->write_ts > jb->read_ts) {
- /* normal read */
- JB_TRACE("JB read ts=%u\n", jb->read_ts);
- media_frame->type = src_media_frame->type;
- media_frame->marker = src_media_frame->marker;
- if(media_frame->type & MEDIA_FRAME_TYPE_AUDIO) {
- media_frame->codec_frame.size = src_media_frame->codec_frame.size;
- memcpy(media_frame->codec_frame.buffer,src_media_frame->codec_frame.buffer,media_frame->codec_frame.size);
- }
- if(media_frame->type & MEDIA_FRAME_TYPE_EVENT) {
- media_frame->event_frame = src_media_frame->event_frame;
- }
- }
- else {
- /* underflow */
- JB_TRACE("JB read ts=%u underflow\n", jb->read_ts);
- media_frame->type = MEDIA_FRAME_TYPE_NONE;
- media_frame->marker = MPF_MARKER_NONE;
- }
- src_media_frame->type = MEDIA_FRAME_TYPE_NONE;
- src_media_frame->marker = MPF_MARKER_NONE;
- /* advance read pos */
- jb->read_ts += jb->frame_ts;
-
- if(jb->config->time_skew_detection) {
- /* update statistics after every read */
- mpf_jitter_buffer_stat_update(jb);
- }
- return TRUE;
-}
-
-apr_uint32_t mpf_jitter_buffer_playout_delay_get(const mpf_jitter_buffer_t *jb)
-{
- if(jb->config->adaptive == 0) {
- return jb->config->initial_playout_delay;
- }
-
- return jb->playout_delay_ts * CODEC_FRAME_TIME_BASE / jb->frame_ts;
-}
diff --git a/libs/unimrcp/libs/mpf/src/mpf_mixer.c b/libs/unimrcp/libs/mpf/src/mpf_mixer.c
deleted file mode 100644
index d4c5b3029d..0000000000
--- a/libs/unimrcp/libs/mpf/src/mpf_mixer.c
+++ /dev/null
@@ -1,210 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mpf_mixer.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include "mpf_mixer.h"
-#include "mpf_encoder.h"
-#include "mpf_decoder.h"
-#include "mpf_resampler.h"
-#include "mpf_codec_manager.h"
-#include "apt_log.h"
-
-typedef struct mpf_mixer_t mpf_mixer_t;
-
-/** MPF mixer derived from MPF object */
-struct mpf_mixer_t {
- /** MPF mixer base */
- mpf_object_t base;
- /** Array of audio sources */
- mpf_audio_stream_t **source_arr;
- /** Number of audio sources */
- apr_size_t source_count;
- /** Audio sink */
- mpf_audio_stream_t *sink;
-
- /** Frame to read from audio source */
- mpf_frame_t frame;
- /** Mixed frame to write to audio sink */
- mpf_frame_t mix_frame;
-};
-
-static apt_bool_t mpf_frames_mix(mpf_frame_t *mix_frame, const mpf_frame_t *frame)
-{
- apr_size_t i;
- apr_int16_t *mix_buf = mix_frame->codec_frame.buffer;
- const apr_int16_t *buf = frame->codec_frame.buffer;
- apr_size_t samples = frame->codec_frame.size / sizeof(apr_int16_t);
-
- if(mix_frame->codec_frame.size != frame->codec_frame.size) {
- return FALSE;
- }
-
- if((frame->type & MEDIA_FRAME_TYPE_AUDIO) == MEDIA_FRAME_TYPE_AUDIO) {
- for(i=0; itype |= MEDIA_FRAME_TYPE_AUDIO;
- }
-
- return TRUE;
-}
-
-static apt_bool_t mpf_mixer_process(mpf_object_t *object)
-{
- apr_size_t i;
- mpf_audio_stream_t *source;
- mpf_mixer_t *mixer = (mpf_mixer_t*) object;
-
- mixer->mix_frame.type = MEDIA_FRAME_TYPE_NONE;
- mixer->mix_frame.marker = MPF_MARKER_NONE;
- memset(mixer->mix_frame.codec_frame.buffer,0,mixer->mix_frame.codec_frame.size);
- for(i=0; isource_count; i++) {
- source = mixer->source_arr[i];
- if(source) {
- mixer->frame.type = MEDIA_FRAME_TYPE_NONE;
- mixer->frame.marker = MPF_MARKER_NONE;
- source->vtable->read_frame(source,&mixer->frame);
- mpf_frames_mix(&mixer->mix_frame,&mixer->frame);
- }
- }
- mixer->sink->vtable->write_frame(mixer->sink,&mixer->mix_frame);
- return TRUE;
-}
-
-static apt_bool_t mpf_mixer_destroy(mpf_object_t *object)
-{
- apr_size_t i;
- mpf_audio_stream_t *source;
- mpf_mixer_t *mixer = (mpf_mixer_t*) object;
-
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Destroy Mixer %s",object->name);
- for(i=0; isource_count; i++) {
- source = mixer->source_arr[i];
- if(source) {
- mpf_audio_stream_rx_close(source);
- }
- }
- mpf_audio_stream_tx_close(mixer->sink);
- return TRUE;
-}
-
-static void mpf_mixer_trace(mpf_object_t *object)
-{
- mpf_mixer_t *mixer = (mpf_mixer_t*) object;
- apr_size_t i;
- mpf_audio_stream_t *source;
- char buf[2048];
- apr_size_t offset;
-
- apt_text_stream_t output;
- apt_text_stream_init(&output,buf,sizeof(buf)-1);
-
- for(i=0; isource_count; i++) {
- source = mixer->source_arr[i];
- if(source) {
- mpf_audio_stream_trace(source,STREAM_DIRECTION_RECEIVE,&output);
- apt_text_char_insert(&output,';');
- }
- }
-
- offset = output.pos - output.text.buf;
- output.pos += apr_snprintf(output.pos, output.text.length - offset,
- "->Mixer->");
-
- mpf_audio_stream_trace(mixer->sink,STREAM_DIRECTION_SEND,&output);
-
- *output.pos = '\0';
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Media Path %s %s",
- object->name,
- output.text.buf);
-}
-
-MPF_DECLARE(mpf_object_t*) mpf_mixer_create(
- mpf_audio_stream_t **source_arr,
- apr_size_t source_count,
- mpf_audio_stream_t *sink,
- const mpf_codec_manager_t *codec_manager,
- const char *name,
- apr_pool_t *pool)
-{
- apr_size_t i;
- apr_size_t frame_size;
- mpf_codec_descriptor_t *descriptor;
- mpf_audio_stream_t *source;
- mpf_mixer_t *mixer;
- if(!source_arr || !source_count || !sink) {
- return NULL;
- }
-
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Create Mixer %s",name);
- mixer = apr_palloc(pool,sizeof(mpf_mixer_t));
- mixer->source_arr = NULL;
- mixer->source_count = 0;
- mixer->sink = NULL;
- mpf_object_init(&mixer->base,name);
- mixer->base.process = mpf_mixer_process;
- mixer->base.destroy = mpf_mixer_destroy;
- mixer->base.trace = mpf_mixer_trace;
-
- if(mpf_audio_stream_tx_validate(sink,NULL,NULL,pool) == FALSE) {
- return NULL;
- }
-
- descriptor = sink->tx_descriptor;
- if(descriptor && mpf_codec_lpcm_descriptor_match(descriptor) == FALSE) {
- mpf_codec_t *codec = mpf_codec_manager_codec_get(codec_manager,descriptor,pool);
- if(codec) {
- /* set encoder after mixer */
- mpf_audio_stream_t *encoder = mpf_encoder_create(sink,codec,pool);
- sink = encoder;
- }
- }
- mixer->sink = sink;
- mpf_audio_stream_tx_open(sink,NULL);
-
- for(i=0; irx_descriptor;
- if(descriptor && mpf_codec_lpcm_descriptor_match(descriptor) == FALSE) {
- mpf_codec_t *codec = mpf_codec_manager_codec_get(codec_manager,descriptor,pool);
- if(codec) {
- /* set decoder before mixer */
- mpf_audio_stream_t *decoder = mpf_decoder_create(source,codec,pool);
- source = decoder;
- }
- }
- source_arr[i] = source;
- mpf_audio_stream_rx_open(source,NULL);
- }
- mixer->source_arr = source_arr;
- mixer->source_count = source_count;
-
- descriptor = sink->tx_descriptor;
- frame_size = mpf_codec_linear_frame_size_calculate(descriptor->sampling_rate,descriptor->channel_count);
- mixer->frame.codec_frame.size = frame_size;
- mixer->frame.codec_frame.buffer = apr_palloc(pool,frame_size);
- mixer->mix_frame.codec_frame.size = frame_size;
- mixer->mix_frame.codec_frame.buffer = apr_palloc(pool,frame_size);
- return &mixer->base;
-}
diff --git a/libs/unimrcp/libs/mpf/src/mpf_multiplier.c b/libs/unimrcp/libs/mpf/src/mpf_multiplier.c
deleted file mode 100644
index 153c6cda9b..0000000000
--- a/libs/unimrcp/libs/mpf/src/mpf_multiplier.c
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mpf_multiplier.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include "mpf_multiplier.h"
-#include "mpf_encoder.h"
-#include "mpf_decoder.h"
-#include "mpf_resampler.h"
-#include "mpf_codec_manager.h"
-#include "apt_log.h"
-
-typedef struct mpf_multiplier_t mpf_multiplier_t;
-
-/** MPF multiplier derived from MPF object */
-struct mpf_multiplier_t {
- /** MPF multiplier base */
- mpf_object_t base;
- /** Audio source */
- mpf_audio_stream_t *source;
- /** Array of audio sinks */
- mpf_audio_stream_t **sink_arr;
- /** Number of audio sinks */
- apr_size_t sink_count;
-
- /** Media frame used to read data from source and write it to sinks */
- mpf_frame_t frame;
-};
-
-static apt_bool_t mpf_multiplier_process(mpf_object_t *object)
-{
- apr_size_t i;
- mpf_audio_stream_t *sink;
- mpf_multiplier_t *multiplier = (mpf_multiplier_t*) object;
-
- multiplier->frame.type = MEDIA_FRAME_TYPE_NONE;
- multiplier->frame.marker = MPF_MARKER_NONE;
- multiplier->source->vtable->read_frame(multiplier->source,&multiplier->frame);
-
- if((multiplier->frame.type & MEDIA_FRAME_TYPE_AUDIO) == 0) {
- memset( multiplier->frame.codec_frame.buffer,
- 0,
- multiplier->frame.codec_frame.size);
- }
-
- for(i=0; isink_count; i++) {
- sink = multiplier->sink_arr[i];
- if(sink) {
- sink->vtable->write_frame(sink,&multiplier->frame);
- }
- }
- return TRUE;
-}
-
-static apt_bool_t mpf_multiplier_destroy(mpf_object_t *object)
-{
- apr_size_t i;
- mpf_audio_stream_t *sink;
- mpf_multiplier_t *multiplier = (mpf_multiplier_t*) object;
-
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Destroy Multiplier %s",object->name);
- mpf_audio_stream_rx_close(multiplier->source);
- for(i=0; isink_count; i++) {
- sink = multiplier->sink_arr[i];
- if(sink) {
- mpf_audio_stream_tx_close(sink);
- }
- }
- return TRUE;
-}
-
-static void mpf_multiplier_trace(mpf_object_t *object)
-{
- mpf_multiplier_t *multiplier = (mpf_multiplier_t*) object;
- apr_size_t i;
- mpf_audio_stream_t *sink;
- char buf[2048];
- apr_size_t offset;
-
- apt_text_stream_t output;
- apt_text_stream_init(&output,buf,sizeof(buf)-1);
-
- mpf_audio_stream_trace(multiplier->source,STREAM_DIRECTION_RECEIVE,&output);
-
- offset = output.pos - output.text.buf;
- output.pos += apr_snprintf(output.pos, output.text.length - offset,
- "->Multiplier->");
-
- for(i=0; isink_count; i++) {
- sink = multiplier->sink_arr[i];
- if(sink) {
- mpf_audio_stream_trace(sink,STREAM_DIRECTION_SEND,&output);
- apt_text_char_insert(&output,';');
- }
- }
-
- *output.pos = '\0';
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Media Path %s %s",
- object->name,
- output.text.buf);
-}
-
-MPF_DECLARE(mpf_object_t*) mpf_multiplier_create(
- mpf_audio_stream_t *source,
- mpf_audio_stream_t **sink_arr,
- apr_size_t sink_count,
- const mpf_codec_manager_t *codec_manager,
- const char *name,
- apr_pool_t *pool)
-{
- apr_size_t i;
- apr_size_t frame_size;
- mpf_codec_descriptor_t *descriptor;
- mpf_audio_stream_t *sink;
- mpf_multiplier_t *multiplier;
- if(!source || !sink_arr || !sink_count) {
- return NULL;
- }
-
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Create Multiplier %s",name);
- multiplier = apr_palloc(pool,sizeof(mpf_multiplier_t));
- multiplier->source = NULL;
- multiplier->sink_arr = NULL;
- multiplier->sink_count = 0;
- mpf_object_init(&multiplier->base,name);
- multiplier->base.process = mpf_multiplier_process;
- multiplier->base.destroy = mpf_multiplier_destroy;
- multiplier->base.trace = mpf_multiplier_trace;
-
- if(mpf_audio_stream_rx_validate(source,NULL,NULL,pool) == FALSE) {
- return NULL;
- }
-
- descriptor = source->rx_descriptor;
- if(descriptor && mpf_codec_lpcm_descriptor_match(descriptor) == FALSE) {
- mpf_codec_t *codec = mpf_codec_manager_codec_get(codec_manager,descriptor,pool);
- if(codec) {
- /* set decoder before bridge */
- mpf_audio_stream_t *decoder = mpf_decoder_create(source,codec,pool);
- source = decoder;
- }
- }
- multiplier->source = source;
- mpf_audio_stream_rx_open(source,NULL);
-
- for(i=0; itx_descriptor;
- if(descriptor && mpf_codec_lpcm_descriptor_match(descriptor) == FALSE) {
- mpf_codec_t *codec = mpf_codec_manager_codec_get(codec_manager,descriptor,pool);
- if(codec) {
- /* set encoder after bridge */
- mpf_audio_stream_t *encoder = mpf_encoder_create(sink,codec,pool);
- sink = encoder;
- }
- }
- sink_arr[i] = sink;
- mpf_audio_stream_tx_open(sink,NULL);
- }
- multiplier->sink_arr = sink_arr;
- multiplier->sink_count = sink_count;
-
- descriptor = source->rx_descriptor;
- frame_size = mpf_codec_linear_frame_size_calculate(descriptor->sampling_rate,descriptor->channel_count);
- multiplier->frame.codec_frame.size = frame_size;
- multiplier->frame.codec_frame.buffer = apr_palloc(pool,frame_size);
- return &multiplier->base;
-}
diff --git a/libs/unimrcp/libs/mpf/src/mpf_named_event.c b/libs/unimrcp/libs/mpf/src/mpf_named_event.c
deleted file mode 100644
index 22df9b07c2..0000000000
--- a/libs/unimrcp/libs/mpf/src/mpf_named_event.c
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mpf_named_event.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include "mpf_named_event.h"
-
-#define TEL_EVENT_NAME "telephone-event"
-#define TEL_EVENT_NAME_LENGTH (sizeof(TEL_EVENT_NAME)-1)
-
-#define TEL_EVENT_FMTP "0-15"
-#define TEL_EVENT_FMTP_LENGTH (sizeof(TEL_EVENT_FMTP)-1)
-
-
-MPF_DECLARE(mpf_codec_descriptor_t*) mpf_event_descriptor_create(apr_uint16_t sampling_rate, apr_pool_t *pool)
-{
- mpf_codec_descriptor_t *descriptor = apr_palloc(pool,sizeof(mpf_codec_descriptor_t));
- mpf_codec_descriptor_init(descriptor);
- descriptor->payload_type = 101;
- descriptor->name.buf = TEL_EVENT_NAME;
- descriptor->name.length = TEL_EVENT_NAME_LENGTH;
- descriptor->sampling_rate = sampling_rate;
- descriptor->channel_count = 1;
- descriptor->format.buf = TEL_EVENT_FMTP;
- descriptor->format.length = TEL_EVENT_FMTP_LENGTH;
- return descriptor;
-}
-
-MPF_DECLARE(apt_bool_t) mpf_event_descriptor_check(const mpf_codec_descriptor_t *descriptor)
-{
- apt_str_t name;
- name.buf = TEL_EVENT_NAME;
- name.length = TEL_EVENT_NAME_LENGTH;
- return apt_string_compare(&descriptor->name,&name);
-}
-
-MPF_DECLARE(apr_uint32_t) mpf_dtmf_char_to_event_id(const char dtmf_char)
-{
- if ((dtmf_char >= '0') && (dtmf_char <= '9'))
- return dtmf_char - '0';
- else if (dtmf_char == '*')
- return 10;
- else if (dtmf_char == '#')
- return 11;
- else if ((dtmf_char >= 'A') && (dtmf_char <= 'D'))
- return 12 + dtmf_char - 'A';
-
- return 255; /* Invalid DTMF event */
-}
-
-MPF_DECLARE(char) mpf_event_id_to_dtmf_char(const apr_uint32_t event_id)
-{
- if (event_id <= 9)
- return '0' + (char)event_id;
- else if (event_id == 10)
- return '*';
- else if (event_id == 11)
- return '#';
- else if (event_id <= 15)
- return 'A' + (char)event_id - 12;
-
- return 0; /* Not a DTMF event */
-}
diff --git a/libs/unimrcp/libs/mpf/src/mpf_resampler.c b/libs/unimrcp/libs/mpf/src/mpf_resampler.c
deleted file mode 100644
index bcd802245f..0000000000
--- a/libs/unimrcp/libs/mpf/src/mpf_resampler.c
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mpf_resampler.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include "mpf_resampler.h"
-#include "apt_log.h"
-
-MPF_DECLARE(mpf_audio_stream_t*) mpf_resampler_create(mpf_audio_stream_t *source, mpf_audio_stream_t *sink, apr_pool_t *pool)
-{
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,
- "Currently resampling is not supported. "
- "Try to configure and use the same sampling rate on both ends");
- return NULL;
-}
diff --git a/libs/unimrcp/libs/mpf/src/mpf_rtp_attribs.c b/libs/unimrcp/libs/mpf/src/mpf_rtp_attribs.c
deleted file mode 100644
index f6f84174e2..0000000000
--- a/libs/unimrcp/libs/mpf/src/mpf_rtp_attribs.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mpf_rtp_attribs.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include "apt_string_table.h"
-#include "mpf_rtp_attribs.h"
-
-/** String table of RTP attributes (mpf_rtp_attrib_e) */
-static const apt_str_table_item_t mpf_rtp_attrib_table[] = {
- {{"rtpmap", 6},1},
- {{"sendonly", 8},8},
- {{"recvonly", 8},2},
- {{"sendrecv", 8},4},
- {{"mid", 3},0},
- {{"ptime", 5},0}
-};
-
-
-MPF_DECLARE(const apt_str_t*) mpf_rtp_attrib_str_get(mpf_rtp_attrib_e attrib_id)
-{
- return apt_string_table_str_get(mpf_rtp_attrib_table,RTP_ATTRIB_COUNT,attrib_id);
-}
-
-MPF_DECLARE(mpf_rtp_attrib_e) mpf_rtp_attrib_id_find(const apt_str_t *attrib)
-{
- return apt_string_table_id_find(mpf_rtp_attrib_table,RTP_ATTRIB_COUNT,attrib);
-}
-
-MPF_DECLARE(const apt_str_t*) mpf_rtp_direction_str_get(mpf_stream_direction_e direction)
-{
- mpf_rtp_attrib_e attrib_id = RTP_ATTRIB_UNKNOWN;
- switch(direction) {
- case STREAM_DIRECTION_SEND:
- attrib_id = RTP_ATTRIB_SENDONLY;
- break;
- case STREAM_DIRECTION_RECEIVE:
- attrib_id = RTP_ATTRIB_RECVONLY;
- break;
- case STREAM_DIRECTION_DUPLEX:
- attrib_id = RTP_ATTRIB_SENDRECV;
- break;
- default:
- break;
- }
- return apt_string_table_str_get(mpf_rtp_attrib_table,RTP_ATTRIB_COUNT,attrib_id);
-}
diff --git a/libs/unimrcp/libs/mpf/src/mpf_rtp_stream.c b/libs/unimrcp/libs/mpf/src/mpf_rtp_stream.c
deleted file mode 100644
index 9f47521489..0000000000
--- a/libs/unimrcp/libs/mpf/src/mpf_rtp_stream.c
+++ /dev/null
@@ -1,1507 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mpf_rtp_stream.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include
-#include "apt_net.h"
-#include "apt_timer_queue.h"
-#include "mpf_rtp_stream.h"
-#include "mpf_termination.h"
-#include "mpf_codec_manager.h"
-#include "mpf_rtp_header.h"
-#include "mpf_rtcp_packet.h"
-#include "mpf_rtp_defs.h"
-#include "mpf_rtp_pt.h"
-#include "mpf_trace.h"
-#include "apt_log.h"
-
-/** Max size of RTP packet */
-#define MAX_RTP_PACKET_SIZE 1500
-/** Max size of RTCP packet */
-#define MAX_RTCP_PACKET_SIZE 1500
-
-/* Reason strings used in RTCP BYE messages (informative only) */
-#define RTCP_BYE_SESSION_ENDED "Session ended"
-#define RTCP_BYE_TALKSPURT_ENDED "Talskpurt ended"
-
-#if ENABLE_RTP_PACKET_TRACE == 1
-#define RTP_TRACE printf
-#elif ENABLE_RTP_PACKET_TRACE == 2
-#define RTP_TRACE mpf_debug_output_trace
-#else
-#define RTP_TRACE mpf_null_trace
-#endif
-
-/** RTP stream */
-typedef struct mpf_rtp_stream_t mpf_rtp_stream_t;
-struct mpf_rtp_stream_t {
- mpf_audio_stream_t *base;
-
- mpf_rtp_media_descriptor_t *local_media;
- mpf_rtp_media_descriptor_t *remote_media;
- mpf_media_state_e state;
-
- rtp_transmitter_t transmitter;
- rtp_receiver_t receiver;
-
- mpf_rtp_config_t *config;
- mpf_rtp_settings_t *settings;
-
- apr_socket_t *rtp_socket;
- apr_socket_t *rtcp_socket;
- apr_sockaddr_t *rtp_l_sockaddr;
- apr_sockaddr_t *rtp_r_sockaddr;
- apr_sockaddr_t *rtcp_l_sockaddr;
- apr_sockaddr_t *rtcp_r_sockaddr;
-
- apt_timer_t *rtcp_tx_timer;
- apt_timer_t *rtcp_rx_timer;
-
- apr_pool_t *pool;
-};
-
-static apt_bool_t mpf_rtp_stream_destroy(mpf_audio_stream_t *stream);
-static apt_bool_t mpf_rtp_rx_stream_open(mpf_audio_stream_t *stream, mpf_codec_t *codec);
-static apt_bool_t mpf_rtp_rx_stream_close(mpf_audio_stream_t *stream);
-static apt_bool_t mpf_rtp_stream_receive(mpf_audio_stream_t *stream, mpf_frame_t *frame);
-static apt_bool_t mpf_rtp_tx_stream_open(mpf_audio_stream_t *stream, mpf_codec_t *codec);
-static apt_bool_t mpf_rtp_tx_stream_close(mpf_audio_stream_t *stream);
-static apt_bool_t mpf_rtp_stream_transmit(mpf_audio_stream_t *stream, const mpf_frame_t *frame);
-
-static const mpf_audio_stream_vtable_t vtable = {
- mpf_rtp_stream_destroy,
- mpf_rtp_rx_stream_open,
- mpf_rtp_rx_stream_close,
- mpf_rtp_stream_receive,
- mpf_rtp_tx_stream_open,
- mpf_rtp_tx_stream_close,
- mpf_rtp_stream_transmit,
- NULL /* mpf_rtp_stream_trace */
-};
-
-static apt_bool_t mpf_rtp_socket_pair_create(mpf_rtp_stream_t *stream, mpf_rtp_media_descriptor_t *local_media, apt_bool_t bind);
-static apt_bool_t mpf_rtp_socket_pair_bind(mpf_rtp_stream_t *stream, mpf_rtp_media_descriptor_t *local_media);
-static void mpf_rtp_socket_pair_close(mpf_rtp_stream_t *stream);
-
-static apt_bool_t mpf_rtcp_report_send(mpf_rtp_stream_t *stream);
-static apt_bool_t mpf_rtcp_bye_send(mpf_rtp_stream_t *stream, apt_str_t *reason);
-static void mpf_rtcp_tx_timer_proc(apt_timer_t *timer, void *obj);
-static void mpf_rtcp_rx_timer_proc(apt_timer_t *timer, void *obj);
-
-
-MPF_DECLARE(mpf_audio_stream_t*) mpf_rtp_stream_create(mpf_termination_t *termination, mpf_rtp_config_t *config, mpf_rtp_settings_t *settings, apr_pool_t *pool)
-{
- mpf_rtp_stream_t *rtp_stream = apr_palloc(pool,sizeof(mpf_rtp_stream_t));
- mpf_stream_capabilities_t *capabilities = mpf_stream_capabilities_create(STREAM_DIRECTION_DUPLEX,pool);
- mpf_audio_stream_t *audio_stream = mpf_audio_stream_create(rtp_stream,&vtable,capabilities,pool);
- if(!audio_stream) {
- return NULL;
- }
-
- audio_stream->direction = STREAM_DIRECTION_NONE;
- audio_stream->termination = termination;
-
- rtp_stream->base = audio_stream;
- rtp_stream->pool = pool;
- rtp_stream->config = config;
- rtp_stream->settings = settings;
- rtp_stream->local_media = NULL;
- rtp_stream->remote_media = NULL;
- rtp_stream->rtp_socket = NULL;
- rtp_stream->rtcp_socket = NULL;
- rtp_stream->rtp_l_sockaddr = NULL;
- rtp_stream->rtp_r_sockaddr = NULL;
- rtp_stream->rtcp_l_sockaddr = NULL;
- rtp_stream->rtcp_r_sockaddr = NULL;
- rtp_stream->rtcp_tx_timer = NULL;
- rtp_stream->rtcp_rx_timer = NULL;
- rtp_stream->state = MPF_MEDIA_DISABLED;
- rtp_receiver_init(&rtp_stream->receiver);
- rtp_transmitter_init(&rtp_stream->transmitter);
- rtp_stream->transmitter.sr_stat.ssrc = (apr_uint32_t)apr_time_now();
-
- if(settings->rtcp == TRUE) {
- if(settings->rtcp_tx_interval) {
- rtp_stream->rtcp_tx_timer = apt_timer_create(
- termination->timer_queue,
- mpf_rtcp_tx_timer_proc,
- rtp_stream, pool);
- }
- if(settings->rtcp_rx_resolution) {
- rtp_stream->rtcp_rx_timer = apt_timer_create(
- termination->timer_queue,
- mpf_rtcp_rx_timer_proc,
- rtp_stream, pool);
- }
- }
-
- return audio_stream;
-}
-
-static apt_bool_t mpf_rtp_stream_local_media_create(mpf_rtp_stream_t *rtp_stream, mpf_rtp_media_descriptor_t *local_media, mpf_rtp_media_descriptor_t *remote_media, mpf_stream_capabilities_t *capabilities)
-{
- apt_bool_t status = TRUE;
- if(!local_media) {
- /* local media is not specified, create the default one */
- local_media = apr_palloc(rtp_stream->pool,sizeof(mpf_rtp_media_descriptor_t));
- mpf_rtp_media_descriptor_init(local_media);
- local_media->state = MPF_MEDIA_ENABLED;
- local_media->direction = STREAM_DIRECTION_DUPLEX;
- }
- if(remote_media) {
- local_media->id = remote_media->id;
- }
- if(local_media->ip.length == 0) {
- local_media->ip = rtp_stream->config->ip;
- local_media->ext_ip = rtp_stream->config->ext_ip;
- }
- if(local_media->port == 0) {
- if(mpf_rtp_socket_pair_create(rtp_stream,local_media,FALSE) == TRUE) {
- /* RTP port management */
- mpf_rtp_config_t *rtp_config = rtp_stream->config;
- apr_port_t first_port_in_search = rtp_config->rtp_port_cur;
- apt_bool_t is_port_ok = FALSE;
- do {
- local_media->port = rtp_config->rtp_port_cur;
- rtp_config->rtp_port_cur += 2;
- if(rtp_config->rtp_port_cur == rtp_config->rtp_port_max) {
- rtp_config->rtp_port_cur = rtp_config->rtp_port_min;
- }
-
- if(mpf_rtp_socket_pair_bind(rtp_stream,local_media) == TRUE) {
- is_port_ok = TRUE;
- break;
- }
- } while(first_port_in_search != rtp_config->rtp_port_cur);
-
- if(is_port_ok == FALSE) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Find Free RTP Port %s:[%hu,%hu]",
- rtp_config->ip.buf,
- rtp_config->rtp_port_min,
- rtp_config->rtp_port_max);
- mpf_rtp_socket_pair_close(rtp_stream);
- status = FALSE;
- }
- }
- else {
- status = FALSE;
- }
- }
- else if(mpf_rtp_socket_pair_create(rtp_stream,local_media,TRUE) == FALSE) {
- status = FALSE;
- }
-
- if(status == FALSE) {
- local_media->state = MPF_MEDIA_DISABLED;
- }
-
- if(rtp_stream->settings->ptime) {
- local_media->ptime = rtp_stream->settings->ptime;
- }
-
- if(mpf_codec_list_is_empty(&local_media->codec_list) == TRUE) {
- if(mpf_codec_list_is_empty(&rtp_stream->settings->codec_list) == TRUE) {
- mpf_codec_manager_codec_list_get(
- rtp_stream->base->termination->codec_manager,
- &local_media->codec_list,
- rtp_stream->pool);
- }
- else {
- mpf_codec_list_copy(&local_media->codec_list,
- &rtp_stream->settings->codec_list,
- rtp_stream->pool);
- }
- }
-
- if(capabilities) {
- if(mpf_codec_list_match(&local_media->codec_list,&capabilities->codecs) == FALSE) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Match Codec List %s:%hu",
- local_media->ip.buf,
- local_media->port);
- local_media->state = MPF_MEDIA_DISABLED;
- status = FALSE;
- }
- }
-
- rtp_stream->local_media = local_media;
- return status;
-}
-
-static apt_bool_t mpf_rtp_stream_local_media_update(mpf_rtp_stream_t *rtp_stream, mpf_rtp_media_descriptor_t *media, mpf_stream_capabilities_t *capabilities)
-{
- apt_bool_t status = TRUE;
- if(apt_string_compare(&rtp_stream->local_media->ip,&media->ip) == FALSE ||
- rtp_stream->local_media->port != media->port) {
-
- mpf_rtp_socket_pair_close(rtp_stream);
-
- if(mpf_rtp_socket_pair_create(rtp_stream,media,TRUE) == FALSE) {
- media->state = MPF_MEDIA_DISABLED;
- status = FALSE;
- }
- }
- if(mpf_codec_list_is_empty(&media->codec_list) == TRUE) {
- mpf_codec_manager_codec_list_get(
- rtp_stream->base->termination->codec_manager,
- &media->codec_list,
- rtp_stream->pool);
- }
-
- if(capabilities) {
- if(mpf_codec_list_match(&media->codec_list,&capabilities->codecs) == FALSE) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Match Codec List %s:%hu",
- media->ip.buf,
- media->port);
- media->state = MPF_MEDIA_DISABLED;
- status = FALSE;
- }
- }
-
- rtp_stream->local_media = media;
- return status;
-}
-
-static apt_bool_t mpf_rtp_stream_remote_media_update(mpf_rtp_stream_t *rtp_stream, mpf_rtp_media_descriptor_t *media)
-{
- apt_bool_t status = TRUE;
- if(media->state == MPF_MEDIA_ENABLED) {
- if(!rtp_stream->remote_media ||
- apt_string_compare(&rtp_stream->remote_media->ip,&media->ip) == FALSE ||
- rtp_stream->remote_media->port != media->port) {
-
- /* update RTP port */
- rtp_stream->rtp_r_sockaddr = NULL;
- apr_sockaddr_info_get(
- &rtp_stream->rtp_r_sockaddr,
- media->ip.buf,
- APR_INET,
- media->port,
- 0,
- rtp_stream->pool);
- if(!rtp_stream->rtp_r_sockaddr) {
- status = FALSE;
- }
-
- /* update RTCP port */
- rtp_stream->rtcp_r_sockaddr = NULL;
- apr_sockaddr_info_get(
- &rtp_stream->rtcp_r_sockaddr,
- media->ip.buf,
- APR_INET,
- media->port+1,
- 0,
- rtp_stream->pool);
- }
- }
-
- rtp_stream->remote_media = media;
- return status;
-}
-
-static apt_bool_t mpf_rtp_stream_media_negotiate(mpf_rtp_stream_t *rtp_stream)
-{
- mpf_rtp_media_descriptor_t *local_media = rtp_stream->local_media;
- mpf_rtp_media_descriptor_t *remote_media = rtp_stream->remote_media;
- if(!local_media || !remote_media) {
- return FALSE;
- }
-
- local_media->id = remote_media->id;
- local_media->mid = remote_media->mid;
- local_media->ptime = remote_media->ptime;
-
- if(rtp_stream->state == MPF_MEDIA_DISABLED && remote_media->state == MPF_MEDIA_ENABLED) {
- /* enable RTP/RTCP session */
- rtp_stream->state = MPF_MEDIA_ENABLED;
- if(rtp_stream->rtp_l_sockaddr) {
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Enable RTP Session %s:%hu",
- rtp_stream->rtp_l_sockaddr->hostname,
- rtp_stream->rtp_l_sockaddr->port);
- }
-
- if(rtp_stream->rtcp_tx_timer) {
- apt_timer_set(rtp_stream->rtcp_tx_timer,rtp_stream->settings->rtcp_tx_interval);
- }
- if(rtp_stream->rtcp_rx_timer) {
- apt_timer_set(rtp_stream->rtcp_rx_timer,rtp_stream->settings->rtcp_rx_resolution);
- }
- }
- else if(rtp_stream->state == MPF_MEDIA_ENABLED && remote_media->state == MPF_MEDIA_DISABLED) {
- /* disable RTP/RTCP session */
- rtp_stream->state = MPF_MEDIA_DISABLED;
- if(rtp_stream->rtp_l_sockaddr) {
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Disable RTP Session %s:%hu",
- rtp_stream->rtp_l_sockaddr->hostname,
- rtp_stream->rtp_l_sockaddr->port);
- }
-
- if(rtp_stream->rtcp_tx_timer) {
- apt_timer_kill(rtp_stream->rtcp_tx_timer);
- }
- if(rtp_stream->rtcp_rx_timer) {
- apt_timer_kill(rtp_stream->rtcp_rx_timer);
- }
- if(rtp_stream->settings->rtcp == TRUE && rtp_stream->settings->rtcp_bye_policy != RTCP_BYE_DISABLE) {
- apt_str_t reason = {RTCP_BYE_SESSION_ENDED, sizeof(RTCP_BYE_SESSION_ENDED)-1};
- mpf_rtcp_bye_send(rtp_stream,&reason);
- }
- }
-
- local_media->state = remote_media->state;
- local_media->direction = mpf_stream_reverse_direction_get(remote_media->direction);
-
- if(remote_media->state == MPF_MEDIA_ENABLED) {
- mpf_codec_list_t *codec_list1 = NULL;
- mpf_codec_list_t *codec_list2 = NULL;
-
- /* intersect local and remote codecs */
- if(rtp_stream->settings->own_preferrence == TRUE) {
- codec_list1 = &local_media->codec_list;
- codec_list2 = &remote_media->codec_list;
- }
- else {
- codec_list2 = &local_media->codec_list;
- codec_list1 = &remote_media->codec_list;
- }
-
- if(mpf_codec_lists_intersect(codec_list1,codec_list2) == FALSE) {
- /* reject RTP/RTCP session */
- rtp_stream->state = MPF_MEDIA_DISABLED;
- local_media->direction = STREAM_DIRECTION_NONE;
- local_media->state = MPF_MEDIA_DISABLED;
- if(rtp_stream->rtp_l_sockaddr) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Reject RTP Session %s:%hu no codecs matched",
- rtp_stream->rtp_l_sockaddr->hostname,
- rtp_stream->rtp_l_sockaddr->port);
- }
-
- if(rtp_stream->rtcp_tx_timer) {
- apt_timer_kill(rtp_stream->rtcp_tx_timer);
- }
- if(rtp_stream->rtcp_rx_timer) {
- apt_timer_kill(rtp_stream->rtcp_rx_timer);
- }
- }
- }
-
- rtp_stream->base->direction = local_media->direction;
- return TRUE;
-}
-
-MPF_DECLARE(apt_bool_t) mpf_rtp_stream_add(mpf_audio_stream_t *stream)
-{
- return TRUE;
-}
-
-MPF_DECLARE(apt_bool_t) mpf_rtp_stream_remove(mpf_audio_stream_t *stream)
-{
- mpf_rtp_stream_t *rtp_stream = stream->obj;
-
- if(rtp_stream->state == MPF_MEDIA_ENABLED) {
- /* disable RTP/RTCP session */
- rtp_stream->state = MPF_MEDIA_DISABLED;
- if(rtp_stream->rtp_l_sockaddr) {
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Remove RTP Session %s:%hu",
- rtp_stream->rtp_l_sockaddr->hostname,
- rtp_stream->rtp_l_sockaddr->port);
- }
-
- if(rtp_stream->rtcp_tx_timer) {
- apt_timer_kill(rtp_stream->rtcp_tx_timer);
- }
- if(rtp_stream->rtcp_rx_timer) {
- apt_timer_kill(rtp_stream->rtcp_rx_timer);
- }
- if(rtp_stream->settings->rtcp == TRUE && rtp_stream->settings->rtcp_bye_policy != RTCP_BYE_DISABLE) {
- apt_str_t reason = {RTCP_BYE_SESSION_ENDED, sizeof(RTCP_BYE_SESSION_ENDED)-1};
- mpf_rtcp_bye_send(rtp_stream,&reason);
- }
- }
-
- mpf_rtp_socket_pair_close(rtp_stream);
- return TRUE;
-}
-
-MPF_DECLARE(apt_bool_t) mpf_rtp_stream_modify(mpf_audio_stream_t *stream, mpf_rtp_stream_descriptor_t *descriptor)
-{
- apt_bool_t status = TRUE;
- mpf_rtp_stream_t *rtp_stream = stream->obj;
- if(!rtp_stream) {
- return FALSE;
- }
-
- if(!rtp_stream->local_media) {
- /* create local media */
- status = mpf_rtp_stream_local_media_create(rtp_stream,descriptor->local,descriptor->remote,descriptor->capabilities);
- }
- else if(descriptor->local) {
- /* update local media */
- status = mpf_rtp_stream_local_media_update(rtp_stream,descriptor->local,descriptor->capabilities);
- }
-
- if(descriptor->remote && status == TRUE) {
- /* update remote media */
- mpf_rtp_stream_remote_media_update(rtp_stream,descriptor->remote);
-
- /* negotiate local and remote media */
- mpf_rtp_stream_media_negotiate(rtp_stream);
- }
-
- if((rtp_stream->base->direction & STREAM_DIRECTION_SEND) == STREAM_DIRECTION_SEND) {
- mpf_codec_list_t *codec_list = &rtp_stream->remote_media->codec_list;
- rtp_stream->base->tx_descriptor = codec_list->primary_descriptor;
- if(rtp_stream->base->tx_descriptor) {
- rtp_stream->transmitter.samples_per_frame =
- (apr_uint32_t)mpf_codec_frame_samples_calculate(rtp_stream->base->tx_descriptor);
- }
- if(codec_list->event_descriptor) {
- rtp_stream->base->tx_event_descriptor = codec_list->event_descriptor;
- }
- }
- if((rtp_stream->base->direction & STREAM_DIRECTION_RECEIVE) == STREAM_DIRECTION_RECEIVE) {
- mpf_codec_list_t *codec_list = &rtp_stream->local_media->codec_list;
- rtp_stream->base->rx_descriptor = codec_list->primary_descriptor;
- if(codec_list->event_descriptor) {
- rtp_stream->base->rx_event_descriptor = codec_list->event_descriptor;
- }
- }
-
- if(!descriptor->local) {
- descriptor->local = rtp_stream->local_media;
- }
- return status;
-}
-
-static apt_bool_t mpf_rtp_stream_destroy(mpf_audio_stream_t *stream)
-{
- return TRUE;
-}
-
-static apt_bool_t mpf_rtp_rx_stream_open(mpf_audio_stream_t *stream, mpf_codec_t *codec)
-{
- mpf_rtp_stream_t *rtp_stream = stream->obj;
- rtp_receiver_t *receiver = &rtp_stream->receiver;
- mpf_jb_config_t *jb_config = &rtp_stream->settings->jb_config;
- if(!rtp_stream->rtp_socket || !rtp_stream->rtp_l_sockaddr || !rtp_stream->rtp_r_sockaddr) {
- return FALSE;
- }
-
- receiver->jb = mpf_jitter_buffer_create(
- jb_config,
- stream->rx_descriptor,
- codec,
- rtp_stream->pool);
-
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,
- "Open RTP Receiver %s:%hu <- %s:%hu playout [%u ms] bounds [%u - %u ms] adaptive [%d] skew detection [%d]",
- rtp_stream->rtp_l_sockaddr->hostname,
- rtp_stream->rtp_l_sockaddr->port,
- rtp_stream->rtp_r_sockaddr->hostname,
- rtp_stream->rtp_r_sockaddr->port,
- jb_config->initial_playout_delay,
- jb_config->min_playout_delay,
- jb_config->max_playout_delay,
- jb_config->adaptive,
- jb_config->time_skew_detection);
- return TRUE;
-}
-
-static apt_bool_t mpf_rtp_rx_stream_close(mpf_audio_stream_t *stream)
-{
- mpf_rtp_stream_t *rtp_stream = stream->obj;
- rtp_receiver_t *receiver = &rtp_stream->receiver;
-
- if(!rtp_stream->rtp_l_sockaddr || !rtp_stream->rtp_r_sockaddr) {
- return FALSE;
- }
-
- receiver->stat.lost_packets = 0;
- if(receiver->stat.received_packets) {
- apr_uint32_t expected_packets = receiver->history.seq_cycles +
- receiver->history.seq_num_max - receiver->history.seq_num_base + 1;
- if(expected_packets > receiver->stat.received_packets) {
- receiver->stat.lost_packets = expected_packets - receiver->stat.received_packets;
- }
- }
-
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Close RTP Receiver %s:%hu <- %s:%hu [r:%u l:%u j:%u p:%u d:%u i:%u]",
- rtp_stream->rtp_l_sockaddr->hostname,
- rtp_stream->rtp_l_sockaddr->port,
- rtp_stream->rtp_r_sockaddr->hostname,
- rtp_stream->rtp_r_sockaddr->port,
- receiver->stat.received_packets,
- receiver->stat.lost_packets,
- receiver->rr_stat.jitter,
- mpf_jitter_buffer_playout_delay_get(receiver->jb),
- receiver->stat.discarded_packets,
- receiver->stat.ignored_packets);
- mpf_jitter_buffer_destroy(receiver->jb);
- return TRUE;
-}
-
-
-static APR_INLINE void rtp_rx_overall_stat_reset(rtp_receiver_t *receiver)
-{
- memset(&receiver->stat,0,sizeof(receiver->stat));
- memset(&receiver->history,0,sizeof(receiver->history));
- memset(&receiver->periodic_history,0,sizeof(receiver->periodic_history));
-}
-
-static APR_INLINE void rtp_rx_stat_init(rtp_receiver_t *receiver, rtp_header_t *header, apr_time_t *time)
-{
- receiver->rr_stat.ssrc = header->ssrc;
- receiver->history.seq_num_base = receiver->history.seq_num_max = (apr_uint16_t)header->sequence;
- receiver->history.ts_last = header->timestamp;
- receiver->history.time_last = *time;
-}
-
-static APR_INLINE void rtp_rx_restart(rtp_receiver_t *receiver)
-{
- apr_byte_t restarts = ++receiver->stat.restarts;
- rtp_rx_overall_stat_reset(receiver);
- mpf_jitter_buffer_restart(receiver->jb);
- receiver->stat.restarts = restarts;
-}
-
-static rtp_header_t* rtp_rx_header_skip(void **buffer, apr_size_t *size)
-{
- apr_size_t offset = 0;
- rtp_header_t *header = (rtp_header_t*)*buffer;
-
- /* RTP header validity check */
- if(header->version != RTP_VERSION) {
- return NULL;
- }
-
- /* calculate payload offset */
- offset = sizeof(rtp_header_t) + (header->count * sizeof(apr_uint32_t));
-
- /* additional offset in case of RTP extension */
- if(header->extension) {
- rtp_extension_header_t *ext_header = (rtp_extension_header_t*)(((apr_byte_t*)*buffer)+offset);
- offset += (ntohs(ext_header->length) * sizeof(apr_uint32_t));
- }
-
- if (offset >= *size) {
- return NULL;
- }
-
- /* skip to payload */
- *buffer = (apr_byte_t*)*buffer + offset;
- *size = *size - offset;
-
- return header;
-}
-
-static APR_INLINE void rtp_periodic_history_update(rtp_receiver_t *receiver)
-{
- apr_uint32_t expected_packets;
- apr_uint32_t expected_interval;
- apr_uint32_t received_interval;
- apr_uint32_t lost_interval;
-
- /* calculate expected packets */
- if(receiver->stat.received_packets) {
- expected_packets = receiver->history.seq_cycles +
- receiver->history.seq_num_max - receiver->history.seq_num_base + 1;
- }
- else {
- expected_packets = 0;
- }
-
- /* calculate expected interval */
- expected_interval = expected_packets - receiver->periodic_history.expected_prior;
- /* update expected prior */
- receiver->periodic_history.expected_prior = expected_packets;
-
- /* calculate received interval */
- received_interval = receiver->stat.received_packets - receiver->periodic_history.received_prior;
- /* update received prior */
- receiver->periodic_history.received_prior = receiver->stat.received_packets;
- /* calculate lost interval */
- if(expected_interval > received_interval) {
- lost_interval = expected_interval - received_interval;
- }
- else {
- lost_interval = 0;
- }
-
- /* update lost fraction */
- if(expected_interval == 0 || lost_interval == 0) {
- receiver->rr_stat.fraction = 0;
- }
- else {
- receiver->rr_stat.fraction = (lost_interval << 8) / expected_interval;
- }
-
- if(expected_packets > receiver->stat.received_packets) {
- receiver->rr_stat.lost = expected_packets - receiver->stat.received_packets;
- }
- else {
- receiver->rr_stat.lost = 0;
- }
-
- receiver->periodic_history.discarded_prior = receiver->stat.discarded_packets;
- receiver->periodic_history.jitter_min = receiver->rr_stat.jitter;
- receiver->periodic_history.jitter_max = receiver->rr_stat.jitter;
-}
-
-typedef enum {
- RTP_SSRC_UPDATE,
- RTP_SSRC_PROBATION,
- RTP_SSRC_RESTART
-} rtp_ssrc_result_e;
-
-static APR_INLINE rtp_ssrc_result_e rtp_rx_ssrc_update(rtp_receiver_t *receiver, apr_uint32_t ssrc)
-{
- if(receiver->rr_stat.ssrc == ssrc) {
- /* known ssrc */
- if(receiver->history.ssrc_probation) {
- /* reset the probation for new ssrc */
- receiver->history.ssrc_probation = 0;
- receiver->history.ssrc_new = 0;
- }
- }
- else {
- if(receiver->history.ssrc_new == ssrc) {
- if(--receiver->history.ssrc_probation == 0) {
- /* restart with new ssrc */
- receiver->rr_stat.ssrc = ssrc;
- return RTP_SSRC_RESTART;
- }
- else {
- return RTP_SSRC_PROBATION;
- }
- }
- else {
- /* start probation for new ssrc */
- receiver->history.ssrc_new = ssrc;
- receiver->history.ssrc_probation = 5;
- return RTP_SSRC_PROBATION;
- }
- }
- return RTP_SSRC_UPDATE;
-}
-
-typedef enum {
- RTP_SEQ_UPDATE,
- RTP_SEQ_MISORDER,
- RTP_SEQ_DRIFT
-} rtp_seq_result_e;
-
-static APR_INLINE rtp_seq_result_e rtp_rx_seq_update(rtp_receiver_t *receiver, apr_uint16_t seq_num)
-{
- rtp_seq_result_e result = RTP_SEQ_UPDATE;
- apr_uint16_t seq_delta = seq_num - receiver->history.seq_num_max;
- if(seq_delta < MAX_DROPOUT) {
- if(seq_num < receiver->history.seq_num_max) {
- /* sequence number wrapped */
- receiver->history.seq_cycles += RTP_SEQ_MOD;
- }
- receiver->history.seq_num_max = seq_num;
- }
- else if(seq_delta <= RTP_SEQ_MOD - MAX_MISORDER) {
- /* sequence number made a very large jump */
- result = RTP_SEQ_DRIFT;
- }
- else {
- /* duplicate or misordered packet */
- result = RTP_SEQ_MISORDER;
- }
- receiver->stat.received_packets++;
-
- return result;
-}
-
-typedef enum {
- RTP_TS_UPDATE,
- RTP_TS_DRIFT
-} rtp_ts_result_e;
-
-static APR_INLINE rtp_ts_result_e rtp_rx_ts_update(rtp_receiver_t *receiver, mpf_codec_descriptor_t *descriptor, apr_time_t *time, apr_uint32_t ts, apr_byte_t *marker)
-{
- apr_int32_t deviation;
- apr_int32_t time_diff;
-
- /* arrival time diff in msec */
- time_diff = (apr_int32_t)apr_time_as_msec(*time - receiver->history.time_last);
-
- /* if the time difference is more than the threshold (INTER_TALKSPURT_GAP),
- and the marker is not set, then this might be a beginning of a
- new malformed talkspurt */
- if(!*marker && time_diff > INTER_TALKSPURT_GAP) {
- /* set the missing marker */
- *marker = 1;
- }
-
- /* arrival time diff in samples */
- deviation = time_diff * descriptor->channel_count * descriptor->sampling_rate / 1000;
- /* arrival timestamp diff */
- deviation -= ts - receiver->history.ts_last;
-
- if(deviation < 0) {
- deviation = -deviation;
- }
-
- if(deviation > DEVIATION_THRESHOLD) {
- return RTP_TS_DRIFT;
- }
-
- receiver->rr_stat.jitter += deviation - ((receiver->rr_stat.jitter + 8) >> 4);
- RTP_TRACE("jitter=%u deviation=%d\n",receiver->rr_stat.jitter,deviation);
- receiver->history.time_last = *time;
- receiver->history.ts_last = ts;
-
- if(receiver->rr_stat.jitter < receiver->periodic_history.jitter_min) {
- receiver->periodic_history.jitter_min = receiver->rr_stat.jitter;
- }
- if(receiver->rr_stat.jitter > receiver->periodic_history.jitter_max) {
- receiver->periodic_history.jitter_max = receiver->rr_stat.jitter;
- }
- return RTP_TS_UPDATE;
-}
-
-static APR_INLINE void rtp_rx_failure_threshold_check(rtp_receiver_t *receiver)
-{
- apr_uint32_t received;
- apr_uint32_t discarded;
- received = receiver->stat.received_packets - receiver->periodic_history.received_prior;
- discarded = receiver->stat.discarded_packets - receiver->periodic_history.discarded_prior;
-
- if(discarded * 100 > received * DISCARDED_TO_RECEIVED_RATIO_THRESHOLD) {
- /* failure threshold reached -> restart */
- rtp_rx_restart(receiver);
- }
-}
-
-static apt_bool_t rtp_rx_packet_receive(mpf_rtp_stream_t *rtp_stream, void *buffer, apr_size_t size)
-{
- rtp_receiver_t *receiver = &rtp_stream->receiver;
- mpf_codec_descriptor_t *descriptor = rtp_stream->base->rx_descriptor;
- apr_time_t time;
- rtp_ssrc_result_e ssrc_result;
- rtp_header_t *header = rtp_rx_header_skip(&buffer,&size);
- if(!header) {
- /* invalid RTP packet */
- receiver->stat.invalid_packets++;
- return FALSE;
- }
-
- header->sequence = ntohs((apr_uint16_t)header->sequence);
- header->timestamp = ntohl(header->timestamp);
- header->ssrc = ntohl(header->ssrc);
-
- time = apr_time_now();
-
- RTP_TRACE("RTP time=%6u ssrc=%8x pt=%3u %cts=%9u seq=%5u size=%"APR_SIZE_T_FMT"\n",
- (apr_uint32_t)apr_time_usec(time),
- header->ssrc, header->type, (header->marker == 1) ? '*' : ' ',
- header->timestamp, header->sequence, size);
- if(!receiver->stat.received_packets) {
- /* initialization */
- rtp_rx_stat_init(receiver,header,&time);
- }
-
- ssrc_result = rtp_rx_ssrc_update(receiver,header->ssrc);
- if(ssrc_result == RTP_SSRC_PROBATION) {
- receiver->stat.invalid_packets++;
- return FALSE;
- }
- else if(ssrc_result == RTP_SSRC_RESTART) {
- rtp_rx_restart(receiver);
- rtp_rx_stat_init(receiver,header,&time);
- }
-
- rtp_rx_seq_update(receiver,(apr_uint16_t)header->sequence);
-
- if(header->type == descriptor->payload_type) {
- /* codec */
- apr_byte_t marker = (apr_byte_t)header->marker;
- if(rtp_rx_ts_update(receiver,descriptor,&time,header->timestamp,&marker) == RTP_TS_DRIFT) {
- rtp_rx_restart(receiver);
- return FALSE;
- }
-
- if(mpf_jitter_buffer_write(receiver->jb,buffer,size,header->timestamp,marker) != JB_OK) {
- receiver->stat.discarded_packets++;
- rtp_rx_failure_threshold_check(receiver);
- }
- }
- else if(rtp_stream->base->rx_event_descriptor &&
- header->type == rtp_stream->base->rx_event_descriptor->payload_type) {
- /* named event */
- mpf_named_event_frame_t *named_event = (mpf_named_event_frame_t *)buffer;
- named_event->duration = ntohs((apr_uint16_t)named_event->duration);
- if(mpf_jitter_buffer_event_write(receiver->jb,named_event,header->timestamp,(apr_byte_t)header->marker) != JB_OK) {
- receiver->stat.discarded_packets++;
- }
- }
- else if(header->type == RTP_PT_CN) {
- /* CN packet */
- receiver->stat.ignored_packets++;
- }
- else {
- /* invalid payload type */
- receiver->stat.ignored_packets++;
- }
-
- return TRUE;
-}
-
-static apt_bool_t rtp_rx_process(mpf_rtp_stream_t *rtp_stream)
-{
- char buffer[MAX_RTP_PACKET_SIZE];
- apr_size_t size = sizeof(buffer);
- apr_size_t max_count = 5;
- while(max_count && apr_socket_recv(rtp_stream->rtp_socket,buffer,&size) == APR_SUCCESS) {
- rtp_rx_packet_receive(rtp_stream,buffer,size);
-
- size = sizeof(buffer);
- max_count--;
- }
- return TRUE;
-}
-
-static apt_bool_t mpf_rtp_stream_receive(mpf_audio_stream_t *stream, mpf_frame_t *frame)
-{
- mpf_rtp_stream_t *rtp_stream = stream->obj;
- rtp_rx_process(rtp_stream);
-
- return mpf_jitter_buffer_read(rtp_stream->receiver.jb,frame);
-}
-
-
-static apt_bool_t mpf_rtp_tx_stream_open(mpf_audio_stream_t *stream, mpf_codec_t *codec)
-{
- apr_size_t frame_size;
- mpf_rtp_stream_t *rtp_stream = stream->obj;
- rtp_transmitter_t *transmitter = &rtp_stream->transmitter;
-
- if(!rtp_stream->rtp_socket || !rtp_stream->rtp_l_sockaddr || !rtp_stream->rtp_r_sockaddr) {
- return FALSE;
- }
-
- if(!codec) {
- return FALSE;
- }
-
- if(!transmitter->ptime) {
- if(rtp_stream->settings && rtp_stream->settings->ptime) {
- transmitter->ptime = rtp_stream->settings->ptime;
- }
- else {
- transmitter->ptime = 20;
- }
- }
- transmitter->packet_frames = transmitter->ptime / CODEC_FRAME_TIME_BASE;
- transmitter->current_frames = 0;
-
- frame_size = mpf_codec_frame_size_calculate(
- stream->tx_descriptor,
- codec->attribs);
- transmitter->packet_data = apr_palloc(
- rtp_stream->pool,
- sizeof(rtp_header_t) + transmitter->packet_frames * frame_size);
-
- transmitter->inactivity = 1;
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Open RTP Transmitter %s:%hu -> %s:%hu",
- rtp_stream->rtp_l_sockaddr->hostname,
- rtp_stream->rtp_l_sockaddr->port,
- rtp_stream->rtp_r_sockaddr->hostname,
- rtp_stream->rtp_r_sockaddr->port);
- return TRUE;
-}
-
-static apt_bool_t mpf_rtp_tx_stream_close(mpf_audio_stream_t *stream)
-{
- mpf_rtp_stream_t *rtp_stream = stream->obj;
- if(!rtp_stream->rtp_l_sockaddr || !rtp_stream->rtp_r_sockaddr) {
- return FALSE;
- }
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Close RTP Transmitter %s:%hu -> %s:%hu [s:%u o:%u]",
- rtp_stream->rtp_l_sockaddr->hostname,
- rtp_stream->rtp_l_sockaddr->port,
- rtp_stream->rtp_r_sockaddr->hostname,
- rtp_stream->rtp_r_sockaddr->port,
- rtp_stream->transmitter.sr_stat.sent_packets,
- rtp_stream->transmitter.sr_stat.sent_octets);
- return TRUE;
-}
-
-
-static APR_INLINE void rtp_header_prepare(
- rtp_transmitter_t *transmitter,
- rtp_header_t *header,
- apr_byte_t payload_type,
- apr_byte_t marker,
- apr_uint32_t timestamp)
-{
- header->version = RTP_VERSION;
- header->padding = 0;
- header->extension = 0;
- header->count = 0;
- header->marker = marker;
- header->type = payload_type;
- header->timestamp = timestamp;
- header->ssrc = htonl(transmitter->sr_stat.ssrc);
-}
-
-static APR_INLINE apt_bool_t mpf_rtp_data_send(mpf_rtp_stream_t *rtp_stream, rtp_transmitter_t *transmitter, const mpf_frame_t *frame)
-{
- apt_bool_t status = TRUE;
- memcpy(
- transmitter->packet_data + transmitter->packet_size,
- frame->codec_frame.buffer,
- frame->codec_frame.size);
- transmitter->packet_size += frame->codec_frame.size;
-
- if(++transmitter->current_frames == transmitter->packet_frames) {
- rtp_header_t *header = (rtp_header_t*)transmitter->packet_data;
- header->sequence = htons(++transmitter->last_seq_num);
- RTP_TRACE("> RTP time=%6u ssrc=%8x pt=%3u %cts=%9u seq=%5hu\n",
- (apr_uint32_t)apr_time_usec(apr_time_now()),
- transmitter->sr_stat.ssrc, header->type,
- (header->marker == 1) ? '*' : ' ',
- header->timestamp, transmitter->last_seq_num);
- header->timestamp = htonl(header->timestamp);
- if(apr_socket_sendto(
- rtp_stream->rtp_socket,
- rtp_stream->rtp_r_sockaddr,
- 0,
- transmitter->packet_data,
- &transmitter->packet_size) == APR_SUCCESS) {
- transmitter->sr_stat.sent_packets++;
- transmitter->sr_stat.sent_octets += (apr_uint32_t)transmitter->packet_size - sizeof(rtp_header_t);
- }
- else {
- status = FALSE;
- }
- transmitter->current_frames = 0;
- }
- return status;
-}
-
-static APR_INLINE apt_bool_t mpf_rtp_event_send(mpf_rtp_stream_t *rtp_stream, rtp_transmitter_t *transmitter, const mpf_frame_t *frame)
-{
- char packet_data[20];
- apr_size_t packet_size = sizeof(rtp_header_t) + sizeof(mpf_named_event_frame_t);
- rtp_header_t *header = (rtp_header_t*) packet_data;
- mpf_named_event_frame_t *named_event = (mpf_named_event_frame_t*)(header+1);
- rtp_header_prepare(
- transmitter,
- header,
- rtp_stream->base->tx_event_descriptor->payload_type,
- (frame->marker == MPF_MARKER_START_OF_EVENT) ? 1 : 0,
- transmitter->timestamp_base);
-
- *named_event = frame->event_frame;
- named_event->edge = (frame->marker == MPF_MARKER_END_OF_EVENT) ? 1 : 0;
-
- header->sequence = htons(++transmitter->last_seq_num);
- RTP_TRACE("> RTP time=%6u ssrc=%8x pt=%3u %cts=%9u seq=%hu event=%2u dur=%3u %c\n",
- (apr_uint32_t)apr_time_usec(apr_time_now()),
- transmitter->sr_stat.ssrc,
- header->type, (header->marker == 1) ? '*' : ' ',
- header->timestamp, transmitter->last_seq_num,
- named_event->event_id, named_event->duration,
- (named_event->edge == 1) ? '*' : ' ');
- header->timestamp = htonl(header->timestamp);
- named_event->duration = htons((apr_uint16_t)named_event->duration);
- if(apr_socket_sendto(
- rtp_stream->rtp_socket,
- rtp_stream->rtp_r_sockaddr,
- 0,
- packet_data,
- &packet_size) != APR_SUCCESS) {
- return FALSE;
- }
- transmitter->sr_stat.sent_packets++;
- transmitter->sr_stat.sent_octets += sizeof(mpf_named_event_frame_t);
- return TRUE;
-}
-
-static apt_bool_t mpf_rtp_stream_transmit(mpf_audio_stream_t *stream, const mpf_frame_t *frame)
-{
- apt_bool_t status = TRUE;
- mpf_rtp_stream_t *rtp_stream = stream->obj;
- rtp_transmitter_t *transmitter = &rtp_stream->transmitter;
-
- transmitter->timestamp += transmitter->samples_per_frame;
-
- if(frame->type == MEDIA_FRAME_TYPE_NONE) {
- if(!transmitter->inactivity) {
- if(transmitter->current_frames == 0) {
- /* set inactivity (ptime alligned) */
- transmitter->inactivity = 1;
- if(rtp_stream->settings->rtcp == TRUE && rtp_stream->settings->rtcp_bye_policy == RTCP_BYE_PER_TALKSPURT) {
- apt_str_t reason = {RTCP_BYE_TALKSPURT_ENDED, sizeof(RTCP_BYE_TALKSPURT_ENDED)-1};
- mpf_rtcp_bye_send(rtp_stream,&reason);
- }
- }
- else {
- /* ptime allignment */
- status = mpf_rtp_data_send(rtp_stream,transmitter,frame);
- }
- }
- return status;
- }
-
- if((frame->type & MEDIA_FRAME_TYPE_EVENT) == MEDIA_FRAME_TYPE_EVENT){
- /* transmit event as soon as received */
- if(stream->tx_event_descriptor) {
- if(frame->marker == MPF_MARKER_START_OF_EVENT) {
- /* store start time (base) of the event */
- transmitter->timestamp_base = transmitter->timestamp;
- }
- else if(frame->marker == MPF_MARKER_NEW_SEGMENT) {
- /* update base in case of long-lasting events */
- transmitter->timestamp_base = transmitter->timestamp;
- }
-
- status = mpf_rtp_event_send(rtp_stream,transmitter,frame);
- }
- }
-
- if((frame->type & MEDIA_FRAME_TYPE_AUDIO) == MEDIA_FRAME_TYPE_AUDIO){
- if(transmitter->current_frames == 0) {
- rtp_header_t *header = (rtp_header_t*)transmitter->packet_data;
- rtp_header_prepare(
- transmitter,
- header,
- stream->tx_descriptor->payload_type,
- transmitter->inactivity,
- transmitter->timestamp);
- transmitter->packet_size = sizeof(rtp_header_t);
- if(transmitter->inactivity) {
- transmitter->inactivity = 0;
- }
- }
- status = mpf_rtp_data_send(rtp_stream,transmitter,frame);
- }
-
- return status;
-}
-
-static apt_bool_t mpf_socket_create(apr_pool_t *pool, apr_socket_t **socket)
-{
- if(!socket)
- return FALSE;
-
- if(apr_socket_create(socket,APR_INET,SOCK_DGRAM,0,pool) != APR_SUCCESS) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Socket");
- *socket = NULL;
- return FALSE;
- }
-
- apr_socket_opt_set(*socket,APR_SO_NONBLOCK,1);
- apr_socket_timeout_set(*socket,0);
- return TRUE;
-}
-
-static apt_bool_t mpf_socket_bind(apr_socket_t *socket, const char *ip, apr_port_t port, apr_pool_t *pool, apr_sockaddr_t **l_sockaddr)
-{
- if(!socket || !l_sockaddr)
- return FALSE;
-
- *l_sockaddr = NULL;
- apr_sockaddr_info_get(
- l_sockaddr,
- ip,
- APR_INET,
- port,
- 0,
- pool);
- if(!*l_sockaddr) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Get Sockaddr %s:%hu",ip,port);
- return FALSE;
- }
-
- if(apr_socket_bind(socket,*l_sockaddr) != APR_SUCCESS) {
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Failed to Bind Socket to %s:%hu", ip,port);
- return FALSE;
- }
- return TRUE;
-}
-
-/* Create RTP/RTCP sockets */
-static apt_bool_t mpf_rtp_socket_pair_create(mpf_rtp_stream_t *stream, mpf_rtp_media_descriptor_t *local_media, apt_bool_t bind)
-{
- /* Create and optionally bind RTP socket. Return FALSE in case of an error. */
- if(mpf_socket_create(stream->pool,&stream->rtp_socket) == FALSE) {
- return FALSE;
- }
- if(bind == TRUE) {
- if(mpf_socket_bind(stream->rtp_socket,local_media->ip.buf,local_media->port,stream->pool,&stream->rtp_l_sockaddr) == FALSE) {
- apr_socket_close(stream->rtp_socket);
- stream->rtp_socket = NULL;
- return FALSE;
- }
- }
-
- /* Create and optionally bind RCTP socket. Continue in either way. */
- if(mpf_socket_create(stream->pool,&stream->rtcp_socket) == TRUE && bind == TRUE) {
- if(mpf_socket_bind(stream->rtcp_socket,local_media->ip.buf,local_media->port+1,stream->pool,&stream->rtcp_l_sockaddr) == FALSE) {
- apr_socket_close(stream->rtcp_socket);
- stream->rtcp_socket = NULL;
- }
- }
- return TRUE;
-}
-
-/* Bind RTP/RTCP sockets */
-static apt_bool_t mpf_rtp_socket_pair_bind(mpf_rtp_stream_t *stream, mpf_rtp_media_descriptor_t *local_media)
-{
- /* Bind RTP socket. Return FALSE in case of an error. */
- if(mpf_socket_bind(stream->rtp_socket,local_media->ip.buf,local_media->port,stream->pool,&stream->rtp_l_sockaddr) == FALSE) {
- return FALSE;
- }
-
- /* Try to bind RTCP socket. Continue in either way. */
- mpf_socket_bind(stream->rtcp_socket,local_media->ip.buf,local_media->port+1,stream->pool,&stream->rtcp_l_sockaddr);
- return TRUE;
-}
-
-/* Close RTP/RTCP sockets */
-static void mpf_rtp_socket_pair_close(mpf_rtp_stream_t *stream)
-{
- if(stream->rtp_socket) {
- apr_socket_close(stream->rtp_socket);
- stream->rtp_socket = NULL;
- }
- if(stream->rtcp_socket) {
- apr_socket_close(stream->rtcp_socket);
- stream->rtcp_socket = NULL;
- }
-}
-
-
-
-static APR_INLINE void rtcp_sr_generate(mpf_rtp_stream_t *rtp_stream, rtcp_sr_stat_t *sr_stat)
-{
- *sr_stat = rtp_stream->transmitter.sr_stat;
- apt_ntp_time_get(&sr_stat->ntp_sec, &sr_stat->ntp_frac);
- sr_stat->rtp_ts = rtp_stream->transmitter.timestamp;
-
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Generate RTCP SR [ssrc:%u s:%u o:%u ts:%u]",
- sr_stat->ssrc,
- sr_stat->sent_packets,
- sr_stat->sent_octets,
- sr_stat->rtp_ts);
- rtcp_sr_hton(sr_stat);
-}
-
-static APR_INLINE void rtcp_rr_generate(mpf_rtp_stream_t *rtp_stream, rtcp_rr_stat_t *rr_stat)
-{
- *rr_stat = rtp_stream->receiver.rr_stat;
- rr_stat->last_seq = rtp_stream->receiver.history.seq_num_max;
-
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Generate RTCP RR [ssrc:%u last_seq:%u j:%u lost:%u frac:%d]",
- rr_stat->ssrc,
- rr_stat->last_seq,
- rr_stat->jitter,
- rr_stat->lost,
- rr_stat->fraction);
- rtcp_rr_hton(rr_stat);
-}
-
-/* Generate either RTCP SR or RTCP RR packet */
-static APR_INLINE apr_size_t rtcp_report_generate(mpf_rtp_stream_t *rtp_stream, rtcp_packet_t *rtcp_packet, apr_size_t length)
-{
- apr_size_t offset = 0;
- rtcp_header_init(&rtcp_packet->header,RTCP_RR);
- if(rtp_stream->base->direction & STREAM_DIRECTION_SEND) {
- rtcp_packet->header.pt = RTCP_SR;
- }
- if(rtp_stream->base->direction & STREAM_DIRECTION_RECEIVE) {
- rtcp_packet->header.count = 1;
- }
- offset += sizeof(rtcp_header_t);
-
- if(rtcp_packet->header.pt == RTCP_SR) {
- rtcp_sr_generate(rtp_stream,&rtcp_packet->r.sr.sr_stat);
- offset += sizeof(rtcp_sr_stat_t);
- if(rtcp_packet->header.count) {
- rtcp_rr_generate(rtp_stream,rtcp_packet->r.sr.rr_stat);
- offset += sizeof(rtcp_rr_stat_t);
- }
- }
- else if(rtcp_packet->header.pt == RTCP_RR) {
- rtcp_packet->r.rr.ssrc = htonl(rtp_stream->transmitter.sr_stat.ssrc);
- rtcp_rr_generate(rtp_stream,rtcp_packet->r.rr.rr_stat);
- offset += sizeof(rtcp_packet->r.rr);
- }
- rtcp_header_length_set(&rtcp_packet->header,offset);
- return offset;
-}
-
-/* Generate RTCP SDES packet */
-static APR_INLINE apr_size_t rtcp_sdes_generate(mpf_rtp_stream_t *rtp_stream, rtcp_packet_t *rtcp_packet, apr_size_t length)
-{
- rtcp_sdes_item_t *item;
- apr_size_t offset = 0;
- apr_size_t padding;
- rtcp_header_init(&rtcp_packet->header,RTCP_SDES);
- offset += sizeof(rtcp_header_t);
-
- rtcp_packet->header.count ++;
- rtcp_packet->r.sdes.ssrc = htonl(rtp_stream->transmitter.sr_stat.ssrc);
- offset += sizeof(apr_uint32_t);
-
- /* insert SDES CNAME item */
- item = &rtcp_packet->r.sdes.item[0];
- item->type = RTCP_SDES_CNAME;
- item->length = (apr_byte_t)rtp_stream->local_media->ip.length;
- memcpy(item->data,rtp_stream->local_media->ip.buf,item->length);
- offset += sizeof(rtcp_sdes_item_t) - 1 + item->length;
-
- /* terminate with end marker and pad to next 4-octet boundary */
- padding = 4 - (offset & 0x3);
- while(padding--) {
- item = (rtcp_sdes_item_t*) ((char*)rtcp_packet + offset);
- item->type = RTCP_SDES_END;
- offset++;
- }
-
- rtcp_header_length_set(&rtcp_packet->header,offset);
- return offset;
-}
-
-/* Generate RTCP BYE packet */
-static APR_INLINE apr_size_t rtcp_bye_generate(mpf_rtp_stream_t *rtp_stream, rtcp_packet_t *rtcp_packet, apr_size_t length, apt_str_t *reason)
-{
- apr_size_t offset = 0;
- rtcp_header_init(&rtcp_packet->header,RTCP_BYE);
- offset += sizeof(rtcp_header_t);
-
- rtcp_packet->r.bye.ssrc[0] = htonl(rtp_stream->transmitter.sr_stat.ssrc);
- rtcp_packet->header.count++;
- offset += rtcp_packet->header.count * sizeof(apr_uint32_t);
-
- if(reason->length) {
- apr_size_t padding;
-
- memcpy(rtcp_packet->r.bye.data,reason->buf,reason->length);
- rtcp_packet->r.bye.length = (apr_byte_t)reason->length;
- offset += rtcp_packet->r.bye.length;
-
- /* terminate with end marker and pad to next 4-octet boundary */
- padding = 4 - (reason->length & 0x3);
- if(padding) {
- char *end = rtcp_packet->r.bye.data + reason->length;
- memset(end,0,padding);
- offset += padding;
- }
- }
-
- rtcp_header_length_set(&rtcp_packet->header,offset);
- return offset;
-}
-
-/* Send compound RTCP packet (SR/RR + SDES) */
-static apt_bool_t mpf_rtcp_report_send(mpf_rtp_stream_t *rtp_stream)
-{
- char buffer[MAX_RTCP_PACKET_SIZE];
- apr_size_t length = 0;
- rtcp_packet_t *rtcp_packet;
-
- if(!rtp_stream->rtcp_socket || !rtp_stream->rtcp_l_sockaddr || !rtp_stream->rtcp_r_sockaddr) {
- /* session is not initialized */
- return FALSE;
- }
-
- if(rtp_stream->base->direction != STREAM_DIRECTION_NONE) {
- /* update periodic (prior) history */
- rtp_periodic_history_update(&rtp_stream->receiver);
- }
-
- rtcp_packet = (rtcp_packet_t*) (buffer + length);
- length += rtcp_report_generate(rtp_stream,rtcp_packet,sizeof(buffer)-length);
-
- rtcp_packet = (rtcp_packet_t*) (buffer + length);
- length += rtcp_sdes_generate(rtp_stream,rtcp_packet,sizeof(buffer)-length);
-
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Send Compound RTCP Packet [%"APR_SIZE_T_FMT" bytes] %s:%hu -> %s:%hu",
- length,
- rtp_stream->rtcp_l_sockaddr->hostname,
- rtp_stream->rtcp_l_sockaddr->port,
- rtp_stream->rtcp_r_sockaddr->hostname,
- rtp_stream->rtcp_r_sockaddr->port);
- if(apr_socket_sendto(
- rtp_stream->rtcp_socket,
- rtp_stream->rtcp_r_sockaddr,
- 0,
- buffer,
- &length) != APR_SUCCESS) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Send Compound RTCP Packet [%"APR_SIZE_T_FMT" bytes] %s:%hu -> %s:%hu",
- length,
- rtp_stream->rtcp_l_sockaddr->hostname,
- rtp_stream->rtcp_l_sockaddr->port,
- rtp_stream->rtcp_r_sockaddr->hostname,
- rtp_stream->rtcp_r_sockaddr->port);
- return FALSE;
- }
- return TRUE;
-}
-
-/* Send compound RTCP packet (SR/RR + SDES + BYE) */
-static apt_bool_t mpf_rtcp_bye_send(mpf_rtp_stream_t *rtp_stream, apt_str_t *reason)
-{
- char buffer[MAX_RTCP_PACKET_SIZE];
- apr_size_t length = 0;
- rtcp_packet_t *rtcp_packet;
-
- if(!rtp_stream->rtcp_socket || !rtp_stream->rtcp_l_sockaddr || !rtp_stream->rtcp_r_sockaddr) {
- /* session is not initialized */
- return FALSE;
- }
-
- if(rtp_stream->base->direction != STREAM_DIRECTION_NONE) {
- /* update periodic (prior) history */
- rtp_periodic_history_update(&rtp_stream->receiver);
- }
-
- rtcp_packet = (rtcp_packet_t*) (buffer + length);
- length += rtcp_report_generate(rtp_stream,rtcp_packet,sizeof(buffer)-length);
-
- rtcp_packet = (rtcp_packet_t*) (buffer + length);
- length += rtcp_sdes_generate(rtp_stream,rtcp_packet,sizeof(buffer)-length);
-
- rtcp_packet = (rtcp_packet_t*) (buffer + length);
- length += rtcp_bye_generate(rtp_stream,rtcp_packet,sizeof(buffer)-length,reason);
-
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Send Compound RTCP Packet [BYE] [%"APR_SIZE_T_FMT" bytes] %s:%hu -> %s:%hu",
- length,
- rtp_stream->rtcp_l_sockaddr->hostname,
- rtp_stream->rtcp_l_sockaddr->port,
- rtp_stream->rtcp_r_sockaddr->hostname,
- rtp_stream->rtcp_r_sockaddr->port);
- if(apr_socket_sendto(
- rtp_stream->rtcp_socket,
- rtp_stream->rtcp_r_sockaddr,
- 0,
- buffer,
- &length) != APR_SUCCESS) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Send Compound RTCP Packet [BYE] [%"APR_SIZE_T_FMT" bytes] %s:%hu -> %s:%hu",
- length,
- rtp_stream->rtcp_l_sockaddr->hostname,
- rtp_stream->rtcp_l_sockaddr->port,
- rtp_stream->rtcp_r_sockaddr->hostname,
- rtp_stream->rtcp_r_sockaddr->port);
- return FALSE;
- }
- return TRUE;
-}
-
-static APR_INLINE void rtcp_sr_get(mpf_rtp_stream_t *rtp_stream, rtcp_sr_stat_t *sr_stat)
-{
- rtcp_sr_ntoh(sr_stat);
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Get RTCP SR [ssrc:%u s:%u o:%u ts:%u]",
- sr_stat->ssrc,
- sr_stat->sent_packets,
- sr_stat->sent_octets,
- sr_stat->rtp_ts);
-}
-
-static APR_INLINE void rtcp_rr_get(mpf_rtp_stream_t *rtp_stream, rtcp_rr_stat_t *rr_stat)
-{
- rtcp_rr_ntoh(rr_stat);
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Get RTCP RR [ssrc:%u last_seq:%u j:%u lost:%u frac:%d]",
- rr_stat->ssrc,
- rr_stat->last_seq,
- rr_stat->jitter,
- rr_stat->lost,
- rr_stat->fraction);
-}
-
-static apt_bool_t mpf_rtcp_compound_packet_receive(mpf_rtp_stream_t *rtp_stream, char *buffer, apr_size_t length)
-{
- rtcp_packet_t *rtcp_packet = (rtcp_packet_t*) buffer;
- rtcp_packet_t *rtcp_packet_end;
-
- rtcp_packet_end = (rtcp_packet_t*)(buffer + length);
-
- while(rtcp_packet < rtcp_packet_end && rtcp_packet->header.version == RTP_VERSION) {
- rtcp_packet->header.length = ntohs((apr_uint16_t)rtcp_packet->header.length);
-
- if(rtcp_packet->header.pt == RTCP_SR) {
- /* RTCP SR */
- rtcp_sr_get(rtp_stream,&rtcp_packet->r.sr.sr_stat);
- if(rtcp_packet->header.count) {
- rtcp_rr_get(rtp_stream,rtcp_packet->r.sr.rr_stat);
- }
- }
- else if(rtcp_packet->header.pt == RTCP_RR) {
- /* RTCP RR */
- rtcp_packet->r.rr.ssrc = ntohl(rtcp_packet->r.rr.ssrc);
- if(rtcp_packet->header.count) {
- rtcp_rr_get(rtp_stream,rtcp_packet->r.rr.rr_stat);
- }
- }
- else if(rtcp_packet->header.pt == RTCP_SDES) {
- /* RTCP SDES */
- }
- else if(rtcp_packet->header.pt == RTCP_BYE) {
- /* RTCP BYE */
- }
- else {
- /* unknown RTCP packet */
- }
-
- /* get next RTCP packet */
- rtcp_packet = (rtcp_packet_t*)((apr_uint32_t*)rtcp_packet + rtcp_packet->header.length + 1);
- }
-
- if(rtcp_packet != rtcp_packet_end) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Malformed Compound RTCP Packet");
- return FALSE;
- }
-
- return TRUE;
-}
-
-static void mpf_rtcp_tx_timer_proc(apt_timer_t *timer, void *obj)
-{
- mpf_rtp_stream_t *rtp_stream = obj;
-
- /* generate and send RTCP compound report (SR/RR + SDES) */
- mpf_rtcp_report_send(rtp_stream);
-
- /* re-schedule timer */
- apt_timer_set(timer,rtp_stream->settings->rtcp_tx_interval);
-}
-
-static void mpf_rtcp_rx_timer_proc(apt_timer_t *timer, void *obj)
-{
- mpf_rtp_stream_t *rtp_stream = obj;
- if(rtp_stream->rtcp_socket && rtp_stream->rtcp_l_sockaddr && rtp_stream->rtcp_r_sockaddr) {
- char buffer[MAX_RTCP_PACKET_SIZE];
- apr_size_t length = sizeof(buffer);
-
- if(apr_socket_recv(rtp_stream->rtcp_socket,buffer,&length) == APR_SUCCESS) {
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Receive Compound RTCP Packet [%"APR_SIZE_T_FMT" bytes] %s:%hu <- %s:%hu",
- length,
- rtp_stream->rtcp_l_sockaddr->hostname,
- rtp_stream->rtcp_l_sockaddr->port,
- rtp_stream->rtcp_r_sockaddr->hostname,
- rtp_stream->rtcp_r_sockaddr->port);
- mpf_rtcp_compound_packet_receive(rtp_stream,buffer,length);
- }
- }
-
- /* re-schedule timer */
- apt_timer_set(timer,rtp_stream->settings->rtcp_rx_resolution);
-}
diff --git a/libs/unimrcp/libs/mpf/src/mpf_rtp_termination_factory.c b/libs/unimrcp/libs/mpf/src/mpf_rtp_termination_factory.c
deleted file mode 100644
index 497c33da41..0000000000
--- a/libs/unimrcp/libs/mpf/src/mpf_rtp_termination_factory.c
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mpf_rtp_termination_factory.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include
-#include "mpf_termination.h"
-#include "mpf_rtp_termination_factory.h"
-#include "mpf_rtp_stream.h"
-#include "apt_log.h"
-
-typedef struct media_engine_slot_t media_engine_slot_t;
-typedef struct rtp_termination_factory_t rtp_termination_factory_t;
-
-struct media_engine_slot_t {
- mpf_engine_t *media_engine;
- mpf_rtp_config_t *rtp_config;
-};
-
-struct rtp_termination_factory_t {
- mpf_termination_factory_t base;
-
- mpf_rtp_config_t *config;
- apr_array_header_t *media_engine_slots;
- apr_pool_t *pool;
-};
-
-static apt_bool_t mpf_rtp_termination_destroy(mpf_termination_t *termination)
-{
- return TRUE;
-}
-
-static apt_bool_t mpf_rtp_termination_add(mpf_termination_t *termination, void *descriptor)
-{
- apt_bool_t status = TRUE;
- mpf_rtp_termination_descriptor_t *rtp_descriptor = descriptor;
- mpf_audio_stream_t *audio_stream = termination->audio_stream;
- if(!audio_stream) {
- int i;
- media_engine_slot_t *slot;
- rtp_termination_factory_t *rtp_termination_factory = (rtp_termination_factory_t*)termination->termination_factory;
- mpf_rtp_config_t *rtp_config = rtp_termination_factory->config;
- for(i=0; imedia_engine_slots->nelts; i++) {
- slot = &APR_ARRAY_IDX(rtp_termination_factory->media_engine_slots,i,media_engine_slot_t);
- if(slot->media_engine == termination->media_engine) {
- rtp_config = slot->rtp_config;
- break;
- }
- }
- audio_stream = mpf_rtp_stream_create(
- termination,
- rtp_config,
- rtp_descriptor->audio.settings,
- termination->pool);
- if(!audio_stream) {
- return FALSE;
- }
- termination->audio_stream = audio_stream;
- }
-
- status = mpf_rtp_stream_add(audio_stream);
- if(rtp_descriptor) {
- status = mpf_rtp_stream_modify(audio_stream,&rtp_descriptor->audio);
- }
- return status;
-}
-
-static apt_bool_t mpf_rtp_termination_modify(mpf_termination_t *termination, void *descriptor)
-{
- apt_bool_t status = TRUE;
- mpf_rtp_termination_descriptor_t *rtp_descriptor = descriptor;
- mpf_audio_stream_t *audio_stream = termination->audio_stream;
- if(!audio_stream) {
- return FALSE;
- }
-
- if(rtp_descriptor) {
- status = mpf_rtp_stream_modify(audio_stream,&rtp_descriptor->audio);
- }
- return status;
-}
-
-static apt_bool_t mpf_rtp_termination_subtract(mpf_termination_t *termination)
-{
- mpf_audio_stream_t *audio_stream = termination->audio_stream;
- if(!audio_stream) {
- return FALSE;
- }
-
- return mpf_rtp_stream_remove(audio_stream);
-}
-
-static const mpf_termination_vtable_t rtp_vtable = {
- mpf_rtp_termination_destroy,
- mpf_rtp_termination_add,
- mpf_rtp_termination_modify,
- mpf_rtp_termination_subtract
-};
-
-static mpf_termination_t* mpf_rtp_termination_create(mpf_termination_factory_t *termination_factory, void *obj, apr_pool_t *pool)
-{
- mpf_termination_t *termination = mpf_termination_base_create(termination_factory,obj,&rtp_vtable,NULL,NULL,pool);
- if(termination) {
- termination->name = "rtp-tm";
- }
- return termination;
-}
-
-static apt_bool_t mpf_rtp_factory_engine_assign(mpf_termination_factory_t *termination_factory, mpf_engine_t *media_engine)
-{
- int i;
- media_engine_slot_t *slot;
- mpf_rtp_config_t *rtp_config;
- rtp_termination_factory_t *rtp_termination_factory;
- if(!termination_factory || !media_engine) {
- return FALSE;
- }
-
- rtp_termination_factory = (rtp_termination_factory_t *) termination_factory;
- for(i=0; imedia_engine_slots->nelts; i++) {
- slot = &APR_ARRAY_IDX(rtp_termination_factory->media_engine_slots,i,media_engine_slot_t);
- if(slot->media_engine == media_engine) {
- /* already exists, just return true */
- return TRUE;
- }
- }
-
- slot = apr_array_push(rtp_termination_factory->media_engine_slots);
- slot->media_engine = media_engine;
- rtp_config = mpf_rtp_config_alloc(rtp_termination_factory->pool);
- *rtp_config = *rtp_termination_factory->config;
- slot->rtp_config = rtp_config;
-
- if(rtp_termination_factory->media_engine_slots->nelts > 1) {
- mpf_rtp_config_t *rtp_config_prev;
-
- /* split RTP port range evenly among assigned media engines */
- apr_uint16_t ports_per_engine = (apr_uint16_t)((rtp_termination_factory->config->rtp_port_max - rtp_termination_factory->config->rtp_port_min) /
- rtp_termination_factory->media_engine_slots->nelts);
- if(ports_per_engine % 2 != 0) {
- /* number of ports per engine should be even (RTP/RTCP pair)*/
- ports_per_engine--;
- }
- /* rewrite max RTP port for the first slot */
- slot = &APR_ARRAY_IDX(rtp_termination_factory->media_engine_slots,0,media_engine_slot_t);
- rtp_config_prev = slot->rtp_config;
- rtp_config_prev->rtp_port_max = rtp_config_prev->rtp_port_min + ports_per_engine;
-
- /* rewrite cur, min and max RTP ports for the slots between first and last, if any */
- for(i=1; imedia_engine_slots->nelts-1; i++) {
- slot = &APR_ARRAY_IDX(rtp_termination_factory->media_engine_slots,i,media_engine_slot_t);
- rtp_config = slot->rtp_config;
- rtp_config->rtp_port_min = rtp_config_prev->rtp_port_max;
- rtp_config->rtp_port_max = rtp_config->rtp_port_min + ports_per_engine;
-
- rtp_config->rtp_port_cur = rtp_config->rtp_port_min;
-
- rtp_config_prev = rtp_config;
- }
-
- /* rewrite cur and min but leave max RTP port for the last slot */
- slot = &APR_ARRAY_IDX(rtp_termination_factory->media_engine_slots,
- rtp_termination_factory->media_engine_slots->nelts-1,media_engine_slot_t);
- rtp_config = slot->rtp_config;
- rtp_config->rtp_port_min = rtp_config_prev->rtp_port_max;
- rtp_config->rtp_port_cur = rtp_config->rtp_port_min;
- }
- return TRUE;
-}
-
-MPF_DECLARE(mpf_termination_factory_t*) mpf_rtp_termination_factory_create(
- mpf_rtp_config_t *rtp_config,
- apr_pool_t *pool)
-{
- rtp_termination_factory_t *rtp_termination_factory;
- if(!rtp_config) {
- return NULL;
- }
- rtp_config->rtp_port_cur = rtp_config->rtp_port_min;
- rtp_termination_factory = apr_palloc(pool,sizeof(rtp_termination_factory_t));
- rtp_termination_factory->base.create_termination = mpf_rtp_termination_create;
- rtp_termination_factory->base.assign_engine = mpf_rtp_factory_engine_assign;
- rtp_termination_factory->pool = pool;
- rtp_termination_factory->config = rtp_config;
- rtp_termination_factory->media_engine_slots = apr_array_make(pool,1,sizeof(media_engine_slot_t));
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create RTP Termination Factory %s:[%hu,%hu]",
- rtp_config->ip.buf,
- rtp_config->rtp_port_min,
- rtp_config->rtp_port_max);
- return &rtp_termination_factory->base;
-}
diff --git a/libs/unimrcp/libs/mpf/src/mpf_scheduler.c b/libs/unimrcp/libs/mpf/src/mpf_scheduler.c
deleted file mode 100644
index dab8e6b067..0000000000
--- a/libs/unimrcp/libs/mpf/src/mpf_scheduler.c
+++ /dev/null
@@ -1,267 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mpf_scheduler.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include "mpf_scheduler.h"
-
-#ifdef WIN32
-#define ENABLE_MULTIMEDIA_TIMERS
-#endif
-
-#ifdef ENABLE_MULTIMEDIA_TIMERS
-
-#pragma warning(disable:4201)
-#include
-#include
-
-#ifndef TIME_KILL_SYNCHRONOUS
-#define TIME_KILL_SYNCHRONOUS 0x0100
-#endif
-
-#else
-#include
-#endif
-
-
-struct mpf_scheduler_t {
- apr_pool_t *pool;
- unsigned long resolution; /* scheduler resolution */
-
- unsigned long media_resolution;
- mpf_scheduler_proc_f media_proc;
- void *media_obj;
-
- unsigned long timer_resolution;
- unsigned long timer_elapsed_time;
- mpf_scheduler_proc_f timer_proc;
- void *timer_obj;
-
-#ifdef ENABLE_MULTIMEDIA_TIMERS
- unsigned int timer_id;
-#else
- apr_thread_t *thread;
- apt_bool_t running;
-#endif
-};
-
-static APR_INLINE void mpf_scheduler_init(mpf_scheduler_t *scheduler);
-
-/** Create scheduler */
-MPF_DECLARE(mpf_scheduler_t*) mpf_scheduler_create(apr_pool_t *pool)
-{
- mpf_scheduler_t *scheduler = apr_palloc(pool,sizeof(mpf_scheduler_t));
- mpf_scheduler_init(scheduler);
- scheduler->pool = pool;
- scheduler->resolution = 0;
-
- scheduler->media_resolution = 0;
- scheduler->media_obj = NULL;
- scheduler->media_proc = NULL;
-
- scheduler->timer_resolution = 0;
- scheduler->timer_elapsed_time = 0;
- scheduler->timer_obj = NULL;
- scheduler->timer_proc = NULL;
- return scheduler;
-}
-
-/** Destroy scheduler */
-MPF_DECLARE(void) mpf_scheduler_destroy(mpf_scheduler_t *scheduler)
-{
- /* nothing to destroy */
-}
-
-/** Set media processing clock */
-MPF_DECLARE(apt_bool_t) mpf_scheduler_media_clock_set(
- mpf_scheduler_t *scheduler,
- unsigned long resolution,
- mpf_scheduler_proc_f proc,
- void *obj)
-{
- scheduler->media_resolution = resolution;
- scheduler->media_proc = proc;
- scheduler->media_obj = obj;
- return TRUE;
-}
-
-/** Set timer clock */
-MPF_DECLARE(apt_bool_t) mpf_scheduler_timer_clock_set(
- mpf_scheduler_t *scheduler,
- unsigned long resolution,
- mpf_scheduler_proc_f proc,
- void *obj)
-{
- scheduler->timer_resolution = resolution;
- scheduler->timer_elapsed_time = 0;
- scheduler->timer_proc = proc;
- scheduler->timer_obj = obj;
- return TRUE;
-}
-
-/** Set scheduler rate (n times faster than real-time) */
-MPF_DECLARE(apt_bool_t) mpf_scheduler_rate_set(
- mpf_scheduler_t *scheduler,
- unsigned long rate)
-{
- if(rate == 0 || rate > 10) {
- /* rate shows how many times scheduler should be faster than real-time,
- 1 is the defualt and probably the only reasonable value,
- however, the rates up to 10 times faster should be acceptable */
- rate = 1;
- }
-
- scheduler->media_resolution /= rate;
- scheduler->timer_resolution /= rate;
- return TRUE;
-}
-
-static APR_INLINE void mpf_scheduler_resolution_set(mpf_scheduler_t *scheduler)
-{
- if(scheduler->media_resolution) {
- scheduler->resolution = scheduler->media_resolution;
- }
- else if(scheduler->timer_resolution) {
- scheduler->resolution = scheduler->timer_resolution;
- }
-}
-
-
-
-#ifdef ENABLE_MULTIMEDIA_TIMERS
-
-static APR_INLINE void mpf_scheduler_init(mpf_scheduler_t *scheduler)
-{
- scheduler->timer_id = 0;
-}
-
-static void CALLBACK mm_timer_proc(UINT uID, UINT uMsg, DWORD_PTR dwUser, DWORD_PTR dw1, DWORD_PTR dw2)
-{
- mpf_scheduler_t *scheduler = (mpf_scheduler_t*) dwUser;
- if(scheduler->media_proc) {
- scheduler->media_proc(scheduler,scheduler->media_obj);
- }
-
- if(scheduler->timer_proc) {
- scheduler->timer_elapsed_time += scheduler->resolution;
- if(scheduler->timer_elapsed_time >= scheduler->timer_resolution) {
- scheduler->timer_elapsed_time = 0;
- scheduler->timer_proc(scheduler,scheduler->timer_obj);
- }
- }
-}
-
-/** Start scheduler */
-MPF_DECLARE(apt_bool_t) mpf_scheduler_start(mpf_scheduler_t *scheduler)
-{
- mpf_scheduler_resolution_set(scheduler);
- scheduler->timer_id = timeSetEvent(
- scheduler->resolution, 0, mm_timer_proc, (DWORD_PTR) scheduler,
- TIME_PERIODIC | TIME_CALLBACK_FUNCTION | TIME_KILL_SYNCHRONOUS);
- return scheduler->timer_id ? TRUE : FALSE;
-}
-
-/** Stop scheduler */
-MPF_DECLARE(apt_bool_t) mpf_scheduler_stop(mpf_scheduler_t *scheduler)
-{
- if(!scheduler) {
- return FALSE;
- }
-
- timeKillEvent(scheduler->timer_id);
- scheduler->timer_id = 0;
- return TRUE;
-}
-
-#else
-
-#include "apt_task.h"
-
-static APR_INLINE void mpf_scheduler_init(mpf_scheduler_t *scheduler)
-{
- scheduler->thread = NULL;
- scheduler->running = FALSE;
-}
-
-static void* APR_THREAD_FUNC timer_thread_proc(apr_thread_t *thread, void *data)
-{
- mpf_scheduler_t *scheduler = data;
- apr_interval_time_t timeout = scheduler->resolution * 1000;
- apr_interval_time_t time_drift = 0;
- apr_time_t time_now, time_last;
-
-#if APR_HAS_SETTHREADNAME
- apr_thread_name_set("MPF Scheduler");
-#endif
- time_now = apr_time_now();
- while(scheduler->running == TRUE) {
- time_last = time_now;
-
- if(scheduler->media_proc) {
- scheduler->media_proc(scheduler,scheduler->media_obj);
- }
-
- if(scheduler->timer_proc) {
- scheduler->timer_elapsed_time += scheduler->resolution;
- if(scheduler->timer_elapsed_time >= scheduler->timer_resolution) {
- scheduler->timer_elapsed_time = 0;
- scheduler->timer_proc(scheduler,scheduler->timer_obj);
- }
- }
-
- if(timeout > time_drift) {
- apr_sleep(timeout - time_drift);
- }
-
- time_now = apr_time_now();
- time_drift += time_now - time_last - timeout;
-#if 0
- printf("time_drift=%d\n",time_drift);
-#endif
- }
-
- apr_thread_exit(thread,APR_SUCCESS);
- return NULL;
-}
-
-MPF_DECLARE(apt_bool_t) mpf_scheduler_start(mpf_scheduler_t *scheduler)
-{
- mpf_scheduler_resolution_set(scheduler);
-
- scheduler->running = TRUE;
- if(apr_thread_create(&scheduler->thread,NULL,timer_thread_proc,scheduler,scheduler->pool) != APR_SUCCESS) {
- scheduler->running = FALSE;
- return FALSE;
- }
- return TRUE;
-}
-
-MPF_DECLARE(apt_bool_t) mpf_scheduler_stop(mpf_scheduler_t *scheduler)
-{
- if(!scheduler) {
- return FALSE;
- }
-
- scheduler->running = FALSE;
- if(scheduler->thread) {
- apr_status_t s;
- apr_thread_join(&s,scheduler->thread);
- scheduler->thread = NULL;
- }
- return TRUE;
-}
-
-#endif
diff --git a/libs/unimrcp/libs/mpf/src/mpf_stream.c b/libs/unimrcp/libs/mpf/src/mpf_stream.c
deleted file mode 100644
index 2c0c890aa2..0000000000
--- a/libs/unimrcp/libs/mpf/src/mpf_stream.c
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mpf_stream.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include "mpf_stream.h"
-
-/** Create stream capabilities */
-MPF_DECLARE(mpf_stream_capabilities_t*) mpf_stream_capabilities_create(mpf_stream_direction_e direction, apr_pool_t *pool)
-{
- mpf_stream_capabilities_t *capabilities = (mpf_stream_capabilities_t*)apr_palloc(pool,sizeof(mpf_stream_capabilities_t));
- capabilities->direction = direction;
- mpf_codec_capabilities_init(&capabilities->codecs,1,pool);
- return capabilities;
-}
-
-/** Clone stream capabilities */
-MPF_DECLARE(mpf_stream_capabilities_t*) mpf_stream_capabilities_clone(const mpf_stream_capabilities_t *src_capabilities, apr_pool_t *pool)
-{
- mpf_stream_capabilities_t *capabilities = (mpf_stream_capabilities_t*)apr_palloc(pool,sizeof(mpf_stream_capabilities_t));
- capabilities->direction = src_capabilities->direction;
- mpf_codec_capabilities_clone(&capabilities->codecs,&src_capabilities->codecs,pool);
- return capabilities;
-}
-
-/** Merge stream capabilities */
-MPF_DECLARE(apt_bool_t) mpf_stream_capabilities_merge(mpf_stream_capabilities_t *capabilities, const mpf_stream_capabilities_t *src_capabilities, apr_pool_t *pool)
-{
- capabilities->direction |= src_capabilities->direction;
- return mpf_codec_capabilities_merge(&capabilities->codecs,&src_capabilities->codecs,pool);
-}
-
-
-
-/** Create audio stream */
-MPF_DECLARE(mpf_audio_stream_t*) mpf_audio_stream_create(void *obj, const mpf_audio_stream_vtable_t *vtable, const mpf_stream_capabilities_t *capabilities, apr_pool_t *pool)
-{
- mpf_audio_stream_t *stream;
- if(!vtable || !capabilities) {
- return NULL;
- }
-
- /* validate required fields */
- if(capabilities->direction & STREAM_DIRECTION_SEND) {
- /* validate sink */
- if(!vtable->write_frame) {
- return NULL;
- }
- }
- if(capabilities->direction & STREAM_DIRECTION_RECEIVE) {
- /* validate source */
- if(!vtable->read_frame) {
- return NULL;
- }
- }
-
- stream = (mpf_audio_stream_t*)apr_palloc(pool,sizeof(mpf_audio_stream_t));
- stream->obj = obj;
- stream->vtable = vtable;
- stream->termination = NULL;
- stream->capabilities = capabilities;
- stream->direction = capabilities->direction;
- stream->rx_descriptor = NULL;
- stream->rx_event_descriptor = NULL;
- stream->tx_descriptor = NULL;
- stream->tx_event_descriptor = NULL;
- return stream;
-}
-
-/** Validate audio stream receiver */
-MPF_DECLARE(apt_bool_t) mpf_audio_stream_rx_validate(
- mpf_audio_stream_t *stream,
- const mpf_codec_descriptor_t *descriptor,
- const mpf_codec_descriptor_t *event_descriptor,
- apr_pool_t *pool)
-{
- if(!stream->capabilities) {
- return FALSE;
- }
-
- if(!stream->rx_descriptor) {
- stream->rx_descriptor = mpf_codec_descriptor_create_by_capabilities(&stream->capabilities->codecs,descriptor,pool);
- }
- if(!stream->rx_event_descriptor) {
- if(stream->capabilities->codecs.allow_named_events == TRUE && event_descriptor) {
- stream->rx_event_descriptor = apr_palloc(pool,sizeof(mpf_codec_descriptor_t));
- *stream->rx_event_descriptor = *event_descriptor;
- }
- }
-
- return stream->rx_descriptor ? TRUE : FALSE;
-}
-
-/** Validate audio stream transmitter */
-MPF_DECLARE(apt_bool_t) mpf_audio_stream_tx_validate(
- mpf_audio_stream_t *stream,
- const mpf_codec_descriptor_t *descriptor,
- const mpf_codec_descriptor_t *event_descriptor,
- apr_pool_t *pool)
-{
- if(!stream->capabilities) {
- return FALSE;
- }
-
- if(!stream->tx_descriptor) {
- stream->tx_descriptor = mpf_codec_descriptor_create_by_capabilities(&stream->capabilities->codecs,descriptor,pool);
- }
- if(!stream->tx_event_descriptor) {
- if(stream->capabilities->codecs.allow_named_events == TRUE && event_descriptor) {
- stream->tx_event_descriptor = apr_palloc(pool,sizeof(mpf_codec_descriptor_t));
- *stream->tx_event_descriptor = *event_descriptor;
- }
- }
- return stream->tx_descriptor ? TRUE : FALSE;
-}
-
-/** Trace media path */
-MPF_DECLARE(void) mpf_audio_stream_trace(mpf_audio_stream_t *stream, mpf_stream_direction_e direction, apt_text_stream_t *output)
-{
- if(stream->vtable->trace) {
- stream->vtable->trace(stream,direction,output);
- return;
- }
-
- if(direction & STREAM_DIRECTION_SEND) {
- mpf_codec_descriptor_t *descriptor = stream->tx_descriptor;
- if(descriptor) {
- apr_size_t offset = output->pos - output->text.buf;
- output->pos += apr_snprintf(output->pos, output->text.length - offset,
- "[%s/%d/%d]->Sink",
- descriptor->name.buf,
- descriptor->sampling_rate,
- descriptor->channel_count);
- }
- }
- if(direction & STREAM_DIRECTION_RECEIVE) {
- mpf_codec_descriptor_t *descriptor = stream->rx_descriptor;
- if(descriptor) {
- apr_size_t offset = output->pos - output->text.buf;
- output->pos += apr_snprintf(output->pos, output->text.length - offset,
- "Source->[%s/%d/%d]",
- descriptor->name.buf,
- descriptor->sampling_rate,
- descriptor->channel_count);
- }
- }
-}
diff --git a/libs/unimrcp/libs/mpf/src/mpf_termination.c b/libs/unimrcp/libs/mpf/src/mpf_termination.c
deleted file mode 100644
index 23e7a3aaaa..0000000000
--- a/libs/unimrcp/libs/mpf/src/mpf_termination.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mpf_termination.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include "mpf_termination.h"
-#include "mpf_stream.h"
-#include "mpf_codec_manager.h"
-
-MPF_DECLARE(mpf_termination_t*) mpf_termination_base_create(
- mpf_termination_factory_t *termination_factory,
- void *obj,
- const mpf_termination_vtable_t *vtable,
- mpf_audio_stream_t *audio_stream,
- mpf_video_stream_t *video_stream,
- apr_pool_t *pool)
-{
- mpf_termination_t *termination = apr_palloc(pool,sizeof(mpf_termination_t));
- termination->pool = pool;
- termination->name = "media-tm";
- termination->obj = obj;
- termination->media_engine = NULL;
- termination->event_handler = NULL;
- termination->codec_manager = NULL;
- termination->timer_queue = NULL;
- termination->termination_factory = termination_factory;
- termination->vtable = vtable;
- termination->slot = 0;
- if(audio_stream) {
- audio_stream->termination = termination;
- }
- if(video_stream) {
- video_stream->termination = termination;
- }
- termination->audio_stream = audio_stream;
- termination->video_stream = video_stream;
- return termination;
-}
-
-MPF_DECLARE(apt_bool_t) mpf_termination_add(mpf_termination_t *termination, void *descriptor)
-{
- if(termination->vtable && termination->vtable->add) {
- termination->vtable->add(termination,descriptor);
- }
- return TRUE;
-}
-
-MPF_DECLARE(apt_bool_t) mpf_termination_modify(mpf_termination_t *termination, void *descriptor)
-{
- if(termination->vtable && termination->vtable->modify) {
- termination->vtable->modify(termination,descriptor);
- }
- return TRUE;
-}
-
-MPF_DECLARE(apt_bool_t) mpf_termination_subtract(mpf_termination_t *termination)
-{
- if(termination->vtable && termination->vtable->subtract) {
- termination->vtable->subtract(termination);
- }
- return TRUE;
-}
diff --git a/libs/unimrcp/libs/mpf/src/mpf_termination_factory.c b/libs/unimrcp/libs/mpf/src/mpf_termination_factory.c
deleted file mode 100644
index f8d0034c8b..0000000000
--- a/libs/unimrcp/libs/mpf/src/mpf_termination_factory.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mpf_termination_factory.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include "mpf_termination_factory.h"
-#include "mpf_termination.h"
-
-/** Assign media engine to termination factory */
-MPF_DECLARE(apt_bool_t) mpf_termination_factory_engine_assign(
- mpf_termination_factory_t *termination_factory,
- mpf_engine_t *media_engine)
-{
- if(termination_factory && termination_factory->assign_engine && media_engine) {
- return termination_factory->assign_engine(termination_factory,media_engine);
- }
- return FALSE;
-}
-
-/** Create MPF termination from termination factory */
-MPF_DECLARE(mpf_termination_t*) mpf_termination_create(
- mpf_termination_factory_t *termination_factory,
- void *obj,
- apr_pool_t *pool)
-{
- if(termination_factory && termination_factory->create_termination) {
- return termination_factory->create_termination(termination_factory,obj,pool);
- }
- return NULL;
-}
-
-/** Create raw MPF termination. */
-MPF_DECLARE(mpf_termination_t*) mpf_raw_termination_create(
- void *obj,
- mpf_audio_stream_t *audio_stream,
- mpf_video_stream_t *video_stream,
- apr_pool_t *pool)
-{
- return mpf_termination_base_create(NULL,obj,NULL,audio_stream,video_stream,pool);
-}
-
-MPF_DECLARE(apt_bool_t) mpf_termination_destroy(mpf_termination_t *termination)
-{
- if(termination->vtable && termination->vtable->destroy) {
- termination->vtable->destroy(termination);
- }
- return TRUE;
-}
-
-/** Get termination name */
-MPF_DECLARE(const char*) mpf_termination_name_get(const mpf_termination_t *termination)
-{
- return termination->name;
-}
-
-/** Get associated object. */
-MPF_DECLARE(void*) mpf_termination_object_get(const mpf_termination_t *termination)
-{
- return termination->obj;
-}
-
-/** Get audio stream. */
-MPF_DECLARE(mpf_audio_stream_t*) mpf_termination_audio_stream_get(const mpf_termination_t *termination)
-{
- return termination->audio_stream;
-}
-
-/** Get video stream. */
-MPF_DECLARE(mpf_video_stream_t*) mpf_termination_video_stream_get(const mpf_termination_t *termination)
-{
- return termination->video_stream;
-}
diff --git a/libs/unimrcp/libs/mrcp-client/Makefile.am b/libs/unimrcp/libs/mrcp-client/Makefile.am
deleted file mode 100644
index dfbacdcb77..0000000000
--- a/libs/unimrcp/libs/mrcp-client/Makefile.am
+++ /dev/null
@@ -1,23 +0,0 @@
-MAINTAINERCLEANFILES = Makefile.in
-
-AM_CPPFLAGS = -I$(top_srcdir)/libs/mrcp-client/include \
- -I$(top_srcdir)/libs/mrcp-signaling/include \
- -I$(top_srcdir)/libs/mrcpv2-transport/include \
- -I$(top_srcdir)/libs/mrcp/include \
- -I$(top_srcdir)/libs/mrcp/message/include \
- -I$(top_srcdir)/libs/mrcp/control/include \
- -I$(top_srcdir)/libs/mrcp/resources/include \
- -I$(top_srcdir)/libs/mpf/include \
- -I$(top_srcdir)/libs/apr-toolkit/include \
- $(UNIMRCP_APR_INCLUDES)
-
-noinst_LTLIBRARIES = libmrcpclient.la
-
-include_HEADERS = include/mrcp_client_types.h \
- include/mrcp_client.h \
- include/mrcp_client_session.h \
- include/mrcp_application.h
-
-libmrcpclient_la_SOURCES = src/mrcp_client.c \
- src/mrcp_client_session.c \
- src/mrcp_application.c
diff --git a/libs/unimrcp/libs/mrcp-client/include/mrcp_application.h b/libs/unimrcp/libs/mrcp-client/include/mrcp_application.h
deleted file mode 100644
index 3770e77ece..0000000000
--- a/libs/unimrcp/libs/mrcp-client/include/mrcp_application.h
+++ /dev/null
@@ -1,360 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_application.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MRCP_APPLICATION_H
-#define MRCP_APPLICATION_H
-
-/**
- * @file mrcp_application.h
- * @brief MRCP User Level Application Interface
- */
-
-#include "mrcp_client_types.h"
-#include "mpf_rtp_descriptor.h"
-#include "mpf_stream.h"
-
-APT_BEGIN_EXTERN_C
-
-/** MRCP application message declaration */
-typedef struct mrcp_app_message_t mrcp_app_message_t;
-
-/** MRCP signaling message declaration */
-typedef struct mrcp_sig_message_t mrcp_sig_message_t;
-
-/** MRCP application message dispatcher declaration */
-typedef struct mrcp_app_message_dispatcher_t mrcp_app_message_dispatcher_t;
-
-/** MRCP application message handler */
-typedef apt_bool_t (*mrcp_app_message_handler_f)(const mrcp_app_message_t *app_message);
-
-/** Enumeration of MRCP signaling message types */
-typedef enum {
- MRCP_SIG_MESSAGE_TYPE_REQUEST, /**< request message */
- MRCP_SIG_MESSAGE_TYPE_RESPONSE, /**< response message */
- MRCP_SIG_MESSAGE_TYPE_EVENT /**< event message */
-} mrcp_sig_message_type_e;
-
-/** Enumeration of MRCP signaling status codes */
-typedef enum {
- MRCP_SIG_STATUS_CODE_SUCCESS, /**< indicates success */
- MRCP_SIG_STATUS_CODE_FAILURE, /**< request failed */
- MRCP_SIG_STATUS_CODE_TERMINATE, /**< request failed, session/channel/connection unexpectedly terminated */
- MRCP_SIG_STATUS_CODE_CANCEL /**< request cancelled */
-} mrcp_sig_status_code_e;
-
-
-/** Enumeration of MRCP signaling commands (requests/responses) */
-typedef enum {
- MRCP_SIG_COMMAND_SESSION_UPDATE,
- MRCP_SIG_COMMAND_SESSION_TERMINATE,
- MRCP_SIG_COMMAND_CHANNEL_ADD,
- MRCP_SIG_COMMAND_CHANNEL_REMOVE,
- MRCP_SIG_COMMAND_RESOURCE_DISCOVER
-} mrcp_sig_command_e;
-
-/** Enumeration of MRCP signaling events */
-typedef enum {
- MRCP_SIG_EVENT_TERMINATE
-} mrcp_sig_event_e;
-
-
-/** Enumeration of MRCP application message types */
-typedef enum {
- MRCP_APP_MESSAGE_TYPE_SIGNALING, /**< signaling message type */
- MRCP_APP_MESSAGE_TYPE_CONTROL /**< control message type */
-} mrcp_app_message_type_e;
-
-/** MRCP signaling message definition */
-struct mrcp_sig_message_t {
- /** Message type (request/response/event) */
- mrcp_sig_message_type_e message_type;
- /** Command (request/response) identifier */
- mrcp_sig_command_e command_id;
- /** Event identifier */
- mrcp_sig_event_e event_id;
- /** Status code used in response */
- mrcp_sig_status_code_e status;
-};
-
-
-/** MRCP application message definition */
-struct mrcp_app_message_t {
- /** Message type (signaling/control) */
- mrcp_app_message_type_e message_type;
-
- /** Application */
- mrcp_application_t *application;
- /** Session */
- mrcp_session_t *session;
- /** Channel */
- mrcp_channel_t *channel;
- /** Session/resource descriptor */
- mrcp_session_descriptor_t *descriptor;
-
- /** MRCP signaling message (used if message_type == MRCP_APP_MESSAGE_SIGNALING) */
- mrcp_sig_message_t sig_message;
- /** MRCP control message (used if message_type == MRCP_APP_MESSAGE_CONTROL) */
- mrcp_message_t *control_message;
-};
-
-/** MRCP application message dispatcher interface */
-struct mrcp_app_message_dispatcher_t {
- /** Response to mrcp_application_session_update()request */
- apt_bool_t (*on_session_update)(mrcp_application_t *application, mrcp_session_t *session, mrcp_sig_status_code_e status);
- /** Response to mrcp_application_session_terminate()request */
- apt_bool_t (*on_session_terminate)(mrcp_application_t *application, mrcp_session_t *session, mrcp_sig_status_code_e status);
-
- /** Response to mrcp_application_channel_add() request */
- apt_bool_t (*on_channel_add)(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_sig_status_code_e status);
- /** Response to mrcp_application_channel_remove() request */
- apt_bool_t (*on_channel_remove)(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_sig_status_code_e status);
-
- /** Response (event) to mrcp_application_message_send() request */
- apt_bool_t (*on_message_receive)(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_message_t *message);
-
- /** Event indicating unexpected session/channel termination */
- apt_bool_t (*on_terminate_event)(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel);
-
- /** Response to mrcp_application_resource_discover() request */
- apt_bool_t (*on_resource_discover)(mrcp_application_t *application, mrcp_session_t *session, mrcp_session_descriptor_t *descriptor, mrcp_sig_status_code_e status);
-};
-
-
-
-/**
- * Create application instance.
- * @param handler the event handler
- * @param obj the external object
- * @param pool the pool to allocate memory from
- */
-MRCP_DECLARE(mrcp_application_t*) mrcp_application_create(const mrcp_app_message_handler_f handler, void *obj, apr_pool_t *pool);
-
-/**
- * Destroy application instance.
- * @param application the application to destroy
- */
-MRCP_DECLARE(apt_bool_t) mrcp_application_destroy(mrcp_application_t *application);
-
-/**
- * Get external object associated with the application.
- * @param application the application to get object from
- */
-MRCP_DECLARE(void*) mrcp_application_object_get(const mrcp_application_t *application);
-
-/**
- * Get dir layout structure.
- * @param application the application to get dir layout from
- */
-MRCP_DECLARE(const apt_dir_layout_t*) mrcp_application_dir_layout_get(const mrcp_application_t *application);
-
-/**
- * Create session.
- * @param application the entire application
- * @param profile the name of the profile to use
- * @param obj the external object
- * @return the created session instance
- */
-MRCP_DECLARE(mrcp_session_t*) mrcp_application_session_create(mrcp_application_t *application, const char *profile, void *obj);
-
-/**
- * Get memory pool the session object is created out of.
- * @param session the session to get pool from
- */
-MRCP_DECLARE(apr_pool_t*) mrcp_application_session_pool_get(const mrcp_session_t *session);
-
-/**
- * Get session identifier.
- * @param session the session to get identifier of
- */
-MRCP_DECLARE(const apt_str_t*) mrcp_application_session_id_get(const mrcp_session_t *session);
-
-/**
- * Get SIP or RTSP response code.
- * @param session the session to use
- */
-MRCP_DECLARE(int) mrcp_application_session_response_code_get(const mrcp_session_t *session);
-
-/**
- * Get external object associated with the session.
- * @param session the session to get object from
- */
-MRCP_DECLARE(void*) mrcp_application_session_object_get(const mrcp_session_t *session);
-
-/**
- * Set (associate) external object to the session.
- * @param session the session to set object for
- * @param obj the object to set
- */
-MRCP_DECLARE(void) mrcp_application_session_object_set(mrcp_session_t *session, void *obj);
-
-/**
- * Set name of the session (informative only used for debugging).
- * @param session the session to set name for
- * @param name the name to set
- */
-MRCP_DECLARE(void) mrcp_application_session_name_set(mrcp_session_t *session, const char *name);
-
-/**
- * Send session update request.
- * @param session the session to update
- */
-MRCP_DECLARE(apt_bool_t) mrcp_application_session_update(mrcp_session_t *session);
-
-/**
- * Send session termination request.
- * @param session the session to terminate
- */
-MRCP_DECLARE(apt_bool_t) mrcp_application_session_terminate(mrcp_session_t *session);
-
-/**
- * Destroy client session (session must be terminated prior to destroy).
- * @param session the session to destroy
- */
-MRCP_DECLARE(apt_bool_t) mrcp_application_session_destroy(mrcp_session_t *session);
-
-
-/**
- * Create control channel.
- * @param session the session to create channel for
- * @param resource_id the resource identifier of the channel
- * @param termination the media termination
- * @param rtp_descriptor the RTP termination descriptor (NULL by default)
- * @param obj the external object
- */
-MRCP_DECLARE(mrcp_channel_t*) mrcp_application_channel_create(
- mrcp_session_t *session,
- mrcp_resource_id resource_id,
- mpf_termination_t *termination,
- mpf_rtp_termination_descriptor_t *rtp_descriptor,
- void *obj);
-
-/**
- * Get external object associated with the channel.
- * @param channel the channel to get object from
- */
-MRCP_DECLARE(void*) mrcp_application_channel_object_get(const mrcp_channel_t *channel);
-
-/**
- * Get RTP termination descriptor.
- * @param channel the channel to get descriptor from
- */
-MRCP_DECLARE(mpf_rtp_termination_descriptor_t*) mrcp_application_rtp_descriptor_get(const mrcp_channel_t *channel);
-
-/**
- * Get codec descriptor of source stream.
- * @param channel the channel to get descriptor from
- */
-MRCP_DECLARE(const mpf_codec_descriptor_t*) mrcp_application_source_descriptor_get(const mrcp_channel_t *channel);
-
-/**
- * Get codec descriptor of sink stream.
- * @param channel the channel to get descriptor from
- */
-MRCP_DECLARE(const mpf_codec_descriptor_t*) mrcp_application_sink_descriptor_get(const mrcp_channel_t *channel);
-
-/**
- * Get associated audio stream.
- * @param channel the channel to get associated stream from
- */
-MRCP_DECLARE(const mpf_audio_stream_t*) mrcp_application_audio_stream_get(const mrcp_channel_t *channel);
-
-/**
- * Send channel add request.
- * @param session the session to create channel for
- * @param channel the control channel
- */
-MRCP_DECLARE(apt_bool_t) mrcp_application_channel_add(mrcp_session_t *session, mrcp_channel_t *channel);
-
-/**
- * Create MRCP message.
- * @param session the session
- * @param channel the control channel
- * @param method_id the method identifier of MRCP message
- */
-MRCP_DECLARE(mrcp_message_t*) mrcp_application_message_create(mrcp_session_t *session, mrcp_channel_t *channel, mrcp_method_id method_id);
-
-/**
- * Send MRCP message.
- * @param session the session
- * @param channel the control channel
- * @param message the MRCP message to send
- */
-MRCP_DECLARE(apt_bool_t) mrcp_application_message_send(mrcp_session_t *session, mrcp_channel_t *channel, mrcp_message_t *message);
-
-/**
- * Remove channel.
- * @param session the session to remove channel from
- * @param channel the control channel to remove
- */
-MRCP_DECLARE(apt_bool_t) mrcp_application_channel_remove(mrcp_session_t *session, mrcp_channel_t *channel);
-
-/**
- * Discover resources.
- * @param session the session to use as communication object
- */
-MRCP_DECLARE(apt_bool_t) mrcp_application_resource_discover(mrcp_session_t *session);
-
-/**
- * Dispatch application message.
- * @param dispatcher the dispatcher inteface
- * @param app_message the message to dispatch
- */
-MRCP_DECLARE(apt_bool_t) mrcp_application_message_dispatch(const mrcp_app_message_dispatcher_t *dispatcher, const mrcp_app_message_t *app_message);
-
-/**
- * Create audio termination
- * @param session the session to create termination for
- * @param stream_vtable the virtual table of audio stream
- * @param capabilities the capabilities of the stream
- * @param obj the external object
- */
-MRCP_DECLARE(mpf_termination_t*) mrcp_application_audio_termination_create(
- mrcp_session_t *session,
- const mpf_audio_stream_vtable_t *stream_vtable,
- mpf_stream_capabilities_t *capabilities,
- void *obj);
-/**
- * Create source media termination
- * @param session the session to create termination for
- * @param stream_vtable the virtual table of audio stream
- * @param codec_descriptor the descriptor of audio stream (NULL by default)
- * @param obj the external object
- * @deprecated @see mrcp_application_audio_termination_create()
- */
-MRCP_DECLARE(mpf_termination_t*) mrcp_application_source_termination_create(
- mrcp_session_t *session,
- const mpf_audio_stream_vtable_t *stream_vtable,
- mpf_codec_descriptor_t *codec_descriptor,
- void *obj);
-/**
- * Create sink media termination
- * @param session the session to create termination for
- * @param stream_vtable the virtual table of audio stream
- * @param codec_descriptor the descriptor of audio stream (NULL by default)
- * @param obj the external object
- * @deprecated @see mrcp_application_audio_termination_create()
- */
-MRCP_DECLARE(mpf_termination_t*) mrcp_application_sink_termination_create(
- mrcp_session_t *session,
- const mpf_audio_stream_vtable_t *stream_vtable,
- mpf_codec_descriptor_t *codec_descriptor,
- void *obj);
-
-APT_END_EXTERN_C
-
-#endif /* MRCP_APPLICATION_H */
diff --git a/libs/unimrcp/libs/mrcp-client/include/mrcp_client.h b/libs/unimrcp/libs/mrcp-client/include/mrcp_client.h
deleted file mode 100644
index 87d36e21fe..0000000000
--- a/libs/unimrcp/libs/mrcp-client/include/mrcp_client.h
+++ /dev/null
@@ -1,254 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_client.h 2251 2014-11-21 02:36:44Z achaloyan@gmail.com $
- */
-
-#ifndef MRCP_CLIENT_H
-#define MRCP_CLIENT_H
-
-/**
- * @file mrcp_client.h
- * @brief MRCP Client
- */
-
-#include "mrcp_client_types.h"
-#include "mpf_rtp_descriptor.h"
-#include "apt_task.h"
-
-APT_BEGIN_EXTERN_C
-
-/** Event handler used in case of asynchronous start */
-typedef void (*mrcp_client_handler_f)(apt_bool_t status);
-
-/**
- * Create MRCP client instance.
- * @return the created client instance
- */
-MRCP_DECLARE(mrcp_client_t*) mrcp_client_create(apt_dir_layout_t *dir_layout);
-
-/**
- * Set asynchronous start mode.
- * @param client the MRCP client to set mode for
- * @param handler the event handler to signal start completion
- */
-MRCP_DECLARE(void) mrcp_client_async_start_set(mrcp_client_t *client, mrcp_client_handler_f handler);
-
-
-/**
- * Start message processing loop.
- * @param client the MRCP client to start
- * @return the created client instance
- */
-MRCP_DECLARE(apt_bool_t) mrcp_client_start(mrcp_client_t *client);
-
-/**
- * Shutdown message processing loop.
- * @param client the MRCP client to shutdown
- */
-MRCP_DECLARE(apt_bool_t) mrcp_client_shutdown(mrcp_client_t *client);
-
-/**
- * Destroy MRCP client.
- * @param client the MRCP client to destroy
- */
-MRCP_DECLARE(apt_bool_t) mrcp_client_destroy(mrcp_client_t *client);
-
-
-/**
- * Register MRCP resource factory.
- * @param client the MRCP client to set resource factory for
- * @param resource_factory the resource factory to set
- */
-MRCP_DECLARE(apt_bool_t) mrcp_client_resource_factory_register(mrcp_client_t *client, mrcp_resource_factory_t *resource_factory);
-
-/**
- * Register codec manager.
- * @param client the MRCP client to set codec manager for
- * @param codec_manager the codec manager to set
- */
-MRCP_DECLARE(apt_bool_t) mrcp_client_codec_manager_register(mrcp_client_t *client, mpf_codec_manager_t *codec_manager);
-
-/**
- * Get registered codec manager.
- * @param client the MRCP client to get codec manager from
- */
-MRCP_DECLARE(const mpf_codec_manager_t*) mrcp_client_codec_manager_get(const mrcp_client_t *client);
-
-/**
- * Register media engine.
- * @param client the MRCP client to set media engine for
- * @param media_engine the media engine to set
- */
-MRCP_DECLARE(apt_bool_t) mrcp_client_media_engine_register(mrcp_client_t *client, mpf_engine_t *media_engine);
-
-/**
- * Register RTP termination factory.
- * @param client the MRCP client to set termination factory for
- * @param rtp_termination_factory the termination factory
- * @param name the name of the factory
- */
-MRCP_DECLARE(apt_bool_t) mrcp_client_rtp_factory_register(mrcp_client_t *client, mpf_termination_factory_t *rtp_termination_factory, const char *name);
-
-/**
- * Register RTP settings.
- * @param client the MRCP client to set RTP settings for
- * @param rtp_settings the settings to set
- * @param name the name of the settings
- */
-MRCP_DECLARE(apt_bool_t) mrcp_client_rtp_settings_register(mrcp_client_t *client, mpf_rtp_settings_t *rtp_settings, const char *name);
-
-/**
- * Register MRCP signaling agent.
- * @param client the MRCP client to set signaling agent for
- * @param signaling_agent the signaling agent to set
- */
-MRCP_DECLARE(apt_bool_t) mrcp_client_signaling_agent_register(mrcp_client_t *client, mrcp_sig_agent_t *signaling_agent);
-
-/**
- * Register MRCP signaling settings.
- * @param client the MRCP client to set signaling settings for
- * @param signaling_settings the signaling settings to set
- * @param name the name of the agent
- */
-MRCP_DECLARE(apt_bool_t) mrcp_client_signaling_settings_register(mrcp_client_t *client, mrcp_sig_settings_t *signaling_settings, const char *name);
-
-/**
- * Register MRCP connection agent (MRCPv2 only).
- * @param client the MRCP client to set connection agent for
- * @param connection_agent the connection agent to set
- */
-MRCP_DECLARE(apt_bool_t) mrcp_client_connection_agent_register(mrcp_client_t *client, mrcp_connection_agent_t *connection_agent);
-
-/** Create MRCP profile */
-MRCP_DECLARE(mrcp_client_profile_t*) mrcp_client_profile_create(
- mrcp_resource_factory_t *resource_factory,
- mrcp_sig_agent_t *signaling_agent,
- mrcp_connection_agent_t *connection_agent,
- mpf_engine_t *media_engine,
- mpf_termination_factory_t *rtp_factory,
- mpf_rtp_settings_t *rtp_settings,
- mrcp_sig_settings_t *signaling_settings,
- apr_pool_t *pool);
-
-/** Create MRCP profile (extended version) */
-MRCP_DECLARE(mrcp_client_profile_t*) mrcp_client_profile_create_ex(
- mrcp_version_e mrcp_version,
- mrcp_resource_factory_t *resource_factory,
- mrcp_sa_factory_t *sa_factory,
- mrcp_ca_factory_t *ca_factory,
- mpf_engine_factory_t *mpf_factory,
- mpf_termination_factory_t *rtp_factory,
- mpf_rtp_settings_t *rtp_settings,
- mrcp_sig_settings_t *signaling_settings,
- apr_pool_t *pool);
-
-/**
- * Set a tag to the profile.
- * @param profile the profile to set a tag for
- * @param tag the tag to set
- */
-MRCP_DECLARE(void) mrcp_client_profile_tag_set(mrcp_client_profile_t *profile, const char *tag);
-
-/**
- * Register MRCP profile.
- * @param client the MRCP client to set profile for
- * @param profile the profile to set
- * @param name the name of the profile
- */
-MRCP_DECLARE(apt_bool_t) mrcp_client_profile_register(mrcp_client_t *client, mrcp_client_profile_t *profile, const char *name);
-
-/**
- * Register MRCP application.
- * @param client the MRCP client to set application for
- * @param application the application to set
- * @param name the name of the application
- */
-MRCP_DECLARE(apt_bool_t) mrcp_client_application_register(mrcp_client_t *client, mrcp_application_t *application, const char *name);
-
-/**
- * Get memory pool.
- * @param client the MRCP client to get memory pool from
- */
-MRCP_DECLARE(apr_pool_t*) mrcp_client_memory_pool_get(const mrcp_client_t *client);
-
-/**
- * Get media engine by name.
- * @param client the MRCP client to get media engine from
- * @param name the name of the media engine to lookup
- */
-MRCP_DECLARE(mpf_engine_t*) mrcp_client_media_engine_get(const mrcp_client_t *client, const char *name);
-
-/**
- * Get RTP termination factory by name.
- * @param client the MRCP client to get from
- * @param name the name to lookup
- */
-MRCP_DECLARE(mpf_termination_factory_t*) mrcp_client_rtp_factory_get(const mrcp_client_t *client, const char *name);
-
-/**
- * Get RTP settings by name
- * @param client the MRCP client to get from
- * @param name the name to lookup
- */
-MRCP_DECLARE(mpf_rtp_settings_t*) mrcp_client_rtp_settings_get(const mrcp_client_t *client, const char *name);
-
-/**
- * Get signaling agent by name.
- * @param client the MRCP client to get from
- * @param name the name to lookup
- */
-MRCP_DECLARE(mrcp_sig_agent_t*) mrcp_client_signaling_agent_get(const mrcp_client_t *client, const char *name);
-
-/**
- * Get signaling settings by name.
- * @param client the MRCP client to get from
- * @param name the name to lookup
- */
-MRCP_DECLARE(mrcp_sig_settings_t*) mrcp_client_signaling_settings_get(const mrcp_client_t *client, const char *name);
-
-/**
- * Get connection agent by name.
- * @param client the MRCP client to get from
- * @param name the name to lookup
- */
-MRCP_DECLARE(mrcp_connection_agent_t*) mrcp_client_connection_agent_get(const mrcp_client_t *client, const char *name);
-
-/**
- * Get profile by name.
- * @param client the MRCP client to get from
- * @param name the name to lookup
- */
-MRCP_DECLARE(mrcp_client_profile_t*) mrcp_client_profile_get(const mrcp_client_t *client, const char *name);
-
-/**
- * Get available profiles.
- * @param client the MRCP client to get the profile from
- * @param profiles the array of profiles to be filled in
- * @param count the max number of profiles on entry; and the number of profiles filled in on exit
- * @param tag the tag to be used as a filter (no filter is specified if tag is NULL)
- * @return FALSE if the provided max number of profiles is less than the actual number of profiles
- */
-MRCP_DECLARE(apt_bool_t) mrcp_client_profiles_get(const mrcp_client_t *client, mrcp_client_profile_t *profiles[], apr_size_t *count, const char *tag);
-
-/**
- * Get directory layout.
- * @param client the MRCP client to get from
- */
-MRCP_DECLARE(apt_dir_layout_t*) mrcp_client_dir_layout_get(const mrcp_client_t *client);
-
-APT_END_EXTERN_C
-
-#endif /* MRCP_CLIENT_H */
diff --git a/libs/unimrcp/libs/mrcp-client/include/mrcp_client_session.h b/libs/unimrcp/libs/mrcp-client/include/mrcp_client_session.h
deleted file mode 100644
index f6a3c645ee..0000000000
--- a/libs/unimrcp/libs/mrcp-client/include/mrcp_client_session.h
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_client_session.h 2251 2014-11-21 02:36:44Z achaloyan@gmail.com $
- */
-
-#ifndef MRCP_CLIENT_SESSION_H
-#define MRCP_CLIENT_SESSION_H
-
-/**
- * @file mrcp_client_session.h
- * @brief MRCP Client Session
- */
-
-#include "mrcp_client_types.h"
-#include "mrcp_application.h"
-#include "mrcp_session.h"
-#include "mpf_engine.h"
-#include "apt_task_msg.h"
-#include "apt_obj_list.h"
-
-APT_BEGIN_EXTERN_C
-
-/** RTP termination slot declaration */
-typedef struct rtp_termination_slot_t rtp_termination_slot_t;
-
-/** MRCP client session declaration */
-typedef struct mrcp_client_session_t mrcp_client_session_t;
-
-/** Client session states */
-typedef enum {
- SESSION_STATE_NONE,
- SESSION_STATE_GENERATING_OFFER,
- SESSION_STATE_PROCESSING_ANSWER,
- SESSION_STATE_TERMINATING,
- SESSION_STATE_DISCOVERING
-} mrcp_client_session_state_e;
-
-/** MRCP client session */
-struct mrcp_client_session_t {
- /** Session base */
- mrcp_session_t base;
- /** Application session belongs to */
- mrcp_application_t *application;
- /** External object associated with session */
- void *app_obj;
- /** Profile to use */
- mrcp_client_profile_t *profile;
-
- /** Media context */
- mpf_context_t *context;
- /** Codec manager */
- const mpf_codec_manager_t *codec_manager;
-
- /** RTP termination array (mrcp_termination_slot_t) */
- apr_array_header_t *terminations;
- /** MRCP control channel array (mrcp_channel_t*) */
- apr_array_header_t *channels;
-
- /** Indicates whether session is already added to session table */
- apt_bool_t registered;
-
- /** In-progress offer */
- mrcp_session_descriptor_t *offer;
- /** In-progress answer */
- mrcp_session_descriptor_t *answer;
-
- /** MRCP application active request */
- const mrcp_app_message_t *active_request;
- /** MRCP application request queue */
- apt_obj_list_t *request_queue;
-
- /** MPF task message, which construction is in progress */
- mpf_task_msg_t *mpf_task_msg;
-
- /** Session state */
- mrcp_client_session_state_e state;
- /** Status code of the app response to be generated */
- mrcp_sig_status_code_e status;
- /** Number of in-progress sub requests */
- apr_size_t subrequest_count;
- /** True, if server unexpectedly closed session/connection */
- apt_bool_t disconnected;
-};
-
-/** MRCP channel */
-struct mrcp_channel_t {
- /** Memory pool */
- apr_pool_t *pool;
- /** External object associated with channel */
- void *obj;
- /** MRCP resource */
- mrcp_resource_t *resource;
- /** MRCP session entire channel belongs to */
- mrcp_session_t *session;
- /** MRCP control channel */
- mrcp_control_channel_t *control_channel;
- /** Media termination */
- mpf_termination_t *termination;
- /** Associated RTP termination slot */
- rtp_termination_slot_t *rtp_termination_slot;
-
- /** waiting state of control channel */
- apt_bool_t waiting_for_channel;
- /** waiting state of media termination */
- apt_bool_t waiting_for_termination;
-};
-
-/** RTP termination slot */
-struct rtp_termination_slot_t {
- /** waiting state */
- apt_bool_t waiting;
- /** RTP termination */
- mpf_termination_t *termination;
- /** RTP termination descriptor */
- mpf_rtp_termination_descriptor_t *descriptor;
- /** Associated MRCP channel */
- mrcp_channel_t *channel;
- /** media descriptor id (index of media in session descriptor) */
- apr_size_t id;
-};
-
-/** MRCP client profile */
-struct mrcp_client_profile_t {
- /** Unique profile name */
- const char *name;
- /** Arbitrary tag set/used by user application */
- const char *tag;
- /** MRCP version */
- mrcp_version_e mrcp_version;
- /** MRCP resource factory */
- mrcp_resource_factory_t *resource_factory;
- /** Media engine factory */
- mpf_engine_factory_t *mpf_factory;
- /** RTP termination factory */
- mpf_termination_factory_t *rtp_termination_factory;
- /** Signaling agent factory */
- mrcp_sa_factory_t *sa_factory;
- /** Connection agent factory */
- mrcp_ca_factory_t *ca_factory;
- /** Signaling settings */
- mrcp_sig_settings_t *signaling_settings;
- /** RTP settings */
- mpf_rtp_settings_t *rtp_settings;
-};
-
-/** MRCP application */
-struct mrcp_application_t {
- /** External object associated with the application */
- void *obj;
- /** Application message handler */
- mrcp_app_message_handler_f handler;
- /** MRCP client */
- mrcp_client_t *client;
- /** Application task message pool */
- apt_task_msg_pool_t *msg_pool;
-};
-
-/** Create channel */
-mrcp_channel_t* mrcp_client_channel_create(
- mrcp_client_session_t *session,
- mrcp_resource_t *resource,
- mpf_termination_t *termination,
- mpf_rtp_termination_descriptor_t *rtp_descriptor,
- void *obj);
-
-/** Create signaling app_message_t request */
-mrcp_app_message_t* mrcp_client_app_signaling_request_create(mrcp_sig_command_e command_id, apr_pool_t *pool);
-/** Create signaling app_message_t event */
-mrcp_app_message_t* mrcp_client_app_signaling_event_create(mrcp_sig_event_e event_id, apr_pool_t *pool);
-/** Create control app_message_t */
-mrcp_app_message_t* mrcp_client_app_control_message_create(apr_pool_t *pool);
-
-/** Process application message */
-apt_bool_t mrcp_client_app_message_process(mrcp_app_message_t *app_message);
-/** Process MPF message */
-apt_bool_t mrcp_client_mpf_message_process(mpf_message_container_t *mpf_message_container);
-
-/** Process session answer */
-apt_bool_t mrcp_client_session_answer_process(mrcp_client_session_t *session, mrcp_session_descriptor_t *descriptor);
-/** Process session termination response */
-apt_bool_t mrcp_client_session_terminate_response_process(mrcp_client_session_t *session);
-/** Process session control response */
-apt_bool_t mrcp_client_session_control_response_process(mrcp_client_session_t *session, mrcp_message_t *message);
-/** Process resource discovery response */
-apt_bool_t mrcp_client_session_discover_response_process(mrcp_client_session_t *session, mrcp_session_descriptor_t *descriptor);
-/** Process session termination event */
-apt_bool_t mrcp_client_session_terminate_event_process(mrcp_client_session_t *session);
-
-/** Process channel add event */
-apt_bool_t mrcp_client_on_channel_add(mrcp_channel_t *channel, mrcp_control_descriptor_t *descriptor, apt_bool_t status);
-/** Process channel modify event */
-apt_bool_t mrcp_client_on_channel_modify(mrcp_channel_t *channel, mrcp_control_descriptor_t *descriptor, apt_bool_t status);
-/** Process channel remove event */
-apt_bool_t mrcp_client_on_channel_remove(mrcp_channel_t *channel, apt_bool_t status);
-/** Process message receive event */
-apt_bool_t mrcp_client_on_message_receive(mrcp_channel_t *channel, mrcp_message_t *message);
-/** Process disconnect event */
-apt_bool_t mrcp_client_on_disconnect(mrcp_channel_t *channel);
-
-APT_END_EXTERN_C
-
-#endif /* MRCP_CLIENT_SESSION_H */
diff --git a/libs/unimrcp/libs/mrcp-client/include/mrcp_client_types.h b/libs/unimrcp/libs/mrcp-client/include/mrcp_client_types.h
deleted file mode 100644
index 61a555bcbe..0000000000
--- a/libs/unimrcp/libs/mrcp-client/include/mrcp_client_types.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_client_types.h 2251 2014-11-21 02:36:44Z achaloyan@gmail.com $
- */
-
-#ifndef MRCP_CLIENT_TYPES_H
-#define MRCP_CLIENT_TYPES_H
-
-/**
- * @file mrcp_client_types.h
- * @brief MRCP Client Types
- */
-
-#include "mrcp_sig_types.h"
-#include "mrcp_connection_types.h"
-#include "mpf_types.h"
-
-APT_BEGIN_EXTERN_C
-
-/** Opaque MRCP client declaration */
-typedef struct mrcp_client_t mrcp_client_t;
-
-/** Opaque MRCP client profile declaration */
-typedef struct mrcp_client_profile_t mrcp_client_profile_t;
-/** Backward compatible declaration of MRCP profile */
-typedef mrcp_client_profile_t mrcp_profile_t;
-
-/** Opaque MRCP application declaration */
-typedef struct mrcp_application_t mrcp_application_t;
-
-/** Opaque MRCP channel declaration */
-typedef struct mrcp_channel_t mrcp_channel_t;
-
-
-APT_END_EXTERN_C
-
-#endif /* MRCP_CLIENT_TYPES_H */
diff --git a/libs/unimrcp/libs/mrcp-client/mrcpclient.2017.vcxproj b/libs/unimrcp/libs/mrcp-client/mrcpclient.2017.vcxproj
deleted file mode 100644
index e5cfaa0b33..0000000000
--- a/libs/unimrcp/libs/mrcp-client/mrcpclient.2017.vcxproj
+++ /dev/null
@@ -1,131 +0,0 @@
-
-
-
-
- Debug
- Win32
-
-
- Debug
- x64
-
-
- Release
- Win32
-
-
- Release
- x64
-
-
-
- mrcpclient
- {72782932-37CC-46AE-8C7F-9A7B1A6EE108}
- mrcpclient
- Win32Proj
-
-
-
- StaticLibrary
- Unicode
- true
- $(DefaultPlatformToolset)
-
-
- StaticLibrary
- Unicode
- $(DefaultPlatformToolset)
-
-
- StaticLibrary
- Unicode
- true
- $(DefaultPlatformToolset)
-
-
- StaticLibrary
- Unicode
- $(DefaultPlatformToolset)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <_ProjectFileVersion>10.0.30319.1
- $(PlatformName)\$(Configuration)\
- $(PlatformName)\$(Configuration)\
- $(SolutionDir)$(PlatformName)\$(Configuration)\
- $(PlatformName)\$(Configuration)\
- $(PlatformName)\$(Configuration)\
- $(PlatformName)\$(Configuration)\
- $(SolutionDir)$(PlatformName)\$(Configuration)\
- $(PlatformName)\$(Configuration)\
-
-
-
- APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)
-
-
-
-
- X64
-
-
- APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)
- ProgramDatabase
-
-
-
-
- APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)
-
-
-
-
- X64
-
-
- APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {f6c55d93-b927-4483-bb69-15aef3dd2dff}
-
-
-
-
-
-
\ No newline at end of file
diff --git a/libs/unimrcp/libs/mrcp-client/mrcpclient.vcproj b/libs/unimrcp/libs/mrcp-client/mrcpclient.vcproj
deleted file mode 100644
index 046c3e4695..0000000000
--- a/libs/unimrcp/libs/mrcp-client/mrcpclient.vcproj
+++ /dev/null
@@ -1,280 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/libs/unimrcp/libs/mrcp-client/mrcpclient.vcxproj b/libs/unimrcp/libs/mrcp-client/mrcpclient.vcxproj
deleted file mode 100644
index 3447a31724..0000000000
--- a/libs/unimrcp/libs/mrcp-client/mrcpclient.vcxproj
+++ /dev/null
@@ -1,125 +0,0 @@
-
-
-
-
- Debug
- Win32
-
-
- Debug
- x64
-
-
- Release
- Win32
-
-
- Release
- x64
-
-
-
- {72782932-37CC-46AE-8C7F-9A7B1A6EE108}
- mrcpclient
- Win32Proj
-
-
-
- StaticLibrary
- Unicode
- true
-
-
- StaticLibrary
- Unicode
-
-
- StaticLibrary
- Unicode
- true
-
-
- StaticLibrary
- Unicode
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <_ProjectFileVersion>10.0.30319.1
- AllRules.ruleset
-
-
- AllRules.ruleset
-
-
- AllRules.ruleset
-
-
- AllRules.ruleset
-
-
-
-
-
- X64
-
-
- ProgramDatabase
-
-
-
-
- X64
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {12a49562-bab9-43a3-a21d-15b60bbb4c31}
- false
-
-
- {a9edac04-6a5f-4ba7-bc0d-cce7b255b6ea}
- false
-
-
-
-
-
-
\ No newline at end of file
diff --git a/libs/unimrcp/libs/mrcp-client/mrcpclient.vcxproj.filters b/libs/unimrcp/libs/mrcp-client/mrcpclient.vcxproj.filters
deleted file mode 100644
index 789830de35..0000000000
--- a/libs/unimrcp/libs/mrcp-client/mrcpclient.vcxproj.filters
+++ /dev/null
@@ -1,38 +0,0 @@
-
-
-
-
- {93995380-89BD-4b04-88EB-625FBE52EBFB}
- h;hpp;hxx;hm;inl;inc;xsd
-
-
- {dc4325fe-8e7a-4a40-ab63-4173d85cf131}
- cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
-
-
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
-
-
- src
-
-
- src
-
-
- src
-
-
-
\ No newline at end of file
diff --git a/libs/unimrcp/libs/mrcp-client/src/mrcp_application.c b/libs/unimrcp/libs/mrcp-client/src/mrcp_application.c
deleted file mode 100644
index 849847720b..0000000000
--- a/libs/unimrcp/libs/mrcp-client/src/mrcp_application.c
+++ /dev/null
@@ -1,549 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_application.c 2251 2014-11-21 02:36:44Z achaloyan@gmail.com $
- */
-
-#include "mrcp_application.h"
-#include "mrcp_client.h"
-#include "mrcp_client_session.h"
-#include "mrcp_session_descriptor.h"
-#include "mrcp_message.h"
-#include "mrcp_sig_agent.h"
-#include "mrcp_resource_factory.h"
-#include "mpf_termination_factory.h"
-#include "apt_dir_layout.h"
-#include "apt_log.h"
-
-mrcp_client_session_t* mrcp_client_session_create(mrcp_client_t *client);
-
-apt_bool_t mrcp_app_signaling_task_msg_signal(mrcp_sig_command_e command_id, mrcp_session_t *session, mrcp_channel_t *channel);
-apt_bool_t mrcp_app_control_task_msg_signal(mrcp_session_t *session, mrcp_channel_t *channel, mrcp_message_t *message);
-
-
-/** Create application instance */
-MRCP_DECLARE(mrcp_application_t*) mrcp_application_create(const mrcp_app_message_handler_f handler, void *obj, apr_pool_t *pool)
-{
- mrcp_application_t *application;
- if(!handler) {
- return FALSE;
- }
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create Application");
- application = apr_palloc(pool,sizeof(mrcp_application_t));
- application->obj = obj;
- application->handler = handler;
- application->client = NULL;
- return application;
-}
-
-/** Destroy application instance */
-MRCP_DECLARE(apt_bool_t) mrcp_application_destroy(mrcp_application_t *application)
-{
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Destroy Application");
- return TRUE;
-}
-
-/** Get external object associated with the application */
-MRCP_DECLARE(void*) mrcp_application_object_get(const mrcp_application_t *application)
-{
- return application->obj;
-}
-
-/** Get dir layout structure */
-MRCP_DECLARE(const apt_dir_layout_t*) mrcp_application_dir_layout_get(const mrcp_application_t *application)
-{
- return mrcp_client_dir_layout_get(application->client);
-}
-
-
-
-/** Create client session */
-MRCP_DECLARE(mrcp_session_t*) mrcp_application_session_create(mrcp_application_t *application, const char *profile_name, void *obj)
-{
- mrcp_client_profile_t *profile;
- mrcp_client_session_t *session;
- if(!application || !application->client || !profile_name) {
- return NULL;
- }
-
- profile = mrcp_client_profile_get(application->client,profile_name);
- if(!profile) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"No Such Profile [%s]",profile_name);
- return NULL;
- }
-
- session = mrcp_client_session_create(application->client);
- if(!session) {
- return NULL;
- }
- session->application = application;
- session->app_obj = obj;
- session->base.log_obj = obj;
- session->profile = profile;
-
- apt_obj_log(APT_LOG_MARK,APT_PRIO_NOTICE,session->base.log_obj,"Create MRCP Handle "APT_PTR_FMT" [%s]",
- MRCP_SESSION_PTR(session),
- profile_name);
- return &session->base;
-}
-
-/** Get memory pool the session object is created out of */
-MRCP_DECLARE(apr_pool_t*) mrcp_application_session_pool_get(const mrcp_session_t *session)
-{
- if(!session) {
- return NULL;
- }
- return session->pool;
-}
-
-/** Get session identifier */
-MRCP_DECLARE(const apt_str_t*) mrcp_application_session_id_get(const mrcp_session_t *session)
-{
- if(!session) {
- return NULL;
- }
- return &session->id;
-}
-
-/** Get SIP or RTSP response code */
-MRCP_DECLARE(int) mrcp_application_session_response_code_get(const mrcp_session_t *session)
-{
- mrcp_client_session_t *client_session = (mrcp_client_session_t*)session;
- if(!client_session || !client_session->answer) {
- return 0;
- }
- return client_session->answer->response_code;
-}
-
-/** Get external object associated with the session */
-MRCP_DECLARE(void*) mrcp_application_session_object_get(const mrcp_session_t *session)
-{
- mrcp_client_session_t *client_session = (mrcp_client_session_t*)session;
- if(!client_session) {
- return NULL;
- }
- return client_session->app_obj;
-}
-
-/** Set (associate) external object to the session */
-MRCP_DECLARE(void) mrcp_application_session_object_set(mrcp_session_t *session, void *obj)
-{
- mrcp_client_session_t *client_session = (mrcp_client_session_t*)session;
- if(client_session) {
- client_session->app_obj = obj;
- }
-}
-
-/** Set name of the session (informative only used for debugging) */
-MRCP_DECLARE(void) mrcp_application_session_name_set(mrcp_session_t *session, const char *name)
-{
- if(session && name) {
- session->name = apr_pstrdup(session->pool,name);
- }
-}
-
-
-/** Send session update request */
-MRCP_DECLARE(apt_bool_t) mrcp_application_session_update(mrcp_session_t *session)
-{
- if(!session) {
- return FALSE;
- }
- return mrcp_app_signaling_task_msg_signal(MRCP_SIG_COMMAND_SESSION_UPDATE,session,NULL);
-}
-
-/** Send session termination request */
-MRCP_DECLARE(apt_bool_t) mrcp_application_session_terminate(mrcp_session_t *session)
-{
- if(!session) {
- return FALSE;
- }
- return mrcp_app_signaling_task_msg_signal(MRCP_SIG_COMMAND_SESSION_TERMINATE,session,NULL);
-}
-
-/** Destroy client session (session must be terminated prior to destroy) */
-MRCP_DECLARE(apt_bool_t) mrcp_application_session_destroy(mrcp_session_t *session)
-{
- if(!session) {
- return FALSE;
- }
- apt_obj_log(APT_LOG_MARK,APT_PRIO_NOTICE,session->log_obj,"Destroy MRCP Handle %s",session->name);
- mrcp_session_destroy(session);
- return TRUE;
-}
-
-
-/** Create control channel */
-MRCP_DECLARE(mrcp_channel_t*) mrcp_application_channel_create(
- mrcp_session_t *session,
- mrcp_resource_id resource_id,
- mpf_termination_t *termination,
- mpf_rtp_termination_descriptor_t *rtp_descriptor,
- void *obj)
-{
- mrcp_resource_t *resource;
- mrcp_client_profile_t *profile;
- mrcp_client_session_t *client_session = (mrcp_client_session_t*)session;
- if(!client_session || !client_session->profile) {
- /* Invalid params */
- return FALSE;
- }
- profile = client_session->profile;
-
- if(!profile->resource_factory) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Channel: invalid profile");
- return FALSE;
- }
- resource = mrcp_resource_get(profile->resource_factory,resource_id);
- if(!resource) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Channel: no such resource");
- return FALSE;
- }
-
- if(termination) {
- /* Media engine and RTP factory must be specified in this case */
- if(!profile->mpf_factory || !profile->rtp_termination_factory) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Channel: invalid profile");
- return FALSE;
- }
- }
- else {
- /* Either termination or rtp_descriptor must be specified */
- if(!rtp_descriptor) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Channel: missing both termination and RTP descriptor");
- return FALSE;
- }
- }
-
- return mrcp_client_channel_create(client_session,resource,termination,rtp_descriptor,obj);
-}
-
-/** Get external object associated with the channel */
-MRCP_DECLARE(void*) mrcp_application_channel_object_get(const mrcp_channel_t *channel)
-{
- if(!channel) {
- return FALSE;
- }
- return channel->obj;
-}
-
-/** Get RTP termination descriptor */
-MRCP_DECLARE(mpf_rtp_termination_descriptor_t*) mrcp_application_rtp_descriptor_get(const mrcp_channel_t *channel)
-{
- if(!channel || !channel->rtp_termination_slot) {
- return NULL;
- }
- return channel->rtp_termination_slot->descriptor;
-}
-
-/** Get codec descriptor of source stream */
-MRCP_DECLARE(const mpf_codec_descriptor_t*) mrcp_application_source_descriptor_get(const mrcp_channel_t *channel)
-{
- mpf_audio_stream_t *audio_stream;
- if(!channel || !channel->termination) {
- return NULL;
- }
- audio_stream = mpf_termination_audio_stream_get(channel->termination);
- if(!audio_stream) {
- return NULL;
- }
- return audio_stream->rx_descriptor;
-}
-
-/** Get codec descriptor of sink stream */
-MRCP_DECLARE(const mpf_codec_descriptor_t*) mrcp_application_sink_descriptor_get(const mrcp_channel_t *channel)
-{
- mpf_audio_stream_t *audio_stream;
- if(!channel || !channel->termination) {
- return NULL;
- }
- audio_stream = mpf_termination_audio_stream_get(channel->termination);
- if(!audio_stream) {
- return NULL;
- }
- return audio_stream->tx_descriptor;
-}
-
-/** Get associated audio stream */
-MRCP_DECLARE(const mpf_audio_stream_t*) mrcp_application_audio_stream_get(const mrcp_channel_t *channel)
-{
- if(!channel || !channel->termination) {
- return NULL;
- }
-
- return mpf_termination_audio_stream_get(channel->termination);
-}
-
-/** Send channel add request */
-MRCP_DECLARE(apt_bool_t) mrcp_application_channel_add(mrcp_session_t *session, mrcp_channel_t *channel)
-{
- if(!session || !channel) {
- return FALSE;
- }
- return mrcp_app_signaling_task_msg_signal(MRCP_SIG_COMMAND_CHANNEL_ADD,session,channel);
-}
-
-/** Send channel removal request */
-MRCP_DECLARE(apt_bool_t) mrcp_application_channel_remove(mrcp_session_t *session, mrcp_channel_t *channel)
-{
- if(!session || !channel) {
- return FALSE;
- }
- return mrcp_app_signaling_task_msg_signal(MRCP_SIG_COMMAND_CHANNEL_REMOVE,session,channel);
-}
-
-/** Send resource discovery request */
-MRCP_DECLARE(apt_bool_t) mrcp_application_resource_discover(mrcp_session_t *session)
-{
- if(!session) {
- return FALSE;
- }
- return mrcp_app_signaling_task_msg_signal(MRCP_SIG_COMMAND_RESOURCE_DISCOVER,session,NULL);
-}
-
-/** Create MRCP message */
-MRCP_DECLARE(mrcp_message_t*) mrcp_application_message_create(mrcp_session_t *session, mrcp_channel_t *channel, mrcp_method_id method_id)
-{
- mrcp_message_t *mrcp_message;
- mrcp_client_profile_t *profile;
- mrcp_client_session_t *client_session = (mrcp_client_session_t*)session;
- if(!client_session || !channel || !channel->resource) {
- return NULL;
- }
- profile = client_session->profile;
- if(!profile || !profile->resource_factory) {
- return NULL;
- }
- mrcp_message = mrcp_request_create(
- channel->resource,
- profile->mrcp_version,
- method_id,
- session->pool);
- return mrcp_message;
-}
-
-/** Send MRCP message */
-MRCP_DECLARE(apt_bool_t) mrcp_application_message_send(mrcp_session_t *session, mrcp_channel_t *channel, mrcp_message_t *message)
-{
- if(!session || !channel || !message) {
- return FALSE;
- }
- return mrcp_app_control_task_msg_signal(session,channel,message);
-}
-
-/** Create audio termination */
-MRCP_DECLARE(mpf_termination_t*) mrcp_application_audio_termination_create(
- mrcp_session_t *session,
- const mpf_audio_stream_vtable_t *stream_vtable,
- mpf_stream_capabilities_t *capabilities,
- void *obj)
-{
- mpf_audio_stream_t *audio_stream;
-
- if(!capabilities) {
- return NULL;
- }
-
- if(mpf_codec_capabilities_validate(&capabilities->codecs) == FALSE) {
- return NULL;
- }
-
- /* create audio stream */
- audio_stream = mpf_audio_stream_create(
- obj, /* object to associate */
- stream_vtable, /* virtual methods table of audio stream */
- capabilities, /* stream capabilities */
- session->pool); /* memory pool to allocate memory from */
- if(!audio_stream) {
- return NULL;
- }
-
- /* create raw termination */
- return mpf_raw_termination_create(
- NULL, /* no object to associate */
- audio_stream, /* audio stream */
- NULL, /* no video stream */
- session->pool); /* memory pool to allocate memory from */
-}
-
-/** Create source media termination */
-MRCP_DECLARE(mpf_termination_t*) mrcp_application_source_termination_create(
- mrcp_session_t *session,
- const mpf_audio_stream_vtable_t *stream_vtable,
- mpf_codec_descriptor_t *codec_descriptor,
- void *obj)
-{
- mpf_stream_capabilities_t *capabilities;
- mpf_audio_stream_t *audio_stream;
-
- capabilities = mpf_source_stream_capabilities_create(session->pool);
- if(codec_descriptor) {
- mpf_codec_capabilities_add(
- &capabilities->codecs,
- mpf_sample_rate_mask_get(codec_descriptor->sampling_rate),
- codec_descriptor->name.buf);
- }
- else {
- mpf_codec_default_capabilities_add(&capabilities->codecs);
- }
-
- /* create audio stream */
- audio_stream = mpf_audio_stream_create(
- obj, /* object to associate */
- stream_vtable, /* virtual methods table of audio stream */
- capabilities, /* stream capabilities */
- session->pool); /* memory pool to allocate memory from */
-
- if(!audio_stream) {
- return NULL;
- }
-
- audio_stream->rx_descriptor = codec_descriptor;
-
- /* create raw termination */
- return mpf_raw_termination_create(
- NULL, /* no object to associate */
- audio_stream, /* audio stream */
- NULL, /* no video stream */
- session->pool); /* memory pool to allocate memory from */
-}
-
-/** Create sink media termination */
-MRCP_DECLARE(mpf_termination_t*) mrcp_application_sink_termination_create(
- mrcp_session_t *session,
- const mpf_audio_stream_vtable_t *stream_vtable,
- mpf_codec_descriptor_t *codec_descriptor,
- void *obj)
-{
- mpf_stream_capabilities_t *capabilities;
- mpf_audio_stream_t *audio_stream;
-
- capabilities = mpf_sink_stream_capabilities_create(session->pool);
- if(codec_descriptor) {
- mpf_codec_capabilities_add(
- &capabilities->codecs,
- mpf_sample_rate_mask_get(codec_descriptor->sampling_rate),
- codec_descriptor->name.buf);
- }
- else {
- mpf_codec_default_capabilities_add(&capabilities->codecs);
- }
-
- /* create audio stream */
- audio_stream = mpf_audio_stream_create(
- obj, /* object to associate */
- stream_vtable, /* virtual methods table of audio stream */
- capabilities, /* stream capabilities */
- session->pool); /* memory pool to allocate memory from */
- if(!audio_stream) {
- return NULL;
- }
-
- audio_stream->tx_descriptor = codec_descriptor;
-
- /* create raw termination */
- return mpf_raw_termination_create(
- NULL, /* no object to associate */
- audio_stream, /* audio stream */
- NULL, /* no video stream */
- session->pool); /* memory pool to allocate memory from */
-}
-
-/** Dispatch application message */
-MRCP_DECLARE(apt_bool_t) mrcp_application_message_dispatch(const mrcp_app_message_dispatcher_t *dispatcher, const mrcp_app_message_t *app_message)
-{
- apt_bool_t status = FALSE;
- switch(app_message->message_type) {
- case MRCP_APP_MESSAGE_TYPE_SIGNALING:
- {
- if(app_message->sig_message.message_type == MRCP_SIG_MESSAGE_TYPE_RESPONSE) {
- switch(app_message->sig_message.command_id) {
- case MRCP_SIG_COMMAND_SESSION_UPDATE:
- if(dispatcher->on_session_update) {
- status = dispatcher->on_session_update(
- app_message->application,
- app_message->session,
- app_message->sig_message.status);
- }
- break;
- case MRCP_SIG_COMMAND_SESSION_TERMINATE:
- if(dispatcher->on_session_terminate) {
- status = dispatcher->on_session_terminate(
- app_message->application,
- app_message->session,
- app_message->sig_message.status);
- }
- break;
- case MRCP_SIG_COMMAND_CHANNEL_ADD:
- if(dispatcher->on_channel_add) {
- status = dispatcher->on_channel_add(
- app_message->application,
- app_message->session,
- app_message->channel,
- app_message->sig_message.status);
- }
- break;
- case MRCP_SIG_COMMAND_CHANNEL_REMOVE:
- if(dispatcher->on_channel_remove) {
- status = dispatcher->on_channel_remove(
- app_message->application,
- app_message->session,
- app_message->channel,
- app_message->sig_message.status);
- }
- break;
- case MRCP_SIG_COMMAND_RESOURCE_DISCOVER:
- if(dispatcher->on_resource_discover) {
- status = dispatcher->on_resource_discover(
- app_message->application,
- app_message->session,
- app_message->descriptor,
- app_message->sig_message.status);
- }
- break;
- default:
- break;
- }
- }
- else if(app_message->sig_message.message_type == MRCP_SIG_MESSAGE_TYPE_EVENT) {
- switch(app_message->sig_message.event_id) {
- case MRCP_SIG_EVENT_TERMINATE:
- if(dispatcher->on_terminate_event) {
- status = dispatcher->on_terminate_event(
- app_message->application,
- app_message->session,
- app_message->channel);
- }
- break;
- default:
- break;
- }
- }
- break;
- }
- case MRCP_APP_MESSAGE_TYPE_CONTROL:
- {
- if(dispatcher->on_message_receive) {
- status = dispatcher->on_message_receive(
- app_message->application,
- app_message->session,
- app_message->channel,
- app_message->control_message);
- }
- break;
- }
- }
- return status;
-}
diff --git a/libs/unimrcp/libs/mrcp-client/src/mrcp_client.c b/libs/unimrcp/libs/mrcp-client/src/mrcp_client.c
deleted file mode 100644
index 0212ff8a86..0000000000
--- a/libs/unimrcp/libs/mrcp-client/src/mrcp_client.c
+++ /dev/null
@@ -1,989 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_client.c 2251 2014-11-21 02:36:44Z achaloyan@gmail.com $
- */
-
-#include
-#include
-#include "mrcp_client.h"
-#include "mrcp_sig_agent.h"
-#include "mrcp_client_session.h"
-#include "mrcp_client_connection.h"
-#include "mrcp_ca_factory.h"
-#include "mpf_engine_factory.h"
-#include "apt_consumer_task.h"
-#include "apt_pool.h"
-#include "apt_log.h"
-
-#define CLIENT_TASK_NAME "MRCP Client"
-
-/** MRCP client */
-struct mrcp_client_t {
- /** Main message processing task */
- apt_consumer_task_t *task;
-
- /** MRCP resource factory */
- mrcp_resource_factory_t *resource_factory;
- /** Codec manager */
- mpf_codec_manager_t *codec_manager;
- /** Table of media processing engines (mpf_engine_t*) */
- apr_hash_t *media_engine_table;
- /** Table of RTP termination factories (mpf_termination_factory_t*) */
- apr_hash_t *rtp_factory_table;
- /** Table of signaling agents (mrcp_sig_agent_t*) */
- apr_hash_t *sig_agent_table;
- /** Table of signaling settings (mrcp_sig_settings_t*) */
- apr_hash_t *sig_settings_table;
- /** Table of connection agents (mrcp_connection_agent_t*) */
- apr_hash_t *cnt_agent_table;
- /** Table of RTP settings (mpf_rtp_settings_t*) */
- apr_hash_t *rtp_settings_table;
- /** Table of profiles (mrcp_client_profile_t*) */
- apr_hash_t *profile_table;
-
- /** Table of applications (mrcp_application_t*) */
- apr_hash_t *app_table;
-
- /** Table of sessions/handles */
- apr_hash_t *session_table;
-
- /** Connection task message pool */
- apt_task_msg_pool_t *cnt_msg_pool;
-
- /** Event handler used in case of async start */
- mrcp_client_handler_f on_start_complete;
- /** Wait object used in case of synch start */
- apr_thread_cond_t *sync_start_object;
- /** Mutex to protect sync start routine */
- apr_thread_mutex_t *sync_start_mutex;
-
- /** Dir layout structure */
- apt_dir_layout_t *dir_layout;
- /** Memory pool */
- apr_pool_t *pool;
-};
-
-
-typedef enum {
- MRCP_CLIENT_SIGNALING_TASK_MSG = TASK_MSG_USER,
- MRCP_CLIENT_CONNECTION_TASK_MSG,
- MRCP_CLIENT_MEDIA_TASK_MSG,
- MRCP_CLIENT_APPLICATION_TASK_MSG
-} mrcp_client_task_msg_type_e;
-
-/* Signaling agent interface */
-typedef enum {
- SIG_AGENT_TASK_MSG_ANSWER,
- SIG_AGENT_TASK_MSG_TERMINATE_RESPONSE,
- SIG_AGENT_TASK_MSG_CONTROL_RESPONSE,
- SIG_AGENT_TASK_MSG_DISCOVER_RESPONSE,
- SIG_AGENT_TASK_MSG_TERMINATE_EVENT
-} sig_agent_task_msg_type_e;
-
-typedef struct sig_agent_task_msg_data_t sig_agent_task_msg_data_t;
-struct sig_agent_task_msg_data_t {
- mrcp_client_session_t *session;
- mrcp_session_descriptor_t *descriptor;
- mrcp_message_t *message;
-};
-
-static apt_bool_t mrcp_client_answer_signal(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor);
-static apt_bool_t mrcp_client_terminate_response_signal(mrcp_session_t *session);
-static apt_bool_t mrcp_client_control_response_signal(mrcp_session_t *session, mrcp_message_t *message);
-static apt_bool_t mrcp_client_discover_response_signal(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor);
-
-static apt_bool_t mrcp_client_terminate_event_signal(mrcp_session_t *session);
-
-static const mrcp_session_response_vtable_t session_response_vtable = {
- mrcp_client_answer_signal,
- mrcp_client_terminate_response_signal,
- mrcp_client_control_response_signal,
- mrcp_client_discover_response_signal
-};
-
-static const mrcp_session_event_vtable_t session_event_vtable = {
- mrcp_client_terminate_event_signal
-};
-
-/* Connection agent interface */
-typedef enum {
- CONNECTION_AGENT_TASK_MSG_ADD_CHANNEL,
- CONNECTION_AGENT_TASK_MSG_MODIFY_CHANNEL,
- CONNECTION_AGENT_TASK_MSG_REMOVE_CHANNEL,
- CONNECTION_AGENT_TASK_MSG_RECEIVE_MESSAGE,
- CONNECTION_AGENT_TASK_MSG_DISCONNECT
-} connection_agent_task_msg_type_e ;
-
-typedef struct connection_agent_task_msg_data_t connection_agent_task_msg_data_t;
-struct connection_agent_task_msg_data_t {
- mrcp_channel_t *channel;
- mrcp_control_descriptor_t *descriptor;
- mrcp_message_t *message;
- apt_bool_t status;
-};
-
-static apt_bool_t mrcp_client_channel_add_signal(mrcp_control_channel_t *channel, mrcp_control_descriptor_t *descriptor, apt_bool_t status);
-static apt_bool_t mrcp_client_channel_modify_signal(mrcp_control_channel_t *channel, mrcp_control_descriptor_t *descriptor, apt_bool_t status);
-static apt_bool_t mrcp_client_channel_remove_signal(mrcp_control_channel_t *channel, apt_bool_t status);
-static apt_bool_t mrcp_client_message_signal(mrcp_control_channel_t *channel, mrcp_message_t *message);
-static apt_bool_t mrcp_client_disconnect_signal(mrcp_control_channel_t *channel);
-
-static const mrcp_connection_event_vtable_t connection_method_vtable = {
- mrcp_client_channel_add_signal,
- mrcp_client_channel_modify_signal,
- mrcp_client_channel_remove_signal,
- mrcp_client_message_signal,
- mrcp_client_disconnect_signal
-};
-
-/* Task interface */
-static void mrcp_client_on_start_complete(apt_task_t *task);
-static void mrcp_client_on_terminate_complete(apt_task_t *task);
-static apt_bool_t mrcp_client_msg_process(apt_task_t *task, apt_task_msg_t *msg);
-
-
-/** Create MRCP client instance */
-MRCP_DECLARE(mrcp_client_t*) mrcp_client_create(apt_dir_layout_t *dir_layout)
-{
- mrcp_client_t *client;
- apr_pool_t *pool;
- apt_task_t *task;
- apt_task_vtable_t *vtable;
- apt_task_msg_pool_t *msg_pool;
-
- pool = apt_pool_create();
- if(!pool) {
- return NULL;
- }
-
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create "CLIENT_TASK_NAME);
- client = apr_palloc(pool,sizeof(mrcp_client_t));
- client->pool = pool;
- client->dir_layout = dir_layout;
- client->resource_factory = NULL;
- client->media_engine_table = NULL;
- client->rtp_factory_table = NULL;
- client->sig_agent_table = NULL;
- client->sig_settings_table = NULL;
- client->cnt_agent_table = NULL;
- client->rtp_settings_table = NULL;
- client->profile_table = NULL;
- client->app_table = NULL;
- client->session_table = NULL;
- client->cnt_msg_pool = NULL;
-
- msg_pool = apt_task_msg_pool_create_dynamic(0,pool);
- client->task = apt_consumer_task_create(client,msg_pool,pool);
- if(!client->task) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Client Task");
- return NULL;
- }
- task = apt_consumer_task_base_get(client->task);
- apt_task_name_set(task,CLIENT_TASK_NAME);
- vtable = apt_task_vtable_get(task);
- if(vtable) {
- vtable->process_msg = mrcp_client_msg_process;
- vtable->on_start_complete = mrcp_client_on_start_complete;
- vtable->on_terminate_complete = mrcp_client_on_terminate_complete;
- }
-
- client->media_engine_table = apr_hash_make(client->pool);
- client->rtp_factory_table = apr_hash_make(client->pool);
- client->sig_agent_table = apr_hash_make(client->pool);
- client->sig_settings_table = apr_hash_make(client->pool);
- client->cnt_agent_table = apr_hash_make(client->pool);
- client->rtp_settings_table = apr_hash_make(client->pool);
- client->profile_table = apr_hash_make(client->pool);
- client->app_table = apr_hash_make(client->pool);
-
- client->session_table = apr_hash_make(client->pool);
-
- client->on_start_complete = NULL;
- client->sync_start_object = NULL;
- client->sync_start_mutex = NULL;
- return client;
-}
-
-/** Set asynchronous start mode */
-MRCP_DECLARE(void) mrcp_client_async_start_set(mrcp_client_t *client, mrcp_client_handler_f handler)
-{
- if(client) {
- client->on_start_complete = handler;
- }
-}
-
-/** Start message processing loop */
-MRCP_DECLARE(apt_bool_t) mrcp_client_start(mrcp_client_t *client)
-{
- apt_bool_t sync_start = TRUE;
- apt_task_t *task;
- if(!client || !client->task) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Invalid Client");
- return FALSE;
- }
- task = apt_consumer_task_base_get(client->task);
-
- if(client->on_start_complete) {
- sync_start = FALSE;
- }
-
- if(sync_start == TRUE) {
- /* get prepared to start stack synchronously */
- apr_thread_mutex_create(&client->sync_start_mutex,APR_THREAD_MUTEX_DEFAULT,client->pool);
- apr_thread_cond_create(&client->sync_start_object,client->pool);
-
- apr_thread_mutex_lock(client->sync_start_mutex);
- }
-
- if(apt_task_start(task) == FALSE) {
- if(sync_start == TRUE) {
- apr_thread_mutex_unlock(client->sync_start_mutex);
- }
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Start Client Task");
- return FALSE;
- }
-
- if(sync_start == TRUE) {
- /* wait for start complete */
- apr_thread_cond_wait(client->sync_start_object,client->sync_start_mutex);
- apr_thread_mutex_unlock(client->sync_start_mutex);
- }
-
- return TRUE;
-}
-
-/** Shutdown message processing loop */
-MRCP_DECLARE(apt_bool_t) mrcp_client_shutdown(mrcp_client_t *client)
-{
- apt_task_t *task;
- if(!client || !client->task) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Invalid Client");
- return FALSE;
- }
- task = apt_consumer_task_base_get(client->task);
- if(apt_task_terminate(task,TRUE) == FALSE) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Shutdown Client Task");
- return FALSE;
- }
- client->session_table = NULL;
-
- if(client->sync_start_object) {
- apr_thread_cond_destroy(client->sync_start_object);
- client->sync_start_object = NULL;
- }
- if(client->sync_start_mutex) {
- apr_thread_mutex_destroy(client->sync_start_mutex);
- client->sync_start_mutex = NULL;
- }
-
- return TRUE;
-}
-
-/** Destroy MRCP client */
-MRCP_DECLARE(apt_bool_t) mrcp_client_destroy(mrcp_client_t *client)
-{
- apt_task_t *task;
- if(!client || !client->task) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Invalid Client");
- return FALSE;
- }
- task = apt_consumer_task_base_get(client->task);
- apt_task_destroy(task);
-
- apr_pool_destroy(client->pool);
- return TRUE;
-}
-
-
-/** Register MRCP resource factory */
-MRCP_DECLARE(apt_bool_t) mrcp_client_resource_factory_register(mrcp_client_t *client, mrcp_resource_factory_t *resource_factory)
-{
- if(!resource_factory) {
- return FALSE;
- }
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Register Resource Factory");
- client->resource_factory = resource_factory;
- return TRUE;
-}
-
-/** Register codec manager */
-MRCP_DECLARE(apt_bool_t) mrcp_client_codec_manager_register(mrcp_client_t *client, mpf_codec_manager_t *codec_manager)
-{
- if(!codec_manager) {
- return FALSE;
- }
- client->codec_manager = codec_manager;
- return TRUE;
-}
-
-/** Get registered codec manager */
-MRCP_DECLARE(const mpf_codec_manager_t*) mrcp_client_codec_manager_get(const mrcp_client_t *client)
-{
- return client->codec_manager;
-}
-
-/** Register media engine */
-MRCP_DECLARE(apt_bool_t) mrcp_client_media_engine_register(mrcp_client_t *client, mpf_engine_t *media_engine)
-{
- const char *id;
- if(!media_engine) {
- return FALSE;
- }
- id = mpf_engine_id_get(media_engine);
- if(!id) {
- return FALSE;
- }
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Register Media Engine [%s]",id);
- mpf_engine_codec_manager_register(media_engine,client->codec_manager);
- apr_hash_set(client->media_engine_table,id,APR_HASH_KEY_STRING,media_engine);
- mpf_engine_task_msg_type_set(media_engine,MRCP_CLIENT_MEDIA_TASK_MSG);
- if(client->task) {
- apt_task_t *media_task = mpf_task_get(media_engine);
- apt_task_t *task = apt_consumer_task_base_get(client->task);
- apt_task_add(task,media_task);
- }
- return TRUE;
-}
-
-/** Get media engine by name */
-MRCP_DECLARE(mpf_engine_t*) mrcp_client_media_engine_get(const mrcp_client_t *client, const char *name)
-{
- return apr_hash_get(client->media_engine_table,name,APR_HASH_KEY_STRING);
-}
-
-/** Register RTP termination factory */
-MRCP_DECLARE(apt_bool_t) mrcp_client_rtp_factory_register(mrcp_client_t *client, mpf_termination_factory_t *rtp_termination_factory, const char *name)
-{
- if(!rtp_termination_factory || !name) {
- return FALSE;
- }
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Register RTP Termination Factory [%s]",name);
- apr_hash_set(client->rtp_factory_table,name,APR_HASH_KEY_STRING,rtp_termination_factory);
- return TRUE;
-}
-
-/** Get RTP termination factory by name */
-MRCP_DECLARE(mpf_termination_factory_t*) mrcp_client_rtp_factory_get(const mrcp_client_t *client, const char *name)
-{
- return apr_hash_get(client->rtp_factory_table,name,APR_HASH_KEY_STRING);
-}
-
-/** Register RTP settings */
-MRCP_DECLARE(apt_bool_t) mrcp_client_rtp_settings_register(mrcp_client_t *client, mpf_rtp_settings_t *rtp_settings, const char *name)
-{
- if(!rtp_settings || !name) {
- return FALSE;
- }
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Register RTP Settings [%s]",name);
- apr_hash_set(client->rtp_settings_table,name,APR_HASH_KEY_STRING,rtp_settings);
- return TRUE;
-}
-
-/** Get RTP settings by name */
-MRCP_DECLARE(mpf_rtp_settings_t*) mrcp_client_rtp_settings_get(const mrcp_client_t *client, const char *name)
-{
- return apr_hash_get(client->rtp_settings_table,name,APR_HASH_KEY_STRING);
-}
-
-/** Register MRCP signaling agent */
-MRCP_DECLARE(apt_bool_t) mrcp_client_signaling_agent_register(mrcp_client_t *client, mrcp_sig_agent_t *signaling_agent)
-{
- if(!signaling_agent || !signaling_agent->id) {
- return FALSE;
- }
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Register Signaling Agent [%s]",signaling_agent->id);
- signaling_agent->msg_pool = apt_task_msg_pool_create_dynamic(sizeof(sig_agent_task_msg_data_t),client->pool);
- signaling_agent->parent = client;
- signaling_agent->resource_factory = client->resource_factory;
- apr_hash_set(client->sig_agent_table,signaling_agent->id,APR_HASH_KEY_STRING,signaling_agent);
- if(client->task) {
- apt_task_t *task = apt_consumer_task_base_get(client->task);
- apt_task_add(task,signaling_agent->task);
- }
- return TRUE;
-}
-
-/** Get signaling agent by name */
-MRCP_DECLARE(mrcp_sig_agent_t*) mrcp_client_signaling_agent_get(const mrcp_client_t *client, const char *name)
-{
- return apr_hash_get(client->sig_agent_table,name,APR_HASH_KEY_STRING);
-}
-
-/** Register MRCP signaling settings */
-MRCP_DECLARE(apt_bool_t) mrcp_client_signaling_settings_register(mrcp_client_t *client, mrcp_sig_settings_t *signaling_settings, const char *name)
-{
- if(!signaling_settings || !name) {
- return FALSE;
- }
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Register Signaling Settings [%s]",name);
- apr_hash_set(client->sig_settings_table,name,APR_HASH_KEY_STRING,signaling_settings);
- return TRUE;
-}
-
-/** Get signaling settings by name */
-MRCP_DECLARE(mrcp_sig_settings_t*) mrcp_client_signaling_settings_get(const mrcp_client_t *client, const char *name)
-{
- return apr_hash_get(client->sig_settings_table,name,APR_HASH_KEY_STRING);
-}
-
-
-/** Register MRCP connection agent (MRCPv2 only) */
-MRCP_DECLARE(apt_bool_t) mrcp_client_connection_agent_register(mrcp_client_t *client, mrcp_connection_agent_t *connection_agent)
-{
- const char *id;
- if(!connection_agent) {
- return FALSE;
- }
- id = mrcp_client_connection_agent_id_get(connection_agent);
- if(!id) {
- return FALSE;
- }
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Register Connection Agent [%s]",id);
- mrcp_client_connection_resource_factory_set(connection_agent,client->resource_factory);
- mrcp_client_connection_agent_handler_set(connection_agent,client,&connection_method_vtable);
- client->cnt_msg_pool = apt_task_msg_pool_create_dynamic(sizeof(connection_agent_task_msg_data_t),client->pool);
- apr_hash_set(client->cnt_agent_table,id,APR_HASH_KEY_STRING,connection_agent);
- if(client->task) {
- apt_task_t *task = apt_consumer_task_base_get(client->task);
- apt_task_t *connection_task = mrcp_client_connection_agent_task_get(connection_agent);
- apt_task_add(task,connection_task);
- }
- return TRUE;
-}
-
-/** Get connection agent by name */
-MRCP_DECLARE(mrcp_connection_agent_t*) mrcp_client_connection_agent_get(const mrcp_client_t *client, const char *name)
-{
- return apr_hash_get(client->cnt_agent_table,name,APR_HASH_KEY_STRING);
-}
-
-/** Create MRCP profile */
-MRCP_DECLARE(mrcp_client_profile_t*) mrcp_client_profile_create(
- mrcp_resource_factory_t *resource_factory,
- mrcp_sig_agent_t *signaling_agent,
- mrcp_connection_agent_t *connection_agent,
- mpf_engine_t *media_engine,
- mpf_termination_factory_t *rtp_factory,
- mpf_rtp_settings_t *rtp_settings,
- mrcp_sig_settings_t *signaling_settings,
- apr_pool_t *pool)
-{
- mrcp_sa_factory_t *sa_factory = NULL;
- mrcp_ca_factory_t *ca_factory = NULL;
- mpf_engine_factory_t *mpf_factory = NULL;
- mrcp_version_e mrcp_version = MRCP_VERSION_2;
- if(!connection_agent)
- mrcp_version = MRCP_VERSION_1;
-
- if(signaling_agent) {
- sa_factory = mrcp_sa_factory_create(pool);
- mrcp_sa_factory_agent_add(sa_factory,signaling_agent);
- }
-
- if(connection_agent) {
- ca_factory = mrcp_ca_factory_create(pool);
- mrcp_ca_factory_agent_add(ca_factory,connection_agent);
- }
-
- if(media_engine) {
- mpf_factory = mpf_engine_factory_create(pool);
- mpf_engine_factory_engine_add(mpf_factory,media_engine);
- }
-
- return mrcp_client_profile_create_ex(
- mrcp_version,
- resource_factory,
- sa_factory,
- ca_factory,
- mpf_factory,
- rtp_factory,
- rtp_settings,
- signaling_settings,
- pool);
-}
-
-/** Create MRCP profile (extended version) */
-MRCP_DECLARE(mrcp_client_profile_t*) mrcp_client_profile_create_ex(
- mrcp_version_e mrcp_version,
- mrcp_resource_factory_t *resource_factory,
- mrcp_sa_factory_t *sa_factory,
- mrcp_ca_factory_t *ca_factory,
- mpf_engine_factory_t *mpf_factory,
- mpf_termination_factory_t *rtp_factory,
- mpf_rtp_settings_t *rtp_settings,
- mrcp_sig_settings_t *signaling_settings,
- apr_pool_t *pool)
-{
- mrcp_client_profile_t *profile = apr_palloc(pool,sizeof(mrcp_client_profile_t));
- profile->name = NULL;
- profile->tag = NULL;
- profile->mrcp_version = mrcp_version;
- profile->resource_factory = resource_factory;
- profile->mpf_factory = mpf_factory;
- profile->rtp_termination_factory = rtp_factory;
- profile->rtp_settings = rtp_settings;
- profile->sa_factory = sa_factory;
- profile->ca_factory = ca_factory;
- profile->signaling_settings = signaling_settings;
-
- if(mpf_factory && rtp_factory)
- mpf_engine_factory_rtp_factory_assign(mpf_factory,rtp_factory);
- return profile;
-}
-
-/** Set a tag to the profile */
-MRCP_DECLARE(void) mrcp_client_profile_tag_set(mrcp_client_profile_t *profile, const char *tag)
-{
- if(profile) {
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set Profile Tag [%s]",tag);
- profile->tag = tag;
- }
-}
-
-/** Register MRCP profile */
-MRCP_DECLARE(apt_bool_t) mrcp_client_profile_register(mrcp_client_t *client, mrcp_client_profile_t *profile, const char *name)
-{
- if(!profile || !name) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Register Profile: no name");
- return FALSE;
- }
- if(!profile->resource_factory) {
- profile->resource_factory = client->resource_factory;
- }
- if(!profile->sa_factory) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Register Profile [%s]: missing signaling agent factory",name);
- return FALSE;
- }
- if(mrcp_sa_factory_is_empty(profile->sa_factory) == TRUE) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Register Profile [%s]: empty signaling agent factory",name);
- return FALSE;
- }
- if(profile->mrcp_version == MRCP_VERSION_2) {
- if(!profile->ca_factory) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Register Profile [%s]: missing connection agent factory",name);
- return FALSE;
- }
- if(mrcp_ca_factory_is_empty(profile->ca_factory) == TRUE) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Register Profile [%s]: empty connection agent factory",name);
- return FALSE;
- }
- }
-
- /* mpf_factory may not be specified; but if it is specified, it must not be empty */
- if(profile->mpf_factory) {
- if(mpf_engine_factory_is_empty(profile->mpf_factory) == TRUE) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Register Profile [%s]: empty media engine factory",name);
- return FALSE;
- }
- }
-
- if(!profile->signaling_settings) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Register Profile [%s]: missing signaling settings",name);
- return FALSE;
- }
-
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Register Profile [%s]",name);
- apr_hash_set(client->profile_table,name,APR_HASH_KEY_STRING,profile);
- profile->name = name;
- return TRUE;
-}
-
-/** Get profile by name */
-MRCP_DECLARE(mrcp_client_profile_t*) mrcp_client_profile_get(const mrcp_client_t *client, const char *name)
-{
- return apr_hash_get(client->profile_table,name,APR_HASH_KEY_STRING);
-}
-
-/** Get available profiles */
-MRCP_DECLARE(apt_bool_t) mrcp_client_profiles_get(const mrcp_client_t *client, mrcp_client_profile_t *profiles[], apr_size_t *count, const char *tag)
-{
- apr_hash_index_t *it;
- void *val;
- mrcp_client_profile_t *profile;
- apr_size_t i = 0;
- apt_bool_t status = TRUE;
-
- if(!profiles || !count) {
- return FALSE;
- }
-
- for(it = apr_hash_first(client->pool, client->profile_table); it; it = apr_hash_next(it)) {
- apr_hash_this(it, NULL, NULL, &val);
- if(!val) continue;
-
- if(i >= *count) {
- status = FALSE;
- break;
- }
-
- profile = val;
- if(!tag || (profile->tag && strcasecmp(tag,profile->tag) == 0)) {
- profiles[i] = profile;
- i++;
- }
- }
- *count = i;
- return status;
-}
-
-/** Register MRCP application */
-MRCP_DECLARE(apt_bool_t) mrcp_client_application_register(mrcp_client_t *client, mrcp_application_t *application, const char *name)
-{
- if(!application || !name) {
- return FALSE;
- }
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Register Application [%s]",name);
- application->client = client;
- application->msg_pool = apt_task_msg_pool_create_dynamic(sizeof(mrcp_app_message_t*),client->pool);
- apr_hash_set(client->app_table,name,APR_HASH_KEY_STRING,application);
- return TRUE;
-}
-
-/** Get memory pool */
-MRCP_DECLARE(apr_pool_t*) mrcp_client_memory_pool_get(const mrcp_client_t *client)
-{
- return client->pool;
-}
-
-/** Get directory layout */
-MRCP_DECLARE(apt_dir_layout_t*) mrcp_client_dir_layout_get(const mrcp_client_t *client)
-{
- return client->dir_layout;
-}
-
-mrcp_client_session_t* mrcp_client_session_create(mrcp_client_t *client)
-{
- apr_pool_t *pool;
- mrcp_client_session_t *session = (mrcp_client_session_t*) mrcp_session_create(sizeof(mrcp_client_session_t)-sizeof(mrcp_session_t));
-
- pool = session->base.pool;
- session->base.name = apr_psprintf(pool,"0x%pp",session);
- session->base.response_vtable = &session_response_vtable;
- session->base.event_vtable = &session_event_vtable;
-
- session->application = NULL;
- session->app_obj = NULL;
- session->profile = NULL;
- session->context = NULL;
- session->codec_manager = client->codec_manager;
- session->terminations = apr_array_make(pool,2,sizeof(rtp_termination_slot_t));
- session->channels = apr_array_make(pool,2,sizeof(mrcp_channel_t*));
- session->registered = FALSE;
- session->offer = NULL;
- session->answer = NULL;
- session->active_request = NULL;
- session->request_queue = apt_list_create(pool);
- session->mpf_task_msg = NULL;
- session->subrequest_count = 0;
- session->disconnected = FALSE;
- session->state = SESSION_STATE_NONE;
- session->status = MRCP_SIG_STATUS_CODE_SUCCESS;
- return session;
-}
-
-void mrcp_client_session_add(mrcp_client_t *client, mrcp_client_session_t *session)
-{
- if(session) {
- apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,session->base.log_obj,"Add MRCP Handle "APT_NAMESID_FMT,
- session->base.name,
- MRCP_SESSION_SID(&session->base));
- apr_hash_set(client->session_table,session,sizeof(void*),session);
- }
-}
-
-void mrcp_client_session_remove(mrcp_client_t *client, mrcp_client_session_t *session)
-{
- if(session) {
- apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,session->base.log_obj,"Remove MRCP Handle "APT_NAMESID_FMT,
- session->base.name,
- MRCP_SESSION_SID(&session->base));
- apr_hash_set(client->session_table,session,sizeof(void*),NULL);
- }
-}
-
-static void mrcp_client_on_start_complete(apt_task_t *task)
-{
- apt_consumer_task_t *consumer_task = apt_task_object_get(task);
- mrcp_client_t *client = apt_consumer_task_object_get(consumer_task);
-
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,CLIENT_TASK_NAME" Started");
- if(client->on_start_complete) {
- /* async start */
- client->on_start_complete(TRUE);
- }
- else {
- /* sync start */
- apr_thread_mutex_lock(client->sync_start_mutex);
- apr_thread_cond_signal(client->sync_start_object);
- apr_thread_mutex_unlock(client->sync_start_mutex);
- }
-}
-
-static void mrcp_client_on_terminate_complete(apt_task_t *task)
-{
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,CLIENT_TASK_NAME" Terminated");
-}
-
-
-static apt_bool_t mrcp_client_msg_process(apt_task_t *task, apt_task_msg_t *msg)
-{
- apt_consumer_task_t *consumer_task = apt_task_object_get(task);
- mrcp_client_t *client = apt_consumer_task_object_get(consumer_task);
- if(!client) {
- return FALSE;
- }
- switch(msg->type) {
- case MRCP_CLIENT_SIGNALING_TASK_MSG:
- {
- const sig_agent_task_msg_data_t *sig_message = (const sig_agent_task_msg_data_t*)msg->data;
- switch(msg->sub_type) {
- case SIG_AGENT_TASK_MSG_ANSWER:
- mrcp_client_session_answer_process(sig_message->session,sig_message->descriptor);
- break;
- case SIG_AGENT_TASK_MSG_TERMINATE_RESPONSE:
- mrcp_client_session_terminate_response_process(sig_message->session);
- break;
- case SIG_AGENT_TASK_MSG_CONTROL_RESPONSE:
- mrcp_client_session_control_response_process(sig_message->session,sig_message->message);
- break;
- case SIG_AGENT_TASK_MSG_DISCOVER_RESPONSE:
- mrcp_client_session_discover_response_process(sig_message->session,sig_message->descriptor);
- break;
- case SIG_AGENT_TASK_MSG_TERMINATE_EVENT:
- mrcp_client_session_terminate_event_process(sig_message->session);
- break;
- default:
- break;
- }
- break;
- }
- case MRCP_CLIENT_CONNECTION_TASK_MSG:
- {
- const connection_agent_task_msg_data_t *data = (const connection_agent_task_msg_data_t*)msg->data;
- switch(msg->sub_type) {
- case CONNECTION_AGENT_TASK_MSG_ADD_CHANNEL:
- mrcp_client_on_channel_add(data->channel,data->descriptor,data->status);
- break;
- case CONNECTION_AGENT_TASK_MSG_MODIFY_CHANNEL:
- mrcp_client_on_channel_modify(data->channel,data->descriptor,data->status);
- break;
- case CONNECTION_AGENT_TASK_MSG_REMOVE_CHANNEL:
- mrcp_client_on_channel_remove(data->channel,data->status);
- break;
- case CONNECTION_AGENT_TASK_MSG_RECEIVE_MESSAGE:
- mrcp_client_on_message_receive(data->channel,data->message);
- break;
- case CONNECTION_AGENT_TASK_MSG_DISCONNECT:
- mrcp_client_on_disconnect(data->channel);
- break;
- default:
- break;
- }
- break;
- }
- case MRCP_CLIENT_MEDIA_TASK_MSG:
- {
- mpf_message_container_t *container = (mpf_message_container_t*) msg->data;
- mrcp_client_mpf_message_process(container);
- break;
- }
- case MRCP_CLIENT_APPLICATION_TASK_MSG:
- {
- mrcp_app_message_t **app_message = (mrcp_app_message_t**) msg->data;
- mrcp_client_app_message_process(*app_message);
- break;
- }
- default:
- {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Task Message Received [%d;%d]", msg->type,msg->sub_type);
- break;
- }
- }
- return TRUE;
-}
-
-apt_bool_t mrcp_app_signaling_task_msg_signal(mrcp_sig_command_e command_id, mrcp_session_t *session, mrcp_channel_t *channel)
-{
- mrcp_client_session_t *client_session = (mrcp_client_session_t*)session;
- mrcp_application_t *application = client_session->application;
- apt_task_t *task = apt_consumer_task_base_get(application->client->task);
- apt_task_msg_t *task_msg = apt_task_msg_acquire(application->msg_pool);
- if(task_msg) {
- mrcp_app_message_t **slot = ((mrcp_app_message_t**)task_msg->data);
- mrcp_app_message_t *app_message;
- task_msg->type = MRCP_CLIENT_APPLICATION_TASK_MSG;
-
- app_message = mrcp_client_app_signaling_request_create(command_id,session->pool);
- app_message->application = client_session->application;
- app_message->session = session;
- app_message->channel = channel;
- app_message->control_message = NULL;
- app_message->descriptor = NULL;
- *slot = app_message;
- return apt_task_msg_signal(task,task_msg);
- }
- return FALSE;
-}
-
-apt_bool_t mrcp_app_control_task_msg_signal(mrcp_session_t *session, mrcp_channel_t *channel, mrcp_message_t *message)
-{
- mrcp_client_session_t *client_session = (mrcp_client_session_t*)session;
- mrcp_application_t *application = client_session->application;
- apt_task_t *task = apt_consumer_task_base_get(application->client->task);
- apt_task_msg_t *task_msg = apt_task_msg_acquire(application->msg_pool);
- if(task_msg) {
- mrcp_app_message_t **slot = ((mrcp_app_message_t**)task_msg->data);
- mrcp_app_message_t *app_message;
- task_msg->type = MRCP_CLIENT_APPLICATION_TASK_MSG;
-
- app_message = mrcp_client_app_control_message_create(session->pool);
- app_message->application = client_session->application;
- app_message->session = session;
- app_message->channel = channel;
- app_message->control_message = message;
- *slot = app_message;
- return apt_task_msg_signal(task,task_msg);
- }
- return FALSE;
-}
-
-static apt_bool_t mrcp_client_signaling_task_msg_signal(sig_agent_task_msg_type_e type, mrcp_session_t *session, mrcp_session_descriptor_t *descriptor, mrcp_message_t *message)
-{
- sig_agent_task_msg_data_t *data;
- apt_task_msg_t *task_msg = apt_task_msg_acquire(session->signaling_agent->msg_pool);
- if(task_msg) {
- task_msg->type = MRCP_CLIENT_SIGNALING_TASK_MSG;
- task_msg->sub_type = type;
- data = (sig_agent_task_msg_data_t*) task_msg->data;
- data->session = (mrcp_client_session_t*)session;
- data->descriptor = descriptor;
- data->message = message;
- return apt_task_msg_parent_signal(session->signaling_agent->task,task_msg);
- }
- return FALSE;
-}
-
-static apt_bool_t mrcp_client_connection_task_msg_signal(
- connection_agent_task_msg_type_e type,
- mrcp_connection_agent_t *agent,
- mrcp_control_channel_t *channel,
- mrcp_control_descriptor_t *descriptor,
- mrcp_message_t *message,
- apt_bool_t status)
-{
- apt_task_t *task;
- apt_task_msg_t *task_msg;
- connection_agent_task_msg_data_t *data;
- mrcp_client_t *client = mrcp_client_connection_agent_object_get(agent);
- if(!client || !client->cnt_msg_pool) {
- return FALSE;
- }
- task = apt_consumer_task_base_get(client->task);
- task_msg = apt_task_msg_acquire(client->cnt_msg_pool);
- if(task_msg) {
- task_msg->type = MRCP_CLIENT_CONNECTION_TASK_MSG;
- task_msg->sub_type = type;
- data = (connection_agent_task_msg_data_t*) task_msg->data;
- data->channel = channel ? channel->obj : NULL;
- data->descriptor = descriptor;
- data->message = message;
- data->status = status;
- return apt_task_msg_signal(task,task_msg);
- }
- return FALSE;
-}
-
-
-static apt_bool_t mrcp_client_answer_signal(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor)
-{
- return mrcp_client_signaling_task_msg_signal(SIG_AGENT_TASK_MSG_ANSWER,session,descriptor,NULL);
-}
-
-static apt_bool_t mrcp_client_terminate_response_signal(mrcp_session_t *session)
-{
- return mrcp_client_signaling_task_msg_signal(SIG_AGENT_TASK_MSG_TERMINATE_RESPONSE,session,NULL,NULL);
-}
-
-static apt_bool_t mrcp_client_control_response_signal(mrcp_session_t *session, mrcp_message_t *message)
-{
- return mrcp_client_signaling_task_msg_signal(SIG_AGENT_TASK_MSG_CONTROL_RESPONSE,session,NULL,message);
-}
-
-static apt_bool_t mrcp_client_discover_response_signal(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor)
-{
- return mrcp_client_signaling_task_msg_signal(SIG_AGENT_TASK_MSG_DISCOVER_RESPONSE,session,descriptor,NULL);
-}
-
-static apt_bool_t mrcp_client_terminate_event_signal(mrcp_session_t *session)
-{
- return mrcp_client_signaling_task_msg_signal(SIG_AGENT_TASK_MSG_TERMINATE_EVENT,session,NULL,NULL);
-}
-
-
-static apt_bool_t mrcp_client_channel_add_signal(mrcp_control_channel_t *channel, mrcp_control_descriptor_t *descriptor, apt_bool_t status)
-{
- return mrcp_client_connection_task_msg_signal(
- CONNECTION_AGENT_TASK_MSG_ADD_CHANNEL,
- channel->agent,
- channel,
- descriptor,
- NULL,
- status);
-}
-
-static apt_bool_t mrcp_client_channel_modify_signal(mrcp_control_channel_t *channel, mrcp_control_descriptor_t *descriptor, apt_bool_t status)
-{
- return mrcp_client_connection_task_msg_signal(
- CONNECTION_AGENT_TASK_MSG_MODIFY_CHANNEL,
- channel->agent,
- channel,
- descriptor,
- NULL,
- status);
-}
-
-static apt_bool_t mrcp_client_channel_remove_signal(mrcp_control_channel_t *channel, apt_bool_t status)
-{
- return mrcp_client_connection_task_msg_signal(
- CONNECTION_AGENT_TASK_MSG_REMOVE_CHANNEL,
- channel->agent,
- channel,
- NULL,
- NULL,
- status);
-}
-
-static apt_bool_t mrcp_client_message_signal(mrcp_control_channel_t *channel, mrcp_message_t *mrcp_message)
-{
- return mrcp_client_connection_task_msg_signal(
- CONNECTION_AGENT_TASK_MSG_RECEIVE_MESSAGE,
- channel->agent,
- channel,
- NULL,
- mrcp_message,
- TRUE);
-}
-
-static apt_bool_t mrcp_client_disconnect_signal(mrcp_control_channel_t *channel)
-{
- return mrcp_client_connection_task_msg_signal(
- CONNECTION_AGENT_TASK_MSG_DISCONNECT,
- channel->agent,
- channel,
- NULL,
- NULL,
- TRUE);
-}
diff --git a/libs/unimrcp/libs/mrcp-client/src/mrcp_client_session.c b/libs/unimrcp/libs/mrcp-client/src/mrcp_client_session.c
deleted file mode 100644
index 851e7ffcba..0000000000
--- a/libs/unimrcp/libs/mrcp-client/src/mrcp_client_session.c
+++ /dev/null
@@ -1,1314 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_client_session.c 2251 2014-11-21 02:36:44Z achaloyan@gmail.com $
- */
-
-#include "mrcp_client_session.h"
-#include "mrcp_resource_factory.h"
-#include "mrcp_resource.h"
-#include "mrcp_sig_agent.h"
-#include "mrcp_client_connection.h"
-#include "mrcp_session.h"
-#include "mrcp_session_descriptor.h"
-#include "mrcp_control_descriptor.h"
-#include "mrcp_message.h"
-#include "mrcp_ca_factory.h"
-#include "mpf_engine_factory.h"
-#include "mpf_termination_factory.h"
-#include "mpf_stream.h"
-#include "apt_consumer_task.h"
-#include "apt_obj_list.h"
-#include "apt_log.h"
-
-/** Macro to log session name and identifier */
-#define MRCP_SESSION_NAMESID(session) \
- session->base.name, MRCP_SESSION_SID(&session->base)
-
-#define IS_SESSION_TERMINATE(app_message) \
- (app_message->message_type == MRCP_APP_MESSAGE_TYPE_SIGNALING && \
- app_message->sig_message.command_id == MRCP_SIG_COMMAND_SESSION_TERMINATE)
-
-void mrcp_client_session_add(mrcp_client_t *client, mrcp_client_session_t *session);
-void mrcp_client_session_remove(mrcp_client_t *client, mrcp_client_session_t *session);
-
-static apt_bool_t mrcp_client_session_offer_send(mrcp_client_session_t *session);
-
-static apt_bool_t mrcp_app_session_terminate_raise(mrcp_client_session_t *session, mrcp_sig_status_code_e status);
-static apt_bool_t mrcp_app_sig_response_raise(mrcp_client_session_t *session, apt_bool_t process_pending_requests);
-static apt_bool_t mrcp_app_sig_event_raise(mrcp_client_session_t *session, mrcp_channel_t *channel);
-static apt_bool_t mrcp_app_control_message_raise(mrcp_client_session_t *session, mrcp_channel_t *channel, mrcp_message_t *mrcp_message);
-static apt_bool_t mrcp_app_failure_message_raise(mrcp_client_session_t *session);
-static apt_bool_t mrcp_app_request_dispatch(mrcp_client_session_t *session, const mrcp_app_message_t *app_message);
-
-static apt_bool_t mrcp_client_resource_answer_process(mrcp_client_session_t *session, mrcp_session_descriptor_t *descriptor);
-static apt_bool_t mrcp_client_control_media_answer_process(mrcp_client_session_t *session, mrcp_session_descriptor_t *descriptor);
-static apt_bool_t mrcp_client_av_media_answer_process(mrcp_client_session_t *session, mrcp_session_descriptor_t *descriptor);
-
-static mrcp_channel_t* mrcp_client_channel_find_by_name(mrcp_client_session_t *session, const apt_str_t *resource_name);
-
-static APR_INLINE mrcp_version_e mrcp_session_version_get(mrcp_client_session_t *session)
-{
- return session->profile->mrcp_version;
-}
-
-static APR_INLINE void mrcp_client_session_state_set(mrcp_client_session_t *session, mrcp_client_session_state_e state)
-{
- if(session->subrequest_count != 0) {
- /* error case */
- apt_obj_log(APT_LOG_MARK,APT_PRIO_ERROR,session->base.log_obj,"Unexpected State Change [%d] pending subrequests [%d] "APT_NAMESID_FMT,
- state,
- session->subrequest_count,
- MRCP_SESSION_NAMESID(session));
- session->subrequest_count = 0;
- }
- session->state = state;
-}
-
-static APR_INLINE void mrcp_client_session_subrequest_add(mrcp_client_session_t *session)
-{
- session->subrequest_count++;
-}
-
-static APR_INLINE apt_bool_t mrcp_client_session_subrequest_remove(mrcp_client_session_t *session)
-{
- if(!session->subrequest_count) {
- /* error case */
- return FALSE;
- }
-
- session->subrequest_count--;
- return (session->subrequest_count ? FALSE : TRUE);
-}
-
-static mrcp_app_message_t* mrcp_client_app_response_create(const mrcp_app_message_t *app_request, mrcp_sig_status_code_e status, apr_pool_t *pool)
-{
- mrcp_app_message_t *app_response = apr_palloc(pool,sizeof(mrcp_app_message_t));
- *app_response = *app_request;
- app_response->sig_message.message_type = MRCP_SIG_MESSAGE_TYPE_RESPONSE;
- app_response->sig_message.status = status;
- return app_response;
-}
-
-
-mrcp_channel_t* mrcp_client_channel_create(
- mrcp_client_session_t *session,
- mrcp_resource_t *resource,
- mpf_termination_t *termination,
- mpf_rtp_termination_descriptor_t *rtp_descriptor,
- void *obj)
-{
- mrcp_channel_t *channel = apr_palloc(session->base.pool,sizeof(mrcp_channel_t));
- channel->pool = session->base.pool;
- channel->obj = obj;
- channel->session = &session->base;
- channel->control_channel = NULL;
- channel->termination = termination;
- channel->rtp_termination_slot = NULL;
- channel->resource = resource;
- channel->waiting_for_channel = FALSE;
- channel->waiting_for_termination = FALSE;
-
- if(rtp_descriptor) {
- rtp_termination_slot_t *termination_slot = apr_palloc(channel->pool,sizeof(rtp_termination_slot_t));
- termination_slot->descriptor = rtp_descriptor;
- termination_slot->termination = NULL;
- termination_slot->waiting = FALSE;
- termination_slot->channel = channel;
- termination_slot->id = 0;
- channel->rtp_termination_slot = termination_slot;
- }
- apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,session->base.log_obj,"Create Channel "APT_NAMESID_FMT,
- MRCP_SESSION_NAMESID(session));
- return channel;
-}
-
-apt_bool_t mrcp_client_session_answer_process(mrcp_client_session_t *session, mrcp_session_descriptor_t *descriptor)
-{
- if(!session->offer) {
- return FALSE;
- }
- if(!descriptor) {
- apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,session->base.log_obj,"Receive Answer "APT_NAMESID_FMT" [null descriptor]",
- MRCP_SESSION_NAMESID(session));
- session->status = MRCP_SIG_STATUS_CODE_FAILURE;
- /* raise app response */
- return mrcp_app_sig_response_raise(session,TRUE);
- }
-
- apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,session->base.log_obj,"Receive Answer "APT_NAMESID_FMT" [c:%d a:%d v:%d] Status %d",
- MRCP_SESSION_NAMESID(session),
- descriptor->control_media_arr->nelts,
- descriptor->audio_media_arr->nelts,
- descriptor->video_media_arr->nelts,
- descriptor->response_code);
-
- if(descriptor->response_code >=200 && descriptor->response_code < 300) {
- mrcp_client_session_state_set(session,SESSION_STATE_PROCESSING_ANSWER);
- if(session->context) {
- /* first, reset/destroy existing associations and topology */
- if(mpf_engine_topology_message_add(
- session->base.media_engine,
- MPF_RESET_ASSOCIATIONS,session->context,
- &session->mpf_task_msg) == TRUE){
- mrcp_client_session_subrequest_add(session);
- }
- }
-
- if(mrcp_session_version_get(session) == MRCP_VERSION_1) {
- if(mrcp_client_resource_answer_process(session,descriptor) != TRUE) {
- session->status = MRCP_SIG_STATUS_CODE_FAILURE;
- }
- }
- else {
- mrcp_client_control_media_answer_process(session,descriptor);
- mrcp_client_av_media_answer_process(session,descriptor);
- }
-
- if(session->context) {
- /* apply topology based on assigned associations */
- if(mpf_engine_topology_message_add(
- session->base.media_engine,
- MPF_APPLY_TOPOLOGY,session->context,
- &session->mpf_task_msg) == TRUE) {
- mrcp_client_session_subrequest_add(session);
- }
-
- mpf_engine_message_send(session->base.media_engine,&session->mpf_task_msg);
- }
- }
- else {
- session->status = MRCP_SIG_STATUS_CODE_TERMINATE;
- }
-
- /* store received answer */
- session->answer = descriptor;
-
- if(!session->subrequest_count) {
- /* raise app response */
- mrcp_app_sig_response_raise(session,TRUE);
- }
-
- return TRUE;
-}
-
-apt_bool_t mrcp_client_session_terminate_response_process(mrcp_client_session_t *session)
-{
- apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,session->base.log_obj,"Session Terminated "APT_NAMESID_FMT, MRCP_SESSION_NAMESID(session));
-
- if(mrcp_client_session_subrequest_remove(session) == TRUE) {
- mrcp_app_session_terminate_raise(session,MRCP_SIG_STATUS_CODE_SUCCESS);
- }
- return TRUE;
-}
-
-apt_bool_t mrcp_client_session_terminate_event_process(mrcp_client_session_t *session)
-{
- if(session->state == SESSION_STATE_TERMINATING) {
- /* session termination request has been sent, still waiting for the response,
- all the events must be ignored at this stage */
- apt_obj_log(APT_LOG_MARK,APT_PRIO_WARNING,session->base.log_obj,"Unexpected Event! "APT_NAMESID_FMT,
- MRCP_SESSION_NAMESID(session));
- return FALSE;
- }
-
- apt_obj_log(APT_LOG_MARK,APT_PRIO_DEBUG,session->base.log_obj,"Mark Session as Disconnected "APT_NAMESID_FMT,
- MRCP_SESSION_NAMESID(session));
- session->disconnected = TRUE;
- if(!session->active_request) {
- /* raise app event */
- mrcp_app_sig_event_raise(session,NULL);
- }
-
- return TRUE;
-}
-
-apt_bool_t mrcp_client_session_control_response_process(mrcp_client_session_t *session, mrcp_message_t *message)
-{
- mrcp_channel_t *channel = mrcp_client_channel_find_by_name(session,&message->channel_id.resource_name);
- if(!channel) {
- return FALSE;
- }
- return mrcp_app_control_message_raise(session,channel,message);
-}
-
-apt_bool_t mrcp_client_session_discover_response_process(mrcp_client_session_t *session, mrcp_session_descriptor_t *descriptor)
-{
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Resources Discovered %s", session->base.name);
- if(!session->active_request) {
- return FALSE;
- }
-
- if(!descriptor) {
- /* raise app response */
- session->status = MRCP_SIG_STATUS_CODE_FAILURE;
- return mrcp_app_sig_response_raise(session,TRUE);
- }
-
- if(mrcp_session_version_get(session) == MRCP_VERSION_1) {
- if(descriptor->resource_state == TRUE) {
- mrcp_control_descriptor_t *control_media;
- if(!session->answer) {
- session->answer = descriptor;
- }
- control_media = mrcp_control_descriptor_create(session->base.pool);
- control_media->id = mrcp_session_control_media_add(session->answer,control_media);
- control_media->resource_name = descriptor->resource_name;
- }
- }
- else {
- session->answer = descriptor;
- }
-
- if(mrcp_client_session_subrequest_remove(session) == TRUE) {
- mrcp_app_message_t *response;
- response = mrcp_client_app_response_create(session->active_request,MRCP_SIG_STATUS_CODE_SUCCESS,session->base.pool);
- response->descriptor = session->answer;
- session->answer = NULL;
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Raise App Resource Discovery Response %s", session->base.name);
- session->application->handler(response);
-
- session->active_request = apt_list_pop_front(session->request_queue);
- if(session->active_request) {
- mrcp_app_request_dispatch(session,session->active_request);
- }
- }
- return TRUE;
-}
-
-apt_bool_t mrcp_client_on_channel_add(mrcp_channel_t *channel, mrcp_control_descriptor_t *descriptor, apt_bool_t status)
-{
- mrcp_client_session_t *session = (mrcp_client_session_t*)channel->session;
- apt_obj_log(APT_LOG_MARK,APT_PRIO_DEBUG,session->base.log_obj,"Control Channel Added "APT_NAMESIDRES_FMT,
- MRCP_SESSION_NAMESID(session),
- channel->resource->name.buf);
- if(!channel->waiting_for_channel) {
- return FALSE;
- }
- channel->waiting_for_channel = FALSE;
- if(mrcp_client_session_subrequest_remove(session) == TRUE) {
- /* send offer to server */
- mrcp_client_session_offer_send(session);
- }
- return TRUE;
-}
-
-apt_bool_t mrcp_client_on_channel_modify(mrcp_channel_t *channel, mrcp_control_descriptor_t *descriptor, apt_bool_t status)
-{
- mrcp_client_session_t *session = (mrcp_client_session_t*)channel->session;
- apt_obj_log(APT_LOG_MARK,APT_PRIO_DEBUG,session->base.log_obj,"Control Channel Modified "APT_NAMESIDRES_FMT,
- MRCP_SESSION_NAMESID(session),
- channel->resource->name.buf);
- if(!channel->waiting_for_channel) {
- return FALSE;
- }
- channel->waiting_for_channel = FALSE;
- if(mrcp_client_session_subrequest_remove(session) == TRUE) {
- /* raise app response */
- if(status != TRUE) {
- session->status = MRCP_SIG_STATUS_CODE_FAILURE;
- }
- mrcp_app_sig_response_raise(session,TRUE);
- }
- return TRUE;
-}
-
-apt_bool_t mrcp_client_on_channel_remove(mrcp_channel_t *channel, apt_bool_t status)
-{
- mrcp_client_session_t *session = (mrcp_client_session_t*)channel->session;
- apt_obj_log(APT_LOG_MARK,APT_PRIO_DEBUG,session->base.log_obj,"Control Channel Removed "APT_NAMESIDRES_FMT,
- MRCP_SESSION_NAMESID(session),
- channel->resource->name.buf);
- if(!channel->waiting_for_channel) {
- return FALSE;
- }
- channel->waiting_for_channel = FALSE;
- if(mrcp_client_session_subrequest_remove(session) == TRUE) {
- mrcp_app_session_terminate_raise(
- session,
- status == TRUE ? MRCP_SIG_STATUS_CODE_SUCCESS : MRCP_SIG_STATUS_CODE_FAILURE);
- }
- return TRUE;
-}
-
-apt_bool_t mrcp_client_on_message_receive(mrcp_channel_t *channel, mrcp_message_t *message)
-{
- mrcp_client_session_t *session = (mrcp_client_session_t*)channel->session;
- return mrcp_app_control_message_raise(session,channel,message);
-}
-
-apt_bool_t mrcp_client_on_disconnect(mrcp_channel_t *channel)
-{
- mrcp_client_session_t *session = (mrcp_client_session_t*)channel->session;
- return mrcp_client_session_terminate_event_process(session);
-}
-
-mrcp_app_message_t* mrcp_client_app_signaling_request_create(mrcp_sig_command_e command_id, apr_pool_t *pool)
-{
- mrcp_app_message_t *app_message = apr_palloc(pool,sizeof(mrcp_app_message_t));
- app_message->message_type = MRCP_APP_MESSAGE_TYPE_SIGNALING;
- app_message->sig_message.message_type = MRCP_SIG_MESSAGE_TYPE_REQUEST;
- app_message->sig_message.command_id = command_id;
- return app_message;
-}
-
-mrcp_app_message_t* mrcp_client_app_signaling_event_create(mrcp_sig_event_e event_id, apr_pool_t *pool)
-{
- mrcp_app_message_t *app_message = apr_palloc(pool,sizeof(mrcp_app_message_t));
- app_message->message_type = MRCP_APP_MESSAGE_TYPE_SIGNALING;
- app_message->sig_message.message_type = MRCP_SIG_MESSAGE_TYPE_EVENT;
- app_message->sig_message.event_id = event_id;
- return app_message;
-}
-
-mrcp_app_message_t* mrcp_client_app_control_message_create(apr_pool_t *pool)
-{
- mrcp_app_message_t *app_message = apr_palloc(pool,sizeof(mrcp_app_message_t));
- app_message->message_type = MRCP_APP_MESSAGE_TYPE_CONTROL;
- return app_message;
-}
-
-apt_bool_t mrcp_client_app_message_process(mrcp_app_message_t *app_message)
-{
- mrcp_client_session_t *session = (mrcp_client_session_t*)app_message->session;
- if(app_message->message_type == MRCP_APP_MESSAGE_TYPE_SIGNALING) {
- apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,session->base.log_obj,"Receive App Request "APT_NAMESID_FMT" [%d]",
- MRCP_SESSION_NAMESID(session),
- app_message->sig_message.command_id);
- }
- else {
- apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,session->base.log_obj,"Receive App MRCP Request "APT_NAMESID_FMT,
- MRCP_SESSION_NAMESID(session));
- }
-
- if(session->active_request) {
- apt_obj_log(APT_LOG_MARK,APT_PRIO_DEBUG,session->base.log_obj,"Push Request to Queue "APT_NAMESID_FMT,
- MRCP_SESSION_NAMESID(session));
- apt_list_push_back(session->request_queue,app_message,session->base.pool);
- return TRUE;
- }
-
- session->active_request = app_message;
- mrcp_app_request_dispatch(session,app_message);
- return TRUE;
-}
-
-static apt_bool_t mrcp_client_session_offer_send(mrcp_client_session_t *session)
-{
- mrcp_session_descriptor_t *descriptor = session->offer;
- apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,session->base.log_obj,"Send Offer "APT_NAMESID_FMT" [c:%d a:%d v:%d] to %s:%hu",
- MRCP_SESSION_NAMESID(session),
- descriptor->control_media_arr->nelts,
- descriptor->audio_media_arr->nelts,
- descriptor->video_media_arr->nelts,
- session->profile->signaling_settings->server_ip,
- session->profile->signaling_settings->server_port);
- return mrcp_session_offer(&session->base,descriptor);
-}
-
-static apt_bool_t mrcp_app_session_terminate_raise(mrcp_client_session_t *session, mrcp_sig_status_code_e status)
-{
- int i;
- mrcp_channel_t *channel;
- for(i=0; ichannels->nelts; i++) {
- channel = APR_ARRAY_IDX(session->channels,i,mrcp_channel_t*);
- if(!channel) continue;
-
- if(channel->control_channel) {
- mrcp_client_control_channel_destroy(channel->control_channel);
- channel->control_channel = NULL;
- }
- }
-
- mrcp_client_session_remove(session->application->client,session);
- /* raise app response */
- if(status != MRCP_SIG_STATUS_CODE_SUCCESS) {
- session->status = status;
- }
- return mrcp_app_sig_response_raise(session,FALSE);
-}
-
-static apt_bool_t mrcp_app_sig_response_raise(mrcp_client_session_t *session, apt_bool_t process_pending_requests)
-{
- mrcp_app_message_t *response;
- const mrcp_app_message_t *request = session->active_request;
- if(!request) {
- return FALSE;
- }
- session->active_request = NULL;
- if(session->disconnected == TRUE) {
- session->status = MRCP_SIG_STATUS_CODE_TERMINATE;
- }
- response = mrcp_client_app_response_create(request,session->status,session->base.pool);
- apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,session->base.log_obj,"Raise App Response "APT_NAMESID_FMT" [%d] %s [%d]",
- MRCP_SESSION_NAMESID(session),
- response->sig_message.command_id,
- session->status == MRCP_SIG_STATUS_CODE_SUCCESS ? "SUCCESS" : "FAILURE",
- session->status);
- session->application->handler(response);
-
- if(process_pending_requests) {
- session->active_request = apt_list_pop_front(session->request_queue);
- if(session->active_request) {
- mrcp_app_request_dispatch(session,session->active_request);
- }
- }
- return TRUE;
-}
-
-static apt_bool_t mrcp_app_sig_event_raise(mrcp_client_session_t *session, mrcp_channel_t *channel)
-{
- mrcp_app_message_t *app_event;
- if(!session) {
- return FALSE;
- }
- app_event = mrcp_client_app_signaling_event_create(MRCP_SIG_EVENT_TERMINATE,session->base.pool);
- app_event->application = session->application;
- app_event->session = &session->base;
- app_event->channel = channel;
- apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,session->base.log_obj,"Raise App Event "APT_NAMESID_FMT" [%d]",
- MRCP_SESSION_NAMESID(session),
- app_event->sig_message.event_id);
- return session->application->handler(app_event);
-}
-
-static apt_bool_t mrcp_app_control_message_raise(mrcp_client_session_t *session, mrcp_channel_t *channel, mrcp_message_t *mrcp_message)
-{
- if(mrcp_message->start_line.message_type == MRCP_MESSAGE_TYPE_RESPONSE) {
- mrcp_app_message_t *response;
- mrcp_message_t *mrcp_request;
- if(!session->active_request || !session->active_request->control_message) {
- return FALSE;
- }
- response = mrcp_client_app_response_create(session->active_request,0,session->base.pool);
- mrcp_request = session->active_request->control_message;
- mrcp_message->start_line.method_id = mrcp_request->start_line.method_id;
- mrcp_message->start_line.method_name = mrcp_request->start_line.method_name;
- response->control_message = mrcp_message;
- apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,session->base.log_obj,"Raise App MRCP Response "APT_NAMESID_FMT,
- MRCP_SESSION_NAMESID(session));
- session->application->handler(response);
-
- session->active_request = apt_list_pop_front(session->request_queue);
- if(session->active_request) {
- mrcp_app_request_dispatch(session,session->active_request);
- }
- }
- else if(mrcp_message->start_line.message_type == MRCP_MESSAGE_TYPE_EVENT) {
- mrcp_app_message_t *app_message;
- app_message = mrcp_client_app_control_message_create(session->base.pool);
- app_message->control_message = mrcp_message;
- app_message->application = session->application;
- app_message->session = &session->base;
- app_message->channel = channel;
- apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,session->base.log_obj,"Raise App MRCP Event "APT_NAMESID_FMT,
- MRCP_SESSION_NAMESID(session));
- session->application->handler(app_message);
- }
- return TRUE;
-}
-
-static apt_bool_t mrcp_app_failure_message_raise(mrcp_client_session_t *session)
-{
- mrcp_app_message_t *response;
- const mrcp_app_message_t *request = session->active_request;
- if(!request) {
- return FALSE;
- }
- session->active_request = NULL;
- response = mrcp_client_app_response_create(request,session->status,session->base.pool);
- if(response->message_type == MRCP_APP_MESSAGE_TYPE_SIGNALING) {
- apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,session->base.log_obj,"Raise App Response "APT_NAMESID_FMT" [%d] %s [%d]",
- MRCP_SESSION_NAMESID(session),
- response->sig_message.command_id,
- session->status == MRCP_SIG_STATUS_CODE_SUCCESS ? "SUCCESS" : "FAILURE",
- session->status);
- }
- else if(response->control_message){
- mrcp_message_t *mrcp_response = mrcp_response_create(response->control_message,response->control_message->pool);
- mrcp_response->start_line.status_code = MRCP_STATUS_CODE_METHOD_FAILED;
- response->control_message = mrcp_response;
- apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,session->base.log_obj,"Raise App MRCP Response "APT_NAMESID_FMT,
- MRCP_SESSION_NAMESID(session));
- }
- session->application->handler(response);
- return TRUE;
-}
-
-static apt_bool_t mrcp_client_channel_find(mrcp_client_session_t *session, mrcp_channel_t *channel, int *index)
-{
- int i;
- mrcp_channel_t *existing_channel;
- for(i=0; ichannels->nelts; i++) {
- existing_channel = APR_ARRAY_IDX(session->channels,i,mrcp_channel_t*);
- if(existing_channel == channel) {
- if(index) {
- *index = i;
- }
- return TRUE;
- }
- }
- return FALSE;
-}
-
-static rtp_termination_slot_t* mrcp_client_rtp_termination_find(mrcp_client_session_t *session, mpf_termination_t *termination)
-{
- int i;
- rtp_termination_slot_t *slot;
- for(i=0; iterminations->nelts; i++) {
- slot = &APR_ARRAY_IDX(session->terminations,i,rtp_termination_slot_t);
- if(slot->termination == termination) {
- return slot;
- }
- }
- return NULL;
-}
-
-static mrcp_channel_t* mrcp_client_channel_termination_find(mrcp_client_session_t *session, mpf_termination_t *termination)
-{
- int i;
- mrcp_channel_t *channel;
- for(i=0; ichannels->nelts; i++) {
- channel = APR_ARRAY_IDX(session->channels,i,mrcp_channel_t*);
- if(!channel) continue;
-
- if(channel->termination == termination) {
- return channel;
- }
- }
- return NULL;
-}
-
-static mrcp_channel_t* mrcp_client_channel_find_by_name(mrcp_client_session_t *session, const apt_str_t *resource_name)
-{
- int i;
- mrcp_channel_t *channel;
- for(i=0; ichannels->nelts; i++) {
- channel = APR_ARRAY_IDX(session->channels,i,mrcp_channel_t*);
- if(!channel || !channel->resource) continue;
-
- if(apt_string_compare(&channel->resource->name,resource_name) == TRUE) {
- return channel;
- }
- }
- return NULL;
-}
-
-static apt_bool_t mrcp_client_message_send(mrcp_client_session_t *session, mrcp_channel_t *channel, mrcp_message_t *message)
-{
- if(!session->base.id.length) {
- mrcp_message_t *response = mrcp_response_create(message,message->pool);
- response->start_line.status_code = MRCP_STATUS_CODE_METHOD_FAILED;
- apt_obj_log(APT_LOG_MARK,APT_PRIO_DEBUG,session->base.log_obj,"Raise App Failure MRCP Response "APT_NAMESID_FMT,
- MRCP_SESSION_NAMESID(session));
- mrcp_app_control_message_raise(session,channel,response);
- return TRUE;
- }
-
- message->channel_id.session_id = session->base.id;
- message->start_line.request_id = ++session->base.last_request_id;
- apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,session->base.log_obj,"Send MRCP Request "APT_NAMESIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]",
- MRCP_SESSION_NAMESID(session),
- channel->resource->name.buf,
- message->start_line.request_id);
-
- if(channel->control_channel) {
- /* MRCPv2 */
- mrcp_client_control_message_send(channel->control_channel,message);
- }
- else {
- /* MRCPv1 */
- mrcp_session_control_request(channel->session,message);
- }
-
- return TRUE;
-}
-
-static apt_bool_t mrcp_client_channel_modify(mrcp_client_session_t *session, mrcp_channel_t *channel, apt_bool_t enable)
-{
- int index;
- if(!session->offer) {
- return FALSE;
- }
- if(!channel->resource) {
- return FALSE;
- }
-
- apt_obj_log(APT_LOG_MARK,APT_PRIO_NOTICE,session->base.log_obj,"Modify Control Channel "APT_NAMESIDRES_FMT" [%d]",
- MRCP_SESSION_NAMESID(session),
- channel->resource->name.buf,
- enable);
- if(mrcp_client_channel_find(session,channel,&index) == TRUE) {
- mrcp_control_descriptor_t *control_media = mrcp_session_control_media_get(session->offer,(apr_size_t)index);
- if(control_media) {
- control_media->port = (enable == TRUE) ? TCP_DISCARD_PORT : 0;
- }
- if(channel->termination && channel->rtp_termination_slot) {
- mpf_audio_stream_t *audio_stream = mpf_termination_audio_stream_get(
- channel->termination);
- mpf_rtp_media_descriptor_t *audio_media = mrcp_session_audio_media_get(
- session->offer,
- channel->rtp_termination_slot->id);
- if(audio_media && audio_stream) {
- mpf_stream_direction_e direction = mpf_stream_reverse_direction_get(audio_stream->direction);
- if(enable == TRUE) {
- audio_media->direction |= direction;
- }
- else {
- audio_media->direction &= ~direction;
- }
- audio_media->state = (audio_media->direction != STREAM_DIRECTION_NONE) ? MPF_MEDIA_ENABLED : MPF_MEDIA_DISABLED;
- }
- }
- }
-
- session->offer->resource_name = channel->resource->name;
- session->offer->resource_state = enable;
- return mrcp_client_session_offer_send(session);
-}
-
-static apt_bool_t mrcp_client_channel_add(mrcp_client_session_t *session, mrcp_channel_t *channel)
-{
- mpf_rtp_termination_descriptor_t *rtp_descriptor = NULL;
- rtp_termination_slot_t *slot;
- apr_pool_t *pool = session->base.pool;
- mrcp_client_profile_t *profile = session->profile;
- if(mrcp_client_channel_find(session,channel,NULL) == TRUE) {
- /* update */
- return mrcp_client_channel_modify(session,channel,TRUE);
- }
-
- if(!session->offer) {
- session->offer = mrcp_session_descriptor_create(pool);
- }
-
- mrcp_client_session_state_set(session,SESSION_STATE_GENERATING_OFFER);
-
- if(mrcp_session_version_get(session) == MRCP_VERSION_1) {
- session->offer->resource_name = channel->resource->name;
- session->offer->resource_state = TRUE;
- }
- else {
- mrcp_control_descriptor_t *control_media;
- if(!channel->control_channel) {
- channel->control_channel = mrcp_client_control_channel_create(session->base.connection_agent,channel,pool);
- mrcp_client_control_channel_log_obj_set(channel->control_channel,session->base.log_obj);
- }
- control_media = mrcp_control_offer_create(pool);
- control_media->id = mrcp_session_control_media_add(session->offer,control_media);
- mrcp_cmid_add(control_media->cmid_arr,session->offer->control_media_arr->nelts);
- control_media->resource_name = channel->resource->name;
- if(mrcp_client_control_channel_add(channel->control_channel,control_media) == TRUE) {
- channel->waiting_for_channel = TRUE;
- mrcp_client_session_subrequest_add(session);
- }
- }
-
- apt_obj_log(APT_LOG_MARK,APT_PRIO_NOTICE,session->base.log_obj,"Add Control Channel "APT_NAMESIDRES_FMT,
- MRCP_SESSION_NAMESID(session),
- channel->resource->name.buf);
- /* add control channel */
- APR_ARRAY_PUSH(session->channels,mrcp_channel_t*) = channel;
-
- /* add rtp termination slot */
- slot = apr_array_push(session->terminations);
- slot->waiting = FALSE;
- slot->termination = NULL;
- slot->descriptor = NULL;
- slot->channel = channel;
- slot->id = 0;
-
- if(channel->termination) {
- /* media termination mode */
- mpf_termination_t *termination;
- mpf_audio_stream_t *audio_stream;
-
- if(!session->context) {
- /* create media context first */
- session->context = mpf_engine_context_create(
- session->base.media_engine,
- session->base.name,
- session,5,pool);
- }
- apt_obj_log(APT_LOG_MARK,APT_PRIO_DEBUG,session->base.log_obj,"Add Media Termination "APT_NAMESIDRES_FMT,
- MRCP_SESSION_NAMESID(session),
- mpf_termination_name_get(channel->termination));
- if(mpf_engine_termination_message_add(
- session->base.media_engine,
- MPF_ADD_TERMINATION,session->context,channel->termination,NULL,
- &session->mpf_task_msg) == TRUE) {
- channel->waiting_for_termination = TRUE;
- mrcp_client_session_subrequest_add(session);
- }
-
- /* initialize rtp descriptor */
- rtp_descriptor = apr_palloc(pool,sizeof(mpf_rtp_termination_descriptor_t));
- mpf_rtp_termination_descriptor_init(rtp_descriptor);
- rtp_descriptor->audio.settings = profile->rtp_settings;
- audio_stream = mpf_termination_audio_stream_get(channel->termination);
- if(audio_stream) {
- mpf_rtp_media_descriptor_t *media;
- media = apr_palloc(pool,sizeof(mpf_rtp_media_descriptor_t));
- mpf_rtp_media_descriptor_init(media);
- media->state = MPF_MEDIA_ENABLED;
- media->direction = mpf_stream_reverse_direction_get(audio_stream->direction);
- rtp_descriptor->audio.local = media;
- if(audio_stream->capabilities) {
- rtp_descriptor->audio.capabilities = mpf_stream_capabilities_clone(audio_stream->capabilities,pool);
- rtp_descriptor->audio.capabilities->direction = media->direction;
- }
- }
-
- /* create rtp termination */
- termination = mpf_termination_create(session->base.rtp_factory,session,pool);
- slot->termination = termination;
- apt_obj_log(APT_LOG_MARK,APT_PRIO_DEBUG,session->base.log_obj,"Add Media Termination "APT_NAMESIDRES_FMT,
- MRCP_SESSION_NAMESID(session),
- mpf_termination_name_get(termination));
-
- /* send add termination request (add to media context) */
- if(mpf_engine_termination_message_add(
- session->base.media_engine,
- MPF_ADD_TERMINATION,session->context,termination,rtp_descriptor,
- &session->mpf_task_msg) == TRUE) {
- slot->waiting = TRUE;
- mrcp_client_session_subrequest_add(session);
- }
- mpf_engine_message_send(session->base.media_engine,&session->mpf_task_msg);
- }
- else {
- /* bypass media mode */
- if(channel->rtp_termination_slot) {
- rtp_descriptor = channel->rtp_termination_slot->descriptor;
- if(rtp_descriptor) {
- if(rtp_descriptor->audio.local) {
- session->offer->ip = rtp_descriptor->audio.local->ip;
- session->offer->ext_ip = rtp_descriptor->audio.local->ext_ip;
- rtp_descriptor->audio.local->id = mrcp_session_audio_media_add(session->offer,rtp_descriptor->audio.local);
- rtp_descriptor->audio.local->mid = session->offer->audio_media_arr->nelts;
- slot->id = session->offer->audio_media_arr->nelts - 1;
- }
- }
- }
- }
-
- slot->descriptor = rtp_descriptor;
- channel->rtp_termination_slot = slot;
-
- if(!session->subrequest_count) {
- /* send offer to server */
- mrcp_client_session_offer_send(session);
- }
- return TRUE;
-}
-
-static apt_bool_t mrcp_client_session_update(mrcp_client_session_t *session)
-{
- if(!session->offer) {
- return FALSE;
- }
- apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,session->base.log_obj,"Update Session "APT_NAMESID_FMT,
- MRCP_SESSION_NAMESID(session));
- return mrcp_client_session_offer_send(session);
-}
-
-static apt_bool_t mrcp_client_session_terminate(mrcp_client_session_t *session)
-{
- mrcp_channel_t *channel;
- rtp_termination_slot_t *slot;
- int i;
-
- apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,session->base.log_obj,"Terminate Session "APT_NAMESID_FMT,
- MRCP_SESSION_NAMESID(session));
-
- mrcp_client_session_state_set(session,SESSION_STATE_TERMINATING);
- if(session->context) {
- /* first destroy existing topology */
- if(mpf_engine_topology_message_add(
- session->base.media_engine,
- MPF_DESTROY_TOPOLOGY,session->context,
- &session->mpf_task_msg) == TRUE){
- mrcp_client_session_subrequest_add(session);
- }
- }
- /* remove existing control channels */
- for(i=0; ichannels->nelts; i++) {
- /* get existing channel */
- channel = APR_ARRAY_IDX(session->channels,i,mrcp_channel_t*);
- if(!channel) continue;
-
- if(channel->control_channel) {
- /* remove channel */
- apt_obj_log(APT_LOG_MARK,APT_PRIO_DEBUG,session->base.log_obj,"Remove Control Channel "APT_NAMESID_FMT,
- MRCP_SESSION_NAMESID(session));
- if(mrcp_client_control_channel_remove(channel->control_channel) == TRUE) {
- channel->waiting_for_channel = TRUE;
- mrcp_client_session_subrequest_add(session);
- }
- }
-
- /* send subtract termination request */
- if(channel->termination) {
- apt_obj_log(APT_LOG_MARK,APT_PRIO_DEBUG,session->base.log_obj,"Subtract Media Termination "APT_NAMESIDRES_FMT,
- MRCP_SESSION_NAMESID(session),
- mpf_termination_name_get(channel->termination));
- if(mpf_engine_termination_message_add(
- session->base.media_engine,
- MPF_SUBTRACT_TERMINATION,session->context,channel->termination,NULL,
- &session->mpf_task_msg) == TRUE) {
- channel->waiting_for_termination = TRUE;
- mrcp_client_session_subrequest_add(session);
- }
- }
- }
-
- if(session->context) {
- /* subtract existing terminations */
- for(i=0; iterminations->nelts; i++) {
- /* get existing termination */
- slot = &APR_ARRAY_IDX(session->terminations,i,rtp_termination_slot_t);
- if(!slot->termination) continue;
-
- /* send subtract termination request */
- apt_obj_log(APT_LOG_MARK,APT_PRIO_DEBUG,session->base.log_obj,"Subtract Media Termination "APT_NAMESIDRES_FMT,
- MRCP_SESSION_NAMESID(session),
- mpf_termination_name_get(slot->termination));
- if(mpf_engine_termination_message_add(
- session->base.media_engine,
- MPF_SUBTRACT_TERMINATION,session->context,slot->termination,NULL,
- &session->mpf_task_msg) == TRUE) {
- slot->waiting = TRUE;
- mrcp_client_session_subrequest_add(session);
- }
- }
-
- mpf_engine_message_send(session->base.media_engine,&session->mpf_task_msg);
- }
-
- mrcp_client_session_subrequest_add(session);
- mrcp_session_terminate_request(&session->base);
- return TRUE;
-}
-
-static apt_bool_t mrcp_client_resource_discover(mrcp_client_session_t *session)
-{
- mrcp_session_descriptor_t *descriptor = NULL;
-
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Discover Resources "APT_PTR_FMT, MRCP_SESSION_PTR(&session->base));
- session->answer = NULL;
- mrcp_client_session_state_set(session,SESSION_STATE_DISCOVERING);
-
- if(mrcp_session_version_get(session) == MRCP_VERSION_1) {
- mrcp_resource_t *resource;
- mrcp_resource_id i;
-
- for(i=0; iprofile->resource_factory,i);
- if(!resource) continue;
-
- descriptor = mrcp_session_descriptor_create(session->base.pool);
- apt_string_copy(&descriptor->resource_name,&resource->name,session->base.pool);
- if(mrcp_session_discover_request(&session->base,descriptor) == TRUE) {
- mrcp_client_session_subrequest_add(session);
- }
- }
- }
- else {
- if(mrcp_session_discover_request(&session->base,descriptor) == TRUE) {
- mrcp_client_session_subrequest_add(session);
- }
- }
-
- if(session->subrequest_count == 0) {
- session->status = MRCP_SIG_STATUS_CODE_FAILURE;
- mrcp_app_sig_response_raise(session,TRUE);
- }
- return TRUE;
-}
-
-static apt_bool_t mrcp_client_on_termination_add(mrcp_client_session_t *session, const mpf_message_t *mpf_message)
-{
- rtp_termination_slot_t *termination_slot;
- apt_obj_log(APT_LOG_MARK,APT_PRIO_DEBUG,session->base.log_obj,"Media Termination Added "APT_NAMESIDRES_FMT,
- MRCP_SESSION_NAMESID(session),
- mpf_termination_name_get(mpf_message->termination));
- termination_slot = mrcp_client_rtp_termination_find(session,mpf_message->termination);
- if(termination_slot) {
- /* rtp termination */
- mpf_rtp_termination_descriptor_t *rtp_descriptor;
- if(termination_slot->waiting == FALSE) {
- return FALSE;
- }
- termination_slot->waiting = FALSE;
- rtp_descriptor = mpf_message->descriptor;
- if(rtp_descriptor->audio.local) {
- session->offer->ip = rtp_descriptor->audio.local->ip;
- session->offer->ext_ip = rtp_descriptor->audio.local->ext_ip;
- rtp_descriptor->audio.local->id = mrcp_session_audio_media_add(session->offer,rtp_descriptor->audio.local);
- rtp_descriptor->audio.local->mid = session->offer->audio_media_arr->nelts;
- termination_slot->id = session->offer->audio_media_arr->nelts - 1;
- }
- if(mrcp_client_session_subrequest_remove(session) == TRUE) {
- /* send offer to server */
- mrcp_client_session_offer_send(session);
- }
- }
- else {
- /* channel termination */
- mrcp_channel_t *channel = mrcp_client_channel_termination_find(session,mpf_message->termination);
- if(channel && channel->waiting_for_termination == TRUE) {
- channel->waiting_for_termination = FALSE;
- if(mrcp_client_session_subrequest_remove(session) == TRUE) {
- /* send offer to server */
- mrcp_client_session_offer_send(session);
- }
- }
- }
- return TRUE;
-}
-
-static apt_bool_t mrcp_client_on_termination_modify(mrcp_client_session_t *session, const mpf_message_t *mpf_message)
-{
- rtp_termination_slot_t *termination_slot;
- apt_obj_log(APT_LOG_MARK,APT_PRIO_DEBUG,session->base.log_obj,"Media Termination Modified "APT_NAMESIDRES_FMT,
- MRCP_SESSION_NAMESID(session),
- mpf_termination_name_get(mpf_message->termination));
- termination_slot = mrcp_client_rtp_termination_find(session,mpf_message->termination);
- if(termination_slot) {
- /* rtp termination */
- if(termination_slot->waiting == FALSE) {
- return FALSE;
- }
- termination_slot->waiting = FALSE;
- termination_slot->descriptor = mpf_message->descriptor;;
-
- if(mrcp_client_session_subrequest_remove(session) == TRUE) {
- if(session->state == SESSION_STATE_GENERATING_OFFER) {
- /* send offer to server */
- mrcp_client_session_offer_send(session);
- }
- else if(session->state == SESSION_STATE_PROCESSING_ANSWER) {
- /* raise app response */
- mrcp_app_sig_response_raise(session,TRUE);
- }
- }
- }
- return TRUE;
-}
-
-static apt_bool_t mrcp_client_on_termination_subtract(mrcp_client_session_t *session, const mpf_message_t *mpf_message)
-{
- rtp_termination_slot_t *termination_slot;
- apt_obj_log(APT_LOG_MARK,APT_PRIO_DEBUG,session->base.log_obj,"Media Termination Subtracted "APT_NAMESIDRES_FMT,
- MRCP_SESSION_NAMESID(session),
- mpf_termination_name_get(mpf_message->termination));
- termination_slot = mrcp_client_rtp_termination_find(session,mpf_message->termination);
- if(termination_slot) {
- /* rtp termination */
- if(termination_slot->waiting == FALSE) {
- return FALSE;
- }
- termination_slot->waiting = FALSE;
- if(mrcp_client_session_subrequest_remove(session) == TRUE) {
- mrcp_app_session_terminate_raise(session,MRCP_SIG_STATUS_CODE_SUCCESS);
- }
- }
- else {
- /* channel termination */
- mrcp_channel_t *channel = mrcp_client_channel_termination_find(session,mpf_message->termination);
- if(channel && channel->waiting_for_termination == TRUE) {
- channel->waiting_for_termination = FALSE;
- if(mrcp_client_session_subrequest_remove(session) == TRUE) {
- /* raise app response */
- mrcp_app_sig_response_raise(session,TRUE);
- }
- }
- }
- return TRUE;
-}
-
-apt_bool_t mrcp_client_mpf_message_process(mpf_message_container_t *mpf_message_container)
-{
- apr_size_t i;
- mrcp_client_session_t *session;
- const mpf_message_t *mpf_message;
- for(i=0; icount; i++) {
- mpf_message = &mpf_message_container->messages[i];
- if(mpf_message->context) {
- session = mpf_engine_context_object_get(mpf_message->context);
- }
- else {
- session = NULL;
- }
- if(!session) {
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Received MPF Message: NULL session");
- continue;
- }
- if(mpf_message->message_type == MPF_MESSAGE_TYPE_RESPONSE) {
- switch(mpf_message->command_id) {
- case MPF_ADD_TERMINATION:
- mrcp_client_on_termination_add(session,mpf_message);
- break;
- case MPF_MODIFY_TERMINATION:
- mrcp_client_on_termination_modify(session,mpf_message);
- break;
- case MPF_SUBTRACT_TERMINATION:
- mrcp_client_on_termination_subtract(session,mpf_message);
- break;
- case MPF_ADD_ASSOCIATION:
- case MPF_REMOVE_ASSOCIATION:
- case MPF_RESET_ASSOCIATIONS:
- case MPF_APPLY_TOPOLOGY:
- case MPF_DESTROY_TOPOLOGY:
- if(mrcp_client_session_subrequest_remove(session) == TRUE) {
- if(session->state == SESSION_STATE_GENERATING_OFFER) {
- /* send offer to server */
- mrcp_client_session_offer_send(session);
- }
- else if(session->state == SESSION_STATE_PROCESSING_ANSWER) {
- /* raise app response */
- mrcp_app_sig_response_raise(session,TRUE);
- }
- }
- break;
- default:
- break;
- }
- }
- else if(mpf_message->message_type == MPF_MESSAGE_TYPE_EVENT) {
- apt_obj_log(APT_LOG_MARK,APT_PRIO_DEBUG,session->base.log_obj,"Process MPF Event "APT_NAMESID_FMT,
- MRCP_SESSION_NAMESID(session));
- }
- }
- return TRUE;
-}
-
-static apt_bool_t mrcp_client_resource_answer_process(mrcp_client_session_t *session, mrcp_session_descriptor_t *descriptor)
-{
- apt_bool_t status = TRUE;
- if(session->offer->resource_state == TRUE) {
- if(descriptor->resource_state == TRUE) {
- mrcp_client_av_media_answer_process(session,descriptor);
- }
- else {
- status = FALSE;
- }
- }
- return status;
-}
-
-static apt_bool_t mrcp_client_control_media_answer_process(mrcp_client_session_t *session, mrcp_session_descriptor_t *descriptor)
-{
- mrcp_channel_t *channel;
- mrcp_control_descriptor_t *control_descriptor;
- int i;
- int count = session->channels->nelts;
- if(count != descriptor->control_media_arr->nelts) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Number of control channels [%d] != Number of control media in answer [%d]",
- count,descriptor->control_media_arr->nelts);
- count = descriptor->control_media_arr->nelts;
- }
-
- if(!session->base.id.length) {
- /* initial answer received, store session id and add to session's table */
- control_descriptor = mrcp_session_control_media_get(descriptor,0);
- if(control_descriptor) {
- session->base.id = control_descriptor->session_id;
- }
- }
-
- /* update existing control channels */
- for(i=0; ichannels,i,mrcp_channel_t*);
- if(!channel) continue;
-
- /* get control descriptor */
- control_descriptor = mrcp_session_control_media_get(descriptor,i);
- /* modify channel */
- apt_obj_log(APT_LOG_MARK,APT_PRIO_DEBUG,session->base.log_obj,"Modify Control Channel "APT_NAMESID_FMT,
- MRCP_SESSION_NAMESID(session));
- if(mrcp_client_control_channel_modify(channel->control_channel,control_descriptor) == TRUE) {
- channel->waiting_for_channel = TRUE;
- mrcp_client_session_subrequest_add(session);
- }
- }
- return TRUE;
-}
-
-static apt_bool_t mrcp_client_av_media_answer_process(mrcp_client_session_t *session, mrcp_session_descriptor_t *descriptor)
-{
- rtp_termination_slot_t *slot;
- int i;
- int count = session->terminations->nelts;
- if(count != descriptor->audio_media_arr->nelts) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Number of terminations [%d] != Number of audio media in answer [%d]",
- count,descriptor->audio_media_arr->nelts);
- count = descriptor->audio_media_arr->nelts;
- }
-
- /* update existing terminations */
- for(i=0; iterminations,i,rtp_termination_slot_t);
- remote_media = mrcp_session_audio_media_get(descriptor,i);
- if(slot->descriptor) {
- slot->descriptor->audio.remote = remote_media;
- }
- if(slot->termination) {
- /* construct termination descriptor */
- rtp_descriptor = apr_palloc(session->base.pool,sizeof(mpf_rtp_termination_descriptor_t));
- mpf_rtp_termination_descriptor_init(rtp_descriptor);
- rtp_descriptor->audio.local = NULL;
- rtp_descriptor->audio.remote = remote_media;
-
- /* send modify termination request */
- apt_obj_log(APT_LOG_MARK,APT_PRIO_DEBUG,session->base.log_obj,"Modify Media Termination "APT_NAMESIDRES_FMT,
- MRCP_SESSION_NAMESID(session),
- mpf_termination_name_get(slot->termination));
- if(mpf_engine_termination_message_add(
- session->base.media_engine,
- MPF_MODIFY_TERMINATION,session->context,slot->termination,rtp_descriptor,
- &session->mpf_task_msg) == TRUE) {
- slot->waiting = TRUE;
- mrcp_client_session_subrequest_add(session);
- }
- if(slot->channel && slot->channel->termination) {
- if(mpf_engine_assoc_message_add(
- session->base.media_engine,
- MPF_ADD_ASSOCIATION,session->context,slot->termination,slot->channel->termination,
- &session->mpf_task_msg) == TRUE) {
- mrcp_client_session_subrequest_add(session);
- }
- }
- }
- }
- return TRUE;
-}
-
-static apt_bool_t mrcp_app_request_dispatch(mrcp_client_session_t *session, const mrcp_app_message_t *app_message)
-{
- if(session->state == SESSION_STATE_TERMINATING) {
- /* no more requests are allowed, as session is being terminated!
- just return, it is horribly wrong and can crash anytime here */
- apt_obj_log(APT_LOG_MARK,APT_PRIO_ERROR,session->base.log_obj,"Inappropriate Application Request "APT_NAMESID_FMT" [%d]",
- MRCP_SESSION_NAMESID(session),
- app_message->sig_message.command_id);
- return FALSE;
- }
-
- if(session->disconnected == TRUE) {
- /* cancel all the requests besides session termination one */
- if(!IS_SESSION_TERMINATE(app_message)) {
- apt_obj_log(APT_LOG_MARK,APT_PRIO_WARNING,session->base.log_obj,"Cancel App Request "APT_NAMESID_FMT" [%d]",
- MRCP_SESSION_NAMESID(session), app_message->sig_message.command_id);
- session->status = MRCP_SIG_STATUS_CODE_CANCEL;
- return mrcp_app_failure_message_raise(session);
- }
- }
-
- if(session->registered == FALSE) {
- if(IS_SESSION_TERMINATE(app_message)) {
- /* if session is not registered, nothing to terminate, just respond with success */
- session->status = MRCP_SIG_STATUS_CODE_SUCCESS;
- return mrcp_app_sig_response_raise(session,FALSE);
- }
-
- /* select signaling agent */
- session->base.signaling_agent = mrcp_sa_factory_agent_select(session->profile->sa_factory);
- if(!session->base.signaling_agent) {
- apt_obj_log(APT_LOG_MARK,APT_PRIO_WARNING,session->base.log_obj,"Failed to Select Signaling Agent "APT_NAMESID_FMT" [%d]",
- MRCP_SESSION_NAMESID(session),
- app_message->sig_message.command_id);
- session->status = MRCP_SIG_STATUS_CODE_FAILURE;
- }
- if(session->profile->mrcp_version == MRCP_VERSION_2) {
- /* select connection agent */
- session->base.connection_agent = mrcp_ca_factory_agent_select(session->profile->ca_factory);
- if(!session->base.connection_agent) {
- apt_obj_log(APT_LOG_MARK,APT_PRIO_WARNING,session->base.log_obj,"Failed to Select Connection Agent "APT_NAMESID_FMT" [%d]",
- MRCP_SESSION_NAMESID(session),
- app_message->sig_message.command_id);
- session->status = MRCP_SIG_STATUS_CODE_FAILURE;
- }
- }
- if(session->profile->mpf_factory) {
- /* select media engine */
- session->base.media_engine = mpf_engine_factory_engine_select(session->profile->mpf_factory);
- if(!session->base.media_engine) {
- apt_obj_log(APT_LOG_MARK,APT_PRIO_WARNING,session->base.log_obj,"Failed to Select Media Engine "APT_NAMESID_FMT" [%d]",
- MRCP_SESSION_NAMESID(session),
- app_message->sig_message.command_id);
- session->status = MRCP_SIG_STATUS_CODE_FAILURE;
- }
- }
- /* set rtp termination factory */
- session->base.rtp_factory = session->profile->rtp_termination_factory;
-
- if(session->status == MRCP_SIG_STATUS_CODE_FAILURE) {
- /* raise app response in case of failure */
- return mrcp_app_failure_message_raise(session);
- }
-
- if(session->base.signaling_agent->create_client_session(&session->base,session->profile->signaling_settings) != TRUE) {
- /* raise app response */
- apt_obj_log(APT_LOG_MARK,APT_PRIO_WARNING,session->base.log_obj,"Failed to Create Session "APT_NAMESID_FMT" [%d]",
- MRCP_SESSION_NAMESID(session),
- app_message->sig_message.command_id);
- session->status = MRCP_SIG_STATUS_CODE_FAILURE;
- return mrcp_app_failure_message_raise(session);
- }
-
- mrcp_client_session_add(session->application->client,session);
- session->registered = TRUE;
- }
- session->status = MRCP_SIG_STATUS_CODE_SUCCESS;
- switch(app_message->message_type) {
- case MRCP_APP_MESSAGE_TYPE_SIGNALING:
- {
- apt_obj_log(APT_LOG_MARK,APT_PRIO_DEBUG,session->base.log_obj,"Dispatch App Request "APT_NAMESID_FMT" [%d]",
- MRCP_SESSION_NAMESID(session),
- app_message->sig_message.command_id);
- switch(app_message->sig_message.command_id) {
- case MRCP_SIG_COMMAND_SESSION_UPDATE:
- mrcp_client_session_update(session);
- break;
- case MRCP_SIG_COMMAND_SESSION_TERMINATE:
- mrcp_client_session_terminate(session);
- break;
- case MRCP_SIG_COMMAND_CHANNEL_ADD:
- mrcp_client_channel_add(session,app_message->channel);
- break;
- case MRCP_SIG_COMMAND_CHANNEL_REMOVE:
- mrcp_client_channel_modify(session,app_message->channel,FALSE);
- break;
- case MRCP_SIG_COMMAND_RESOURCE_DISCOVER:
- mrcp_client_resource_discover(session);
- break;
- default:
- break;
- }
- break;
- }
- case MRCP_APP_MESSAGE_TYPE_CONTROL:
- {
- mrcp_client_message_send(session,app_message->channel,app_message->control_message);
- break;
- }
- }
- return TRUE;
-}
diff --git a/libs/unimrcp/libs/mrcp-engine/Makefile.am b/libs/unimrcp/libs/mrcp-engine/Makefile.am
deleted file mode 100644
index a67c910526..0000000000
--- a/libs/unimrcp/libs/mrcp-engine/Makefile.am
+++ /dev/null
@@ -1,38 +0,0 @@
-MAINTAINERCLEANFILES = Makefile.in
-
-AM_CPPFLAGS = -I$(top_srcdir)/libs/mrcp-engine/include \
- -I$(top_srcdir)/libs/mrcp/include \
- -I$(top_srcdir)/libs/mrcp/message/include \
- -I$(top_srcdir)/libs/mrcp/control/include \
- -I$(top_srcdir)/libs/mrcp/resources/include \
- -I$(top_srcdir)/libs/mpf/include \
- -I$(top_srcdir)/libs/apr-toolkit/include \
- $(UNIMRCP_APR_INCLUDES)
-
-noinst_LTLIBRARIES = libmrcpengine.la
-
-include_HEADERS = include/mrcp_engine_types.h \
- include/mrcp_engine_plugin.h \
- include/mrcp_engine_iface.h \
- include/mrcp_engine_impl.h \
- include/mrcp_synth_engine.h \
- include/mrcp_recog_engine.h \
- include/mrcp_recorder_engine.h \
- include/mrcp_verifier_engine.h \
- include/mrcp_resource_engine.h \
- include/mrcp_engine_factory.h \
- include/mrcp_engine_loader.h \
- include/mrcp_state_machine.h \
- include/mrcp_synth_state_machine.h \
- include/mrcp_recog_state_machine.h \
- include/mrcp_recorder_state_machine.h \
- include/mrcp_verifier_state_machine.h
-
-libmrcpengine_la_SOURCES = src/mrcp_engine_iface.c \
- src/mrcp_engine_impl.c \
- src/mrcp_engine_factory.c \
- src/mrcp_engine_loader.c \
- src/mrcp_synth_state_machine.c \
- src/mrcp_recog_state_machine.c \
- src/mrcp_recorder_state_machine.c \
- src/mrcp_verifier_state_machine.c
diff --git a/libs/unimrcp/libs/mrcp-engine/include/mrcp_engine_factory.h b/libs/unimrcp/libs/mrcp-engine/include/mrcp_engine_factory.h
deleted file mode 100644
index d769a0a937..0000000000
--- a/libs/unimrcp/libs/mrcp-engine/include/mrcp_engine_factory.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_engine_factory.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MRCP_ENGINE_FACTORY_H
-#define MRCP_ENGINE_FACTORY_H
-
-/**
- * @file mrcp_engine_factory.h
- * @brief Factory of MRCP Engines
- */
-
-#include "mrcp_engine_iface.h"
-
-APT_BEGIN_EXTERN_C
-
-/** Opaque engine factory declaration */
-typedef struct mrcp_engine_factory_t mrcp_engine_factory_t;
-
-/** Create engine factory */
-MRCP_DECLARE(mrcp_engine_factory_t*) mrcp_engine_factory_create(apr_pool_t *pool);
-
-/** Destroy registered engines and the factory */
-MRCP_DECLARE(apt_bool_t) mrcp_engine_factory_destroy(mrcp_engine_factory_t *factory);
-
-/** Open registered engines */
-MRCP_DECLARE(apt_bool_t) mrcp_engine_factory_open(mrcp_engine_factory_t *factory);
-
-/** Close registered engines */
-MRCP_DECLARE(apt_bool_t) mrcp_engine_factory_close(mrcp_engine_factory_t *factory);
-
-
-/** Register engine */
-MRCP_DECLARE(apt_bool_t) mrcp_engine_factory_engine_register(mrcp_engine_factory_t *factory, mrcp_engine_t *engine);
-
-/** Get engine by name */
-MRCP_DECLARE(mrcp_engine_t*) mrcp_engine_factory_engine_get(const mrcp_engine_factory_t *factory, const char *name);
-
-/** Find engine by resource identifier */
-MRCP_DECLARE(mrcp_engine_t*) mrcp_engine_factory_engine_find(const mrcp_engine_factory_t *factory, mrcp_resource_id resource_id);
-
-/** Start iterating over the engines in a factory */
-MRCP_DECLARE(apr_hash_index_t*) mrcp_engine_factory_engine_first(const mrcp_engine_factory_t *factory);
-
-
-APT_END_EXTERN_C
-
-#endif /* MRCP_ENGINE_FACTORY_H */
diff --git a/libs/unimrcp/libs/mrcp-engine/include/mrcp_engine_iface.h b/libs/unimrcp/libs/mrcp-engine/include/mrcp_engine_iface.h
deleted file mode 100644
index 2e70c80dec..0000000000
--- a/libs/unimrcp/libs/mrcp-engine/include/mrcp_engine_iface.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_engine_iface.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MRCP_ENGINE_IFACE_H
-#define MRCP_ENGINE_IFACE_H
-
-/**
- * @file mrcp_engine_iface.h
- * @brief MRCP Engine User Interface (typically user is an MRCP server)
- */
-
-#include "mrcp_engine_types.h"
-
-APT_BEGIN_EXTERN_C
-
-/** Destroy engine */
-apt_bool_t mrcp_engine_virtual_destroy(mrcp_engine_t *engine);
-
-/** Open engine */
-apt_bool_t mrcp_engine_virtual_open(mrcp_engine_t *engine);
-
-/** Response to open engine request */
-void mrcp_engine_on_open(mrcp_engine_t *engine, apt_bool_t status);
-
-/** Close engine */
-apt_bool_t mrcp_engine_virtual_close(mrcp_engine_t *engine);
-
-/** Response to close engine request */
-void mrcp_engine_on_close(mrcp_engine_t *engine);
-
-
-/** Create engine channel */
-mrcp_engine_channel_t* mrcp_engine_channel_virtual_create(mrcp_engine_t *engine, mrcp_version_e mrcp_version, apr_pool_t *pool);
-
-/** Destroy engine channel */
-apt_bool_t mrcp_engine_channel_virtual_destroy(mrcp_engine_channel_t *channel);
-
-/** Open engine channel */
-static APR_INLINE apt_bool_t mrcp_engine_channel_virtual_open(mrcp_engine_channel_t *channel)
-{
- if(channel->is_open == FALSE) {
- channel->is_open = channel->method_vtable->open(channel);
- return channel->is_open;
- }
- return FALSE;
-}
-
-/** Close engine channel */
-static APR_INLINE apt_bool_t mrcp_engine_channel_virtual_close(mrcp_engine_channel_t *channel)
-{
- if(channel->is_open == TRUE) {
- channel->is_open = FALSE;
- return channel->method_vtable->close(channel);
- }
- return FALSE;
-}
-
-/** Process request */
-static APR_INLINE apt_bool_t mrcp_engine_channel_request_process(mrcp_engine_channel_t *channel, mrcp_message_t *message)
-{
- return channel->method_vtable->process_request(channel,message);
-}
-
-/** Allocate engine config */
-mrcp_engine_config_t* mrcp_engine_config_alloc(apr_pool_t *pool);
-
-
-APT_END_EXTERN_C
-
-#endif /* MRCP_ENGINE_IFACE_H */
diff --git a/libs/unimrcp/libs/mrcp-engine/include/mrcp_engine_impl.h b/libs/unimrcp/libs/mrcp-engine/include/mrcp_engine_impl.h
deleted file mode 100644
index 6900b6abe0..0000000000
--- a/libs/unimrcp/libs/mrcp-engine/include/mrcp_engine_impl.h
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_engine_impl.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MRCP_ENGINE_IMPL_H
-#define MRCP_ENGINE_IMPL_H
-
-/**
- * @file mrcp_engine_impl.h
- * @brief MRCP Engine Realization Interface (typically should be implemented in plugins)
- */
-
-#include "mrcp_engine_types.h"
-#include "mpf_stream.h"
-
-APT_BEGIN_EXTERN_C
-
-/** Create engine */
-mrcp_engine_t* mrcp_engine_create(
- mrcp_resource_id resource_id,
- void *obj,
- const mrcp_engine_method_vtable_t *vtable,
- apr_pool_t *pool);
-
-/** Send engine open response */
-static APR_INLINE apt_bool_t mrcp_engine_open_respond(mrcp_engine_t *engine, apt_bool_t status)
-{
- return engine->event_vtable->on_open(engine,status);
-}
-
-/** Send engine close response */
-static APR_INLINE apt_bool_t mrcp_engine_close_respond(mrcp_engine_t *engine)
-{
- return engine->event_vtable->on_close(engine);
-}
-
-
-/** Get engine config */
-const mrcp_engine_config_t* mrcp_engine_config_get(const mrcp_engine_t *engine);
-
-/** Get engine param by name */
-const char* mrcp_engine_param_get(const mrcp_engine_t *engine, const char *name);
-
-
-/** Create engine channel */
-mrcp_engine_channel_t* mrcp_engine_channel_create(
- mrcp_engine_t *engine,
- const mrcp_engine_channel_method_vtable_t *method_vtable,
- void *method_obj,
- mpf_termination_t *termination,
- apr_pool_t *pool);
-
-/** Create audio termination */
-mpf_termination_t* mrcp_engine_audio_termination_create(
- void *obj,
- const mpf_audio_stream_vtable_t *stream_vtable,
- mpf_stream_capabilities_t *capabilities,
- apr_pool_t *pool);
-
-/** Create engine channel and source media termination
- * @deprecated @see mrcp_engine_channel_create() and mrcp_engine_audio_termination_create()
- */
-mrcp_engine_channel_t* mrcp_engine_source_channel_create(
- mrcp_engine_t *engine,
- const mrcp_engine_channel_method_vtable_t *channel_vtable,
- const mpf_audio_stream_vtable_t *stream_vtable,
- void *method_obj,
- mpf_codec_descriptor_t *codec_descriptor,
- apr_pool_t *pool);
-
-/** Create engine channel and sink media termination
- * @deprecated @see mrcp_engine_channel_create() and mrcp_engine_audio_termination_create()
- */
-mrcp_engine_channel_t* mrcp_engine_sink_channel_create(
- mrcp_engine_t *engine,
- const mrcp_engine_channel_method_vtable_t *channel_vtable,
- const mpf_audio_stream_vtable_t *stream_vtable,
- void *method_obj,
- mpf_codec_descriptor_t *codec_descriptor,
- apr_pool_t *pool);
-
-/** Send channel open response */
-static APR_INLINE apt_bool_t mrcp_engine_channel_open_respond(mrcp_engine_channel_t *channel, apt_bool_t status)
-{
- return channel->event_vtable->on_open(channel,status);
-}
-
-/** Send channel close response */
-static APR_INLINE apt_bool_t mrcp_engine_channel_close_respond(mrcp_engine_channel_t *channel)
-{
- return channel->event_vtable->on_close(channel);
-}
-
-/** Send response/event message */
-static APR_INLINE apt_bool_t mrcp_engine_channel_message_send(mrcp_engine_channel_t *channel, mrcp_message_t *message)
-{
- return channel->event_vtable->on_message(channel,message);
-}
-
-/** Get channel identifier */
-static APR_INLINE const char* mrcp_engine_channel_id_get(mrcp_engine_channel_t *channel)
-{
- return channel->id.buf;
-}
-
-/** Get MRCP version channel is created in the scope of */
-static APR_INLINE mrcp_version_e mrcp_engine_channel_version_get(const mrcp_engine_channel_t *channel)
-{
- return channel->mrcp_version;
-}
-
-/** Get codec descriptor of the audio source stream */
-const mpf_codec_descriptor_t* mrcp_engine_source_stream_codec_get(const mrcp_engine_channel_t *channel);
-
-/** Get codec descriptor of the audio sink stream */
-const mpf_codec_descriptor_t* mrcp_engine_sink_stream_codec_get(const mrcp_engine_channel_t *channel);
-
-
-APT_END_EXTERN_C
-
-#endif /* MRCP_ENGINE_IMPL_H */
diff --git a/libs/unimrcp/libs/mrcp-engine/include/mrcp_engine_loader.h b/libs/unimrcp/libs/mrcp-engine/include/mrcp_engine_loader.h
deleted file mode 100644
index a408497266..0000000000
--- a/libs/unimrcp/libs/mrcp-engine/include/mrcp_engine_loader.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_engine_loader.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MRCP_ENGINE_LOADER_H
-#define MRCP_ENGINE_LOADER_H
-
-/**
- * @file mrcp_engine_loader.h
- * @brief Loader of plugins for MRCP engines
- */
-
-#include "mrcp_engine_iface.h"
-
-APT_BEGIN_EXTERN_C
-
-/** Opaque engine loader declaration */
-typedef struct mrcp_engine_loader_t mrcp_engine_loader_t;
-
-/** Create engine loader */
-MRCP_DECLARE(mrcp_engine_loader_t*) mrcp_engine_loader_create(apr_pool_t *pool);
-
-/** Destroy engine loader */
-MRCP_DECLARE(apt_bool_t) mrcp_engine_loader_destroy(mrcp_engine_loader_t *loader);
-
-/** Unload loaded plugins */
-MRCP_DECLARE(apt_bool_t) mrcp_engine_loader_plugins_unload(mrcp_engine_loader_t *loader);
-
-
-/** Load engine plugin */
-MRCP_DECLARE(mrcp_engine_t*) mrcp_engine_loader_plugin_load(
- mrcp_engine_loader_t *loader,
- const char *id,
- const char *path,
- mrcp_engine_config_t *config);
-
-
-APT_END_EXTERN_C
-
-#endif /* MRCP_ENGINE_LOADER_H */
diff --git a/libs/unimrcp/libs/mrcp-engine/include/mrcp_engine_plugin.h b/libs/unimrcp/libs/mrcp-engine/include/mrcp_engine_plugin.h
deleted file mode 100644
index e9cdb6da9b..0000000000
--- a/libs/unimrcp/libs/mrcp-engine/include/mrcp_engine_plugin.h
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_engine_plugin.h 2139 2014-07-07 05:06:19Z achaloyan@gmail.com $
- */
-
-#ifndef MRCP_ENGINE_PLUGIN_H
-#define MRCP_ENGINE_PLUGIN_H
-
-/**
- * @file mrcp_engine_plugin.h
- * @brief MRCP Engine Plugin
- */
-
-#include "apr_version.h"
-#include "apt_log.h"
-#include "mrcp_engine_types.h"
-
-APT_BEGIN_EXTERN_C
-
-/** Let the plugin symbols be always exported as C functions */
-#ifdef __cplusplus
-#define MRCP_PLUGIN_EXTERN_C extern "C"
-#else
-#define MRCP_PLUGIN_EXTERN_C extern
-#endif
-
-/** Plugin export defines */
-#ifdef WIN32
-#define MRCP_PLUGIN_DECLARE(type) MRCP_PLUGIN_EXTERN_C __declspec(dllexport) type
-#else
-#define MRCP_PLUGIN_DECLARE(type) MRCP_PLUGIN_EXTERN_C type
-#endif
-
-/** [REQUIRED] Symbol name of the main entry point in plugin DSO */
-#define MRCP_PLUGIN_ENGINE_SYM_NAME "mrcp_plugin_create"
-/** [REQUIRED] Symbol name of the vesrion number entry point in plugin DSO */
-#define MRCP_PLUGIN_VERSION_SYM_NAME "mrcp_plugin_version"
-/** [IMPLIED] Symbol name of the log accessor entry point in plugin DSO */
-#define MRCP_PLUGIN_LOGGER_SYM_NAME "mrcp_plugin_logger_set"
-
-/** Prototype of engine creator (entry point of plugin DSO) */
-typedef mrcp_engine_t* (*mrcp_plugin_creator_f)(apr_pool_t *pool);
-
-/** Prototype of log accessor (entry point of plugin DSO) */
-typedef apt_bool_t (*mrcp_plugin_log_accessor_f)(apt_logger_t *logger);
-
-/** Declare this macro in plugins to use log routine of the server */
-#define MRCP_PLUGIN_LOGGER_IMPLEMENT \
- MRCP_PLUGIN_DECLARE(apt_bool_t) mrcp_plugin_logger_set(apt_logger_t *logger) \
- { return apt_log_instance_set(logger); }
-
-/** Declare this macro in plugins to set plugin version */
-#define MRCP_PLUGIN_VERSION_DECLARE \
- MRCP_PLUGIN_DECLARE(mrcp_plugin_version_t) mrcp_plugin_version; \
- mrcp_plugin_version_t mrcp_plugin_version = \
- {PLUGIN_MAJOR_VERSION, PLUGIN_MINOR_VERSION, PLUGIN_PATCH_VERSION};
-
-
-/** major version
- * Major API changes that could cause compatibility problems for older
- * plugins such as structure size changes. No binary compatibility is
- * possible across a change in the major version.
- */
-#define PLUGIN_MAJOR_VERSION 1
-
-/** minor version
- * Minor API changes that do not cause binary compatibility problems.
- * Reset to 0 when upgrading PLUGIN_MAJOR_VERSION
- */
-#define PLUGIN_MINOR_VERSION 2
-
-/** patch level
- * The Patch Level never includes API changes, simply bug fixes.
- * Reset to 0 when upgrading PLUGIN_MINOR_VERSION
- */
-#define PLUGIN_PATCH_VERSION 0
-
-
-/**
- * Check at compile time if the plugin version is at least a certain
- * level.
- */
-#define PLUGIN_VERSION_AT_LEAST(major,minor,patch) \
-(((major) < PLUGIN_MAJOR_VERSION) \
- || ((major) == PLUGIN_MAJOR_VERSION && (minor) < PLUGIN_MINOR_VERSION) \
- || ((major) == PLUGIN_MAJOR_VERSION && (minor) == PLUGIN_MINOR_VERSION && (patch) <= PLUGIN_PATCH_VERSION))
-
-/** The formatted string of plugin's version */
-#define PLUGIN_VERSION_STRING \
- APR_STRINGIFY(PLUGIN_MAJOR_VERSION) "." \
- APR_STRINGIFY(PLUGIN_MINOR_VERSION) "." \
- APR_STRINGIFY(PLUGIN_PATCH_VERSION)
-
-/** Plugin version */
-typedef apr_version_t mrcp_plugin_version_t;
-
-/** Get plugin version */
-static APR_INLINE void mrcp_plugin_version_get(mrcp_plugin_version_t *version)
-{
- version->major = PLUGIN_MAJOR_VERSION;
- version->minor = PLUGIN_MINOR_VERSION;
- version->patch = PLUGIN_PATCH_VERSION;
-}
-
-/** Check plugin version */
-static APR_INLINE int mrcp_plugin_version_check(mrcp_plugin_version_t *version)
-{
- return PLUGIN_VERSION_AT_LEAST(version->major,version->minor,version->patch);
-}
-
-APT_END_EXTERN_C
-
-#endif /* MRCP_ENGINE_PLUGIN_H */
diff --git a/libs/unimrcp/libs/mrcp-engine/include/mrcp_engine_types.h b/libs/unimrcp/libs/mrcp-engine/include/mrcp_engine_types.h
deleted file mode 100644
index ee2390c255..0000000000
--- a/libs/unimrcp/libs/mrcp-engine/include/mrcp_engine_types.h
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_engine_types.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MRCP_ENGINE_TYPES_H
-#define MRCP_ENGINE_TYPES_H
-
-/**
- * @file mrcp_engine_types.h
- * @brief MRCP Engine Types
- */
-
-#include
-#include "mrcp_state_machine.h"
-#include "mpf_types.h"
-#include "apt_string.h"
-
-APT_BEGIN_EXTERN_C
-
-/** MRCP engine declaration */
-typedef struct mrcp_engine_t mrcp_engine_t;
-/** MRCP engine config declaration */
-typedef struct mrcp_engine_config_t mrcp_engine_config_t;
-/** MRCP engine vtable declaration */
-typedef struct mrcp_engine_method_vtable_t mrcp_engine_method_vtable_t;
-/** MRCP engine event vtable declaration */
-typedef struct mrcp_engine_event_vtable_t mrcp_engine_event_vtable_t;
-/** MRCP engine channel declaration */
-typedef struct mrcp_engine_channel_t mrcp_engine_channel_t;
-/** MRCP engine channel virtual method table declaration */
-typedef struct mrcp_engine_channel_method_vtable_t mrcp_engine_channel_method_vtable_t;
-/** MRCP engine channel virtual event table declaration */
-typedef struct mrcp_engine_channel_event_vtable_t mrcp_engine_channel_event_vtable_t;
-
-/** Table of channel virtual methods */
-struct mrcp_engine_channel_method_vtable_t {
- /** Virtual destroy */
- apt_bool_t (*destroy)(mrcp_engine_channel_t *channel);
- /** Virtual open */
- apt_bool_t (*open)(mrcp_engine_channel_t *channel);
- /** Virtual close */
- apt_bool_t (*close)(mrcp_engine_channel_t *channel);
- /** Virtual process_request */
- apt_bool_t (*process_request)(mrcp_engine_channel_t *channel, mrcp_message_t *request);
-};
-
-/** Table of channel virtual event handlers */
-struct mrcp_engine_channel_event_vtable_t {
- /** Open event handler */
- apt_bool_t (*on_open)(mrcp_engine_channel_t *channel, apt_bool_t status);
- /** Close event handler */
- apt_bool_t (*on_close)(mrcp_engine_channel_t *channel);
- /** Message event handler */
- apt_bool_t (*on_message)(mrcp_engine_channel_t *channel, mrcp_message_t *message);
-};
-
-/** MRCP engine channel declaration */
-struct mrcp_engine_channel_t {
- /** Table of virtual methods */
- const mrcp_engine_channel_method_vtable_t *method_vtable;
- /** External object used with virtual methods */
- void *method_obj;
- /** Table of virtual event handlers */
- const mrcp_engine_channel_event_vtable_t *event_vtable;
- /** External object used with event handlers */
- void *event_obj;
- /** Media termination */
- mpf_termination_t *termination;
- /** Back pointer to engine */
- mrcp_engine_t *engine;
- /** Unique identifier to be used in traces */
- apt_str_t id;
- /** MRCP version */
- mrcp_version_e mrcp_version;
- /** Is channel successfully opened */
- apt_bool_t is_open;
- /** Pool to allocate memory from */
- apr_pool_t *pool;
-};
-
-/** Table of MRCP engine virtual methods */
-struct mrcp_engine_method_vtable_t {
- /** Virtual destroy */
- apt_bool_t (*destroy)(mrcp_engine_t *engine);
- /** Virtual open */
- apt_bool_t (*open)(mrcp_engine_t *engine);
- /** Virtual close */
- apt_bool_t (*close)(mrcp_engine_t *engine);
- /** Virtual channel create */
- mrcp_engine_channel_t* (*create_channel)(mrcp_engine_t *engine, apr_pool_t *pool);
-};
-
-/** Table of MRCP engine virtual event handlers */
-struct mrcp_engine_event_vtable_t {
- /** Open event handler */
- apt_bool_t (*on_open)(mrcp_engine_t *channel, apt_bool_t status);
- /** Close event handler */
- apt_bool_t (*on_close)(mrcp_engine_t *channel);
-};
-
-/** MRCP engine */
-struct mrcp_engine_t {
- /** Identifier of the engine */
- const char *id;
- /** Resource identifier */
- mrcp_resource_id resource_id;
- /** External object associated with engine */
- void *obj;
- /** Table of virtual methods */
- const mrcp_engine_method_vtable_t *method_vtable;
- /** Table of virtual event handlers */
- const mrcp_engine_event_vtable_t *event_vtable;
- /** External object used with event handlers */
- void *event_obj;
- /** Codec manager */
- const mpf_codec_manager_t *codec_manager;
- /** Dir layout structure */
- const apt_dir_layout_t *dir_layout;
- /** Config of engine */
- mrcp_engine_config_t *config;
- /** Number of simultaneous channels currently in use */
- apr_size_t cur_channel_count;
- /** Is engine successfully opened */
- apt_bool_t is_open;
- /** Pool to allocate memory from */
- apr_pool_t *pool;
-
- /** Create state machine */
- mrcp_state_machine_t* (*create_state_machine)(void *obj, mrcp_version_e version, apr_pool_t *pool);
-};
-
-/** MRCP engine config */
-struct mrcp_engine_config_t {
- /** Max number of simultaneous channels */
- apr_size_t max_channel_count;
- /** Table of name/value string params */
- apr_table_t *params;
-};
-
-APT_END_EXTERN_C
-
-#endif /* MRCP_ENGINE_TYPES_H */
diff --git a/libs/unimrcp/libs/mrcp-engine/include/mrcp_recog_engine.h b/libs/unimrcp/libs/mrcp-engine/include/mrcp_recog_engine.h
deleted file mode 100644
index d9fce1bd97..0000000000
--- a/libs/unimrcp/libs/mrcp-engine/include/mrcp_recog_engine.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_recog_engine.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MRCP_RECOG_ENGINE_H
-#define MRCP_RECOG_ENGINE_H
-
-/**
- * @file mrcp_recog_engine.h
- * @brief Recognizer Engine Includes
- */
-
-#include "mrcp_engine_plugin.h"
-#include "mrcp_engine_impl.h"
-
-#include "mrcp_recog_resource.h"
-#include "mrcp_recog_header.h"
-#include "mrcp_generic_header.h"
-#include "mrcp_message.h"
-
-#endif /* MRCP_RECOG_ENGINE_H */
diff --git a/libs/unimrcp/libs/mrcp-engine/include/mrcp_recog_state_machine.h b/libs/unimrcp/libs/mrcp-engine/include/mrcp_recog_state_machine.h
deleted file mode 100644
index 9be07b6bec..0000000000
--- a/libs/unimrcp/libs/mrcp-engine/include/mrcp_recog_state_machine.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_recog_state_machine.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MRCP_RECOG_STATE_MACHINE_H
-#define MRCP_RECOG_STATE_MACHINE_H
-
-/**
- * @file mrcp_recog_state_machine.h
- * @brief MRCP Recognizer State Machine
- */
-
-#include "mrcp_state_machine.h"
-
-APT_BEGIN_EXTERN_C
-
-/** Create MRCP recognizer state machine */
-mrcp_state_machine_t* mrcp_recog_state_machine_create(void *obj, mrcp_version_e version, apr_pool_t *pool);
-
-APT_END_EXTERN_C
-
-#endif /* MRCP_RECOG_STATE_MACHINE_H */
diff --git a/libs/unimrcp/libs/mrcp-engine/include/mrcp_recorder_engine.h b/libs/unimrcp/libs/mrcp-engine/include/mrcp_recorder_engine.h
deleted file mode 100644
index 90fa022725..0000000000
--- a/libs/unimrcp/libs/mrcp-engine/include/mrcp_recorder_engine.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_recorder_engine.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MRCP_RECORDER_ENGINE_H
-#define MRCP_RECORDER_ENGINE_H
-
-/**
- * @file mrcp_recorder_engine.h
- * @brief Recorder Engine Includes
- */
-
-#include "mrcp_engine_plugin.h"
-#include "mrcp_engine_impl.h"
-
-#include "mrcp_recorder_resource.h"
-#include "mrcp_recorder_header.h"
-#include "mrcp_generic_header.h"
-#include "mrcp_message.h"
-
-#endif /* MRCP_RECORDER_ENGINE_H */
diff --git a/libs/unimrcp/libs/mrcp-engine/include/mrcp_recorder_state_machine.h b/libs/unimrcp/libs/mrcp-engine/include/mrcp_recorder_state_machine.h
deleted file mode 100644
index 242440a42f..0000000000
--- a/libs/unimrcp/libs/mrcp-engine/include/mrcp_recorder_state_machine.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_recorder_state_machine.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MRCP_RECORDER_STATE_MACHINE_H
-#define MRCP_RECORDER_STATE_MACHINE_H
-
-/**
- * @file mrcp_recorder_state_machine.h
- * @brief MRCP Recorder State Machine
- */
-
-#include "mrcp_state_machine.h"
-
-APT_BEGIN_EXTERN_C
-
-/** Create MRCP recorder state machine */
-mrcp_state_machine_t* mrcp_recorder_state_machine_create(void *obj, mrcp_version_e version, apr_pool_t *pool);
-
-APT_END_EXTERN_C
-
-#endif /* MRCP_RECORDER_STATE_MACHINE_H */
diff --git a/libs/unimrcp/libs/mrcp-engine/include/mrcp_resource_engine.h b/libs/unimrcp/libs/mrcp-engine/include/mrcp_resource_engine.h
deleted file mode 100644
index 3743af9ab0..0000000000
--- a/libs/unimrcp/libs/mrcp-engine/include/mrcp_resource_engine.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_resource_engine.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MRCP_RESOURCE_ENGINE_H
-#define MRCP_RESOURCE_ENGINE_H
-
-/**
- * @file mrcp_resource_engine.h
- * @brief Legacy MRCP Resource Engine
- * @deprecated @see mrcp_engine_plugin.h and mrcp_engine_impl.h
- */
-
-#include "mrcp_engine_plugin.h"
-#include "mrcp_engine_impl.h"
-
-APT_BEGIN_EXTERN_C
-
-/** Termorary define legacy mrcp_resource_engine_t as mrcp_engine_t */
-typedef mrcp_engine_t mrcp_resource_engine_t;
-
-/**
- * Create resource engine
- * @deprecated @see mrcp_engine_create
- */
-static APR_INLINE mrcp_engine_t* mrcp_resource_engine_create(
- mrcp_resource_id resource_id,
- void *obj,
- const mrcp_engine_method_vtable_t *vtable,
- apr_pool_t *pool)
-{
- return mrcp_engine_create(resource_id,obj,vtable,pool);
-}
-
-APT_END_EXTERN_C
-
-#endif /* MRCP_RESOURCE_ENGINE_H */
diff --git a/libs/unimrcp/libs/mrcp-engine/include/mrcp_state_machine.h b/libs/unimrcp/libs/mrcp-engine/include/mrcp_state_machine.h
deleted file mode 100644
index acec6fa8bc..0000000000
--- a/libs/unimrcp/libs/mrcp-engine/include/mrcp_state_machine.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_state_machine.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MRCP_STATE_MACHINE_H
-#define MRCP_STATE_MACHINE_H
-
-/**
- * @file mrcp_state_machine.h
- * @brief MRCP State Machine
- */
-
-#include "mrcp_types.h"
-
-APT_BEGIN_EXTERN_C
-
-/** MRCP state machine declaration */
-typedef struct mrcp_state_machine_t mrcp_state_machine_t;
-
-
-/** MRCP state machine */
-struct mrcp_state_machine_t {
- /** External object associated with state machine */
- void *obj;
- /** State either active or deactivating */
- apt_bool_t active;
-
- /** Virtual update */
- apt_bool_t (*update)(mrcp_state_machine_t *state_machine, mrcp_message_t *message);
- /** Deactivate */
- apt_bool_t (*deactivate)(mrcp_state_machine_t *state_machine);
-
-
- /** Message dispatcher */
- apt_bool_t (*on_dispatch)(mrcp_state_machine_t *state_machine, mrcp_message_t *message);
- /** Deactivated */
- apt_bool_t (*on_deactivate)(mrcp_state_machine_t *state_machine);
-};
-
-/** Initialize MRCP state machine */
-static APR_INLINE void mrcp_state_machine_init(mrcp_state_machine_t *state_machine, void *obj)
-{
- state_machine->obj = obj;
- state_machine->active = TRUE;
- state_machine->on_dispatch = NULL;
- state_machine->on_deactivate = NULL;
- state_machine->update = NULL;
- state_machine->deactivate = NULL;
-}
-
-/** Update MRCP state machine */
-static APR_INLINE apt_bool_t mrcp_state_machine_update(mrcp_state_machine_t *state_machine, mrcp_message_t *message)
-{
- if(state_machine->update) {
- return state_machine->update(state_machine,message);
- }
- return FALSE;
-}
-
-/** Deactivate MRCP state machine */
-static APR_INLINE apt_bool_t mrcp_state_machine_deactivate(mrcp_state_machine_t *state_machine)
-{
- if(state_machine->deactivate) {
- state_machine->active = FALSE;
- return state_machine->deactivate(state_machine);
- }
- return FALSE;
-}
-
-APT_END_EXTERN_C
-
-#endif /* MRCP_STATE_MACHINE_H */
diff --git a/libs/unimrcp/libs/mrcp-engine/include/mrcp_synth_engine.h b/libs/unimrcp/libs/mrcp-engine/include/mrcp_synth_engine.h
deleted file mode 100644
index 0536ef4b4b..0000000000
--- a/libs/unimrcp/libs/mrcp-engine/include/mrcp_synth_engine.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_synth_engine.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MRCP_SYNTH_ENGINE_H
-#define MRCP_SYNTH_ENGINE_H
-
-/**
- * @file mrcp_synth_engine.h
- * @brief Synthesizer Engine Includes
- */
-
-#include "mrcp_engine_plugin.h"
-#include "mrcp_engine_impl.h"
-
-#include "mrcp_synth_resource.h"
-#include "mrcp_synth_header.h"
-#include "mrcp_generic_header.h"
-#include "mrcp_message.h"
-
-#endif /* MRCP_SYNTH_ENGINE_H */
diff --git a/libs/unimrcp/libs/mrcp-engine/include/mrcp_synth_state_machine.h b/libs/unimrcp/libs/mrcp-engine/include/mrcp_synth_state_machine.h
deleted file mode 100644
index 2ddc1ac069..0000000000
--- a/libs/unimrcp/libs/mrcp-engine/include/mrcp_synth_state_machine.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_synth_state_machine.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MRCP_SYNTH_STATE_MACHINE_H
-#define MRCP_SYNTH_STATE_MACHINE_H
-
-/**
- * @file mrcp_synth_state_machine.h
- * @brief MRCP Synthesizer State Machine
- */
-
-#include "mrcp_state_machine.h"
-
-APT_BEGIN_EXTERN_C
-
-/** Create MRCP synthesizer state machine */
-mrcp_state_machine_t* mrcp_synth_state_machine_create(void *obj, mrcp_version_e version, apr_pool_t *pool);
-
-APT_END_EXTERN_C
-
-#endif /* MRCP_SYNTH_STATE_MACHINE_H */
diff --git a/libs/unimrcp/libs/mrcp-engine/include/mrcp_verifier_engine.h b/libs/unimrcp/libs/mrcp-engine/include/mrcp_verifier_engine.h
deleted file mode 100644
index e741209c27..0000000000
--- a/libs/unimrcp/libs/mrcp-engine/include/mrcp_verifier_engine.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_verifier_engine.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MRCP_VERIFIER_ENGINE_H
-#define MRCP_VERIFIER_ENGINE_H
-
-/**
- * @file mrcp_verifier_engine.h
- * @brief Verifier Engine Includes
- */
-
-#include "mrcp_engine_plugin.h"
-#include "mrcp_engine_impl.h"
-
-#include "mrcp_verifier_resource.h"
-#include "mrcp_verifier_header.h"
-#include "mrcp_generic_header.h"
-#include "mrcp_message.h"
-
-#endif /* MRCP_VERIFIER_ENGINE_H */
diff --git a/libs/unimrcp/libs/mrcp-engine/include/mrcp_verifier_state_machine.h b/libs/unimrcp/libs/mrcp-engine/include/mrcp_verifier_state_machine.h
deleted file mode 100644
index a4b320a87d..0000000000
--- a/libs/unimrcp/libs/mrcp-engine/include/mrcp_verifier_state_machine.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_verifier_state_machine.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MRCP_VERIFIER_STATE_MACHINE_H
-#define MRCP_VERIFIER_STATE_MACHINE_H
-
-/**
- * @file mrcp_verifier_state_machine.h
- * @brief MRCP Verifier State Machine
- */
-
-#include "mrcp_state_machine.h"
-
-APT_BEGIN_EXTERN_C
-
-/** Create MRCP verifier state machine */
-mrcp_state_machine_t* mrcp_verifier_state_machine_create(void *obj, mrcp_version_e version, apr_pool_t *pool);
-
-APT_END_EXTERN_C
-
-#endif /* MRCP_VERIFIER_STATE_MACHINE_H */
diff --git a/libs/unimrcp/libs/mrcp-engine/mrcpengine.vcproj b/libs/unimrcp/libs/mrcp-engine/mrcpengine.vcproj
deleted file mode 100644
index 8966705a4e..0000000000
--- a/libs/unimrcp/libs/mrcp-engine/mrcpengine.vcproj
+++ /dev/null
@@ -1,348 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/libs/unimrcp/libs/mrcp-engine/mrcpengine.vcxproj b/libs/unimrcp/libs/mrcp-engine/mrcpengine.vcxproj
deleted file mode 100644
index 1288995027..0000000000
--- a/libs/unimrcp/libs/mrcp-engine/mrcpengine.vcxproj
+++ /dev/null
@@ -1,142 +0,0 @@
-
-
-
-
- Debug
- Win32
-
-
- Debug
- x64
-
-
- Release
- Win32
-
-
- Release
- x64
-
-
-
- {843425BE-9A9A-44F4-A4E3-4B57D6ABD53C}
- mrcpengine
- Win32Proj
-
-
-
- StaticLibrary
- Unicode
- true
-
-
- StaticLibrary
- Unicode
-
-
- StaticLibrary
- Unicode
- true
-
-
- StaticLibrary
- Unicode
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <_ProjectFileVersion>10.0.30319.1
- AllRules.ruleset
-
-
- AllRules.ruleset
-
-
- AllRules.ruleset
-
-
- AllRules.ruleset
-
-
-
-
-
- X64
-
-
- ProgramDatabase
-
-
-
-
- X64
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {b5a00bfa-6083-4fae-a097-71642d6473b5}
- false
-
-
- {1c320193-46a6-4b34-9c56-8ab584fc1b56}
- false
-
-
-
-
-
-
\ No newline at end of file
diff --git a/libs/unimrcp/libs/mrcp-engine/mrcpengine.vcxproj.filters b/libs/unimrcp/libs/mrcp-engine/mrcpengine.vcxproj.filters
deleted file mode 100644
index 33be90e794..0000000000
--- a/libs/unimrcp/libs/mrcp-engine/mrcpengine.vcxproj.filters
+++ /dev/null
@@ -1,89 +0,0 @@
-
-
-
-
- {93995380-89BD-4b04-88EB-625FBE52EBFB}
- h;hpp;hxx;hm;inl;inc;xsd
-
-
- {dd062ad2-9a06-4efc-8e17-328567b52854}
- cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
-
-
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
-
\ No newline at end of file
diff --git a/libs/unimrcp/libs/mrcp-engine/src/mrcp_engine_factory.c b/libs/unimrcp/libs/mrcp-engine/src/mrcp_engine_factory.c
deleted file mode 100644
index 5c20286fff..0000000000
--- a/libs/unimrcp/libs/mrcp-engine/src/mrcp_engine_factory.c
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_engine_factory.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include
-#include "mrcp_engine_factory.h"
-#include "mrcp_synth_state_machine.h"
-#include "mrcp_recog_state_machine.h"
-#include "mrcp_recorder_state_machine.h"
-#include "mrcp_verifier_state_machine.h"
-#include "apt_log.h"
-
-/** Engine factory declaration */
-struct mrcp_engine_factory_t {
- apr_hash_t *engines;
- apr_pool_t *pool;
-};
-
-
-MRCP_DECLARE(mrcp_engine_factory_t*) mrcp_engine_factory_create(apr_pool_t *pool)
-{
- mrcp_engine_factory_t *factory = apr_palloc(pool,sizeof(mrcp_engine_factory_t));
- factory->pool = pool;
- factory->engines = apr_hash_make(pool);
- return factory;
-}
-
-/** Destroy registered engines and the factory */
-MRCP_DECLARE(apt_bool_t) mrcp_engine_factory_destroy(mrcp_engine_factory_t *factory)
-{
- mrcp_engine_t *engine;
- apr_hash_index_t *it;
- void *val;
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Destroy MRCP Engines");
- it=apr_hash_first(factory->pool,factory->engines);
- for(; it; it = apr_hash_next(it)) {
- apr_hash_this(it,NULL,NULL,&val);
- engine = val;
- if(engine) {
- mrcp_engine_virtual_destroy(engine);
- }
- }
- apr_hash_clear(factory->engines);
- return TRUE;
-}
-
-/** Open registered engines */
-MRCP_DECLARE(apt_bool_t) mrcp_engine_factory_open(mrcp_engine_factory_t *factory)
-{
- mrcp_engine_t *engine;
- apr_hash_index_t *it;
- void *val;
- it = apr_hash_first(factory->pool,factory->engines);
- for(; it; it = apr_hash_next(it)) {
- apr_hash_this(it,NULL,NULL,&val);
- engine = val;
- if(engine) {
- mrcp_engine_virtual_open(engine);
- }
- }
- return TRUE;
-}
-
-/** Close registered engines */
-MRCP_DECLARE(apt_bool_t) mrcp_engine_factory_close(mrcp_engine_factory_t *factory)
-{
- mrcp_engine_t *engine;
- apr_hash_index_t *it;
- void *val;
- it=apr_hash_first(factory->pool,factory->engines);
- for(; it; it = apr_hash_next(it)) {
- apr_hash_this(it,NULL,NULL,&val);
- engine = val;
- if(engine) {
- mrcp_engine_virtual_close(engine);
- }
- }
- return TRUE;
-}
-
-/** Register new engine */
-MRCP_DECLARE(apt_bool_t) mrcp_engine_factory_engine_register(mrcp_engine_factory_t *factory, mrcp_engine_t *engine)
-{
- if(!engine || !engine->id) {
- return FALSE;
- }
-
- switch(engine->resource_id) {
- case MRCP_SYNTHESIZER_RESOURCE:
- engine->create_state_machine = mrcp_synth_state_machine_create;
- break;
- case MRCP_RECOGNIZER_RESOURCE:
- engine->create_state_machine = mrcp_recog_state_machine_create;
- break;
- case MRCP_RECORDER_RESOURCE:
- engine->create_state_machine = mrcp_recorder_state_machine_create;
- break;
- case MRCP_VERIFIER_RESOURCE:
- engine->create_state_machine = mrcp_verifier_state_machine_create;
- break;
- default:
- break;
- }
-
- if(!engine->create_state_machine) {
- return FALSE;
- }
-
- apr_hash_set(factory->engines,engine->id,APR_HASH_KEY_STRING,engine);
- return TRUE;
-}
-
-/** Get engine by name */
-MRCP_DECLARE(mrcp_engine_t*) mrcp_engine_factory_engine_get(const mrcp_engine_factory_t *factory, const char *name)
-{
- if(!name) {
- return NULL;
- }
- return apr_hash_get(factory->engines,name,APR_HASH_KEY_STRING);
-}
-
-/** Find engine by resource identifier */
-MRCP_DECLARE(mrcp_engine_t*) mrcp_engine_factory_engine_find(const mrcp_engine_factory_t *factory, mrcp_resource_id resource_id)
-{
- mrcp_engine_t *engine;
- void *val;
- apr_hash_index_t *it = apr_hash_first(factory->pool,factory->engines);
- /* walk through the engines */
- for(; it; it = apr_hash_next(it)) {
- apr_hash_this(it,NULL,NULL,&val);
- engine = val;
- if(engine && engine->resource_id == resource_id) {
- return engine;
- }
- }
- return NULL;
-}
-
-/** Start iterating over the engines in a factory */
-MRCP_DECLARE(apr_hash_index_t*) mrcp_engine_factory_engine_first(const mrcp_engine_factory_t *factory)
-{
- return apr_hash_first(factory->pool,factory->engines);
-}
diff --git a/libs/unimrcp/libs/mrcp-engine/src/mrcp_engine_iface.c b/libs/unimrcp/libs/mrcp-engine/src/mrcp_engine_iface.c
deleted file mode 100644
index daea6039c8..0000000000
--- a/libs/unimrcp/libs/mrcp-engine/src/mrcp_engine_iface.c
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_engine_iface.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include "mrcp_engine_iface.h"
-#include "apt_log.h"
-
-/** Destroy engine */
-apt_bool_t mrcp_engine_virtual_destroy(mrcp_engine_t *engine)
-{
- return engine->method_vtable->destroy(engine);
-}
-
-/** Open engine */
-apt_bool_t mrcp_engine_virtual_open(mrcp_engine_t *engine)
-{
- if(engine->is_open == FALSE) {
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Open Engine [%s]",engine->id);
- return engine->method_vtable->open(engine);
- }
- return FALSE;
-}
-
-/** Response to open engine request */
-void mrcp_engine_on_open(mrcp_engine_t *engine, apt_bool_t status)
-{
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Engine Opened [%s] status [%s]",
- engine->id,
- status == TRUE ? "success" : "failure");
- engine->is_open = status;
-}
-
-/** Close engine */
-apt_bool_t mrcp_engine_virtual_close(mrcp_engine_t *engine)
-{
- if(engine->is_open == TRUE) {
- engine->is_open = FALSE;
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Close Engine [%s]",engine->id);
- return engine->method_vtable->close(engine);
- }
- return FALSE;
-}
-
-/** Response to close engine request */
-void mrcp_engine_on_close(mrcp_engine_t *engine)
-{
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Engine Closed [%s]",engine->id);
- engine->is_open = FALSE;
-}
-
-/** Create engine channel */
-mrcp_engine_channel_t* mrcp_engine_channel_virtual_create(mrcp_engine_t *engine, mrcp_version_e mrcp_version, apr_pool_t *pool)
-{
- mrcp_engine_channel_t *channel;
- if(engine->is_open != TRUE) {
- return NULL;
- }
- if(engine->config->max_channel_count && engine->cur_channel_count >= engine->config->max_channel_count) {
- apt_log(APT_LOG_MARK, APT_PRIO_NOTICE, "Maximum channel count %"APR_SIZE_T_FMT" exceeded for engine [%s]",
- engine->config->max_channel_count, engine->id);
- return NULL;
- }
- channel = engine->method_vtable->create_channel(engine,pool);
- if(channel) {
- channel->mrcp_version = mrcp_version;
- engine->cur_channel_count++;
- }
- return channel;
-}
-
-/** Destroy engine channel */
-apt_bool_t mrcp_engine_channel_virtual_destroy(mrcp_engine_channel_t *channel)
-{
- mrcp_engine_t *engine = channel->engine;
- if(engine->cur_channel_count) {
- engine->cur_channel_count--;
- }
- return channel->method_vtable->destroy(channel);
-}
-
-/** Allocate engine config */
-mrcp_engine_config_t* mrcp_engine_config_alloc(apr_pool_t *pool)
-{
- mrcp_engine_config_t *config = apr_palloc(pool,sizeof(mrcp_engine_config_t));
- config->max_channel_count = 0;
- config->params = NULL;
- return config;
-}
diff --git a/libs/unimrcp/libs/mrcp-engine/src/mrcp_engine_impl.c b/libs/unimrcp/libs/mrcp-engine/src/mrcp_engine_impl.c
deleted file mode 100644
index 2e536e18b4..0000000000
--- a/libs/unimrcp/libs/mrcp-engine/src/mrcp_engine_impl.c
+++ /dev/null
@@ -1,246 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_engine_impl.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include "mrcp_engine_impl.h"
-#include "mpf_termination_factory.h"
-
-/** Create engine */
-mrcp_engine_t* mrcp_engine_create(
- mrcp_resource_id resource_id,
- void *obj,
- const mrcp_engine_method_vtable_t *vtable,
- apr_pool_t *pool)
-{
- mrcp_engine_t *engine = apr_palloc(pool,sizeof(mrcp_engine_t));
- engine->id = NULL;
- engine->resource_id = resource_id;
- engine->obj = obj;
- engine->method_vtable =vtable;
- engine->event_vtable = NULL;
- engine->event_obj = NULL;
- engine->config = NULL;
- engine->codec_manager = NULL;
- engine->dir_layout = NULL;
- engine->cur_channel_count = 0;
- engine->is_open = FALSE;
- engine->pool = pool;
- engine->create_state_machine = NULL;
- return engine;
-}
-
-/** Get engine config */
-const mrcp_engine_config_t* mrcp_engine_config_get(const mrcp_engine_t *engine)
-{
- return engine->config;
-}
-
-/** Get engine param by name */
-const char* mrcp_engine_param_get(const mrcp_engine_t *engine, const char *name)
-{
- if(!engine->config || !engine->config->params) {
- return NULL;
- }
- return apr_table_get(engine->config->params,name);
-}
-
-/** Create engine channel */
-mrcp_engine_channel_t* mrcp_engine_channel_create(
- mrcp_engine_t *engine,
- const mrcp_engine_channel_method_vtable_t *method_vtable,
- void *method_obj,
- mpf_termination_t *termination,
- apr_pool_t *pool)
-{
- mrcp_engine_channel_t *channel = apr_palloc(pool,sizeof(mrcp_engine_channel_t));
- channel->method_vtable = method_vtable;
- channel->method_obj = method_obj;
- channel->event_vtable = NULL;
- channel->event_obj = NULL;
- channel->termination = termination;
- channel->engine = engine;
- channel->is_open = FALSE;
- channel->pool = pool;
- apt_string_reset(&channel->id);
- return channel;
-}
-
-/** Create audio termination */
-mpf_termination_t* mrcp_engine_audio_termination_create(
- void *obj,
- const mpf_audio_stream_vtable_t *stream_vtable,
- mpf_stream_capabilities_t *capabilities,
- apr_pool_t *pool)
-{
- mpf_audio_stream_t *audio_stream;
- if(!capabilities) {
- return NULL;
- }
-
- if(mpf_codec_capabilities_validate(&capabilities->codecs) == FALSE) {
- return NULL;
- }
-
- /* create audio stream */
- audio_stream = mpf_audio_stream_create(
- obj, /* object to associate */
- stream_vtable, /* virtual methods table of audio stream */
- capabilities, /* stream capabilities */
- pool); /* pool to allocate memory from */
-
- if(!audio_stream) {
- return NULL;
- }
-
- /* create media termination */
- return mpf_raw_termination_create(
- NULL, /* no object to associate */
- audio_stream, /* audio stream */
- NULL, /* no video stream */
- pool); /* pool to allocate memory from */
-}
-
-
-/** Create engine channel and source media termination */
-mrcp_engine_channel_t* mrcp_engine_source_channel_create(
- mrcp_engine_t *engine,
- const mrcp_engine_channel_method_vtable_t *channel_vtable,
- const mpf_audio_stream_vtable_t *stream_vtable,
- void *method_obj,
- mpf_codec_descriptor_t *codec_descriptor,
- apr_pool_t *pool)
-{
- mpf_stream_capabilities_t *capabilities;
- mpf_audio_stream_t *audio_stream;
- mpf_termination_t *termination;
-
- capabilities = mpf_source_stream_capabilities_create(pool);
- if(codec_descriptor) {
- mpf_codec_capabilities_add(
- &capabilities->codecs,
- mpf_sample_rate_mask_get(codec_descriptor->sampling_rate),
- codec_descriptor->name.buf);
- }
- else {
- mpf_codec_default_capabilities_add(&capabilities->codecs);
- }
-
- /* create audio stream */
- audio_stream = mpf_audio_stream_create(
- method_obj, /* object to associate */
- stream_vtable, /* virtual methods table of audio stream */
- capabilities, /* stream capabilities */
- pool); /* pool to allocate memory from */
-
- if(!audio_stream) {
- return NULL;
- }
-
- audio_stream->rx_descriptor = codec_descriptor;
-
- /* create media termination */
- termination = mpf_raw_termination_create(
- NULL, /* no object to associate */
- audio_stream, /* audio stream */
- NULL, /* no video stream */
- pool); /* pool to allocate memory from */
-
- /* create engine channel base */
- return mrcp_engine_channel_create(
- engine, /* engine */
- channel_vtable, /* virtual methods table of engine channel */
- method_obj, /* object to associate */
- termination, /* media termination, used to terminate audio stream */
- pool); /* pool to allocate memory from */
-}
-
-/** Create engine channel and sink media termination */
-mrcp_engine_channel_t* mrcp_engine_sink_channel_create(
- mrcp_engine_t *engine,
- const mrcp_engine_channel_method_vtable_t *channel_vtable,
- const mpf_audio_stream_vtable_t *stream_vtable,
- void *method_obj,
- mpf_codec_descriptor_t *codec_descriptor,
- apr_pool_t *pool)
-{
- mpf_stream_capabilities_t *capabilities;
- mpf_audio_stream_t *audio_stream;
- mpf_termination_t *termination;
-
- capabilities = mpf_sink_stream_capabilities_create(pool);
- if(codec_descriptor) {
- mpf_codec_capabilities_add(
- &capabilities->codecs,
- mpf_sample_rate_mask_get(codec_descriptor->sampling_rate),
- codec_descriptor->name.buf);
- }
- else {
- mpf_codec_default_capabilities_add(&capabilities->codecs);
- }
-
- /* create audio stream */
- audio_stream = mpf_audio_stream_create(
- method_obj, /* object to associate */
- stream_vtable, /* virtual methods table of audio stream */
- capabilities, /* stream capabilities */
- pool); /* pool to allocate memory from */
-
- if(!audio_stream) {
- return NULL;
- }
-
- audio_stream->tx_descriptor = codec_descriptor;
-
- /* create media termination */
- termination = mpf_raw_termination_create(
- NULL, /* no object to associate */
- audio_stream, /* audio stream */
- NULL, /* no video stream */
- pool); /* pool to allocate memory from */
-
- /* create engine channel base */
- return mrcp_engine_channel_create(
- engine, /* engine */
- channel_vtable, /* virtual methods table of engine channel */
- method_obj, /* object to associate */
- termination, /* media termination, used to terminate audio stream */
- pool); /* pool to allocate memory from */
-}
-
-/** Get codec descriptor of the audio source stream */
-const mpf_codec_descriptor_t* mrcp_engine_source_stream_codec_get(const mrcp_engine_channel_t *channel)
-{
- if(channel && channel->termination) {
- mpf_audio_stream_t *audio_stream = mpf_termination_audio_stream_get(channel->termination);
- if(audio_stream) {
- return audio_stream->rx_descriptor;
- }
- }
- return NULL;
-}
-
-/** Get codec descriptor of the audio sink stream */
-const mpf_codec_descriptor_t* mrcp_engine_sink_stream_codec_get(const mrcp_engine_channel_t *channel)
-{
- if(channel && channel->termination) {
- mpf_audio_stream_t *audio_stream = mpf_termination_audio_stream_get(channel->termination);
- if(audio_stream) {
- return audio_stream->tx_descriptor;
- }
- }
- return NULL;
-}
diff --git a/libs/unimrcp/libs/mrcp-engine/src/mrcp_engine_loader.c b/libs/unimrcp/libs/mrcp-engine/src/mrcp_engine_loader.c
deleted file mode 100644
index 45996cce7e..0000000000
--- a/libs/unimrcp/libs/mrcp-engine/src/mrcp_engine_loader.c
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_engine_loader.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include
-#include
-#include "mrcp_engine_loader.h"
-#include "mrcp_engine_plugin.h"
-#include "apt_log.h"
-
-/** Engine loader declaration */
-struct mrcp_engine_loader_t {
- /** Table of plugins (apr_dso_handle_t*) */
- apr_hash_t *plugins;
- apr_pool_t *pool;
-};
-
-
-/** Create engine loader */
-MRCP_DECLARE(mrcp_engine_loader_t*) mrcp_engine_loader_create(apr_pool_t *pool)
-{
- mrcp_engine_loader_t *loader = apr_palloc(pool,sizeof(mrcp_engine_loader_t));
- loader->pool = pool;
- loader->plugins = apr_hash_make(pool);
- return loader;
-}
-
-/** Destroy engine loader */
-MRCP_DECLARE(apt_bool_t) mrcp_engine_loader_destroy(mrcp_engine_loader_t *loader)
-{
- return mrcp_engine_loader_plugins_unload(loader);
-}
-
-/** Unload loaded plugins */
-MRCP_DECLARE(apt_bool_t) mrcp_engine_loader_plugins_unload(mrcp_engine_loader_t *loader)
-{
- apr_hash_index_t *it;
- void *val;
- apr_dso_handle_t *plugin;
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Unload Plugins");
- it=apr_hash_first(loader->pool,loader->plugins);
- for(; it; it = apr_hash_next(it)) {
- apr_hash_this(it,NULL,NULL,&val);
- plugin = val;
- if(plugin) {
- apr_dso_unload(plugin);
- }
- }
- apr_hash_clear(loader->plugins);
- return TRUE;
-}
-
-static apt_bool_t plugin_version_load(apr_dso_handle_t *plugin)
-{
- apr_dso_handle_sym_t version_handle = NULL;
- if(apr_dso_sym(&version_handle,plugin,MRCP_PLUGIN_VERSION_SYM_NAME) != APR_SUCCESS) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"No Version Info Found: %s", MRCP_PLUGIN_VERSION_SYM_NAME);
- return FALSE;
- }
-
- if(version_handle) {
- mrcp_plugin_version_t *version = (mrcp_plugin_version_t*)version_handle;
- if(mrcp_plugin_version_check(version)) {
- return TRUE;
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Incompatible Plugin Version Found [%d.%d.%d] < ["PLUGIN_VERSION_STRING"]",
- version->major,
- version->minor,
- version->patch);
- }
- }
- return FALSE;
-}
-
-static mrcp_plugin_creator_f plugin_creator_load(apr_dso_handle_t *plugin)
-{
- apr_dso_handle_sym_t func_handle = NULL;
- mrcp_plugin_creator_f plugin_creator = NULL;
-
- if(apr_dso_sym(&func_handle,plugin,MRCP_PLUGIN_ENGINE_SYM_NAME) == APR_SUCCESS) {
- if(func_handle) {
- plugin_creator = (mrcp_plugin_creator_f)(intptr_t)func_handle;
- }
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Load DSO Symbol: "MRCP_PLUGIN_ENGINE_SYM_NAME);
- return NULL;
- }
-
- return plugin_creator;
-}
-
-static apt_bool_t plugin_logger_load(apr_dso_handle_t *plugin)
-{
- apr_dso_handle_sym_t func_handle = NULL;
- if(apr_dso_sym(&func_handle,plugin,MRCP_PLUGIN_LOGGER_SYM_NAME) != APR_SUCCESS) {
- return FALSE;
- }
-
- if(func_handle) {
- apt_logger_t *logger = apt_log_instance_get();
- mrcp_plugin_log_accessor_f log_accessor;
- log_accessor = (mrcp_plugin_log_accessor_f)(intptr_t)func_handle;
- log_accessor(logger);
- }
- return TRUE;
-}
-
-
-/** Load engine plugin */
-MRCP_DECLARE(mrcp_engine_t*) mrcp_engine_loader_plugin_load(mrcp_engine_loader_t *loader, const char *id, const char *path, mrcp_engine_config_t *config)
-{
- apr_dso_handle_t *plugin = NULL;
- mrcp_plugin_creator_f plugin_creator = NULL;
- mrcp_engine_t *engine = NULL;
- if(!path || !id) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Load Plugin: invalid params");
- return NULL;
- }
-
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Load Plugin [%s] [%s]",id,path);
- if(apr_dso_load(&plugin,path,loader->pool) != APR_SUCCESS) {
- char derr[512] = "";
- apr_dso_error(plugin,derr,sizeof(derr));
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Load DSO: %s", derr);
- return NULL;
- }
-
- if(plugin_version_load(plugin) != TRUE) {
- apr_dso_unload(plugin);
- return NULL;
- }
-
- plugin_creator = plugin_creator_load(plugin);
- if(!plugin_creator) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"No Entry Point Found for Plugin");
- apr_dso_unload(plugin);
- return NULL;
- }
-
- plugin_logger_load(plugin);
-
- apr_hash_set(loader->plugins,id,APR_HASH_KEY_STRING,plugin);
-
- engine = plugin_creator(loader->pool);
- if(!engine) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create MRCP Engine");
- return NULL;
- }
-
- engine->id = id;
- engine->config = config;
- return engine;
-}
diff --git a/libs/unimrcp/libs/mrcp-engine/src/mrcp_recog_state_machine.c b/libs/unimrcp/libs/mrcp-engine/src/mrcp_recog_state_machine.c
deleted file mode 100644
index f205d2ea78..0000000000
--- a/libs/unimrcp/libs/mrcp-engine/src/mrcp_recog_state_machine.c
+++ /dev/null
@@ -1,553 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_recog_state_machine.c 2228 2014-11-12 01:18:27Z achaloyan@gmail.com $
- */
-
-#include "apt_obj_list.h"
-#include "apt_log.h"
-#include "mrcp_state_machine.h"
-#include "mrcp_recog_state_machine.h"
-#include "mrcp_recog_header.h"
-#include "mrcp_generic_header.h"
-#include "mrcp_recog_resource.h"
-#include "mrcp_message.h"
-
-/** MRCP recognizer states */
-typedef enum {
- RECOGNIZER_STATE_IDLE,
- RECOGNIZER_STATE_RECOGNIZING,
- RECOGNIZER_STATE_RECOGNIZED,
-
- RECOGNIZER_STATE_COUNT
-} mrcp_recog_state_e;
-
-static const char * state_names[RECOGNIZER_STATE_COUNT] = {
- "IDLE",
- "RECOGNIZING",
- "RECOGNIZED"
-};
-
-typedef struct mrcp_recog_state_machine_t mrcp_recog_state_machine_t;
-struct mrcp_recog_state_machine_t {
- /** state machine base */
- mrcp_state_machine_t base;
- /** recognizer state */
- mrcp_recog_state_e state;
- /** indicate whether active_request was processed from pending request queue */
- apt_bool_t is_pending;
- /** request sent to recognition engine and waiting for the response to be received */
- mrcp_message_t *active_request;
- /** in-progress recognize request */
- mrcp_message_t *recog;
- /** queue of pending recognition requests */
- apt_obj_list_t *queue;
- /** properties used in set/get params */
- mrcp_message_header_t *properties;
-};
-
-typedef apt_bool_t (*recog_method_f)(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message);
-
-static APR_INLINE apt_bool_t recog_request_dispatch(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message)
-{
- state_machine->active_request = message;
- return state_machine->base.on_dispatch(&state_machine->base,message);
-}
-
-static APR_INLINE apt_bool_t recog_response_dispatch(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message)
-{
- state_machine->active_request = NULL;
- if(state_machine->base.active == FALSE) {
- /* this is the response to deactivation (STOP) request */
- return state_machine->base.on_deactivate(&state_machine->base);
- }
- return state_machine->base.on_dispatch(&state_machine->base,message);
-}
-
-static APR_INLINE apt_bool_t recog_event_dispatch(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message)
-{
- if(state_machine->base.active == FALSE) {
- /* do nothing, state machine has already been deactivated */
- return FALSE;
- }
- return state_machine->base.on_dispatch(&state_machine->base,message);
-}
-
-static APR_INLINE void recog_state_change(mrcp_recog_state_machine_t *state_machine, mrcp_recog_state_e state, mrcp_message_t *message)
-{
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"State Transition %s -> %s "APT_SIDRES_FMT,
- state_names[state_machine->state],
- state_names[state],
- MRCP_MESSAGE_SIDRES(message));
- state_machine->state = state;
- if(state == RECOGNIZER_STATE_IDLE) {
- state_machine->recog = NULL;
- }
-}
-
-
-static apt_bool_t recog_request_set_params(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message)
-{
- mrcp_header_fields_set(state_machine->properties,&message->header,message->pool);
- return recog_request_dispatch(state_machine,message);
-}
-
-static apt_bool_t recog_response_set_params(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message)
-{
- return recog_response_dispatch(state_machine,message);
-}
-
-static apt_bool_t recog_request_get_params(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message)
-{
- return recog_request_dispatch(state_machine,message);
-}
-
-static apt_bool_t recog_response_get_params(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message)
-{
- mrcp_header_fields_get(&message->header,state_machine->properties,&state_machine->active_request->header,message->pool);
- return recog_response_dispatch(state_machine,message);
-}
-
-static apt_bool_t recog_request_define_grammar(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message)
-{
- if(state_machine->state == RECOGNIZER_STATE_RECOGNIZING) {
- mrcp_message_t *response_message = mrcp_response_create(message,message->pool);
- response_message->start_line.status_code = MRCP_STATUS_CODE_METHOD_NOT_VALID;
- return recog_response_dispatch(state_machine,response_message);
- }
- else if(state_machine->state == RECOGNIZER_STATE_RECOGNIZED) {
- recog_state_change(state_machine,RECOGNIZER_STATE_IDLE,message);
- }
-
- return recog_request_dispatch(state_machine,message);
-}
-
-static apt_bool_t recog_response_define_grammar(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message)
-{
- if(mrcp_resource_header_property_check(message,RECOGNIZER_HEADER_COMPLETION_CAUSE) != TRUE) {
- mrcp_recog_header_t *recog_header = mrcp_resource_header_prepare(message);
- recog_header->completion_cause = RECOGNIZER_COMPLETION_CAUSE_SUCCESS;
- mrcp_resource_header_property_add(message,RECOGNIZER_HEADER_COMPLETION_CAUSE);
- }
- return recog_response_dispatch(state_machine,message);
-}
-
-static apt_bool_t recog_request_recognize(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message)
-{
- mrcp_header_fields_inherit(&message->header,state_machine->properties,message->pool);
- if(state_machine->state == RECOGNIZER_STATE_RECOGNIZING) {
- mrcp_message_t *response;
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Queue Up RECOGNIZE Request "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]",
- MRCP_MESSAGE_SIDRES(message),
- message->start_line.request_id);
- message->start_line.request_state = MRCP_REQUEST_STATE_PENDING;
- apt_list_push_back(state_machine->queue,message,message->pool);
-
- response = mrcp_response_create(message,message->pool);
- response->start_line.request_state = MRCP_REQUEST_STATE_PENDING;
- return recog_response_dispatch(state_machine,response);
- }
-
- return recog_request_dispatch(state_machine,message);
-}
-
-static apt_bool_t recog_response_recognize(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message)
-{
- if(message->start_line.request_state == MRCP_REQUEST_STATE_INPROGRESS) {
- state_machine->recog = state_machine->active_request;
- recog_state_change(state_machine,RECOGNIZER_STATE_RECOGNIZING,message);
- }
- if(state_machine->is_pending == TRUE) {
- state_machine->is_pending = FALSE;
- /* not to send the response for pending request */
- return TRUE;
- }
- return recog_response_dispatch(state_machine,message);
-}
-
-static apt_bool_t recog_request_interpret(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message)
-{
- mrcp_header_fields_inherit(&message->header,state_machine->properties,message->pool);
- return recog_request_dispatch(state_machine,message);
-}
-
-static apt_bool_t recog_response_interpret(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message)
-{
- return recog_response_dispatch(state_machine,message);
-}
-
-static apt_bool_t recog_request_get_result(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message)
-{
- mrcp_message_t *response_message;
- if(state_machine->state == RECOGNIZER_STATE_RECOGNIZED) {
- /* found recognized request */
- return recog_request_dispatch(state_machine,message);
- }
-
- /* found no recognized request */
- response_message = mrcp_response_create(message,message->pool);
- response_message->start_line.status_code = MRCP_STATUS_CODE_METHOD_NOT_VALID;
- return recog_response_dispatch(state_machine,response_message);
-}
-
-static apt_bool_t recog_response_get_result(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message)
-{
- return recog_response_dispatch(state_machine,message);
-}
-
-static apt_bool_t recog_request_recognition_start_timers(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message)
-{
- mrcp_message_t *response_message;
- if(state_machine->state == RECOGNIZER_STATE_RECOGNIZING) {
- /* found in-progress request */
- return recog_request_dispatch(state_machine,message);
- }
-
- /* found no in-progress request */
- response_message = mrcp_response_create(message,message->pool);
- response_message->start_line.status_code = MRCP_STATUS_CODE_METHOD_NOT_VALID;
- return recog_response_dispatch(state_machine,response_message);
-}
-
-static apt_bool_t recog_response_recognition_start_timers(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message)
-{
- return recog_response_dispatch(state_machine,message);
-}
-
-static apt_bool_t recog_pending_requests_remove(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *request_message, mrcp_message_t *response_message)
-{
- apt_list_elem_t *elem;
- mrcp_message_t *pending_message;
- mrcp_request_id_list_t *request_id_list = NULL;
- mrcp_generic_header_t *generic_header = mrcp_generic_header_get(request_message);
- mrcp_generic_header_t *response_generic_header = mrcp_generic_header_prepare(response_message);
- if(generic_header && mrcp_generic_header_property_check(request_message,GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST) == TRUE) {
- if(generic_header->active_request_id_list.count) {
- /* selective STOP request */
- request_id_list = &generic_header->active_request_id_list;
- }
- }
-
- elem = apt_list_first_elem_get(state_machine->queue);
- while(elem) {
- pending_message = apt_list_elem_object_get(elem);
- if(!request_id_list || active_request_id_list_find(generic_header,pending_message->start_line.request_id) == TRUE) {
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Remove Pending RECOGNIZE Request "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]",
- MRCP_MESSAGE_SIDRES(pending_message),
- pending_message->start_line.request_id);
- elem = apt_list_elem_remove(state_machine->queue,elem);
- /* append active id list */
- active_request_id_list_append(response_generic_header,pending_message->start_line.request_id);
- }
- else {
- /* speak request remains in the queue, just proceed to the next one */
- elem = apt_list_next_elem_get(state_machine->queue,elem);
- }
- }
- if(response_generic_header->active_request_id_list.count) {
- mrcp_generic_header_property_add(response_message,GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST);
- }
- return TRUE;
-}
-
-static apt_bool_t recog_request_stop(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message)
-{
- mrcp_message_t *response_message;
- if(state_machine->state == RECOGNIZER_STATE_RECOGNIZING) {
- mrcp_request_id_list_t *request_id_list = NULL;
- mrcp_generic_header_t *generic_header = mrcp_generic_header_get(message);
- if(generic_header && mrcp_generic_header_property_check(message,GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST) == TRUE) {
- if(generic_header->active_request_id_list.count) {
- /* selective STOP request */
- request_id_list = &generic_header->active_request_id_list;
- }
- }
-
- if(!request_id_list || active_request_id_list_find(generic_header,state_machine->recog->start_line.request_id) == TRUE) {
- /* found in-progress RECOGNIZE request, stop it */
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Found IN-PROGRESS RECOGNIZE Request "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]",
- MRCP_MESSAGE_SIDRES(message),
- message->start_line.request_id);
- return recog_request_dispatch(state_machine,message);
- }
- }
- else if(state_machine->state == RECOGNIZER_STATE_RECOGNIZED) {
- recog_state_change(state_machine,RECOGNIZER_STATE_IDLE,message);
- }
-
- /* found no in-progress RECOGNIZE request, sending immediate response */
- response_message = mrcp_response_create(message,message->pool);
- recog_pending_requests_remove(state_machine,message,response_message);
- return recog_response_dispatch(state_machine,response_message);
-}
-
-static apt_bool_t recog_response_stop(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message)
-{
- mrcp_message_t *pending_request;
- mrcp_generic_header_t *generic_header = mrcp_generic_header_prepare(message);
- /* append active id list */
- active_request_id_list_append(generic_header,state_machine->recog->start_line.request_id);
- mrcp_generic_header_property_add(message,GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST);
- recog_pending_requests_remove(state_machine,state_machine->active_request,message);
- recog_state_change(state_machine,RECOGNIZER_STATE_IDLE,message);
- pending_request = apt_list_pop_front(state_machine->queue);
- recog_response_dispatch(state_machine,message);
-
- /* process pending RECOGNIZE requests / if any */
- if(pending_request) {
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process Pending RECOGNIZE Request "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]",
- MRCP_MESSAGE_SIDRES(pending_request),
- pending_request->start_line.request_id);
- state_machine->is_pending = TRUE;
- recog_request_dispatch(state_machine,pending_request);
- }
- return TRUE;
-}
-
-static apt_bool_t recog_event_start_of_input(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message)
-{
- if(!state_machine->recog) {
- /* unexpected event, no in-progress recognition request */
- return FALSE;
- }
-
- if(state_machine->recog->start_line.request_id != message->start_line.request_id) {
- /* unexpected event */
- return FALSE;
- }
-
- message->start_line.request_state = MRCP_REQUEST_STATE_INPROGRESS;
- return recog_event_dispatch(state_machine,message);
-}
-
-static apt_bool_t recog_event_recognition_complete(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message)
-{
- mrcp_message_t *pending_request;
- if(!state_machine->recog) {
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Unexpected RECOGNITION-COMPLETE Event "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]",
- MRCP_MESSAGE_SIDRES(message),
- message->start_line.request_id);
- return FALSE;
- }
-
- if(state_machine->recog->start_line.request_id != message->start_line.request_id) {
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Unexpected RECOGNITION-COMPLETE Event "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]",
- MRCP_MESSAGE_SIDRES(message),
- message->start_line.request_id);
- return FALSE;
- }
-
- if(state_machine->active_request && state_machine->active_request->start_line.method_id == RECOGNIZER_STOP) {
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Ignore RECOGNITION-COMPLETE Event "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]: waiting for STOP response",
- MRCP_MESSAGE_SIDRES(message),
- message->start_line.request_id);
- return FALSE;
- }
-
- if(mrcp_resource_header_property_check(message,RECOGNIZER_HEADER_COMPLETION_CAUSE) != TRUE) {
- mrcp_recog_header_t *recog_header = mrcp_resource_header_prepare(message);
- recog_header->completion_cause = RECOGNIZER_COMPLETION_CAUSE_SUCCESS;
- mrcp_resource_header_property_add(message,RECOGNIZER_HEADER_COMPLETION_CAUSE);
- }
- recog_state_change(state_machine,RECOGNIZER_STATE_RECOGNIZED,message);
- recog_event_dispatch(state_machine,message);
-
- /* process pending RECOGNIZE requests */
- pending_request = apt_list_pop_front(state_machine->queue);
- if(pending_request) {
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process Pending RECOGNIZE Request "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]",
- MRCP_MESSAGE_SIDRES(pending_request),
- pending_request->start_line.request_id);
- state_machine->is_pending = TRUE;
- recog_request_dispatch(state_machine,pending_request);
- }
- return TRUE;
-}
-
-static apt_bool_t recog_event_interpretation_complete(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message)
-{
- if(mrcp_resource_header_property_check(message,RECOGNIZER_HEADER_COMPLETION_CAUSE) != TRUE) {
- mrcp_recog_header_t *recog_header = mrcp_resource_header_prepare(message);
- recog_header->completion_cause = RECOGNIZER_COMPLETION_CAUSE_SUCCESS;
- mrcp_resource_header_property_add(message,RECOGNIZER_HEADER_COMPLETION_CAUSE);
- }
- return recog_event_dispatch(state_machine,message);
-}
-
-static recog_method_f recog_request_method_array[RECOGNIZER_METHOD_COUNT] = {
- recog_request_set_params,
- recog_request_get_params,
- recog_request_define_grammar,
- recog_request_recognize,
- recog_request_interpret,
- recog_request_get_result,
- recog_request_recognition_start_timers,
- recog_request_stop
-};
-
-static recog_method_f recog_response_method_array[RECOGNIZER_METHOD_COUNT] = {
- recog_response_set_params,
- recog_response_get_params,
- recog_response_define_grammar,
- recog_response_recognize,
- recog_response_interpret,
- recog_response_get_result,
- recog_response_recognition_start_timers,
- recog_response_stop
-};
-
-static recog_method_f recog_event_method_array[RECOGNIZER_EVENT_COUNT] = {
- recog_event_start_of_input,
- recog_event_recognition_complete,
- recog_event_interpretation_complete
-};
-
-/** Update state according to received incoming request from MRCP client */
-static apt_bool_t recog_request_state_update(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message)
-{
- recog_method_f method;
- if(message->start_line.method_id >= RECOGNIZER_METHOD_COUNT) {
- return FALSE;
- }
-
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process %s Request "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]",
- message->start_line.method_name.buf,
- MRCP_MESSAGE_SIDRES(message),
- message->start_line.request_id);
- method = recog_request_method_array[message->start_line.method_id];
- if(method) {
- return method(state_machine,message);
- }
- return recog_request_dispatch(state_machine,message);
-}
-
-/** Update state according to received outgoing response from recognition engine */
-static apt_bool_t recog_response_state_update(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message)
-{
- recog_method_f method;
- if(!state_machine->active_request) {
- /* unexpected response, no active request waiting for response */
- return FALSE;
- }
- if(state_machine->active_request->start_line.request_id != message->start_line.request_id) {
- /* unexpected response, request id doesn't match */
- return FALSE;
- }
-
- if(message->start_line.method_id >= RECOGNIZER_METHOD_COUNT) {
- return FALSE;
- }
-
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process %s Response "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]",
- message->start_line.method_name.buf,
- MRCP_MESSAGE_SIDRES(message),
- message->start_line.request_id);
- method = recog_response_method_array[message->start_line.method_id];
- if(method) {
- return method(state_machine,message);
- }
- return recog_response_dispatch(state_machine,message);
-}
-
-/** Update state according to received outgoing event from recognition engine */
-static apt_bool_t recog_event_state_update(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message)
-{
- recog_method_f method;
- if(message->start_line.method_id >= RECOGNIZER_EVENT_COUNT) {
- return FALSE;
- }
-
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process %s Event "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]",
- message->start_line.method_name.buf,
- MRCP_MESSAGE_SIDRES(message),
- message->start_line.request_id);
- method = recog_event_method_array[message->start_line.method_id];
- if(method) {
- return method(state_machine,message);
- }
- return recog_event_dispatch(state_machine,message);
-}
-
-/** Update state according to request received from MRCP client or response/event received from recognition engine */
-static apt_bool_t recog_state_update(mrcp_state_machine_t *base, mrcp_message_t *message)
-{
- mrcp_recog_state_machine_t *state_machine = (mrcp_recog_state_machine_t*)base;
- apt_bool_t status = TRUE;
- switch(message->start_line.message_type) {
- case MRCP_MESSAGE_TYPE_REQUEST:
- status = recog_request_state_update(state_machine,message);
- break;
- case MRCP_MESSAGE_TYPE_RESPONSE:
- status = recog_response_state_update(state_machine,message);
- break;
- case MRCP_MESSAGE_TYPE_EVENT:
- status = recog_event_state_update(state_machine,message);
- break;
- default:
- status = FALSE;
- break;
- }
- return status;
-}
-
-/** Deactivate state machine */
-static apt_bool_t recog_state_deactivate(mrcp_state_machine_t *base)
-{
- mrcp_recog_state_machine_t *state_machine = (mrcp_recog_state_machine_t*)base;
- mrcp_message_t *message;
- mrcp_message_t *source;
- if(state_machine->state != RECOGNIZER_STATE_RECOGNIZING) {
- /* no in-progress RECOGNIZE request to deactivate */
- return FALSE;
- }
- source = state_machine->recog;
- if(!source) {
- return FALSE;
- }
-
- /* create internal STOP request */
- message = mrcp_request_create(
- source->resource,
- source->start_line.version,
- RECOGNIZER_STOP,
- source->pool);
- message->channel_id = source->channel_id;
- message->start_line.request_id = source->start_line.request_id + 1;
- apt_string_set(&message->start_line.method_name,"DEACTIVATE"); /* informative only */
- message->header = source->header;
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Create and Process STOP Request "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]",
- MRCP_MESSAGE_SIDRES(message),
- message->start_line.request_id);
- return recog_request_dispatch(state_machine,message);
-}
-
-/** Create MRCP recognizer state machine */
-mrcp_state_machine_t* mrcp_recog_state_machine_create(void *obj, mrcp_version_e version, apr_pool_t *pool)
-{
- mrcp_recog_state_machine_t *state_machine = apr_palloc(pool,sizeof(mrcp_recog_state_machine_t));
- mrcp_state_machine_init(&state_machine->base,obj);
- state_machine->base.update = recog_state_update;
- state_machine->base.deactivate = recog_state_deactivate;
- state_machine->state = RECOGNIZER_STATE_IDLE;
- state_machine->is_pending = FALSE;
- state_machine->active_request = NULL;
- state_machine->recog = NULL;
- state_machine->queue = apt_list_create(pool);
- state_machine->properties = mrcp_message_header_create(
- mrcp_generic_header_vtable_get(version),
- mrcp_recog_header_vtable_get(version),
- pool);
- return &state_machine->base;
-}
diff --git a/libs/unimrcp/libs/mrcp-engine/src/mrcp_recorder_state_machine.c b/libs/unimrcp/libs/mrcp-engine/src/mrcp_recorder_state_machine.c
deleted file mode 100644
index ad7bd7b1b6..0000000000
--- a/libs/unimrcp/libs/mrcp-engine/src/mrcp_recorder_state_machine.c
+++ /dev/null
@@ -1,389 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_recorder_state_machine.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include "apt_obj_list.h"
-#include "apt_log.h"
-#include "mrcp_recorder_state_machine.h"
-#include "mrcp_generic_header.h"
-#include "mrcp_recorder_header.h"
-#include "mrcp_recorder_resource.h"
-#include "mrcp_message.h"
-
-/** MRCP recorder states */
-typedef enum {
- RECORDER_STATE_IDLE,
- RECORDER_STATE_RECORDING,
-
- RECORDER_STATE_COUNT
-} mrcp_recorder_state_e;
-
-static const char * state_names[RECORDER_STATE_COUNT] = {
- "IDLE",
- "RECORDING",
-};
-
-typedef struct mrcp_recorder_state_machine_t mrcp_recorder_state_machine_t;
-
-struct mrcp_recorder_state_machine_t {
- /** state machine base */
- mrcp_state_machine_t base;
- /** recorder state */
- mrcp_recorder_state_e state;
- /** request sent to recorder engine and waiting for the response to be received */
- mrcp_message_t *active_request;
- /** in-progress record request */
- mrcp_message_t *record;
- /** properties used in set/get params */
- mrcp_message_header_t *properties;
-};
-
-typedef apt_bool_t (*recorder_method_f)(mrcp_recorder_state_machine_t *state_machine, mrcp_message_t *message);
-
-static APR_INLINE apt_bool_t recorder_request_dispatch(mrcp_recorder_state_machine_t *state_machine, mrcp_message_t *message)
-{
- state_machine->active_request = message;
- return state_machine->base.on_dispatch(&state_machine->base,message);
-}
-
-static APR_INLINE apt_bool_t recorder_response_dispatch(mrcp_recorder_state_machine_t *state_machine, mrcp_message_t *message)
-{
- state_machine->active_request = NULL;
- if(state_machine->base.active == FALSE) {
- /* this is the response to deactivation (STOP) request */
- return state_machine->base.on_deactivate(&state_machine->base);
- }
- return state_machine->base.on_dispatch(&state_machine->base,message);
-}
-
-static APR_INLINE apt_bool_t recorder_event_dispatch(mrcp_recorder_state_machine_t *state_machine, mrcp_message_t *message)
-{
- if(state_machine->base.active == FALSE) {
- /* do nothing, state machine has already been deactivated */
- return FALSE;
- }
- return state_machine->base.on_dispatch(&state_machine->base,message);
-}
-
-static APR_INLINE void recorder_state_change(mrcp_recorder_state_machine_t *state_machine, mrcp_recorder_state_e state, mrcp_message_t *message)
-{
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"State Transition %s -> %s "APT_SIDRES_FMT,
- state_names[state_machine->state],
- state_names[state],
- MRCP_MESSAGE_SIDRES(message));
- state_machine->state = state;
- if(state == RECORDER_STATE_IDLE) {
- state_machine->record = NULL;
- }
-}
-
-
-static apt_bool_t recorder_request_set_params(mrcp_recorder_state_machine_t *state_machine, mrcp_message_t *message)
-{
- mrcp_header_fields_set(state_machine->properties,&message->header,message->pool);
- return recorder_request_dispatch(state_machine,message);
-}
-
-static apt_bool_t recorder_response_set_params(mrcp_recorder_state_machine_t *state_machine, mrcp_message_t *message)
-{
- return recorder_response_dispatch(state_machine,message);
-}
-
-static apt_bool_t recorder_request_get_params(mrcp_recorder_state_machine_t *state_machine, mrcp_message_t *message)
-{
- return recorder_request_dispatch(state_machine,message);
-}
-
-static apt_bool_t recorder_response_get_params(mrcp_recorder_state_machine_t *state_machine, mrcp_message_t *message)
-{
- mrcp_header_fields_get(&message->header,state_machine->properties,&state_machine->active_request->header,message->pool);
- return recorder_response_dispatch(state_machine,message);
-}
-
-static apt_bool_t recorder_request_record(mrcp_recorder_state_machine_t *state_machine, mrcp_message_t *message)
-{
- mrcp_header_fields_inherit(&message->header,state_machine->properties,message->pool);
- if(state_machine->state == RECORDER_STATE_RECORDING) {
- mrcp_message_t *response;
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Reject RECORD Request "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]",
- MRCP_MESSAGE_SIDRES(message),
- message->start_line.request_id);
-
- /* there is in-progress request, reject this one */
- response = mrcp_response_create(message,message->pool);
- response->start_line.status_code = MRCP_STATUS_CODE_METHOD_NOT_VALID;
- return recorder_response_dispatch(state_machine,response);
- }
-
- return recorder_request_dispatch(state_machine,message);
-}
-
-static apt_bool_t recorder_response_record(mrcp_recorder_state_machine_t *state_machine, mrcp_message_t *message)
-{
- if(message->start_line.request_state == MRCP_REQUEST_STATE_INPROGRESS) {
- state_machine->record = state_machine->active_request;
- recorder_state_change(state_machine,RECORDER_STATE_RECORDING,message);
- }
- return recorder_response_dispatch(state_machine,message);
-}
-
-static apt_bool_t recorder_request_stop(mrcp_recorder_state_machine_t *state_machine, mrcp_message_t *message)
-{
- mrcp_message_t *response;
- if(state_machine->state == RECORDER_STATE_RECORDING) {
- /* found in-progress RECORDER request, stop it */
- return recorder_request_dispatch(state_machine,message);
- }
-
- /* found no in-progress RECORDER request, sending immediate response */
- response = mrcp_response_create(message,message->pool);
- return recorder_response_dispatch(state_machine,response);
-}
-
-static apt_bool_t recorder_response_stop(mrcp_recorder_state_machine_t *state_machine, mrcp_message_t *message)
-{
- mrcp_generic_header_t *generic_header = mrcp_generic_header_prepare(message);
- /* append active id list */
- active_request_id_list_append(generic_header,state_machine->record->start_line.request_id);
- mrcp_generic_header_property_add(message,GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST);
- recorder_state_change(state_machine,RECORDER_STATE_IDLE,message);
- return recorder_response_dispatch(state_machine,message);
-}
-
-static apt_bool_t recorder_request_start_timers(mrcp_recorder_state_machine_t *state_machine, mrcp_message_t *message)
-{
- mrcp_message_t *response;
- if(state_machine->state == RECORDER_STATE_RECORDING) {
- /* found in-progress request */
- return recorder_request_dispatch(state_machine,message);
- }
-
- /* found no in-progress request */
- response = mrcp_response_create(message,message->pool);
- response->start_line.status_code = MRCP_STATUS_CODE_METHOD_NOT_VALID;
- return recorder_response_dispatch(state_machine,response);
-}
-
-static apt_bool_t recorder_response_start_timers(mrcp_recorder_state_machine_t *state_machine, mrcp_message_t *message)
-{
- return recorder_response_dispatch(state_machine,message);
-}
-
-static apt_bool_t recorder_event_start_of_input(mrcp_recorder_state_machine_t *state_machine, mrcp_message_t *message)
-{
- if(!state_machine->record) {
- /* unexpected event, no in-progress record request */
- return FALSE;
- }
-
- if(state_machine->record->start_line.request_id != message->start_line.request_id) {
- /* unexpected event */
- return FALSE;
- }
-
- message->start_line.request_state = MRCP_REQUEST_STATE_INPROGRESS;
- return recorder_event_dispatch(state_machine,message);
-}
-
-static apt_bool_t recorder_event_record_complete(mrcp_recorder_state_machine_t *state_machine, mrcp_message_t *message)
-{
- if(!state_machine->record) {
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Unexpected RECORD-COMPLETE Event "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]",
- MRCP_MESSAGE_SIDRES(message),
- message->start_line.request_id);
- return FALSE;
- }
-
- if(state_machine->record->start_line.request_id != message->start_line.request_id) {
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Unexpected RECORD-COMPLETE Event "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]",
- MRCP_MESSAGE_SIDRES(message),
- message->start_line.request_id);
- return FALSE;
- }
-
- if(state_machine->active_request && state_machine->active_request->start_line.method_id == RECORDER_STOP) {
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Ignore RECORD-COMPLETE Event "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]: waiting for STOP response",
- MRCP_MESSAGE_SIDRES(message),
- message->start_line.request_id);
- return FALSE;
- }
-
- if(mrcp_resource_header_property_check(message,RECORDER_HEADER_COMPLETION_CAUSE) != TRUE) {
- mrcp_recorder_header_t *recorder_header = mrcp_resource_header_prepare(message);
- recorder_header->completion_cause = RECORDER_COMPLETION_CAUSE_SUCCESS_SILENCE;
- mrcp_resource_header_property_add(message,RECORDER_HEADER_COMPLETION_CAUSE);
- }
- recorder_state_change(state_machine,RECORDER_STATE_IDLE,message);
- return recorder_event_dispatch(state_machine,message);
-}
-
-static recorder_method_f recorder_request_method_array[RECORDER_METHOD_COUNT] = {
- recorder_request_set_params,
- recorder_request_get_params,
- recorder_request_record,
- recorder_request_stop,
- recorder_request_start_timers
-};
-
-static recorder_method_f recorder_response_method_array[RECORDER_METHOD_COUNT] = {
- recorder_response_set_params,
- recorder_response_get_params,
- recorder_response_record,
- recorder_response_stop,
- recorder_response_start_timers
-};
-
-static recorder_method_f recorder_event_method_array[RECORDER_EVENT_COUNT] = {
- recorder_event_start_of_input,
- recorder_event_record_complete
-};
-
-/** Update state according to received incoming request from MRCP client */
-static apt_bool_t recorder_request_state_update(mrcp_recorder_state_machine_t *state_machine, mrcp_message_t *message)
-{
- recorder_method_f method;
- if(message->start_line.method_id >= RECORDER_METHOD_COUNT) {
- return FALSE;
- }
-
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process %s Request "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]",
- message->start_line.method_name.buf,
- MRCP_MESSAGE_SIDRES(message),
- message->start_line.request_id);
- method = recorder_request_method_array[message->start_line.method_id];
- if(method) {
- return method(state_machine,message);
- }
- return recorder_request_dispatch(state_machine,message);
-}
-
-/** Update state according to received outgoing response from recorder engine */
-static apt_bool_t recorder_response_state_update(mrcp_recorder_state_machine_t *state_machine, mrcp_message_t *message)
-{
- recorder_method_f method;
- if(!state_machine->active_request) {
- /* unexpected response, no active request waiting for response */
- return FALSE;
- }
- if(state_machine->active_request->start_line.request_id != message->start_line.request_id) {
- /* unexpected response, request id doesn't match */
- return FALSE;
- }
-
- if(message->start_line.method_id >= RECORDER_METHOD_COUNT) {
- return FALSE;
- }
-
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process %s Response "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]",
- message->start_line.method_name.buf,
- MRCP_MESSAGE_SIDRES(message),
- message->start_line.request_id);
- method = recorder_response_method_array[message->start_line.method_id];
- if(method) {
- return method(state_machine,message);
- }
- return recorder_response_dispatch(state_machine,message);
-}
-
-/** Update state according to received outgoing event from recorder engine */
-static apt_bool_t recorder_event_state_update(mrcp_recorder_state_machine_t *state_machine, mrcp_message_t *message)
-{
- recorder_method_f method;
- if(message->start_line.method_id >= RECORDER_EVENT_COUNT) {
- return FALSE;
- }
-
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process %s Event "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]",
- message->start_line.method_name.buf,
- MRCP_MESSAGE_SIDRES(message),
- message->start_line.request_id);
- method = recorder_event_method_array[message->start_line.method_id];
- if(method) {
- return method(state_machine,message);
- }
- return recorder_event_dispatch(state_machine,message);
-}
-
-/** Update state according to request received from MRCP client or response/event received from recorder engine */
-static apt_bool_t recorder_state_update(mrcp_state_machine_t *base, mrcp_message_t *message)
-{
- mrcp_recorder_state_machine_t *state_machine = (mrcp_recorder_state_machine_t*)base;
- apt_bool_t status = TRUE;
- switch(message->start_line.message_type) {
- case MRCP_MESSAGE_TYPE_REQUEST:
- status = recorder_request_state_update(state_machine,message);
- break;
- case MRCP_MESSAGE_TYPE_RESPONSE:
- status = recorder_response_state_update(state_machine,message);
- break;
- case MRCP_MESSAGE_TYPE_EVENT:
- status = recorder_event_state_update(state_machine,message);
- break;
- default:
- status = FALSE;
- break;
- }
- return status;
-}
-
-/** Deactivate state machine */
-static apt_bool_t recorder_state_deactivate(mrcp_state_machine_t *base)
-{
- mrcp_recorder_state_machine_t *state_machine = (mrcp_recorder_state_machine_t*)base;
- mrcp_message_t *message;
- mrcp_message_t *source;
- if(state_machine->state != RECORDER_STATE_RECORDING) {
- /* no in-progress RECORD request to deactivate */
- return FALSE;
- }
- source = state_machine->record;
- if(!source) {
- return FALSE;
- }
-
- /* create internal STOP request */
- message = mrcp_request_create(
- source->resource,
- source->start_line.version,
- RECORDER_STOP,
- source->pool);
- message->channel_id = source->channel_id;
- message->start_line.request_id = source->start_line.request_id + 1;
- apt_string_set(&message->start_line.method_name,"DEACTIVATE"); /* informative only */
- message->header = source->header;
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Create and Process STOP Request "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]",
- MRCP_MESSAGE_SIDRES(message),
- message->start_line.request_id);
- return recorder_request_dispatch(state_machine,message);
-}
-
-/** Create MRCP recorder state machine */
-mrcp_state_machine_t* mrcp_recorder_state_machine_create(void *obj, mrcp_version_e version, apr_pool_t *pool)
-{
- mrcp_recorder_state_machine_t *state_machine = apr_palloc(pool,sizeof(mrcp_recorder_state_machine_t));
- mrcp_state_machine_init(&state_machine->base,obj);
- state_machine->base.update = recorder_state_update;
- state_machine->base.deactivate = recorder_state_deactivate;
- state_machine->state = RECORDER_STATE_IDLE;
- state_machine->active_request = NULL;
- state_machine->record = NULL;
- state_machine->properties = mrcp_message_header_create(
- mrcp_generic_header_vtable_get(version),
- mrcp_recorder_header_vtable_get(version),
- pool);
- return &state_machine->base;
-}
diff --git a/libs/unimrcp/libs/mrcp-engine/src/mrcp_synth_state_machine.c b/libs/unimrcp/libs/mrcp-engine/src/mrcp_synth_state_machine.c
deleted file mode 100644
index 205f39c0bf..0000000000
--- a/libs/unimrcp/libs/mrcp-engine/src/mrcp_synth_state_machine.c
+++ /dev/null
@@ -1,612 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_synth_state_machine.c 2228 2014-11-12 01:18:27Z achaloyan@gmail.com $
- */
-
-#include "apt_obj_list.h"
-#include "apt_log.h"
-#include "mrcp_state_machine.h"
-#include "mrcp_synth_state_machine.h"
-#include "mrcp_synth_header.h"
-#include "mrcp_generic_header.h"
-#include "mrcp_synth_resource.h"
-#include "mrcp_message.h"
-
-/** MRCP synthesizer states */
-typedef enum {
- SYNTHESIZER_STATE_IDLE,
- SYNTHESIZER_STATE_SPEAKING,
- SYNTHESIZER_STATE_PAUSED,
-
- SYNTHESIZER_STATE_COUNT
-} mrcp_synth_state_e;
-
-static const char * state_names[SYNTHESIZER_STATE_COUNT] = {
- "IDLE",
- "SPEAKING",
- "PAUSED"
-};
-
-typedef struct mrcp_synth_state_machine_t mrcp_synth_state_machine_t;
-struct mrcp_synth_state_machine_t {
- /** state machine base */
- mrcp_state_machine_t base;
- /** synthesizer state */
- mrcp_synth_state_e state;
- /** indicate whether active_request was processed from pending request queue */
- apt_bool_t is_pending;
- /** request sent to synthesizer engine and waiting for the response to be received */
- mrcp_message_t *active_request;
- /** in-progress speak request */
- mrcp_message_t *speaker;
- /** queue of pending speak requests */
- apt_obj_list_t *queue;
- /** properties used in set/get params */
- mrcp_message_header_t *properties;
-};
-
-typedef apt_bool_t (*synth_method_f)(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message);
-
-static APR_INLINE apt_bool_t synth_request_dispatch(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message)
-{
- state_machine->active_request = message;
- return state_machine->base.on_dispatch(&state_machine->base,message);
-}
-
-static APR_INLINE apt_bool_t synth_response_dispatch(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message)
-{
- state_machine->active_request = NULL;
- if(state_machine->base.active == FALSE) {
- /* this is the response to deactivation (STOP) request */
- return state_machine->base.on_deactivate(&state_machine->base);
- }
- return state_machine->base.on_dispatch(&state_machine->base,message);
-}
-
-static APR_INLINE apt_bool_t synth_event_dispatch(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message)
-{
- if(state_machine->base.active == FALSE) {
- /* do nothing, state machine has already been deactivated */
- return FALSE;
- }
- return state_machine->base.on_dispatch(&state_machine->base,message);
-}
-
-static APR_INLINE void synth_state_change(mrcp_synth_state_machine_t *state_machine, mrcp_synth_state_e state, mrcp_message_t *message)
-{
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"State Transition %s -> %s "APT_SIDRES_FMT,
- state_names[state_machine->state],
- state_names[state],
- MRCP_MESSAGE_SIDRES(message));
- state_machine->state = state;
- if(state == SYNTHESIZER_STATE_IDLE) {
- state_machine->speaker = NULL;
- }
-}
-
-
-static apt_bool_t synth_request_set_params(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message)
-{
- mrcp_header_fields_set(state_machine->properties,&message->header,message->pool);
- return synth_request_dispatch(state_machine,message);
-}
-
-static apt_bool_t synth_response_set_params(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message)
-{
- return synth_response_dispatch(state_machine,message);
-}
-
-static apt_bool_t synth_request_get_params(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message)
-{
- return synth_request_dispatch(state_machine,message);
-}
-
-static apt_bool_t synth_response_get_params(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message)
-{
- mrcp_header_fields_get(&message->header,state_machine->properties,&state_machine->active_request->header,message->pool);
- return synth_response_dispatch(state_machine,message);
-}
-
-static apt_bool_t synth_request_speak(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message)
-{
- mrcp_header_fields_inherit(&message->header,state_machine->properties,message->pool);
- if(state_machine->speaker) {
- mrcp_message_t *response;
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Queue Up SPEAK Request "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]",
- MRCP_MESSAGE_SIDRES(message),
- message->start_line.request_id);
- message->start_line.request_state = MRCP_REQUEST_STATE_PENDING;
- apt_list_push_back(state_machine->queue,message,message->pool);
-
- response = mrcp_response_create(message,message->pool);
- response->start_line.request_state = MRCP_REQUEST_STATE_PENDING;
- return synth_response_dispatch(state_machine,response);
- }
-
- return synth_request_dispatch(state_machine,message);
-}
-
-static apt_bool_t synth_response_speak(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message)
-{
- if(message->start_line.request_state == MRCP_REQUEST_STATE_INPROGRESS) {
- state_machine->speaker = state_machine->active_request;
- synth_state_change(state_machine,SYNTHESIZER_STATE_SPEAKING,message);
- }
- if(state_machine->is_pending == TRUE) {
- mrcp_message_t *event_message = mrcp_event_create(
- state_machine->active_request,
- SYNTHESIZER_SPEECH_MARKER,
- state_machine->active_request->pool);
- event_message->start_line.request_state = MRCP_REQUEST_STATE_INPROGRESS;
- state_machine->is_pending = FALSE;
- /* not to send the response for pending request, instead send SPEECH-MARKER event */
- return synth_event_dispatch(state_machine,event_message);
- }
- return synth_response_dispatch(state_machine,message);
-}
-
-static apt_bool_t synth_pending_requests_remove(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *request_message, mrcp_message_t *response_message)
-{
- apt_list_elem_t *elem;
- mrcp_message_t *pending_message;
- mrcp_request_id_list_t *request_id_list = NULL;
- mrcp_generic_header_t *generic_header = mrcp_generic_header_get(request_message);
- mrcp_generic_header_t *response_generic_header = mrcp_generic_header_prepare(response_message);
- if(generic_header && mrcp_generic_header_property_check(request_message,GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST) == TRUE) {
- if(generic_header->active_request_id_list.count) {
- /* selective STOP request */
- request_id_list = &generic_header->active_request_id_list;
- }
- }
-
- elem = apt_list_first_elem_get(state_machine->queue);
- while(elem) {
- pending_message = apt_list_elem_object_get(elem);
- if(!request_id_list || active_request_id_list_find(generic_header,pending_message->start_line.request_id) == TRUE) {
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Remove Pending SPEAK Request "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]",
- MRCP_MESSAGE_SIDRES(pending_message),
- pending_message->start_line.request_id);
- elem = apt_list_elem_remove(state_machine->queue,elem);
- /* append active id list */
- active_request_id_list_append(response_generic_header,pending_message->start_line.request_id);
- }
- else {
- /* speak request remains in the queue, just proceed to the next one */
- elem = apt_list_next_elem_get(state_machine->queue,elem);
- }
- }
- if(response_generic_header->active_request_id_list.count) {
- mrcp_generic_header_property_add(response_message,GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST);
- }
- return TRUE;
-}
-
-static apt_bool_t synth_request_stop(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message)
-{
- mrcp_message_t *response_message;
- if(state_machine->speaker) {
- mrcp_request_id_list_t *request_id_list = NULL;
- mrcp_generic_header_t *generic_header = mrcp_generic_header_get(message);
- if(generic_header && mrcp_generic_header_property_check(message,GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST) == TRUE) {
- if(generic_header->active_request_id_list.count) {
- /* selective STOP request */
- request_id_list = &generic_header->active_request_id_list;
- }
- }
-
- if(!request_id_list || active_request_id_list_find(generic_header,state_machine->speaker->start_line.request_id) == TRUE) {
- /* found in-progress SPEAK request, stop it */
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Found IN-PROGRESS SPEAK Request "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]",
- MRCP_MESSAGE_SIDRES(message),
- message->start_line.request_id);
- return synth_request_dispatch(state_machine,message);
- }
- }
-
- /* found no in-progress SPEAK request, sending immediate response */
- response_message = mrcp_response_create(message,message->pool);
- synth_pending_requests_remove(state_machine,message,response_message);
- return synth_response_dispatch(state_machine,response_message);
-}
-
-static apt_bool_t synth_response_stop(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message)
-{
- mrcp_message_t *pending_request;
- mrcp_generic_header_t *generic_header = mrcp_generic_header_prepare(message);
- /* append active id list */
- active_request_id_list_append(generic_header,state_machine->speaker->start_line.request_id);
- mrcp_generic_header_property_add(message,GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST);
- synth_pending_requests_remove(state_machine,state_machine->active_request,message);
- synth_state_change(state_machine,SYNTHESIZER_STATE_IDLE,message);
- pending_request = apt_list_pop_front(state_machine->queue);
- synth_response_dispatch(state_machine,message);
-
- /* process pending SPEAK requests / if any */
- if(pending_request) {
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process Pending SPEAK Request "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]",
- MRCP_MESSAGE_SIDRES(message),
- pending_request->start_line.request_id);
- state_machine->is_pending = TRUE;
- synth_request_dispatch(state_machine,pending_request);
- }
- return TRUE;
-}
-
-static apt_bool_t synth_request_pause(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message)
-{
- if(state_machine->speaker) {
- /* speaking or paused state */
- if(state_machine->state == SYNTHESIZER_STATE_SPEAKING) {
- synth_request_dispatch(state_machine,message);
- }
- else {
- /* paused state */
- mrcp_message_t *response_message = mrcp_response_create(message,message->pool);
- synth_response_dispatch(state_machine,response_message);
- }
- }
- else {
- /* idle state */
- mrcp_message_t *response_message = mrcp_response_create(message,message->pool);
- response_message->start_line.status_code = MRCP_STATUS_CODE_METHOD_NOT_VALID;
- synth_response_dispatch(state_machine,response_message);
- }
- return TRUE;
-}
-
-static apt_bool_t synth_response_pause(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message)
-{
- if(message->start_line.status_code == MRCP_STATUS_CODE_SUCCESS) {
- mrcp_generic_header_t *generic_header = mrcp_generic_header_prepare(message);
- /* append active id list */
- active_request_id_list_append(generic_header,state_machine->speaker->start_line.request_id);
- mrcp_generic_header_property_add(message,GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST);
- synth_state_change(state_machine,SYNTHESIZER_STATE_PAUSED,message);
- }
- synth_response_dispatch(state_machine,message);
- return TRUE;
-}
-
-static apt_bool_t synth_request_resume(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message)
-{
- if(state_machine->speaker) {
- /* speaking or paused state */
- if(state_machine->state == SYNTHESIZER_STATE_PAUSED) {
- synth_request_dispatch(state_machine,message);
- }
- else {
- /* speaking state */
- mrcp_message_t *response_message = mrcp_response_create(message,message->pool);
- synth_response_dispatch(state_machine,response_message);
- }
- }
- else {
- /* idle state */
- mrcp_message_t *response_message = mrcp_response_create(message,message->pool);
- response_message->start_line.status_code = MRCP_STATUS_CODE_METHOD_NOT_VALID;
- synth_response_dispatch(state_machine,response_message);
- }
- return TRUE;
-}
-
-static apt_bool_t synth_response_resume(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message)
-{
- if(message->start_line.status_code == MRCP_STATUS_CODE_SUCCESS) {
- mrcp_generic_header_t *generic_header = mrcp_generic_header_prepare(message);
- /* append active id list */
- active_request_id_list_append(generic_header,state_machine->speaker->start_line.request_id);
- mrcp_generic_header_property_add(message,GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST);
- synth_state_change(state_machine,SYNTHESIZER_STATE_SPEAKING,message);
- }
- synth_response_dispatch(state_machine,message);
- return TRUE;
-}
-
-static apt_bool_t synth_request_barge_in_occurred(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message)
-{
- mrcp_message_t *response_message;
- if(state_machine->speaker) {
- apt_bool_t kill_on_barge_in = TRUE;
- mrcp_synth_header_t *synth_header = mrcp_resource_header_get(message);
- if(synth_header) {
- if(mrcp_resource_header_property_check(message,SYNTHESIZER_HEADER_KILL_ON_BARGE_IN) == TRUE) {
- kill_on_barge_in = synth_header->kill_on_barge_in;
- }
- }
-
- if(kill_on_barge_in == TRUE) {
- return synth_request_dispatch(state_machine,message);
- }
- }
-
- /* found no kill-on-bargein enabled in-progress SPEAK request, sending immediate response */
- response_message = mrcp_response_create(message,message->pool);
- return synth_response_dispatch(state_machine,response_message);
-}
-
-static apt_bool_t synth_response_barge_in_occurred(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message)
-{
- mrcp_generic_header_t *generic_header = mrcp_generic_header_prepare(message);
- /* append active id list */
- active_request_id_list_append(generic_header,state_machine->speaker->start_line.request_id);
- mrcp_generic_header_property_add(message,GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST);
- synth_pending_requests_remove(state_machine,state_machine->active_request,message);
- synth_state_change(state_machine,SYNTHESIZER_STATE_IDLE,message);
- return synth_response_dispatch(state_machine,message);
-}
-
-static apt_bool_t synth_request_control(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message)
-{
- mrcp_message_t *response_message;
- if(state_machine->state == SYNTHESIZER_STATE_SPEAKING) {
- return synth_request_dispatch(state_machine,message);
- }
-
- /* found no in-progress SPEAK request, sending immediate response */
- response_message = mrcp_response_create(message,message->pool);
- return synth_response_dispatch(state_machine,response_message);
-}
-
-static apt_bool_t synth_response_control(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message)
-{
- mrcp_generic_header_t *generic_header = mrcp_generic_header_prepare(message);
- /* append active id list */
- active_request_id_list_append(generic_header,state_machine->speaker->start_line.request_id);
- mrcp_generic_header_property_add(message,GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST);
- return synth_response_dispatch(state_machine,message);
-}
-
-static apt_bool_t synth_request_define_lexicon(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message)
-{
- mrcp_message_t *response_message;
- if(state_machine->state == SYNTHESIZER_STATE_IDLE) {
- return synth_request_dispatch(state_machine,message);
- }
-
- /* sending failure response */
- response_message = mrcp_response_create(message,message->pool);
- response_message->start_line.status_code = MRCP_STATUS_CODE_METHOD_NOT_VALID;
- return synth_response_dispatch(state_machine,response_message);
-}
-
-static apt_bool_t synth_response_define_lexicon(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message)
-{
- return synth_response_dispatch(state_machine,message);
-}
-
-static apt_bool_t synth_event_speech_marker(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message)
-{
- if(!state_machine->speaker) {
- /* unexpected event, no in-progress speak request */
- return FALSE;
- }
-
- if(state_machine->speaker->start_line.request_id != message->start_line.request_id) {
- /* unexpected event */
- return FALSE;
- }
-
- message->start_line.request_state = MRCP_REQUEST_STATE_INPROGRESS;
- return synth_event_dispatch(state_machine,message);
-}
-
-static apt_bool_t synth_event_speak_complete(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message)
-{
- mrcp_message_t *pending_request;
- if(!state_machine->speaker) {
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Unexpected SPEAK-COMPLETE Event "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]",
- MRCP_MESSAGE_SIDRES(message),
- message->start_line.request_id);
- return FALSE;
- }
-
- if(state_machine->speaker->start_line.request_id != message->start_line.request_id) {
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Unexpected SPEAK-COMPLETE Event "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]",
- MRCP_MESSAGE_SIDRES(message),
- message->start_line.request_id);
- return FALSE;
- }
-
- if(state_machine->active_request && state_machine->active_request->start_line.method_id == SYNTHESIZER_STOP) {
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Ignore SPEAK-COMPLETE Event "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]: waiting for STOP response",
- MRCP_MESSAGE_SIDRES(message),
- message->start_line.request_id);
- return FALSE;
- }
-
- if(mrcp_resource_header_property_check(message,SYNTHESIZER_HEADER_COMPLETION_CAUSE) != TRUE) {
- mrcp_synth_header_t *synth_header = mrcp_resource_header_prepare(message);
- synth_header->completion_cause = SYNTHESIZER_COMPLETION_CAUSE_NORMAL;
- mrcp_resource_header_property_add(message,SYNTHESIZER_HEADER_COMPLETION_CAUSE);
- }
- synth_state_change(state_machine,SYNTHESIZER_STATE_IDLE,message);
- synth_event_dispatch(state_machine,message);
-
- /* process pending SPEAK requests */
- pending_request = apt_list_pop_front(state_machine->queue);
- if(pending_request) {
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process Pending SPEAK Request "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]",
- MRCP_MESSAGE_SIDRES(pending_request),
- pending_request->start_line.request_id);
- state_machine->is_pending = TRUE;
- synth_request_dispatch(state_machine,pending_request);
- }
- return TRUE;
-}
-
-static synth_method_f synth_request_method_array[SYNTHESIZER_METHOD_COUNT] = {
- synth_request_set_params,
- synth_request_get_params,
- synth_request_speak,
- synth_request_stop,
- synth_request_pause,
- synth_request_resume,
- synth_request_barge_in_occurred,
- synth_request_control,
- synth_request_define_lexicon
-};
-
-static synth_method_f synth_response_method_array[SYNTHESIZER_METHOD_COUNT] = {
- synth_response_set_params,
- synth_response_get_params,
- synth_response_speak,
- synth_response_stop,
- synth_response_pause,
- synth_response_resume,
- synth_response_barge_in_occurred,
- synth_response_control,
- synth_response_define_lexicon,
-};
-
-static synth_method_f synth_event_method_array[SYNTHESIZER_EVENT_COUNT] = {
- synth_event_speech_marker,
- synth_event_speak_complete
-};
-
-/** Update state according to received incoming request from MRCP client */
-static apt_bool_t synth_request_state_update(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message)
-{
- synth_method_f method;
- if(message->start_line.method_id >= SYNTHESIZER_METHOD_COUNT) {
- return FALSE;
- }
-
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process %s Request "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]",
- message->start_line.method_name.buf,
- MRCP_MESSAGE_SIDRES(message),
- message->start_line.request_id);
- method = synth_request_method_array[message->start_line.method_id];
- if(method) {
- return method(state_machine,message);
- }
- return synth_request_dispatch(state_machine,message);
-}
-
-/** Update state according to received outgoing response from synthesizer engine */
-static apt_bool_t synth_response_state_update(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message)
-{
- synth_method_f method;
- if(!state_machine->active_request) {
- /* unexpected response, no active request waiting for response */
- return FALSE;
- }
- if(state_machine->active_request->start_line.request_id != message->start_line.request_id) {
- /* unexpected response, request id doesn't match */
- return FALSE;
- }
-
- if(message->start_line.method_id >= SYNTHESIZER_METHOD_COUNT) {
- return FALSE;
- }
-
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process %s Response "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]",
- message->start_line.method_name.buf,
- MRCP_MESSAGE_SIDRES(message),
- message->start_line.request_id);
- method = synth_response_method_array[message->start_line.method_id];
- if(method) {
- return method(state_machine,message);
- }
- return synth_response_dispatch(state_machine,message);
-}
-
-/** Update state according to received outgoing event from synthesizer engine */
-static apt_bool_t synth_event_state_update(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message)
-{
- synth_method_f method;
- if(message->start_line.method_id >= SYNTHESIZER_EVENT_COUNT) {
- return FALSE;
- }
-
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process %s Event "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]",
- message->start_line.method_name.buf,
- MRCP_MESSAGE_SIDRES(message),
- message->start_line.request_id);
- method = synth_event_method_array[message->start_line.method_id];
- if(method) {
- return method(state_machine,message);
- }
- return synth_event_dispatch(state_machine,message);
-}
-
-/** Update state according to request received from MRCP client or response/event received from synthesizer engine */
-static apt_bool_t synth_state_update(mrcp_state_machine_t *base, mrcp_message_t *message)
-{
- mrcp_synth_state_machine_t *synth_state_machine = (mrcp_synth_state_machine_t*)base;
- apt_bool_t status = TRUE;
- switch(message->start_line.message_type) {
- case MRCP_MESSAGE_TYPE_REQUEST:
- status = synth_request_state_update(synth_state_machine,message);
- break;
- case MRCP_MESSAGE_TYPE_RESPONSE:
- status = synth_response_state_update(synth_state_machine,message);
- break;
- case MRCP_MESSAGE_TYPE_EVENT:
- status = synth_event_state_update(synth_state_machine,message);
- break;
- default:
- status = FALSE;
- break;
- }
- return status;
-}
-
-/** Deactivate state machine */
-static apt_bool_t synth_state_deactivate(mrcp_state_machine_t *base)
-{
- mrcp_synth_state_machine_t *state_machine = (mrcp_synth_state_machine_t*)base;
- mrcp_message_t *message;
- mrcp_message_t *source;
- if(!state_machine->speaker) {
- /* no in-progress SPEAK request to deactivate */
- return FALSE;
- }
- source = state_machine->speaker;
-
- /* create internal STOP request */
- message = mrcp_request_create(
- source->resource,
- source->start_line.version,
- SYNTHESIZER_STOP,
- source->pool);
- message->channel_id = source->channel_id;
- message->start_line.request_id = source->start_line.request_id + 1;
- apt_string_set(&message->start_line.method_name,"DEACTIVATE"); /* informative only */
- message->header = source->header;
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Create and Process STOP Request "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]",
- MRCP_MESSAGE_SIDRES(message),
- message->start_line.request_id);
- return synth_request_dispatch(state_machine,message);
-}
-
-/** Create MRCP synthesizer state machine */
-mrcp_state_machine_t* mrcp_synth_state_machine_create(void *obj, mrcp_version_e version, apr_pool_t *pool)
-{
- mrcp_synth_state_machine_t *state_machine = apr_palloc(pool,sizeof(mrcp_synth_state_machine_t));
- mrcp_state_machine_init(&state_machine->base,obj);
- state_machine->base.update = synth_state_update;
- state_machine->base.deactivate = synth_state_deactivate;
- state_machine->state = SYNTHESIZER_STATE_IDLE;
- state_machine->is_pending = FALSE;
- state_machine->active_request = NULL;
- state_machine->speaker = NULL;
- state_machine->queue = apt_list_create(pool);
- state_machine->properties = mrcp_message_header_create(
- mrcp_generic_header_vtable_get(version),
- mrcp_synth_header_vtable_get(version),
- pool);
- return &state_machine->base;
-}
diff --git a/libs/unimrcp/libs/mrcp-engine/src/mrcp_verifier_state_machine.c b/libs/unimrcp/libs/mrcp-engine/src/mrcp_verifier_state_machine.c
deleted file mode 100644
index 6ca313e51c..0000000000
--- a/libs/unimrcp/libs/mrcp-engine/src/mrcp_verifier_state_machine.c
+++ /dev/null
@@ -1,524 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_verifier_state_machine.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include "apt_obj_list.h"
-#include "apt_log.h"
-#include "mrcp_verifier_state_machine.h"
-#include "mrcp_generic_header.h"
-#include "mrcp_verifier_header.h"
-#include "mrcp_verifier_resource.h"
-#include "mrcp_message.h"
-
-/** MRCP verifier states */
-typedef enum {
- VERIFIER_STATE_IDLE,
- VERIFIER_STATE_OPENED,
- VERIFIER_STATE_VERIFYING,
-
- VERIFIER_STATE_COUNT
-} mrcp_verifier_state_e;
-
-static const char * state_names[VERIFIER_STATE_COUNT] = {
- "IDLE",
- "OPENED",
- "VERIFYING"
-};
-
-typedef struct mrcp_verifier_state_machine_t mrcp_verifier_state_machine_t;
-
-struct mrcp_verifier_state_machine_t {
- /** state machine base */
- mrcp_state_machine_t base;
- /** verifier state */
- mrcp_verifier_state_e state;
- /** request sent to verification engine and waiting for the response to be received */
- mrcp_message_t *active_request;
- /** in-progress verify request */
- mrcp_message_t *verify;
- /** properties used in set/get params */
- mrcp_message_header_t *properties;
-};
-
-typedef apt_bool_t (*verifier_method_f)(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message);
-
-static APR_INLINE apt_bool_t verifier_request_dispatch(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message)
-{
- state_machine->active_request = message;
- return state_machine->base.on_dispatch(&state_machine->base,message);
-}
-
-static APR_INLINE apt_bool_t verifier_response_dispatch(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message)
-{
- state_machine->active_request = NULL;
- if(state_machine->base.active == FALSE) {
- /* this is the response to deactivation (STOP) request */
- return state_machine->base.on_deactivate(&state_machine->base);
- }
- return state_machine->base.on_dispatch(&state_machine->base,message);
-}
-
-static APR_INLINE apt_bool_t verifier_event_dispatch(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message)
-{
- if(state_machine->base.active == FALSE) {
- /* do nothing, state machine has already been deactivated */
- return FALSE;
- }
- return state_machine->base.on_dispatch(&state_machine->base,message);
-}
-
-static APR_INLINE void verifier_state_change(mrcp_verifier_state_machine_t *state_machine, mrcp_verifier_state_e state, mrcp_message_t *message)
-{
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"State Transition %s -> %s "APT_SIDRES_FMT,
- state_names[state_machine->state],
- state_names[state],
- MRCP_MESSAGE_SIDRES(message));
- state_machine->state = state;
- if(state == VERIFIER_STATE_IDLE) {
- state_machine->verify = NULL;
- }
-}
-
-
-static apt_bool_t verifier_request_set_params(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message)
-{
- mrcp_header_fields_set(state_machine->properties,&message->header,message->pool);
- return verifier_request_dispatch(state_machine,message);
-}
-
-static apt_bool_t verifier_response_set_params(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message)
-{
- return verifier_response_dispatch(state_machine,message);
-}
-
-static apt_bool_t verifier_request_get_params(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message)
-{
- return verifier_request_dispatch(state_machine,message);
-}
-
-static apt_bool_t verifier_response_get_params(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message)
-{
- mrcp_header_fields_get(&message->header,state_machine->properties,&state_machine->active_request->header,message->pool);
- return verifier_response_dispatch(state_machine,message);
-}
-
-static apt_bool_t verifier_request_start_session(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message)
-{
- if(state_machine->state == VERIFIER_STATE_VERIFYING) {
- mrcp_message_t *response_message = mrcp_response_create(message,message->pool);
- response_message->start_line.status_code = MRCP_STATUS_CODE_METHOD_NOT_VALID;
- return verifier_response_dispatch(state_machine,response_message);
- }
-
- return verifier_request_dispatch(state_machine,message);
-}
-
-static apt_bool_t verifier_response_start_session(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message)
-{
- verifier_state_change(state_machine,VERIFIER_STATE_OPENED,message);
-
- return verifier_response_dispatch(state_machine,message);
-}
-
-static apt_bool_t verifier_request_end_session(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message)
-{
- if(state_machine->state == VERIFIER_STATE_IDLE) {
- mrcp_message_t *response_message = mrcp_response_create(message,message->pool);
- response_message->start_line.status_code = MRCP_STATUS_CODE_METHOD_NOT_VALID;
- return verifier_response_dispatch(state_machine,response_message);
- }
-
- return verifier_request_dispatch(state_machine,message);
-}
-
-static apt_bool_t verifier_response_end_session(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message)
-{
- verifier_state_change(state_machine,VERIFIER_STATE_IDLE,message);
-
- return verifier_response_dispatch(state_machine,message);
-}
-
-static apt_bool_t verifier_request_query_voiceprint(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message)
-{
- if(state_machine->state == VERIFIER_STATE_IDLE) {
- mrcp_message_t *response_message = mrcp_response_create(message,message->pool);
- response_message->start_line.status_code = MRCP_STATUS_CODE_METHOD_NOT_VALID;
- return verifier_response_dispatch(state_machine,response_message);
- }
-
- return verifier_request_dispatch(state_machine,message);
-}
-
-static apt_bool_t verifier_response_query_voiceprint(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message)
-{
-
- return verifier_response_dispatch(state_machine,message);
-}
-
-static apt_bool_t verifier_request_delete_voiceprint(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message)
-{
- if(state_machine->state == VERIFIER_STATE_IDLE) {
- mrcp_message_t *response_message = mrcp_response_create(message,message->pool);
- response_message->start_line.status_code = MRCP_STATUS_CODE_METHOD_NOT_VALID;
- return verifier_response_dispatch(state_machine,response_message);
- }
-
- return verifier_request_dispatch(state_machine,message);
-}
-
-static apt_bool_t verifier_response_delete_voiceprint(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message)
-{
- return verifier_response_dispatch(state_machine,message);
-}
-
-static apt_bool_t verifier_request_verify(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message)
-{
- if(state_machine->state == VERIFIER_STATE_IDLE || state_machine->state == VERIFIER_STATE_VERIFYING) {
- mrcp_message_t *response_message = mrcp_response_create(message,message->pool);
- response_message->start_line.status_code = MRCP_STATUS_CODE_METHOD_NOT_VALID;
- return verifier_response_dispatch(state_machine,response_message);
- }
-
- state_machine->verify = message;
- return verifier_request_dispatch(state_machine,message);
-}
-
-static apt_bool_t verifier_response_verify(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message)
-{
- verifier_state_change(state_machine,VERIFIER_STATE_VERIFYING,message);
-
- return verifier_response_dispatch(state_machine,message);
-}
-
-static apt_bool_t verifier_request_verify_from_buffer(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message)
-{
- if(state_machine->state == VERIFIER_STATE_IDLE || state_machine->state == VERIFIER_STATE_VERIFYING) {
- mrcp_message_t *response_message = mrcp_response_create(message,message->pool);
- response_message->start_line.status_code = MRCP_STATUS_CODE_METHOD_NOT_VALID;
- return verifier_response_dispatch(state_machine,response_message);
- }
-
- state_machine->verify = message;
- return verifier_request_dispatch(state_machine,message);
-}
-
-static apt_bool_t verifier_response_verify_from_buffer(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message)
-{
- verifier_state_change(state_machine,VERIFIER_STATE_VERIFYING,message);
-
- return verifier_response_dispatch(state_machine,message);
-}
-
-static apt_bool_t verifier_request_verify_rollback(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message)
-{
- return verifier_request_dispatch(state_machine,message);
-}
-
-static apt_bool_t verifier_response_verify_rollback(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message)
-{
- return verifier_response_dispatch(state_machine,message);
-}
-
-static apt_bool_t verifier_request_stop(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message)
-{
- if(state_machine->state == VERIFIER_STATE_IDLE) {
- mrcp_message_t *response_message = mrcp_response_create(message,message->pool);
- response_message->start_line.status_code = MRCP_STATUS_CODE_METHOD_NOT_VALID;
- return verifier_response_dispatch(state_machine,response_message);
- }
-
- if(state_machine->state == VERIFIER_STATE_OPENED) {
- /* no in-progress VERIFY request, sending immediate response */
- mrcp_message_t *response_message = mrcp_response_create(message,message->pool);
- return verifier_response_dispatch(state_machine,response_message);
- }
-
- return verifier_request_dispatch(state_machine,message);
-}
-
-static apt_bool_t verifier_response_stop(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message)
-{
- mrcp_generic_header_t *generic_header = mrcp_generic_header_prepare(message);
- /* append active id list */
- active_request_id_list_append(generic_header,state_machine->verify->start_line.request_id);
- mrcp_generic_header_property_add(message,GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST);
- verifier_state_change(state_machine,VERIFIER_STATE_OPENED,message);
- return verifier_response_dispatch(state_machine,message);
-}
-
-static apt_bool_t verifier_request_clear_buffer(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message)
-{
- return verifier_request_dispatch(state_machine,message);
-}
-
-static apt_bool_t verifier_response_clear_buffer(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message)
-{
- return verifier_response_dispatch(state_machine,message);
-}
-
-static apt_bool_t verifier_request_start_input_timers(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message)
-{
- if(state_machine->state == VERIFIER_STATE_IDLE || state_machine->state == VERIFIER_STATE_VERIFYING) {
- mrcp_message_t *response_message = mrcp_response_create(message,message->pool);
- response_message->start_line.status_code = MRCP_STATUS_CODE_METHOD_NOT_VALID;
- return verifier_response_dispatch(state_machine,response_message);
- }
-
- return verifier_request_dispatch(state_machine,message);
-}
-
-static apt_bool_t verifier_response_start_input_timers(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message)
-{
- return verifier_response_dispatch(state_machine,message);
-}
-
-static apt_bool_t verifier_request_get_intermidiate_result(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message)
-{
- if(state_machine->state != VERIFIER_STATE_VERIFYING) {
- mrcp_message_t *response_message = mrcp_response_create(message,message->pool);
- response_message->start_line.status_code = MRCP_STATUS_CODE_METHOD_NOT_VALID;
- return verifier_response_dispatch(state_machine,response_message);
- }
- return verifier_request_dispatch(state_machine,message);
-}
-
-static apt_bool_t verifier_response_get_intermidiate_result(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message)
-{
- return verifier_response_dispatch(state_machine,message);
-}
-
-
-static apt_bool_t verifier_event_start_of_input(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message)
-{
- if(!state_machine->verify) {
- /* unexpected event, no in-progress verify request */
- return FALSE;
- }
-
- if(state_machine->verify->start_line.request_id != message->start_line.request_id) {
- /* unexpected event */
- return FALSE;
- }
-
- message->start_line.request_state = MRCP_REQUEST_STATE_INPROGRESS;
- return verifier_event_dispatch(state_machine,message);
-}
-
-static apt_bool_t verifier_event_verification_complete(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message)
-{
- if(!state_machine->verify) {
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Unexpected VERIFICATION-COMPLETE Event "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]",
- MRCP_MESSAGE_SIDRES(message),
- message->start_line.request_id);
- return FALSE;
- }
-
- if(state_machine->verify->start_line.request_id != message->start_line.request_id) {
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Unexpected VERIFICATION-COMPLETE Event "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]",
- MRCP_MESSAGE_SIDRES(message),
- message->start_line.request_id);
- return FALSE;
- }
-
- if(state_machine->active_request && state_machine->active_request->start_line.method_id == VERIFIER_STOP) {
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Ignore VERIFICATION-COMPLETE Event "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]: waiting for STOP response",
- MRCP_MESSAGE_SIDRES(message),
- message->start_line.request_id);
- return FALSE;
- }
-
- if(mrcp_resource_header_property_check(message,VERIFIER_HEADER_COMPLETION_CAUSE) != TRUE) {
- mrcp_verifier_header_t *verifier_header = mrcp_resource_header_prepare(message);
- verifier_header->completion_cause = VERIFIER_COMPLETION_CAUSE_SUCCESS;
- mrcp_resource_header_property_add(message,VERIFIER_HEADER_COMPLETION_CAUSE);
- }
- verifier_state_change(state_machine,VERIFIER_STATE_OPENED,message);
- return verifier_event_dispatch(state_machine,message);
-}
-
-static verifier_method_f verifier_request_method_array[VERIFIER_METHOD_COUNT] = {
- verifier_request_set_params,
- verifier_request_get_params,
- verifier_request_start_session,
- verifier_request_end_session,
- verifier_request_query_voiceprint,
- verifier_request_delete_voiceprint,
- verifier_request_verify,
- verifier_request_verify_from_buffer,
- verifier_request_verify_rollback,
- verifier_request_stop,
- verifier_request_clear_buffer,
- verifier_request_start_input_timers,
- verifier_request_get_intermidiate_result
-};
-
-static verifier_method_f verifier_response_method_array[VERIFIER_METHOD_COUNT] = {
- verifier_response_set_params,
- verifier_response_get_params,
- verifier_response_start_session,
- verifier_response_end_session,
- verifier_response_query_voiceprint,
- verifier_response_delete_voiceprint,
- verifier_response_verify,
- verifier_response_verify_from_buffer,
- verifier_response_verify_rollback,
- verifier_response_stop,
- verifier_response_clear_buffer,
- verifier_response_start_input_timers,
- verifier_response_get_intermidiate_result
-};
-
-static verifier_method_f verifier_event_method_array[VERIFIER_EVENT_COUNT] = {
- verifier_event_start_of_input,
- verifier_event_verification_complete
-};
-
-/** Update state according to received incoming request from MRCP client */
-static apt_bool_t verifier_request_state_update(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message)
-{
- verifier_method_f method;
- if(message->start_line.method_id >= VERIFIER_METHOD_COUNT) {
- return FALSE;
- }
-
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process %s Request "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]",
- message->start_line.method_name.buf,
- MRCP_MESSAGE_SIDRES(message),
- message->start_line.request_id);
- method = verifier_request_method_array[message->start_line.method_id];
- if(method) {
- return method(state_machine,message);
- }
- return verifier_request_dispatch(state_machine,message);
-}
-
-/** Update state according to received outgoing response from verification engine */
-static apt_bool_t verifier_response_state_update(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message)
-{
- verifier_method_f method;
- if(!state_machine->active_request) {
- /* unexpected response, no active request waiting for response */
- return FALSE;
- }
- if(state_machine->active_request->start_line.request_id != message->start_line.request_id) {
- /* unexpected response, request id doesn't match */
- return FALSE;
- }
-
- if(message->start_line.method_id >= VERIFIER_METHOD_COUNT) {
- return FALSE;
- }
-
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process %s Response "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]",
- message->start_line.method_name.buf,
- MRCP_MESSAGE_SIDRES(message),
- message->start_line.request_id);
- method = verifier_response_method_array[message->start_line.method_id];
- if(method) {
- return method(state_machine,message);
- }
- return verifier_response_dispatch(state_machine,message);
-}
-
-/** Update state according to received outgoing event from verification engine */
-static apt_bool_t verifier_event_state_update(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message)
-{
- verifier_method_f method;
- if(message->start_line.method_id >= VERIFIER_EVENT_COUNT) {
- return FALSE;
- }
-
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process %s Event "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]",
- message->start_line.method_name.buf,
- MRCP_MESSAGE_SIDRES(message),
- message->start_line.request_id);
- method = verifier_event_method_array[message->start_line.method_id];
- if(method) {
- return method(state_machine,message);
- }
- return verifier_event_dispatch(state_machine,message);
-}
-
-/** Update state according to request received from MRCP client or response/event received from verification engine */
-static apt_bool_t verifier_state_update(mrcp_state_machine_t *base, mrcp_message_t *message)
-{
- mrcp_verifier_state_machine_t *state_machine = (mrcp_verifier_state_machine_t*)base;
- apt_bool_t status = TRUE;
- switch(message->start_line.message_type) {
- case MRCP_MESSAGE_TYPE_REQUEST:
- status = verifier_request_state_update(state_machine,message);
- break;
- case MRCP_MESSAGE_TYPE_RESPONSE:
- status = verifier_response_state_update(state_machine,message);
- break;
- case MRCP_MESSAGE_TYPE_EVENT:
- status = verifier_event_state_update(state_machine,message);
- break;
- default:
- status = FALSE;
- break;
- }
- return status;
-}
-
-/** Deactivate state machine */
-static apt_bool_t verifier_state_deactivate(mrcp_state_machine_t *base)
-{
- mrcp_verifier_state_machine_t *state_machine = (mrcp_verifier_state_machine_t*)base;
- mrcp_message_t *message;
- mrcp_message_t *source;
- if(state_machine->state != VERIFIER_STATE_VERIFYING) {
- /* no in-progress VERIFY request to deactivate */
- return FALSE;
- }
- source = state_machine->verify;
- if(!source) {
- return FALSE;
- }
-
- /* create internal STOP request */
- message = mrcp_request_create(
- source->resource,
- source->start_line.version,
- VERIFIER_STOP,
- source->pool);
- message->channel_id = source->channel_id;
- message->start_line.request_id = source->start_line.request_id + 1;
- apt_string_set(&message->start_line.method_name,"DEACTIVATE"); /* informative only */
- message->header = source->header;
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Create and Process STOP Request "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]",
- MRCP_MESSAGE_SIDRES(message),
- message->start_line.request_id);
- return verifier_request_dispatch(state_machine,message);
-}
-
-/** Create MRCP verification state machine */
-mrcp_state_machine_t* mrcp_verifier_state_machine_create(void *obj, mrcp_version_e version, apr_pool_t *pool)
-{
- mrcp_verifier_state_machine_t *state_machine = apr_palloc(pool,sizeof(mrcp_verifier_state_machine_t));
- mrcp_state_machine_init(&state_machine->base,obj);
- state_machine->base.update = verifier_state_update;
- state_machine->base.deactivate = verifier_state_deactivate;
- state_machine->state = VERIFIER_STATE_IDLE;
- state_machine->active_request = NULL;
- state_machine->verify = NULL;
- state_machine->properties = mrcp_message_header_create(
- mrcp_generic_header_vtable_get(version),
- mrcp_verifier_header_vtable_get(version),
- pool);
- return &state_machine->base;
-}
diff --git a/libs/unimrcp/libs/mrcp-server/Makefile.am b/libs/unimrcp/libs/mrcp-server/Makefile.am
deleted file mode 100644
index 0ebf90cab0..0000000000
--- a/libs/unimrcp/libs/mrcp-server/Makefile.am
+++ /dev/null
@@ -1,22 +0,0 @@
-MAINTAINERCLEANFILES = Makefile.in
-
-AM_CPPFLAGS = -I$(top_srcdir)/libs/mrcp-server/include \
- -I$(top_srcdir)/libs/mrcp-engine/include \
- -I$(top_srcdir)/libs/mrcp-signaling/include \
- -I$(top_srcdir)/libs/mrcpv2-transport/include \
- -I$(top_srcdir)/libs/mrcp/include \
- -I$(top_srcdir)/libs/mrcp/message/include \
- -I$(top_srcdir)/libs/mrcp/control/include \
- -I$(top_srcdir)/libs/mrcp/resources/include \
- -I$(top_srcdir)/libs/mpf/include \
- -I$(top_srcdir)/libs/apr-toolkit/include \
- $(UNIMRCP_APR_INCLUDES)
-
-noinst_LTLIBRARIES = libmrcpserver.la
-
-include_HEADERS = include/mrcp_server_types.h \
- include/mrcp_server.h \
- include/mrcp_server_session.h
-
-libmrcpserver_la_SOURCES = src/mrcp_server.c \
- src/mrcp_server_session.c
diff --git a/libs/unimrcp/libs/mrcp-server/include/mrcp_server.h b/libs/unimrcp/libs/mrcp-server/include/mrcp_server.h
deleted file mode 100644
index a51186dd88..0000000000
--- a/libs/unimrcp/libs/mrcp-server/include/mrcp_server.h
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_server.h 2251 2014-11-21 02:36:44Z achaloyan@gmail.com $
- */
-
-#ifndef MRCP_SERVER_H
-#define MRCP_SERVER_H
-
-/**
- * @file mrcp_server.h
- * @brief MRCP Server
- */
-
-#include "mrcp_server_types.h"
-#include "mrcp_engine_iface.h"
-#include "mpf_rtp_descriptor.h"
-#include "apt_task.h"
-
-APT_BEGIN_EXTERN_C
-
-/**
- * Create MRCP server instance.
- * @return the created server instance
- */
-MRCP_DECLARE(mrcp_server_t*) mrcp_server_create(apt_dir_layout_t *dir_layout);
-
-/**
- * Start message processing loop.
- * @param server the MRCP server to start
- * @return the created server instance
- */
-MRCP_DECLARE(apt_bool_t) mrcp_server_start(mrcp_server_t *server);
-
-/**
- * Shutdown message processing loop.
- * @param server the MRCP server to shutdown
- */
-MRCP_DECLARE(apt_bool_t) mrcp_server_shutdown(mrcp_server_t *server);
-
-/**
- * Destroy MRCP server.
- * @param server the MRCP server to destroy
- */
-MRCP_DECLARE(apt_bool_t) mrcp_server_destroy(mrcp_server_t *server);
-
-
-/**
- * Register MRCP resource factory.
- * @param server the MRCP server to set resource factory for
- * @param resource_factory the resource factory to set
- */
-MRCP_DECLARE(apt_bool_t) mrcp_server_resource_factory_register(
- mrcp_server_t *server,
- mrcp_resource_factory_t *resource_factory);
-
-/**
- * Register MRCP engine.
- * @param server the MRCP server to set engine for
- * @param engine the engine to set
- */
-MRCP_DECLARE(apt_bool_t) mrcp_server_engine_register(
- mrcp_server_t *server,
- mrcp_engine_t *engine);
-
-/**
- * Register codec manager.
- * @param server the MRCP server to set codec manager for
- * @param codec_manager the codec manager to set
- */
-MRCP_DECLARE(apt_bool_t) mrcp_server_codec_manager_register(mrcp_server_t *server, mpf_codec_manager_t *codec_manager);
-
-/**
- * Get registered codec manager.
- * @param server the MRCP server to get codec manager from
- */
-MRCP_DECLARE(const mpf_codec_manager_t*) mrcp_server_codec_manager_get(const mrcp_server_t *server);
-
-/**
- * Register media engine.
- * @param server the MRCP server to set media engine for
- * @param media_engine the media engine to set
- */
-MRCP_DECLARE(apt_bool_t) mrcp_server_media_engine_register(
- mrcp_server_t *server,
- mpf_engine_t *media_engine);
-
-/**
- * Register RTP termination factory.
- * @param server the MRCP server to set termination factory for
- * @param rtp_termination_factory the termination factory
- * @param name the name of the factory
- */
-MRCP_DECLARE(apt_bool_t) mrcp_server_rtp_factory_register(
- mrcp_server_t *server,
- mpf_termination_factory_t *rtp_termination_factory,
- const char *name);
-
-/**
- * Register RTP settings.
- * @param server the MRCP server to set RTP settings for
- * @param rtp_settings the settings to set
- * @param name the name of the settings
- */
-MRCP_DECLARE(apt_bool_t) mrcp_server_rtp_settings_register(
- mrcp_server_t *server,
- mpf_rtp_settings_t *rtp_settings,
- const char *name);
-
-/**
- * Register MRCP signaling agent.
- * @param server the MRCP server to set signaling agent for
- * @param signaling_agent the signaling agent to set
- */
-MRCP_DECLARE(apt_bool_t) mrcp_server_signaling_agent_register(
- mrcp_server_t *server,
- mrcp_sig_agent_t *signaling_agent);
-
-/**
- * Register MRCP connection agent (MRCPv2 only).
- * @param server the MRCP server to set connection agent for
- * @param connection_agent the connection agent to set
- */
-MRCP_DECLARE(apt_bool_t) mrcp_server_connection_agent_register(
- mrcp_server_t *server,
- mrcp_connection_agent_t *connection_agent);
-
-/** Create MRCP profile */
-MRCP_DECLARE(mrcp_server_profile_t*) mrcp_server_profile_create(
- const char *id,
- mrcp_version_e mrcp_version,
- mrcp_resource_factory_t *resource_factory,
- mrcp_sig_agent_t *signaling_agent,
- mrcp_connection_agent_t *connection_agent,
- mpf_engine_t *media_engine,
- mpf_termination_factory_t *rtp_factory,
- mpf_rtp_settings_t *rtp_settings,
- apr_pool_t *pool);
-
-/**
- * Register MRCP profile.
- * @param server the MRCP server to set profile for
- * @param profile the profile to set
- * @param plugin_map the map of engines (plugins)
- */
-MRCP_DECLARE(apt_bool_t) mrcp_server_profile_register(
- mrcp_server_t *server,
- mrcp_server_profile_t *profile,
- apr_table_t *plugin_map);
-
-/**
- * Load MRCP engine as a plugin.
- * @param server the MRCP server to use
- * @param id the identifier of the plugin
- * @param path the path to the plugin to load
- * @param config the config of the engine
- */
-MRCP_DECLARE(mrcp_engine_t*) mrcp_server_engine_load(
- mrcp_server_t *server,
- const char *id,
- const char *path,
- mrcp_engine_config_t *config);
-
-/**
- * Get memory pool.
- * @param server the MRCP server to get memory pool from
- */
-MRCP_DECLARE(apr_pool_t*) mrcp_server_memory_pool_get(const mrcp_server_t *server);
-
-/**
- * Get media engine by name.
- * @param server the MRCP server to get media engine from
- * @param name the name of the media engine to lookup
- */
-MRCP_DECLARE(mpf_engine_t*) mrcp_server_media_engine_get(const mrcp_server_t *server, const char *name);
-
-/**
- * Get RTP termination factory by name.
- * @param server the MRCP server to get from
- * @param name the name to lookup
- */
-MRCP_DECLARE(mpf_termination_factory_t*) mrcp_server_rtp_factory_get(const mrcp_server_t *server, const char *name);
-
-/**
- * Get RTP settings by name
- * @param server the MRCP server to get from
- * @param name the name to lookup
- */
-MRCP_DECLARE(mpf_rtp_settings_t*) mrcp_server_rtp_settings_get(const mrcp_server_t *server, const char *name);
-
-/**
- * Get signaling agent by name.
- * @param server the MRCP server to get from
- * @param name the name to lookup
- */
-MRCP_DECLARE(mrcp_sig_agent_t*) mrcp_server_signaling_agent_get(const mrcp_server_t *server, const char *name);
-
-/**
- * Get connection agent by name.
- * @param server the MRCP server to get from
- * @param name the name to lookup
- */
-MRCP_DECLARE(mrcp_connection_agent_t*) mrcp_server_connection_agent_get(const mrcp_server_t *server, const char *name);
-
-/**
- * Get profile by name.
- * @param server the MRCP client to get from
- * @param name the name to lookup
- */
-MRCP_DECLARE(mrcp_server_profile_t*) mrcp_server_profile_get(const mrcp_server_t *server, const char *name);
-
-APT_END_EXTERN_C
-
-#endif /* MRCP_SERVER_H */
diff --git a/libs/unimrcp/libs/mrcp-server/include/mrcp_server_session.h b/libs/unimrcp/libs/mrcp-server/include/mrcp_server_session.h
deleted file mode 100644
index af456a021a..0000000000
--- a/libs/unimrcp/libs/mrcp-server/include/mrcp_server_session.h
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_server_session.h 2251 2014-11-21 02:36:44Z achaloyan@gmail.com $
- */
-
-#ifndef MRCP_SERVER_SESSION_H
-#define MRCP_SERVER_SESSION_H
-
-/**
- * @file mrcp_server_session.h
- * @brief MRCP Server Session
- */
-
-#include
-#include "mrcp_session.h"
-#include "mpf_engine.h"
-#include "apt_task.h"
-#include "apt_obj_list.h"
-
-
-APT_BEGIN_EXTERN_C
-
-/** Opaque MRCP channel declaration */
-typedef struct mrcp_channel_t mrcp_channel_t;
-/** MRCP server session declaration */
-typedef struct mrcp_server_session_t mrcp_server_session_t;
-/** MRCP signaling message declaration */
-typedef struct mrcp_signaling_message_t mrcp_signaling_message_t;
-
-/** Enumeration of signaling task messages */
-typedef enum {
- SIGNALING_MESSAGE_OFFER,
- SIGNALING_MESSAGE_CONTROL,
- SIGNALING_MESSAGE_TERMINATE,
-} mrcp_signaling_message_type_e;
-
-/** MRCP signaling message */
-struct mrcp_signaling_message_t {
- /** Signaling message type */
- mrcp_signaling_message_type_e type;
-
- /** Session */
- mrcp_server_session_t *session;
- /** Descriptor */
- mrcp_session_descriptor_t *descriptor;
-
- /** Channel */
- mrcp_channel_t *channel;
- /** MRCP message */
- mrcp_message_t *message;
-};
-
-/** Server session states */
-typedef enum {
- SESSION_STATE_NONE, /**< initial state */
- SESSION_STATE_GENERATING_ANSWER, /**< received offer, generating answer now */
- SESSION_STATE_INITIALIZING, /**< answer is ready, finally initializing channels now */
- SESSION_STATE_DEACTIVATING, /**< received session termination request, deinitializing channels now */
- SESSION_STATE_TERMINATING /**< finally terminating session */
-} mrcp_server_session_state_e;
-
-
-/** MRCP server session */
-struct mrcp_server_session_t {
- /** Session base */
- mrcp_session_t base;
- /** MRCP server */
- mrcp_server_t *server;
- /** MRCP profile */
- mrcp_server_profile_t *profile;
-
- /** Media context */
- mpf_context_t *context;
-
- /** Media termination array */
- apr_array_header_t *terminations;
- /** MRCP control channel array */
- apr_array_header_t *channels;
-
- /** In-progress signaling request */
- mrcp_signaling_message_t *active_request;
- /** Signaling request queue */
- apt_obj_list_t *request_queue;
-
- /** In-progress offer */
- mrcp_session_descriptor_t *offer;
- /** In-progres answer */
- mrcp_session_descriptor_t *answer;
-
- /** MPF task message, which construction is in progress */
- mpf_task_msg_t *mpf_task_msg;
-
- /** Session state */
- mrcp_server_session_state_e state;
- /** Number of in-progress sub requests */
- apr_size_t subrequest_count;
-};
-
-/** MRCP server profile */
-struct mrcp_server_profile_t {
- /** Identifier of the profile */
- const char *id;
- /** MRCP version */
- mrcp_version_e mrcp_version;
- /** Table of engines (mrcp_engine_t*) */
- apr_hash_t *engine_table;
- /** MRCP resource factory */
- mrcp_resource_factory_t *resource_factory;
- /** Media processing engine */
- mpf_engine_t *media_engine;
- /** RTP termination factory */
- mpf_termination_factory_t *rtp_termination_factory;
- /** RTP settings */
- mpf_rtp_settings_t *rtp_settings;
- /** Signaling agent */
- mrcp_sig_agent_t *signaling_agent;
- /** Connection agent */
- mrcp_connection_agent_t *connection_agent;
-};
-
-/** Create server session */
-mrcp_server_session_t* mrcp_server_session_create(void);
-
-/** Process signaling message */
-apt_bool_t mrcp_server_signaling_message_process(mrcp_signaling_message_t *signaling_message);
-/** Process MPF message */
-apt_bool_t mrcp_server_mpf_message_process(mpf_message_container_t *mpf_message_container);
-
-/** Process channel modify event */
-apt_bool_t mrcp_server_on_channel_modify(mrcp_channel_t *channel, mrcp_control_descriptor_t *answer, apt_bool_t status);
-/** Process channel remove event */
-apt_bool_t mrcp_server_on_channel_remove(mrcp_channel_t *channel, apt_bool_t status);
-/** Process channel message receive */
-apt_bool_t mrcp_server_on_channel_message(mrcp_channel_t *channel, mrcp_message_t *message);
-/** Process connection disconnect event */
-apt_bool_t mrcp_server_on_disconnect(mrcp_channel_t *channel);
-
-/** Process channel open event */
-apt_bool_t mrcp_server_on_engine_channel_open(mrcp_channel_t *channel, apt_bool_t status);
-/** Process channel close event */
-apt_bool_t mrcp_server_on_engine_channel_close(mrcp_channel_t *channel);
-/** Process message receive event */
-apt_bool_t mrcp_server_on_engine_channel_message(mrcp_channel_t *channel, mrcp_message_t *message);
-
-/** Get session by channel */
-mrcp_session_t* mrcp_server_channel_session_get(mrcp_channel_t *channel);
-
-APT_END_EXTERN_C
-
-#endif /* MRCP_SERVER_SESSION_H */
diff --git a/libs/unimrcp/libs/mrcp-server/include/mrcp_server_types.h b/libs/unimrcp/libs/mrcp-server/include/mrcp_server_types.h
deleted file mode 100644
index 99c0b615ae..0000000000
--- a/libs/unimrcp/libs/mrcp-server/include/mrcp_server_types.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_server_types.h 2251 2014-11-21 02:36:44Z achaloyan@gmail.com $
- */
-
-#ifndef MRCP_SERVER_TYPES_H
-#define MRCP_SERVER_TYPES_H
-
-/**
- * @file mrcp_server_types.h
- * @brief MRCP Server Types
- */
-
-#include "mrcp_sig_types.h"
-#include "mrcp_connection_types.h"
-#include "mpf_types.h"
-
-APT_BEGIN_EXTERN_C
-
-/** Opaque MRCP server declaration */
-typedef struct mrcp_server_t mrcp_server_t;
-
-/** Opaque MRCP server profile declaration */
-typedef struct mrcp_server_profile_t mrcp_server_profile_t;
-
-
-APT_END_EXTERN_C
-
-#endif /* MRCP_SERVER_TYPES_H */
diff --git a/libs/unimrcp/libs/mrcp-server/mrcpserver.vcproj b/libs/unimrcp/libs/mrcp-server/mrcpserver.vcproj
deleted file mode 100644
index da47c522b9..0000000000
--- a/libs/unimrcp/libs/mrcp-server/mrcpserver.vcproj
+++ /dev/null
@@ -1,272 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/libs/unimrcp/libs/mrcp-server/mrcpserver.vcxproj b/libs/unimrcp/libs/mrcp-server/mrcpserver.vcxproj
deleted file mode 100644
index 1d3fff21bc..0000000000
--- a/libs/unimrcp/libs/mrcp-server/mrcpserver.vcxproj
+++ /dev/null
@@ -1,127 +0,0 @@
-
-
-
-
- Debug
- Win32
-
-
- Debug
- x64
-
-
- Release
- Win32
-
-
- Release
- x64
-
-
-
- {18B1F35A-10F8-4287-9B37-2D10501B0B38}
- mrcpserver
- Win32Proj
-
-
-
- StaticLibrary
- Unicode
- true
-
-
- StaticLibrary
- Unicode
-
-
- StaticLibrary
- Unicode
- true
-
-
- StaticLibrary
- Unicode
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <_ProjectFileVersion>10.0.30319.1
- AllRules.ruleset
-
-
- AllRules.ruleset
-
-
- AllRules.ruleset
-
-
- AllRules.ruleset
-
-
-
-
-
- X64
-
-
- ProgramDatabase
-
-
-
-
- X64
-
-
-
-
-
-
-
-
-
-
-
-
-
- {843425be-9a9a-44f4-a4e3-4b57d6abd53c}
- false
-
-
- {12a49562-bab9-43a3-a21d-15b60bbb4c31}
- false
-
-
- {a9edac04-6a5f-4ba7-bc0d-cce7b255b6ea}
- false
-
-
-
-
-
-
\ No newline at end of file
diff --git a/libs/unimrcp/libs/mrcp-server/mrcpserver.vcxproj.filters b/libs/unimrcp/libs/mrcp-server/mrcpserver.vcxproj.filters
deleted file mode 100644
index 866a6dfbbc..0000000000
--- a/libs/unimrcp/libs/mrcp-server/mrcpserver.vcxproj.filters
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-
-
- {93995380-89BD-4b04-88EB-625FBE52EBFB}
- h;hpp;hxx;hm;inl;inc;xsd
-
-
- {4557fd27-79b0-442d-809b-82996c7da820}
- cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
-
-
-
-
- include
-
-
- include
-
-
- include
-
-
-
-
- src
-
-
- src
-
-
-
\ No newline at end of file
diff --git a/libs/unimrcp/libs/mrcp-server/src/mrcp_server.c b/libs/unimrcp/libs/mrcp-server/src/mrcp_server.c
deleted file mode 100644
index d37528917e..0000000000
--- a/libs/unimrcp/libs/mrcp-server/src/mrcp_server.c
+++ /dev/null
@@ -1,999 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_server.c 2251 2014-11-21 02:36:44Z achaloyan@gmail.com $
- */
-
-#include "mrcp_server.h"
-#include "mrcp_server_session.h"
-#include "mrcp_message.h"
-#include "mrcp_resource_factory.h"
-#include "mrcp_resource.h"
-#include "mrcp_engine_factory.h"
-#include "mrcp_engine_loader.h"
-#include "mrcp_sig_agent.h"
-#include "mrcp_server_connection.h"
-#include "mpf_termination_factory.h"
-#include "apt_pool.h"
-#include "apt_consumer_task.h"
-#include "apt_obj_list.h"
-#include "apt_log.h"
-
-#define SERVER_TASK_NAME "MRCP Server"
-
-/** MRCP server */
-struct mrcp_server_t {
- /** Main message processing task */
- apt_consumer_task_t *task;
-
- /** MRCP resource factory */
- mrcp_resource_factory_t *resource_factory;
- /** MRCP engine factory */
- mrcp_engine_factory_t *engine_factory;
- /** Loader of plugins for MRCP engines */
- mrcp_engine_loader_t *engine_loader;
-
- /** Codec manager */
- mpf_codec_manager_t *codec_manager;
- /** Table of media processing engines (mpf_engine_t*) */
- apr_hash_t *media_engine_table;
- /** Table of RTP termination factories (mpf_termination_factory_t*) */
- apr_hash_t *rtp_factory_table;
- /** Table of signaling agents (mrcp_sig_agent_t*) */
- apr_hash_t *sig_agent_table;
- /** Table of connection agents (mrcp_connection_agent_t*) */
- apr_hash_t *cnt_agent_table;
- /** Table of RTP settings (mpf_rtp_settings_t*) */
- apr_hash_t *rtp_settings_table;
- /** Table of profiles (mrcp_server_profile_t*) */
- apr_hash_t *profile_table;
-
- /** Table of sessions */
- apr_hash_t *session_table;
-
- /** Connection task message pool */
- apt_task_msg_pool_t *connection_msg_pool;
- /** Engine task message pool */
- apt_task_msg_pool_t *engine_msg_pool;
-
- /** Dir layout structure */
- apt_dir_layout_t *dir_layout;
- /** Time server started at */
- apr_time_t start_time;
- /** Memory pool */
- apr_pool_t *pool;
-};
-
-
-typedef enum {
- MRCP_SERVER_SIGNALING_TASK_MSG = TASK_MSG_USER,
- MRCP_SERVER_CONNECTION_TASK_MSG,
- MRCP_SERVER_ENGINE_TASK_MSG,
- MRCP_SERVER_MEDIA_TASK_MSG
-} mrcp_server_task_msg_type_e;
-
-
-static apt_bool_t mrcp_server_offer_signal(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor);
-static apt_bool_t mrcp_server_terminate_signal(mrcp_session_t *session);
-static apt_bool_t mrcp_server_control_signal(mrcp_session_t *session, mrcp_message_t *message);
-
-static const mrcp_session_request_vtable_t session_request_vtable = {
- mrcp_server_offer_signal,
- mrcp_server_terminate_signal,
- mrcp_server_control_signal,
- NULL /* mrcp_server_discover_signal */
-};
-
-
-/* Connection agent interface */
-typedef enum {
- CONNECTION_AGENT_TASK_MSG_ADD_CHANNEL,
- CONNECTION_AGENT_TASK_MSG_MODIFY_CHANNEL,
- CONNECTION_AGENT_TASK_MSG_REMOVE_CHANNEL,
- CONNECTION_AGENT_TASK_MSG_RECEIVE_MESSAGE,
- CONNECTION_AGENT_TASK_MSG_DISCONNECT
-} connection_agent_task_msg_type_e;
-
-typedef struct connection_agent_task_msg_data_t connection_agent_task_msg_data_t;
-struct connection_agent_task_msg_data_t {
- mrcp_channel_t *channel;
- mrcp_control_descriptor_t *descriptor;
- mrcp_message_t *message;
- apt_bool_t status;
-};
-
-static apt_bool_t mrcp_server_channel_add_signal(mrcp_control_channel_t *channel, mrcp_control_descriptor_t *descriptor, apt_bool_t status);
-static apt_bool_t mrcp_server_channel_modify_signal(mrcp_control_channel_t *channel, mrcp_control_descriptor_t *descriptor, apt_bool_t status);
-static apt_bool_t mrcp_server_channel_remove_signal(mrcp_control_channel_t *channel, apt_bool_t status);
-static apt_bool_t mrcp_server_message_signal(mrcp_control_channel_t *channel, mrcp_message_t *message);
-static apt_bool_t mrcp_server_disconnect_signal(mrcp_control_channel_t *channel);
-
-static const mrcp_connection_event_vtable_t connection_method_vtable = {
- mrcp_server_channel_add_signal,
- mrcp_server_channel_modify_signal,
- mrcp_server_channel_remove_signal,
- mrcp_server_message_signal,
- mrcp_server_disconnect_signal
-};
-
-
-/* MRCP engine interface */
-typedef enum {
- ENGINE_TASK_MSG_OPEN_ENGINE,
- ENGINE_TASK_MSG_CLOSE_ENGINE,
- ENGINE_TASK_MSG_OPEN_CHANNEL,
- ENGINE_TASK_MSG_CLOSE_CHANNEL,
- ENGINE_TASK_MSG_MESSAGE
-} engine_task_msg_type_e;
-
-typedef struct engine_task_msg_data_t engine_task_msg_data_t;
-struct engine_task_msg_data_t {
- mrcp_engine_t *engine;
- mrcp_channel_t *channel;
- apt_bool_t status;
- mrcp_message_t *mrcp_message;
-};
-
-static apt_bool_t mrcp_server_engine_open_signal(mrcp_engine_t *engine, apt_bool_t status);
-static apt_bool_t mrcp_server_engine_close_signal(mrcp_engine_t *engine);
-
-const mrcp_engine_event_vtable_t engine_vtable = {
- mrcp_server_engine_open_signal,
- mrcp_server_engine_close_signal,
-};
-
-static apt_bool_t mrcp_server_channel_open_signal(mrcp_engine_channel_t *channel, apt_bool_t status);
-static apt_bool_t mrcp_server_channel_close_signal(mrcp_engine_channel_t *channel);
-static apt_bool_t mrcp_server_channel_message_signal(mrcp_engine_channel_t *channel, mrcp_message_t *message);
-
-const mrcp_engine_channel_event_vtable_t engine_channel_vtable = {
- mrcp_server_channel_open_signal,
- mrcp_server_channel_close_signal,
- mrcp_server_channel_message_signal
-};
-
-/* Task interface */
-static apt_bool_t mrcp_server_msg_process(apt_task_t *task, apt_task_msg_t *msg);
-static apt_bool_t mrcp_server_start_request_process(apt_task_t *task);
-static apt_bool_t mrcp_server_terminate_request_process(apt_task_t *task);
-static void mrcp_server_on_start_complete(apt_task_t *task);
-static void mrcp_server_on_terminate_complete(apt_task_t *task);
-
-static mrcp_session_t* mrcp_server_sig_agent_session_create(mrcp_sig_agent_t *signaling_agent);
-
-
-/** Create MRCP server instance */
-MRCP_DECLARE(mrcp_server_t*) mrcp_server_create(apt_dir_layout_t *dir_layout)
-{
- mrcp_server_t *server;
- apr_pool_t *pool;
- apt_task_t *task;
- apt_task_vtable_t *vtable;
- apt_task_msg_pool_t *msg_pool;
-
- pool = apt_pool_create();
- if(!pool) {
- return NULL;
- }
-
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create "SERVER_TASK_NAME);
- server = apr_palloc(pool,sizeof(mrcp_server_t));
- server->pool = pool;
- server->dir_layout = dir_layout;
- server->resource_factory = NULL;
- server->engine_factory = NULL;
- server->engine_loader = NULL;
- server->media_engine_table = NULL;
- server->rtp_factory_table = NULL;
- server->sig_agent_table = NULL;
- server->cnt_agent_table = NULL;
- server->rtp_settings_table = NULL;
- server->profile_table = NULL;
- server->session_table = NULL;
- server->connection_msg_pool = NULL;
- server->engine_msg_pool = NULL;
-
- msg_pool = apt_task_msg_pool_create_dynamic(0,pool);
-
- server->task = apt_consumer_task_create(server,msg_pool,pool);
- if(!server->task) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Server Task");
- return NULL;
- }
- task = apt_consumer_task_base_get(server->task);
- apt_task_name_set(task,SERVER_TASK_NAME);
- vtable = apt_task_vtable_get(task);
- if(vtable) {
- vtable->process_msg = mrcp_server_msg_process;
- vtable->process_start = mrcp_server_start_request_process;
- vtable->process_terminate = mrcp_server_terminate_request_process;
- vtable->on_start_complete = mrcp_server_on_start_complete;
- vtable->on_terminate_complete = mrcp_server_on_terminate_complete;
- }
-
- server->engine_factory = mrcp_engine_factory_create(server->pool);
- server->engine_loader = mrcp_engine_loader_create(server->pool);
-
- server->media_engine_table = apr_hash_make(server->pool);
- server->rtp_factory_table = apr_hash_make(server->pool);
- server->rtp_settings_table = apr_hash_make(server->pool);
- server->sig_agent_table = apr_hash_make(server->pool);
- server->cnt_agent_table = apr_hash_make(server->pool);
-
- server->profile_table = apr_hash_make(server->pool);
-
- server->session_table = apr_hash_make(server->pool);
- return server;
-}
-
-/** Start message processing loop */
-MRCP_DECLARE(apt_bool_t) mrcp_server_start(mrcp_server_t *server)
-{
- apt_task_t *task;
- if(!server || !server->task) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Invalid Server");
- return FALSE;
- }
- server->start_time = apr_time_now();
- task = apt_consumer_task_base_get(server->task);
- if(apt_task_start(task) == FALSE) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Start Server Task");
- return FALSE;
- }
- return TRUE;
-}
-
-/** Shutdown message processing loop */
-MRCP_DECLARE(apt_bool_t) mrcp_server_shutdown(mrcp_server_t *server)
-{
- apt_task_t *task;
- apr_time_t uptime;
- if(!server || !server->task) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Invalid Server");
- return FALSE;
- }
- task = apt_consumer_task_base_get(server->task);
- if(apt_task_terminate(task,TRUE) == FALSE) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Shutdown Server Task");
- return FALSE;
- }
- server->session_table = NULL;
- uptime = apr_time_now() - server->start_time;
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Server Uptime [%"APR_TIME_T_FMT" sec]", apr_time_sec(uptime));
- return TRUE;
-}
-
-/** Destroy MRCP server */
-MRCP_DECLARE(apt_bool_t) mrcp_server_destroy(mrcp_server_t *server)
-{
- apt_task_t *task;
- if(!server || !server->task) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Invalid Server");
- return FALSE;
- }
-
- mrcp_engine_factory_destroy(server->engine_factory);
- mrcp_engine_loader_destroy(server->engine_loader);
-
- task = apt_consumer_task_base_get(server->task);
- apt_task_destroy(task);
-
- apr_pool_destroy(server->pool);
- return TRUE;
-}
-
-/** Register MRCP resource factory */
-MRCP_DECLARE(apt_bool_t) mrcp_server_resource_factory_register(mrcp_server_t *server, mrcp_resource_factory_t *resource_factory)
-{
- if(!resource_factory) {
- return FALSE;
- }
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Register Resource Factory");
- server->resource_factory = resource_factory;
- return TRUE;
-}
-
-/** Register MRCP engine */
-MRCP_DECLARE(apt_bool_t) mrcp_server_engine_register(mrcp_server_t *server, mrcp_engine_t *engine)
-{
- if(!engine || !engine->id) {
- return FALSE;
- }
-
- if(!server->engine_msg_pool) {
- server->engine_msg_pool = apt_task_msg_pool_create_dynamic(sizeof(engine_task_msg_data_t),server->pool);
- }
- engine->codec_manager = server->codec_manager;
- engine->dir_layout = server->dir_layout;
- engine->event_vtable = &engine_vtable;
- engine->event_obj = server;
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Register MRCP Engine [%s]",engine->id);
- return mrcp_engine_factory_engine_register(server->engine_factory,engine);
-}
-
-/** Register codec manager */
-MRCP_DECLARE(apt_bool_t) mrcp_server_codec_manager_register(mrcp_server_t *server, mpf_codec_manager_t *codec_manager)
-{
- if(!codec_manager) {
- return FALSE;
- }
- server->codec_manager = codec_manager;
- return TRUE;
-}
-
-/** Get registered codec manager */
-MRCP_DECLARE(const mpf_codec_manager_t*) mrcp_server_codec_manager_get(const mrcp_server_t *server)
-{
- return server->codec_manager;
-}
-
-/** Register media engine */
-MRCP_DECLARE(apt_bool_t) mrcp_server_media_engine_register(mrcp_server_t *server, mpf_engine_t *media_engine)
-{
- const char *id;
- if(!media_engine) {
- return FALSE;
- }
- id = mpf_engine_id_get(media_engine);
- if(!id) {
- return FALSE;
- }
-
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Register Media Engine [%s]",id);
- mpf_engine_codec_manager_register(media_engine,server->codec_manager);
- apr_hash_set(server->media_engine_table,id,APR_HASH_KEY_STRING,media_engine);
- mpf_engine_task_msg_type_set(media_engine,MRCP_SERVER_MEDIA_TASK_MSG);
- if(server->task) {
- apt_task_t *media_task = mpf_task_get(media_engine);
- apt_task_t *task = apt_consumer_task_base_get(server->task);
- apt_task_add(task,media_task);
- }
- return TRUE;
-}
-
-/** Get media engine by name */
-MRCP_DECLARE(mpf_engine_t*) mrcp_server_media_engine_get(const mrcp_server_t *server, const char *name)
-{
- return apr_hash_get(server->media_engine_table,name,APR_HASH_KEY_STRING);
-}
-
-/** Register RTP termination factory */
-MRCP_DECLARE(apt_bool_t) mrcp_server_rtp_factory_register(mrcp_server_t *server, mpf_termination_factory_t *rtp_termination_factory, const char *name)
-{
- if(!rtp_termination_factory || !name) {
- return FALSE;
- }
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Register RTP Termination Factory [%s]",name);
- apr_hash_set(server->rtp_factory_table,name,APR_HASH_KEY_STRING,rtp_termination_factory);
- return TRUE;
-}
-
-/** Get RTP termination factory by name */
-MRCP_DECLARE(mpf_termination_factory_t*) mrcp_server_rtp_factory_get(const mrcp_server_t *server, const char *name)
-{
- return apr_hash_get(server->rtp_factory_table,name,APR_HASH_KEY_STRING);
-}
-
-/** Register RTP settings */
-MRCP_DECLARE(apt_bool_t) mrcp_server_rtp_settings_register(mrcp_server_t *server, mpf_rtp_settings_t *rtp_settings, const char *name)
-{
- if(!rtp_settings || !name) {
- return FALSE;
- }
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Register RTP Settings [%s]",name);
- apr_hash_set(server->rtp_settings_table,name,APR_HASH_KEY_STRING,rtp_settings);
- return TRUE;
-}
-
-/** Get RTP settings by name */
-MRCP_DECLARE(mpf_rtp_settings_t*) mrcp_server_rtp_settings_get(const mrcp_server_t *server, const char *name)
-{
- return apr_hash_get(server->rtp_settings_table,name,APR_HASH_KEY_STRING);
-}
-
-/** Register MRCP signaling agent */
-MRCP_DECLARE(apt_bool_t) mrcp_server_signaling_agent_register(mrcp_server_t *server, mrcp_sig_agent_t *signaling_agent)
-{
- if(!signaling_agent || !signaling_agent->id) {
- return FALSE;
- }
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Register Signaling Agent [%s]",signaling_agent->id);
- signaling_agent->parent = server;
- signaling_agent->resource_factory = server->resource_factory;
- signaling_agent->create_server_session = mrcp_server_sig_agent_session_create;
- signaling_agent->msg_pool = apt_task_msg_pool_create_dynamic(sizeof(mrcp_signaling_message_t*),server->pool);
- apr_hash_set(server->sig_agent_table,signaling_agent->id,APR_HASH_KEY_STRING,signaling_agent);
- if(server->task) {
- apt_task_t *task = apt_consumer_task_base_get(server->task);
- apt_task_add(task,signaling_agent->task);
- }
- return TRUE;
-}
-
-/** Get signaling agent by name */
-MRCP_DECLARE(mrcp_sig_agent_t*) mrcp_server_signaling_agent_get(const mrcp_server_t *server, const char *name)
-{
- return apr_hash_get(server->sig_agent_table,name,APR_HASH_KEY_STRING);
-}
-
-/** Register MRCP connection agent (MRCPv2 only) */
-MRCP_DECLARE(apt_bool_t) mrcp_server_connection_agent_register(mrcp_server_t *server, mrcp_connection_agent_t *connection_agent)
-{
- const char *id;
- if(!connection_agent) {
- return FALSE;
- }
- id = mrcp_server_connection_agent_id_get(connection_agent);
- if(!id) {
- return FALSE;
- }
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Register Connection Agent [%s]",id);
- mrcp_server_connection_resource_factory_set(connection_agent,server->resource_factory);
- mrcp_server_connection_agent_handler_set(connection_agent,server,&connection_method_vtable);
- server->connection_msg_pool = apt_task_msg_pool_create_dynamic(sizeof(connection_agent_task_msg_data_t),server->pool);
- apr_hash_set(server->cnt_agent_table,id,APR_HASH_KEY_STRING,connection_agent);
- if(server->task) {
- apt_task_t *task = apt_consumer_task_base_get(server->task);
- apt_task_t *connection_task = mrcp_server_connection_agent_task_get(connection_agent);
- apt_task_add(task,connection_task);
- }
- return TRUE;
-}
-
-/** Get connection agent by name */
-MRCP_DECLARE(mrcp_connection_agent_t*) mrcp_server_connection_agent_get(const mrcp_server_t *server, const char *name)
-{
- return apr_hash_get(server->cnt_agent_table,name,APR_HASH_KEY_STRING);
-}
-
-/** Create MRCP profile */
-MRCP_DECLARE(mrcp_server_profile_t*) mrcp_server_profile_create(
- const char *id,
- mrcp_version_e mrcp_version,
- mrcp_resource_factory_t *resource_factory,
- mrcp_sig_agent_t *signaling_agent,
- mrcp_connection_agent_t *connection_agent,
- mpf_engine_t *media_engine,
- mpf_termination_factory_t *rtp_factory,
- mpf_rtp_settings_t *rtp_settings,
- apr_pool_t *pool)
-{
- mrcp_server_profile_t *profile = apr_palloc(pool,sizeof(mrcp_server_profile_t));
- profile->id = id;
- profile->mrcp_version = mrcp_version;
- profile->resource_factory = resource_factory;
- profile->engine_table = NULL;
- profile->media_engine = media_engine;
- profile->rtp_termination_factory = rtp_factory;
- profile->rtp_settings = rtp_settings;
- profile->signaling_agent = signaling_agent;
- profile->connection_agent = connection_agent;
-
- mpf_termination_factory_engine_assign(rtp_factory,media_engine);
- return profile;
-}
-
-static apt_bool_t mrcp_server_engine_table_make(mrcp_server_t *server, mrcp_server_profile_t *profile, apr_table_t *plugin_map)
-{
- int i;
- mrcp_resource_t *resource;
- const char *plugin_name = NULL;
- mrcp_engine_t *engine;
-
- profile->engine_table = apr_hash_make(server->pool);
- for(i=0; iresource_factory,i);
- if(!resource) continue;
-
- engine = NULL;
- /* first, try to find engine by name specified in plugin map (if available) */
- if(plugin_map) {
- plugin_name = apr_table_get(plugin_map,resource->name.buf);
- if(plugin_name) {
- engine = mrcp_engine_factory_engine_get(server->engine_factory,plugin_name);
- }
- }
-
- /* next, if no engine found or specified, try to find the first available one */
- if(!engine) {
- engine = mrcp_engine_factory_engine_find(server->engine_factory,i);
- }
-
- if(engine) {
- if(engine->id) {
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Assign MRCP Engine [%s] [%s]",resource->name.buf,engine->id);
- }
- apr_hash_set(profile->engine_table,resource->name.buf,resource->name.length,engine);
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"No MRCP Engine Available [%s]",resource->name.buf);
- }
- }
-
- return TRUE;
-}
-
-/** Register MRCP profile */
-MRCP_DECLARE(apt_bool_t) mrcp_server_profile_register(
- mrcp_server_t *server,
- mrcp_server_profile_t *profile,
- apr_table_t *plugin_map)
-{
- if(!profile || !profile->id) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Register Profile: no name");
- return FALSE;
- }
- if(!profile->resource_factory) {
- if(!server->resource_factory) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Register Profile [%s]: missing resource factory",profile->id);
- return FALSE;
- }
- profile->resource_factory = server->resource_factory;
- }
- mrcp_server_engine_table_make(server,profile,plugin_map);
-
- if(!profile->signaling_agent) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Register Profile [%s]: missing signaling agent",profile->id);
- return FALSE;
- }
- if(profile->mrcp_version == MRCP_VERSION_2 &&
- !profile->connection_agent) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Register Profile [%s]: missing connection agent",profile->id);
- return FALSE;
- }
- if(!profile->media_engine) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Register Profile [%s]: missing media engine",profile->id);
- return FALSE;
- }
- if(!profile->rtp_termination_factory) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Register Profile [%s]: missing RTP factory",profile->id);
- return FALSE;
- }
-
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Register Profile [%s]",profile->id);
- apr_hash_set(server->profile_table,profile->id,APR_HASH_KEY_STRING,profile);
- return TRUE;
-}
-
-/** Get profile by name */
-MRCP_DECLARE(mrcp_server_profile_t*) mrcp_server_profile_get(const mrcp_server_t *server, const char *name)
-{
- return apr_hash_get(server->profile_table,name,APR_HASH_KEY_STRING);
-}
-
-/** Load MRCP engine */
-MRCP_DECLARE(mrcp_engine_t*) mrcp_server_engine_load(
- mrcp_server_t *server,
- const char *id,
- const char *path,
- mrcp_engine_config_t *config)
-{
- mrcp_engine_t *engine;
- if(!id || !path || !config) {
- return FALSE;
- }
-
- engine = mrcp_engine_loader_plugin_load(server->engine_loader,id,path,config);
- if(!engine) {
- return FALSE;
- }
-
- return engine;
-}
-
-MRCP_DECLARE(apr_pool_t*) mrcp_server_memory_pool_get(const mrcp_server_t *server)
-{
- return server->pool;
-}
-
-void mrcp_server_session_add(mrcp_server_session_t *session)
-{
- if(session->base.id.buf) {
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Add Session "APT_SID_FMT,MRCP_SESSION_SID(&session->base));
- apr_hash_set(session->server->session_table,session->base.id.buf,session->base.id.length,session);
- }
-}
-
-void mrcp_server_session_remove(mrcp_server_session_t *session)
-{
- if(session->base.id.buf) {
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Remove Session "APT_SID_FMT,MRCP_SESSION_SID(&session->base));
- apr_hash_set(session->server->session_table,session->base.id.buf,session->base.id.length,NULL);
- }
-}
-
-static APR_INLINE mrcp_server_session_t* mrcp_server_session_find(mrcp_server_t *server, const apt_str_t *session_id)
-{
- return apr_hash_get(server->session_table,session_id->buf,session_id->length);
-}
-
-static apt_bool_t mrcp_server_start_request_process(apt_task_t *task)
-{
- apt_consumer_task_t *consumer_task = apt_task_object_get(task);
- mrcp_server_t *server = apt_consumer_task_object_get(consumer_task);
-
- mrcp_engine_t *engine;
- apr_hash_index_t *it;
- void *val;
- it = mrcp_engine_factory_engine_first(server->engine_factory);
- for(; it; it = apr_hash_next(it)) {
- apr_hash_this(it,NULL,NULL,&val);
- engine = val;
- if(engine) {
- if(mrcp_engine_virtual_open(engine) == TRUE) {
- apt_task_start_request_add(task);
- }
- }
- }
-
- return apt_task_start_request_process(task);
-}
-
-static apt_bool_t mrcp_server_terminate_request_process(apt_task_t *task)
-{
- apt_consumer_task_t *consumer_task = apt_task_object_get(task);
- mrcp_server_t *server = apt_consumer_task_object_get(consumer_task);
-
- mrcp_engine_t *engine;
- apr_hash_index_t *it;
- void *val;
- it = mrcp_engine_factory_engine_first(server->engine_factory);
- for(; it; it = apr_hash_next(it)) {
- apr_hash_this(it,NULL,NULL,&val);
- engine = val;
- if(engine) {
- if(mrcp_engine_virtual_close(engine) == TRUE) {
- apt_task_terminate_request_add(task);
- }
- }
- }
-
- return apt_task_terminate_request_process(task);
-}
-
-static void mrcp_server_on_start_complete(apt_task_t *task)
-{
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,SERVER_TASK_NAME" Started");
-}
-
-static void mrcp_server_on_terminate_complete(apt_task_t *task)
-{
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,SERVER_TASK_NAME" Terminated");
-}
-
-static apt_bool_t mrcp_server_msg_process(apt_task_t *task, apt_task_msg_t *msg)
-{
- switch(msg->type) {
- case MRCP_SERVER_SIGNALING_TASK_MSG:
- {
- mrcp_signaling_message_t **signaling_message = (mrcp_signaling_message_t**) msg->data;
- mrcp_server_signaling_message_process(*signaling_message);
- break;
- }
- case MRCP_SERVER_CONNECTION_TASK_MSG:
- {
- const connection_agent_task_msg_data_t *connection_message = (const connection_agent_task_msg_data_t*)msg->data;
- switch(msg->sub_type) {
- case CONNECTION_AGENT_TASK_MSG_ADD_CHANNEL:
- {
- mrcp_server_on_channel_modify(connection_message->channel,connection_message->descriptor,connection_message->status);
- break;
- }
- case CONNECTION_AGENT_TASK_MSG_MODIFY_CHANNEL:
- {
- mrcp_server_on_channel_modify(connection_message->channel,connection_message->descriptor,connection_message->status);
- break;
- }
- case CONNECTION_AGENT_TASK_MSG_REMOVE_CHANNEL:
- {
- mrcp_server_on_channel_remove(connection_message->channel,connection_message->status);
- break;
- }
- case CONNECTION_AGENT_TASK_MSG_RECEIVE_MESSAGE:
- {
- mrcp_server_on_channel_message(connection_message->channel, connection_message->message);
- break;
- }
- case CONNECTION_AGENT_TASK_MSG_DISCONNECT:
- {
- mrcp_server_on_channel_message(connection_message->channel, connection_message->message);
- break;
- }
- default:
- break;
- }
- break;
- }
- case MRCP_SERVER_ENGINE_TASK_MSG:
- {
- engine_task_msg_data_t *data = (engine_task_msg_data_t*)msg->data;
- switch(msg->sub_type) {
- case ENGINE_TASK_MSG_OPEN_ENGINE:
- mrcp_engine_on_open(data->engine,data->status);
- apt_task_start_request_remove(task);
- break;
- case ENGINE_TASK_MSG_CLOSE_ENGINE:
- mrcp_engine_on_close(data->engine);
- apt_task_terminate_request_remove(task);
- break;
- case ENGINE_TASK_MSG_OPEN_CHANNEL:
- mrcp_server_on_engine_channel_open(data->channel,data->status);
- break;
- case ENGINE_TASK_MSG_CLOSE_CHANNEL:
- mrcp_server_on_engine_channel_close(data->channel);
- break;
- case ENGINE_TASK_MSG_MESSAGE:
- mrcp_server_on_engine_channel_message(data->channel,data->mrcp_message);
- break;
- default:
- break;
- }
- break;
- }
- case MRCP_SERVER_MEDIA_TASK_MSG:
- {
- mpf_message_container_t *mpf_message_container = (mpf_message_container_t*) msg->data;
- mrcp_server_mpf_message_process(mpf_message_container);
- break;
- }
- default:
- {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Task Message Received [%d;%d]", msg->type,msg->sub_type);
- break;
- }
- }
- return TRUE;
-}
-
-static apt_bool_t mrcp_server_signaling_task_msg_signal(mrcp_signaling_message_type_e type, mrcp_session_t *session, mrcp_session_descriptor_t *descriptor, mrcp_message_t *message)
-{
- mrcp_signaling_message_t *signaling_message;
- apt_task_msg_t *task_msg = apt_task_msg_acquire(session->signaling_agent->msg_pool);
- mrcp_signaling_message_t **slot = ((mrcp_signaling_message_t**)task_msg->data);
- task_msg->type = MRCP_SERVER_SIGNALING_TASK_MSG;
- task_msg->sub_type = type;
-
- signaling_message = apr_palloc(session->pool,sizeof(mrcp_signaling_message_t));
- signaling_message->type = type;
- signaling_message->session = (mrcp_server_session_t*)session;
- signaling_message->descriptor = descriptor;
- signaling_message->channel = NULL;
- signaling_message->message = message;
- *slot = signaling_message;
-
- return apt_task_msg_parent_signal(session->signaling_agent->task,task_msg);
-}
-
-static apt_bool_t mrcp_server_connection_task_msg_signal(
- connection_agent_task_msg_type_e type,
- mrcp_connection_agent_t *agent,
- mrcp_control_channel_t *channel,
- mrcp_control_descriptor_t *descriptor,
- mrcp_message_t *message,
- apt_bool_t status)
-{
- mrcp_server_t *server = mrcp_server_connection_agent_object_get(agent);
- apt_task_t *task = apt_consumer_task_base_get(server->task);
- connection_agent_task_msg_data_t *data;
- apt_task_msg_t *task_msg = apt_task_msg_acquire(server->connection_msg_pool);
- task_msg->type = MRCP_SERVER_CONNECTION_TASK_MSG;
- task_msg->sub_type = type;
- data = (connection_agent_task_msg_data_t*) task_msg->data;
- data->channel = channel ? channel->obj : NULL;
- data->descriptor = descriptor;
- data->message = message;
- data->status = status;
-
- return apt_task_msg_signal(task,task_msg);
-}
-
-static apt_bool_t mrcp_server_engine_task_msg_signal(
- engine_task_msg_type_e type,
- mrcp_engine_t *engine,
- apt_bool_t status)
-{
- mrcp_server_t *server = engine->event_obj;
- apt_task_t *task = apt_consumer_task_base_get(server->task);
- engine_task_msg_data_t *data;
- apt_task_msg_t *task_msg = apt_task_msg_acquire(server->engine_msg_pool);
- task_msg->type = MRCP_SERVER_ENGINE_TASK_MSG;
- task_msg->sub_type = type;
- data = (engine_task_msg_data_t*) task_msg->data;
- data->engine = engine;
- data->channel = NULL;
- data->status = status;
- data->mrcp_message = NULL;
-
- return apt_task_msg_signal(task,task_msg);
-}
-
-static apt_bool_t mrcp_server_channel_task_msg_signal(
- engine_task_msg_type_e type,
- mrcp_engine_channel_t *engine_channel,
- apt_bool_t status,
- mrcp_message_t *message)
-{
- mrcp_channel_t *channel = engine_channel->event_obj;
- mrcp_session_t *session = mrcp_server_channel_session_get(channel);
- mrcp_server_t *server = session->signaling_agent->parent;
- apt_task_t *task = apt_consumer_task_base_get(server->task);
- engine_task_msg_data_t *data;
- apt_task_msg_t *task_msg = apt_task_msg_acquire(server->engine_msg_pool);
- task_msg->type = MRCP_SERVER_ENGINE_TASK_MSG;
- task_msg->sub_type = type;
- data = (engine_task_msg_data_t*) task_msg->data;
- data->engine = engine_channel->engine;
- data->channel = channel;
- data->status = status;
- data->mrcp_message = message;
-
- return apt_task_msg_signal(task,task_msg);
-}
-
-static mrcp_server_profile_t* mrcp_server_profile_get_by_agent(mrcp_server_t *server, mrcp_server_session_t *session, const mrcp_sig_agent_t *signaling_agent)
-{
- mrcp_server_profile_t *profile;
- apr_hash_index_t *it;
- void *val;
- it = apr_hash_first(session->base.pool,server->profile_table);
- for(; it; it = apr_hash_next(it)) {
- apr_hash_this(it,NULL,NULL,&val);
- profile = val;
- if(profile && profile->signaling_agent == signaling_agent) {
- return profile;
- }
- }
- return NULL;
-}
-
-static mrcp_session_t* mrcp_server_sig_agent_session_create(mrcp_sig_agent_t *signaling_agent)
-{
- mrcp_server_t *server = signaling_agent->parent;
- mrcp_server_session_t *session = mrcp_server_session_create();
- session->server = server;
- session->profile = mrcp_server_profile_get_by_agent(server,session,signaling_agent);
- if(!session->profile) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot Find Profile by Agent "APT_NAMESID_FMT,
- session->base.name,
- MRCP_SESSION_SID(&session->base));
- mrcp_session_destroy(&session->base);
- return NULL;
- }
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Create Session "APT_NAMESID_FMT" [%s]",
- session->base.name,
- MRCP_SESSION_SID(&session->base),
- session->profile->id);
- session->base.signaling_agent = signaling_agent;
- session->base.request_vtable = &session_request_vtable;
- return &session->base;
-}
-
-static apt_bool_t mrcp_server_offer_signal(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor)
-{
- return mrcp_server_signaling_task_msg_signal(SIGNALING_MESSAGE_OFFER,session,descriptor,NULL);
-}
-
-static apt_bool_t mrcp_server_terminate_signal(mrcp_session_t *session)
-{
- return mrcp_server_signaling_task_msg_signal(SIGNALING_MESSAGE_TERMINATE,session,NULL,NULL);
-}
-
-static apt_bool_t mrcp_server_control_signal(mrcp_session_t *session, mrcp_message_t *message)
-{
- return mrcp_server_signaling_task_msg_signal(SIGNALING_MESSAGE_CONTROL,session,NULL,message);
-}
-
-static apt_bool_t mrcp_server_channel_add_signal(mrcp_control_channel_t *channel, mrcp_control_descriptor_t *descriptor, apt_bool_t status)
-{
- mrcp_connection_agent_t *agent = channel->agent;
- return mrcp_server_connection_task_msg_signal(
- CONNECTION_AGENT_TASK_MSG_ADD_CHANNEL,
- agent,
- channel,
- descriptor,
- NULL,
- status);
-}
-
-static apt_bool_t mrcp_server_channel_modify_signal(mrcp_control_channel_t *channel, mrcp_control_descriptor_t *descriptor, apt_bool_t status)
-{
- mrcp_connection_agent_t *agent = channel->agent;
- return mrcp_server_connection_task_msg_signal(
- CONNECTION_AGENT_TASK_MSG_MODIFY_CHANNEL,
- agent,
- channel,
- descriptor,
- NULL,
- status);
-}
-
-static apt_bool_t mrcp_server_channel_remove_signal(mrcp_control_channel_t *channel, apt_bool_t status)
-{
- mrcp_connection_agent_t *agent = channel->agent;
- return mrcp_server_connection_task_msg_signal(
- CONNECTION_AGENT_TASK_MSG_REMOVE_CHANNEL,
- agent,
- channel,
- NULL,
- NULL,
- status);
-}
-
-static apt_bool_t mrcp_server_message_signal(mrcp_control_channel_t *channel, mrcp_message_t *message)
-{
- mrcp_connection_agent_t *agent = channel->agent;
- return mrcp_server_connection_task_msg_signal(
- CONNECTION_AGENT_TASK_MSG_RECEIVE_MESSAGE,
- agent,
- channel,
- NULL,
- message,
- TRUE);
-}
-
-static apt_bool_t mrcp_server_disconnect_signal(mrcp_control_channel_t *channel)
-{
- mrcp_connection_agent_t *agent = channel->agent;
- return mrcp_server_connection_task_msg_signal(
- CONNECTION_AGENT_TASK_MSG_DISCONNECT,
- agent,
- channel,
- NULL,
- NULL,
- TRUE);
-}
-
-static apt_bool_t mrcp_server_engine_open_signal(mrcp_engine_t *engine, apt_bool_t status)
-{
- return mrcp_server_engine_task_msg_signal(
- ENGINE_TASK_MSG_OPEN_ENGINE,
- engine,
- status);
-}
-
-static apt_bool_t mrcp_server_engine_close_signal(mrcp_engine_t *engine)
-{
- return mrcp_server_engine_task_msg_signal(
- ENGINE_TASK_MSG_CLOSE_ENGINE,
- engine,
- TRUE);
-}
-
-static apt_bool_t mrcp_server_channel_open_signal(mrcp_engine_channel_t *channel, apt_bool_t status)
-{
- return mrcp_server_channel_task_msg_signal(
- ENGINE_TASK_MSG_OPEN_CHANNEL,
- channel,
- status,
- NULL);
-}
-
-static apt_bool_t mrcp_server_channel_close_signal(mrcp_engine_channel_t *channel)
-{
- return mrcp_server_channel_task_msg_signal(
- ENGINE_TASK_MSG_CLOSE_CHANNEL,
- channel,
- TRUE,
- NULL);
-}
-
-static apt_bool_t mrcp_server_channel_message_signal(mrcp_engine_channel_t *channel, mrcp_message_t *message)
-{
- return mrcp_server_channel_task_msg_signal(
- ENGINE_TASK_MSG_MESSAGE,
- channel,
- TRUE,
- message);
-}
diff --git a/libs/unimrcp/libs/mrcp-server/src/mrcp_server_session.c b/libs/unimrcp/libs/mrcp-server/src/mrcp_server_session.c
deleted file mode 100644
index c2dfb0b98f..0000000000
--- a/libs/unimrcp/libs/mrcp-server/src/mrcp_server_session.c
+++ /dev/null
@@ -1,1191 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_server_session.c 2237 2014-11-12 01:48:46Z achaloyan@gmail.com $
- */
-
-#include "mrcp_server.h"
-#include "mrcp_server_session.h"
-#include "mrcp_resource.h"
-#include "mrcp_resource_factory.h"
-#include "mrcp_engine_iface.h"
-#include "mrcp_sig_agent.h"
-#include "mrcp_server_connection.h"
-#include "mrcp_session_descriptor.h"
-#include "mrcp_control_descriptor.h"
-#include "mrcp_state_machine.h"
-#include "mrcp_message.h"
-#include "mpf_termination_factory.h"
-#include "mpf_stream.h"
-#include "apt_consumer_task.h"
-#include "apt_log.h"
-
-/** Macro to log session name and identifier */
-#define MRCP_SESSION_NAMESID(session) \
- session->base.name, MRCP_SESSION_SID(&session->base)
-
-#define MRCP_SESSION_ID_HEX_STRING_LENGTH 16
-
-struct mrcp_channel_t {
- /** Memory pool */
- apr_pool_t *pool;
- /** MRCP resource */
- mrcp_resource_t *resource;
- /** MRCP session entire channel belongs to */
- mrcp_session_t *session;
- /** MRCP control channel */
- mrcp_control_channel_t *control_channel;
- /** MRCP engine channel */
- mrcp_engine_channel_t *engine_channel;
- /** MRCP resource state machine */
- mrcp_state_machine_t *state_machine;
- /** media descriptor id (position in session descriptor) */
- apr_size_t id;
- /** array of cmid attributes (used for resource grouping) */
- apr_array_header_t *cmid_arr;
- /** waiting state of control media */
- apt_bool_t waiting_for_channel;
- /** waiting state of media termination */
- apt_bool_t waiting_for_termination;
-};
-
-typedef struct mrcp_termination_slot_t mrcp_termination_slot_t;
-
-struct mrcp_termination_slot_t {
- /** RTP termination */
- mpf_termination_t *termination;
- /** media descriptor id (position in SDP message) */
- apr_size_t id;
- /** media id (used for resource grouping) */
- apr_size_t mid;
- /** Array of associated MRCP channels (mrcp_channel_t*) */
- apr_array_header_t *channels;
-
- /** waiting state */
- apt_bool_t waiting;
-};
-
-extern const mrcp_engine_channel_event_vtable_t engine_channel_vtable;
-
-void mrcp_server_session_add(mrcp_server_session_t *session);
-void mrcp_server_session_remove(mrcp_server_session_t *session);
-
-static apt_bool_t mrcp_server_signaling_message_dispatch(mrcp_server_session_t *session, mrcp_signaling_message_t *signaling_message);
-
-static apt_bool_t mrcp_server_resource_offer_process(mrcp_server_session_t *session, mrcp_session_descriptor_t *descriptor);
-static apt_bool_t mrcp_server_control_media_offer_process(mrcp_server_session_t *session, mrcp_session_descriptor_t *descriptor);
-static apt_bool_t mrcp_server_av_media_offer_process(mrcp_server_session_t *session, mrcp_session_descriptor_t *descriptor);
-
-static apt_bool_t mrcp_server_engine_channels_update(mrcp_server_session_t *session);
-static apt_bool_t mrcp_server_session_answer_send(mrcp_server_session_t *session);
-static apt_bool_t mrcp_server_session_terminate_process(mrcp_server_session_t *session);
-static apt_bool_t mrcp_server_session_terminate_send(mrcp_server_session_t *session);
-
-static mrcp_channel_t* mrcp_server_channel_find(mrcp_server_session_t *session, const apt_str_t *resource_name);
-
-static apt_bool_t state_machine_on_message_dispatch(mrcp_state_machine_t *state_machine, mrcp_message_t *message);
-static apt_bool_t state_machine_on_deactivate(mrcp_state_machine_t *state_machine);
-
-
-mrcp_server_session_t* mrcp_server_session_create()
-{
- mrcp_server_session_t *session = (mrcp_server_session_t*) mrcp_session_create(sizeof(mrcp_server_session_t)-sizeof(mrcp_session_t));
- session->context = NULL;
- session->terminations = apr_array_make(session->base.pool,2,sizeof(mrcp_termination_slot_t));
- session->channels = apr_array_make(session->base.pool,2,sizeof(mrcp_channel_t*));
- session->active_request = NULL;
- session->request_queue = apt_list_create(session->base.pool);
- session->offer = NULL;
- session->answer = NULL;
- session->mpf_task_msg = NULL;
- session->subrequest_count = 0;
- session->state = SESSION_STATE_NONE;
- session->base.name = apr_psprintf(session->base.pool,"0x%pp",session);
- return session;
-}
-
-static APR_INLINE mrcp_version_e mrcp_session_version_get(mrcp_server_session_t *session)
-{
- return session->profile->mrcp_version;
-}
-
-static mrcp_engine_channel_t* mrcp_server_engine_channel_create(
- mrcp_server_session_t *session,
- mrcp_channel_t *channel,
- const apt_str_t *resource_name)
-{
- mrcp_engine_t *engine = apr_hash_get(
- session->profile->engine_table,
- resource_name->buf,
- resource_name->length);
- if(!engine) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Find MRCP Engine "APT_NAMESID_FMT" [%s]",
- MRCP_SESSION_NAMESID(session),
- resource_name->buf);
- return NULL;
- }
-
- channel->state_machine = engine->create_state_machine(
- channel,
- mrcp_session_version_get(session),
- channel->pool);
- if(channel->state_machine) {
- channel->state_machine->on_dispatch = state_machine_on_message_dispatch;
- channel->state_machine->on_deactivate = state_machine_on_deactivate;
- }
-
- return mrcp_engine_channel_virtual_create(engine,mrcp_session_version_get(session),session->base.pool);
-}
-
-static mrcp_channel_t* mrcp_server_channel_create(mrcp_server_session_t *session, const apt_str_t *resource_name, apr_size_t id, apr_array_header_t *cmid_arr)
-{
- mrcp_channel_t *channel;
- apr_pool_t *pool = session->base.pool;
-
- channel = apr_palloc(pool,sizeof(mrcp_channel_t));
- channel->pool = pool;
- channel->session = &session->base;
- channel->resource = NULL;
- channel->control_channel = NULL;
- channel->state_machine = NULL;
- channel->engine_channel = NULL;
- channel->id = id;
- channel->cmid_arr = cmid_arr;
- channel->waiting_for_channel = FALSE;
- channel->waiting_for_termination = FALSE;
-
- if(resource_name && resource_name->buf) {
- mrcp_resource_t *resource;
- mrcp_engine_channel_t *engine_channel;
- resource = mrcp_resource_find(session->profile->resource_factory,resource_name);
- if(resource) {
- channel->resource = resource;
- if(mrcp_session_version_get(session) == MRCP_VERSION_2) {
- channel->control_channel = mrcp_server_control_channel_create(
- session->profile->connection_agent,
- channel,
- pool);
- }
- engine_channel = mrcp_server_engine_channel_create(session,channel,resource_name);
- if(engine_channel) {
- engine_channel->id = session->base.id;
- engine_channel->event_obj = channel;
- engine_channel->event_vtable = &engine_channel_vtable;
- channel->engine_channel = engine_channel;
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Engine Channel "APT_NAMESID_FMT" [%s]",
- MRCP_SESSION_NAMESID(session),
- resource_name->buf);
- session->answer->status = MRCP_SESSION_STATUS_UNACCEPTABLE_RESOURCE;
- }
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"No Such Resource "APT_NAMESID_FMT" [%s]",
- MRCP_SESSION_NAMESID(session),
- resource_name->buf);
- session->answer->status = MRCP_SESSION_STATUS_NO_SUCH_RESOURCE;
- }
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Invalid Resource Identifier "APT_NAMESID_FMT,
- MRCP_SESSION_NAMESID(session));
- session->answer->status = MRCP_SESSION_STATUS_NO_SUCH_RESOURCE;
- }
-
- return channel;
-}
-
-static APR_INLINE void mrcp_server_session_state_set(mrcp_server_session_t *session, mrcp_server_session_state_e state)
-{
- if(session->subrequest_count != 0) {
- /* error case */
- session->subrequest_count = 0;
- }
- session->state = state;
-}
-
-static APR_INLINE void mrcp_server_session_subrequest_add(mrcp_server_session_t *session)
-{
- session->subrequest_count++;
-}
-
-static void mrcp_server_session_subrequest_remove(mrcp_server_session_t *session)
-{
- if(!session->subrequest_count) {
- /* error case */
- return;
- }
- session->subrequest_count--;
- if(!session->subrequest_count) {
- switch(session->state) {
- case SESSION_STATE_GENERATING_ANSWER:
- mrcp_server_engine_channels_update(session);
- break;
- case SESSION_STATE_INITIALIZING:
- /* send answer to client */
- mrcp_server_session_answer_send(session);
- break;
- case SESSION_STATE_DEACTIVATING:
- mrcp_server_session_terminate_process(session);
- break;
- case SESSION_STATE_TERMINATING:
- mrcp_server_session_terminate_send(session);
- break;
- default:
- break;
- }
- }
-}
-
-mrcp_session_t* mrcp_server_channel_session_get(mrcp_channel_t *channel)
-{
- return channel->session;
-}
-
-apt_bool_t mrcp_server_signaling_message_process(mrcp_signaling_message_t *signaling_message)
-{
- mrcp_server_session_t *session = signaling_message->session;
- if(session->active_request) {
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Push Request to Queue "APT_NAMESID_FMT,
- MRCP_SESSION_NAMESID(session));
- apt_list_push_back(session->request_queue,signaling_message,session->base.pool);
- }
- else {
- session->active_request = signaling_message;
- mrcp_server_signaling_message_dispatch(session,signaling_message);
- }
- return TRUE;
-}
-
-apt_bool_t mrcp_server_on_channel_modify(mrcp_channel_t *channel, mrcp_control_descriptor_t *answer, apt_bool_t status)
-{
- mrcp_server_session_t *session = (mrcp_server_session_t*)channel->session;
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Control Channel Modified "APT_NAMESIDRES_FMT,
- MRCP_SESSION_NAMESID(session),
- channel->resource->name.buf);
- if(!answer) {
- return FALSE;
- }
- if(!channel->waiting_for_channel) {
- return FALSE;
- }
- channel->waiting_for_channel = FALSE;
- answer->session_id = session->base.id;
- mrcp_session_control_media_set(session->answer,channel->id,answer);
- mrcp_server_session_subrequest_remove(session);
- return TRUE;
-}
-
-apt_bool_t mrcp_server_on_channel_remove(mrcp_channel_t *channel, apt_bool_t status)
-{
- mrcp_server_session_t *session = (mrcp_server_session_t*)channel->session;
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Control Channel Removed "APT_NAMESIDRES_FMT,
- MRCP_SESSION_NAMESID(session),
- channel->resource->name.buf);
- if(!channel->waiting_for_channel) {
- return FALSE;
- }
- channel->waiting_for_channel = FALSE;
- mrcp_server_session_subrequest_remove(session);
- return TRUE;
-}
-
-apt_bool_t mrcp_server_on_channel_message(mrcp_channel_t *channel, mrcp_message_t *message)
-{
- mrcp_server_session_t *session = (mrcp_server_session_t*)channel->session;
- mrcp_signaling_message_t *signaling_message;
- signaling_message = apr_palloc(session->base.pool,sizeof(mrcp_signaling_message_t));
- signaling_message->type = SIGNALING_MESSAGE_CONTROL;
- signaling_message->session = session;
- signaling_message->descriptor = NULL;
- signaling_message->channel = channel;
- signaling_message->message = message;
- return mrcp_server_signaling_message_process(signaling_message);
-}
-
-apt_bool_t mrcp_server_on_disconnect(mrcp_channel_t *channel)
-{
- /* to be processed */
- return TRUE;
-}
-
-apt_bool_t mrcp_server_on_engine_channel_open(mrcp_channel_t *channel, apt_bool_t status)
-{
- mrcp_server_session_t *session = (mrcp_server_session_t*)channel->session;
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Engine Channel Opened "APT_NAMESIDRES_FMT" [%s]",
- MRCP_SESSION_NAMESID(session),
- channel->resource->name.buf,
- status == TRUE ? "OK" : "Failed");
- if(status == FALSE) {
- session->answer->status = MRCP_SESSION_STATUS_UNAVAILABLE_RESOURCE;
- }
- mrcp_server_session_subrequest_remove(session);
- return TRUE;
-}
-
-apt_bool_t mrcp_server_on_engine_channel_close(mrcp_channel_t *channel)
-{
- mrcp_server_session_t *session = (mrcp_server_session_t*)channel->session;
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Engine Channel Closed "APT_NAMESIDRES_FMT,
- MRCP_SESSION_NAMESID(session),
- channel->resource->name.buf);
- mrcp_server_session_subrequest_remove(session);
- return TRUE;
-}
-
-apt_bool_t mrcp_server_on_engine_channel_message(mrcp_channel_t *channel, mrcp_message_t *message)
-{
- if(!channel->state_machine) {
- return FALSE;
- }
- /* update state machine */
- return mrcp_state_machine_update(channel->state_machine,message);
-}
-
-
-static mrcp_session_descriptor_t* mrcp_session_answer_create(mrcp_session_descriptor_t *offer, apr_pool_t *pool)
-{
- int i;
- mrcp_session_descriptor_t *answer = apr_palloc(pool,sizeof(mrcp_session_descriptor_t));
- apt_string_reset(&answer->origin);
- apt_string_reset(&answer->ip);
- apt_string_reset(&answer->ext_ip);
- answer->resource_name = offer->resource_name;
- answer->resource_state = offer->resource_state;
- answer->status = offer->status;
- answer->control_media_arr = apr_array_make(pool,offer->control_media_arr->nelts,sizeof(void*));
- for(i=0; icontrol_media_arr->nelts; i++) {
- APR_ARRAY_PUSH(answer->control_media_arr,void*) = NULL;
- }
- answer->audio_media_arr = apr_array_make(pool,offer->audio_media_arr->nelts,sizeof(mpf_rtp_media_descriptor_t*));
- for(i=0; iaudio_media_arr->nelts; i++) {
- APR_ARRAY_PUSH(answer->audio_media_arr,mpf_rtp_media_descriptor_t*) = NULL;
- }
- answer->video_media_arr = apr_array_make(pool,offer->video_media_arr->nelts,sizeof(mpf_rtp_media_descriptor_t*));
- for(i=0; ivideo_media_arr->nelts; i++) {
- APR_ARRAY_PUSH(answer->video_media_arr,mpf_rtp_media_descriptor_t*) = NULL;
- }
- return answer;
-}
-
-static apt_bool_t mrcp_server_session_offer_process(mrcp_server_session_t *session, mrcp_session_descriptor_t *descriptor)
-{
- if(!session->context) {
- /* initial offer received, generate session id and add to session's table */
- if(!session->base.id.length) {
- apt_unique_id_generate(&session->base.id,MRCP_SESSION_ID_HEX_STRING_LENGTH,session->base.pool);
- }
- mrcp_server_session_add(session);
-
- session->context = mpf_engine_context_create(
- session->profile->media_engine,
- session->base.name,
- session,5,session->base.pool);
- }
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Receive Offer "APT_NAMESID_FMT" [c:%d a:%d v:%d]",
- MRCP_SESSION_NAMESID(session),
- descriptor->control_media_arr->nelts,
- descriptor->audio_media_arr->nelts,
- descriptor->video_media_arr->nelts);
-
- /* store received offer */
- session->offer = descriptor;
- session->answer = mrcp_session_answer_create(descriptor,session->base.pool);
-
- mrcp_server_session_state_set(session,SESSION_STATE_GENERATING_ANSWER);
-
- /* first, reset/destroy existing associations and topology */
- if(mpf_engine_topology_message_add(
- session->profile->media_engine,
- MPF_RESET_ASSOCIATIONS,session->context,
- &session->mpf_task_msg) == TRUE){
- mrcp_server_session_subrequest_add(session);
- }
-
- if(mrcp_session_version_get(session) == MRCP_VERSION_1) {
- if(mrcp_server_resource_offer_process(session,descriptor) == TRUE) {
- mrcp_server_av_media_offer_process(session,descriptor);
- }
- else {
- session->answer->resource_state = FALSE;
- }
- }
- else {
- mrcp_server_control_media_offer_process(session,descriptor);
- mrcp_server_av_media_offer_process(session,descriptor);
- }
-
- /* apply topology based on assigned associations */
- if(mpf_engine_topology_message_add(
- session->profile->media_engine,
- MPF_APPLY_TOPOLOGY,session->context,
- &session->mpf_task_msg) == TRUE) {
- mrcp_server_session_subrequest_add(session);
- }
- mpf_engine_message_send(session->profile->media_engine,&session->mpf_task_msg);
-
- if(!session->subrequest_count) {
- /* send answer to client */
- mrcp_server_session_answer_send(session);
- }
- return TRUE;
-}
-
-static apt_bool_t mrcp_server_session_terminate_process(mrcp_server_session_t *session)
-{
- mrcp_channel_t *channel;
- mrcp_termination_slot_t *slot;
- int i;
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Terminate Session "APT_NAMESID_FMT,MRCP_SESSION_NAMESID(session));
-
- mrcp_server_session_state_set(session,SESSION_STATE_TERMINATING);
-
- if(session->context) {
- /* first, destroy existing topology */
- if(mpf_engine_topology_message_add(
- session->profile->media_engine,
- MPF_RESET_ASSOCIATIONS,session->context,
- &session->mpf_task_msg) == TRUE){
- mrcp_server_session_subrequest_add(session);
- }
- }
-
- for(i=0; ichannels->nelts; i++) {
- channel = APR_ARRAY_IDX(session->channels,i,mrcp_channel_t*);
- if(!channel) continue;
-
- /* send remove channel request */
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Remove Control Channel "APT_NAMESIDRES_FMT" [%d]",
- MRCP_SESSION_NAMESID(session),
- channel->resource->name.buf,
- i);
- if(channel->control_channel) {
- if(mrcp_server_control_channel_remove(channel->control_channel) == TRUE) {
- channel->waiting_for_channel = TRUE;
- mrcp_server_session_subrequest_add(session);
- }
- }
-
- if(channel->engine_channel) {
- mpf_termination_t *termination = channel->engine_channel->termination;
- /* send subtract termination request */
- if(termination) {
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Subtract Media Termination "APT_NAMESIDRES_FMT,
- MRCP_SESSION_NAMESID(session),
- mpf_termination_name_get(termination));
- if(mpf_engine_termination_message_add(
- session->profile->media_engine,
- MPF_SUBTRACT_TERMINATION,session->context,termination,NULL,
- &session->mpf_task_msg) == TRUE) {
- channel->waiting_for_termination = TRUE;
- mrcp_server_session_subrequest_add(session);
- }
- }
-
- /* close engine channel */
- if(mrcp_engine_channel_virtual_close(channel->engine_channel) == TRUE) {
- mrcp_server_session_subrequest_add(session);
- }
- }
- }
- for(i=0; iterminations->nelts; i++) {
- /* get existing termination */
- slot = &APR_ARRAY_IDX(session->terminations,i,mrcp_termination_slot_t);
- if(!slot->termination) continue;
-
- /* send subtract termination request */
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Subtract Media Termination "APT_NAMESIDRES_FMT,
- MRCP_SESSION_NAMESID(session),
- mpf_termination_name_get(slot->termination));
- if(mpf_engine_termination_message_add(
- session->profile->media_engine,
- MPF_SUBTRACT_TERMINATION,session->context,slot->termination,NULL,
- &session->mpf_task_msg) == TRUE) {
- slot->waiting = TRUE;
- mrcp_server_session_subrequest_add(session);
- }
- }
-
- if(session->context) {
- mpf_engine_message_send(session->profile->media_engine,&session->mpf_task_msg);
- }
-
- mrcp_server_session_remove(session);
-
- if(!session->subrequest_count) {
- mrcp_server_session_terminate_send(session);
- }
-
- return TRUE;
-}
-
-static apt_bool_t mrcp_server_session_deactivate(mrcp_server_session_t *session)
-{
- mrcp_channel_t *channel;
- int i;
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Deactivate Session "APT_NAMESID_FMT,MRCP_SESSION_NAMESID(session));
- mrcp_server_session_state_set(session,SESSION_STATE_DEACTIVATING);
- for(i=0; ichannels->nelts; i++) {
- channel = APR_ARRAY_IDX(session->channels,i,mrcp_channel_t*);
- if(!channel || !channel->state_machine) continue;
-
- if(mrcp_state_machine_deactivate(channel->state_machine) == TRUE) {
- mrcp_server_session_subrequest_add(session);
- }
- }
-
- if(!session->subrequest_count) {
- mrcp_server_session_terminate_process(session);
- }
-
- return TRUE;
-}
-
-static apt_bool_t mrcp_server_on_message_receive(mrcp_server_session_t *session, mrcp_channel_t *channel, mrcp_message_t *message)
-{
- if(!channel) {
- channel = mrcp_server_channel_find(session,&message->channel_id.resource_name);
- if(!channel) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"No Such Channel "APT_NAMESIDRES_FMT,
- MRCP_SESSION_NAMESID(session),
- message->channel_id.resource_name.buf);
- return FALSE;
- }
- }
- if(!channel->resource || !channel->state_machine) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Missing Resource "APT_NAMESIDRES_FMT,
- MRCP_SESSION_NAMESID(session),
- message->channel_id.resource_name.buf);
- return FALSE;
- }
-
- /* update state machine */
- return mrcp_state_machine_update(channel->state_machine,message);
-}
-
-static apt_bool_t mrcp_server_signaling_message_dispatch(mrcp_server_session_t *session, mrcp_signaling_message_t *signaling_message)
-{
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Dispatch Signaling Message [%d]",signaling_message->type);
- switch(signaling_message->type) {
- case SIGNALING_MESSAGE_OFFER:
- mrcp_server_session_offer_process(signaling_message->session,signaling_message->descriptor);
- break;
- case SIGNALING_MESSAGE_CONTROL:
- mrcp_server_on_message_receive(signaling_message->session,signaling_message->channel,signaling_message->message);
- break;
- case SIGNALING_MESSAGE_TERMINATE:
- mrcp_server_session_deactivate(signaling_message->session);
- break;
- default:
- break;
- }
- return TRUE;
-}
-
-static apt_bool_t mrcp_server_engine_channels_update(mrcp_server_session_t *session)
-{
- mrcp_channel_t *channel;
- mrcp_session_descriptor_t *descriptor = session->offer;
- if(!descriptor) {
- return FALSE;
- }
-
- mrcp_server_session_state_set(session,SESSION_STATE_INITIALIZING);
-
- if(mrcp_session_version_get(session) == MRCP_VERSION_1) {
- if(session->offer) {
- channel = mrcp_server_channel_find(session,&descriptor->resource_name);
- if(channel && channel->engine_channel) {
- /* open engine channel */
- if(mrcp_engine_channel_virtual_open(channel->engine_channel) == TRUE) {
- mrcp_server_session_subrequest_add(session);
- }
- }
- }
- }
- else {
- int i;
- mrcp_control_descriptor_t *control_descriptor;
- for(i=0; ichannels->nelts; i++) {
- channel = APR_ARRAY_IDX(session->channels,i,mrcp_channel_t*);
- if(!channel || !channel->engine_channel) continue;
-
- control_descriptor = mrcp_session_control_media_get(descriptor,i);
- if(!control_descriptor) continue;
-
- if(control_descriptor->port) {
- /* open engine channel */
- if(mrcp_engine_channel_virtual_open(channel->engine_channel) == TRUE) {
- mrcp_server_session_subrequest_add(session);
- }
- }
- else {
- /* close engine channel */
- if(mrcp_engine_channel_virtual_close(channel->engine_channel) == TRUE) {
- mrcp_server_session_subrequest_add(session);
- }
- }
- }
- }
-
- if(!session->subrequest_count) {
- mrcp_server_session_answer_send(session);
- }
- return TRUE;
-}
-
-static apt_bool_t mrcp_server_resource_offer_process(mrcp_server_session_t *session, mrcp_session_descriptor_t *descriptor)
-{
- if(descriptor->resource_state == TRUE) {
- /* setup */
- mrcp_channel_t *channel;
- int count = session->channels->nelts;
- channel = mrcp_server_channel_find(session,&descriptor->resource_name);
- if(channel) {
- /* channel already exists */
- return TRUE;
- }
- /* create new MRCP channel instance */
- channel = mrcp_server_channel_create(session,&descriptor->resource_name,count,NULL);
- if(!channel || !channel->resource) {
- return FALSE;
- }
- /* add to channel array */
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Add Control Channel "APT_NAMESIDRES_FMT" [%d]",
- MRCP_SESSION_NAMESID(session),
- channel->resource->name.buf,
- count);
- APR_ARRAY_PUSH(session->channels,mrcp_channel_t*) = channel;
- if(channel->engine_channel && channel->engine_channel->termination) {
- mpf_termination_t *termination = channel->engine_channel->termination;
- /* send add termination request (add to media context) */
- if(mpf_engine_termination_message_add(
- session->profile->media_engine,
- MPF_ADD_TERMINATION,session->context,termination,NULL,
- &session->mpf_task_msg) == TRUE) {
- channel->waiting_for_termination = TRUE;
- mrcp_server_session_subrequest_add(session);
- }
- }
- }
- else {
- /* teardown */
- }
- return TRUE;
-}
-
-static apt_bool_t mrcp_server_control_media_offer_process(mrcp_server_session_t *session, mrcp_session_descriptor_t *descriptor)
-{
- mrcp_channel_t *channel;
- mrcp_control_descriptor_t *control_descriptor;
- int i;
- int count = session->channels->nelts;
- if(count > descriptor->control_media_arr->nelts) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Number of Control Channels [%d] > Number of Control Media in Offer [%d]",
- count,descriptor->control_media_arr->nelts);
- count = descriptor->control_media_arr->nelts;
- }
-
- /* update existing control channels */
- for(i=0; ichannels,i,mrcp_channel_t*);
- if(!channel) continue;
-
- channel->waiting_for_channel = FALSE;
- /* get control descriptor */
- control_descriptor = mrcp_session_control_media_get(descriptor,i);
- if(!control_descriptor) continue;
-
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Modify Control Channel "APT_NAMESIDRES_FMT" [%d]",
- MRCP_SESSION_NAMESID(session),
- channel->resource->name.buf,
- i);
- if(channel->control_channel) {
- /* send offer */
- if(mrcp_server_control_channel_modify(channel->control_channel,control_descriptor) == TRUE) {
- channel->waiting_for_channel = TRUE;
- mrcp_server_session_subrequest_add(session);
- }
- }
-
- if(channel->waiting_for_channel == FALSE) {
- mrcp_control_descriptor_t *answer = mrcp_control_answer_create(control_descriptor,channel->pool);
- answer->port = 0;
- answer->session_id = session->base.id;
- mrcp_session_control_media_set(session->answer,channel->id,answer);
- }
- }
-
- /* add new control channels */
- for(; icontrol_media_arr->nelts; i++) {
- /* get control descriptor */
- control_descriptor = mrcp_session_control_media_get(descriptor,i);
- if(!control_descriptor) continue;
-
- /* create new MRCP channel instance */
- channel = mrcp_server_channel_create(session,&control_descriptor->resource_name,i,control_descriptor->cmid_arr);
- if(!channel || !channel->resource) continue;
-
- control_descriptor->session_id = session->base.id;
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Add Control Channel "APT_NAMESIDRES_FMT" [%d]",
- MRCP_SESSION_NAMESID(session),
- channel->resource->name.buf,
- i);
- APR_ARRAY_PUSH(session->channels,mrcp_channel_t*) = channel;
-
- if(channel->control_channel) {
- /* send modify connection request */
- if(mrcp_server_control_channel_add(channel->control_channel,control_descriptor) == TRUE) {
- channel->waiting_for_channel = TRUE;
- mrcp_server_session_subrequest_add(session);
- }
- }
-
- if(channel->waiting_for_channel == FALSE) {
- mrcp_control_descriptor_t *answer = mrcp_control_answer_create(control_descriptor,channel->pool);
- answer->port = 0;
- answer->session_id = session->base.id;
- mrcp_session_control_media_set(session->answer,channel->id,answer);
- }
-
- if(channel->engine_channel && channel->engine_channel->termination) {
- mpf_termination_t *termination = channel->engine_channel->termination;
- /* send add termination request (add to media context) */
- if(mpf_engine_termination_message_add(
- session->profile->media_engine,
- MPF_ADD_TERMINATION,session->context,termination,NULL,
- &session->mpf_task_msg) == TRUE) {
- channel->waiting_for_termination = TRUE;
- mrcp_server_session_subrequest_add(session);
- }
- }
- }
-
- return TRUE;
-}
-
-static mpf_rtp_termination_descriptor_t* mrcp_server_associations_build(mrcp_server_session_t *session, mrcp_session_descriptor_t *descriptor, mrcp_termination_slot_t *slot)
-{
- int i;
- mrcp_channel_t *channel;
- mpf_audio_stream_t *audio_stream;
- mpf_stream_capabilities_t *capabilities = NULL;
- mpf_rtp_termination_descriptor_t *rtp_descriptor;
- mpf_rtp_media_descriptor_t *media_descriptor = mrcp_session_audio_media_get(descriptor,slot->id);
- if(!media_descriptor) {
- return NULL;
- }
- /* construct termination descriptor */
- rtp_descriptor = apr_palloc(session->base.pool,sizeof(mpf_rtp_termination_descriptor_t));
- mpf_rtp_termination_descriptor_init(rtp_descriptor);
- rtp_descriptor->audio.local = NULL;
- rtp_descriptor->audio.remote = media_descriptor;
- rtp_descriptor->audio.settings = session->profile->rtp_settings;
-
- slot->mid = media_descriptor->mid;
- slot->channels = apr_array_make(session->base.pool,1,sizeof(mrcp_channel_t*));
- for(i=0; ichannels->nelts; i++) {
- channel = APR_ARRAY_IDX(session->channels,i,mrcp_channel_t*);
- if(!channel) continue;
-
- if(session->terminations->nelts == 1 || (!channel->cmid_arr || mrcp_cmid_find(channel->cmid_arr,slot->mid) == TRUE)) {
- APR_ARRAY_PUSH(slot->channels, mrcp_channel_t*) = channel;
-
- audio_stream = NULL;
- if(channel->engine_channel && channel->engine_channel->termination) {
- audio_stream = mpf_termination_audio_stream_get(channel->engine_channel->termination);
- }
- if(!audio_stream) continue;
-
- if(audio_stream->capabilities) {
- /* set descriptor according to media termination(s)
- of associated control channel(s) */
- if(capabilities) {
- mpf_stream_capabilities_merge(
- capabilities,
- audio_stream->capabilities,
- session->base.pool);
- }
- else {
- capabilities = mpf_stream_capabilities_clone(
- audio_stream->capabilities,
- session->base.pool);
- }
- }
-
- if(mrcp_session_version_get(session) == MRCP_VERSION_1) {
- mpf_stream_direction_e direction = audio_stream->direction;
- /* implicitly modify the descriptor, if needed */
- if(media_descriptor->direction == STREAM_DIRECTION_NONE && mpf_codec_list_is_empty(&media_descriptor->codec_list) == TRUE) {
- /* this is the case when SETUP contains no SDP, assume all the available codecs are offered */
- if(mpf_codec_list_is_empty(&session->profile->rtp_settings->codec_list) == FALSE) {
- mpf_codec_list_copy(&media_descriptor->codec_list,
- &session->profile->rtp_settings->codec_list,
- session->base.pool);
- }
- }
-
- media_descriptor->direction |= direction;
- if(media_descriptor->state == MPF_MEDIA_DISABLED) {
- media_descriptor->state = MPF_MEDIA_ENABLED;
- }
- }
- }
- }
- if(capabilities) {
- capabilities->direction = mpf_stream_reverse_direction_get(capabilities->direction);
- rtp_descriptor->audio.capabilities = capabilities;
- }
- return rtp_descriptor;
-}
-
-static apt_bool_t mrcp_server_associations_set(mrcp_server_session_t *session, mrcp_session_descriptor_t *descriptor, mrcp_termination_slot_t *slot)
-{
- int i;
- mrcp_channel_t *channel;
- for(i=0; ichannels->nelts; i++) {
- channel = ((mrcp_channel_t**)slot->channels->elts)[i];
- if(!channel || !channel->engine_channel) continue;
-
- if(mpf_engine_assoc_message_add(
- session->profile->media_engine,
- MPF_ADD_ASSOCIATION,session->context,slot->termination,channel->engine_channel->termination,
- &session->mpf_task_msg) == TRUE) {
- mrcp_server_session_subrequest_add(session);
- }
- }
- return TRUE;
-}
-
-static apt_bool_t mrcp_server_av_media_offer_process(mrcp_server_session_t *session, mrcp_session_descriptor_t *descriptor)
-{
- mpf_rtp_termination_descriptor_t *rtp_descriptor;
- mrcp_termination_slot_t *slot;
- int i;
- int count = session->terminations->nelts;
- if(!descriptor->audio_media_arr->nelts) {
- /* no media to process */
- return TRUE;
- }
- if(count > descriptor->audio_media_arr->nelts) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Number of Terminations [%d] > Number of Audio Media in Offer [%d]",
- count,descriptor->audio_media_arr->nelts);
- count = descriptor->audio_media_arr->nelts;
- }
-
- /* update existing terminations */
- for(i=0; iterminations,i,mrcp_termination_slot_t);
- if(!slot->termination) continue;
-
- /* build associations between specified RTP termination and control channels */
- rtp_descriptor = mrcp_server_associations_build(session,descriptor,slot);
- if(!rtp_descriptor) continue;
-
- /* send modify termination request */
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Modify Media Termination "APT_NAMESIDRES_FMT" [%d]",
- MRCP_SESSION_NAMESID(session),
- mpf_termination_name_get(slot->termination),
- i);
- if(mpf_engine_termination_message_add(
- session->profile->media_engine,
- MPF_MODIFY_TERMINATION,session->context,slot->termination,rtp_descriptor,
- &session->mpf_task_msg) == TRUE) {
- slot->waiting = TRUE;
- mrcp_server_session_subrequest_add(session);
- }
-
- /* set built associations */
- mrcp_server_associations_set(session,descriptor,slot);
- }
-
- /* add new terminations */
- for(; iaudio_media_arr->nelts; i++) {
- mpf_termination_t *termination;
- /* create new RTP termination instance */
- termination = mpf_termination_create(session->profile->rtp_termination_factory,session,session->base.pool);
- /* add to termination array */
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Add Media Termination "APT_NAMESIDRES_FMT" [%d]",
- MRCP_SESSION_NAMESID(session),
- mpf_termination_name_get(termination),
- i);
- slot = apr_array_push(session->terminations);
- slot->id = i;
- slot->mid = 0;
- slot->waiting = FALSE;
- slot->termination = termination;
- slot->channels = NULL;
-
- /* build associations between specified RTP termination and control channels */
- rtp_descriptor = mrcp_server_associations_build(session,descriptor,slot);
- if(!rtp_descriptor) continue;
-
- /* send add termination request (add to media context) */
- if(mpf_engine_termination_message_add(
- session->profile->media_engine,
- MPF_ADD_TERMINATION,session->context,termination,rtp_descriptor,
- &session->mpf_task_msg) == TRUE) {
- slot->waiting = TRUE;
- mrcp_server_session_subrequest_add(session);
- }
-
- /* set built associations */
- mrcp_server_associations_set(session,descriptor,slot);
- }
- return TRUE;
-}
-
-static apt_bool_t mrcp_server_session_answer_send(mrcp_server_session_t *session)
-{
- apt_bool_t status;
- mrcp_session_descriptor_t *descriptor = session->answer;
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Send Answer "APT_NAMESID_FMT" [c:%d a:%d v:%d] Status %s",
- MRCP_SESSION_NAMESID(session),
- descriptor->control_media_arr->nelts,
- descriptor->audio_media_arr->nelts,
- descriptor->video_media_arr->nelts,
- mrcp_session_status_phrase_get(descriptor->status));
- status = mrcp_session_answer(&session->base,descriptor);
- session->offer = NULL;
- session->answer = NULL;
-
- session->active_request = apt_list_pop_front(session->request_queue);
- if(session->active_request) {
- mrcp_server_signaling_message_dispatch(session,session->active_request);
- }
- return status;
-}
-
-static apt_bool_t mrcp_server_session_terminate_send(mrcp_server_session_t *session)
-{
- int i;
- mrcp_channel_t *channel;
- for(i=0; ichannels->nelts; i++) {
- channel = APR_ARRAY_IDX(session->channels,i,mrcp_channel_t*);
- if(!channel) continue;
-
- if(channel->control_channel) {
- mrcp_server_control_channel_destroy(channel->control_channel);
- channel->control_channel = NULL;
- }
- if(channel->engine_channel) {
- mrcp_engine_channel_virtual_destroy(channel->engine_channel);
- channel->engine_channel = NULL;
- }
- }
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Session Terminated "APT_NAMESID_FMT,MRCP_SESSION_NAMESID(session));
- mrcp_session_terminate_response(&session->base);
- return TRUE;
-}
-
-
-static mrcp_termination_slot_t* mrcp_server_rtp_termination_find(mrcp_server_session_t *session, mpf_termination_t *termination)
-{
- int i;
- mrcp_termination_slot_t *slot;
- for(i=0; iterminations->nelts; i++) {
- slot = &APR_ARRAY_IDX(session->terminations,i,mrcp_termination_slot_t);
- if(slot->termination == termination) {
- return slot;
- }
- }
- return NULL;
-}
-
-static mrcp_channel_t* mrcp_server_channel_termination_find(mrcp_server_session_t *session, mpf_termination_t *termination)
-{
- int i;
- mrcp_channel_t *channel;
- for(i=0; ichannels->nelts; i++) {
- channel = APR_ARRAY_IDX(session->channels,i,mrcp_channel_t*);
- if(!channel) continue;
-
- if(channel->engine_channel && channel->engine_channel->termination == termination) {
- return channel;
- }
- }
- return NULL;
-}
-
-static mrcp_channel_t* mrcp_server_channel_find(mrcp_server_session_t *session, const apt_str_t *resource_name)
-{
- int i;
- mrcp_channel_t *channel;
- for(i=0; ichannels->nelts; i++) {
- channel = APR_ARRAY_IDX(session->channels,i,mrcp_channel_t*);
- if(!channel) continue;
-
- if(apt_string_compare(&channel->resource->name,resource_name) == TRUE) {
- return channel;
- }
- }
- return NULL;
-}
-
-static apt_bool_t mrcp_server_on_termination_modify(mrcp_server_session_t *session, const mpf_message_t *mpf_message)
-{
- mrcp_termination_slot_t *termination_slot;
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Media Termination Modified "APT_NAMESIDRES_FMT,
- MRCP_SESSION_NAMESID(session),
- mpf_termination_name_get(mpf_message->termination));
- termination_slot = mrcp_server_rtp_termination_find(session,mpf_message->termination);
- if(termination_slot) {
- /* rtp termination */
- mpf_rtp_termination_descriptor_t *rtp_descriptor;
- if(termination_slot->waiting == FALSE) {
- return FALSE;
- }
- termination_slot->waiting = FALSE;
- rtp_descriptor = mpf_message->descriptor;
- if(rtp_descriptor->audio.local) {
- session->answer->ip = rtp_descriptor->audio.local->ip;
- session->answer->ext_ip = rtp_descriptor->audio.local->ext_ip;
- mrcp_session_audio_media_set(session->answer,termination_slot->id,rtp_descriptor->audio.local);
- }
- mrcp_server_session_subrequest_remove(session);
- }
- else {
- /* engine channel termination */
- mrcp_channel_t *channel = mrcp_server_channel_termination_find(session,mpf_message->termination);
- if(channel && channel->waiting_for_termination == TRUE) {
- channel->waiting_for_termination = FALSE;
- mrcp_server_session_subrequest_remove(session);
- }
- }
- return TRUE;
-}
-
-static apt_bool_t mrcp_server_on_termination_subtract(mrcp_server_session_t *session, const mpf_message_t *mpf_message)
-{
- mrcp_termination_slot_t *termination_slot;
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Media Termination Subtracted "APT_NAMESIDRES_FMT,
- MRCP_SESSION_NAMESID(session),
- mpf_termination_name_get(mpf_message->termination));
- termination_slot = mrcp_server_rtp_termination_find(session,mpf_message->termination);
- if(termination_slot) {
- /* rtp termination */
- if(termination_slot->waiting == FALSE) {
- return FALSE;
- }
- termination_slot->waiting = FALSE;
- mrcp_server_session_subrequest_remove(session);
- }
- else {
- /* engine channel termination */
- mrcp_channel_t *channel = mrcp_server_channel_termination_find(session,mpf_message->termination);
- if(channel && channel->waiting_for_termination == TRUE) {
- channel->waiting_for_termination = FALSE;
- mrcp_server_session_subrequest_remove(session);
- }
- }
- return TRUE;
-}
-
-apt_bool_t mrcp_server_mpf_message_process(mpf_message_container_t *mpf_message_container)
-{
- apr_size_t i;
- mrcp_server_session_t *session;
- const mpf_message_t *mpf_message;
- for(i=0; icount; i++) {
- mpf_message = &mpf_message_container->messages[i];
- if(mpf_message->context) {
- session = mpf_engine_context_object_get(mpf_message->context);
- }
- else {
- session = NULL;
- }
- if(!session) {
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Received MPF Message: NULL session");
- continue;
- }
- if(mpf_message->message_type == MPF_MESSAGE_TYPE_RESPONSE) {
- switch(mpf_message->command_id) {
- case MPF_ADD_TERMINATION:
- mrcp_server_on_termination_modify(session,mpf_message);
- break;
- case MPF_MODIFY_TERMINATION:
- mrcp_server_on_termination_modify(session,mpf_message);
- break;
- case MPF_SUBTRACT_TERMINATION:
- mrcp_server_on_termination_subtract(session,mpf_message);
- break;
- case MPF_ADD_ASSOCIATION:
- case MPF_REMOVE_ASSOCIATION:
- case MPF_RESET_ASSOCIATIONS:
- case MPF_APPLY_TOPOLOGY:
- case MPF_DESTROY_TOPOLOGY:
- mrcp_server_session_subrequest_remove(session);
- break;
- default:
- break;
- }
- }
- else if(mpf_message->message_type == MPF_MESSAGE_TYPE_EVENT) {
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Process MPF Event");
- }
- }
- return TRUE;
-}
-
-static apt_bool_t state_machine_on_message_dispatch(mrcp_state_machine_t *state_machine, mrcp_message_t *message)
-{
- mrcp_channel_t *channel = state_machine->obj;
-
- if(message->start_line.message_type == MRCP_MESSAGE_TYPE_REQUEST) {
- /* send request message to engine for actual processing */
- if(channel->engine_channel) {
- mrcp_engine_channel_request_process(channel->engine_channel,message);
- }
- }
- else if(message->start_line.message_type == MRCP_MESSAGE_TYPE_RESPONSE) {
- mrcp_server_session_t *session = (mrcp_server_session_t*)channel->session;
- /* send response message to client */
- if(channel->control_channel) {
- /* MRCPv2 */
- mrcp_server_control_message_send(channel->control_channel,message);
- }
- else {
- /* MRCPv1 */
- mrcp_session_control_response(channel->session,message);
- }
-
- session->active_request = apt_list_pop_front(session->request_queue);
- if(session->active_request) {
- mrcp_server_signaling_message_dispatch(session,session->active_request);
- }
- }
- else {
- /* send event message to client */
- if(channel->control_channel) {
- /* MRCPv2 */
- mrcp_server_control_message_send(channel->control_channel,message);
- }
- else {
- /* MRCPv1 */
- mrcp_session_control_response(channel->session,message);
- }
- }
- return TRUE;
-}
-
-static apt_bool_t state_machine_on_deactivate(mrcp_state_machine_t *state_machine)
-{
- mrcp_channel_t *channel = state_machine->obj;
- mrcp_server_session_t *session = (mrcp_server_session_t*)channel->session;
- mrcp_server_session_subrequest_remove(session);
- return TRUE;
-}
diff --git a/libs/unimrcp/libs/mrcp-signaling/Makefile.am b/libs/unimrcp/libs/mrcp-signaling/Makefile.am
deleted file mode 100644
index e274f1ce83..0000000000
--- a/libs/unimrcp/libs/mrcp-signaling/Makefile.am
+++ /dev/null
@@ -1,17 +0,0 @@
-MAINTAINERCLEANFILES = Makefile.in
-
-AM_CPPFLAGS = -I$(top_srcdir)/libs/mrcp-signaling/include \
- -I$(top_srcdir)/libs/mrcp/include \
- -I$(top_srcdir)/libs/mpf/include \
- -I$(top_srcdir)/libs/apr-toolkit/include \
- $(UNIMRCP_APR_INCLUDES)
-
-noinst_LTLIBRARIES = libmrcpsignaling.la
-
-include_HEADERS = include/mrcp_sig_types.h \
- include/mrcp_sig_agent.h \
- include/mrcp_session.h \
- include/mrcp_session_descriptor.h
-
-libmrcpsignaling_la_SOURCES = src/mrcp_sig_agent.c \
- src/mrcp_session_descriptor.c
\ No newline at end of file
diff --git a/libs/unimrcp/libs/mrcp-signaling/include/mrcp_session.h b/libs/unimrcp/libs/mrcp-signaling/include/mrcp_session.h
deleted file mode 100644
index f4b9ebcc96..0000000000
--- a/libs/unimrcp/libs/mrcp-signaling/include/mrcp_session.h
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_session.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MRCP_SESSION_H
-#define MRCP_SESSION_H
-
-/**
- * @file mrcp_session.h
- * @brief Abstract MRCP Session
- */
-
-#include "mrcp_sig_types.h"
-#include "mpf_types.h"
-#include "apt_string.h"
-
-APT_BEGIN_EXTERN_C
-
-/** Macro to log session pointers */
-#define MRCP_SESSION_PTR(session) (session)
-/** Macro to log session string identifiers */
-#define MRCP_SESSION_SID(session) \
- (session)->id.buf ? (session)->id.buf : "new"
-
-/** Macro to log session pointers and string identifiers */
-#define MRCP_SESSION_PTRSID(session) \
- MRCP_SESSION_PTR(session), MRCP_SESSION_SID(session)
-
-/** MRCP session request vtable declaration */
-typedef struct mrcp_session_request_vtable_t mrcp_session_request_vtable_t;
-/** MRCP session response vtable declaration */
-typedef struct mrcp_session_response_vtable_t mrcp_session_response_vtable_t;
-/** MRCP session event vtable declaration */
-typedef struct mrcp_session_event_vtable_t mrcp_session_event_vtable_t;
-
-
-/** MRCP session */
-struct mrcp_session_t {
- /** Memory pool to allocate memory from */
- apr_pool_t *pool;
- /** External object associated with session */
- void *obj;
- /** External logger object associated with session */
- void *log_obj;
- /** Informative name of the session used for debugging */
- const char *name;
-
- /** Signaling (session managment) agent */
- mrcp_sig_agent_t *signaling_agent;
- /** MRCPv2 connection agent, if any */
- void *connection_agent;
- /** Media processing engine */
- mpf_engine_t *media_engine;
- /** RTP termination factory */
- mpf_termination_factory_t *rtp_factory;
-
- /** Session identifier */
- apt_str_t id;
- /** Last request identifier sent for client, received for server */
- mrcp_request_id last_request_id;
-
- /** Virtual request methods */
- const mrcp_session_request_vtable_t *request_vtable;
- /** Virtual response methods */
- const mrcp_session_response_vtable_t *response_vtable;
- /** Virtual event methods */
- const mrcp_session_event_vtable_t *event_vtable;
-};
-
-
-/** MRCP session request vtable */
-struct mrcp_session_request_vtable_t {
- /** Offer session descriptor */
- apt_bool_t (*offer)(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor);
- /** Terminate session */
- apt_bool_t (*terminate)(mrcp_session_t *session);
- /** Control session (MRCPv1 only) */
- apt_bool_t (*control)(mrcp_session_t *session, mrcp_message_t *message);
- /** Discover resources */
- apt_bool_t (*discover)(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor);
-};
-
-/** MRCP session response vtable */
-struct mrcp_session_response_vtable_t {
- /** Answer with remote session descriptor */
- apt_bool_t (*on_answer)(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor);
- /** Session terminated */
- apt_bool_t (*on_terminate)(mrcp_session_t *session);
- /** Control session (MRCPv1 only) */
- apt_bool_t (*on_control)(mrcp_session_t *session, mrcp_message_t *message);
- /** Response to resource discovery request */
- apt_bool_t (*on_discover)(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor);
-};
-
-/** MRCP session event vtable */
-struct mrcp_session_event_vtable_t {
- /** Received session termination event without appropriate request */
- apt_bool_t (*on_terminate)(mrcp_session_t *session);
-};
-
-
-/** Create new memory pool and allocate session object from the pool. */
-MRCP_DECLARE(mrcp_session_t*) mrcp_session_create(apr_size_t padding);
-
-/** Destroy session and assosiated memory pool. */
-MRCP_DECLARE(void) mrcp_session_destroy(mrcp_session_t *session);
-
-
-/** Offer */
-static APR_INLINE apt_bool_t mrcp_session_offer(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor)
-{
- if(session->request_vtable->offer) {
- return session->request_vtable->offer(session,descriptor);
- }
- return FALSE;
-}
-
-/** Terminate */
-static APR_INLINE apt_bool_t mrcp_session_terminate_request(mrcp_session_t *session)
-{
- if(session->request_vtable->terminate) {
- return session->request_vtable->terminate(session);
- }
- return FALSE;
-}
-
-/** Answer */
-static APR_INLINE apt_bool_t mrcp_session_answer(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor)
-{
- if(session->response_vtable->on_answer) {
- return session->response_vtable->on_answer(session,descriptor);
- }
- return FALSE;
-}
-
-/** On terminate response */
-static APR_INLINE apt_bool_t mrcp_session_terminate_response(mrcp_session_t *session)
-{
- if(session->response_vtable->on_terminate) {
- return session->response_vtable->on_terminate(session);
- }
- return FALSE;
-}
-
-/** On terminate event */
-static APR_INLINE apt_bool_t mrcp_session_terminate_event(mrcp_session_t *session)
-{
- if(session->event_vtable->on_terminate) {
- return session->event_vtable->on_terminate(session);
- }
- return FALSE;
-}
-
-/** Control request */
-static APR_INLINE apt_bool_t mrcp_session_control_request(mrcp_session_t *session, mrcp_message_t *message)
-{
- if(session->request_vtable->control) {
- return session->request_vtable->control(session,message);
- }
- return FALSE;
-}
-
-/** On control response/event */
-static APR_INLINE apt_bool_t mrcp_session_control_response(mrcp_session_t *session, mrcp_message_t *message)
-{
- if(session->response_vtable->on_control) {
- return session->response_vtable->on_control(session,message);
- }
- return FALSE;
-}
-
-/** Resource discovery request */
-static APR_INLINE apt_bool_t mrcp_session_discover_request(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor)
-{
- if(session->request_vtable->discover) {
- return session->request_vtable->discover(session,descriptor);
- }
- return FALSE;
-}
-
-/** On resource discovery response */
-static APR_INLINE apt_bool_t mrcp_session_discover_response(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor)
-{
- if(session->response_vtable->on_discover) {
- return session->response_vtable->on_discover(session,descriptor);
- }
- return FALSE;
-}
-
-APT_END_EXTERN_C
-
-#endif /* MRCP_SESSION_H */
diff --git a/libs/unimrcp/libs/mrcp-signaling/include/mrcp_session_descriptor.h b/libs/unimrcp/libs/mrcp-signaling/include/mrcp_session_descriptor.h
deleted file mode 100644
index e1e9b48448..0000000000
--- a/libs/unimrcp/libs/mrcp-signaling/include/mrcp_session_descriptor.h
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_session_descriptor.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MRCP_SESSION_DESCRIPTOR_H
-#define MRCP_SESSION_DESCRIPTOR_H
-
-/**
- * @file mrcp_session_descriptor.h
- * @brief MRCP Session Descriptor
- */
-
-#include "mpf_rtp_descriptor.h"
-#include "mrcp_sig_types.h"
-
-APT_BEGIN_EXTERN_C
-
-/** MRCP session status */
-typedef enum {
- MRCP_SESSION_STATUS_OK, /**< OK */
- MRCP_SESSION_STATUS_NO_SUCH_RESOURCE, /**< no such resource found */
- MRCP_SESSION_STATUS_UNACCEPTABLE_RESOURCE,/**< resource exists, but no implementation (plugin) found */
- MRCP_SESSION_STATUS_UNAVAILABLE_RESOURCE, /**< resource exists, but is temporary unavailable */
- MRCP_SESSION_STATUS_ERROR /**< internal error occurred */
-} mrcp_session_status_e;
-
-/** MRCP session descriptor */
-struct mrcp_session_descriptor_t {
- /** SDP origin */
- apt_str_t origin;
- /** Session level IP address */
- apt_str_t ip;
- /** Session level external (NAT) IP address */
- apt_str_t ext_ip;
- /** Session level resource name (MRCPv1 only) */
- apt_str_t resource_name;
- /** Resource state (MRCPv1 only) */
- apt_bool_t resource_state;
- /** Session status */
- mrcp_session_status_e status;
- /** Response code (SIP for MRCPv2 and RTSP for MRCPv1) */
- int response_code;
-
- /** MRCP control media array (mrcp_control_descriptor_t) */
- apr_array_header_t *control_media_arr;
- /** Audio media array (mpf_rtp_media_descriptor_t) */
- apr_array_header_t *audio_media_arr;
- /** Video media array (mpf_rtp_media_descriptor_t) */
- apr_array_header_t *video_media_arr;
-};
-
-/** Create session descriptor */
-MRCP_DECLARE(mrcp_session_descriptor_t*) mrcp_session_descriptor_create(apr_pool_t *pool);
-
-static APR_INLINE apr_size_t mrcp_session_media_count_get(const mrcp_session_descriptor_t *descriptor)
-{
- return descriptor->control_media_arr->nelts + descriptor->audio_media_arr->nelts + descriptor->video_media_arr->nelts;
-}
-
-static APR_INLINE apr_size_t mrcp_session_control_media_add(mrcp_session_descriptor_t *descriptor, void *media)
-{
- APR_ARRAY_PUSH(descriptor->control_media_arr,void*) = media;
- return mrcp_session_media_count_get(descriptor) - 1;
-}
-
-static APR_INLINE void* mrcp_session_control_media_get(const mrcp_session_descriptor_t *descriptor, apr_size_t id)
-{
- if((int)id >= descriptor->control_media_arr->nelts) {
- return NULL;
- }
- return APR_ARRAY_IDX(descriptor->control_media_arr,id,void*);
-}
-
-static APR_INLINE apt_bool_t mrcp_session_control_media_set(mrcp_session_descriptor_t *descriptor, apr_size_t id, void *media)
-{
- if((int)id >= descriptor->control_media_arr->nelts) {
- return FALSE;
- }
- APR_ARRAY_IDX(descriptor->control_media_arr,id,void*) = media;
- return TRUE;
-}
-
-
-static APR_INLINE apr_size_t mrcp_session_audio_media_add(mrcp_session_descriptor_t *descriptor, mpf_rtp_media_descriptor_t *media)
-{
- APR_ARRAY_PUSH(descriptor->audio_media_arr,mpf_rtp_media_descriptor_t*) = media;
- return mrcp_session_media_count_get(descriptor) - 1;
-}
-
-static APR_INLINE mpf_rtp_media_descriptor_t* mrcp_session_audio_media_get(const mrcp_session_descriptor_t *descriptor, apr_size_t id)
-{
- if((int)id >= descriptor->audio_media_arr->nelts) {
- return NULL;
- }
- return APR_ARRAY_IDX(descriptor->audio_media_arr,id,mpf_rtp_media_descriptor_t*);
-}
-
-static APR_INLINE apt_bool_t mrcp_session_audio_media_set(const mrcp_session_descriptor_t *descriptor, apr_size_t id, mpf_rtp_media_descriptor_t* media)
-{
- if((int)id >= descriptor->audio_media_arr->nelts) {
- return FALSE;
- }
- APR_ARRAY_IDX(descriptor->audio_media_arr,id,mpf_rtp_media_descriptor_t*) = media;
- return TRUE;
-}
-
-
-static APR_INLINE apr_size_t mrcp_session_video_media_add(mrcp_session_descriptor_t *descriptor, mpf_rtp_media_descriptor_t *media)
-{
- APR_ARRAY_PUSH(descriptor->video_media_arr,mpf_rtp_media_descriptor_t*) = media;
- return mrcp_session_media_count_get(descriptor) - 1;
-}
-
-static APR_INLINE mpf_rtp_media_descriptor_t* mrcp_session_video_media_get(const mrcp_session_descriptor_t *descriptor, apr_size_t id)
-{
- if((int)id >= descriptor->video_media_arr->nelts) {
- return NULL;
- }
- return APR_ARRAY_IDX(descriptor->video_media_arr,id,mpf_rtp_media_descriptor_t*);
-}
-
-static APR_INLINE apt_bool_t mrcp_session_video_media_set(mrcp_session_descriptor_t *descriptor, apr_size_t id, mpf_rtp_media_descriptor_t* media)
-{
- if((int)id >= descriptor->video_media_arr->nelts) {
- return FALSE;
- }
- APR_ARRAY_IDX(descriptor->video_media_arr,id,mpf_rtp_media_descriptor_t*) = media;
- return TRUE;
-}
-
-/** Get session status phrase */
-MRCP_DECLARE(const char*) mrcp_session_status_phrase_get(mrcp_session_status_e status);
-
-APT_END_EXTERN_C
-
-#endif /* MRCP_SESSION_DESCRIPTOR_H */
diff --git a/libs/unimrcp/libs/mrcp-signaling/include/mrcp_sig_agent.h b/libs/unimrcp/libs/mrcp-signaling/include/mrcp_sig_agent.h
deleted file mode 100644
index a7595066d5..0000000000
--- a/libs/unimrcp/libs/mrcp-signaling/include/mrcp_sig_agent.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_sig_agent.h 2253 2014-11-21 02:57:19Z achaloyan@gmail.com $
- */
-
-#ifndef MRCP_SIG_AGENT_H
-#define MRCP_SIG_AGENT_H
-
-/**
- * @file mrcp_sig_agent.h
- * @brief Abstract MRCP Signaling Agent
- */
-
-#include
-#include
-#include "mrcp_sig_types.h"
-#include "apt_task.h"
-
-APT_BEGIN_EXTERN_C
-
-/** Signaling settings */
-struct mrcp_sig_settings_t {
- /** Server IP address */
- char *server_ip;
- /** Server port */
- apr_port_t server_port;
- /** Server SIP user name (v2 only) */
- char *user_name;
- /** Resource location (v1 only) */
- char *resource_location;
- /** Map of the MRCP resource names (v1 only) */
- apr_table_t *resource_map;
- /** Force destination IP address. Should be used only in case
- SDP contains incorrect connection address (local IP address behind NAT) */
- apt_bool_t force_destination;
- /** Optional feature tags */
- char *feature_tags;
-};
-
-/** MRCP signaling agent */
-struct mrcp_sig_agent_t {
- /** Agent identifier */
- const char *id;
- /** Memory pool to allocate memory from */
- apr_pool_t *pool;
- /** External object associated with agent */
- void *obj;
- /** Parent object (client/server) */
- void *parent;
- /** MRCP resource factory */
- mrcp_resource_factory_t *resource_factory;
- /** Task interface */
- apt_task_t *task;
- /** Task message pool used to allocate signaling agent messages */
- apt_task_msg_pool_t *msg_pool;
-
- /** Virtual create_server_session */
- mrcp_session_t* (*create_server_session)(mrcp_sig_agent_t *signaling_agent);
- /** Virtual create_client_session */
- apt_bool_t (*create_client_session)(mrcp_session_t *session, const mrcp_sig_settings_t *settings);
-};
-
-/** Create signaling agent. */
-MRCP_DECLARE(mrcp_sig_agent_t*) mrcp_signaling_agent_create(const char *id, void *obj, apr_pool_t *pool);
-
-/** Create factory of signaling agents. */
-MRCP_DECLARE(mrcp_sa_factory_t*) mrcp_sa_factory_create(apr_pool_t *pool);
-
-/** Add signaling agent to factory. */
-MRCP_DECLARE(apt_bool_t) mrcp_sa_factory_agent_add(mrcp_sa_factory_t *sa_factory, mrcp_sig_agent_t *sig_agent);
-
-/** Determine whether factory is empty. */
-MRCP_DECLARE(apt_bool_t) mrcp_sa_factory_is_empty(const mrcp_sa_factory_t *sa_factory);
-
-/** Select next available signaling agent. */
-MRCP_DECLARE(mrcp_sig_agent_t*) mrcp_sa_factory_agent_select(mrcp_sa_factory_t *sa_factory);
-
-/** Allocate MRCP signaling settings. */
-MRCP_DECLARE(mrcp_sig_settings_t*) mrcp_signaling_settings_alloc(apr_pool_t *pool);
-
-
-APT_END_EXTERN_C
-
-#endif /* MRCP_SIG_AGENT_H */
diff --git a/libs/unimrcp/libs/mrcp-signaling/include/mrcp_sig_types.h b/libs/unimrcp/libs/mrcp-signaling/include/mrcp_sig_types.h
deleted file mode 100644
index 6dc589036e..0000000000
--- a/libs/unimrcp/libs/mrcp-signaling/include/mrcp_sig_types.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_sig_types.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MRCP_SIG_TYPES_H
-#define MRCP_SIG_TYPES_H
-
-/**
- * @file mrcp_sig_types.h
- * @brief MRCP Signaling Types Declaration
- */
-
-#include "mrcp_types.h"
-
-APT_BEGIN_EXTERN_C
-
-/** Opaque MRCP signaling settings declaration */
-typedef struct mrcp_sig_settings_t mrcp_sig_settings_t;
-
-/** Opaque MRCP signaling agent declaration */
-typedef struct mrcp_sig_agent_t mrcp_sig_agent_t;
-
-/** Opaque MRCP signaling agent factory declaration */
-typedef struct mrcp_sa_factory_t mrcp_sa_factory_t;
-
-/** Opaque MRCP session declaration */
-typedef struct mrcp_session_t mrcp_session_t;
-
-/** Opaque MRCP session descriptor declaration */
-typedef struct mrcp_session_descriptor_t mrcp_session_descriptor_t;
-
-APT_END_EXTERN_C
-
-#endif /* MRCP_SIG_TYPES_H */
diff --git a/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.2010.vcxproj.filters b/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.2010.vcxproj.filters
deleted file mode 100644
index 4e5d30c3da..0000000000
--- a/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.2010.vcxproj.filters
+++ /dev/null
@@ -1,35 +0,0 @@
-
-
-
-
- {93995380-89BD-4b04-88EB-625FBE52EBFB}
- h;hpp;hxx;hm;inl;inc;xsd
-
-
- {f3dc550f-1a0f-4b9e-b077-3b6940dc5531}
- cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
-
-
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
-
-
- src
-
-
- src
-
-
-
\ No newline at end of file
diff --git a/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.2017.vcxproj b/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.2017.vcxproj
deleted file mode 100644
index d8f8525d72..0000000000
--- a/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.2017.vcxproj
+++ /dev/null
@@ -1,130 +0,0 @@
-
-
-
-
- Debug
- Win32
-
-
- Debug
- x64
-
-
- Release
- Win32
-
-
- Release
- x64
-
-
-
- mrcpsignaling
- {12A49562-BAB9-43A3-A21D-15B60BBB4C31}
- mrcpsignaling
- Win32Proj
-
-
-
- StaticLibrary
- Unicode
- true
- $(DefaultPlatformToolset)
-
-
- StaticLibrary
- Unicode
- $(DefaultPlatformToolset)
-
-
- StaticLibrary
- Unicode
- true
- $(DefaultPlatformToolset)
-
-
- StaticLibrary
- Unicode
- $(DefaultPlatformToolset)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <_ProjectFileVersion>10.0.30319.1
- $(PlatformName)\$(Configuration)\
- $(PlatformName)\$(Configuration)\
- $(SolutionDir)$(PlatformName)\$(Configuration)\
- $(PlatformName)\$(Configuration)\
- $(PlatformName)\$(Configuration)\
- $(PlatformName)\$(Configuration)\
- $(SolutionDir)$(PlatformName)\$(Configuration)\
- $(PlatformName)\$(Configuration)\
-
-
-
- APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)
-
-
-
-
- X64
-
-
- APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)
- ProgramDatabase
-
-
-
-
- APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)
-
-
-
-
- X64
-
-
- APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {f6c55d93-b927-4483-bb69-15aef3dd2dff}
-
-
-
-
-
-
\ No newline at end of file
diff --git a/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.vcproj b/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.vcproj
deleted file mode 100644
index 6aa8163acc..0000000000
--- a/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.vcproj
+++ /dev/null
@@ -1,276 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.vcxproj b/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.vcxproj
deleted file mode 100644
index 13a3708693..0000000000
--- a/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.vcxproj
+++ /dev/null
@@ -1,124 +0,0 @@
-
-
-
-
- Debug
- Win32
-
-
- Debug
- x64
-
-
- Release
- Win32
-
-
- Release
- x64
-
-
-
- {12A49562-BAB9-43A3-A21D-15B60BBB4C31}
- mrcpsignaling
- Win32Proj
-
-
-
- StaticLibrary
- Unicode
- true
-
-
- StaticLibrary
- Unicode
-
-
- StaticLibrary
- Unicode
- true
-
-
- StaticLibrary
- Unicode
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <_ProjectFileVersion>10.0.30319.1
- AllRules.ruleset
-
-
- AllRules.ruleset
-
-
- AllRules.ruleset
-
-
- AllRules.ruleset
-
-
-
-
-
- X64
-
-
- ProgramDatabase
-
-
-
-
- X64
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {b5a00bfa-6083-4fae-a097-71642d6473b5}
- false
-
-
- {1c320193-46a6-4b34-9c56-8ab584fc1b56}
- false
-
-
-
-
-
-
\ No newline at end of file
diff --git a/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.vcxproj.filters b/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.vcxproj.filters
deleted file mode 100644
index 7b9d1aa49b..0000000000
--- a/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.vcxproj.filters
+++ /dev/null
@@ -1,35 +0,0 @@
-
-
-
-
- {93995380-89BD-4b04-88EB-625FBE52EBFB}
- h;hpp;hxx;hm;inl;inc;xsd
-
-
- {38ec7b90-673c-4c54-9c3a-13d5270556a0}
- cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
-
-
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
-
-
- src
-
-
- src
-
-
-
\ No newline at end of file
diff --git a/libs/unimrcp/libs/mrcp-signaling/src/mrcp_session_descriptor.c b/libs/unimrcp/libs/mrcp-signaling/src/mrcp_session_descriptor.c
deleted file mode 100644
index a14545708b..0000000000
--- a/libs/unimrcp/libs/mrcp-signaling/src/mrcp_session_descriptor.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_session_descriptor.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include "mrcp_session_descriptor.h"
-
-MRCP_DECLARE(mrcp_session_descriptor_t*) mrcp_session_descriptor_create(apr_pool_t *pool)
-{
- mrcp_session_descriptor_t *descriptor = apr_palloc(pool,sizeof(mrcp_session_descriptor_t));
- apt_string_reset(&descriptor->origin);
- apt_string_reset(&descriptor->ip);
- apt_string_reset(&descriptor->ext_ip);
- apt_string_reset(&descriptor->resource_name);
- descriptor->resource_state = FALSE;
- descriptor->status = MRCP_SESSION_STATUS_OK;
- descriptor->response_code = 0;
- descriptor->control_media_arr = apr_array_make(pool,1,sizeof(void*));
- descriptor->audio_media_arr = apr_array_make(pool,1,sizeof(mpf_rtp_media_descriptor_t*));
- descriptor->video_media_arr = apr_array_make(pool,0,sizeof(mpf_rtp_media_descriptor_t*));
- return descriptor;
-}
-
-MRCP_DECLARE(const char*) mrcp_session_status_phrase_get(mrcp_session_status_e status)
-{
- switch(status) {
- case MRCP_SESSION_STATUS_OK:
- return "OK";
- case MRCP_SESSION_STATUS_NO_SUCH_RESOURCE:
- return "Not Found";
- case MRCP_SESSION_STATUS_UNACCEPTABLE_RESOURCE:
- return "Not Acceptable";
- case MRCP_SESSION_STATUS_UNAVAILABLE_RESOURCE:
- return "Unavailable";
- case MRCP_SESSION_STATUS_ERROR:
- return "Error";
- }
- return "Unknown";
-}
diff --git a/libs/unimrcp/libs/mrcp-signaling/src/mrcp_sig_agent.c b/libs/unimrcp/libs/mrcp-signaling/src/mrcp_sig_agent.c
deleted file mode 100644
index dca8de94c3..0000000000
--- a/libs/unimrcp/libs/mrcp-signaling/src/mrcp_sig_agent.c
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_sig_agent.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include "mrcp_sig_agent.h"
-#include "mrcp_session.h"
-#include "apt_pool.h"
-
-/** Factory of MRCP signaling agents */
-struct mrcp_sa_factory_t {
- /** Array of pointers to signaling agents */
- apr_array_header_t *agents_arr;
- /** Index of the current agent */
- int index;
-};
-
-/** Create signaling agent */
-MRCP_DECLARE(mrcp_sig_agent_t*) mrcp_signaling_agent_create(const char *id, void *obj, apr_pool_t *pool)
-{
- mrcp_sig_agent_t *sig_agent = apr_palloc(pool,sizeof(mrcp_sig_agent_t));
- sig_agent->id = id;
- sig_agent->pool = pool;
- sig_agent->obj = obj;
- sig_agent->resource_factory = NULL;
- sig_agent->parent = NULL;
- sig_agent->task = NULL;
- sig_agent->msg_pool = NULL;
- sig_agent->create_server_session = NULL;
- sig_agent->create_client_session = NULL;
- return sig_agent;
-}
-
-/** Create factory of signaling agents */
-MRCP_DECLARE(mrcp_sa_factory_t*) mrcp_sa_factory_create(apr_pool_t *pool)
-{
- mrcp_sa_factory_t *sa_factory = apr_palloc(pool,sizeof(mrcp_sa_factory_t));
- sa_factory->agents_arr = apr_array_make(pool,1,sizeof(mrcp_sig_agent_t*));
- sa_factory->index = 0;
- return sa_factory;
-}
-
-/** Add signaling agent to pool */
-MRCP_DECLARE(apt_bool_t) mrcp_sa_factory_agent_add(mrcp_sa_factory_t *sa_factory, mrcp_sig_agent_t *sig_agent)
-{
- mrcp_sig_agent_t **slot;
- if(!sig_agent)
- return FALSE;
-
- slot = apr_array_push(sa_factory->agents_arr);
- *slot = sig_agent;
- return TRUE;
-}
-
-/** Determine whether factory is empty. */
-MRCP_DECLARE(apt_bool_t) mrcp_sa_factory_is_empty(const mrcp_sa_factory_t *sa_factory)
-{
- return apr_is_empty_array(sa_factory->agents_arr);
-}
-
-/** Select next available signaling agent */
-MRCP_DECLARE(mrcp_sig_agent_t*) mrcp_sa_factory_agent_select(mrcp_sa_factory_t *sa_factory)
-{
- mrcp_sig_agent_t *sig_agent = APR_ARRAY_IDX(sa_factory->agents_arr, sa_factory->index, mrcp_sig_agent_t*);
- if(++sa_factory->index == sa_factory->agents_arr->nelts) {
- sa_factory->index = 0;
- }
- return sig_agent;
-}
-
-/** Allocate MRCP signaling settings */
-MRCP_DECLARE(mrcp_sig_settings_t*) mrcp_signaling_settings_alloc(apr_pool_t *pool)
-{
- mrcp_sig_settings_t *settings = apr_palloc(pool,sizeof(mrcp_sig_settings_t));
- settings->server_ip = NULL;
- settings->server_port = 0;
- settings->user_name = NULL;
- settings->resource_location = NULL;
- settings->resource_map = apr_table_make(pool,2);
- settings->force_destination = FALSE;
- settings->feature_tags = NULL;
- return settings;
-}
-
-
-MRCP_DECLARE(mrcp_session_t*) mrcp_session_create(apr_size_t padding)
-{
- mrcp_session_t *session;
- apr_pool_t *pool = apt_pool_create();
- if(!pool) {
- return NULL;
- }
- session = apr_palloc(pool,sizeof(mrcp_session_t)+padding);
- session->pool = pool;
- session->obj = NULL;
- session->log_obj = NULL;
- session->name = NULL;
- session->signaling_agent = NULL;
- session->connection_agent = NULL;
- session->media_engine = NULL;
- session->rtp_factory = NULL;
- session->request_vtable = NULL;
- session->response_vtable = NULL;
- session->event_vtable = NULL;
- apt_string_reset(&session->id);
- session->last_request_id = 0;
- return session;
-}
-
-MRCP_DECLARE(void) mrcp_session_destroy(mrcp_session_t *session)
-{
- if(session->pool) {
- apr_pool_destroy(session->pool);
- }
-}
diff --git a/libs/unimrcp/libs/mrcp/Makefile.am b/libs/unimrcp/libs/mrcp/Makefile.am
deleted file mode 100644
index 7c893f8dd9..0000000000
--- a/libs/unimrcp/libs/mrcp/Makefile.am
+++ /dev/null
@@ -1,47 +0,0 @@
-MAINTAINERCLEANFILES = Makefile.in
-
-AM_CPPFLAGS = -I$(top_srcdir)/libs/mrcp/include \
- -I$(top_srcdir)/libs/mrcp/message/include \
- -I$(top_srcdir)/libs/mrcp/control/include \
- -I$(top_srcdir)/libs/mrcp/resources/include \
- -I$(top_srcdir)/libs/apr-toolkit/include \
- $(UNIMRCP_APR_INCLUDES)
-
-noinst_LTLIBRARIES = libmrcp.la
-
-include_HEADERS = include/mrcp.h \
- include/mrcp_types.h \
- message/include/mrcp_start_line.h \
- message/include/mrcp_header_accessor.h \
- message/include/mrcp_generic_header.h \
- message/include/mrcp_header.h \
- message/include/mrcp_message.h \
- control/include/mrcp_resource.h \
- control/include/mrcp_resource_factory.h \
- control/include/mrcp_resource_loader.h \
- control/include/mrcp_stream.h \
- resources/include/mrcp_synth_header.h \
- resources/include/mrcp_synth_resource.h \
- resources/include/mrcp_recog_header.h \
- resources/include/mrcp_recog_resource.h \
- resources/include/mrcp_recorder_header.h \
- resources/include/mrcp_recorder_resource.h \
- resources/include/mrcp_verifier_header.h \
- resources/include/mrcp_verifier_resource.h
-
-libmrcp_la_SOURCES = message/src/mrcp_start_line.c \
- message/src/mrcp_header_accessor.c \
- message/src/mrcp_generic_header.c \
- message/src/mrcp_header.c \
- message/src/mrcp_message.c \
- control/src/mrcp_resource_factory.c \
- control/src/mrcp_resource_loader.c \
- control/src/mrcp_stream.c \
- resources/src/mrcp_synth_header.c \
- resources/src/mrcp_synth_resource.c \
- resources/src/mrcp_recog_header.c \
- resources/src/mrcp_recog_resource.c \
- resources/src/mrcp_recorder_header.c \
- resources/src/mrcp_recorder_resource.c \
- resources/src/mrcp_verifier_header.c \
- resources/src/mrcp_verifier_resource.c
diff --git a/libs/unimrcp/libs/mrcp/control/include/mrcp_resource.h b/libs/unimrcp/libs/mrcp/control/include/mrcp_resource.h
deleted file mode 100644
index 9c2910903a..0000000000
--- a/libs/unimrcp/libs/mrcp/control/include/mrcp_resource.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_resource.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MRCP_RESOURCE_H
-#define MRCP_RESOURCE_H
-
-/**
- * @file mrcp_resource.h
- * @brief Abstract MRCP Resource
- */
-
-#include "mrcp_types.h"
-#include "mrcp_header_accessor.h"
-
-APT_BEGIN_EXTERN_C
-
-
-/** MRCP resource definition */
-struct mrcp_resource_t {
- /** MRCP resource identifier */
- mrcp_resource_id id;
- /** MRCP resource name */
- apt_str_t name;
-
- /** Get string table of methods */
- const apt_str_table_item_t* (*get_method_str_table)(mrcp_version_e version);
- /** Number of methods */
- apr_size_t method_count;
-
- /** Get string table of events */
- const apt_str_table_item_t* (*get_event_str_table)(mrcp_version_e version);
- /** Number of events */
- apr_size_t event_count;
-
- /** Get vtable of resource header */
- const mrcp_header_vtable_t* (*get_resource_header_vtable)(mrcp_version_e version);
-};
-
-/** Initialize MRCP resource */
-static APR_INLINE mrcp_resource_t* mrcp_resource_create(apr_pool_t *pool)
-{
- mrcp_resource_t *resource = (mrcp_resource_t*) apr_palloc(pool, sizeof(mrcp_resource_t));
- resource->id = 0;
- apt_string_reset(&resource->name);
- resource->method_count = 0;
- resource->event_count = 0;
- resource->get_method_str_table = NULL;
- resource->get_event_str_table = NULL;
- resource->get_resource_header_vtable = NULL;
- return resource;
-}
-
-/** Validate MRCP resource */
-static APR_INLINE apt_bool_t mrcp_resource_validate(mrcp_resource_t *resource)
-{
- if(resource->method_count && resource->event_count &&
- resource->get_method_str_table && resource->get_event_str_table &&
- resource->get_resource_header_vtable &&
- resource->name.buf && resource->name.length) {
- return TRUE;
- }
- return FALSE;
-}
-
-APT_END_EXTERN_C
-
-#endif /* MRCP_RESOURCE_H */
diff --git a/libs/unimrcp/libs/mrcp/control/include/mrcp_resource_factory.h b/libs/unimrcp/libs/mrcp/control/include/mrcp_resource_factory.h
deleted file mode 100644
index 0f3c2f6e09..0000000000
--- a/libs/unimrcp/libs/mrcp/control/include/mrcp_resource_factory.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_resource_factory.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MRCP_RESOURCE_FACTORY_H
-#define MRCP_RESOURCE_FACTORY_H
-
-/**
- * @file mrcp_resource_factory.h
- * @brief Aggregation of MRCP Resources
- */
-
-#include "apt_text_stream.h"
-#include "mrcp_types.h"
-
-APT_BEGIN_EXTERN_C
-
-/** Create MRCP resource factory */
-MRCP_DECLARE(mrcp_resource_factory_t*) mrcp_resource_factory_create(apr_size_t resource_count, apr_pool_t *pool);
-
-/** Destroy MRCP resource factory */
-MRCP_DECLARE(apt_bool_t) mrcp_resource_factory_destroy(mrcp_resource_factory_t *resource_factory);
-
-/** Register MRCP resource */
-MRCP_DECLARE(apt_bool_t) mrcp_resource_register(mrcp_resource_factory_t *resource_factory, mrcp_resource_t *resource);
-
-/** Get MRCP resource by resource id */
-MRCP_DECLARE(mrcp_resource_t*) mrcp_resource_get(const mrcp_resource_factory_t *resource_factory, mrcp_resource_id resource_id);
-
-/** Find MRCP resource by resource name */
-MRCP_DECLARE(mrcp_resource_t*) mrcp_resource_find(const mrcp_resource_factory_t *resource_factory, const apt_str_t *name);
-
-
-APT_END_EXTERN_C
-
-#endif /* MRCP_RESOURCE_FACTORY_H */
diff --git a/libs/unimrcp/libs/mrcp/control/include/mrcp_resource_loader.h b/libs/unimrcp/libs/mrcp/control/include/mrcp_resource_loader.h
deleted file mode 100644
index 555b580a6d..0000000000
--- a/libs/unimrcp/libs/mrcp/control/include/mrcp_resource_loader.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_resource_loader.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MRCP_RESOURCE_LOADER_H
-#define MRCP_RESOURCE_LOADER_H
-
-/**
- * @file mrcp_resource_loader.h
- * @brief MRCP Resource Loader
- */
-
-#include "apt_string.h"
-#include "mrcp_types.h"
-
-APT_BEGIN_EXTERN_C
-
-/** Opaque resource loader declaration */
-typedef struct mrcp_resource_loader_t mrcp_resource_loader_t;
-
-
-/** Create MRCP resource loader */
-MRCP_DECLARE(mrcp_resource_loader_t*) mrcp_resource_loader_create(apt_bool_t load_all_resources, apr_pool_t *pool);
-
-/** Load all MRCP resources */
-MRCP_DECLARE(apt_bool_t) mrcp_resources_load(mrcp_resource_loader_t *loader);
-
-/** Load MRCP resource by resource name */
-MRCP_DECLARE(apt_bool_t) mrcp_resource_load(mrcp_resource_loader_t *loader, const apt_str_t *name);
-
-/** Load MRCP resource by resource identifier */
-MRCP_DECLARE(apt_bool_t) mrcp_resource_load_by_id(mrcp_resource_loader_t *loader, mrcp_resource_id id);
-
-/** Get MRCP resource factory */
-MRCP_DECLARE(mrcp_resource_factory_t*) mrcp_resource_factory_get(const mrcp_resource_loader_t *loader);
-
-APT_END_EXTERN_C
-
-#endif /* MRCP_RESOURCE_LOADER_H */
diff --git a/libs/unimrcp/libs/mrcp/control/include/mrcp_stream.h b/libs/unimrcp/libs/mrcp/control/include/mrcp_stream.h
deleted file mode 100644
index 1389effb42..0000000000
--- a/libs/unimrcp/libs/mrcp/control/include/mrcp_stream.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_stream.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MRCP_STREAM_H
-#define MRCP_STREAM_H
-
-/**
- * @file mrcp_stream.h
- * @brief MRCP Stream Parser and Generator
- */
-
-#include "apt_text_message.h"
-#include "mrcp_types.h"
-
-APT_BEGIN_EXTERN_C
-
-
-/** Opaque MRCP parser declaration */
-typedef struct mrcp_parser_t mrcp_parser_t;
-/** Opaque MRCP generator declaration */
-typedef struct mrcp_generator_t mrcp_generator_t;
-
-
-/** Create MRCP stream parser */
-MRCP_DECLARE(mrcp_parser_t*) mrcp_parser_create(const mrcp_resource_factory_t *resource_factory, apr_pool_t *pool);
-
-/** Set resource by name to be used for parsing of MRCPv1 messages */
-MRCP_DECLARE(void) mrcp_parser_resource_set(mrcp_parser_t *parser, const apt_str_t *resource_name);
-
-/** Set verbose mode for the parser */
-MRCP_DECLARE(void) mrcp_parser_verbose_set(mrcp_parser_t *parser, apt_bool_t verbose);
-
-/** Parse MRCP stream */
-MRCP_DECLARE(apt_message_status_e) mrcp_parser_run(mrcp_parser_t *parser, apt_text_stream_t *stream, mrcp_message_t **message);
-
-
-
-/** Create MRCP stream generator */
-MRCP_DECLARE(mrcp_generator_t*) mrcp_generator_create(const mrcp_resource_factory_t *resource_factory, apr_pool_t *pool);
-
-/** Set verbose mode for the generator */
-MRCP_DECLARE(void) mrcp_generator_verbose_set(mrcp_generator_t *generator, apt_bool_t verbose);
-
-/** Generate MRCP stream */
-MRCP_DECLARE(apt_message_status_e) mrcp_generator_run(mrcp_generator_t *generator, mrcp_message_t *message, apt_text_stream_t *stream);
-
-
-/** Generate MRCP message (excluding message body) */
-MRCP_DECLARE(apt_bool_t) mrcp_message_generate(const mrcp_resource_factory_t *resource_factory, mrcp_message_t *message, apt_text_stream_t *stream);
-
-
-APT_END_EXTERN_C
-
-#endif /* MRCP_STREAM_H */
diff --git a/libs/unimrcp/libs/mrcp/control/src/mrcp_resource_factory.c b/libs/unimrcp/libs/mrcp/control/src/mrcp_resource_factory.c
deleted file mode 100644
index e0a1124075..0000000000
--- a/libs/unimrcp/libs/mrcp/control/src/mrcp_resource_factory.c
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_resource_factory.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include
-#include "mrcp_resource_factory.h"
-#include "mrcp_message.h"
-#include "mrcp_resource.h"
-#include "mrcp_generic_header.h"
-
-/** Resource factory definition (aggregation of resources) */
-struct mrcp_resource_factory_t {
- /** Array of MRCP resources (reference by id) */
- mrcp_resource_t **resource_array;
- /** Number of MRCP resources */
- apr_size_t resource_count;
- /** Hash of MRCP resources (reference by name) */
- apr_hash_t *resource_hash;
-};
-
-/** Create MRCP resource factory */
-MRCP_DECLARE(mrcp_resource_factory_t*) mrcp_resource_factory_create(apr_size_t resource_count, apr_pool_t *pool)
-{
- apr_size_t i;
- mrcp_resource_factory_t *resource_factory;
- if(resource_count == 0) {
- return NULL;
- }
-
- resource_factory = apr_palloc(pool,sizeof(mrcp_resource_factory_t));
- resource_factory->resource_count = resource_count;
- resource_factory->resource_array = apr_palloc(pool,sizeof(mrcp_resource_t*)*resource_count);
- for(i=0; iresource_array[i] = NULL;
- }
- resource_factory->resource_hash = apr_hash_make(pool);
- return resource_factory;
-}
-
-/** Destroy MRCP resource container */
-MRCP_DECLARE(apt_bool_t) mrcp_resource_factory_destroy(mrcp_resource_factory_t *resource_factory)
-{
- if(resource_factory->resource_array) {
- resource_factory->resource_array = NULL;
- }
- resource_factory->resource_count = 0;
- return TRUE;
-}
-
-/** Register MRCP resource */
-MRCP_DECLARE(apt_bool_t) mrcp_resource_register(mrcp_resource_factory_t *resource_factory, mrcp_resource_t *resource)
-{
- if(!resource || resource->id >= resource_factory->resource_count) {
- /* invalid params */
- return FALSE;
- }
- if(resource_factory->resource_array[resource->id]) {
- /* resource with specified id already exists */
- return FALSE;
- }
- if(mrcp_resource_validate(resource) != TRUE) {
- /* invalid resource */
- return FALSE;
- }
- resource_factory->resource_array[resource->id] = resource;
- apr_hash_set(resource_factory->resource_hash,resource->name.buf,resource->name.length,resource);
- return TRUE;
-}
-
-/** Get MRCP resource by resource id */
-MRCP_DECLARE(mrcp_resource_t*) mrcp_resource_get(const mrcp_resource_factory_t *resource_factory, mrcp_resource_id resource_id)
-{
- if(resource_id >= resource_factory->resource_count) {
- return NULL;
- }
- return resource_factory->resource_array[resource_id];
-}
-
-/** Find MRCP resource by resource name */
-MRCP_DECLARE(mrcp_resource_t*) mrcp_resource_find(const mrcp_resource_factory_t *resource_factory, const apt_str_t *name)
-{
- if(!name->buf || !name->length) {
- return NULL;
- }
-
- return apr_hash_get(resource_factory->resource_hash,name->buf,name->length);
-}
diff --git a/libs/unimrcp/libs/mrcp/control/src/mrcp_resource_loader.c b/libs/unimrcp/libs/mrcp/control/src/mrcp_resource_loader.c
deleted file mode 100644
index d172bdddb4..0000000000
--- a/libs/unimrcp/libs/mrcp/control/src/mrcp_resource_loader.c
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_resource_loader.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include "mrcp_resource_loader.h"
-#include "mrcp_resource_factory.h"
-#include "mrcp_resource.h"
-#include "mrcp_synth_resource.h"
-#include "mrcp_recog_resource.h"
-#include "mrcp_recorder_resource.h"
-#include "mrcp_verifier_resource.h"
-#include "apt_log.h"
-
-/** Resource loader */
-struct mrcp_resource_loader_t {
- mrcp_resource_factory_t *factory;
- apr_pool_t *pool;
-};
-
-/** String table of MRCPv2 resources (mrcp_resource_type_e) */
-static const apt_str_table_item_t mrcp_resource_string_table[] = {
- {{"speechsynth",11},6},
- {{"speechrecog",11},6},
- {{"recorder", 8},0},
- {{"speakverify",11},3}
-};
-
-static mrcp_resource_t* mrcp_resource_create_by_id(mrcp_resource_id id, apr_pool_t *pool);
-
-/** Create default MRCP resource factory */
-MRCP_DECLARE(mrcp_resource_loader_t*) mrcp_resource_loader_create(apt_bool_t load_all_resources, apr_pool_t *pool)
-{
- mrcp_resource_loader_t *loader;
- mrcp_resource_factory_t *resource_factory;
- resource_factory = mrcp_resource_factory_create(MRCP_RESOURCE_TYPE_COUNT,pool);
- if(!resource_factory) {
- return NULL;
- }
-
- loader = apr_palloc(pool,sizeof(mrcp_resource_loader_t));
- loader->factory = resource_factory;
- loader->pool = pool;
-
- if(load_all_resources == TRUE) {
- mrcp_resources_load(loader);
- }
-
- return loader;
-}
-
-/** Load all MRCP resources */
-MRCP_DECLARE(apt_bool_t) mrcp_resources_load(mrcp_resource_loader_t *loader)
-{
- mrcp_resource_id id;
- for(id=0; idpool);
- if(!resource) {
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Failed to Load Resource [%d]",id);
- return FALSE;
- }
-
- apt_string_copy(&resource->name,name,loader->pool);
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Register Resource [%s]",name->buf);
- return mrcp_resource_register(loader->factory,resource);
-}
-
-/** Load MRCP resource by resource identifier */
-MRCP_DECLARE(apt_bool_t) mrcp_resource_load_by_id(mrcp_resource_loader_t *loader, mrcp_resource_id id)
-{
- const apt_str_t *name = apt_string_table_str_get(
- mrcp_resource_string_table,
- MRCP_RESOURCE_TYPE_COUNT,
- id);
- mrcp_resource_t *resource = mrcp_resource_create_by_id(id,loader->pool);
- if(!resource || !name) {
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Failed to Load Resource [%d]",id);
- return FALSE;
- }
-
- resource->name = *name;
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Register Resource [%s]",resource->name.buf);
- return mrcp_resource_register(loader->factory,resource);
-}
-
-/** Get MRCP resource factory */
-MRCP_DECLARE(mrcp_resource_factory_t*) mrcp_resource_factory_get(const mrcp_resource_loader_t *loader)
-{
- return loader->factory;
-}
-
-static mrcp_resource_t* mrcp_resource_create_by_id(mrcp_resource_id id, apr_pool_t *pool)
-{
- mrcp_resource_t *resource = NULL;
- switch(id) {
- case MRCP_SYNTHESIZER_RESOURCE:
- resource = mrcp_synth_resource_create(pool);
- break;
- case MRCP_RECOGNIZER_RESOURCE:
- resource = mrcp_recog_resource_create(pool);
- break;
- case MRCP_RECORDER_RESOURCE:
- resource = mrcp_recorder_resource_create(pool);
- break;
- case MRCP_VERIFIER_RESOURCE:
- resource = mrcp_verifier_resource_create(pool);
- break;
- }
-
- if(resource) {
- resource->id = id;
- }
- return resource;
-}
diff --git a/libs/unimrcp/libs/mrcp/control/src/mrcp_stream.c b/libs/unimrcp/libs/mrcp/control/src/mrcp_stream.c
deleted file mode 100644
index 7791764722..0000000000
--- a/libs/unimrcp/libs/mrcp/control/src/mrcp_stream.c
+++ /dev/null
@@ -1,245 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_stream.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include "mrcp_stream.h"
-#include "mrcp_message.h"
-#include "mrcp_resource_factory.h"
-#include "mrcp_resource.h"
-#include "apt_log.h"
-
-
-/** MRCP parser */
-struct mrcp_parser_t {
- apt_message_parser_t *base;
- const mrcp_resource_factory_t *resource_factory;
- mrcp_resource_t *resource;
-};
-
-/** MRCP generator */
-struct mrcp_generator_t {
- apt_message_generator_t *base;
- const mrcp_resource_factory_t *resource_factory;
-};
-
-/** Create message and read start line */
-static apt_bool_t mrcp_parser_on_start(apt_message_parser_t *parser, apt_message_context_t *context, apt_text_stream_t *stream, apr_pool_t *pool);
-/** Header section handler */
-static apt_bool_t mrcp_parser_on_header_complete(apt_message_parser_t *parser, apt_message_context_t *context);
-
-static const apt_message_parser_vtable_t parser_vtable = {
- mrcp_parser_on_start,
- mrcp_parser_on_header_complete,
- NULL
-};
-
-/** Start message generation */
-apt_bool_t mrcp_generator_on_start(apt_message_generator_t *generator, apt_message_context_t *context, apt_text_stream_t *stream);
-/** Finalize by setting overall message length in start line */
-apt_bool_t mrcp_generator_on_header_complete(apt_message_generator_t *generator, apt_message_context_t *context, apt_text_stream_t *stream);
-
-static const apt_message_generator_vtable_t generator_vtable = {
- mrcp_generator_on_start,
- mrcp_generator_on_header_complete,
- NULL
-};
-
-
-/** Create MRCP stream parser */
-MRCP_DECLARE(mrcp_parser_t*) mrcp_parser_create(const mrcp_resource_factory_t *resource_factory, apr_pool_t *pool)
-{
- mrcp_parser_t *parser = apr_palloc(pool,sizeof(mrcp_parser_t));
- parser->base = apt_message_parser_create(parser,&parser_vtable,pool);
- parser->resource_factory = resource_factory;
- parser->resource = NULL;
- return parser;
-}
-
-/** Set resource by name to be used for parsing of MRCPv1 messages */
-MRCP_DECLARE(void) mrcp_parser_resource_set(mrcp_parser_t *parser, const apt_str_t *resource_name)
-{
- if(resource_name) {
- parser->resource = mrcp_resource_find(parser->resource_factory,resource_name);
- }
-}
-
-/** Set verbose mode for the parser */
-MRCP_DECLARE(void) mrcp_parser_verbose_set(mrcp_parser_t *parser, apt_bool_t verbose)
-{
- apt_message_parser_verbose_set(parser->base,verbose);
-}
-
-/** Parse MRCP stream */
-MRCP_DECLARE(apt_message_status_e) mrcp_parser_run(mrcp_parser_t *parser, apt_text_stream_t *stream, mrcp_message_t **message)
-{
- return apt_message_parser_run(parser->base,stream,(void**)message);
-}
-
-/** Create message and read start line */
-static apt_bool_t mrcp_parser_on_start(apt_message_parser_t *parser, apt_message_context_t *context, apt_text_stream_t *stream, apr_pool_t *pool)
-{
- mrcp_message_t *mrcp_message;
- apt_str_t start_line;
- /* read start line */
- if(apt_text_line_read(stream,&start_line) == FALSE) {
- return FALSE;
- }
-
- /* create new MRCP message */
- mrcp_message = mrcp_message_create(pool);
- /* parse start-line */
- if(mrcp_start_line_parse(&mrcp_message->start_line,&start_line,mrcp_message->pool) == FALSE) {
- return FALSE;
- }
-
- if(mrcp_message->start_line.version == MRCP_VERSION_1) {
- mrcp_parser_t *mrcp_parser = apt_message_parser_object_get(parser);
- if(!mrcp_parser->resource) {
- return FALSE;
- }
- apt_string_copy(
- &mrcp_message->channel_id.resource_name,
- &mrcp_parser->resource->name,
- pool);
-
- if(mrcp_message_resource_set(mrcp_message,mrcp_parser->resource) == FALSE) {
- return FALSE;
- }
- }
-
- context->message = mrcp_message;
- context->header = &mrcp_message->header.header_section;
- context->body = &mrcp_message->body;
- return TRUE;
-}
-
-/** Header section handler */
-static apt_bool_t mrcp_parser_on_header_complete(apt_message_parser_t *parser, apt_message_context_t *context)
-{
- mrcp_message_t *mrcp_message = context->message;
- if(mrcp_message->start_line.version == MRCP_VERSION_2) {
- mrcp_resource_t *resource;
- mrcp_parser_t *mrcp_parser;
- if(mrcp_channel_id_parse(&mrcp_message->channel_id,&mrcp_message->header,mrcp_message->pool) == FALSE) {
- return FALSE;
- }
- mrcp_parser = apt_message_parser_object_get(parser);
- /* find resource */
- resource = mrcp_resource_find(mrcp_parser->resource_factory,&mrcp_message->channel_id.resource_name);
- if(!resource) {
- return FALSE;
- }
-
- if(mrcp_message_resource_set(mrcp_message,resource) == FALSE) {
- return FALSE;
- }
- }
-
- if(mrcp_header_fields_parse(&mrcp_message->header,mrcp_message->pool) == FALSE) {
- return FALSE;
- }
-
- if(context->body && mrcp_generic_header_property_check(mrcp_message,GENERIC_HEADER_CONTENT_LENGTH) == TRUE) {
- mrcp_generic_header_t *generic_header = mrcp_generic_header_get(mrcp_message);
- if(generic_header && generic_header->content_length) {
- context->body->length = generic_header->content_length;
- }
- }
- return TRUE;
-}
-
-
-/** Create MRCP stream generator */
-MRCP_DECLARE(mrcp_generator_t*) mrcp_generator_create(const mrcp_resource_factory_t *resource_factory, apr_pool_t *pool)
-{
- mrcp_generator_t *generator = apr_palloc(pool,sizeof(mrcp_generator_t));
- generator->base = apt_message_generator_create(generator,&generator_vtable,pool);
- generator->resource_factory = resource_factory;
- return generator;
-}
-
-/** Set verbose mode for the generator */
-MRCP_DECLARE(void) mrcp_generator_verbose_set(mrcp_generator_t *generator, apt_bool_t verbose)
-{
- apt_message_generator_verbose_set(generator->base,verbose);
-}
-
-/** Generate MRCP stream */
-MRCP_DECLARE(apt_message_status_e) mrcp_generator_run(mrcp_generator_t *generator, mrcp_message_t *message, apt_text_stream_t *stream)
-{
- return apt_message_generator_run(generator->base,message,stream);
-}
-
-/** Initialize by generating message start line and return header section and body */
-apt_bool_t mrcp_generator_on_start(apt_message_generator_t *generator, apt_message_context_t *context, apt_text_stream_t *stream)
-{
- mrcp_message_t *mrcp_message = context->message;
- /* validate message */
- if(mrcp_message_validate(mrcp_message) == FALSE) {
- return FALSE;
- }
- /* generate start-line */
- if(mrcp_start_line_generate(&mrcp_message->start_line,stream) == FALSE) {
- return FALSE;
- }
-
- if(mrcp_message->start_line.version == MRCP_VERSION_2) {
- mrcp_channel_id_generate(&mrcp_message->channel_id,stream);
- }
-
- context->header = &mrcp_message->header.header_section;
- context->body = &mrcp_message->body;
- return TRUE;
-}
-
-/** Finalize by setting overall message length in start line */
-apt_bool_t mrcp_generator_on_header_complete(apt_message_generator_t *generator, apt_message_context_t *context, apt_text_stream_t *stream)
-{
- mrcp_message_t *mrcp_message = context->message;
- /* finalize start-line generation */
- return mrcp_start_line_finalize(&mrcp_message->start_line,mrcp_message->body.length,stream);
-}
-
-/** Generate MRCP message (excluding message body) */
-MRCP_DECLARE(apt_bool_t) mrcp_message_generate(const mrcp_resource_factory_t *resource_factory, mrcp_message_t *message, apt_text_stream_t *stream)
-{
- /* validate message */
- if(mrcp_message_validate(message) == FALSE) {
- return FALSE;
- }
-
- /* generate start-line */
- if(mrcp_start_line_generate(&message->start_line,stream) == FALSE) {
- return FALSE;
- }
-
- if(message->start_line.version == MRCP_VERSION_2) {
- mrcp_channel_id_generate(&message->channel_id,stream);
- }
-
- /* generate header section */
- if(apt_header_section_generate(&message->header.header_section,stream) == FALSE) {
- return FALSE;
- }
-
- /* finalize start-line generation */
- if(mrcp_start_line_finalize(&message->start_line,message->body.length,stream) == FALSE) {
- return FALSE;
- }
-
- return TRUE;
-}
diff --git a/libs/unimrcp/libs/mrcp/include/mrcp.h b/libs/unimrcp/libs/mrcp/include/mrcp.h
deleted file mode 100644
index 995443e7ee..0000000000
--- a/libs/unimrcp/libs/mrcp/include/mrcp.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MRCP_H
-#define MRCP_H
-
-/**
- * @file mrcp.h
- * @brief MRCP Core Definitions
- */
-
-#include
-#include
-
-/** Library export/import defines */
-#ifdef WIN32
-#ifdef MRCP_STATIC_LIB
-#define MRCP_DECLARE(type) type __stdcall
-#else
-#ifdef MRCP_LIB_EXPORT
-#define MRCP_DECLARE(type) __declspec(dllexport) type __stdcall
-#else
-#define MRCP_DECLARE(type) __declspec(dllimport) type __stdcall
-#endif
-#endif
-#else
-#define MRCP_DECLARE(type) type
-#endif
-
-#endif /* MRCP_H */
diff --git a/libs/unimrcp/libs/mrcp/include/mrcp_types.h b/libs/unimrcp/libs/mrcp/include/mrcp_types.h
deleted file mode 100644
index 3f37cb6cfe..0000000000
--- a/libs/unimrcp/libs/mrcp/include/mrcp_types.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_types.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MRCP_TYPES_H
-#define MRCP_TYPES_H
-
-/**
- * @file mrcp_types.h
- * @brief Basic MRCP Types
- */
-
-#include "mrcp.h"
-
-APT_BEGIN_EXTERN_C
-
-/** Protocol version */
-typedef enum {
-
- MRCP_VERSION_UNKNOWN = 0, /**< Unknown version */
- MRCP_VERSION_1 = 1, /**< MRCPv1 (RFC4463) */
- MRCP_VERSION_2 = 2 /**< MRCPv2 (draft-ietf-speechsc-mrcpv2-20) */
-} mrcp_version_e;
-
-/** Enumeration of MRCP resource types */
-typedef enum {
- MRCP_SYNTHESIZER_RESOURCE, /**< Synthesizer resource */
- MRCP_RECOGNIZER_RESOURCE, /**< Recognizer resource */
- MRCP_RECORDER_RESOURCE, /**< Recorder resource */
- MRCP_VERIFIER_RESOURCE, /**< Verifier resource */
-
- MRCP_RESOURCE_TYPE_COUNT /**< Number of resources */
-} mrcp_resource_type_e;
-
-/* MRCPv2 specifies request-id as 32bit unsigned integer,
- * while MRCPv1 doesn't limit this value (1 * DIGIT).
- * Some MRCPv1 clients use too long request-id.
- * To support them #define TOO_LONG_MRCP_REQUEST_ID
- */
-#ifdef TOO_LONG_MRCP_REQUEST_ID
-/** MRCP request identifier */
-typedef apr_uint64_t mrcp_request_id;
-/** Format to log MRCP request identifier */
-#define MRCP_REQUEST_ID_FMT APR_UINT64_T_FMT
-#else
-/** MRCP request identifier */
-typedef apr_uint32_t mrcp_request_id;
-/** Format to log MRCP request identifier */
-#define MRCP_REQUEST_ID_FMT "d"
-#endif
-
-
-/** Method identifier associated with method name */
-typedef apr_size_t mrcp_method_id;
-/** Resource identifier associated with resource name */
-typedef apr_size_t mrcp_resource_id;
-
-
-/** Opaque MRCP message declaration */
-typedef struct mrcp_message_t mrcp_message_t;
-/** Opaque MRCP resource declaration */
-typedef struct mrcp_resource_t mrcp_resource_t;
-/** Opaque MRCP resource factory declaration */
-typedef struct mrcp_resource_factory_t mrcp_resource_factory_t;
-
-
-APT_END_EXTERN_C
-
-#endif /* MRCP_TYPES_H */
diff --git a/libs/unimrcp/libs/mrcp/message/include/mrcp_generic_header.h b/libs/unimrcp/libs/mrcp/message/include/mrcp_generic_header.h
deleted file mode 100644
index af84350da4..0000000000
--- a/libs/unimrcp/libs/mrcp/message/include/mrcp_generic_header.h
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_generic_header.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MRCP_GENERIC_HEADER_H
-#define MRCP_GENERIC_HEADER_H
-
-/**
- * @file mrcp_generic_header.h
- * @brief MRCP Generic Header
- */
-
-#include "mrcp_types.h"
-#include "mrcp_header_accessor.h"
-
-APT_BEGIN_EXTERN_C
-
-/** Enumeration of MRCP generic header fields */
-typedef enum {
- GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST,
- GENERIC_HEADER_PROXY_SYNC_ID,
- GENERIC_HEADER_ACCEPT_CHARSET,
- GENERIC_HEADER_CONTENT_TYPE,
- GENERIC_HEADER_CONTENT_ID,
- GENERIC_HEADER_CONTENT_BASE,
- GENERIC_HEADER_CONTENT_ENCODING,
- GENERIC_HEADER_CONTENT_LOCATION,
- GENERIC_HEADER_CONTENT_LENGTH,
- GENERIC_HEADER_CACHE_CONTROL,
- GENERIC_HEADER_LOGGING_TAG,
- GENERIC_HEADER_VENDOR_SPECIFIC_PARAMS,
-
- /** Additional header fields for MRCP v2 */
- GENERIC_HEADER_ACCEPT,
- GENERIC_HEADER_FETCH_TIMEOUT,
- GENERIC_HEADER_SET_COOKIE,
- GENERIC_HEADER_SET_COOKIE2,
-
- GENERIC_HEADER_COUNT
-} mrcp_generic_header_id;
-
-/** MRCP request identifiers list declaration */
-typedef struct mrcp_request_id_list_t mrcp_request_id_list_t;
-/** MRCP vendor specific parameter list of pairs */
-typedef struct mrcp_vendor_specific_params_list_t mrcp_vendor_specific_params_list_t;
-/** MRCP generic header declaration */
-typedef struct mrcp_generic_header_t mrcp_generic_header_t;
-
-/** Max number of request ids in active request id list */
-#define MAX_ACTIVE_REQUEST_ID_COUNT 5
-/** List (array) of MRCP request identifiers */
-struct mrcp_request_id_list_t {
- /** Array of request identifiers */
- mrcp_request_id ids[MAX_ACTIVE_REQUEST_ID_COUNT];
- /** Number of request identifiers */
- apr_size_t count;
-};
-
-
-/** MRCP generic header */
-struct mrcp_generic_header_t {
- /** Indicates the list of request-ids to which it should apply */
- mrcp_request_id_list_t active_request_id_list;
- /** Helps the resource receiving the event, proxied by the client,
- to decide if this event has been processed through a direct interaction of the resources */
- apt_str_t proxy_sync_id;
- /** Specifies the acceptable character set for entities returned in the response or events associated with this request */
- apt_str_t accept_charset;
- /** Restricted to speech markup, grammar, recognition results, etc. */
- apt_str_t content_type;
- /** Contains an ID or name for the content, by which it can be referred to */
- apt_str_t content_id;
- /** May be used to specify the base URI for resolving relative URLs within the entity */
- apt_str_t content_base;
- /** Indicates what additional content coding has been applied to the entity-body */
- apt_str_t content_encoding;
- /** Statement of the location of the resource corresponding to this particular entity at the time of the request */
- apt_str_t content_location;
- /** Contains the length of the content of the message body */
- size_t content_length;
- /** Defines the default caching algorithms on the media server for the session or request */
- apt_str_t cache_control;
- /** Sets the logging tag for logs generated by the media server */
- apt_str_t logging_tag;
- /** Specifies the vendor specific parameters used by the media server */
- apt_pair_arr_t *vendor_specific_params;
-
- /** Additional header fields for MRCP v2 */
- /** Specifies the acceptable media types set for entities returned in the response or events associated with this request */
- apt_str_t accept;
- /** Defines the timeout for content that the server may need to fetch over the network */
- apr_size_t fetch_timeout;
- /** Enables to synchronize the cookie store of MRCP v2 client and server */
- apt_str_t set_cookie;
- /** Enables to synchronize the cookie store of MRCP v2 client and server */
- apt_str_t set_cookie2;
-};
-
-/** Get generic header vtable */
-MRCP_DECLARE(const mrcp_header_vtable_t*) mrcp_generic_header_vtable_get(mrcp_version_e version);
-
-
-/** Append active request id list */
-MRCP_DECLARE(apt_bool_t) active_request_id_list_append(mrcp_generic_header_t *generic_header, mrcp_request_id request_id);
-/** Find request id in active request id list */
-MRCP_DECLARE(apt_bool_t) active_request_id_list_find(const mrcp_generic_header_t *generic_header, mrcp_request_id request_id);
-
-
-APT_END_EXTERN_C
-
-#endif /* MRCP_GENERIC_HEADER_H */
diff --git a/libs/unimrcp/libs/mrcp/message/include/mrcp_header.h b/libs/unimrcp/libs/mrcp/message/include/mrcp_header.h
deleted file mode 100644
index 9c9c0d5dee..0000000000
--- a/libs/unimrcp/libs/mrcp/message/include/mrcp_header.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_header.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MRCP_HEADER_H
-#define MRCP_HEADER_H
-
-/**
- * @file mrcp_header.h
- * @brief MRCP Message Header Definition
- */
-
-#include "mrcp_header_accessor.h"
-
-APT_BEGIN_EXTERN_C
-
-/**
- * Allows external applications to trigger whether
- * transaprent header fields are supported or not
- */
-#define TRANSPARENT_HEADER_FIELDS_SUPPORT
-
-/** MRCP message header declaration */
-typedef struct mrcp_message_header_t mrcp_message_header_t;
-/** MRCP channel-id declaration */
-typedef struct mrcp_channel_id mrcp_channel_id;
-
-
-/** MRCP message-header */
-struct mrcp_message_header_t {
- /** MRCP generic-header */
- mrcp_header_accessor_t generic_header_accessor;
- /** MRCP resource specific header */
- mrcp_header_accessor_t resource_header_accessor;
-
- /** Header section (collection of header fields)*/
- apt_header_section_t header_section;
-};
-
-/** MRCP channel-identifier */
-struct mrcp_channel_id {
- /** Unambiguous string identifying the MRCP session */
- apt_str_t session_id;
- /** MRCP resource name */
- apt_str_t resource_name;
-};
-
-
-/** Initialize MRCP message-header */
-static APR_INLINE void mrcp_message_header_init(mrcp_message_header_t *header)
-{
- mrcp_header_accessor_init(&header->generic_header_accessor);
- mrcp_header_accessor_init(&header->resource_header_accessor);
- apt_header_section_init(&header->header_section);
-}
-
-/** Allocate MRCP message-header data */
-MRCP_DECLARE(apt_bool_t) mrcp_message_header_data_alloc(
- mrcp_message_header_t *header,
- const mrcp_header_vtable_t *generic_header_vtable,
- const mrcp_header_vtable_t *resource_header_vtable,
- apr_pool_t *pool);
-
-/** Create MRCP message-header */
-MRCP_DECLARE(mrcp_message_header_t*) mrcp_message_header_create(
- const mrcp_header_vtable_t *generic_header_vtable,
- const mrcp_header_vtable_t *resource_header_vtable,
- apr_pool_t *pool);
-
-/** Destroy MRCP message-header */
-static APR_INLINE void mrcp_message_header_destroy(mrcp_message_header_t *header)
-{
- mrcp_header_destroy(&header->generic_header_accessor);
- mrcp_header_destroy(&header->resource_header_accessor);
-}
-
-/** Add MRCP header field */
-MRCP_DECLARE(apt_bool_t) mrcp_header_field_add(mrcp_message_header_t *header, apt_header_field_t *header_field, apr_pool_t *pool);
-
-
-/** Set (copy) MRCP header fields */
-MRCP_DECLARE(apt_bool_t) mrcp_header_fields_set(mrcp_message_header_t *header, const mrcp_message_header_t *src_header, apr_pool_t *pool);
-
-/** Get (copy) MRCP header fields */
-MRCP_DECLARE(apt_bool_t) mrcp_header_fields_get(mrcp_message_header_t *header, const mrcp_message_header_t *src_header, const mrcp_message_header_t *mask_header, apr_pool_t *pool);
-
-/** Inherit (copy) MRCP header fields */
-MRCP_DECLARE(apt_bool_t) mrcp_header_fields_inherit(mrcp_message_header_t *header, const mrcp_message_header_t *src_header, apr_pool_t *pool);
-
-/** Parse MRCP header fields */
-MRCP_DECLARE(apt_bool_t) mrcp_header_fields_parse(mrcp_message_header_t *header, apr_pool_t *pool);
-
-
-/** Initialize MRCP channel-identifier */
-MRCP_DECLARE(void) mrcp_channel_id_init(mrcp_channel_id *channel_id);
-
-/** Parse MRCP channel-identifier */
-MRCP_DECLARE(apt_bool_t) mrcp_channel_id_parse(mrcp_channel_id *channel_id, mrcp_message_header_t *header, apr_pool_t *pool);
-
-/** Generate MRCP channel-identifier */
-MRCP_DECLARE(apt_bool_t) mrcp_channel_id_generate(mrcp_channel_id *channel_id, apt_text_stream_t *text_stream);
-
-
-
-APT_END_EXTERN_C
-
-#endif /* MRCP_HEADER_H */
diff --git a/libs/unimrcp/libs/mrcp/message/include/mrcp_header_accessor.h b/libs/unimrcp/libs/mrcp/message/include/mrcp_header_accessor.h
deleted file mode 100644
index 217b7bb2cd..0000000000
--- a/libs/unimrcp/libs/mrcp/message/include/mrcp_header_accessor.h
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_header_accessor.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MRCP_HEADER_ACCESSOR_H
-#define MRCP_HEADER_ACCESSOR_H
-
-/**
- * @file mrcp_header_accessor.h
- * @brief Abstract MRCP Header Accessor
- */
-
-#include "apt_text_stream.h"
-#include "apt_header_field.h"
-#include "mrcp.h"
-
-APT_BEGIN_EXTERN_C
-
-/** MRCP header accessor declaration */
-typedef struct mrcp_header_accessor_t mrcp_header_accessor_t;
-/** MRCP header vtable declaration */
-typedef struct mrcp_header_vtable_t mrcp_header_vtable_t;
-
-/** MRCP header accessor interface */
-struct mrcp_header_vtable_t {
- /** Allocate actual header data */
- void* (*allocate)(mrcp_header_accessor_t *accessor, apr_pool_t *pool);
- /** Destroy header data */
- void (*destroy)(mrcp_header_accessor_t *accessor);
-
- /** Parse header field value */
- apt_bool_t (*parse_field)(mrcp_header_accessor_t *accessor, apr_size_t id, const apt_str_t *value, apr_pool_t *pool);
- /** Generate header field value */
- apt_bool_t (*generate_field)(const mrcp_header_accessor_t *accessor, apr_size_t id, apt_str_t *value, apr_pool_t *pool);
- /** Duplicate header field value */
- apt_bool_t (*duplicate_field)(mrcp_header_accessor_t *accessor, const mrcp_header_accessor_t *src, apr_size_t id, const apt_str_t *value, apr_pool_t *pool);
-
- /** Table of fields */
- const apt_str_table_item_t *field_table;
- /** Number of fields */
- apr_size_t field_count;
-};
-
-/** MRCP header accessor */
-struct mrcp_header_accessor_t {
- /** Actual header data allocated by accessor */
- void *data;
- /** Header accessor interface */
- const mrcp_header_vtable_t *vtable;
-};
-
-
-
-/** Initialize header vtable */
-static APR_INLINE void mrcp_header_vtable_init(mrcp_header_vtable_t *vtable)
-{
- vtable->allocate = NULL;
- vtable->destroy = NULL;
- vtable->parse_field = NULL;
- vtable->generate_field = NULL;
- vtable->duplicate_field = NULL;
- vtable->field_table = NULL;
- vtable->field_count = 0;
-}
-
-/** Validate header vtable */
-static APR_INLINE apt_bool_t mrcp_header_vtable_validate(const mrcp_header_vtable_t *vtable)
-{
- return (vtable->allocate && vtable->destroy &&
- vtable->parse_field && vtable->generate_field &&
- vtable->duplicate_field && vtable->field_table &&
- vtable->field_count) ? TRUE : FALSE;
-}
-
-
-/** Initialize header accessor */
-static APR_INLINE void mrcp_header_accessor_init(mrcp_header_accessor_t *accessor)
-{
- accessor->data = NULL;
- accessor->vtable = NULL;
-}
-
-/** Allocate header data */
-static APR_INLINE void* mrcp_header_allocate(mrcp_header_accessor_t *accessor, apr_pool_t *pool)
-{
- if(accessor->data) {
- return accessor->data;
- }
- if(!accessor->vtable || !accessor->vtable->allocate) {
- return NULL;
- }
- return accessor->vtable->allocate(accessor,pool);
-}
-
-/** Destroy header data */
-static APR_INLINE void mrcp_header_destroy(mrcp_header_accessor_t *accessor)
-{
- if(!accessor->vtable || !accessor->vtable->destroy) {
- return;
- }
- accessor->vtable->destroy(accessor);
-}
-
-
-/** Parse header field value */
-MRCP_DECLARE(apt_bool_t) mrcp_header_field_value_parse(mrcp_header_accessor_t *accessor, apt_header_field_t *header_field, apr_pool_t *pool);
-
-/** Generate header field value */
-MRCP_DECLARE(apt_header_field_t*) mrcp_header_field_value_generate(const mrcp_header_accessor_t *accessor, apr_size_t id, apt_bool_t empty_value, apr_pool_t *pool);
-
-/** Duplicate header field value */
-MRCP_DECLARE(apt_bool_t) mrcp_header_field_value_duplicate(mrcp_header_accessor_t *accessor, const mrcp_header_accessor_t *src_accessor, apr_size_t id, const apt_str_t *value, apr_pool_t *pool);
-
-
-APT_END_EXTERN_C
-
-#endif /* MRCP_HEADER_ACCESSOR_H */
diff --git a/libs/unimrcp/libs/mrcp/message/include/mrcp_message.h b/libs/unimrcp/libs/mrcp/message/include/mrcp_message.h
deleted file mode 100644
index 569a91b4bf..0000000000
--- a/libs/unimrcp/libs/mrcp/message/include/mrcp_message.h
+++ /dev/null
@@ -1,253 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_message.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MRCP_MESSAGE_H
-#define MRCP_MESSAGE_H
-
-/**
- * @file mrcp_message.h
- * @brief MRCP Message Definition
- */
-
-#include "mrcp_types.h"
-#include "mrcp_start_line.h"
-#include "mrcp_header.h"
-#include "mrcp_generic_header.h"
-
-APT_BEGIN_EXTERN_C
-
-/** Macro to log channel identifier of the message */
-#define MRCP_MESSAGE_SIDRES(message) \
- (message)->channel_id.session_id.buf, (message)->channel_id.resource_name.buf
-
-/** MRCP message */
-struct mrcp_message_t {
- /** Start-line of MRCP message */
- mrcp_start_line_t start_line;
- /** Channel-identifier of MRCP message */
- mrcp_channel_id channel_id;
- /** Header of MRCP message */
- mrcp_message_header_t header;
- /** Body of MRCP message */
- apt_str_t body;
-
- /** Associated MRCP resource */
- const mrcp_resource_t *resource;
- /** Memory pool to allocate memory from */
- apr_pool_t *pool;
-};
-
-/**
- * Create an MRCP message.
- * @param pool the pool to allocate memory from
- */
-MRCP_DECLARE(mrcp_message_t*) mrcp_message_create(apr_pool_t *pool);
-
-/**
- * Create an MRCP request message.
- * @param resource the MRCP resource to use
- * @param version the MRCP version to use
- * @param method_id the MRCP resource specific method identifier
- * @param pool the pool to allocate memory from
- */
-MRCP_DECLARE(mrcp_message_t*) mrcp_request_create(
- const mrcp_resource_t *resource,
- mrcp_version_e version,
- mrcp_method_id method_id,
- apr_pool_t *pool);
-
-/**
- * Create an MRCP response message based on given request message.
- * @param request_message the MRCP request message to create a response for
- * @param pool the pool to allocate memory from
- */
-MRCP_DECLARE(mrcp_message_t*) mrcp_response_create(const mrcp_message_t *request_message, apr_pool_t *pool);
-
-/**
- * Create an MRCP event message based on given requuest message.
- * @param request_message the MRCP request message to create an event for
- * @param event_id the MRCP resource specific event identifier
- * @param pool the pool to allocate memory from
- */
-MRCP_DECLARE(mrcp_message_t*) mrcp_event_create(
- const mrcp_message_t *request_message,
- mrcp_method_id event_id,
- apr_pool_t *pool);
-
-/**
- * Associate MRCP resource with message.
- * @param message the message to associate resource with
- * @param resource the resource to associate
- */
-MRCP_DECLARE(apt_bool_t) mrcp_message_resource_set(mrcp_message_t *message, const mrcp_resource_t *resource);
-
-/**
- * Validate MRCP message.
- * @param message the message to validate
- */
-MRCP_DECLARE(apt_bool_t) mrcp_message_validate(mrcp_message_t *message);
-
-/**
- * Destroy MRCP message.
- * @param message the message to destroy
- */
-MRCP_DECLARE(void) mrcp_message_destroy(mrcp_message_t *message);
-
-
-/**
- * Get MRCP generic header.
- * @param message the message to get generic header from
- */
-static APR_INLINE mrcp_generic_header_t* mrcp_generic_header_get(const mrcp_message_t *message)
-{
- return (mrcp_generic_header_t*) message->header.generic_header_accessor.data;
-}
-
-/**
- * Allocate (if not allocated) and get MRCP generic header.
- * @param message the message to prepare generic header for
- */
-static APR_INLINE mrcp_generic_header_t* mrcp_generic_header_prepare(mrcp_message_t *message)
-{
- return (mrcp_generic_header_t*) mrcp_header_allocate(&message->header.generic_header_accessor,message->pool);
-}
-
-/**
- * Add MRCP generic header field by specified property (numeric identifier).
- * @param message the message to add property for
- * @param id the numeric identifier to add
- */
-MRCP_DECLARE(apt_bool_t) mrcp_generic_header_property_add(mrcp_message_t *message, apr_size_t id);
-
-/**
- * Add only the name of MRCP generic header field specified by property (numeric identifier).
- * @param message the message to add property for
- * @param id the numeric identifier to add
- * @remark Should be used to construct empty header fiedls for GET-PARAMS requests
- */
-MRCP_DECLARE(apt_bool_t) mrcp_generic_header_name_property_add(mrcp_message_t *message, apr_size_t id);
-
-/**
- * Remove MRCP generic header field by specified property (numeric identifier).
- * @param message the message to remove property from
- * @param id the numeric identifier to remove
- */
-static APR_INLINE apt_bool_t mrcp_generic_header_property_remove(mrcp_message_t *message, apr_size_t id)
-{
- apt_header_field_t *header_field = apt_header_section_field_get(&message->header.header_section,id);
- if(header_field) {
- return apt_header_section_field_remove(&message->header.header_section,header_field);
- }
- return FALSE;
-}
-
-/**
- * Check whether specified by property (numeric identifier) MRCP generic header field is set or not.
- * @param message the message to use
- * @param id the numeric identifier to check
- */
-static APR_INLINE apt_bool_t mrcp_generic_header_property_check(const mrcp_message_t *message, apr_size_t id)
-{
- return apt_header_section_field_check(&message->header.header_section,id);
-}
-
-
-/**
- * Get MRCP resource header.
- * @param message the message to get resource header from
- */
-static APR_INLINE void* mrcp_resource_header_get(const mrcp_message_t *message)
-{
- return message->header.resource_header_accessor.data;
-}
-
-/**
- * Allocate (if not allocated) and get MRCP resource header.
- * @param message the message to prepare resource header for
- */
-static APR_INLINE void* mrcp_resource_header_prepare(mrcp_message_t *mrcp_message)
-{
- return mrcp_header_allocate(&mrcp_message->header.resource_header_accessor,mrcp_message->pool);
-}
-
-/**
- * Add MRCP resource header field by specified property (numeric identifier).
- * @param message the message to add property for
- * @param id the numeric identifier to add
- */
-MRCP_DECLARE(apt_bool_t) mrcp_resource_header_property_add(mrcp_message_t *message, apr_size_t id);
-
-/**
- * Add only the name of MRCP resource header field specified by property (numeric identifier).
- * @param message the message to add property for
- * @param id the numeric identifier to add
- * @remark Should be used to construct empty header fiedls for GET-PARAMS requests
- */
-MRCP_DECLARE(apt_bool_t) mrcp_resource_header_name_property_add(mrcp_message_t *message, apr_size_t id);
-
-/**
- * Remove MRCP resource header field by specified property (numeric identifier).
- * @param message the message to remove property from
- * @param id the numeric identifier to remove
- */
-static APR_INLINE apt_bool_t mrcp_resource_header_property_remove(mrcp_message_t *message, apr_size_t id)
-{
- apt_header_field_t *header_field = apt_header_section_field_get(&message->header.header_section,id + GENERIC_HEADER_COUNT);
- if(header_field) {
- return apt_header_section_field_remove(&message->header.header_section,header_field);
- }
- return FALSE;
-}
-
-/**
- * Check whether specified by property (numeric identifier) MRCP resource header field is set or not.
- * @param message the message to use
- * @param id the numeric identifier to check
- */
-static APR_INLINE apt_bool_t mrcp_resource_header_property_check(const mrcp_message_t *message, apr_size_t id)
-{
- return apt_header_section_field_check(&message->header.header_section,id + GENERIC_HEADER_COUNT);
-}
-
-/**
- * Add MRCP header field.
- * @param message the message to add header field for
- * @param header_field the header field to add
- */
-static APR_INLINE apt_bool_t mrcp_message_header_field_add(mrcp_message_t *message, apt_header_field_t *header_field)
-{
- return mrcp_header_field_add(&message->header,header_field,message->pool);
-}
-
-/**
- * Get the next MRCP header field.
- * @param message the message to use
- * @param header_field current header field
- * @remark Should be used to iterate on header fields
- *
- * apt_header_field_t *header_field = NULL;
- * while( (header_field = mrcp_message_next_header_field_get(message,header_field)) != NULL ) {
- * }
- */
-MRCP_DECLARE(apt_header_field_t*) mrcp_message_next_header_field_get(
- const mrcp_message_t *message,
- apt_header_field_t *header_field);
-
-APT_END_EXTERN_C
-
-#endif /* MRCP_MESSAGE_H */
diff --git a/libs/unimrcp/libs/mrcp/message/include/mrcp_start_line.h b/libs/unimrcp/libs/mrcp/message/include/mrcp_start_line.h
deleted file mode 100644
index 8b739a259f..0000000000
--- a/libs/unimrcp/libs/mrcp/message/include/mrcp_start_line.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_start_line.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MRCP_START_LINE_H
-#define MRCP_START_LINE_H
-
-/**
- * @file mrcp_start_line.h
- * @brief MRCP Start Line Definition
- */
-
-#include "mrcp_types.h"
-#include "apt_text_stream.h"
-
-APT_BEGIN_EXTERN_C
-
-/** Request-states used in MRCP response message */
-typedef enum {
- /** The request was processed to completion and there will be no
- more events from that resource to the client with that request-id */
- MRCP_REQUEST_STATE_COMPLETE,
- /** Indicate that further event messages will be delivered with that request-id */
- MRCP_REQUEST_STATE_INPROGRESS,
- /** The job has been placed on a queue and will be processed in first-in-first-out order */
- MRCP_REQUEST_STATE_PENDING,
-
- /** Number of request states */
- MRCP_REQUEST_STATE_COUNT,
- /** Unknown request state */
- MRCP_REQUEST_STATE_UNKNOWN = MRCP_REQUEST_STATE_COUNT
-} mrcp_request_state_e;
-
-/** Status codes */
-typedef enum {
- MRCP_STATUS_CODE_UNKNOWN = 0,
- /* success codes (2xx) */
- MRCP_STATUS_CODE_SUCCESS = 200,
- MRCP_STATUS_CODE_SUCCESS_WITH_IGNORE = 201,
- /* failure codes (4xx) */
- MRCP_STATUS_CODE_METHOD_NOT_ALLOWED = 401,
- MRCP_STATUS_CODE_METHOD_NOT_VALID = 402,
- MRCP_STATUS_CODE_UNSUPPORTED_PARAM = 403,
- MRCP_STATUS_CODE_ILLEGAL_PARAM_VALUE = 404,
- MRCP_STATUS_CODE_NOT_FOUND = 405,
- MRCP_STATUS_CODE_MISSING_PARAM = 406,
- MRCP_STATUS_CODE_METHOD_FAILED = 407,
- MRCP_STATUS_CODE_UNRECOGNIZED_MESSAGE = 408,
- MRCP_STATUS_CODE_UNSUPPORTED_PARAM_VALUE = 409,
- MRCP_STATUS_CODE_OUT_OF_ORDER = 410,
- MRCP_STATUS_CODE_RESOURCE_SPECIFIC_FAILURE = 421
-} mrcp_status_code_e;
-
-/** MRCP message types */
-typedef enum {
- MRCP_MESSAGE_TYPE_UNKNOWN,
- MRCP_MESSAGE_TYPE_REQUEST,
- MRCP_MESSAGE_TYPE_RESPONSE,
- MRCP_MESSAGE_TYPE_EVENT
-} mrcp_message_type_e;
-
-
-/** MRCP start-line declaration */
-typedef struct mrcp_start_line_t mrcp_start_line_t;
-
-/** Start-line of MRCP message */
-struct mrcp_start_line_t {
- /** MRCP message type */
- mrcp_message_type_e message_type;
- /** Version of protocol in use */
- mrcp_version_e version;
- /** Specify the length of the message, including the start-line (v2) */
- apr_size_t length;
- /** Unique identifier among client and server */
- mrcp_request_id request_id;
- /** MRCP method name */
- apt_str_t method_name;
- /** MRCP method id (associated with method name) */
- mrcp_method_id method_id;
- /** Success or failure or other status of the request */
- mrcp_status_code_e status_code;
- /** The state of the job initiated by the request */
- mrcp_request_state_e request_state;
-};
-
-/** Initialize MRCP start-line */
-MRCP_DECLARE(void) mrcp_start_line_init(mrcp_start_line_t *start_line);
-/** Parse MRCP start-line */
-MRCP_DECLARE(apt_bool_t) mrcp_start_line_parse(mrcp_start_line_t *start_line, apt_str_t *str, apr_pool_t *pool);
-/** Generate MRCP start-line */
-MRCP_DECLARE(apt_bool_t) mrcp_start_line_generate(mrcp_start_line_t *start_line, apt_text_stream_t *text_stream);
-/** Finalize MRCP start-line generation */
-MRCP_DECLARE(apt_bool_t) mrcp_start_line_finalize(mrcp_start_line_t *start_line, apr_size_t content_length, apt_text_stream_t *text_stream);
-
-/** Parse MRCP request-id */
-MRCP_DECLARE(mrcp_request_id) mrcp_request_id_parse(const apt_str_t *field);
-/** Generate MRCP request-id */
-MRCP_DECLARE(apt_bool_t) mrcp_request_id_generate(mrcp_request_id request_id, apt_text_stream_t *stream);
-
-
-APT_END_EXTERN_C
-
-#endif /* MRCP_START_LINE_H */
diff --git a/libs/unimrcp/libs/mrcp/message/src/mrcp_generic_header.c b/libs/unimrcp/libs/mrcp/message/src/mrcp_generic_header.c
deleted file mode 100644
index 858a76f802..0000000000
--- a/libs/unimrcp/libs/mrcp/message/src/mrcp_generic_header.c
+++ /dev/null
@@ -1,350 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_generic_header.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include "mrcp_generic_header.h"
-#include "mrcp_start_line.h"
-
-/** String table of mrcp generic-header fields (mrcp_generic_header_id) */
-static const apt_str_table_item_t generic_header_string_table[] = {
- {{"Active-Request-Id-List", 22},3},
- {{"Proxy-Sync-Id", 13},0},
- {{"Accept-Charset", 14},7},
- {{"Content-Type", 12},9},
- {{"Content-Id", 10},9},
- {{"Content-Base", 12},8},
- {{"Content-Encoding", 16},9},
- {{"Content-Location", 16},9},
- {{"Content-Length", 14},10},
- {{"Cache-Control", 13},1},
- {{"Logging-Tag", 11},0},
- {{"Vendor-Specific-Parameters",26},0},
- {{"Accept", 6},6},
- {{"Fetch-Timeout", 13},0},
- {{"Set-Cookie", 10},10},
- {{"Set-Cookie2", 11},10}
-};
-
-/** Parse mrcp request-id list */
-static apt_bool_t mrcp_request_id_list_parse(mrcp_request_id_list_t *request_id_list, const apt_str_t *value)
-{
- apt_str_t field;
- apt_text_stream_t stream;
- stream.text = *value;
- apt_text_stream_reset(&stream);
- request_id_list->count = 0;
- while(request_id_list->count < MAX_ACTIVE_REQUEST_ID_COUNT) {
- if(apt_text_field_read(&stream,',',TRUE,&field) == FALSE) {
- break;
- }
- request_id_list->ids[request_id_list->count] = mrcp_request_id_parse(&field);
- request_id_list->count++;
- }
- return TRUE;
-}
-
-/** Generate mrcp request-id list */
-static apt_bool_t mrcp_request_id_list_generate(const mrcp_request_id_list_t *request_id_list, apt_str_t *str, apr_pool_t *pool)
-{
- apr_size_t i;
- int length;
- char *pos;
-
- /* compute estimated length, assuming request-ids consist of upto 10 digits */
- str->length = 10 * request_id_list->count;
- if(request_id_list->count > 1) {
- /* , */
- str->length += request_id_list->count - 1;
- }
-
- str->buf = apr_palloc(pool,str->length + 1);
-
- pos = str->buf;
- for(i=0; icount; i++) {
- if(i != 0) {
- *pos++ = ',';
- }
-
- length = apr_snprintf(pos, str->length - (pos - str->buf), "%"MRCP_REQUEST_ID_FMT, request_id_list->ids[i]);
- if(length < 0)
- return FALSE;
- pos += length;
- }
- *pos = '\0';
- return TRUE;
-}
-
-
-/** Initialize generic-header */
-static void mrcp_generic_header_init(mrcp_generic_header_t *generic_header)
-{
- generic_header->active_request_id_list.count = 0;
- apt_string_reset(&generic_header->proxy_sync_id);
- apt_string_reset(&generic_header->accept_charset);
- apt_string_reset(&generic_header->content_type);
- apt_string_reset(&generic_header->content_id);
- apt_string_reset(&generic_header->content_base);
- apt_string_reset(&generic_header->content_encoding);
- apt_string_reset(&generic_header->content_location);
- generic_header->content_length = 0;
- apt_string_reset(&generic_header->cache_control);
- apt_string_reset(&generic_header->logging_tag);
- generic_header->vendor_specific_params = NULL;
- /* initializes additionnal MRCP v2 generic header fields */
- apt_string_reset(&generic_header->accept);
- generic_header->fetch_timeout = 0;
- apt_string_reset(&generic_header->set_cookie);
- apt_string_reset(&generic_header->set_cookie2);
-}
-
-
-/** Allocate generic-header */
-static void* mrcp_generic_header_allocate(mrcp_header_accessor_t *accessor, apr_pool_t *pool)
-{
- mrcp_generic_header_t *generic_header = apr_palloc(pool,sizeof(mrcp_generic_header_t));
- mrcp_generic_header_init(generic_header);
- accessor->data = generic_header;
- return accessor->data;
-}
-
-/** Parse generic-header */
-static apt_bool_t mrcp_generic_header_parse(mrcp_header_accessor_t *accessor, size_t id, const apt_str_t *value, apr_pool_t *pool)
-{
- apt_bool_t status = TRUE;
- mrcp_generic_header_t *generic_header = accessor->data;
- switch(id) {
- case GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST:
- mrcp_request_id_list_parse(&generic_header->active_request_id_list,value);
- break;
- case GENERIC_HEADER_PROXY_SYNC_ID:
- generic_header->proxy_sync_id = *value;
- break;
- case GENERIC_HEADER_ACCEPT_CHARSET:
- generic_header->accept_charset = *value;
- break;
- case GENERIC_HEADER_CONTENT_TYPE:
- generic_header->content_type = *value;
- break;
- case GENERIC_HEADER_CONTENT_ID:
- generic_header->content_id = *value;
- break;
- case GENERIC_HEADER_CONTENT_BASE:
- generic_header->content_base = *value;
- break;
- case GENERIC_HEADER_CONTENT_ENCODING:
- generic_header->content_encoding = *value;
- break;
- case GENERIC_HEADER_CONTENT_LOCATION:
- generic_header->content_location = *value;
- break;
- case GENERIC_HEADER_CONTENT_LENGTH:
- generic_header->content_length = apt_size_value_parse(value);
- break;
- case GENERIC_HEADER_CACHE_CONTROL:
- generic_header->cache_control = *value;
- break;
- case GENERIC_HEADER_LOGGING_TAG:
- generic_header->logging_tag = *value;
- break;
- case GENERIC_HEADER_VENDOR_SPECIFIC_PARAMS:
- if(!generic_header->vendor_specific_params) {
- generic_header->vendor_specific_params = apt_pair_array_create(1,pool);
- }
- apt_pair_array_parse(generic_header->vendor_specific_params,value,pool);
- break;
- case GENERIC_HEADER_ACCEPT:
- generic_header->accept = *value;
- break;
- case GENERIC_HEADER_FETCH_TIMEOUT:
- generic_header->fetch_timeout = apt_size_value_parse(value);
- break;
- case GENERIC_HEADER_SET_COOKIE:
- generic_header->set_cookie = *value;
- break;
- case GENERIC_HEADER_SET_COOKIE2:
- generic_header->set_cookie2 = *value;
- break;
- default:
- status = FALSE;
- }
- return status;
-}
-
-/** Generate generic-header */
-static apt_bool_t mrcp_generic_header_generate(const mrcp_header_accessor_t *accessor, apr_size_t id, apt_str_t *value, apr_pool_t *pool)
-{
- mrcp_generic_header_t *generic_header = accessor->data;
- switch(id) {
- case GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST:
- mrcp_request_id_list_generate(&generic_header->active_request_id_list,value,pool);
- break;
- case GENERIC_HEADER_PROXY_SYNC_ID:
- *value = generic_header->proxy_sync_id;
- break;
- case GENERIC_HEADER_ACCEPT_CHARSET:
- *value = generic_header->accept_charset;
- break;
- case GENERIC_HEADER_CONTENT_TYPE:
- *value = generic_header->content_type;
- break;
- case GENERIC_HEADER_CONTENT_ID:
- *value = generic_header->content_id;
- break;
- case GENERIC_HEADER_CONTENT_BASE:
- *value = generic_header->content_base;
- break;
- case GENERIC_HEADER_CONTENT_ENCODING:
- *value = generic_header->content_encoding;
- break;
- case GENERIC_HEADER_CONTENT_LOCATION:
- *value = generic_header->content_location;
- break;
- case GENERIC_HEADER_CONTENT_LENGTH:
- apt_size_value_generate(generic_header->content_length,value,pool);
- break;
- case GENERIC_HEADER_CACHE_CONTROL:
- *value = generic_header->cache_control;
- break;
- case GENERIC_HEADER_LOGGING_TAG:
- *value = generic_header->logging_tag;
- break;
- case GENERIC_HEADER_VENDOR_SPECIFIC_PARAMS:
- apt_pair_array_generate(generic_header->vendor_specific_params,value,pool);
- break;
- case GENERIC_HEADER_ACCEPT:
- *value = generic_header->accept;
- break;
- case GENERIC_HEADER_FETCH_TIMEOUT:
- apt_size_value_generate(generic_header->fetch_timeout,value,pool);
- break;
- case GENERIC_HEADER_SET_COOKIE:
- *value = generic_header->set_cookie;
- break;
- case GENERIC_HEADER_SET_COOKIE2:
- *value = generic_header->set_cookie2;
- break;
- default:
- break;
- }
- return TRUE;
-}
-
-/** Duplicate generic-header */
-static apt_bool_t mrcp_generic_header_duplicate(mrcp_header_accessor_t *accessor, const mrcp_header_accessor_t *src, apr_size_t id, const apt_str_t *value, apr_pool_t *pool)
-{
- mrcp_generic_header_t *generic_header = accessor->data;
- const mrcp_generic_header_t *src_generic_header = src->data;
- apt_bool_t status = TRUE;
-
- if(!generic_header || !src_generic_header) {
- return FALSE;
- }
-
- switch(id) {
- case GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST:
- break;
- case GENERIC_HEADER_PROXY_SYNC_ID:
- generic_header->proxy_sync_id = *value;
- break;
- case GENERIC_HEADER_ACCEPT_CHARSET:
- generic_header->accept_charset = *value;
- break;
- case GENERIC_HEADER_CONTENT_TYPE:
- generic_header->content_type = *value;
- break;
- case GENERIC_HEADER_CONTENT_ID:
- generic_header->content_id = *value;
- break;
- case GENERIC_HEADER_CONTENT_BASE:
- generic_header->content_base = *value;
- break;
- case GENERIC_HEADER_CONTENT_ENCODING:
- generic_header->content_encoding = *value;
- break;
- case GENERIC_HEADER_CONTENT_LOCATION:
- generic_header->content_location = *value;
- break;
- case GENERIC_HEADER_CONTENT_LENGTH:
- generic_header->content_length = src_generic_header->content_length;
- break;
- case GENERIC_HEADER_CACHE_CONTROL:
- generic_header->cache_control = *value;
- break;
- case GENERIC_HEADER_LOGGING_TAG:
- generic_header->logging_tag = *value;
- break;
- case GENERIC_HEADER_VENDOR_SPECIFIC_PARAMS:
- generic_header->vendor_specific_params = apt_pair_array_copy(src_generic_header->vendor_specific_params,pool);
- break;
- case GENERIC_HEADER_ACCEPT:
- generic_header->accept = *value;
- break;
- case GENERIC_HEADER_FETCH_TIMEOUT:
- generic_header->fetch_timeout = src_generic_header->fetch_timeout;
- break;
- case GENERIC_HEADER_SET_COOKIE:
- generic_header->set_cookie = *value;
- break;
- case GENERIC_HEADER_SET_COOKIE2:
- generic_header->set_cookie2 = *value;
- break;
- default:
- status = FALSE;
- }
- return status;
-}
-
-static const mrcp_header_vtable_t vtable = {
- mrcp_generic_header_allocate,
- NULL, /* nothing to destroy */
- mrcp_generic_header_parse,
- mrcp_generic_header_generate,
- mrcp_generic_header_duplicate,
- generic_header_string_table,
- GENERIC_HEADER_COUNT
-};
-
-
-MRCP_DECLARE(const mrcp_header_vtable_t*) mrcp_generic_header_vtable_get(mrcp_version_e version)
-{
- return &vtable;
-}
-
-
-/** Append active request id list */
-MRCP_DECLARE(apt_bool_t) active_request_id_list_append(mrcp_generic_header_t *generic_header, mrcp_request_id request_id)
-{
- mrcp_request_id_list_t *request_id_list = &generic_header->active_request_id_list;
- if(request_id_list->count >= MAX_ACTIVE_REQUEST_ID_COUNT) {
- return FALSE;
- }
- request_id_list->ids[request_id_list->count++] = request_id;
- return TRUE;
-}
-
-/** Find request id in active request id list */
-MRCP_DECLARE(apt_bool_t) active_request_id_list_find(const mrcp_generic_header_t *generic_header, mrcp_request_id request_id)
-{
- size_t i;
- const mrcp_request_id_list_t *request_id_list = &generic_header->active_request_id_list;
- for(i=0; icount; i++) {
- if(request_id_list->ids[i] == request_id) {
- return TRUE;
- }
- }
- return FALSE;
-}
diff --git a/libs/unimrcp/libs/mrcp/message/src/mrcp_header.c b/libs/unimrcp/libs/mrcp/message/src/mrcp_header.c
deleted file mode 100644
index 22d02692e1..0000000000
--- a/libs/unimrcp/libs/mrcp/message/src/mrcp_header.c
+++ /dev/null
@@ -1,265 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_header.c 2238 2014-11-12 01:50:43Z achaloyan@gmail.com $
- */
-
-#include "mrcp_header.h"
-#include "mrcp_generic_header.h"
-#include "apt_text_message.h"
-#include "apt_log.h"
-
-#define MRCP_CHANNEL_ID "Channel-Identifier"
-#define MRCP_CHANNEL_ID_LENGTH (sizeof(MRCP_CHANNEL_ID)-1)
-
-
-/** Allocate MRCP message-header data */
-MRCP_DECLARE(apt_bool_t) mrcp_message_header_data_alloc(
- mrcp_message_header_t *header,
- const mrcp_header_vtable_t *generic_header_vtable,
- const mrcp_header_vtable_t *resource_header_vtable,
- apr_pool_t *pool)
-{
- if(!generic_header_vtable || !resource_header_vtable) {
- return FALSE;
- }
-
- header->generic_header_accessor.data = NULL;
- header->generic_header_accessor.vtable = generic_header_vtable;
-
- header->resource_header_accessor.data = NULL;
- header->resource_header_accessor.vtable = resource_header_vtable;
-
- apt_header_section_array_alloc(
- &header->header_section,
- header->generic_header_accessor.vtable->field_count +
- header->resource_header_accessor.vtable->field_count,
- pool);
-
- mrcp_header_allocate(&header->generic_header_accessor,pool);
- mrcp_header_allocate(&header->resource_header_accessor,pool);
- return TRUE;
-}
-
-MRCP_DECLARE(mrcp_message_header_t*) mrcp_message_header_create(
- const mrcp_header_vtable_t *generic_header_vtable,
- const mrcp_header_vtable_t *resource_header_vtable,
- apr_pool_t *pool)
-{
- mrcp_message_header_t *header = apr_palloc(pool,sizeof(mrcp_message_header_t));
- apt_header_section_init(&header->header_section);
- mrcp_message_header_data_alloc(header,generic_header_vtable,resource_header_vtable,pool);
- return header;
-}
-
-/** Add MRCP header field */
-MRCP_DECLARE(apt_bool_t) mrcp_header_field_add(mrcp_message_header_t *header, apt_header_field_t *header_field, apr_pool_t *pool)
-{
- apt_bool_t status = FALSE;
- if(apt_string_is_empty(&header_field->name) == FALSE) {
- /* normal header */
- if(mrcp_header_field_value_parse(&header->resource_header_accessor,header_field,pool) == TRUE) {
- header_field->id += GENERIC_HEADER_COUNT;
- }
- else if(mrcp_header_field_value_parse(&header->generic_header_accessor,header_field,pool) == TRUE) {
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Unknown MRCP header field: %s",header_field->name.buf);
- }
- status = apt_header_section_field_add(&header->header_section,header_field);
- }
- return status;
-}
-
-/** Parse MRCP header fields */
-MRCP_DECLARE(apt_bool_t) mrcp_header_fields_parse(mrcp_message_header_t *header, apr_pool_t *pool)
-{
- apt_header_field_t *header_field;
- for(header_field = APR_RING_FIRST(&header->header_section.ring);
- header_field != APR_RING_SENTINEL(&header->header_section.ring, apt_header_field_t, link);
- header_field = APR_RING_NEXT(header_field, link)) {
-
- if(mrcp_header_field_value_parse(&header->resource_header_accessor,header_field,pool) == TRUE) {
- header_field->id += GENERIC_HEADER_COUNT;
- apt_header_section_field_set(&header->header_section,header_field);
- }
- else if(mrcp_header_field_value_parse(&header->generic_header_accessor,header_field,pool) == TRUE) {
- apt_header_section_field_set(&header->header_section,header_field);
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown MRCP header field: %s",header_field->name.buf);
- }
- }
-
- return TRUE;
-}
-
-static apt_bool_t mrcp_header_accessor_value_duplicate(mrcp_message_header_t *header, apt_header_field_t *header_field,
- const mrcp_message_header_t *src_header, const apt_header_field_t *src_header_field,
- apr_pool_t *pool)
-{
- apt_bool_t status = FALSE;
- if(header_field->id < GENERIC_HEADER_COUNT) {
- status = mrcp_header_field_value_duplicate(
- &header->generic_header_accessor,
- &src_header->generic_header_accessor,
- header_field->id,
- &header_field->value,
- pool);
- }
- else {
- status = mrcp_header_field_value_duplicate(
- &header->resource_header_accessor,
- &src_header->resource_header_accessor,
- header_field->id - GENERIC_HEADER_COUNT,
- &header_field->value,
- pool);
- }
- return status;
-}
-
-/** Set (copy) MRCP header fields */
-MRCP_DECLARE(apt_bool_t) mrcp_header_fields_set(mrcp_message_header_t *header, const mrcp_message_header_t *src_header, apr_pool_t *pool)
-{
- apt_header_field_t *header_field;
- const apt_header_field_t *src_header_field;
- for(src_header_field = APR_RING_FIRST(&src_header->header_section.ring);
- src_header_field != APR_RING_SENTINEL(&src_header->header_section.ring, apt_header_field_t, link);
- src_header_field = APR_RING_NEXT(src_header_field, link)) {
-
- header_field = apt_header_section_field_get(&header->header_section,src_header_field->id);
- if(header_field) {
- /* this header field has already been set, just copy its value */
- apt_string_copy(&header_field->value,&src_header_field->value,pool);
- }
- else {
- /* copy the entire header field and add it to the header section */
- header_field = apt_header_field_copy(src_header_field,pool);
- apt_header_section_field_add(&header->header_section,header_field);
- }
-
- mrcp_header_accessor_value_duplicate(header,header_field,src_header,src_header_field,pool);
- }
-
- return TRUE;
-}
-
-/** Get (copy) MRCP header fields */
-MRCP_DECLARE(apt_bool_t) mrcp_header_fields_get(mrcp_message_header_t *header, const mrcp_message_header_t *src_header, const mrcp_message_header_t *mask_header, apr_pool_t *pool)
-{
- apt_header_field_t *header_field;
- const apt_header_field_t *src_header_field;
- const apt_header_field_t *mask_header_field;
- for(mask_header_field = APR_RING_FIRST(&mask_header->header_section.ring);
- mask_header_field != APR_RING_SENTINEL(&mask_header->header_section.ring, apt_header_field_t, link);
- mask_header_field = APR_RING_NEXT(mask_header_field, link)) {
-
- header_field = apt_header_section_field_get(&header->header_section,mask_header_field->id);
- if(header_field) {
- /* this header field has already been set, skip to the next one */
- continue;
- }
-
- src_header_field = apt_header_section_field_get(&src_header->header_section,mask_header_field->id);
- if(src_header_field) {
- /* copy the entire header field */
- header_field = apt_header_field_copy(src_header_field,pool);
- mrcp_header_accessor_value_duplicate(header,header_field,src_header,src_header_field,pool);
- }
- else {
- /* copy only the name of the header field */
- header_field = apt_header_field_copy(mask_header_field,pool);
- }
- /* add the header field to the header section */
- apt_header_section_field_add(&header->header_section,header_field);
- }
-
- return TRUE;
-}
-
-/** Inherit (copy) MRCP header fields */
-MRCP_DECLARE(apt_bool_t) mrcp_header_fields_inherit(mrcp_message_header_t *header, const mrcp_message_header_t *src_header, apr_pool_t *pool)
-{
- apt_header_field_t *header_field;
- const apt_header_field_t *src_header_field;
- for(src_header_field = APR_RING_FIRST(&src_header->header_section.ring);
- src_header_field != APR_RING_SENTINEL(&src_header->header_section.ring, apt_header_field_t, link);
- src_header_field = APR_RING_NEXT(src_header_field, link)) {
-
- header_field = apt_header_section_field_get(&header->header_section,src_header_field->id);
- if(header_field) {
- /* this header field has already been set, skip to the next one */
- continue;
- }
-
- /* copy the entire header field and add it to the header section */
- header_field = apt_header_field_copy(src_header_field,pool);
- mrcp_header_accessor_value_duplicate(header,header_field,src_header,src_header_field,pool);
- apt_header_section_field_add(&header->header_section,header_field);
- }
- return TRUE;
-}
-
-
-/** Initialize MRCP channel-identifier */
-MRCP_DECLARE(void) mrcp_channel_id_init(mrcp_channel_id *channel_id)
-{
- apt_string_reset(&channel_id->session_id);
- apt_string_reset(&channel_id->resource_name);
-}
-
-/** Parse MRCP channel-identifier */
-MRCP_DECLARE(apt_bool_t) mrcp_channel_id_parse(mrcp_channel_id *channel_id, mrcp_message_header_t *header, apr_pool_t *pool)
-{
- apt_header_field_t *header_field;
- for(header_field = APR_RING_FIRST(&header->header_section.ring);
- header_field != APR_RING_SENTINEL(&header->header_section.ring, apt_header_field_t, link);
- header_field = APR_RING_NEXT(header_field, link)) {
-
- if(header_field->value.length && strncasecmp(header_field->name.buf,MRCP_CHANNEL_ID,MRCP_CHANNEL_ID_LENGTH) == 0) {
- apt_id_resource_parse(&header_field->value,'@',&channel_id->session_id,&channel_id->resource_name,pool);
- apt_header_section_field_remove(&header->header_section,header_field);
- return TRUE;
- }
- }
- return FALSE;
-}
-
-/** Generate MRCP channel-identifier */
-MRCP_DECLARE(apt_bool_t) mrcp_channel_id_generate(mrcp_channel_id *channel_id, apt_text_stream_t *stream)
-{
- apt_str_t *str;
- char *pos = stream->pos;
- if(pos + MRCP_CHANNEL_ID_LENGTH + 2 + channel_id->session_id.length + 1 +
- channel_id->resource_name.length >= stream->end) {
- return FALSE;
- }
- memcpy(pos,MRCP_CHANNEL_ID,MRCP_CHANNEL_ID_LENGTH);
- pos += MRCP_CHANNEL_ID_LENGTH;
- *pos++ = ':';
- *pos++ = APT_TOKEN_SP;
-
- str = &channel_id->session_id;
- memcpy(pos,str->buf,str->length);
- pos += str->length;
- *pos++ = '@';
-
- str = &channel_id->resource_name;
- memcpy(pos,str->buf,str->length);
- pos += str->length;
-
- stream->pos = pos;
- return apt_text_eol_insert(stream);
-}
diff --git a/libs/unimrcp/libs/mrcp/message/src/mrcp_header_accessor.c b/libs/unimrcp/libs/mrcp/message/src/mrcp_header_accessor.c
deleted file mode 100644
index ffc113e457..0000000000
--- a/libs/unimrcp/libs/mrcp/message/src/mrcp_header_accessor.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_header_accessor.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include "mrcp_header_accessor.h"
-
-
-/** Parse header field value */
-MRCP_DECLARE(apt_bool_t) mrcp_header_field_value_parse(mrcp_header_accessor_t *accessor, apt_header_field_t *header_field, apr_pool_t *pool)
-{
- apr_size_t id;
- if(!accessor->vtable) {
- return FALSE;
- }
-
- id = apt_string_table_id_find(accessor->vtable->field_table,accessor->vtable->field_count,&header_field->name);
- if(id >= accessor->vtable->field_count) {
- return FALSE;
- }
- header_field->id = id;
-
- if(header_field->value.length) {
- if(accessor->vtable->parse_field(accessor,header_field->id,&header_field->value,pool) == FALSE) {
- return FALSE;
- }
- }
-
- return TRUE;
-}
-
-/** Generate header field value */
-MRCP_DECLARE(apt_header_field_t*) mrcp_header_field_value_generate(const mrcp_header_accessor_t *accessor, apr_size_t id, apt_bool_t empty_value, apr_pool_t *pool)
-{
- apt_header_field_t *header_field;
- const apt_str_t *name;
-
- if(!accessor->vtable) {
- return NULL;
- }
-
- header_field = apt_header_field_alloc(pool);
- name = apt_string_table_str_get(accessor->vtable->field_table,accessor->vtable->field_count,id);
- if(name) {
- header_field->name = *name;
- }
-
- if(empty_value == FALSE) {
- if(accessor->vtable->generate_field(accessor,id,&header_field->value,pool) == FALSE) {
- return NULL;
- }
- }
-
- return header_field;
-}
-
-/** Duplicate header field value */
-MRCP_DECLARE(apt_bool_t) mrcp_header_field_value_duplicate(mrcp_header_accessor_t *accessor, const mrcp_header_accessor_t *src_accessor, apr_size_t id, const apt_str_t *value, apr_pool_t *pool)
-{
- if(!accessor->vtable) {
- return FALSE;
- }
-
- if(value->length) {
- if(accessor->vtable->duplicate_field(accessor,src_accessor,id,value,pool) == FALSE) {
- return FALSE;
- }
- }
-
- return TRUE;
-}
diff --git a/libs/unimrcp/libs/mrcp/message/src/mrcp_message.c b/libs/unimrcp/libs/mrcp/message/src/mrcp_message.c
deleted file mode 100644
index e12aac85b6..0000000000
--- a/libs/unimrcp/libs/mrcp/message/src/mrcp_message.c
+++ /dev/null
@@ -1,259 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_message.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include "mrcp_message.h"
-#include "mrcp_generic_header.h"
-#include "mrcp_resource.h"
-#include "apt_text_message.h"
-#include "apt_log.h"
-
-/** Associate MRCP resource with message */
-static apt_bool_t mrcp_message_resource_set_by_id(mrcp_message_t *message, const mrcp_resource_t *resource)
-{
- if(!resource) {
- return FALSE;
- }
- message->resource = resource;
- message->channel_id.resource_name = resource->name;
- mrcp_message_header_data_alloc(
- &message->header,
- mrcp_generic_header_vtable_get(message->start_line.version),
- resource->get_resource_header_vtable(message->start_line.version),
- message->pool);
-
- /* associate method_name and method_id */
- if(message->start_line.message_type == MRCP_MESSAGE_TYPE_REQUEST) {
- const apt_str_t *name = apt_string_table_str_get(
- resource->get_method_str_table(message->start_line.version),
- resource->method_count,
- message->start_line.method_id);
- if(!name) {
- return FALSE;
- }
- message->start_line.method_name = *name;
- }
- else if(message->start_line.message_type == MRCP_MESSAGE_TYPE_EVENT) {
- const apt_str_t *name = apt_string_table_str_get(
- resource->get_event_str_table(message->start_line.version),
- resource->event_count,
- message->start_line.method_id);
- if(!name) {
- return FALSE;
- }
- message->start_line.method_name = *name;
- }
-
- return TRUE;
-}
-
-/** Associate MRCP resource specific data by resource name */
-MRCP_DECLARE(apt_bool_t) mrcp_message_resource_set(mrcp_message_t *message, const mrcp_resource_t *resource)
-{
- if(!resource) {
- return FALSE;
- }
- message->resource = resource;
- mrcp_message_header_data_alloc(
- &message->header,
- mrcp_generic_header_vtable_get(message->start_line.version),
- resource->get_resource_header_vtable(message->start_line.version),
- message->pool);
-
- /* associate method_name and method_id */
- if(message->start_line.message_type == MRCP_MESSAGE_TYPE_REQUEST) {
- message->start_line.method_id = apt_string_table_id_find(
- resource->get_method_str_table(message->start_line.version),
- resource->method_count,
- &message->start_line.method_name);
- if(message->start_line.method_id >= resource->method_count) {
- return FALSE;
- }
- }
- else if(message->start_line.message_type == MRCP_MESSAGE_TYPE_EVENT) {
- message->start_line.method_id = apt_string_table_id_find(
- resource->get_event_str_table(message->start_line.version),
- resource->event_count,
- &message->start_line.method_name);
- if(message->start_line.method_id >= resource->event_count) {
- return FALSE;
- }
- }
-
- return TRUE;
-}
-
-/** Create an MRCP message */
-MRCP_DECLARE(mrcp_message_t*) mrcp_message_create(apr_pool_t *pool)
-{
- mrcp_message_t *message = apr_palloc(pool,sizeof(mrcp_message_t));
- mrcp_start_line_init(&message->start_line);
- mrcp_channel_id_init(&message->channel_id);
- mrcp_message_header_init(&message->header);
- apt_string_reset(&message->body);
- message->resource = NULL;
- message->pool = pool;
- return message;
-}
-
-/** Create an MRCP request message */
-MRCP_DECLARE(mrcp_message_t*) mrcp_request_create(const mrcp_resource_t *resource, mrcp_version_e version, mrcp_method_id method_id, apr_pool_t *pool)
-{
- mrcp_message_t *request_message = mrcp_message_create(pool);
- request_message->start_line.message_type = MRCP_MESSAGE_TYPE_REQUEST;
- request_message->start_line.version = version;
- request_message->start_line.method_id = method_id;
- mrcp_message_resource_set_by_id(request_message,resource);
- return request_message;
-}
-
-/** Create an MRCP response message */
-MRCP_DECLARE(mrcp_message_t*) mrcp_response_create(const mrcp_message_t *request_message, apr_pool_t *pool)
-{
- mrcp_message_t *response_message = mrcp_message_create(pool);
- response_message->start_line.message_type = MRCP_MESSAGE_TYPE_RESPONSE;
- response_message->start_line.request_state = MRCP_REQUEST_STATE_COMPLETE;
- response_message->start_line.status_code = MRCP_STATUS_CODE_SUCCESS;
- if(request_message) {
- response_message->channel_id = request_message->channel_id;
- response_message->start_line.request_id = request_message->start_line.request_id;
- response_message->start_line.version = request_message->start_line.version;
- response_message->start_line.method_id = request_message->start_line.method_id;
- response_message->start_line.method_name = request_message->start_line.method_name;
- mrcp_message_resource_set_by_id(response_message,request_message->resource);
- }
- return response_message;
-}
-
-/** Create an MRCP event message */
-MRCP_DECLARE(mrcp_message_t*) mrcp_event_create(const mrcp_message_t *request_message, mrcp_method_id event_id, apr_pool_t *pool)
-{
- mrcp_message_t *event_message = mrcp_message_create(pool);
- event_message->start_line.message_type = MRCP_MESSAGE_TYPE_EVENT;
- event_message->start_line.method_id = event_id;
- if(request_message) {
- event_message->channel_id = request_message->channel_id;
- event_message->start_line.request_id = request_message->start_line.request_id;
- event_message->start_line.version = request_message->start_line.version;
- mrcp_message_resource_set_by_id(event_message,request_message->resource);
- }
- return event_message;
-}
-
-/** Destroy MRCP message */
-MRCP_DECLARE(void) mrcp_message_destroy(mrcp_message_t *message)
-{
- apt_string_reset(&message->body);
- mrcp_message_header_destroy(&message->header);
-}
-
-/** Validate MRCP message */
-MRCP_DECLARE(apt_bool_t) mrcp_message_validate(mrcp_message_t *message)
-{
- if(message->body.length) {
- /* content length must be specified */
- mrcp_generic_header_t *generic_header = mrcp_generic_header_prepare(message);
- if(!generic_header) {
- return FALSE;
- }
- if(mrcp_generic_header_property_check(message,GENERIC_HEADER_CONTENT_LENGTH) != TRUE ||
- !generic_header->content_length) {
- generic_header->content_length = message->body.length;
- mrcp_generic_header_property_add(message,GENERIC_HEADER_CONTENT_LENGTH);
- }
- }
-
- return TRUE;
-}
-
-/** Add MRCP generic header field by specified property (numeric identifier) */
-MRCP_DECLARE(apt_bool_t) mrcp_generic_header_property_add(mrcp_message_t *message, apr_size_t id)
-{
- apt_header_field_t *header_field = mrcp_header_field_value_generate(
- &message->header.generic_header_accessor,
- id,
- FALSE,
- message->pool);
- if(!header_field) {
- return FALSE;
- }
- header_field->id = id;
- return apt_header_section_field_add(&message->header.header_section,header_field);
-}
-
-/** Add only the name of MRCP generic header field specified by property (numeric identifier) */
-MRCP_DECLARE(apt_bool_t) mrcp_generic_header_name_property_add(mrcp_message_t *message, apr_size_t id)
-{
- apt_header_field_t *header_field = mrcp_header_field_value_generate(
- &message->header.generic_header_accessor,
- id,
- TRUE,
- message->pool);
- if(!header_field) {
- return FALSE;
- }
- header_field->id = id;
- return apt_header_section_field_add(&message->header.header_section,header_field);
-}
-
-/** Add MRCP resource header field by specified property (numeric identifier) */
-MRCP_DECLARE(apt_bool_t) mrcp_resource_header_property_add(mrcp_message_t *message, apr_size_t id)
-{
- apt_header_field_t *header_field = mrcp_header_field_value_generate(
- &message->header.resource_header_accessor,
- id,
- FALSE,
- message->pool);
- if(!header_field) {
- return FALSE;
- }
- header_field->id = id + GENERIC_HEADER_COUNT;
- return apt_header_section_field_add(&message->header.header_section,header_field);
-}
-
-/** Add only the name of MRCP resource header field specified by property (numeric identifier) */
-MRCP_DECLARE(apt_bool_t) mrcp_resource_header_name_property_add(mrcp_message_t *message, apr_size_t id)
-{
- apt_header_field_t *header_field = mrcp_header_field_value_generate(
- &message->header.resource_header_accessor,
- id,
- TRUE,
- message->pool);
- if(!header_field) {
- return FALSE;
- }
- header_field->id = id + GENERIC_HEADER_COUNT;
- return apt_header_section_field_add(&message->header.header_section,header_field);
-}
-
-/** Get the next MRCP header field */
-MRCP_DECLARE(apt_header_field_t*) mrcp_message_next_header_field_get(const mrcp_message_t *message, apt_header_field_t *header_field)
-{
- const apt_header_section_t *header_section = &message->header.header_section;
- if(header_field) {
- apt_header_field_t *next = APR_RING_NEXT(header_field,link);
- if(next == APR_RING_SENTINEL(&header_section->ring,apt_header_field_t,link)) {
- return NULL;
- }
- return next;
- }
-
- if(APR_RING_EMPTY(&header_section->ring,apt_header_field_t,link)) {
- return NULL;
- }
- return APR_RING_FIRST(&header_section->ring);
-}
diff --git a/libs/unimrcp/libs/mrcp/message/src/mrcp_start_line.c b/libs/unimrcp/libs/mrcp/message/src/mrcp_start_line.c
deleted file mode 100644
index be20150d1d..0000000000
--- a/libs/unimrcp/libs/mrcp/message/src/mrcp_start_line.c
+++ /dev/null
@@ -1,452 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_start_line.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include
-#include
-#include "mrcp_start_line.h"
-#include "apt_string_table.h"
-#include "apt_log.h"
-
-/** Protocol name used in version string */
-#define MRCP_NAME "MRCP"
-#define MRCP_NAME_LENGTH (sizeof(MRCP_NAME)-1)
-
-/** Separators used in MRCP version string parse/generate */
-#define MRCP_NAME_VERSION_SEPARATOR '/'
-#define MRCP_VERSION_MAJOR_MINOR_SEPARATOR '.'
-
-/** Max number of digits message length consists of */
-#define MAX_DIGIT_COUNT 6
-
-
-/** String table of MRCP request-states (mrcp_request_state_t) */
-static const apt_str_table_item_t mrcp_request_state_string_table[] = {
- {{"COMPLETE", 8},0},
- {{"IN-PROGRESS",11},0},
- {{"PENDING", 7},0}
-};
-
-
-/** Parse MRCP version */
-static mrcp_version_e mrcp_version_parse(const apt_str_t *field)
-{
- mrcp_version_e version = MRCP_VERSION_UNKNOWN;
- const char *pos;
- if(field->length <= MRCP_NAME_LENGTH || strncasecmp(field->buf,MRCP_NAME,MRCP_NAME_LENGTH) != 0) {
- /* unexpected protocol name */
- return version;
- }
-
- pos = field->buf + MRCP_NAME_LENGTH;
- if(*pos == MRCP_NAME_VERSION_SEPARATOR) {
- pos++;
- switch(*pos) {
- case '1': version = MRCP_VERSION_1; break;
- case '2': version = MRCP_VERSION_2; break;
- default: ;
- }
- }
- return version;
-}
-
-/** Generate MRCP version */
-static apt_bool_t mrcp_version_generate(mrcp_version_e version, apt_text_stream_t *stream)
-{
- if(stream->pos + MRCP_NAME_LENGTH + 1 >= stream->end) {
- return FALSE;
- }
- memcpy(stream->pos,MRCP_NAME,MRCP_NAME_LENGTH);
- stream->pos += MRCP_NAME_LENGTH;
- *stream->pos++ = MRCP_NAME_VERSION_SEPARATOR;
-
- if(apt_text_size_value_insert(stream,version) == FALSE) {
- return FALSE;
- }
-
- if(stream->pos + 2 >= stream->end) {
- return FALSE;
- }
- *stream->pos++ = MRCP_VERSION_MAJOR_MINOR_SEPARATOR;
- *stream->pos++ = '0';
- return TRUE;
-}
-
-/** Parse MRCP request-state used in MRCP response and event */
-static APR_INLINE mrcp_request_state_e mrcp_request_state_parse(const apt_str_t *request_state_str)
-{
- return apt_string_table_id_find(mrcp_request_state_string_table,MRCP_REQUEST_STATE_COUNT,request_state_str);
-}
-
-/** Generate MRCP request-state used in MRCP response and event */
-static apt_bool_t mrcp_request_state_generate(mrcp_request_state_e request_state, apt_text_stream_t *stream)
-{
- const apt_str_t *name;
- name = apt_string_table_str_get(mrcp_request_state_string_table,MRCP_REQUEST_STATE_COUNT,request_state);
- if(request_state < MRCP_REQUEST_STATE_COUNT) {
- memcpy(stream->pos,name->buf,name->length);
- stream->pos += name->length;
- }
- return TRUE;
-}
-
-
-/** Parse MRCP status-code */
-static APR_INLINE mrcp_status_code_e mrcp_status_code_parse(const apt_str_t *field)
-{
- return apt_size_value_parse(field);
-}
-
-/** Generate MRCP status-code */
-static APR_INLINE size_t mrcp_status_code_generate(mrcp_status_code_e status_code, apt_text_stream_t *stream)
-{
- return apt_text_size_value_insert(stream,status_code);
-}
-
-
-/** Parse MRCP request-line */
-static apt_bool_t mrcp_request_line_parse(mrcp_start_line_t *start_line, apt_text_stream_t *stream)
-{
- apt_str_t field;
- if(apt_text_field_read(stream,APT_TOKEN_SP,TRUE,&field) == FALSE) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot parse request-id in request-line");
- return FALSE;
- }
- start_line->request_id = mrcp_request_id_parse(&field);
-
- if(apt_text_field_read(stream,APT_TOKEN_SP,TRUE,&field) == FALSE) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot parse mrcp-version in request-line");
- return FALSE;
- }
-
- start_line->request_state = mrcp_request_state_parse(&field);
- if(start_line->request_state == MRCP_REQUEST_STATE_UNKNOWN) {
- /* request-line */
- start_line->message_type = MRCP_MESSAGE_TYPE_REQUEST;
- }
- else {
- /* event line */
- start_line->message_type = MRCP_MESSAGE_TYPE_EVENT;
-
- if(apt_text_field_read(stream,APT_TOKEN_SP,TRUE,&field) == FALSE) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot parse mrcp-version in request-line");
- return FALSE;
- }
- }
-
- start_line->version = mrcp_version_parse(&field);
- if(start_line->version == MRCP_VERSION_UNKNOWN) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown mrcp-version");
- return FALSE;
- }
- return TRUE;
-}
-
-/** Generate MRCP request-line */
-static apt_bool_t mrcp_request_line_generate(mrcp_start_line_t *start_line, apt_text_stream_t *stream)
-{
- memcpy(stream->pos,start_line->method_name.buf,start_line->method_name.length);
- stream->pos += start_line->method_name.length;
- *stream->pos++ = APT_TOKEN_SP;
-
- mrcp_request_id_generate(start_line->request_id,stream);
- *stream->pos++ = APT_TOKEN_SP;
-
- if(start_line->message_type == MRCP_MESSAGE_TYPE_REQUEST) {
- if(start_line->status_code != MRCP_STATUS_CODE_UNKNOWN) {
- mrcp_status_code_generate(start_line->status_code,stream);
- *stream->pos++ = APT_TOKEN_SP;
- }
- }
- else if(start_line->message_type == MRCP_MESSAGE_TYPE_EVENT) {
- mrcp_request_state_generate(start_line->request_state,stream);
- *stream->pos++ = APT_TOKEN_SP;
- }
-
- mrcp_version_generate(start_line->version,stream);
- return TRUE;
-}
-
-/** Parse MRCP response-line */
-static apt_bool_t mrcp_response_line_parse(mrcp_start_line_t *start_line, apt_text_stream_t *stream)
-{
- apt_str_t field;
- start_line->length = 0;
- if(start_line->version == MRCP_VERSION_2) {
- if(apt_text_field_read(stream,APT_TOKEN_SP,TRUE,&field) == FALSE) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot parse message-length in response-line");
- return FALSE;
- }
- start_line->length = apt_size_value_parse(&field);
- }
-
- if(apt_text_field_read(stream,APT_TOKEN_SP,TRUE,&field) == FALSE) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot parse request-id in response-line");
- return FALSE;
- }
- start_line->request_id = mrcp_request_id_parse(&field);
-
- if(apt_text_field_read(stream,APT_TOKEN_SP,TRUE,&field) == FALSE) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot parse status-code in response-line");
- return FALSE;
- }
- start_line->status_code = mrcp_status_code_parse(&field);
-
- if(apt_text_field_read(stream,APT_TOKEN_SP,TRUE,&field) == FALSE) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot parse request-state in response-line");
- return FALSE;
- }
- start_line->request_state = mrcp_request_state_parse(&field);
- return TRUE;
-}
-
-/** Generate MRCP response-line */
-static apt_bool_t mrcp_response_line_generate(mrcp_start_line_t *start_line, apt_text_stream_t *stream)
-{
- mrcp_version_generate(start_line->version,stream);
- *stream->pos++ = APT_TOKEN_SP;
-
- mrcp_request_id_generate(start_line->request_id,stream);
- *stream->pos++ = APT_TOKEN_SP;
-
- mrcp_status_code_generate(start_line->status_code,stream);
- *stream->pos++ = APT_TOKEN_SP;
-
- mrcp_request_state_generate(start_line->request_state,stream);
- return TRUE;
-}
-
-/** Parse MRCP v2 start-line */
-static apt_bool_t mrcp_v2_start_line_parse(mrcp_start_line_t *start_line, apt_text_stream_t *stream, apr_pool_t *pool)
-{
- apt_str_t field;
- if(apt_text_field_read(stream,APT_TOKEN_SP,TRUE,&field) == FALSE) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot parse message-length in v2 start-line");
- return FALSE;
- }
- start_line->length = apt_size_value_parse(&field);
-
- if(apt_text_field_read(stream,APT_TOKEN_SP,TRUE,&field) == FALSE) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot parse request-id in v2 start-line");
- return FALSE;
- }
- start_line->request_id = mrcp_request_id_parse(&field);
- if(start_line->request_id == 0 && *field.buf != '0') {
- /* parsing MRCP v2 request or event */
- start_line->message_type = MRCP_MESSAGE_TYPE_REQUEST;
- apt_string_copy(&start_line->method_name,&field,pool);
-
- if(apt_text_field_read(stream,APT_TOKEN_SP,TRUE,&field) == FALSE) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot parse request-id in v2 start-line");
- return FALSE;
- }
- start_line->request_id = mrcp_request_id_parse(&field);
-
- if(apt_text_field_read(stream,APT_TOKEN_SP,TRUE,&field) == TRUE) {
- /* parsing MRCP v2 event */
- start_line->request_state = mrcp_request_state_parse(&field);
- start_line->message_type = MRCP_MESSAGE_TYPE_EVENT;
- }
- }
- else {
- /* parsing MRCP v2 response */
- start_line->message_type = MRCP_MESSAGE_TYPE_RESPONSE;
-
- if(apt_text_field_read(stream,APT_TOKEN_SP,TRUE,&field) == FALSE) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot parse status-code in v2 start-line");
- return FALSE;
- }
- start_line->status_code = mrcp_status_code_parse(&field);
-
- if(apt_text_field_read(stream,APT_TOKEN_SP,TRUE,&field) == FALSE) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot parse request-state in v2 start-line");
- return FALSE;
- }
- start_line->request_state = mrcp_request_state_parse(&field);
- }
-
- return TRUE;
-}
-
-/** Generate MRCP v2 start-line */
-static apt_bool_t mrcp_v2_start_line_generate(mrcp_start_line_t *start_line, apt_text_stream_t *stream)
-{
- char *pos = stream->pos;
- mrcp_version_generate(start_line->version,stream);
- *stream->pos++ = APT_TOKEN_SP;
-
- start_line->length = stream->pos - pos; /* length is temporary used to store offset */
- /* reserving MAX_DIGIT_COUNT space for start_line->length */
- memset(stream->pos,APT_TOKEN_SP,MAX_DIGIT_COUNT+1);
- stream->pos += MAX_DIGIT_COUNT+1;
-
- if(start_line->message_type == MRCP_MESSAGE_TYPE_RESPONSE) {
- mrcp_request_id_generate(start_line->request_id,stream);
- *stream->pos++ = APT_TOKEN_SP;
-
- mrcp_status_code_generate(start_line->status_code,stream);
- *stream->pos++ = APT_TOKEN_SP;
-
- mrcp_request_state_generate(start_line->request_state,stream);
- }
- else {
- memcpy(stream->pos,start_line->method_name.buf,start_line->method_name.length);
- stream->pos += start_line->method_name.length;
- *stream->pos++ = APT_TOKEN_SP;
-
- mrcp_request_id_generate(start_line->request_id,stream);
- if(start_line->message_type == MRCP_MESSAGE_TYPE_EVENT) {
- *stream->pos++ = APT_TOKEN_SP;
- mrcp_request_state_generate(start_line->request_state,stream);
- }
- }
- return TRUE;
-}
-
-/** Initialize MRCP start-line */
-MRCP_DECLARE(void) mrcp_start_line_init(mrcp_start_line_t *start_line)
-{
- start_line->message_type = MRCP_MESSAGE_TYPE_UNKNOWN;
- start_line->version = MRCP_VERSION_UNKNOWN;
- start_line->length = 0;
- start_line->request_id = 0;
- apt_string_reset(&start_line->method_name);
- start_line->status_code = MRCP_STATUS_CODE_UNKNOWN;
- start_line->request_state = MRCP_REQUEST_STATE_UNKNOWN;
-}
-
-/** Parse MRCP start-line */
-MRCP_DECLARE(apt_bool_t) mrcp_start_line_parse(mrcp_start_line_t *start_line, apt_str_t *str, apr_pool_t *pool)
-{
- apt_text_stream_t line;
- apt_str_t field;
- apt_bool_t status = TRUE;
-
- start_line->message_type = MRCP_MESSAGE_TYPE_UNKNOWN;
- apt_text_stream_init(&line,str->buf,str->length);
- if(apt_text_field_read(&line,APT_TOKEN_SP,TRUE,&field) == FALSE) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot read the first field in start-line");
- return FALSE;
- }
-
- if(field.buf == strstr(field.buf,MRCP_NAME)) {
- start_line->version = mrcp_version_parse(&field);
-
- if(start_line->version == MRCP_VERSION_1) {
- /* parsing MRCP v1 response */
- start_line->message_type = MRCP_MESSAGE_TYPE_RESPONSE;
- status = mrcp_response_line_parse(start_line,&line);
- }
- else if(start_line->version == MRCP_VERSION_2) {
- /* parsing MRCP v2 start-line (request/response/event) */
- status = mrcp_v2_start_line_parse(start_line,&line,pool);
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown MRCP version");
- return FALSE;
- }
- }
- else {
- /* parsing MRCP v1 request or event */
- apt_string_copy(&start_line->method_name,&field,pool);
- status = mrcp_request_line_parse(start_line,&line);
- }
- return status;
-}
-
-/** Generate MRCP start-line */
-MRCP_DECLARE(apt_bool_t) mrcp_start_line_generate(mrcp_start_line_t *start_line, apt_text_stream_t *text_stream)
-{
- apt_bool_t status = FALSE;
- if(start_line->version == MRCP_VERSION_1) {
- switch(start_line->message_type) {
- case MRCP_MESSAGE_TYPE_REQUEST:
- status = mrcp_request_line_generate(start_line,text_stream);
- break;
- case MRCP_MESSAGE_TYPE_RESPONSE:
- status = mrcp_response_line_generate(start_line,text_stream);
- break;
- case MRCP_MESSAGE_TYPE_EVENT:
- status = mrcp_request_line_generate(start_line,text_stream);
- break;
- default:
- break;
- }
- }
- else if(start_line->version == MRCP_VERSION_2) {
- status = mrcp_v2_start_line_generate(start_line,text_stream);
- }
-
- if(status == FALSE) {
- return FALSE;
- }
-
- return apt_text_eol_insert(text_stream);
-}
-
-/** Finalize MRCP start-line generation */
-MRCP_DECLARE(apt_bool_t) mrcp_start_line_finalize(mrcp_start_line_t *start_line, apr_size_t content_length, apt_text_stream_t *text_stream)
-{
- apr_size_t length = text_stream->pos - text_stream->text.buf + content_length;
- if(start_line->version == MRCP_VERSION_2) {
- /* message-length includes the number of bytes that specify the message-length in the header */
- /* too comlex to generate!!! see the discussion */
- /* http://www1.ietf.org/mail-archive/web/speechsc/current/msg01734.html */
- apt_str_t field;
- field.buf = text_stream->text.buf + start_line->length; /* length is temporary used to store offset */
- length -= MAX_DIGIT_COUNT;
- if(apt_var_length_value_generate(&length,MAX_DIGIT_COUNT,&field) == FALSE) {
- return FALSE;
- }
- field.buf[field.length] = APT_TOKEN_SP;
- start_line->length += field.length;
-
- field.length = MAX_DIGIT_COUNT - field.length;
- if(field.length) {
- memmove(text_stream->text.buf+field.length,text_stream->text.buf,start_line->length);
- text_stream->text.buf += field.length;
- text_stream->text.length -= field.length;
- }
- }
-
- start_line->length = length;
- return TRUE;
-}
-
-/** Parse MRCP request-id */
-MRCP_DECLARE(mrcp_request_id) mrcp_request_id_parse(const apt_str_t *field)
-{
- if(field->buf) {
-#ifdef TOO_LONG_MRCP_REQUEST_ID
- return apr_atoi64(field->buf);
-#else
- return atol(field->buf);
-#endif
- }
- return 0;
-}
-
-/** Generate MRCP request-id */
-MRCP_DECLARE(apt_bool_t) mrcp_request_id_generate(mrcp_request_id request_id, apt_text_stream_t *stream)
-{
- int length = apr_snprintf(stream->pos, stream->end - stream->pos, "%"MRCP_REQUEST_ID_FMT, request_id);
- if(length <= 0) {
- return FALSE;
- }
- stream->pos += length;
- return TRUE;
-}
diff --git a/libs/unimrcp/libs/mrcp/mrcp.2010.vcxproj.filters b/libs/unimrcp/libs/mrcp/mrcp.2010.vcxproj.filters
deleted file mode 100644
index 119921b34b..0000000000
--- a/libs/unimrcp/libs/mrcp/mrcp.2010.vcxproj.filters
+++ /dev/null
@@ -1,133 +0,0 @@
-
-
-
-
- {93995380-89BD-4b04-88EB-625FBE52EBFB}
- h;hpp;hxx;hm;inl;inc;xsd
-
-
- {19ad4bde-c4f4-4937-9073-ca2780341d76}
-
-
- {8ec996ac-8a0a-4bf0-9b3c-535616585109}
- h;hpp;hxx;hm;inl;inc;xsd
-
-
- {5ba77874-7c17-4748-b5ba-b07b7f0a2169}
- cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
-
-
- {f30fd049-a10d-4aea-b4bb-3eb674690fdd}
-
-
- {7e71717b-6f22-4c59-ba50-7b5a15516b2f}
- h;hpp;hxx;hm;inl;inc;xsd
-
-
- {c66dbb84-ce9d-4408-b54d-4d0ec51069fb}
- cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
-
-
- {f20cfd62-4bb9-42de-bf1c-d578c8cd1a18}
-
-
- {039a4834-7ddb-40e7-9177-55d11ef1e733}
- h;hpp;hxx;hm;inl;inc;xsd
-
-
- {dc087d31-8ecf-473c-baa1-f3091e16014d}
- cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
-
-
-
-
- include
-
-
- include
-
-
- message\include
-
-
- message\include
-
-
- message\include
-
-
- message\include
-
-
- control\include
-
-
- control\include
-
-
- control\include
-
-
- control\include
-
-
- resources\include
-
-
- resources\include
-
-
- resources\include
-
-
- resources\include
-
-
- resources\include
-
-
- resources\include
-
-
-
-
- message\src
-
-
- message\src
-
-
- message\src
-
-
- message\src
-
-
- control\src
-
-
- control\src
-
-
- control\src
-
-
- resources\src
-
-
- resources\src
-
-
- resources\src
-
-
- resources\src
-
-
- resources\src
-
-
- resources\src
-
-
-
\ No newline at end of file
diff --git a/libs/unimrcp/libs/mrcp/mrcp.2017.vcxproj b/libs/unimrcp/libs/mrcp/mrcp.2017.vcxproj
deleted file mode 100644
index d2420fde7c..0000000000
--- a/libs/unimrcp/libs/mrcp/mrcp.2017.vcxproj
+++ /dev/null
@@ -1,163 +0,0 @@
-
-
-
-
- Debug
- Win32
-
-
- Debug
- x64
-
-
- Release
- Win32
-
-
- Release
- x64
-
-
-
- mrcp
- {1C320193-46A6-4B34-9C56-8AB584FC1B56}
- mrcp
- Win32Proj
-
-
-
- StaticLibrary
- Unicode
- true
- $(DefaultPlatformToolset)
-
-
- StaticLibrary
- Unicode
- $(DefaultPlatformToolset)
-
-
- StaticLibrary
- Unicode
- true
- $(DefaultPlatformToolset)
-
-
- StaticLibrary
- Unicode
- $(DefaultPlatformToolset)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <_ProjectFileVersion>10.0.30319.1
- $(PlatformName)\$(Configuration)\
- $(PlatformName)\$(Configuration)\
- $(PlatformName)\$(Configuration)\
- $(PlatformName)\$(Configuration)\
- $(PlatformName)\$(Configuration)\
- $(PlatformName)\$(Configuration)\
- $(SolutionDir)$(PlatformName)\$(Configuration)\
- $(PlatformName)\$(Configuration)\
-
-
-
- %(AdditionalIncludeDirectories)
- APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)
-
-
-
-
- X64
-
-
- %(AdditionalIncludeDirectories)
- APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)
- ProgramDatabase
-
-
-
-
- %(AdditionalIncludeDirectories)
- APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)
-
-
-
-
- X64
-
-
- %(AdditionalIncludeDirectories)
- APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {f6c55d93-b927-4483-bb69-15aef3dd2dff}
-
-
-
-
-
-
\ No newline at end of file
diff --git a/libs/unimrcp/libs/mrcp/mrcp.vcproj b/libs/unimrcp/libs/mrcp/mrcp.vcproj
deleted file mode 100644
index dc421663c7..0000000000
--- a/libs/unimrcp/libs/mrcp/mrcp.vcproj
+++ /dev/null
@@ -1,433 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/libs/unimrcp/libs/mrcp/mrcp.vcxproj b/libs/unimrcp/libs/mrcp/mrcp.vcxproj
deleted file mode 100644
index b2e453c4e8..0000000000
--- a/libs/unimrcp/libs/mrcp/mrcp.vcxproj
+++ /dev/null
@@ -1,157 +0,0 @@
-
-
-
-
- Debug
- Win32
-
-
- Debug
- x64
-
-
- Release
- Win32
-
-
- Release
- x64
-
-
-
- {1C320193-46A6-4B34-9C56-8AB584FC1B56}
- mrcp
- Win32Proj
-
-
-
- StaticLibrary
- Unicode
- true
-
-
- StaticLibrary
- Unicode
-
-
- StaticLibrary
- Unicode
- true
-
-
- StaticLibrary
- Unicode
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <_ProjectFileVersion>10.0.30319.1
- AllRules.ruleset
-
-
- AllRules.ruleset
-
-
- AllRules.ruleset
-
-
- AllRules.ruleset
-
-
-
-
-
- %(AdditionalIncludeDirectories)
-
-
-
-
- %(AdditionalIncludeDirectories)
-
-
-
-
- X64
-
-
- %(AdditionalIncludeDirectories)
- ProgramDatabase
-
-
-
-
- X64
-
-
- %(AdditionalIncludeDirectories)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/libs/unimrcp/libs/mrcp/mrcp.vcxproj.filters b/libs/unimrcp/libs/mrcp/mrcp.vcxproj.filters
deleted file mode 100644
index 300f13fdf6..0000000000
--- a/libs/unimrcp/libs/mrcp/mrcp.vcxproj.filters
+++ /dev/null
@@ -1,151 +0,0 @@
-
-
-
-
- {93995380-89BD-4b04-88EB-625FBE52EBFB}
- h;hpp;hxx;hm;inl;inc;xsd
-
-
- {235b9544-2004-49c6-96de-a5830544296e}
-
-
- {64717899-118b-46de-8646-d7312b19ce00}
- h;hpp;hxx;hm;inl;inc;xsd
-
-
- {1b656d42-e8f0-4126-85da-9bb8a470cfaa}
- cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
-
-
- {39545f85-6811-4878-af3f-26d813012ea3}
-
-
- {e165b2a9-81db-4030-9e72-7189ee45182b}
- h;hpp;hxx;hm;inl;inc;xsd
-
-
- {a4e3b1a7-762d-4fcf-83e8-f52675aab2ff}
- cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
-
-
- {35e8458d-fc25-4066-b4be-ab452a6da8a9}
-
-
- {8bbdedd2-2c1e-4474-8dbb-fcecf1f9a869}
- h;hpp;hxx;hm;inl;inc;xsd
-
-
- {1d167695-a5d2-4f87-8bd3-ea21cea5a368}
- cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
-
-
-
-
- include
-
-
- include
-
-
- message\include
-
-
- message\include
-
-
- message\include
-
-
- message\include
-
-
- message\include
-
-
- control\include
-
-
- control\include
-
-
- control\include
-
-
- control\include
-
-
- resources\include
-
-
- resources\include
-
-
- resources\include
-
-
- resources\include
-
-
- resources\include
-
-
- resources\include
-
-
- resources\include
-
-
- resources\include
-
-
-
-
- message\src
-
-
- message\src
-
-
- message\src
-
-
- message\src
-
-
- message\src
-
-
- control\src
-
-
- control\src
-
-
- control\src
-
-
- resources\src
-
-
- resources\src
-
-
- resources\src
-
-
- resources\src
-
-
- resources\src
-
-
- resources\src
-
-
- resources\src
-
-
- resources\src
-
-
-
\ No newline at end of file
diff --git a/libs/unimrcp/libs/mrcp/resources/include/mrcp_recog_header.h b/libs/unimrcp/libs/mrcp/resources/include/mrcp_recog_header.h
deleted file mode 100644
index a9f71c5a7e..0000000000
--- a/libs/unimrcp/libs/mrcp/resources/include/mrcp_recog_header.h
+++ /dev/null
@@ -1,273 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_recog_header.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MRCP_RECOG_HEADER_H
-#define MRCP_RECOG_HEADER_H
-
-/**
- * @file mrcp_recog_header.h
- * @brief MRCP Recognizer Header
- */
-
-#include "mrcp_types.h"
-#include "mrcp_header_accessor.h"
-
-APT_BEGIN_EXTERN_C
-
-/** MRCP recognizer header fields */
-typedef enum {
- RECOGNIZER_HEADER_CONFIDENCE_THRESHOLD,
- RECOGNIZER_HEADER_SENSITIVITY_LEVEL,
- RECOGNIZER_HEADER_SPEED_VS_ACCURACY,
- RECOGNIZER_HEADER_N_BEST_LIST_LENGTH,
- RECOGNIZER_HEADER_NO_INPUT_TIMEOUT,
- RECOGNIZER_HEADER_RECOGNITION_TIMEOUT,
- RECOGNIZER_HEADER_WAVEFORM_URI,
- RECOGNIZER_HEADER_COMPLETION_CAUSE,
- RECOGNIZER_HEADER_RECOGNIZER_CONTEXT_BLOCK,
- RECOGNIZER_HEADER_START_INPUT_TIMERS,
- RECOGNIZER_HEADER_SPEECH_COMPLETE_TIMEOUT,
- RECOGNIZER_HEADER_SPEECH_INCOMPLETE_TIMEOUT,
- RECOGNIZER_HEADER_DTMF_INTERDIGIT_TIMEOUT,
- RECOGNIZER_HEADER_DTMF_TERM_TIMEOUT,
- RECOGNIZER_HEADER_DTMF_TERM_CHAR,
- RECOGNIZER_HEADER_FAILED_URI,
- RECOGNIZER_HEADER_FAILED_URI_CAUSE,
- RECOGNIZER_HEADER_SAVE_WAVEFORM,
- RECOGNIZER_HEADER_NEW_AUDIO_CHANNEL,
- RECOGNIZER_HEADER_SPEECH_LANGUAGE,
-
- /** Additional header fields for MRCP v2 */
- RECOGNIZER_HEADER_INPUT_TYPE,
- RECOGNIZER_HEADER_INPUT_WAVEFORM_URI,
- RECOGNIZER_HEADER_COMPLETION_REASON,
- RECOGNIZER_HEADER_MEDIA_TYPE,
- RECOGNIZER_HEADER_VER_BUFFER_UTTERANCE,
- RECOGNIZER_HEADER_RECOGNITION_MODE,
- RECOGNIZER_HEADER_CANCEL_IF_QUEUE,
- RECOGNIZER_HEADER_HOTWORD_MAX_DURATION,
- RECOGNIZER_HEADER_HOTWORD_MIN_DURATION,
- RECOGNIZER_HEADER_INTERPRET_TEXT,
- RECOGNIZER_HEADER_DTMF_BUFFER_TIME,
- RECOGNIZER_HEADER_CLEAR_DTMF_BUFFER,
- RECOGNIZER_HEADER_EARLY_NO_MATCH,
- RECOGNIZER_HEADER_NUM_MIN_CONSISTENT_PRONUNCIATIONS,
- RECOGNIZER_HEADER_CONSISTENCY_THRESHOLD,
- RECOGNIZER_HEADER_CLASH_THRESHOLD,
- RECOGNIZER_HEADER_PERSONAL_GRAMMAR_URI,
- RECOGNIZER_HEADER_ENROLL_UTTERANCE,
- RECOGNIZER_HEADER_PHRASE_ID,
- RECOGNIZER_HEADER_PHRASE_NL,
- RECOGNIZER_HEADER_WEIGHT,
- RECOGNIZER_HEADER_SAVE_BEST_WAVEFORM,
- RECOGNIZER_HEADER_NEW_PHRASE_ID,
- RECOGNIZER_HEADER_CONFUSABLE_PHRASES_URI,
- RECOGNIZER_HEADER_ABORT_PHRASE_ENROLLMENT,
-
- RECOGNIZER_HEADER_COUNT
-} mrcp_recognizer_header_id;
-
-
-/** MRCP recognizer completion-cause */
-typedef enum {
- RECOGNIZER_COMPLETION_CAUSE_SUCCESS = 0,
- RECOGNIZER_COMPLETION_CAUSE_NO_MATCH = 1,
- RECOGNIZER_COMPLETION_CAUSE_NO_INPUT_TIMEOUT = 2,
- RECOGNIZER_COMPLETION_CAUSE_RECOGNITION_TIMEOUT = 3,
- RECOGNIZER_COMPLETION_CAUSE_GRAM_LOAD_FAILURE = 4,
- RECOGNIZER_COMPLETION_CAUSE_GRAM_COMP_FAILURE = 5,
- RECOGNIZER_COMPLETION_CAUSE_ERROR = 6,
- RECOGNIZER_COMPLETION_CAUSE_SPEECH_TOO_EARLY = 7,
- RECOGNIZER_COMPLETION_CAUSE_TOO_MUCH_SPEECH_TIMEOUT = 8,
- RECOGNIZER_COMPLETION_CAUSE_URI_FAILURE = 9,
- RECOGNIZER_COMPLETION_CAUSE_LANGUAGE_UNSUPPORTED = 10,
-
- /** Additional completion-cause for MRCP v2 */
- RECOGNIZER_COMPLETION_CAUSE_CANCELLED = 11,
- RECOGNIZER_COMPLETION_CAUSE_SEMANTICS_FAILURE = 12,
- RECOGNIZER_COMPLETION_CAUSE_PARTIAL_MATCH = 13,
- RECOGNIZER_COMPLETION_CAUSE_PARTIAL_MATCH_MAXTIME = 14,
- RECOGNIZER_COMPLETION_CAUSE_NO_MATCH_MAXTIME = 15,
- RECOGNIZER_COMPLETION_CAUSE_GRAM_DEFINITION_FAILURE = 16,
-
- RECOGNIZER_COMPLETION_CAUSE_COUNT = 17,
- RECOGNIZER_COMPLETION_CAUSE_UNKNOWN = RECOGNIZER_COMPLETION_CAUSE_COUNT
-} mrcp_recog_completion_cause_e;
-
-
-
-/** MRCP recognizer-header declaration */
-typedef struct mrcp_recog_header_t mrcp_recog_header_t;
-
-/** MRCP recognizer-header */
-struct mrcp_recog_header_t {
- /** Tells the recognizer resource what confidence level the client considers a
- successful match */
- float confidence_threshold;
- /** To filter out background noise and not mistake it for speech */
- float sensitivity_level;
- /** Tunable towards Performance or Accuracy */
- float speed_vs_accuracy;
- /** The client, by setting this header, can ask the recognition resource
- to send it more than 1 alternative */
- apr_size_t n_best_list_length;
- /** The client can use the no-input-timeout header to set this timeout */
- apr_size_t no_input_timeout;
- /** The client can use the recognition-timeout header to set this timeout */
- apr_size_t recognition_timeout;
- /** MUST be present in the RECOGNITION-COMPLETE event if the Save-Waveform
- header was set to true */
- apt_str_t waveform_uri;
- /** MUST be part of a RECOGNITION-COMPLETE, event coming from
- the recognizer resource to the client */
- mrcp_recog_completion_cause_e completion_cause;
- /** MAY be sent as part of the SET-PARAMS or GET-PARAMS request */
- apt_str_t recognizer_context_block;
- /** MAY be sent as part of the RECOGNIZE request. A value of false tells
- the recognizer to start recognition, but not to start the no-input timer yet */
- apt_bool_t start_input_timers;
- /** Specifies the length of silence required following user
- speech before the speech recognizer finalizes a result */
- apr_size_t speech_complete_timeout;
- /** Specifies the required length of silence following user
- speech after which a recognizer finalizes a result */
- apr_size_t speech_incomplete_timeout;
- /** Specifies the inter-digit timeout value to use when
- recognizing DTMF input */
- apr_size_t dtmf_interdigit_timeout;
- /** Specifies the terminating timeout to use when
- recognizing DTMF input*/
- apr_size_t dtmf_term_timeout;
- /** Specifies the terminating DTMF character for DTMF input
- recognition */
- char dtmf_term_char;
- /** When a recognizer needs to fetch or access a URI and the access fails
- the server SHOULD provide the failed URI in this header in the method response*/
- apt_str_t failed_uri;
- /** When a recognizer method needs a recognizer to fetch or access a URI
- and the access fails the server MUST provide the URI specific or
- protocol specific response code for the URI in the Failed-URI header */
- apt_str_t failed_uri_cause;
- /** Allows the client to request the recognizer resource to
- save the audio input to the recognizer */
- apt_bool_t save_waveform;
- /** MAY be specified in a RECOGNIZE request and allows the
- client to tell the server that, from this point on, further input
- audio comes from a different audio source */
- apt_bool_t new_audio_channel;
- /** Specifies the language of recognition grammar data within
- a session or request, if it is not specified within the data */
- apt_str_t speech_language;
-
- /** Additional header fields for MRCP v2 */
- /** Specifies if the input that caused a barge-in was DTMF or speech */
- apt_str_t input_type;
- /** Optional header specifies a URI pointing to audio content to be
- processed by the RECOGNIZE operation */
- apt_str_t input_waveform_uri;
- /** MAY be specified in a RECOGNITION-COMPLETE event coming from
- the recognizer resource to the client */
- apt_str_t completion_reason;
- /** Tells the server resource the Media Type in which to store captured
- audio such as the one captured and returned by the Waveform-URI header */
- apt_str_t media_type;
- /** Lets the client request the server to buffer the
- utterance associated with this recognition request into a buffer
- available to a co-resident verification resource */
- apt_bool_t ver_buffer_utterance;
- /** Specifies what mode the RECOGNIZE method will operate in */
- apt_str_t recognition_mode;
- /** Specifies what will happen if the client attempts to
- invoke another RECOGNIZE method when this RECOGNIZE request is
- already in progress for the resource*/
- apt_bool_t cancel_if_queue;
- /** Specifies the maximum length of an utterance (in seconds) that will
- be considered for Hotword recognition */
- apr_size_t hotword_max_duration;
- /** Specifies the minimum length of an utterance (in seconds) that will
- be considered for Hotword recognition */
- apr_size_t hotword_min_duration;
- /** Provides a pointer to the text for which a natural language interpretation is desired */
- apt_str_t interpret_text;
- /** MAY be specified in a GET-PARAMS or SET-PARAMS method and
- is used to specify the size in time, in milliseconds, of the
- typeahead buffer for the recognizer */
- apr_size_t dtmf_buffer_time;
- /** MAY be specified in a RECOGNIZE method and is used to
- tell the recognizer to clear the DTMF type-ahead buffer before
- starting the recognize */
- apt_bool_t clear_dtmf_buffer;
- /** MAY be specified in a RECOGNIZE method and is used to
- tell the recognizer that it MUST not wait for the end of speech
- before processing the collected speech to match active grammars */
- apt_bool_t early_no_match;
- /** MAY be specified in a START-PHRASE-ENROLLMENT, "SET-PARAMS", or
- "GET-PARAMS" method and is used to specify the minimum number of
- consistent pronunciations that must be obtained to voice enroll a new phrase */
- apr_size_t num_min_consistent_pronunciations;
- /** MAY be sent as part of the START-PHRASE-ENROLLMENT,"SET-PARAMS", or
- "GET-PARAMS" method and is used during voice-enrollment to specify how similar
- to a previously enrolled pronunciation of the same phrase an utterance needs
- to be in order to be considered "consistent" */
- float consistency_threshold;
- /** MAY be sent as part of the START-PHRASE-ENROLLMENT, SET-PARAMS, or
- "GET-PARAMS" method and is used during voice-enrollment to specify
- how similar the pronunciations of two different phrases can be
- before they are considered to be clashing */
- float clash_threshold;
- /** Specifies the speaker-trained grammar to be used or
- referenced during enrollment operations */
- apt_str_t personal_grammar_uri;
- /** MAY be specified in the RECOGNIZE method. If this header
- is set to "true" and an Enrollment is active, the RECOGNIZE command
- MUST add the collected utterance to the personal grammar that is
- being enrolled */
- apt_bool_t enroll_utterance;
- /** Identifies a phrase in an existing personal grammar for which
- enrollment is desired. It is also returned to the client in the
- RECOGNIZE complete event */
- apt_str_t phrase_id;
- /** Specifies the interpreted text to be returned when the
- phrase is recognized */
- apt_str_t phrase_nl;
- /** Represents the occurrence likelihood of a phrase in an enrolled grammar */
- float weight;
- /** Allows the client to request the recognizer resource to
- save the audio stream for the best repetition of the phrase that was
- used during the enrollment session */
- apt_bool_t save_best_waveform;
- /** Replaces the id used to identify the phrase in a personal grammar */
- apt_str_t new_phrase_id;
- /** Specifies a grammar that defines invalid phrases for enrollment */
- apt_str_t confusable_phrases_uri;
- /** Can optionally be specified in the END-PHRASE-ENROLLMENT
- method to abort the phrase enrollment, rather than committing the
- phrase to the personal grammar */
- apt_bool_t abort_phrase_enrollment;
-};
-
-
-/** Get recognizer header vtable */
-const mrcp_header_vtable_t* mrcp_recog_header_vtable_get(mrcp_version_e version);
-
-/** Get recognizer completion cause string */
-MRCP_DECLARE(const apt_str_t*) mrcp_recog_completion_cause_get(mrcp_recog_completion_cause_e completion_cause, mrcp_version_e version);
-
-APT_END_EXTERN_C
-
-#endif /* MRCP_RECOG_HEADER_H */
diff --git a/libs/unimrcp/libs/mrcp/resources/include/mrcp_recog_resource.h b/libs/unimrcp/libs/mrcp/resources/include/mrcp_recog_resource.h
deleted file mode 100644
index 93e2f1ba9e..0000000000
--- a/libs/unimrcp/libs/mrcp/resources/include/mrcp_recog_resource.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_recog_resource.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MRCP_RECOG_RESOURCE_H
-#define MRCP_RECOG_RESOURCE_H
-
-/**
- * @file mrcp_recog_resource.h
- * @brief MRCP Recognizer Resource
- */
-
-#include "mrcp_types.h"
-
-APT_BEGIN_EXTERN_C
-
-/** MRCP recognizer methods */
-typedef enum {
- RECOGNIZER_SET_PARAMS,
- RECOGNIZER_GET_PARAMS,
- RECOGNIZER_DEFINE_GRAMMAR,
- RECOGNIZER_RECOGNIZE,
- RECOGNIZER_INTERPRET,
- RECOGNIZER_GET_RESULT,
- RECOGNIZER_START_INPUT_TIMERS,
- RECOGNIZER_STOP,
- RECOGNIZER_START_PHRASE_ENROLLMENT,
- RECOGNIZER_ENROLLMENT_ROLLBACK,
- RECOGNIZER_END_PHRASE_ENROLLMENT,
- RECOGNIZER_MODIFY_PHRASE,
- RECOGNIZER_DELETE_PHRASE,
-
- RECOGNIZER_METHOD_COUNT
-} mrcp_recognizer_method_id;
-
-/** MRCP recognizer events */
-typedef enum {
- RECOGNIZER_START_OF_INPUT,
- RECOGNIZER_RECOGNITION_COMPLETE,
- RECOGNIZER_INTERPRETATION_COMPLETE,
-
- RECOGNIZER_EVENT_COUNT
-} mrcp_recognizer_event_id;
-
-/** Create MRCP recognizer resource */
-MRCP_DECLARE(mrcp_resource_t*) mrcp_recog_resource_create(apr_pool_t *pool);
-
-APT_END_EXTERN_C
-
-#endif /* MRCP_RECOG_RESOURCE_H */
diff --git a/libs/unimrcp/libs/mrcp/resources/include/mrcp_recorder_header.h b/libs/unimrcp/libs/mrcp/resources/include/mrcp_recorder_header.h
deleted file mode 100644
index 77569a00b0..0000000000
--- a/libs/unimrcp/libs/mrcp/resources/include/mrcp_recorder_header.h
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_recorder_header.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MRCP_RECORDER_HEADER_H
-#define MRCP_RECORDER_HEADER_H
-
-/**
- * @file mrcp_recorder_header.h
- * @brief MRCP Recorder Header
- */
-
-#include "mrcp_types.h"
-#include "mrcp_header_accessor.h"
-
-APT_BEGIN_EXTERN_C
-
-/** MRCP recorder header fields */
-typedef enum {
- RECORDER_HEADER_SENSITIVITY_LEVEL,
- RECORDER_HEADER_NO_INPUT_TIMEOUT,
- RECORDER_HEADER_COMPLETION_CAUSE,
- RECORDER_HEADER_COMPLETION_REASON,
- RECORDER_HEADER_FAILED_URI,
- RECORDER_HEADER_FAILED_URI_CAUSE,
- RECORDER_HEADER_RECORD_URI,
- RECORDER_HEADER_MEDIA_TYPE,
- RECORDER_HEADER_MAX_TIME,
- RECORDER_HEADER_TRIM_LENGTH,
- RECORDER_HEADER_FINAL_SILENCE,
- RECORDER_HEADER_CAPTURE_ON_SPEECH,
- RECORDER_HEADER_VER_BUFFER_UTTERANCE,
- RECORDER_HEADER_START_INPUT_TIMERS,
- RECORDER_HEADER_NEW_AUDIO_CHANNEL,
-
- RECORDER_HEADER_COUNT
-} mrcp_recorder_header_id;
-
-
-/** MRCP recorder completion-cause */
-typedef enum {
- RECORDER_COMPLETION_CAUSE_SUCCESS_SILENCE = 0,
- RECORDER_COMPLETION_CAUSE_SUCCESS_MAXTIME = 1,
- RECORDER_COMPLETION_CAUSE_NO_INPUT_TIMEOUT = 2,
- RECORDER_COMPLETION_CAUSE_URI_FAILURE = 3,
- RECORDER_COMPLETION_CAUSE_ERROR = 4,
-
- RECORDER_COMPLETION_CAUSE_COUNT = 5,
- RECORDER_COMPLETION_CAUSE_UNKNOWN = RECORDER_COMPLETION_CAUSE_COUNT
-} mrcp_recorder_completion_cause_e;
-
-
-
-/** MRCP recorder-header declaration */
-typedef struct mrcp_recorder_header_t mrcp_recorder_header_t;
-
-/** MRCP recorder-header */
-struct mrcp_recorder_header_t {
- /** To filter out background noise and not mistake it for speech */
- float sensitivity_level;
- /** When recording is started and there is no speech detected for a
- certain period of time, the recorder can send a RECORD-COMPLETE event */
- apr_size_t no_input_timeout;
- /** MUST be part of a RECORD-COMPLETE event coming from the
- recorder resource to the client */
- mrcp_recorder_completion_cause_e completion_cause;
- /** MAY be specified in a RECORD-COMPLETE event coming from
- the recorder resource to the client */
- apt_str_t completion_reason;
- /** When a recorder method needs to post the audio to a URI and access to
- the URI fails, the server MUST provide the failed URI in this header
- in the method response */
- apt_str_t failed_uri;
- /** When a recorder method needs to post the audio to a URI and access to
- the URI fails, the server MUST provide the URI specific or protocol
- specific response code through this header in the method response */
- apt_str_t failed_uri_cause;
- /** When a recorder method contains this header the server must capture
- the audio and store it */
- apt_str_t record_uri;
- /** A RECORD method MUST contain this header, which specifies to the
- server the Media Type of the captured audio or video */
- apt_str_t media_type;
- /** When recording is started this specifies the maximum length of the
- recording in milliseconds, calculated from the time the actual
- capture and store begins and is not necessarily the time the RECORD
- method is received */
- apr_size_t max_time;
- /** This header MAY be sent on a STOP method and specifies the length of
- audio to be trimmed from the end of the recording after the stop */
- apr_size_t trim_length;
- /** When recorder is started and the actual capture begins, this header
- specifies the length of silence in the audio that is to be
- interpreted as the end of the recording*/
- apr_size_t final_silence;
- /** f false, the recorder MUST start capturing immediately when started.
- If true, the recorder MUST wait for the endpointing functionality to
- detect speech before it starts capturing */
- apt_bool_t capture_on_speech;
- /** Tells the server to buffer the utterance associated with this
- recording request into the verification buffer */
- apt_bool_t ver_buffer_utterance;
- /** MAY be sent as part of the RECORD request. A value of false tells the
- recorder resource to start the operation, but not to start the no-input
- timer until the client sends a START-INPUT-TIMERS */
- apt_bool_t start_input_timers;
- /** MAY be specified in a RECORD request and allows the
- client to tell the server that, from this point on, further input
- audio comes from a different audio source */
- apt_bool_t new_audio_channel;
-};
-
-
-/** Get recorder header vtable */
-const mrcp_header_vtable_t* mrcp_recorder_header_vtable_get(mrcp_version_e version);
-
-/** Get recorder completion cause string */
-MRCP_DECLARE(const apt_str_t*) mrcp_recorder_completion_cause_get(
- mrcp_recorder_completion_cause_e completion_cause,
- mrcp_version_e version);
-
-APT_END_EXTERN_C
-
-#endif /* MRCP_RECORDER_HEADER_H */
diff --git a/libs/unimrcp/libs/mrcp/resources/include/mrcp_recorder_resource.h b/libs/unimrcp/libs/mrcp/resources/include/mrcp_recorder_resource.h
deleted file mode 100644
index 86100030a1..0000000000
--- a/libs/unimrcp/libs/mrcp/resources/include/mrcp_recorder_resource.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_recorder_resource.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MRCP_RECORDER_RESOURCE_H
-#define MRCP_RECORDER_RESOURCE_H
-
-/**
- * @file mrcp_recorder_resource.h
- * @brief MRCP Recorder Resource
- */
-
-#include "mrcp_types.h"
-
-APT_BEGIN_EXTERN_C
-
-/** MRCP recorder methods */
-typedef enum {
- RECORDER_SET_PARAMS,
- RECORDER_GET_PARAMS,
- RECORDER_RECORD,
- RECORDER_STOP,
- RECORDER_START_INPUT_TIMERS,
-
- RECORDER_METHOD_COUNT
-} mrcp_recorder_method_id;
-
-/** MRCP recorder events */
-typedef enum {
- RECORDER_START_OF_INPUT,
- RECORDER_RECORD_COMPLETE,
-
- RECORDER_EVENT_COUNT
-} mrcp_recorder_event_id;
-
-/** Create MRCP recorder resource */
-MRCP_DECLARE(mrcp_resource_t*) mrcp_recorder_resource_create(apr_pool_t *pool);
-
-APT_END_EXTERN_C
-
-#endif /* MRCP_RECORDER_RESOURCE_H */
diff --git a/libs/unimrcp/libs/mrcp/resources/include/mrcp_synth_header.h b/libs/unimrcp/libs/mrcp/resources/include/mrcp_synth_header.h
deleted file mode 100644
index 9a9fc6eb6b..0000000000
--- a/libs/unimrcp/libs/mrcp/resources/include/mrcp_synth_header.h
+++ /dev/null
@@ -1,304 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_synth_header.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MRCP_SYNTH_HEADER_H
-#define MRCP_SYNTH_HEADER_H
-
-/**
- * @file mrcp_synth_header.h
- * @brief MRCP Synthesizer Header
- */
-
-#include "mrcp_types.h"
-#include "mrcp_header_accessor.h"
-
-APT_BEGIN_EXTERN_C
-
-/** MRCP synthesizer header fields */
-typedef enum {
- SYNTHESIZER_HEADER_JUMP_SIZE,
- SYNTHESIZER_HEADER_KILL_ON_BARGE_IN,
- SYNTHESIZER_HEADER_SPEAKER_PROFILE,
- SYNTHESIZER_HEADER_COMPLETION_CAUSE,
- SYNTHESIZER_HEADER_COMPLETION_REASON,
- SYNTHESIZER_HEADER_VOICE_GENDER,
- SYNTHESIZER_HEADER_VOICE_AGE,
- SYNTHESIZER_HEADER_VOICE_VARIANT,
- SYNTHESIZER_HEADER_VOICE_NAME,
- SYNTHESIZER_HEADER_PROSODY_VOLUME,
- SYNTHESIZER_HEADER_PROSODY_RATE,
- SYNTHESIZER_HEADER_SPEECH_MARKER,
- SYNTHESIZER_HEADER_SPEECH_LANGUAGE,
- SYNTHESIZER_HEADER_FETCH_HINT,
- SYNTHESIZER_HEADER_AUDIO_FETCH_HINT,
- SYNTHESIZER_HEADER_FAILED_URI,
- SYNTHESIZER_HEADER_FAILED_URI_CAUSE,
- SYNTHESIZER_HEADER_SPEAK_RESTART,
- SYNTHESIZER_HEADER_SPEAK_LENGTH,
- SYNTHESIZER_HEADER_LOAD_LEXICON,
- SYNTHESIZER_HEADER_LEXICON_SEARCH_ORDER,
-
- SYNTHESIZER_HEADER_COUNT
-} mrcp_synthesizer_header_id;
-
-
-/** Speech-units */
-typedef enum {
- SPEECH_UNIT_SECOND,
- SPEECH_UNIT_WORD,
- SPEECH_UNIT_SENTENCE,
- SPEECH_UNIT_PARAGRAPH,
-
- SPEECH_UNIT_COUNT
-} mrcp_speech_unit_e;
-
-/** Speech-length types */
-typedef enum {
- SPEECH_LENGTH_TYPE_TEXT,
- SPEECH_LENGTH_TYPE_NUMERIC_POSITIVE,
- SPEECH_LENGTH_TYPE_NUMERIC_NEGATIVE,
-
- SPEECH_LENGTH_TYPE_UNKNOWN
-} mrcp_speech_length_type_e;
-
-/** MRCP voice-gender */
-typedef enum {
- VOICE_GENDER_MALE,
- VOICE_GENDER_FEMALE,
- VOICE_GENDER_NEUTRAL,
-
- VOICE_GENDER_COUNT,
- VOICE_GENDER_UNKNOWN = VOICE_GENDER_COUNT
-} mrcp_voice_gender_e;
-
-/** Prosody-volume type */
-typedef enum {
- PROSODY_VOLUME_TYPE_LABEL,
- PROSODY_VOLUME_TYPE_NUMERIC,
- PROSODY_VOLUME_TYPE_RELATIVE_CHANGE,
-
- PROSODY_VOLUME_TYPE_UNKNOWN
-} mrcp_prosody_volume_type_e;
-
-/** Prosody-rate type */
-typedef enum {
- PROSODY_RATE_TYPE_LABEL,
- PROSODY_RATE_TYPE_RELATIVE_CHANGE,
-
- PROSODY_RATE_TYPE_UNKNOWN
-} mrcp_prosody_rate_type_e;
-
-/** Prosody-volume */
-typedef enum {
- PROSODY_VOLUME_SILENT,
- PROSODY_VOLUME_XSOFT,
- PROSODY_VOLUME_SOFT,
- PROSODY_VOLUME_MEDIUM,
- PROSODY_VOLUME_LOUD,
- PROSODY_VOLUME_XLOUD,
- PROSODY_VOLUME_DEFAULT,
-
- PROSODY_VOLUME_COUNT,
- PROSODY_VOLUME_UNKNOWN = PROSODY_VOLUME_COUNT
-} mrcp_prosody_volume_label_e;
-
-/** Prosody-rate */
-typedef enum {
- PROSODY_RATE_XSLOW,
- PROSODY_RATE_SLOW,
- PROSODY_RATE_MEDIUM,
- PROSODY_RATE_FAST,
- PROSODY_RATE_XFAST,
- PROSODY_RATE_DEFAULT,
-
- PROSODY_RATE_COUNT,
- PROSODY_RATE_UNKNOWN = PROSODY_RATE_COUNT
-} mrcp_prosody_rate_label_e;
-
-/** Synthesizer completion-cause specified in SPEAK-COMPLETE event */
-typedef enum {
- SYNTHESIZER_COMPLETION_CAUSE_NORMAL = 0,
- SYNTHESIZER_COMPLETION_CAUSE_BARGE_IN = 1,
- SYNTHESIZER_COMPLETION_CAUSE_PARSE_FAILURE = 2,
- SYNTHESIZER_COMPLETION_CAUSE_URI_FAILURE = 3,
- SYNTHESIZER_COMPLETION_CAUSE_ERROR = 4,
- SYNTHESIZER_COMPLETION_CAUSE_LANGUAGE_UNSUPPORTED = 5,
- SYNTHESIZER_COMPLETION_CAUSE_LEXICON_LOAD_FAILURE = 6,
- SYNTHESIZER_COMPLETION_CAUSE_CANCELLED = 7,
-
- SYNTHESIZER_COMPLETION_CAUSE_COUNT = 8,
- SYNTHESIZER_COMPLETION_CAUSE_UNKNOWN = SYNTHESIZER_COMPLETION_CAUSE_COUNT
-} mrcp_synth_completion_cause_e;
-
-
-/** Speech-length value declaration */
-typedef struct mrcp_speech_length_value_t mrcp_speech_length_value_t;
-/** Numeric speech-length declaration */
-typedef struct mrcp_numeric_speech_length_t mrcp_numeric_speech_length_t;
-/** Prosody-param declaration */
-typedef struct mrcp_prosody_param_t mrcp_prosody_param_t;
-/** Voice-param declaration */
-typedef struct mrcp_voice_param_t mrcp_voice_param_t;
-/**Prosody-rate declaration*/
-typedef struct mrcp_prosody_rate_t mrcp_prosody_rate_t;
-/**Prosody-volume declaration*/
-typedef struct mrcp_prosody_volume_t mrcp_prosody_volume_t;
-/** MRCP synthesizer-header declaration */
-typedef struct mrcp_synth_header_t mrcp_synth_header_t;
-
-/** Numeric speech-length */
-struct mrcp_numeric_speech_length_t {
- /** The length */
- apr_size_t length;
- /** The unit (second/word/sentence/paragraph) */
- mrcp_speech_unit_e unit;
-};
-
-/** Definition of speech-length value */
-struct mrcp_speech_length_value_t {
- /** Speech-length type (numeric/text)*/
- mrcp_speech_length_type_e type;
- /** Speech-length value (either numeric or text) */
- union {
- /** Text speech-length */
- apt_str_t tag;
- /** Numeric speech-length */
- mrcp_numeric_speech_length_t numeric;
- } value;
-};
-
-/** MRCP voice-param */
-struct mrcp_voice_param_t {
- /** Voice gender (male/femaile/neutral)*/
- mrcp_voice_gender_e gender;
- /** Voice age */
- apr_size_t age;
- /** Voice variant */
- apr_size_t variant;
- /** Voice name */
- apt_str_t name;
-};
-
-/** MRCP prosody-volume */
-struct mrcp_prosody_volume_t {
- /** prosody-volume type (one of label,numeric,relative change) */
- mrcp_prosody_volume_type_e type;
-
- /** prosody-volume value */
- union {
- /** one of "silent", "x-soft", ... */
- mrcp_prosody_volume_label_e label;
- /** numeric value */
- float numeric;
- /** relative change */
- float relative;
- } value;
-};
-
-/** MRCP prosody-rate */
-struct mrcp_prosody_rate_t {
- /** prosody-rate type (one of label, relative change) */
- mrcp_prosody_rate_type_e type;
-
- /** prosody-rate value */
- union {
- /** one of "x-slow", "slow", ... */
- mrcp_prosody_rate_label_e label;
- /** relative change */
- float relative;
- } value;
-};
-
-/** MRCP prosody-param */
-struct mrcp_prosody_param_t {
- /** Prosofy volume */
- mrcp_prosody_volume_t volume;
- /** Prosofy rate */
- mrcp_prosody_rate_t rate;
-};
-
-/** MRCP synthesizer-header */
-struct mrcp_synth_header_t {
- /** MAY be specified in a CONTROL method and controls the
- amount to jump forward or backward in an active "SPEAK" request */
- mrcp_speech_length_value_t jump_size;
- /** MAY be sent as part of the "SPEAK" method to enable kill-
- on-barge-in support */
- apt_bool_t kill_on_barge_in;
- /** MAY be part of the "SET-PARAMS"/"GET-PARAMS" or "SPEAK"
- request from the client to the server and specifies a URI which
- references the profile of the speaker */
- apt_str_t speaker_profile;
- /** MUST be specified in a "SPEAK-COMPLETE" event coming from
- the synthesizer resource to the client */
- mrcp_synth_completion_cause_e completion_cause;
- /** MAY be specified in a "SPEAK-COMPLETE" event coming from
- the synthesizer resource to the client */
- apt_str_t completion_reason;
- /** This set of header fields defines the voice of the speaker */
- mrcp_voice_param_t voice_param;
- /** This set of header fields defines the prosody of the speech */
- mrcp_prosody_param_t prosody_param;
- /** Contains timestamp information in a "timestamp" field */
- apt_str_t speech_marker;
- /** specifies the default language of the speech data if the
- language is not specified in the markup */
- apt_str_t speech_language;
- /** When the synthesizer needs to fetch documents or other resources like
- speech markup or audio files, this header controls the corresponding
- URI access properties */
- apt_str_t fetch_hint;
- /** When the synthesizer needs to fetch documents or other resources like
- speech audio files, this header controls the corresponding URI access
- properties */
- apt_str_t audio_fetch_hint;
- /** When a synthesizer method needs a synthesizer to fetch or access a
- URI and the access fails, the server SHOULD provide the failed URI in
- this header in the method response */
- apt_str_t failed_uri;
- /** When a synthesizer method needs a synthesizer to fetch or access a
- URI and the access fails the server MUST provide the URI specific or
- protocol specific response code for the URI in the Failed-URI header
- in the method response through this header */
- apt_str_t failed_uri_cause;
- /** When a CONTROL request to jump backward is issued to a currently
- speaking synthesizer resource, and the target jump point is before
- the start of the current "SPEAK" request, the current "SPEAK" request
- MUST restart */
- apt_bool_t speak_restart;
- /** MAY be specified in a CONTROL method to control the
- length of speech to speak, relative to the current speaking point in
- the currently active "SPEAK" request */
- mrcp_speech_length_value_t speak_length;
- /** Used to indicate whether a lexicon has to be loaded or unloaded */
- apt_bool_t load_lexicon;
- /** Used to specify a list of active Lexicon URIs and the
- search order among the active lexicons */
- apt_str_t lexicon_search_order;
-};
-
-/** Get synthesizer header vtable */
-const mrcp_header_vtable_t* mrcp_synth_header_vtable_get(mrcp_version_e version);
-
-/** Get synthesizer completion cause string */
-MRCP_DECLARE(const apt_str_t*) mrcp_synth_completion_cause_get(mrcp_synth_completion_cause_e completion_cause, mrcp_version_e version);
-
-
-APT_END_EXTERN_C
-
-#endif /* MRCP_SYNTH_HEADER_H */
diff --git a/libs/unimrcp/libs/mrcp/resources/include/mrcp_synth_resource.h b/libs/unimrcp/libs/mrcp/resources/include/mrcp_synth_resource.h
deleted file mode 100644
index a03cc53e55..0000000000
--- a/libs/unimrcp/libs/mrcp/resources/include/mrcp_synth_resource.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_synth_resource.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MRCP_SYNTH_RESOURCE_H
-#define MRCP_SYNTH_RESOURCE_H
-
-/**
- * @file mrcp_synth_resource.h
- * @brief MRCP Synthesizer Resource
- */
-
-#include "mrcp_types.h"
-
-APT_BEGIN_EXTERN_C
-
-/** MRCP synthesizer methods */
-typedef enum {
- SYNTHESIZER_SET_PARAMS,
- SYNTHESIZER_GET_PARAMS,
- SYNTHESIZER_SPEAK,
- SYNTHESIZER_STOP,
- SYNTHESIZER_PAUSE,
- SYNTHESIZER_RESUME,
- SYNTHESIZER_BARGE_IN_OCCURRED,
- SYNTHESIZER_CONTROL,
- SYNTHESIZER_DEFINE_LEXICON,
-
- SYNTHESIZER_METHOD_COUNT
-} mrcp_synthesizer_method_id;
-
-/** MRCP synthesizer events */
-typedef enum {
- SYNTHESIZER_SPEECH_MARKER,
- SYNTHESIZER_SPEAK_COMPLETE,
-
- SYNTHESIZER_EVENT_COUNT
-} mrcp_synthesizer_event_id;
-
-
-/** Create MRCP synthesizer resource */
-MRCP_DECLARE(mrcp_resource_t*) mrcp_synth_resource_create(apr_pool_t *pool);
-
-APT_END_EXTERN_C
-
-#endif /* MRCP_SYNTH_RESOURCE_H */
diff --git a/libs/unimrcp/libs/mrcp/resources/include/mrcp_verifier_header.h b/libs/unimrcp/libs/mrcp/resources/include/mrcp_verifier_header.h
deleted file mode 100644
index 7a7e94419a..0000000000
--- a/libs/unimrcp/libs/mrcp/resources/include/mrcp_verifier_header.h
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id:
- */
-
-#ifndef MRCP_VERIFIER_HEADER_H
-#define MRCP_VERIFIER_HEADER_H
-
-/**
- * @file mrcp_verifier_header.h
- * @brief MRCP Verifier Header
- */
-
-#include "mrcp_types.h"
-#include "mrcp_header_accessor.h"
-
-APT_BEGIN_EXTERN_C
-
-/** MRCP verifier header fields */
-typedef enum {
- VERIFIER_HEADER_REPOSITORY_URI,
- VERIFIER_HEADER_VOICEPRINT_IDENTIFIER,
- VERIFIER_HEADER_VERIFICATION_MODE,
- VERIFIER_HEADER_ADAPT_MODEL,
- VERIFIER_HEADER_ABORT_MODEL,
- VERIFIER_HEADER_MIN_VERIFICATION_SCORE,
- VERIFIER_HEADER_NUM_MIN_VERIFICATION_PHRASES,
- VERIFIER_HEADER_NUM_MAX_VERIFICATION_PHRASES,
- VERIFIER_HEADER_NO_INPUT_TIMEOUT,
- VERIFIER_HEADER_SAVE_WAVEFORM,
- VERIFIER_HEADER_MEDIA_TYPE,
- VERIFIER_HEADER_WAVEFORM_URI,
- VERIFIER_HEADER_VOICEPRINT_EXISTS,
- VERIFIER_HEADER_VER_BUFFER_UTTERANCE,
- VERIFIER_HEADER_INPUT_WAVEFORM_URI,
- VERIFIER_HEADER_COMPLETION_CAUSE,
- VERIFIER_HEADER_COMPLETION_REASON,
- VERIFIER_HEADER_SPEECH_COMPLETE_TIMEOUT,
- VERIFIER_HEADER_NEW_AUDIO_CHANNEL,
- VERIFIER_HEADER_ABORT_VERIFICATION,
- VERIFIER_HEADER_START_INPUT_TIMERS,
-
- VERIFIER_HEADER_COUNT
-} mrcp_verifier_header_id;
-
-
-/** MRCP verifier completion-cause */
-typedef enum {
- VERIFIER_COMPLETION_CAUSE_SUCCESS = 0,
- VERIFIER_COMPLETION_CAUSE_ERROR = 1,
- VERIFIER_COMPLETION_CAUSE_NO_INPUT_TIMEOUT = 2,
- VERIFIER_COMPLETION_CAUSE_TOO_MUCH_SPEECH_TIMEOUT = 3,
- VERIFIER_COMPLETION_CAUSE_SPEECH_TOO_EARLY = 4,
- VERIFIER_COMPLETION_CAUSE_BUFFER_EMPTY = 5,
- VERIFIER_COMPLETION_CAUSE_OUT_OF_SEQUENCE = 6,
- VERIFIER_COMPLETION_CAUSE_REPOSITORY_URI_FAILURE = 7,
- VERIFIER_COMPLETION_CAUSE_REPOSITORY_URI_MISSING = 8,
- VERIFIER_COMPLETION_CAUSE_VOICEPRINT_ID_MISSING = 9,
- VERIFIER_COMPLETION_CAUSE_VOICEPRINT_ID_NOT_EXIST = 10,
- VERIFIER_COMPLETION_CAUSE_SPEECH_NOT_USABLE = 11,
-
- VERIFIER_COMPLETION_CAUSE_COUNT = 12,
- VERIFIER_COMPLETION_CAUSE_UNKNOWN = VERIFIER_COMPLETION_CAUSE_COUNT
-} mrcp_verifier_completion_cause_e;
-
-
-
-/** MRCP verifier-header declaration */
-typedef struct mrcp_verifier_header_t mrcp_verifier_header_t;
-
-/** MRCP verifier-header */
-struct mrcp_verifier_header_t {
- /** Specifies the voiceprint repository to be used or referenced during
- speaker verification or identification operations */
- apt_str_t repository_uri;
- /** Specifies the claimed identity for verification applications */
- apt_str_t voiceprint_identifier;
- /** Specifies the mode of the verification resource */
- apt_str_t verification_mode;
- /** Indicates the desired behavior of the verification resource
- after a successful verification operation */
- apt_bool_t adapt_model;
- /** Indicates the desired behavior of the verification resource
- upon session termination */
- apt_bool_t abort_model;
- /** Determines the minimum verification score for which a verification
- decision of "accepted" may be declared by the server */
- float min_verification_score;
- /** Specifies the minimum number of valid utterances
- before a positive decision is given for verification */
- apr_size_t num_min_verification_phrases;
- /** Specifies the number of valid utterances required
- before a decision is forced for verification */
- apr_size_t num_max_verification_phrases;
- /** Sets the length of time from the start of the verification timers
- (see START-INPUT-TIMERS) until the declaration of a no-input event
- in the VERIFICATION-COMPLETE server event message */
- apr_size_t no_input_timeout;
- /** Allows the client to request the verification resource to save
- the audio stream that was used for verification/identification */
- apt_bool_t save_waveform;
- /** Tells the server resource the Media Type of the captured audio or video
- such as the one captured and returned by the Waveform-URI header field */
- apt_str_t media_type;
- /** If the Save-Waveform header field is set to true, the verification resource
- MUST attempt to record the incoming audio stream of the verification into
- a file and provide a URI for the client to access it */
- apt_str_t waveform_uri;
- /** Shows the status of the voiceprint specified
- in the QUERY-VOICEPRINT method */
- apt_bool_t voiceprint_exists;
- /** Indicates that this utterance could be
- later considered for Speaker Verification */
- apt_bool_t ver_buffer_utterance;
- /** Specifies stored audio content that the client requests the server
- to fetch and process according to the current verification mode,
- either to train the voiceprint or verify a claimed identity */
- apt_str_t input_waveform_uri;
- /** Indicates the cause of VERIFY or VERIFY-FROM-BUFFER method completion */
- mrcp_verifier_completion_cause_e completion_cause;
- /** MAY be specified in a VERIFICATION-COMPLETE event
- coming from the verifier resource to the client */
- apt_str_t completion_reason;
- /** Specifies the length of silence required following user
- speech before the speech verifier finalizes a result */
- apr_size_t speech_complete_timeout;
- /** MAY be specified in a VERIFIER request and allows the
- client to tell the server that, from this point on, further input
- audio comes from a different audio source */
- apt_bool_t new_audio_channel;
- /** MUST be sent in a STOP request to indicate
- whether or not to abort a VERIFY method in progress */
- apt_bool_t abort_verification;
- /** MAY be sent as part of a VERIFY request. A value of false
- tells the verification resource to start the VERIFY operation,
- but not to start the no-input timer yet */
- apt_bool_t start_input_timers;
-};
-
-
-/** Get verifier header vtable */
-const mrcp_header_vtable_t* mrcp_verifier_header_vtable_get(mrcp_version_e version);
-
-/** Get verifier completion cause string */
-MRCP_DECLARE(const apt_str_t*) mrcp_verifier_completion_cause_get(mrcp_verifier_completion_cause_e completion_cause, mrcp_version_e version);
-
-APT_END_EXTERN_C
-
-#endif /* MRCP_VERIFIER_HEADER_H */
diff --git a/libs/unimrcp/libs/mrcp/resources/include/mrcp_verifier_resource.h b/libs/unimrcp/libs/mrcp/resources/include/mrcp_verifier_resource.h
deleted file mode 100644
index f3022513eb..0000000000
--- a/libs/unimrcp/libs/mrcp/resources/include/mrcp_verifier_resource.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id:
- */
-
-#ifndef MRCP_VERIFIER_RESOURCE_H
-#define MRCP_VERIFIER_RESOURCE_H
-
-/**
- * @file mrcp_verifier_resource.h
- * @brief MRCP Verifier Resource
- */
-
-#include "mrcp_types.h"
-
-APT_BEGIN_EXTERN_C
-
-/** MRCP verifier methods */
-typedef enum {
- VERIFIER_SET_PARAMS,
- VERIFIER_GET_PARAMS,
- VERIFIER_START_SESSION,
- VERIFIER_END_SESSION,
- VERIFIER_QUERY_VOICEPRINT,
- VERIFIER_DELETE_VOICEPRINT,
- VERIFIER_VERIFY,
- VERIFIER_VERIFY_FROM_BUFFER,
- VERIFIER_VERIFY_ROLLBACK,
- VERIFIER_STOP,
- VERIFIER_CLEAR_BUFFER,
- VERIFIER_START_INPUT_TIMERS,
- VERIFIER_GET_INTERMIDIATE_RESULT,
-
- VERIFIER_METHOD_COUNT
-} mrcp_verifier_method_id;
-
-/** MRCP verifier events */
-typedef enum {
- VERIFIER_START_OF_INPUT,
- VERIFIER_VERIFICATION_COMPLETE,
-
- VERIFIER_EVENT_COUNT
-} mrcp_verifier_event_id;
-
-/** Create MRCP verifier resource */
-MRCP_DECLARE(mrcp_resource_t*) mrcp_verifier_resource_create(apr_pool_t *pool);
-
-APT_END_EXTERN_C
-
-#endif /* MRCP_VERIFIER_RESOURCE_H */
diff --git a/libs/unimrcp/libs/mrcp/resources/src/mrcp_recog_header.c b/libs/unimrcp/libs/mrcp/resources/src/mrcp_recog_header.c
deleted file mode 100644
index 527476c303..0000000000
--- a/libs/unimrcp/libs/mrcp/resources/src/mrcp_recog_header.c
+++ /dev/null
@@ -1,781 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_recog_header.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include "mrcp_recog_header.h"
-
-/** String table of MRCPv1 recognizer header fields (mrcp_recog_header_id) */
-static const apt_str_table_item_t v1_recog_header_string_table[] = {
- {{"Confidence-Threshold", 20},16},
- {{"Sensitivity-Level", 17},14},
- {{"Speed-Vs-Accuracy", 17},4},
- {{"N-Best-List-Length", 18},1},
- {{"No-Input-Timeout", 16},2},
- {{"Recognition-Timeout", 19},19},
- {{"Waveform-Url", 12},4},
- {{"Completion-Cause", 16},16},
- {{"Recognizer-Context-Block", 24},16},
- {{"Recognizer-Start-Timers", 23},18},
- {{"Speech-Complete-Timeout", 23},7},
- {{"Speech-Incomplete-Timeout", 25},12},
- {{"DTMF-Interdigit-Timeout", 23},10},
- {{"DTMF-Term-Timeout", 17},14},
- {{"DTMF-Term-Char", 14},14},
- {{"Failed-Uri", 10},10},
- {{"Failed-Uri-Cause", 16},16},
- {{"Save-Waveform", 13},5},
- {{"New-Audio-Channel", 17},17},
- {{"Speech-Language", 15},8},
- {{"Input-Type", 10},10},
- {{"Input-Waveform-Uri", 18},6},
- {{"Completion-Reason", 17},17},
- {{"Media-Type", 10},0},
- {{"Ver-Buffer-Utterance", 20},0},
- {{"Recognition-Mode", 16},16},
- {{"Cancel-If-Queue", 15},3},
- {{"Hotword-Max-Duration", 20},10},
- {{"Hotword-Min-Duration", 20},20},
- {{"Interpret-Text", 14},12},
- {{"DTMF-Buffer-Time", 16},16},
- {{"Clear-DTMF-Buffer", 17},11},
- {{"Early-No-Match", 14},4},
- {{"Num-Min-Consistent-Pronunciations",33},1},
- {{"Consistency-Threshold", 21},16},
- {{"Clash-Threshold", 15},2},
- {{"Personal-Grammar-URI", 20},9},
- {{"Enroll-Utterance", 16},10},
- {{"Phrase-ID", 9},8},
- {{"Phrase-NL", 9},9},
- {{"Weight", 6},3},
- {{"Save-Best-Waveform", 18},10},
- {{"New-Phrase-ID", 13},4},
- {{"Confusable-Phrases-URI", 22},4},
- {{"Abort-Phrase-Enrollment", 23},0}
-};
-
-/** String table of MRCPv2 recognizer header fields (mrcp_recog_header_id) */
-static const apt_str_table_item_t v2_recog_header_string_table[] = {
- {{"Confidence-Threshold", 20},16},
- {{"Sensitivity-Level", 17},14},
- {{"Speed-Vs-Accuracy", 17},4},
- {{"N-Best-List-Length", 18},1},
- {{"No-Input-Timeout", 16},2},
- {{"Recognition-Timeout", 19},19},
- {{"Waveform-Uri", 12},4},
- {{"Completion-Cause", 16},16},
- {{"Recognizer-Context-Block", 24},7},
- {{"Start-Input-Timers", 18},18},
- {{"Speech-Complete-Timeout", 23},7},
- {{"Speech-Incomplete-Timeout", 25},12},
- {{"DTMF-Interdigit-Timeout", 23},10},
- {{"DTMF-Term-Timeout", 17},14},
- {{"DTMF-Term-Char", 14},14},
- {{"Failed-Uri", 10},10},
- {{"Failed-Uri-Cause", 16},16},
- {{"Save-Waveform", 13},5},
- {{"New-Audio-Channel", 17},17},
- {{"Speech-Language", 15},8},
- {{"Input-Type", 10},10},
- {{"Input-Waveform-Uri", 18},6},
- {{"Completion-Reason", 17},13},
- {{"Media-Type", 10},0},
- {{"Ver-Buffer-Utterance", 20},0},
- {{"Recognition-Mode", 16},16},
- {{"Cancel-If-Queue", 15},3},
- {{"Hotword-Max-Duration", 20},10},
- {{"Hotword-Min-Duration", 20},20},
- {{"Interpret-Text", 14},12},
- {{"DTMF-Buffer-Time", 16},16},
- {{"Clear-DTMF-Buffer", 17},11},
- {{"Early-No-Match", 14},4},
- {{"Num-Min-Consistent-Pronunciations",33},1},
- {{"Consistency-Threshold", 21},16},
- {{"Clash-Threshold", 15},15},
- {{"Personal-Grammar-URI", 20},9},
- {{"Enroll-Utterance", 16},10},
- {{"Phrase-ID", 9},8},
- {{"Phrase-NL", 9},9},
- {{"Weight", 6},3},
- {{"Save-Best-Waveform", 18},10},
- {{"New-Phrase-ID", 13},4},
- {{"Confusable-Phrases-URI", 22},4},
- {{"Abort-Phrase-Enrollment", 23},0}
-};
-
-/** String table of MRCPv1 recognizer completion-cause fields (mrcp_recog_completion_cause_e) */
-static const apt_str_table_item_t v1_completion_cause_string_table[] = {
- {{"success", 7},1},
- {{"no-match", 8},8},
- {{"no-input-timeout", 16},3},
- {{"recognition-timeout", 19},0},
- {{"gram-load-failure", 17},7},
- {{"gram-comp-failure", 17},5},
- {{"error", 5},0},
- {{"speech-too-early", 16},1},
- {{"too-much-speech-timeout", 23},0},
- {{"uri-failure", 11},0},
- {{"language-unsupported", 20},0},
- {{"cancelled", 9},0},
- {{"semantics-failure", 17},2},
- {{"partial-match", 13},13},
- {{"partial-match-maxtime", 21},13},
- {{"no-match-maxtime", 16},9},
- {{"gram-definition-failure", 23},5}
-};
-
-
-/** String table of MRCPv2 recognizer completion-cause fields (mrcp_recog_completion_cause_e) */
-static const apt_str_table_item_t v2_completion_cause_string_table[] = {
- {{"success", 7},7},
- {{"no-match", 8},4},
- {{"no-input-timeout", 16},3},
- {{"hotword-maxtime", 15},0},
- {{"grammar-load-failure", 20},8},
- {{"grammar-compilation-failure",27},8},
- {{"recognizer-error", 16},0},
- {{"speech-too-early", 16},1},
- {{"success-maxtime", 15},15},
- {{"uri-failure", 11},0},
- {{"language-unsupported", 20},0},
- {{"cancelled", 9},0},
- {{"semantics-failure", 17},2},
- {{"partial-match", 13},13},
- {{"partial-match-maxtime", 21},13},
- {{"no-match-maxtime", 16},9},
- {{"grammar-definition-failure", 26},9}
-};
-
-/** Initialize recognizer header */
-static void mrcp_recog_header_init(mrcp_recog_header_t *recog_header)
-{
- recog_header->confidence_threshold = 0.0;
- recog_header->sensitivity_level = 0.0;
- recog_header->speed_vs_accuracy = 0.0;
- recog_header->n_best_list_length = 0;
- recog_header->no_input_timeout = 0;
- recog_header->recognition_timeout = 0;
- apt_string_reset(&recog_header->waveform_uri);
- recog_header->completion_cause = RECOGNIZER_COMPLETION_CAUSE_COUNT;
- apt_string_reset(&recog_header->recognizer_context_block);
- recog_header->start_input_timers = FALSE;
- recog_header->speech_complete_timeout = 0;
- recog_header->speech_incomplete_timeout = 0;
- recog_header->dtmf_interdigit_timeout = 0;
- recog_header->dtmf_term_timeout = 0;
- recog_header->dtmf_term_char = 0;
- apt_string_reset(&recog_header->failed_uri);
- apt_string_reset(&recog_header->failed_uri_cause);
- recog_header->save_waveform = FALSE;
- recog_header->new_audio_channel = FALSE;
- apt_string_reset(&recog_header->speech_language);
- /* initializes additionnal MRCPV2 recog header fields */
- apt_string_reset(&recog_header->input_type);
- apt_string_reset(&recog_header->input_waveform_uri);
- apt_string_reset(&recog_header->completion_reason);
- apt_string_reset(&recog_header->media_type);
- recog_header->ver_buffer_utterance = FALSE;
- apt_string_reset(&recog_header->recognition_mode);
- recog_header->cancel_if_queue = FALSE;
- recog_header->hotword_max_duration = 0;
- recog_header->hotword_min_duration = 0;
- apt_string_reset(&recog_header->interpret_text);
- recog_header->dtmf_buffer_time = 0;
- recog_header->clear_dtmf_buffer = FALSE;
- recog_header->early_no_match = FALSE;
- recog_header->num_min_consistent_pronunciations = 0;
- recog_header->consistency_threshold = 0.0;
- recog_header->clash_threshold = 0.0;
- apt_string_reset(&recog_header->personal_grammar_uri);
- recog_header->enroll_utterance = FALSE;
- apt_string_reset(&recog_header->phrase_id);
- apt_string_reset(&recog_header->phrase_nl);
- recog_header->weight = 0.0;
- recog_header->save_best_waveform = FALSE;
- apt_string_reset(&recog_header->new_phrase_id);
- apt_string_reset(&recog_header->confusable_phrases_uri);
- recog_header->abort_phrase_enrollment = FALSE;
-}
-
-/** Allocate MRCP recognizer header */
-static void* mrcp_recog_header_allocate(mrcp_header_accessor_t *accessor, apr_pool_t *pool)
-{
- mrcp_recog_header_t *recog_header = apr_palloc(pool,sizeof(mrcp_recog_header_t));
- mrcp_recog_header_init(recog_header);
- accessor->data = recog_header;
- return accessor->data;
-}
-
-/** Parse MRCP recognizer header */
-static apt_bool_t mrcp_recog_header_parse(mrcp_recog_header_t *recog_header, apr_size_t id, const apt_str_t *value, apr_pool_t *pool)
-{
- apt_bool_t status = TRUE;
- switch(id) {
- case RECOGNIZER_HEADER_N_BEST_LIST_LENGTH:
- recog_header->n_best_list_length = apt_size_value_parse(value);
- break;
- case RECOGNIZER_HEADER_NO_INPUT_TIMEOUT:
- recog_header->no_input_timeout = apt_size_value_parse(value);
- break;
- case RECOGNIZER_HEADER_RECOGNITION_TIMEOUT:
- recog_header->recognition_timeout = apt_size_value_parse(value);
- break;
- case RECOGNIZER_HEADER_WAVEFORM_URI:
- recog_header->waveform_uri = *value;
- break;
- case RECOGNIZER_HEADER_COMPLETION_CAUSE:
- recog_header->completion_cause = apt_size_value_parse(value);
- break;
- case RECOGNIZER_HEADER_RECOGNIZER_CONTEXT_BLOCK:
- recog_header->recognizer_context_block = *value;
- break;
- case RECOGNIZER_HEADER_START_INPUT_TIMERS:
- apt_boolean_value_parse(value,&recog_header->start_input_timers);
- break;
- case RECOGNIZER_HEADER_SPEECH_COMPLETE_TIMEOUT:
- recog_header->speech_complete_timeout = apt_size_value_parse(value);
- break;
- case RECOGNIZER_HEADER_SPEECH_INCOMPLETE_TIMEOUT:
- recog_header->speech_incomplete_timeout = apt_size_value_parse(value);
- break;
- case RECOGNIZER_HEADER_DTMF_INTERDIGIT_TIMEOUT:
- recog_header->dtmf_interdigit_timeout = apt_size_value_parse(value);
- break;
- case RECOGNIZER_HEADER_DTMF_TERM_TIMEOUT:
- recog_header->dtmf_term_timeout = apt_size_value_parse(value);
- break;
- case RECOGNIZER_HEADER_DTMF_TERM_CHAR:
- recog_header->dtmf_term_char = *value->buf;
- break;
- case RECOGNIZER_HEADER_FAILED_URI:
- recog_header->failed_uri = *value;
- break;
- case RECOGNIZER_HEADER_FAILED_URI_CAUSE:
- recog_header->failed_uri_cause = *value;
- break;
- case RECOGNIZER_HEADER_SAVE_WAVEFORM:
- apt_boolean_value_parse(value,&recog_header->save_waveform);
- break;
- case RECOGNIZER_HEADER_NEW_AUDIO_CHANNEL:
- apt_boolean_value_parse(value,&recog_header->new_audio_channel);
- break;
- case RECOGNIZER_HEADER_SPEECH_LANGUAGE:
- recog_header->speech_language = *value;
- break;
- case RECOGNIZER_HEADER_INPUT_TYPE:
- recog_header->input_type = *value;
- break;
- case RECOGNIZER_HEADER_MEDIA_TYPE:
- recog_header->media_type = *value;
- break;
- case RECOGNIZER_HEADER_INPUT_WAVEFORM_URI:
- recog_header->input_waveform_uri = *value;
- break;
- case RECOGNIZER_HEADER_COMPLETION_REASON:
- recog_header->completion_reason = *value;
- break;
- case RECOGNIZER_HEADER_VER_BUFFER_UTTERANCE:
- apt_boolean_value_parse(value,&recog_header->ver_buffer_utterance);
- break;
- case RECOGNIZER_HEADER_RECOGNITION_MODE:
- recog_header->recognition_mode = *value;
- break;
- case RECOGNIZER_HEADER_CANCEL_IF_QUEUE:
- apt_boolean_value_parse(value,&recog_header->cancel_if_queue);
- break;
- case RECOGNIZER_HEADER_HOTWORD_MAX_DURATION:
- recog_header->hotword_max_duration = apt_size_value_parse(value);
- break;
- case RECOGNIZER_HEADER_HOTWORD_MIN_DURATION:
- recog_header->hotword_min_duration = apt_size_value_parse(value);
- break;
- case RECOGNIZER_HEADER_INTERPRET_TEXT:
- recog_header->interpret_text = *value;
- break;
- case RECOGNIZER_HEADER_DTMF_BUFFER_TIME:
- recog_header->dtmf_buffer_time = apt_size_value_parse(value);
- break;
- case RECOGNIZER_HEADER_CLEAR_DTMF_BUFFER:
- apt_boolean_value_parse(value,&recog_header->clear_dtmf_buffer);
- break;
- case RECOGNIZER_HEADER_EARLY_NO_MATCH:
- apt_boolean_value_parse(value,&recog_header->early_no_match);
- break;
- case RECOGNIZER_HEADER_NUM_MIN_CONSISTENT_PRONUNCIATIONS:
- recog_header->num_min_consistent_pronunciations = apt_size_value_parse(value);
- break;
- case RECOGNIZER_HEADER_CONSISTENCY_THRESHOLD:
- recog_header->consistency_threshold = apt_float_value_parse(value);
- break;
- case RECOGNIZER_HEADER_CLASH_THRESHOLD:
- recog_header->clash_threshold = apt_float_value_parse(value);
- break;
- case RECOGNIZER_HEADER_PERSONAL_GRAMMAR_URI:
- recog_header->personal_grammar_uri = *value;
- break;
- case RECOGNIZER_HEADER_ENROLL_UTTERANCE:
- apt_boolean_value_parse(value,&recog_header->enroll_utterance);
- break;
- case RECOGNIZER_HEADER_PHRASE_ID:
- recog_header->phrase_id = *value;
- break;
- case RECOGNIZER_HEADER_PHRASE_NL:
- recog_header->phrase_nl = *value;
- break;
- case RECOGNIZER_HEADER_WEIGHT:
- recog_header->weight = apt_float_value_parse(value);
- break;
- case RECOGNIZER_HEADER_SAVE_BEST_WAVEFORM:
- apt_boolean_value_parse(value,&recog_header->save_best_waveform);
- break;
- case RECOGNIZER_HEADER_NEW_PHRASE_ID:
- recog_header->new_phrase_id = *value;
- break;
- case RECOGNIZER_HEADER_CONFUSABLE_PHRASES_URI:
- recog_header->confusable_phrases_uri = *value;
- break;
- case RECOGNIZER_HEADER_ABORT_PHRASE_ENROLLMENT:
- apt_boolean_value_parse(value,&recog_header->abort_phrase_enrollment);
- break;
- default:
- status = FALSE;
- }
- return status;
-}
-
-static APR_INLINE float apt_size_value_parse_as_float(const apt_str_t *value)
-{
- float f = (float)apt_size_value_parse(value);
- return f / 100;
-}
-
-static APR_INLINE apt_bool_t apt_size_value_generate_from_float(float value, apt_str_t *str, apr_pool_t *pool)
-{
- apr_size_t s = (apr_size_t)((value + 0.001f) * 100);
- return apt_size_value_generate(s,str,pool);
-}
-
-/** Parse MRCPv1 recognizer header */
-static apt_bool_t mrcp_v1_recog_header_parse(mrcp_header_accessor_t *accessor, apr_size_t id, const apt_str_t *value, apr_pool_t *pool)
-{
- mrcp_recog_header_t *recog_header = accessor->data;
- if(id == RECOGNIZER_HEADER_CONFIDENCE_THRESHOLD) {
- recog_header->confidence_threshold = apt_size_value_parse_as_float(value);
- return TRUE;
- }
- else if(id == RECOGNIZER_HEADER_SENSITIVITY_LEVEL) {
- recog_header->sensitivity_level = apt_size_value_parse_as_float(value);
- return TRUE;
- }
- else if(id == RECOGNIZER_HEADER_SPEED_VS_ACCURACY) {
- recog_header->speed_vs_accuracy = apt_size_value_parse_as_float(value);
- return TRUE;
- }
- return mrcp_recog_header_parse(recog_header,id,value,pool);
-}
-
-/** Parse MRCPv2 recognizer header */
-static apt_bool_t mrcp_v2_recog_header_parse(mrcp_header_accessor_t *accessor, apr_size_t id, const apt_str_t *value, apr_pool_t *pool)
-{
- mrcp_recog_header_t *recog_header = accessor->data;
- if(id == RECOGNIZER_HEADER_CONFIDENCE_THRESHOLD) {
- recog_header->confidence_threshold = apt_float_value_parse(value);
- return TRUE;
- }
- else if(id == RECOGNIZER_HEADER_SENSITIVITY_LEVEL) {
- recog_header->sensitivity_level = apt_float_value_parse(value);
- return TRUE;
- }
- else if(id == RECOGNIZER_HEADER_SPEED_VS_ACCURACY) {
- recog_header->speed_vs_accuracy = apt_float_value_parse(value);
- return TRUE;
- }
- return mrcp_recog_header_parse(recog_header,id,value,pool);
-}
-
-/** Generate MRCP recognizer header */
-static apt_bool_t mrcp_recog_header_generate(const mrcp_recog_header_t *recog_header, apr_size_t id, apt_str_t *value, apr_pool_t *pool)
-{
- switch(id) {
- case RECOGNIZER_HEADER_N_BEST_LIST_LENGTH:
- apt_size_value_generate(recog_header->n_best_list_length,value,pool);
- break;
- case RECOGNIZER_HEADER_NO_INPUT_TIMEOUT:
- apt_size_value_generate(recog_header->no_input_timeout,value,pool);
- break;
- case RECOGNIZER_HEADER_RECOGNITION_TIMEOUT:
- apt_size_value_generate(recog_header->recognition_timeout,value,pool);
- break;
- case RECOGNIZER_HEADER_WAVEFORM_URI:
- *value = recog_header->waveform_uri;
- break;
- case RECOGNIZER_HEADER_RECOGNIZER_CONTEXT_BLOCK:
- *value = recog_header->recognizer_context_block;
- break;
- case RECOGNIZER_HEADER_START_INPUT_TIMERS:
- apt_boolean_value_generate(recog_header->start_input_timers,value,pool);
- break;
- case RECOGNIZER_HEADER_SPEECH_COMPLETE_TIMEOUT:
- apt_size_value_generate(recog_header->speech_complete_timeout,value,pool);
- break;
- case RECOGNIZER_HEADER_SPEECH_INCOMPLETE_TIMEOUT:
- apt_size_value_generate(recog_header->speech_incomplete_timeout,value,pool);
- break;
- case RECOGNIZER_HEADER_DTMF_INTERDIGIT_TIMEOUT:
- apt_size_value_generate(recog_header->dtmf_interdigit_timeout,value,pool);
- break;
- case RECOGNIZER_HEADER_DTMF_TERM_TIMEOUT:
- apt_size_value_generate(recog_header->dtmf_term_timeout,value,pool);
- break;
- case RECOGNIZER_HEADER_DTMF_TERM_CHAR:
- value->length = 1;
- value->buf = apr_palloc(pool,value->length);
- *value->buf = recog_header->dtmf_term_char;
- break;
- case RECOGNIZER_HEADER_FAILED_URI:
- *value = recog_header->failed_uri;
- break;
- case RECOGNIZER_HEADER_FAILED_URI_CAUSE:
- *value = recog_header->failed_uri_cause;
- break;
- case RECOGNIZER_HEADER_SAVE_WAVEFORM:
- apt_boolean_value_generate(recog_header->save_waveform,value,pool);
- break;
- case RECOGNIZER_HEADER_NEW_AUDIO_CHANNEL:
- apt_boolean_value_generate(recog_header->new_audio_channel,value,pool);
- break;
- case RECOGNIZER_HEADER_SPEECH_LANGUAGE:
- *value = recog_header->speech_language;
- break;
- case RECOGNIZER_HEADER_INPUT_TYPE:
- *value = recog_header->input_type;
- break;
- case RECOGNIZER_HEADER_INPUT_WAVEFORM_URI:
- *value = recog_header->input_waveform_uri;
- break;
- case RECOGNIZER_HEADER_COMPLETION_REASON:
- *value = recog_header->completion_reason;
- break;
- case RECOGNIZER_HEADER_MEDIA_TYPE:
- *value = recog_header->media_type;
- break;
- case RECOGNIZER_HEADER_VER_BUFFER_UTTERANCE:
- apt_boolean_value_generate(recog_header->ver_buffer_utterance,value,pool);
- break;
- case RECOGNIZER_HEADER_RECOGNITION_MODE:
- *value = recog_header->recognition_mode;
- break;
- case RECOGNIZER_HEADER_CANCEL_IF_QUEUE:
- apt_boolean_value_generate(recog_header->cancel_if_queue,value,pool);
- break;
- case RECOGNIZER_HEADER_HOTWORD_MAX_DURATION:
- apt_size_value_generate(recog_header->hotword_max_duration,value,pool);
- break;
- case RECOGNIZER_HEADER_HOTWORD_MIN_DURATION:
- apt_size_value_generate(recog_header->hotword_min_duration,value,pool);
- break;
- case RECOGNIZER_HEADER_INTERPRET_TEXT:
- *value = recog_header->interpret_text;
- break;
- case RECOGNIZER_HEADER_DTMF_BUFFER_TIME:
- apt_size_value_generate(recog_header->dtmf_buffer_time,value,pool);
- break;
- case RECOGNIZER_HEADER_CLEAR_DTMF_BUFFER:
- apt_boolean_value_generate(recog_header->clear_dtmf_buffer,value,pool);
- break;
- case RECOGNIZER_HEADER_EARLY_NO_MATCH:
- apt_boolean_value_generate(recog_header->early_no_match,value,pool);
- break;
- case RECOGNIZER_HEADER_NUM_MIN_CONSISTENT_PRONUNCIATIONS:
- apt_size_value_generate(recog_header->num_min_consistent_pronunciations,value,pool);
- break;
- case RECOGNIZER_HEADER_CONSISTENCY_THRESHOLD:
- apt_float_value_generate(recog_header->consistency_threshold,value,pool);
- break;
- case RECOGNIZER_HEADER_CLASH_THRESHOLD:
- apt_float_value_generate(recog_header->clash_threshold,value,pool);
- break;
- case RECOGNIZER_HEADER_PERSONAL_GRAMMAR_URI:
- *value = recog_header->personal_grammar_uri;
- break;
- case RECOGNIZER_HEADER_ENROLL_UTTERANCE:
- apt_boolean_value_generate(recog_header->enroll_utterance,value,pool);
- break;
- case RECOGNIZER_HEADER_PHRASE_ID:
- *value = recog_header->phrase_id;
- break;
- case RECOGNIZER_HEADER_PHRASE_NL:
- *value = recog_header->phrase_nl;
- break;
- case RECOGNIZER_HEADER_WEIGHT:
- apt_float_value_generate(recog_header->weight,value,pool);
- break;
- case RECOGNIZER_HEADER_SAVE_BEST_WAVEFORM:
- apt_boolean_value_generate(recog_header->save_best_waveform,value,pool);
- break;
- case RECOGNIZER_HEADER_NEW_PHRASE_ID:
- *value = recog_header->new_phrase_id;
- break;
- case RECOGNIZER_HEADER_CONFUSABLE_PHRASES_URI:
- *value = recog_header->confusable_phrases_uri;
- break;
- case RECOGNIZER_HEADER_ABORT_PHRASE_ENROLLMENT:
- apt_boolean_value_generate(recog_header->abort_phrase_enrollment,value,pool);
- break;
- default:
- break;
- }
- return TRUE;
-}
-
-/** Generate MRCPv1 recognizer header */
-static apt_bool_t mrcp_v1_recog_header_generate(const mrcp_header_accessor_t *accessor, apr_size_t id, apt_str_t *value, apr_pool_t *pool)
-{
- mrcp_recog_header_t *recog_header = accessor->data;
- if(id == RECOGNIZER_HEADER_CONFIDENCE_THRESHOLD) {
- return apt_size_value_generate_from_float(recog_header->confidence_threshold,value,pool);
- }
- else if(id == RECOGNIZER_HEADER_SENSITIVITY_LEVEL) {
- return apt_size_value_generate_from_float(recog_header->sensitivity_level,value,pool);
- }
- else if(id == RECOGNIZER_HEADER_SPEED_VS_ACCURACY) {
- return apt_size_value_generate_from_float(recog_header->speed_vs_accuracy,value,pool);
- }
- else if(id == RECOGNIZER_HEADER_COMPLETION_CAUSE) {
- return apt_completion_cause_generate(
- v1_completion_cause_string_table,
- RECOGNIZER_COMPLETION_CAUSE_COUNT,
- recog_header->completion_cause,
- value,
- pool);
- }
- return mrcp_recog_header_generate(recog_header,id,value,pool);
-}
-
-/** Generate MRCPv2 recognizer header */
-static apt_bool_t mrcp_v2_recog_header_generate(const mrcp_header_accessor_t *accessor, apr_size_t id, apt_str_t *value, apr_pool_t *pool)
-{
- mrcp_recog_header_t *recog_header = accessor->data;
- if(id == RECOGNIZER_HEADER_CONFIDENCE_THRESHOLD) {
- return apt_float_value_generate(recog_header->confidence_threshold,value,pool);
- }
- else if(id == RECOGNIZER_HEADER_SENSITIVITY_LEVEL) {
- return apt_float_value_generate(recog_header->sensitivity_level,value,pool);
- }
- else if(id == RECOGNIZER_HEADER_SPEED_VS_ACCURACY) {
- return apt_float_value_generate(recog_header->speed_vs_accuracy,value,pool);
- }
- else if(id == RECOGNIZER_HEADER_COMPLETION_CAUSE) {
- return apt_completion_cause_generate(
- v2_completion_cause_string_table,
- RECOGNIZER_COMPLETION_CAUSE_COUNT,
- recog_header->completion_cause,
- value,
- pool);
- }
- return mrcp_recog_header_generate(recog_header,id,value,pool);
-}
-
-/** Duplicate MRCP recognizer header */
-static apt_bool_t mrcp_recog_header_duplicate(mrcp_header_accessor_t *accessor, const mrcp_header_accessor_t *src, apr_size_t id, const apt_str_t *value, apr_pool_t *pool)
-{
- mrcp_recog_header_t *recog_header = accessor->data;
- const mrcp_recog_header_t *src_recog_header = src->data;
- apt_bool_t status = TRUE;
-
- if(!recog_header || !src_recog_header) {
- return FALSE;
- }
-
- switch(id) {
- case RECOGNIZER_HEADER_CONFIDENCE_THRESHOLD:
- recog_header->confidence_threshold = src_recog_header->confidence_threshold;
- break;
- case RECOGNIZER_HEADER_SENSITIVITY_LEVEL:
- recog_header->sensitivity_level = src_recog_header->sensitivity_level;
- break;
- case RECOGNIZER_HEADER_SPEED_VS_ACCURACY:
- recog_header->speed_vs_accuracy = src_recog_header->speed_vs_accuracy;
- break;
- case RECOGNIZER_HEADER_N_BEST_LIST_LENGTH:
- recog_header->n_best_list_length = src_recog_header->n_best_list_length;
- break;
- case RECOGNIZER_HEADER_NO_INPUT_TIMEOUT:
- recog_header->no_input_timeout = src_recog_header->no_input_timeout;
- break;
- case RECOGNIZER_HEADER_RECOGNITION_TIMEOUT:
- recog_header->recognition_timeout = src_recog_header->recognition_timeout;
- break;
- case RECOGNIZER_HEADER_WAVEFORM_URI:
- recog_header->waveform_uri = *value;
- break;
- case RECOGNIZER_HEADER_COMPLETION_CAUSE:
- recog_header->completion_cause = src_recog_header->completion_cause;
- break;
- case RECOGNIZER_HEADER_RECOGNIZER_CONTEXT_BLOCK:
- recog_header->recognizer_context_block = *value;
- break;
- case RECOGNIZER_HEADER_START_INPUT_TIMERS:
- recog_header->start_input_timers = src_recog_header->start_input_timers;
- break;
- case RECOGNIZER_HEADER_SPEECH_COMPLETE_TIMEOUT:
- recog_header->speech_complete_timeout = src_recog_header->speech_complete_timeout;
- break;
- case RECOGNIZER_HEADER_SPEECH_INCOMPLETE_TIMEOUT:
- recog_header->speech_incomplete_timeout = src_recog_header->speech_incomplete_timeout;
- break;
- case RECOGNIZER_HEADER_DTMF_INTERDIGIT_TIMEOUT:
- recog_header->dtmf_interdigit_timeout = src_recog_header->dtmf_interdigit_timeout;
- break;
- case RECOGNIZER_HEADER_DTMF_TERM_TIMEOUT:
- recog_header->dtmf_term_timeout = src_recog_header->dtmf_term_timeout;
- break;
- case RECOGNIZER_HEADER_DTMF_TERM_CHAR:
- recog_header->dtmf_term_char = src_recog_header->dtmf_term_char;
- break;
- case RECOGNIZER_HEADER_FAILED_URI:
- recog_header->failed_uri = *value;
- break;
- case RECOGNIZER_HEADER_FAILED_URI_CAUSE:
- recog_header->failed_uri_cause = *value;
- break;
- case RECOGNIZER_HEADER_SAVE_WAVEFORM:
- recog_header->save_waveform = src_recog_header->save_waveform;
- break;
- case RECOGNIZER_HEADER_NEW_AUDIO_CHANNEL:
- recog_header->new_audio_channel = src_recog_header->new_audio_channel;
- break;
- case RECOGNIZER_HEADER_SPEECH_LANGUAGE:
- recog_header->speech_language = *value;
- break;
- case RECOGNIZER_HEADER_INPUT_TYPE:
- recog_header->input_type = *value;
- break;
- case RECOGNIZER_HEADER_INPUT_WAVEFORM_URI:
- recog_header->input_waveform_uri = *value;
- break;
- case RECOGNIZER_HEADER_COMPLETION_REASON:
- recog_header->completion_reason = *value;
- break;
- case RECOGNIZER_HEADER_MEDIA_TYPE:
- recog_header->media_type = *value;
- break;
- case RECOGNIZER_HEADER_VER_BUFFER_UTTERANCE:
- recog_header->ver_buffer_utterance = src_recog_header->ver_buffer_utterance;
- break;
- case RECOGNIZER_HEADER_RECOGNITION_MODE:
- recog_header->recognition_mode = *value;
- break;
- case RECOGNIZER_HEADER_CANCEL_IF_QUEUE:
- recog_header->cancel_if_queue = src_recog_header->cancel_if_queue;
- break;
- case RECOGNIZER_HEADER_HOTWORD_MAX_DURATION:
- recog_header->hotword_max_duration = src_recog_header->hotword_max_duration;
- break;
- case RECOGNIZER_HEADER_HOTWORD_MIN_DURATION:
- recog_header->hotword_min_duration = src_recog_header->hotword_min_duration;
- break;
- case RECOGNIZER_HEADER_INTERPRET_TEXT:
- recog_header->interpret_text = *value;
- break;
- case RECOGNIZER_HEADER_DTMF_BUFFER_TIME:
- recog_header->dtmf_buffer_time = src_recog_header->dtmf_buffer_time;
- break;
- case RECOGNIZER_HEADER_CLEAR_DTMF_BUFFER:
- recog_header->clear_dtmf_buffer = src_recog_header->clear_dtmf_buffer;
- break;
- case RECOGNIZER_HEADER_EARLY_NO_MATCH:
- recog_header->early_no_match = src_recog_header->early_no_match;
- break;
- case RECOGNIZER_HEADER_NUM_MIN_CONSISTENT_PRONUNCIATIONS:
- recog_header->num_min_consistent_pronunciations = src_recog_header->num_min_consistent_pronunciations;
- break;
- case RECOGNIZER_HEADER_CONSISTENCY_THRESHOLD:
- recog_header->consistency_threshold = src_recog_header->consistency_threshold;
- break;
- case RECOGNIZER_HEADER_CLASH_THRESHOLD:
- recog_header->clash_threshold = src_recog_header->clash_threshold;
- break;
- case RECOGNIZER_HEADER_PERSONAL_GRAMMAR_URI:
- recog_header->personal_grammar_uri = *value;
- break;
- case RECOGNIZER_HEADER_ENROLL_UTTERANCE:
- recog_header->enroll_utterance = src_recog_header->enroll_utterance;
- break;
- case RECOGNIZER_HEADER_PHRASE_ID:
- recog_header->phrase_id = *value;
- break;
- case RECOGNIZER_HEADER_PHRASE_NL:
- recog_header->phrase_nl = *value;
- break;
- case RECOGNIZER_HEADER_WEIGHT:
- recog_header->weight = src_recog_header->weight;
- break;
- case RECOGNIZER_HEADER_SAVE_BEST_WAVEFORM:
- recog_header->save_best_waveform = src_recog_header->save_best_waveform;
- break;
- case RECOGNIZER_HEADER_NEW_PHRASE_ID:
- recog_header->new_phrase_id = *value;
- break;
- case RECOGNIZER_HEADER_CONFUSABLE_PHRASES_URI:
- recog_header->confusable_phrases_uri = *value;
- break;
- case RECOGNIZER_HEADER_ABORT_PHRASE_ENROLLMENT:
- recog_header->abort_phrase_enrollment = src_recog_header->abort_phrase_enrollment;
- break;
- default:
- status = FALSE;
- }
- return status;
-}
-
-static const mrcp_header_vtable_t v1_vtable = {
- mrcp_recog_header_allocate,
- NULL, /* nothing to destroy */
- mrcp_v1_recog_header_parse,
- mrcp_v1_recog_header_generate,
- mrcp_recog_header_duplicate,
- v1_recog_header_string_table,
- RECOGNIZER_HEADER_COUNT
-};
-
-static const mrcp_header_vtable_t v2_vtable = {
- mrcp_recog_header_allocate,
- NULL, /* nothing to destroy */
- mrcp_v2_recog_header_parse,
- mrcp_v2_recog_header_generate,
- mrcp_recog_header_duplicate,
- v2_recog_header_string_table,
- RECOGNIZER_HEADER_COUNT
-};
-
-const mrcp_header_vtable_t* mrcp_recog_header_vtable_get(mrcp_version_e version)
-{
- if(version == MRCP_VERSION_1) {
- return &v1_vtable;
- }
- return &v2_vtable;
-}
-
-MRCP_DECLARE(const apt_str_t*) mrcp_recog_completion_cause_get(mrcp_recog_completion_cause_e completion_cause, mrcp_version_e version)
-{
- const apt_str_table_item_t *table = v2_completion_cause_string_table;
- if(version == MRCP_VERSION_1) {
- table = v1_completion_cause_string_table;
- }
-
- return apt_string_table_str_get(table,RECOGNIZER_COMPLETION_CAUSE_COUNT,completion_cause);
-}
diff --git a/libs/unimrcp/libs/mrcp/resources/src/mrcp_recog_resource.c b/libs/unimrcp/libs/mrcp/resources/src/mrcp_recog_resource.c
deleted file mode 100644
index 83a1a4e83e..0000000000
--- a/libs/unimrcp/libs/mrcp/resources/src/mrcp_recog_resource.c
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_recog_resource.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include "mrcp_recog_resource.h"
-#include "mrcp_recog_header.h"
-#include "mrcp_resource.h"
-
-/** String table of MRCP recognizer methods (mrcp_recognizer_method_id) */
-static const apt_str_table_item_t v1_recog_method_string_table[] = {
- {{"SET-PARAMS", 10},10},
- {{"GET-PARAMS", 10},10},
- {{"DEFINE-GRAMMAR", 14},2},
- {{"RECOGNIZE", 9},7},
- {{"INTERPRET", 9},0},
- {{"GET-RESULT", 10},6},
- {{"RECOGNITION-START-TIMERS", 24},7},
- {{"STOP", 4},2},
- {{"START-PHRASE-ENROLLMENT", 23},2},
- {{"ENROLLMENT-ROLLBACK", 19},2},
- {{"END-PHRASE-ENROLLMENT", 21},5},
- {{"MODIFY-PHRASE", 13},0},
- {{"DELETE-PHRASE", 13},2}
-};
-
-/** String table of MRCPv2 recognizer methods (mrcp_recognizer_method_id) */
-static const apt_str_table_item_t v2_recog_method_string_table[] = {
- {{"SET-PARAMS", 10},10},
- {{"GET-PARAMS", 10},10},
- {{"DEFINE-GRAMMAR", 14},2},
- {{"RECOGNIZE", 9},0},
- {{"INTERPRET", 9},0},
- {{"GET-RESULT", 10},6},
- {{"START-INPUT-TIMERS", 18},7},
- {{"STOP", 4},2},
- {{"START-PHRASE-ENROLLMENT", 23},6},
- {{"ENROLLMENT-ROLLBACK", 19},2},
- {{"END-PHRASE-ENROLLMENT", 21},5},
- {{"MODIFY-PHRASE", 13},0},
- {{"DELETE-PHRASE", 13},2}
-};
-
-/** String table of MRCP recognizer events (mrcp_recognizer_event_id) */
-static const apt_str_table_item_t v1_recog_event_string_table[] = {
- {{"START-OF-SPEECH", 15},0},
- {{"RECOGNITION-COMPLETE", 20},0},
- {{"INTERPRETATION-COMPLETE", 23},0}
-};
-
-/** String table of MRCPv2 recognizer events (mrcp_recognizer_event_id) */
-static const apt_str_table_item_t v2_recog_event_string_table[] = {
- {{"START-OF-INPUT", 14},0},
- {{"RECOGNITION-COMPLETE", 20},0},
- {{"INTERPRETATION-COMPLETE", 23},0}
-};
-
-
-static APR_INLINE const apt_str_table_item_t* recog_method_string_table_get(mrcp_version_e version)
-{
- if(version == MRCP_VERSION_1) {
- return v1_recog_method_string_table;
- }
- return v2_recog_method_string_table;
-}
-
-static APR_INLINE const apt_str_table_item_t* recog_event_string_table_get(mrcp_version_e version)
-{
- if(version == MRCP_VERSION_1) {
- return v1_recog_event_string_table;
- }
- return v2_recog_event_string_table;
-}
-
-/** Create MRCP recognizer resource */
-MRCP_DECLARE(mrcp_resource_t*) mrcp_recog_resource_create(apr_pool_t *pool)
-{
- mrcp_resource_t *resource = mrcp_resource_create(pool);
-
- resource->method_count = RECOGNIZER_METHOD_COUNT;
- resource->event_count = RECOGNIZER_EVENT_COUNT;
- resource->get_method_str_table = recog_method_string_table_get;
- resource->get_event_str_table = recog_event_string_table_get;
- resource->get_resource_header_vtable = mrcp_recog_header_vtable_get;
- return resource;
-}
diff --git a/libs/unimrcp/libs/mrcp/resources/src/mrcp_recorder_header.c b/libs/unimrcp/libs/mrcp/resources/src/mrcp_recorder_header.c
deleted file mode 100644
index 85f619524a..0000000000
--- a/libs/unimrcp/libs/mrcp/resources/src/mrcp_recorder_header.c
+++ /dev/null
@@ -1,282 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_recorder_header.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include "mrcp_recorder_header.h"
-
-/** String table of recorder header fields (mrcp_recorder_header_id) */
-static const apt_str_table_item_t recorder_header_string_table[] = {
- {{"Sensitivity-Level", 17},3},
- {{"No-Input-Timeout", 16},2},
- {{"Completion-Cause", 16},16},
- {{"Completion-Reason", 17},11},
- {{"Failed-Uri", 10},10},
- {{"Failed-Uri-Cause", 16},16},
- {{"Record-Uri", 10},0},
- {{"Media-Type", 10},2},
- {{"Max-Time", 8},2},
- {{"Trim-Length", 11},0},
- {{"Final-Silence", 13},1},
- {{"Capture-On-Speech", 17},2},
- {{"Ver-Buffer-Utterance", 20},0},
- {{"Start-Input-Timers", 18},1},
- {{"New-Audio-Channel", 17},2}
-};
-
-/** String table of recorder completion-cause fields (mrcp_recorder_completion_cause_e) */
-static const apt_str_table_item_t completion_cause_string_table[] = {
- {{"success-silence", 15},8},
- {{"success-maxtime", 15},8},
- {{"no-input-timeout", 16},0},
- {{"uri-failure", 11},0},
- {{"error", 5},0}
-};
-
-
-/** Initialize recorder header */
-static void mrcp_recorder_header_init(mrcp_recorder_header_t *recorder_header)
-{
- recorder_header->sensitivity_level = 0.0;
- recorder_header->no_input_timeout = 0;
- recorder_header->completion_cause = RECORDER_COMPLETION_CAUSE_COUNT;
- apt_string_reset(&recorder_header->completion_reason);
- apt_string_reset(&recorder_header->failed_uri);
- apt_string_reset(&recorder_header->failed_uri_cause);
- apt_string_reset(&recorder_header->record_uri);
- apt_string_reset(&recorder_header->media_type);
- recorder_header->max_time = 0;
- recorder_header->trim_length = 0;
- recorder_header->final_silence = 0;
- recorder_header->capture_on_speech = FALSE;
- recorder_header->ver_buffer_utterance = FALSE;
- recorder_header->start_input_timers = FALSE;
- recorder_header->new_audio_channel = FALSE;
-}
-
-/** Allocate MRCP recorder header */
-static void* mrcp_recorder_header_allocate(mrcp_header_accessor_t *accessor, apr_pool_t *pool)
-{
- mrcp_recorder_header_t *recorder_header = apr_palloc(pool,sizeof(mrcp_recorder_header_t));
- mrcp_recorder_header_init(recorder_header);
- accessor->data = recorder_header;
- return accessor->data;
-}
-
-/** Parse MRCP recorder header */
-static apt_bool_t mrcp_recorder_header_parse(mrcp_header_accessor_t *accessor, apr_size_t id, const apt_str_t *value, apr_pool_t *pool)
-{
- apt_bool_t status = TRUE;
- mrcp_recorder_header_t *recorder_header = accessor->data;
- switch(id) {
- case RECORDER_HEADER_SENSITIVITY_LEVEL:
- recorder_header->sensitivity_level = apt_float_value_parse(value);
- break;
- case RECORDER_HEADER_NO_INPUT_TIMEOUT:
- recorder_header->no_input_timeout = apt_size_value_parse(value);
- break;
- case RECORDER_HEADER_COMPLETION_CAUSE:
- recorder_header->completion_cause = apt_size_value_parse(value);
- break;
- case RECORDER_HEADER_COMPLETION_REASON:
- recorder_header->completion_reason = *value;
- break;
- case RECORDER_HEADER_FAILED_URI:
- recorder_header->failed_uri = *value;
- break;
- case RECORDER_HEADER_FAILED_URI_CAUSE:
- recorder_header->failed_uri_cause = *value;
- break;
- case RECORDER_HEADER_RECORD_URI:
- recorder_header->record_uri = *value;
- break;
- case RECORDER_HEADER_MEDIA_TYPE:
- recorder_header->media_type = *value;
- break;
- case RECORDER_HEADER_MAX_TIME:
- recorder_header->max_time = apt_size_value_parse(value);
- break;
- case RECORDER_HEADER_TRIM_LENGTH:
- recorder_header->trim_length = apt_size_value_parse(value);
- break;
- case RECORDER_HEADER_FINAL_SILENCE:
- recorder_header->final_silence = apt_size_value_parse(value);
- break;
- case RECORDER_HEADER_CAPTURE_ON_SPEECH:
- apt_boolean_value_parse(value,&recorder_header->capture_on_speech);
- break;
- case RECORDER_HEADER_VER_BUFFER_UTTERANCE:
- apt_boolean_value_parse(value,&recorder_header->ver_buffer_utterance);
- break;
- case RECORDER_HEADER_START_INPUT_TIMERS:
- apt_boolean_value_parse(value,&recorder_header->start_input_timers);
- break;
- case RECORDER_HEADER_NEW_AUDIO_CHANNEL:
- apt_boolean_value_parse(value,&recorder_header->new_audio_channel);
- break;
- default:
- status = FALSE;
- }
- return status;
-}
-
-/** Generate MRCP recorder header */
-static apt_bool_t mrcp_recorder_header_generate(const mrcp_header_accessor_t *accessor, apr_size_t id, apt_str_t *value, apr_pool_t *pool)
-{
- mrcp_recorder_header_t *recorder_header = accessor->data;
- switch(id) {
- case RECORDER_HEADER_SENSITIVITY_LEVEL:
- apt_float_value_generate(recorder_header->sensitivity_level,value,pool);
- break;
- case RECORDER_HEADER_NO_INPUT_TIMEOUT:
- apt_size_value_generate(recorder_header->no_input_timeout,value,pool);
- break;
- case RECORDER_HEADER_COMPLETION_CAUSE:
- {
- apt_completion_cause_generate(
- completion_cause_string_table,
- RECORDER_COMPLETION_CAUSE_COUNT,
- recorder_header->completion_cause,
- value,
- pool);
- break;
- }
- case RECORDER_HEADER_COMPLETION_REASON:
- *value = recorder_header->completion_reason;
- break;
- case RECORDER_HEADER_FAILED_URI:
- *value = recorder_header->failed_uri;
- break;
- case RECORDER_HEADER_FAILED_URI_CAUSE:
- *value = recorder_header->failed_uri_cause;
- break;
- case RECORDER_HEADER_RECORD_URI:
- *value = recorder_header->record_uri;
- break;
- case RECORDER_HEADER_MEDIA_TYPE:
- *value = recorder_header->media_type;
- break;
- case RECORDER_HEADER_MAX_TIME:
- apt_size_value_generate(recorder_header->max_time,value,pool);
- break;
- case RECORDER_HEADER_TRIM_LENGTH:
- apt_size_value_generate(recorder_header->trim_length,value,pool);
- break;
- case RECORDER_HEADER_FINAL_SILENCE:
- apt_size_value_generate(recorder_header->final_silence,value,pool);
- break;
- case RECORDER_HEADER_CAPTURE_ON_SPEECH:
- apt_boolean_value_generate(recorder_header->capture_on_speech,value,pool);
- break;
- case RECORDER_HEADER_VER_BUFFER_UTTERANCE:
- apt_boolean_value_generate(recorder_header->ver_buffer_utterance,value,pool);
- break;
- case RECORDER_HEADER_START_INPUT_TIMERS:
- apt_boolean_value_generate(recorder_header->start_input_timers,value,pool);
- break;
- case RECORDER_HEADER_NEW_AUDIO_CHANNEL:
- apt_boolean_value_generate(recorder_header->new_audio_channel,value,pool);
- break;
- default:
- break;
- }
- return TRUE;
-}
-
-/** Duplicate MRCP recorder header */
-static apt_bool_t mrcp_recorder_header_duplicate(mrcp_header_accessor_t *accessor, const mrcp_header_accessor_t *src, apr_size_t id, const apt_str_t *value, apr_pool_t *pool)
-{
- mrcp_recorder_header_t *recorder_header = accessor->data;
- const mrcp_recorder_header_t *src_recorder_header = src->data;
- apt_bool_t status = TRUE;
-
- if(!recorder_header || !src_recorder_header) {
- return FALSE;
- }
-
- switch(id) {
- case RECORDER_HEADER_SENSITIVITY_LEVEL:
- recorder_header->sensitivity_level = src_recorder_header->sensitivity_level;
- break;
- case RECORDER_HEADER_NO_INPUT_TIMEOUT:
- recorder_header->no_input_timeout = src_recorder_header->no_input_timeout;
- break;
- case RECORDER_HEADER_COMPLETION_CAUSE:
- recorder_header->completion_cause = src_recorder_header->completion_cause;
- break;
- case RECORDER_HEADER_COMPLETION_REASON:
- recorder_header->completion_reason = *value;
- break;
- case RECORDER_HEADER_FAILED_URI:
- recorder_header->failed_uri = *value;
- break;
- case RECORDER_HEADER_FAILED_URI_CAUSE:
- recorder_header->failed_uri_cause = *value;
- break;
- case RECORDER_HEADER_RECORD_URI:
- recorder_header->record_uri = *value;
- break;
- case RECORDER_HEADER_MEDIA_TYPE:
- recorder_header->media_type = *value;
- break;
- case RECORDER_HEADER_MAX_TIME:
- recorder_header->max_time = src_recorder_header->max_time;
- break;
- case RECORDER_HEADER_TRIM_LENGTH:
- recorder_header->trim_length = src_recorder_header->trim_length;
- break;
- case RECORDER_HEADER_FINAL_SILENCE:
- recorder_header->final_silence = src_recorder_header->final_silence;
- break;
- case RECORDER_HEADER_CAPTURE_ON_SPEECH:
- recorder_header->capture_on_speech = src_recorder_header->capture_on_speech;
- break;
- case RECORDER_HEADER_VER_BUFFER_UTTERANCE:
- recorder_header->ver_buffer_utterance = src_recorder_header->ver_buffer_utterance;
- break;
- case RECORDER_HEADER_START_INPUT_TIMERS:
- recorder_header->start_input_timers = src_recorder_header->start_input_timers;
- break;
- case RECORDER_HEADER_NEW_AUDIO_CHANNEL:
- recorder_header->new_audio_channel = src_recorder_header->new_audio_channel;
- break;
- default:
- status = FALSE;
- }
- return status;
-}
-
-static const mrcp_header_vtable_t vtable = {
- mrcp_recorder_header_allocate,
- NULL, /* nothing to destroy */
- mrcp_recorder_header_parse,
- mrcp_recorder_header_generate,
- mrcp_recorder_header_duplicate,
- recorder_header_string_table,
- RECORDER_HEADER_COUNT
-};
-
-const mrcp_header_vtable_t* mrcp_recorder_header_vtable_get(mrcp_version_e version)
-{
- return &vtable;
-}
-
-MRCP_DECLARE(const apt_str_t*) mrcp_recorder_completion_cause_get(
- mrcp_recorder_completion_cause_e completion_cause,
- mrcp_version_e version)
-{
- return apt_string_table_str_get(completion_cause_string_table,RECORDER_COMPLETION_CAUSE_COUNT,completion_cause);
-}
diff --git a/libs/unimrcp/libs/mrcp/resources/src/mrcp_recorder_resource.c b/libs/unimrcp/libs/mrcp/resources/src/mrcp_recorder_resource.c
deleted file mode 100644
index 28f4844f4e..0000000000
--- a/libs/unimrcp/libs/mrcp/resources/src/mrcp_recorder_resource.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_recorder_resource.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include "mrcp_recorder_resource.h"
-#include "mrcp_recorder_header.h"
-#include "mrcp_resource.h"
-
-/** String table of MRCP recorder methods (mrcp_recorder_method_id) */
-static const apt_str_table_item_t recorder_method_string_table[] = {
- {{"SET-PARAMS", 10},10},
- {{"GET-PARAMS", 10},0},
- {{"RECORD", 6},0},
- {{"STOP", 4},2},
- {{"START-INPUT-TIMERS", 18},2}
-};
-
-/** String table of MRCP recorder events (mrcp_recorder_event_id) */
-static const apt_str_table_item_t recorder_event_string_table[] = {
- {{"START-OF-INPUT", 14},0},
- {{"RECORD-COMPLETE", 15},0}
-};
-
-static APR_INLINE const apt_str_table_item_t* recorder_method_string_table_get(mrcp_version_e version)
-{
- return recorder_method_string_table;
-}
-
-static APR_INLINE const apt_str_table_item_t* recorder_event_string_table_get(mrcp_version_e version)
-{
- return recorder_event_string_table;
-}
-
-/** Create MRCP recorder resource */
-MRCP_DECLARE(mrcp_resource_t*) mrcp_recorder_resource_create(apr_pool_t *pool)
-{
- mrcp_resource_t *resource = mrcp_resource_create(pool);
-
- resource->method_count = RECORDER_METHOD_COUNT;
- resource->event_count = RECORDER_EVENT_COUNT;
- resource->get_method_str_table = recorder_method_string_table_get;
- resource->get_event_str_table = recorder_event_string_table_get;
- resource->get_resource_header_vtable = mrcp_recorder_header_vtable_get;
- return resource;
-}
diff --git a/libs/unimrcp/libs/mrcp/resources/src/mrcp_synth_header.c b/libs/unimrcp/libs/mrcp/resources/src/mrcp_synth_header.c
deleted file mode 100644
index 49e8c29ef3..0000000000
--- a/libs/unimrcp/libs/mrcp/resources/src/mrcp_synth_header.c
+++ /dev/null
@@ -1,563 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_synth_header.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include "mrcp_synth_header.h"
-
-/** String table of MRCP synthesizer header fields (mrcp_synthesizer_header_id) */
-static const apt_str_table_item_t synth_header_string_table[] = {
- {{"Jump-Size", 9},0},
- {{"Kill-On-Barge-In", 16},0},
- {{"Speaker-Profile", 15},8},
- {{"Completion-Cause", 16},16},
- {{"Completion-Reason", 17},13},
- {{"Voice-Gender", 12},6},
- {{"Voice-Age", 9},6},
- {{"Voice-Variant", 13},6},
- {{"Voice-Name", 10},8},
- {{"Prosody-Volume", 14},8},
- {{"Prosody-Rate", 12},12},
- {{"Speech-Marker", 13},7},
- {{"Speech-Language", 15},7},
- {{"Fetch-Hint", 10},2},
- {{"Audio-Fetch-Hint", 16},0},
- {{"Failed-Uri", 10},10},
- {{"Failed-Uri_Cause", 16},10},
- {{"Speak-Restart", 13},13},
- {{"Speak-Length", 12},6},
- {{"Load-Lexicon", 12},2},
- {{"Lexicon-Search-Order",20},2}
-};
-
-/** String table of MRCP speech-unit fields (mrcp_speech_unit_t) */
-static const apt_str_table_item_t speech_unit_string_table[] = {
- {{"Second", 6},2},
- {{"Word", 4},0},
- {{"Sentence", 8},2},
- {{"Paragraph",9},0}
-};
-
-/** String table of MRCP voice-gender fields (mrcp_voice_gender_t) */
-static const apt_str_table_item_t voice_gender_string_table[] = {
- {{"male", 4},0},
- {{"female", 6},0},
- {{"neutral",7},0}
-};
-
-/** String table of MRCP prosody-volume fields (mrcp_prosody_volume_t) */
-static const apt_str_table_item_t prosody_volume_string_table[] = {
- {{"silent", 6},1},
- {{"x-soft", 6},2},
- {{"soft", 4},3},
- {{"medium", 6},0},
- {{"loud", 4},0},
- {{"x-loud", 6},5},
- {{"default",7},0}
-};
-
-/** String table of MRCP prosody-rate fields (mrcp_prosody_rate_t) */
-static const apt_str_table_item_t prosody_rate_string_table[] = {
- {{"x-slow", 6},3},
- {{"slow", 4},0},
- {{"medium", 6},0},
- {{"fast", 4},0},
- {{"x-fast", 6},4},
- {{"default",7},0}
-};
-
-/** String table of MRCP synthesizer completion-cause fields (mrcp_synthesizer_completion_cause_t) */
-static const apt_str_table_item_t completion_cause_string_table[] = {
- {{"normal", 6},0},
- {{"barge-in", 8},0},
- {{"parse-failure", 13},0},
- {{"uri-failure", 11},0},
- {{"error", 5},0},
- {{"language-unsupported",20},4},
- {{"lexicon-load-failure",20},1},
- {{"cancelled", 9},0}
-};
-
-
-static APR_INLINE apr_size_t apt_string_table_value_parse(const apt_str_table_item_t *string_table, size_t count, const apt_str_t *value)
-{
- return apt_string_table_id_find(string_table,count,value);
-}
-
-static apt_bool_t apt_string_table_value_pgenerate(const apt_str_table_item_t *string_table, apr_size_t count, apr_size_t id, apt_str_t *str, apr_pool_t *pool)
-{
- const apt_str_t *name = apt_string_table_str_get(string_table,count,id);
- if(!name) {
- return FALSE;
- }
-
- apt_string_copy(str,name,pool);
- return TRUE;
-}
-
-/** Parse MRCP prosody-rate value */
-static apt_bool_t mrcp_prosody_param_rate_parse(mrcp_prosody_rate_t *prosody_rate, const apt_str_t *value, apr_pool_t *pool)
-{
- if(!value->length) {
- return FALSE;
- }
-
- /** For the rate attribute, relative changes are a number. (not preceded by a "+" or "-")(w3c ssml)*/
- if('0'<=value->buf[0] && value->buf[0]<='9') {
- prosody_rate->type = PROSODY_RATE_TYPE_RELATIVE_CHANGE;
- }
- else {
- prosody_rate->type = PROSODY_RATE_TYPE_LABEL;
- }
-
- if(prosody_rate->type == PROSODY_RATE_TYPE_RELATIVE_CHANGE) {
- prosody_rate->value.relative = apt_float_value_parse(value);
- }
- else {
- prosody_rate->value.label = apt_string_table_value_parse(prosody_rate_string_table,PROSODY_RATE_COUNT,value);
- }
-
- return TRUE;
-}
-
-/** Generate MRCP prosody-rate value */
-static apt_bool_t mrcp_prosody_rate_generate(mrcp_prosody_rate_t *prosody_rate, apt_str_t *str, apr_pool_t *pool)
-{
- if(prosody_rate->type == PROSODY_RATE_TYPE_LABEL) {
- apt_string_table_value_pgenerate(
- prosody_rate_string_table,
- PROSODY_RATE_COUNT,
- prosody_rate->value.label,
- str,
- pool);
- }
- else {
- apt_float_value_generate(prosody_rate->value.relative,str,pool);
- }
-
- return TRUE;
-}
-
-/** Parse MRCP prosody-volume value */
-static apt_bool_t mrcp_prosody_param_volume_parse(mrcp_prosody_volume_t *prosody_volume, const apt_str_t *value, apr_pool_t *pool)
-{
- if(!value->length) {
- return FALSE;
- }
-
- /** For the volume attribute, relative changes are a number preceded by "+" or "-" (w3c ssml)*/
- if(value->buf[0]=='+' || value->buf[0]=='-') {
- prosody_volume->type = PROSODY_VOLUME_TYPE_RELATIVE_CHANGE;
- }
- else if('0'<=value->buf[0] && value->buf[0]<='9') {
- prosody_volume->type = PROSODY_VOLUME_TYPE_NUMERIC;
- }
- else {
- prosody_volume->type = PROSODY_VOLUME_TYPE_LABEL;
- }
-
- if(prosody_volume->type == PROSODY_VOLUME_TYPE_RELATIVE_CHANGE) {
- prosody_volume->value.relative = apt_float_value_parse(value);
- }
- else if(prosody_volume->type == PROSODY_VOLUME_TYPE_NUMERIC) {
- prosody_volume->value.numeric = apt_float_value_parse(value);
- }
- else {
- prosody_volume->value.label = apt_string_table_value_parse(prosody_volume_string_table,PROSODY_VOLUME_COUNT,value);
- }
-
- return TRUE;
-}
-
-/** Generate MRCP prosody-volume value */
-static apt_bool_t mrcp_prosody_volume_generate(mrcp_prosody_volume_t *prosody_volume, apt_str_t *str, apr_pool_t *pool)
-{
- if(prosody_volume->type == PROSODY_VOLUME_TYPE_LABEL) {
- apt_string_table_value_pgenerate(
- prosody_volume_string_table,
- PROSODY_VOLUME_COUNT,
- prosody_volume->value.label,
- str,
- pool);
- }
- else if (prosody_volume->type == PROSODY_VOLUME_TYPE_NUMERIC) {
- apt_float_value_generate(prosody_volume->value.numeric,str,pool);
- }
- else {
- apt_float_value_generate(prosody_volume->value.relative,str,pool);
- }
-
- return TRUE;
-}
-
-/** Parse MRCP speech-length value */
-static apt_bool_t mrcp_speech_length_value_parse(mrcp_speech_length_value_t *speech_length, const apt_str_t *value, apr_pool_t *pool)
-{
- if(!value->length) {
- return FALSE;
- }
-
- switch(*value->buf) {
- case '+': speech_length->type = SPEECH_LENGTH_TYPE_NUMERIC_POSITIVE; break;
- case '-': speech_length->type = SPEECH_LENGTH_TYPE_NUMERIC_NEGATIVE; break;
- default : speech_length->type = SPEECH_LENGTH_TYPE_TEXT;
- }
-
- if(speech_length->type == SPEECH_LENGTH_TYPE_TEXT) {
- apt_string_copy(&speech_length->value.tag,value,pool);
- }
- else {
- mrcp_numeric_speech_length_t *numeric = &speech_length->value.numeric;
- apt_str_t str;
- apt_text_stream_t stream;
- stream.text = *value;
- apt_text_stream_reset(&stream);
- stream.pos++;
- if(apt_text_field_read(&stream,APT_TOKEN_SP,TRUE,&str) == FALSE) {
- return FALSE;
- }
- numeric->length = apt_size_value_parse(&str);
-
- if(apt_text_field_read(&stream,APT_TOKEN_SP,TRUE,&str) == FALSE) {
- return FALSE;
- }
- numeric->unit = apt_string_table_value_parse(speech_unit_string_table,SPEECH_UNIT_COUNT,&str);
- }
- return TRUE;
-}
-
-/** Generate MRCP speech-length value */
-static apt_bool_t mrcp_speech_length_generate(mrcp_speech_length_value_t *speech_length, apt_str_t *str, apr_pool_t *pool)
-{
- if(speech_length->type == SPEECH_LENGTH_TYPE_TEXT) {
- apt_str_t *tag = &speech_length->value.tag;
- if(tag->length) {
- apt_string_copy(str,tag,pool);
- }
- }
- else {
- const apt_str_t *unit_name = apt_string_table_str_get(
- speech_unit_string_table,
- SPEECH_UNIT_COUNT,
- speech_length->value.numeric.unit);
- if(!unit_name) {
- return FALSE;
- }
-
- str->buf = apr_psprintf(pool, "%c%"APR_SIZE_T_FMT" %s",
- speech_length->type == SPEECH_LENGTH_TYPE_NUMERIC_POSITIVE ? '+' : '-',
- speech_length->value.numeric.length,
- unit_name->buf);
- str->length = strlen(str->buf);
- }
- return TRUE;
-}
-
-/** Initialize synthesizer header */
-static void mrcp_synth_header_init(mrcp_synth_header_t *synth_header)
-{
- synth_header->jump_size.type = SPEECH_LENGTH_TYPE_UNKNOWN;
- synth_header->kill_on_barge_in = FALSE;
- apt_string_reset(&synth_header->speaker_profile);
- synth_header->completion_cause = SYNTHESIZER_COMPLETION_CAUSE_UNKNOWN;
- apt_string_reset(&synth_header->completion_reason);
- synth_header->voice_param.gender = VOICE_GENDER_UNKNOWN;
- synth_header->voice_param.age = 0;
- synth_header->voice_param.variant = 0;
- apt_string_reset(&synth_header->voice_param.name);
- synth_header->prosody_param.volume.type = PROSODY_VOLUME_TYPE_UNKNOWN;
- synth_header->prosody_param.rate.type = PROSODY_RATE_TYPE_UNKNOWN;
- apt_string_reset(&synth_header->speech_marker);
- apt_string_reset(&synth_header->speech_language);
- apt_string_reset(&synth_header->fetch_hint);
- apt_string_reset(&synth_header->audio_fetch_hint);
- apt_string_reset(&synth_header->failed_uri);
- apt_string_reset(&synth_header->failed_uri_cause);
- synth_header->speak_restart = FALSE;
- synth_header->speak_length.type = SPEECH_LENGTH_TYPE_UNKNOWN;
- synth_header->load_lexicon = FALSE;
- apt_string_reset(&synth_header->lexicon_search_order);
-}
-
-
-/** Allocate MRCP synthesizer header */
-static void* mrcp_synth_header_allocate(mrcp_header_accessor_t *accessor, apr_pool_t *pool)
-{
- mrcp_synth_header_t *synth_header = apr_palloc(pool,sizeof(mrcp_synth_header_t));
- mrcp_synth_header_init(synth_header);
- accessor->data = synth_header;
- return accessor->data;
-}
-
-/** Parse MRCP synthesizer header */
-static apt_bool_t mrcp_synth_header_parse(mrcp_header_accessor_t *accessor, size_t id, const apt_str_t *value, apr_pool_t *pool)
-{
- apt_bool_t status = TRUE;
- mrcp_synth_header_t *synth_header = accessor->data;
- switch(id) {
- case SYNTHESIZER_HEADER_JUMP_SIZE:
- mrcp_speech_length_value_parse(&synth_header->jump_size,value,pool);
- break;
- case SYNTHESIZER_HEADER_KILL_ON_BARGE_IN:
- apt_boolean_value_parse(value,&synth_header->kill_on_barge_in);
- break;
- case SYNTHESIZER_HEADER_SPEAKER_PROFILE:
- synth_header->speaker_profile = *value;
- break;
- case SYNTHESIZER_HEADER_COMPLETION_CAUSE:
- synth_header->completion_cause = apt_size_value_parse(value);
- break;
- case SYNTHESIZER_HEADER_COMPLETION_REASON:
- synth_header->completion_reason = *value;
- break;
- case SYNTHESIZER_HEADER_VOICE_GENDER:
- synth_header->voice_param.gender = apt_string_table_value_parse(voice_gender_string_table,VOICE_GENDER_COUNT,value);
- break;
- case SYNTHESIZER_HEADER_VOICE_AGE:
- synth_header->voice_param.age = apt_size_value_parse(value);
- break;
- case SYNTHESIZER_HEADER_VOICE_VARIANT:
- synth_header->voice_param.variant = apt_size_value_parse(value);
- break;
- case SYNTHESIZER_HEADER_VOICE_NAME:
- synth_header->voice_param.name = *value;
- break;
- case SYNTHESIZER_HEADER_PROSODY_VOLUME:
- mrcp_prosody_param_volume_parse(&synth_header->prosody_param.volume,value,pool);
- break;
- case SYNTHESIZER_HEADER_PROSODY_RATE:
- mrcp_prosody_param_rate_parse(&synth_header->prosody_param.rate,value,pool);
- break;
- case SYNTHESIZER_HEADER_SPEECH_MARKER:
- synth_header->speech_marker = *value;
- break;
- case SYNTHESIZER_HEADER_SPEECH_LANGUAGE:
- synth_header->speech_language = *value;
- break;
- case SYNTHESIZER_HEADER_FETCH_HINT:
- synth_header->fetch_hint = *value;
- break;
- case SYNTHESIZER_HEADER_AUDIO_FETCH_HINT:
- synth_header->audio_fetch_hint = *value;
- break;
- case SYNTHESIZER_HEADER_FAILED_URI:
- synth_header->failed_uri = *value;
- break;
- case SYNTHESIZER_HEADER_FAILED_URI_CAUSE:
- synth_header->failed_uri_cause = *value;
- break;
- case SYNTHESIZER_HEADER_SPEAK_RESTART:
- apt_boolean_value_parse(value,&synth_header->speak_restart);
- break;
- case SYNTHESIZER_HEADER_SPEAK_LENGTH:
- mrcp_speech_length_value_parse(&synth_header->speak_length,value,pool);
- break;
- case SYNTHESIZER_HEADER_LOAD_LEXICON:
- apt_boolean_value_parse(value,&synth_header->load_lexicon);
- break;
- case SYNTHESIZER_HEADER_LEXICON_SEARCH_ORDER:
- synth_header->lexicon_search_order = *value;
- break;
- default:
- status = FALSE;
- }
- return status;
-}
-
-/** Generate MRCP synthesizer header */
-static apt_bool_t mrcp_synth_header_generate(const mrcp_header_accessor_t *accessor, size_t id, apt_str_t *value, apr_pool_t *pool)
-{
- mrcp_synth_header_t *synth_header = accessor->data;
- switch(id) {
- case SYNTHESIZER_HEADER_JUMP_SIZE:
- mrcp_speech_length_generate(&synth_header->jump_size,value,pool);
- break;
- case SYNTHESIZER_HEADER_KILL_ON_BARGE_IN:
- apt_boolean_value_generate(synth_header->kill_on_barge_in,value,pool);
- break;
- case SYNTHESIZER_HEADER_SPEAKER_PROFILE:
- *value = synth_header->speaker_profile,value;
- break;
- case SYNTHESIZER_HEADER_COMPLETION_CAUSE:
- apt_completion_cause_generate(
- completion_cause_string_table,
- SYNTHESIZER_COMPLETION_CAUSE_COUNT,
- synth_header->completion_cause,
- value,
- pool);
- break;
- case SYNTHESIZER_HEADER_COMPLETION_REASON:
- *value = synth_header->completion_reason;
- break;
- case SYNTHESIZER_HEADER_VOICE_GENDER:
- apt_string_table_value_pgenerate(
- voice_gender_string_table,
- VOICE_GENDER_COUNT,
- synth_header->voice_param.gender,
- value,
- pool);
- break;
- case SYNTHESIZER_HEADER_VOICE_AGE:
- apt_size_value_generate(synth_header->voice_param.age,value,pool);
- break;
- case SYNTHESIZER_HEADER_VOICE_VARIANT:
- apt_size_value_generate(synth_header->voice_param.variant,value,pool);
- break;
- case SYNTHESIZER_HEADER_VOICE_NAME:
- *value = synth_header->voice_param.name,value;
- break;
- case SYNTHESIZER_HEADER_PROSODY_VOLUME:
- mrcp_prosody_volume_generate(&synth_header->prosody_param.volume,value,pool);
- break;
- case SYNTHESIZER_HEADER_PROSODY_RATE:
- mrcp_prosody_rate_generate(&synth_header->prosody_param.rate,value,pool);
- break;
- case SYNTHESIZER_HEADER_SPEECH_MARKER:
- *value = synth_header->speech_marker;
- break;
- case SYNTHESIZER_HEADER_SPEECH_LANGUAGE:
- *value = synth_header->speech_language;
- break;
- case SYNTHESIZER_HEADER_FETCH_HINT:
- *value = synth_header->fetch_hint;
- break;
- case SYNTHESIZER_HEADER_AUDIO_FETCH_HINT:
- *value = synth_header->audio_fetch_hint;
- break;
- case SYNTHESIZER_HEADER_FAILED_URI:
- *value = synth_header->failed_uri;
- break;
- case SYNTHESIZER_HEADER_FAILED_URI_CAUSE:
- *value = synth_header->failed_uri_cause;
- break;
- case SYNTHESIZER_HEADER_SPEAK_RESTART:
- apt_boolean_value_generate(synth_header->speak_restart,value,pool);
- break;
- case SYNTHESIZER_HEADER_SPEAK_LENGTH:
- mrcp_speech_length_generate(&synth_header->speak_length,value,pool);
- break;
- case SYNTHESIZER_HEADER_LOAD_LEXICON:
- apt_boolean_value_generate(synth_header->load_lexicon,value,pool);
- break;
- case SYNTHESIZER_HEADER_LEXICON_SEARCH_ORDER:
- *value = synth_header->lexicon_search_order;
- break;
- default:
- break;
- }
- return TRUE;
-}
-
-/** Duplicate MRCP synthesizer header */
-static apt_bool_t mrcp_synth_header_duplicate(mrcp_header_accessor_t *accessor, const mrcp_header_accessor_t *src, size_t id, const apt_str_t *value, apr_pool_t *pool)
-{
- mrcp_synth_header_t *synth_header = accessor->data;
- const mrcp_synth_header_t *src_synth_header = src->data;
- apt_bool_t status = TRUE;
-
- if(!synth_header || !src_synth_header) {
- return FALSE;
- }
-
- switch(id) {
- case SYNTHESIZER_HEADER_JUMP_SIZE:
- synth_header->jump_size = src_synth_header->jump_size;
- break;
- case SYNTHESIZER_HEADER_KILL_ON_BARGE_IN:
- synth_header->kill_on_barge_in = src_synth_header->kill_on_barge_in;
- break;
- case SYNTHESIZER_HEADER_SPEAKER_PROFILE:
- synth_header->speaker_profile = *value;
- break;
- case SYNTHESIZER_HEADER_COMPLETION_CAUSE:
- synth_header->completion_cause = src_synth_header->completion_cause;
- break;
- case SYNTHESIZER_HEADER_COMPLETION_REASON:
- synth_header->completion_reason = *value;
- break;
- case SYNTHESIZER_HEADER_VOICE_GENDER:
- synth_header->voice_param.gender = src_synth_header->voice_param.gender;
- break;
- case SYNTHESIZER_HEADER_VOICE_AGE:
- synth_header->voice_param.age = src_synth_header->voice_param.age;
- break;
- case SYNTHESIZER_HEADER_VOICE_VARIANT:
- synth_header->voice_param.variant = src_synth_header->voice_param.variant;
- break;
- case SYNTHESIZER_HEADER_VOICE_NAME:
- synth_header->voice_param.name = *value;
- break;
- case SYNTHESIZER_HEADER_PROSODY_VOLUME:
- synth_header->prosody_param.volume = src_synth_header->prosody_param.volume;
- break;
- case SYNTHESIZER_HEADER_PROSODY_RATE:
- synth_header->prosody_param.rate = src_synth_header->prosody_param.rate;
- break;
- case SYNTHESIZER_HEADER_SPEECH_MARKER:
- synth_header->speech_marker = *value;
- break;
- case SYNTHESIZER_HEADER_SPEECH_LANGUAGE:
- synth_header->speech_language = *value;
- break;
- case SYNTHESIZER_HEADER_FETCH_HINT:
- synth_header->fetch_hint = *value;
- break;
- case SYNTHESIZER_HEADER_AUDIO_FETCH_HINT:
- synth_header->audio_fetch_hint = *value;
- break;
- case SYNTHESIZER_HEADER_FAILED_URI:
- synth_header->failed_uri = *value;
- break;
- case SYNTHESIZER_HEADER_FAILED_URI_CAUSE:
- synth_header->failed_uri_cause = *value;
- break;
- case SYNTHESIZER_HEADER_SPEAK_RESTART:
- synth_header->speak_restart = src_synth_header->speak_restart;
- break;
- case SYNTHESIZER_HEADER_SPEAK_LENGTH:
- synth_header->speak_length = src_synth_header->speak_length;
- break;
- case SYNTHESIZER_HEADER_LOAD_LEXICON:
- synth_header->load_lexicon = src_synth_header->load_lexicon;
- break;
- case SYNTHESIZER_HEADER_LEXICON_SEARCH_ORDER:
- synth_header->lexicon_search_order = *value;
- break;
- default:
- status = FALSE;
- }
- return status;
-}
-
-static const mrcp_header_vtable_t vtable = {
- mrcp_synth_header_allocate,
- NULL, /* nothing to destroy */
- mrcp_synth_header_parse,
- mrcp_synth_header_generate,
- mrcp_synth_header_duplicate,
- synth_header_string_table,
- SYNTHESIZER_HEADER_COUNT
-};
-
-const mrcp_header_vtable_t* mrcp_synth_header_vtable_get(mrcp_version_e version)
-{
- return &vtable;
-}
-
-MRCP_DECLARE(const apt_str_t*) mrcp_synth_completion_cause_get(mrcp_synth_completion_cause_e completion_cause, mrcp_version_e version)
-{
- return apt_string_table_str_get(completion_cause_string_table,SYNTHESIZER_COMPLETION_CAUSE_COUNT,completion_cause);
-}
diff --git a/libs/unimrcp/libs/mrcp/resources/src/mrcp_synth_resource.c b/libs/unimrcp/libs/mrcp/resources/src/mrcp_synth_resource.c
deleted file mode 100644
index 795672043c..0000000000
--- a/libs/unimrcp/libs/mrcp/resources/src/mrcp_synth_resource.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_synth_resource.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include "mrcp_synth_resource.h"
-#include "mrcp_synth_header.h"
-#include "mrcp_resource.h"
-
-/** String table of MRCP synthesizer methods (mrcp_synthesizer_method_id) */
-static const apt_str_table_item_t synth_method_string_table[] = {
- {{"SET-PARAMS", 10},10},
- {{"GET-PARAMS", 10},0},
- {{"SPEAK", 5},1},
- {{"STOP", 4},1},
- {{"PAUSE", 5},0},
- {{"RESUME", 6},0},
- {{"BARGE-IN-OCCURRED",17},0},
- {{"CONTROL", 7},0},
- {{"DEFINE-LEXICON", 14},0}
-};
-
-/** String table of MRCP synthesizer events (mrcp_synthesizer_event_id) */
-static const apt_str_table_item_t synth_event_string_table[] = {
- {{"SPEECH-MARKER", 13},3},
- {{"SPEAK-COMPLETE",14},3}
-};
-
-static APR_INLINE const apt_str_table_item_t* synth_method_string_table_get(mrcp_version_e version)
-{
- return synth_method_string_table;
-}
-
-static APR_INLINE const apt_str_table_item_t* synth_event_string_table_get(mrcp_version_e version)
-{
- return synth_event_string_table;
-}
-
-/** Create MRCP synthesizer resource */
-MRCP_DECLARE(mrcp_resource_t*) mrcp_synth_resource_create(apr_pool_t *pool)
-{
- mrcp_resource_t *resource = mrcp_resource_create(pool);
-
- resource->method_count = SYNTHESIZER_METHOD_COUNT;
- resource->event_count = SYNTHESIZER_EVENT_COUNT;
- resource->get_method_str_table = synth_method_string_table_get;
- resource->get_event_str_table = synth_event_string_table_get;
- resource->get_resource_header_vtable = mrcp_synth_header_vtable_get;
- return resource;
-}
diff --git a/libs/unimrcp/libs/mrcp/resources/src/mrcp_verifier_header.c b/libs/unimrcp/libs/mrcp/resources/src/mrcp_verifier_header.c
deleted file mode 100644
index a0c32d0424..0000000000
--- a/libs/unimrcp/libs/mrcp/resources/src/mrcp_verifier_header.c
+++ /dev/null
@@ -1,352 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id:
- */
-
-#include "mrcp_verifier_header.h"
-
-/** String table of MRCP verifier header fields (mrcp_verifier_header_id) */
-static const apt_str_table_item_t verifier_header_string_table[] = {
- {{"Repository-URI", 14},0},
- {{"Voiceprint-Identifier", 21},12},
- {{"Verification-Mode", 17},6},
- {{"Adapt-Model", 11},1},
- {{"Abort-Model", 11},11},
- {{"Min-Verification-Score", 22},1},
- {{"Num-Min-Verification-Phrases",28},6},
- {{"Num-Max-Verification-Phrases",28},5},
- {{"No-Input-Timeout", 16},2},
- {{"Save-Waveform", 13},4},
- {{"Media-Type", 10},2},
- {{"Waveform-URI", 12},0},
- {{"Voiceprint-Exists", 17},11},
- {{"Ver-Buffer-Utterance", 20},4},
- {{"Input-Waveform-URI", 18},0},
- {{"Completion-Cause", 16},11},
- {{"Completion-Reason", 17},15},
- {{"Speech-Complete-Timeout", 23},1},
- {{"New-Audio-Channel", 17},2},
- {{"Abort-Verification", 18},6},
- {{"Start-Input-Timers", 18},1}
-};
-
-/** String table of MRCP verifier completion-cause fields (mrcp_verifier_completion_cause_e) */
-static const apt_str_table_item_t completion_cause_string_table[] = {
- {{"success", 7},2},
- {{"error", 5},0},
- {{"no-input-timeout", 16},0},
- {{"too-much-speech-timeout",23},0},
- {{"speech-too-early", 16},9},
- {{"buffer-empty", 12},0},
- {{"out-of-sequence", 15},0},
- {{"repository-uri-failure", 22},15},
- {{"repository-uri-missing", 22},15},
- {{"voiceprint-id-missing", 21},14},
- {{"voiceprint-id-not-exist",23},14},
- {{"speech-not-usable", 17},7}
-};
-
-
-/** Initialize verifier header */
-static void mrcp_verifier_header_init(mrcp_verifier_header_t *verifier_header)
-{
- apt_string_reset(&verifier_header->repository_uri);
- apt_string_reset(&verifier_header->voiceprint_identifier);
- apt_string_reset(&verifier_header->verification_mode);
- verifier_header->adapt_model = FALSE;
- verifier_header->abort_model = FALSE;
- verifier_header->min_verification_score = 0.0;
- verifier_header->num_min_verification_phrases = 0;
- verifier_header->num_max_verification_phrases = 0;
- verifier_header->no_input_timeout = 0;
- verifier_header->save_waveform = FALSE;
- apt_string_reset(&verifier_header->media_type);
- apt_string_reset(&verifier_header->waveform_uri);
- verifier_header->voiceprint_exists = FALSE;
- verifier_header->ver_buffer_utterance = FALSE;
- apt_string_reset(&verifier_header->input_waveform_uri);
- verifier_header->completion_cause = VERIFIER_COMPLETION_CAUSE_UNKNOWN;
- apt_string_reset(&verifier_header->completion_reason);
- verifier_header->speech_complete_timeout = 0;
- verifier_header->new_audio_channel = FALSE;
- verifier_header->abort_verification = FALSE;
- verifier_header->start_input_timers = FALSE;
-}
-
-/** Allocate MRCP verifier header */
-static void* mrcp_verifier_header_allocate(mrcp_header_accessor_t *accessor, apr_pool_t *pool)
-{
- mrcp_verifier_header_t *verifier_header = apr_palloc(pool,sizeof(mrcp_verifier_header_t));
- mrcp_verifier_header_init(verifier_header);
- accessor->data = verifier_header;
- return accessor->data;
-}
-
-/** Parse MRCP verifier header */
-static apt_bool_t mrcp_verifier_header_parse(mrcp_header_accessor_t *accessor, apr_size_t id, const apt_str_t *value, apr_pool_t *pool)
-{
- mrcp_verifier_header_t *verifier_header = accessor->data;
- apt_bool_t status = TRUE;
- switch(id) {
- case VERIFIER_HEADER_REPOSITORY_URI:
- verifier_header->repository_uri = *value;
- break;
- case VERIFIER_HEADER_VOICEPRINT_IDENTIFIER:
- verifier_header->voiceprint_identifier = *value;
- break;
- case VERIFIER_HEADER_VERIFICATION_MODE:
- verifier_header->verification_mode = *value;
- break;
- case VERIFIER_HEADER_ADAPT_MODEL:
- apt_boolean_value_parse(value,&verifier_header->adapt_model);
- break;
- case VERIFIER_HEADER_ABORT_MODEL:
- apt_boolean_value_parse(value,&verifier_header->abort_model);
- break;
- case VERIFIER_HEADER_MIN_VERIFICATION_SCORE:
- verifier_header->min_verification_score = apt_float_value_parse(value);
- break;
- case VERIFIER_HEADER_NUM_MIN_VERIFICATION_PHRASES:
- verifier_header->num_min_verification_phrases = apt_size_value_parse(value);
- break;
- case VERIFIER_HEADER_NUM_MAX_VERIFICATION_PHRASES:
- verifier_header->num_max_verification_phrases = apt_size_value_parse(value);
- break;
- case VERIFIER_HEADER_NO_INPUT_TIMEOUT:
- verifier_header->no_input_timeout = apt_size_value_parse(value);
- break;
- case VERIFIER_HEADER_SAVE_WAVEFORM:
- apt_boolean_value_parse(value,&verifier_header->save_waveform);
- break;
- case VERIFIER_HEADER_MEDIA_TYPE:
- verifier_header->media_type = *value;
- break;
- case VERIFIER_HEADER_WAVEFORM_URI:
- verifier_header->waveform_uri = *value;
- break;
- case VERIFIER_HEADER_VOICEPRINT_EXISTS:
- apt_boolean_value_parse(value,&verifier_header->voiceprint_exists);
- break;
- case VERIFIER_HEADER_VER_BUFFER_UTTERANCE:
- apt_boolean_value_parse(value,&verifier_header->ver_buffer_utterance);
- break;
- case VERIFIER_HEADER_INPUT_WAVEFORM_URI:
- verifier_header->input_waveform_uri = *value;
- break;
- case VERIFIER_HEADER_COMPLETION_CAUSE:
- verifier_header->completion_cause = apt_size_value_parse(value);
- break;
- case VERIFIER_HEADER_COMPLETION_REASON:
- verifier_header->completion_reason = *value;
- break;
- case VERIFIER_HEADER_SPEECH_COMPLETE_TIMEOUT:
- verifier_header->speech_complete_timeout = apt_size_value_parse(value);
- break;
- case VERIFIER_HEADER_NEW_AUDIO_CHANNEL:
- apt_boolean_value_parse(value,&verifier_header->new_audio_channel);
- break;
- case VERIFIER_HEADER_ABORT_VERIFICATION:
- apt_boolean_value_parse(value,&verifier_header->abort_verification);
- break;
- case VERIFIER_HEADER_START_INPUT_TIMERS:
- apt_boolean_value_parse(value,&verifier_header->start_input_timers);
- break;
- default:
- status = FALSE;
- }
- return status;
-}
-
-/** Generate MRCP verifier header */
-static apt_bool_t mrcp_verifier_header_generate(const mrcp_header_accessor_t *accessor, apr_size_t id, apt_str_t *value, apr_pool_t *pool)
-{
- mrcp_verifier_header_t *verifier_header = accessor->data;
- switch(id) {
- case VERIFIER_HEADER_REPOSITORY_URI:
- *value = verifier_header->repository_uri;
- break;
- case VERIFIER_HEADER_VOICEPRINT_IDENTIFIER:
- *value = verifier_header->voiceprint_identifier;
- break;
- case VERIFIER_HEADER_VERIFICATION_MODE:
- *value = verifier_header->verification_mode;
- break;
- case VERIFIER_HEADER_ADAPT_MODEL:
- apt_boolean_value_generate(verifier_header->adapt_model,value,pool);
- break;
- case VERIFIER_HEADER_ABORT_MODEL:
- apt_boolean_value_generate(verifier_header->abort_model,value,pool);
- break;
- case VERIFIER_HEADER_MIN_VERIFICATION_SCORE:
- apt_float_value_generate(verifier_header->min_verification_score,value,pool);
- break;
- case VERIFIER_HEADER_NUM_MIN_VERIFICATION_PHRASES:
- apt_size_value_generate(verifier_header->num_min_verification_phrases,value,pool);
- break;
- case VERIFIER_HEADER_NUM_MAX_VERIFICATION_PHRASES:
- apt_size_value_generate(verifier_header->num_max_verification_phrases,value,pool);
- break;
- case VERIFIER_HEADER_NO_INPUT_TIMEOUT:
- apt_size_value_generate(verifier_header->no_input_timeout,value,pool);
- break;
- case VERIFIER_HEADER_SAVE_WAVEFORM:
- apt_boolean_value_generate(verifier_header->save_waveform,value,pool);
- break;
- case VERIFIER_HEADER_MEDIA_TYPE:
- *value = verifier_header->media_type;
- break;
- case VERIFIER_HEADER_WAVEFORM_URI:
- *value = verifier_header->waveform_uri;
- break;
- case VERIFIER_HEADER_VOICEPRINT_EXISTS:
- apt_boolean_value_generate(verifier_header->voiceprint_exists,value,pool);
- break;
- case VERIFIER_HEADER_VER_BUFFER_UTTERANCE:
- apt_boolean_value_generate(verifier_header->ver_buffer_utterance,value,pool);
- break;
- case VERIFIER_HEADER_INPUT_WAVEFORM_URI:
- *value = verifier_header->input_waveform_uri;
- break;
- case VERIFIER_HEADER_COMPLETION_CAUSE:
- apt_completion_cause_generate(
- completion_cause_string_table,
- VERIFIER_COMPLETION_CAUSE_COUNT,
- verifier_header->completion_cause,
- value,
- pool);
- break;
- case VERIFIER_HEADER_COMPLETION_REASON:
- *value = verifier_header->completion_reason;
- break;
- case VERIFIER_HEADER_SPEECH_COMPLETE_TIMEOUT:
- apt_size_value_generate(verifier_header->speech_complete_timeout,value,pool);
- break;
- case VERIFIER_HEADER_NEW_AUDIO_CHANNEL:
- apt_boolean_value_generate(verifier_header->new_audio_channel,value,pool);
- break;
- case VERIFIER_HEADER_ABORT_VERIFICATION:
- apt_boolean_value_generate(verifier_header->abort_verification,value,pool);
- break;
- case VERIFIER_HEADER_START_INPUT_TIMERS:
- apt_boolean_value_generate(verifier_header->start_input_timers,value,pool);
- break;
- default:
- break;
- }
- return TRUE;
-}
-
-/** Duplicate MRCP verifier header */
-static apt_bool_t mrcp_verifier_header_duplicate(mrcp_header_accessor_t *accessor, const mrcp_header_accessor_t *src, apr_size_t id, const apt_str_t *value, apr_pool_t *pool)
-{
- mrcp_verifier_header_t *verifier_header = accessor->data;
- const mrcp_verifier_header_t *src_verifier_header = src->data;
- apt_bool_t status = TRUE;
-
- if(!verifier_header || !src_verifier_header) {
- return FALSE;
- }
-
- switch(id) {
- case VERIFIER_HEADER_REPOSITORY_URI:
- verifier_header->repository_uri = *value;
- break;
- case VERIFIER_HEADER_VOICEPRINT_IDENTIFIER:
- verifier_header->voiceprint_identifier = *value;
- break;
- case VERIFIER_HEADER_VERIFICATION_MODE:
- verifier_header->verification_mode = *value;
- break;
- case VERIFIER_HEADER_ADAPT_MODEL:
- verifier_header->adapt_model = src_verifier_header->adapt_model;
- break;
- case VERIFIER_HEADER_ABORT_MODEL:
- verifier_header->abort_model = src_verifier_header->abort_model;
- break;
- case VERIFIER_HEADER_MIN_VERIFICATION_SCORE:
- verifier_header->min_verification_score = src_verifier_header->min_verification_score;
- break;
- case VERIFIER_HEADER_NUM_MIN_VERIFICATION_PHRASES:
- verifier_header->num_min_verification_phrases = src_verifier_header->num_min_verification_phrases;
- break;
- case VERIFIER_HEADER_NUM_MAX_VERIFICATION_PHRASES:
- verifier_header->num_max_verification_phrases = src_verifier_header->num_max_verification_phrases;
- break;
- case VERIFIER_HEADER_NO_INPUT_TIMEOUT:
- verifier_header->no_input_timeout = src_verifier_header->no_input_timeout;
- break;
- case VERIFIER_HEADER_SAVE_WAVEFORM:
- verifier_header->save_waveform = src_verifier_header->save_waveform;
- break;
- case VERIFIER_HEADER_MEDIA_TYPE:
- verifier_header->media_type = *value;
- break;
- case VERIFIER_HEADER_WAVEFORM_URI:
- verifier_header->waveform_uri = *value;
- break;
- case VERIFIER_HEADER_VOICEPRINT_EXISTS:
- verifier_header->voiceprint_exists = src_verifier_header->voiceprint_exists;
- break;
- case VERIFIER_HEADER_VER_BUFFER_UTTERANCE:
- verifier_header->ver_buffer_utterance = src_verifier_header->ver_buffer_utterance;
- break;
- case VERIFIER_HEADER_INPUT_WAVEFORM_URI:
- verifier_header->input_waveform_uri = *value;
- break;
- case VERIFIER_HEADER_COMPLETION_CAUSE:
- verifier_header->completion_cause = src_verifier_header->completion_cause;
- break;
- case VERIFIER_HEADER_COMPLETION_REASON:
- verifier_header->completion_reason = *value;
- break;
- case VERIFIER_HEADER_SPEECH_COMPLETE_TIMEOUT:
- verifier_header->speech_complete_timeout = src_verifier_header->speech_complete_timeout;
- break;
- case VERIFIER_HEADER_NEW_AUDIO_CHANNEL:
- verifier_header->new_audio_channel = src_verifier_header->new_audio_channel;
- break;
- case VERIFIER_HEADER_ABORT_VERIFICATION:
- verifier_header->abort_verification = src_verifier_header->abort_verification;
- break;
- case VERIFIER_HEADER_START_INPUT_TIMERS:
- verifier_header->start_input_timers = src_verifier_header->start_input_timers;
- break;
- default:
- status = FALSE;
- }
- return status;
-}
-
-static const mrcp_header_vtable_t header_vtable = {
- mrcp_verifier_header_allocate,
- NULL, /* nothing to destroy */
- mrcp_verifier_header_parse,
- mrcp_verifier_header_generate,
- mrcp_verifier_header_duplicate,
- verifier_header_string_table,
- VERIFIER_HEADER_COUNT
-};
-
-const mrcp_header_vtable_t* mrcp_verifier_header_vtable_get(mrcp_version_e version)
-{
- return &header_vtable;
-}
-
-MRCP_DECLARE(const apt_str_t*) mrcp_verifier_completion_cause_get(mrcp_verifier_completion_cause_e completion_cause, mrcp_version_e version)
-{
- const apt_str_table_item_t *table = completion_cause_string_table;
- return apt_string_table_str_get(table,VERIFIER_COMPLETION_CAUSE_COUNT,completion_cause);
-}
diff --git a/libs/unimrcp/libs/mrcp/resources/src/mrcp_verifier_resource.c b/libs/unimrcp/libs/mrcp/resources/src/mrcp_verifier_resource.c
deleted file mode 100644
index 6f430a6619..0000000000
--- a/libs/unimrcp/libs/mrcp/resources/src/mrcp_verifier_resource.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id:
- */
-
-#include "mrcp_verifier_resource.h"
-#include "mrcp_verifier_header.h"
-#include "mrcp_resource.h"
-
-/** String table of MRCP verifier methods (mrcp_verifier_method_id) */
-static const apt_str_table_item_t verifier_method_string_table[] = {
- {{"SET-PARAMS", 10},10},
- {{"GET-PARAMS", 10},10},
- {{"START-SESSION", 13},8},
- {{"END-SESSION", 11},0},
- {{"QUERY-VOICEPRINT", 16},0},
- {{"DELETE-VOICEPRINT", 17},0},
- {{"VERIFY", 6},6},
- {{"VERIFY-FROM-BUFFER", 18},7},
- {{"VERIFY-ROLLBACK", 15},7},
- {{"STOP", 4},2},
- {{"CLEAR-BUFFER", 12},0},
- {{"START-INPUT-TIMERS", 18},6},
- {{"GET-INTERMEDIATE-RESULT",23},4},
-};
-
-/** String table of MRCP verifier events (mrcp_verifier_event_id) */
-static const apt_str_table_item_t verifier_event_string_table[] = {
- {{"START-OF-INPUT", 14},0},
- {{"VERIFICATION-COMPLETE",21},0},
-};
-
-static APR_INLINE const apt_str_table_item_t* verifier_method_string_table_get(mrcp_version_e version)
-{
- return verifier_method_string_table;
-}
-
-static APR_INLINE const apt_str_table_item_t* verifier_event_string_table_get(mrcp_version_e version)
-{
- return verifier_event_string_table;
-}
-
-
-/** Create MRCP verifier resource */
-MRCP_DECLARE(mrcp_resource_t*) mrcp_verifier_resource_create(apr_pool_t *pool)
-{
- mrcp_resource_t *resource = mrcp_resource_create(pool);
-
- resource->method_count = VERIFIER_METHOD_COUNT;
- resource->event_count = VERIFIER_EVENT_COUNT;
- resource->get_method_str_table = verifier_method_string_table_get;
- resource->get_event_str_table = verifier_event_string_table_get;
- resource->get_resource_header_vtable = mrcp_verifier_header_vtable_get;
- return resource;
-}
diff --git a/libs/unimrcp/libs/mrcpv2-transport/Makefile.am b/libs/unimrcp/libs/mrcpv2-transport/Makefile.am
deleted file mode 100644
index c2ffac4ef0..0000000000
--- a/libs/unimrcp/libs/mrcpv2-transport/Makefile.am
+++ /dev/null
@@ -1,23 +0,0 @@
-MAINTAINERCLEANFILES = Makefile.in
-
-AM_CPPFLAGS = -I$(top_srcdir)/libs/mrcpv2-transport/include \
- -I$(top_srcdir)/libs/mrcp/include \
- -I$(top_srcdir)/libs/mrcp/message/include \
- -I$(top_srcdir)/libs/mrcp/control/include \
- -I$(top_srcdir)/libs/apr-toolkit/include \
- $(UNIMRCP_APR_INCLUDES)
-
-noinst_LTLIBRARIES = libmrcpv2transport.la
-
-include_HEADERS = include/mrcp_connection_types.h \
- include/mrcp_control_descriptor.h \
- include/mrcp_connection.h \
- include/mrcp_client_connection.h \
- include/mrcp_server_connection.h \
- include/mrcp_ca_factory.h
-
-libmrcpv2transport_la_SOURCES = src/mrcp_control_descriptor.c \
- src/mrcp_connection.c \
- src/mrcp_client_connection.c \
- src/mrcp_server_connection.c \
- src/mrcp_ca_factory.c
diff --git a/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_ca_factory.h b/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_ca_factory.h
deleted file mode 100644
index 599a4e60b7..0000000000
--- a/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_ca_factory.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_ca_factory.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MRCP_CA_FACTORY_H
-#define MRCP_CA_FACTORY_H
-
-/**
- * @file mrcp_ca_factory.h
- * @brief Factory of MRCPv2 Connection Agents
- */
-
-#include "mrcp_connection_types.h"
-
-APT_BEGIN_EXTERN_C
-
-/** Create factory of connection agents. */
-MRCP_DECLARE(mrcp_ca_factory_t*) mrcp_ca_factory_create(apr_pool_t *pool);
-
-/** Add connection agent to factory. */
-MRCP_DECLARE(apt_bool_t) mrcp_ca_factory_agent_add(mrcp_ca_factory_t *mpf_factory, mrcp_connection_agent_t *agent);
-
-/** Determine whether factory is empty. */
-MRCP_DECLARE(apt_bool_t) mrcp_ca_factory_is_empty(const mrcp_ca_factory_t *factory);
-
-/** Select next available agent. */
-MRCP_DECLARE(mrcp_connection_agent_t*) mrcp_ca_factory_agent_select(mrcp_ca_factory_t *factory);
-
-APT_END_EXTERN_C
-
-#endif /* MRCP_CA_FACTORY_H */
diff --git a/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_client_connection.h b/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_client_connection.h
deleted file mode 100644
index fd762bb1f9..0000000000
--- a/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_client_connection.h
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_client_connection.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MRCP_CLIENT_CONNECTION_H
-#define MRCP_CLIENT_CONNECTION_H
-
-/**
- * @file mrcp_client_connection.h
- * @brief MRCPv2 Client Connection
- */
-
-#include "apt_task.h"
-#include "mrcp_connection_types.h"
-
-APT_BEGIN_EXTERN_C
-
-/**
- * Create connection agent.
- * @param id the identifier of the agent
- * @param max_connection_count the number of max MRCPv2 connections
- * @param offer_new_connection the connection establishment policy in o/a
- * @param pool the pool to allocate memory from
- */
-MRCP_DECLARE(mrcp_connection_agent_t*) mrcp_client_connection_agent_create(
- const char *id,
- apr_size_t max_connection_count,
- apt_bool_t offer_new_connection,
- apr_pool_t *pool);
-
-/**
- * Destroy connection agent.
- * @param agent the agent to destroy
- */
-MRCP_DECLARE(apt_bool_t) mrcp_client_connection_agent_destroy(mrcp_connection_agent_t *agent);
-
-/**
- * Start connection agent and wait for incoming requests.
- * @param agent the agent to start
- */
-MRCP_DECLARE(apt_bool_t) mrcp_client_connection_agent_start(mrcp_connection_agent_t *agent);
-
-/**
- * Terminate connection agent.
- * @param agent the agent to terminate
- */
-MRCP_DECLARE(apt_bool_t) mrcp_client_connection_agent_terminate(mrcp_connection_agent_t *agent);
-
-
-/**
- * Set connection event handler.
- * @param agent the agent to set event hadler for
- * @param obj the external object to associate with the agent
- * @param vtable the event handler virtual methods
- */
-MRCP_DECLARE(void) mrcp_client_connection_agent_handler_set(
- mrcp_connection_agent_t *agent,
- void *obj,
- const mrcp_connection_event_vtable_t *vtable);
-
-/**
- * Set MRCP resource factory.
- * @param agent the agent to set resource factory for
- * @param resource_factory the MRCP resource factory to set
- */
-MRCP_DECLARE(void) mrcp_client_connection_resource_factory_set(
- mrcp_connection_agent_t *agent,
- const mrcp_resource_factory_t *resource_factory);
-/**
- * Set rx buffer size.
- * @param agent the agent to set buffer size for
- * @param size the size of rx buffer to set
- */
-MRCP_DECLARE(void) mrcp_client_connection_rx_size_set(
- mrcp_connection_agent_t *agent,
- apr_size_t size);
-
-/**
- * Set tx buffer size.
- * @param agent the agent to set buffer size for
- * @param size the size of the rx buffer to set
- */
-MRCP_DECLARE(void) mrcp_client_connection_tx_size_set(
- mrcp_connection_agent_t *agent,
- apr_size_t size);
-/**
- * Set request timeout.
- * @param agent the agent to set timeout for
- * @param timeout the timeout to set
- */
-MRCP_DECLARE(void) mrcp_client_connection_timeout_set(
- mrcp_connection_agent_t *agent,
- apr_size_t timeout);
-
-/**
- * Get task.
- * @param agent the agent to get task from
- */
-MRCP_DECLARE(apt_task_t*) mrcp_client_connection_agent_task_get(const mrcp_connection_agent_t *agent);
-
-/**
- * Get external object.
- * @param agent the agent to get object from
- */
-MRCP_DECLARE(void*) mrcp_client_connection_agent_object_get(const mrcp_connection_agent_t *agent);
-
-/**
- * Get string identifier.
- * @param agent the agent to get identifier of
- */
-MRCP_DECLARE(const char*) mrcp_client_connection_agent_id_get(const mrcp_connection_agent_t *agent);
-
-
-/**
- * Create control channel.
- * @param agent the agent to create channel for
- * @param obj the external object to associate with the control channel
- * @param pool the pool to allocate memory from
- */
-MRCP_DECLARE(mrcp_control_channel_t*) mrcp_client_control_channel_create(
- mrcp_connection_agent_t *agent,
- void *obj,
- apr_pool_t *pool);
-
-/**
- * Add MRCPv2 control channel.
- * @param channel the control channel to add
- * @param descriptor the control descriptor
- */
-MRCP_DECLARE(apt_bool_t) mrcp_client_control_channel_add(
- mrcp_control_channel_t *channel,
- mrcp_control_descriptor_t *descriptor);
-
-/**
- * Modify MRCPv2 control channel.
- * @param channel the control channel to modify
- * @param descriptor the control descriptor
- */
-MRCP_DECLARE(apt_bool_t) mrcp_client_control_channel_modify(
- mrcp_control_channel_t *channel,
- mrcp_control_descriptor_t *descriptor);
-
-/**
- * Remove MRCPv2 control channel.
- * @param channel the control channel to remove
- */
-MRCP_DECLARE(apt_bool_t) mrcp_client_control_channel_remove(mrcp_control_channel_t *channel);
-
-/**
- * Destroy MRCPv2 control channel.
- * @param channel the control channel to destroy
- */
-MRCP_DECLARE(apt_bool_t) mrcp_client_control_channel_destroy(mrcp_control_channel_t *channel);
-
-/**
- * Send MRCPv2 message.
- * @param channel the control channel to send message through
- * @param message the message to send
- */
-MRCP_DECLARE(apt_bool_t) mrcp_client_control_message_send(mrcp_control_channel_t *channel, mrcp_message_t *message);
-
-/**
- * Set the logger object.
- * @param channel the control channel to set the object for
- * @param log_obj the object to set
- */
-MRCP_DECLARE(void) mrcp_client_control_channel_log_obj_set(mrcp_control_channel_t *channel, void *log_obj);
-
-
-APT_END_EXTERN_C
-
-#endif /* MRCP_CLIENT_CONNECTION_H */
diff --git a/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_connection.h b/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_connection.h
deleted file mode 100644
index fd2f39dca0..0000000000
--- a/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_connection.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_connection.h 2170 2014-09-09 05:19:48Z achaloyan@gmail.com $
- */
-
-#ifndef MRCP_CONNECTION_H
-#define MRCP_CONNECTION_H
-
-/**
- * @file mrcp_connection.h
- * @brief MRCP Connection
- */
-
-#include
-#include
-#ifdef WIN32
-#pragma warning(disable: 4127)
-#endif
-#include
-#include "mrcp_connection_types.h"
-#include "mrcp_stream.h"
-
-APT_BEGIN_EXTERN_C
-
-/** Size of the buffer used for MRCP rx/tx stream */
-#define MRCP_STREAM_BUFFER_SIZE 1024
-
-/** MRCPv2 connection */
-struct mrcp_connection_t {
- /** Ring entry */
- APR_RING_ENTRY(mrcp_connection_t) link;
-
- /** Memory pool */
- apr_pool_t *pool;
-
- /** Accepted/Connected socket */
- apr_socket_t *sock;
- /** Socket poll descriptor */
- apr_pollfd_t sock_pfd;
- /** Local sockaddr */
- apr_sockaddr_t *l_sockaddr;
- /** Remote sockaddr */
- apr_sockaddr_t *r_sockaddr;
- /** Remote IP */
- apt_str_t remote_ip;
- /** String identifier used for traces */
- const char *id;
- /** Transparently dump whatever received/sent on transport layer,
- if verbose is set to TRUE (default) */
- apt_bool_t verbose;
-
- /** Reference count */
- apr_size_t access_count;
- /** Opaque agent */
- void *agent;
-
- /** Table of control channels */
- apr_hash_t *channel_table;
-
- /** Rx buffer */
- char *rx_buffer;
- /** Rx buffer size */
- apr_size_t rx_buffer_size;
- /** Rx stream */
- apt_text_stream_t rx_stream;
- /** MRCP parser to parser MRCP messages out of rx stream */
- mrcp_parser_t *parser;
-
- /** Tx buffer */
- char *tx_buffer;
- /** Tx buffer size */
- apr_size_t tx_buffer_size;
- /** MRCP generator to generate MRCP messages into tx stream */
- mrcp_generator_t *generator;
-};
-
-/** Create MRCP connection. */
-mrcp_connection_t* mrcp_connection_create(void);
-
-/** Destroy MRCP connection. */
-void mrcp_connection_destroy(mrcp_connection_t *connection);
-
-/** Add Control Channel to MRCP connection. */
-apt_bool_t mrcp_connection_channel_add(mrcp_connection_t *connection, mrcp_control_channel_t *channel);
-
-/** Find Control Channel by Channel Identifier. */
-mrcp_control_channel_t* mrcp_connection_channel_find(const mrcp_connection_t *connection, const apt_str_t *identifier);
-
-/** Remove Control Channel from MRCP connection. */
-apt_bool_t mrcp_connection_channel_remove(mrcp_connection_t *connection, mrcp_control_channel_t *channel);
-
-/** Raise disconnect event for each channel from the specified connection. */
-apt_bool_t mrcp_connection_disconnect_raise(mrcp_connection_t *connection, const mrcp_connection_event_vtable_t *vtable);
-
-APT_END_EXTERN_C
-
-#endif /* MRCP_CONNECTION_H */
diff --git a/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_connection_types.h b/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_connection_types.h
deleted file mode 100644
index 6f98564dbd..0000000000
--- a/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_connection_types.h
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_connection_types.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MRCP_CONNECTION_TYPES_H
-#define MRCP_CONNECTION_TYPES_H
-
-/**
- * @file mrcp_connection_types.h
- * @brief MRCP Connection Types Declaration
- */
-
-#include
-#include "apt_string.h"
-#include "apt_timer_queue.h"
-#include "mrcp_types.h"
-
-APT_BEGIN_EXTERN_C
-
-/** Opaque MRCPv2 control descriptor declaration */
-typedef struct mrcp_control_descriptor_t mrcp_control_descriptor_t;
-
-/** Opaque MRCPv2 connection declaration */
-typedef struct mrcp_connection_t mrcp_connection_t;
-
-/** Opaque MRCPv2 control channel declaration */
-typedef struct mrcp_control_channel_t mrcp_control_channel_t;
-
-/** Opaque MRCPv2 connection agent declaration */
-typedef struct mrcp_connection_agent_t mrcp_connection_agent_t;
-
-/** Opaque MRCPv2 connection agent factory declaration */
-typedef struct mrcp_ca_factory_t mrcp_ca_factory_t;
-
-/** MRCPv2 connection event vtable declaration */
-typedef struct mrcp_connection_event_vtable_t mrcp_connection_event_vtable_t;
-
-/** MRCPv2 connection event vtable */
-struct mrcp_connection_event_vtable_t {
- /** Channel add event handler */
- apt_bool_t (*on_add)(mrcp_control_channel_t *channel, mrcp_control_descriptor_t *descriptor, apt_bool_t status);
- /** Channel modify event handler */
- apt_bool_t (*on_modify)(mrcp_control_channel_t *channel, mrcp_control_descriptor_t *descriptor, apt_bool_t status);
- /** Channel remove event handler */
- apt_bool_t (*on_remove)(mrcp_control_channel_t *channel, apt_bool_t status);
- /** Message receive event handler */
- apt_bool_t (*on_receive)(mrcp_control_channel_t *channel, mrcp_message_t *message);
- /** Disconnect event handler */
- apt_bool_t (*on_disconnect)(mrcp_control_channel_t *channel);
-};
-
-/** MRCPv2 control channel */
-struct mrcp_control_channel_t {
- /** MRCPv2 Connection agent */
- mrcp_connection_agent_t *agent;
- /** MRCPv2 (shared) connection */
- mrcp_connection_t *connection;
- /** Request sent to the server and waiting for a response */
- mrcp_message_t *active_request;
- /** Timer used for request timeouts */
- apt_timer_t *request_timer;
- /** Indicate removed connection (safe to destroy) */
- apt_bool_t removed;
- /** External object associated with the channel */
- void *obj;
- /** External logger object associated with the channel */
- void *log_obj;
- /** Pool to allocate memory from */
- apr_pool_t *pool;
- /** Channel identifier (id at resource) */
- apt_str_t identifier;
-};
-
-/** Send channel add response */
-static APR_INLINE apt_bool_t mrcp_control_channel_add_respond(
- const mrcp_connection_event_vtable_t *vtable,
- mrcp_control_channel_t *channel,
- mrcp_control_descriptor_t *descriptor,
- apt_bool_t status)
-{
- if(vtable && vtable->on_add) {
- return vtable->on_add(channel,descriptor,status);
- }
- return FALSE;
-}
-
-/** Send channel modify response */
-static APR_INLINE apt_bool_t mrcp_control_channel_modify_respond(
- const mrcp_connection_event_vtable_t *vtable,
- mrcp_control_channel_t *channel,
- mrcp_control_descriptor_t *descriptor,
- apt_bool_t status)
-{
- if(vtable && vtable->on_modify) {
- return vtable->on_modify(channel,descriptor,status);
- }
- return FALSE;
-}
-
-/** Send channel remove response */
-static APR_INLINE apt_bool_t mrcp_control_channel_remove_respond(
- const mrcp_connection_event_vtable_t *vtable,
- mrcp_control_channel_t *channel,
- apt_bool_t status)
-{
- if(vtable && vtable->on_remove) {
- return vtable->on_remove(channel,status);
- }
- return FALSE;
-}
-
-/** Send MRCP message receive event */
-static APR_INLINE apt_bool_t mrcp_connection_message_receive(
- const mrcp_connection_event_vtable_t *vtable,
- mrcp_control_channel_t *channel,
- mrcp_message_t *message)
-{
- if(vtable && vtable->on_receive) {
- return vtable->on_receive(channel,message);
- }
- return FALSE;
-}
-
-APT_END_EXTERN_C
-
-#endif /* MRCP_CONNECTION_TYPES_H */
diff --git a/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_control_descriptor.h b/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_control_descriptor.h
deleted file mode 100644
index 9597970ddf..0000000000
--- a/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_control_descriptor.h
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_control_descriptor.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MRCP_CONTROL_DESCRIPTOR_H
-#define MRCP_CONTROL_DESCRIPTOR_H
-
-/**
- * @file mrcp_control_descriptor.h
- * @brief MRCPv2 Control Descriptor
- */
-
-#include
-#include "apt_string.h"
-#include "mrcp_connection_types.h"
-
-APT_BEGIN_EXTERN_C
-
-/** TCP discard port used in offer/answer */
-#define TCP_DISCARD_PORT 9
-
-
-/** MRCPv2 proto transport */
-typedef enum {
- MRCP_PROTO_TCP,
- MRCP_PROTO_TLS,
-
- MRCP_PROTO_COUNT,
- MRCP_PROTO_UNKNOWN = MRCP_PROTO_COUNT
-}mrcp_proto_type_e;
-
-
-/** MRCPv2 attributes */
-typedef enum {
- MRCP_ATTRIB_SETUP,
- MRCP_ATTRIB_CONNECTION,
- MRCP_ATTRIB_RESOURCE,
- MRCP_ATTRIB_CHANNEL,
- MRCP_ATTRIB_CMID,
-
- MRCP_ATTRIB_COUNT,
- MRCP_ATTRIB_UNKNOWN = MRCP_ATTRIB_COUNT
-}mrcp_attrib_e;
-
-
-/** MRCPv2 setup attributes */
-typedef enum {
- MRCP_SETUP_TYPE_ACTIVE,
- MRCP_SETUP_TYPE_PASSIVE,
-
- MRCP_SETUP_TYPE_COUNT,
- MRCP_SETUP_TYPE_UNKNOWN = MRCP_SETUP_TYPE_COUNT
-} mrcp_setup_type_e;
-
-/** MRCPv2 connection attributes */
-typedef enum {
- MRCP_CONNECTION_TYPE_NEW,
- MRCP_CONNECTION_TYPE_EXISTING,
-
- MRCP_CONNECTION_TYPE_COUNT,
- MRCP_CONNECTION_TYPE_UNKNOWN = MRCP_CONNECTION_TYPE_COUNT
-} mrcp_connection_type_e;
-
-
-/** MRCPv2 control descriptor */
-struct mrcp_control_descriptor_t {
- /** IP address */
- apt_str_t ip;
- /** Port */
- apr_port_t port;
- /** Protocol type */
- mrcp_proto_type_e proto;
- /** Setup type */
- mrcp_setup_type_e setup_type;
- /** Connection type */
- mrcp_connection_type_e connection_type;
- /** Resource name */
- apt_str_t resource_name;
- /** Session identifier */
- apt_str_t session_id;
- /** Array of cmid attributes */
- apr_array_header_t *cmid_arr;
- /** Base identifier */
- apr_size_t id;
-};
-
-
-/** Create MRCP control descriptor */
-MRCP_DECLARE(mrcp_control_descriptor_t*) mrcp_control_descriptor_create(apr_pool_t *pool);
-
-/** Create MRCP control offer */
-MRCP_DECLARE(mrcp_control_descriptor_t*) mrcp_control_offer_create(apr_pool_t *pool);
-
-/** Create MRCP control answer */
-MRCP_DECLARE(mrcp_control_descriptor_t*) mrcp_control_answer_create(mrcp_control_descriptor_t *offer, apr_pool_t *pool);
-
-/** Add cmid to cmid_arr */
-MRCP_DECLARE(void) mrcp_cmid_add(apr_array_header_t *cmid_arr, apr_size_t cmid);
-
-/** Find cmid in cmid_arr */
-MRCP_DECLARE(apt_bool_t) mrcp_cmid_find(const apr_array_header_t *cmid_arr, apr_size_t cmid);
-
-/** Get MRCP protocol transport name by identifier */
-MRCP_DECLARE(const apt_str_t*) mrcp_proto_get(mrcp_proto_type_e proto);
-
-/** Find MRCP protocol transport identifier by name */
-MRCP_DECLARE(mrcp_proto_type_e) mrcp_proto_find(const apt_str_t *attrib);
-
-
-/** Get MRCP attribute name by identifier */
-MRCP_DECLARE(const apt_str_t*) mrcp_attrib_str_get(mrcp_attrib_e attrib_id);
-
-/** Find MRCP attribute identifier by name */
-MRCP_DECLARE(mrcp_attrib_e) mrcp_attrib_id_find(const apt_str_t *attrib);
-
-
-/** Get MRCP setup type name by identifier */
-MRCP_DECLARE(const apt_str_t*) mrcp_setup_type_get(mrcp_setup_type_e setup_type);
-
-/** Find MRCP setup type identifier by name */
-MRCP_DECLARE(mrcp_setup_type_e) mrcp_setup_type_find(const apt_str_t *attrib);
-
-
-/** Get MRCP connection type name by identifier */
-MRCP_DECLARE(const apt_str_t*) mrcp_connection_type_get(mrcp_connection_type_e connection_type);
-
-/** Find MRCP connection type identifier by name */
-MRCP_DECLARE(mrcp_connection_type_e) mrcp_connection_type_find(const apt_str_t *attrib);
-
-
-APT_END_EXTERN_C
-
-#endif /* MRCP_CONTROL_DESCRIPTOR_H */
diff --git a/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_server_connection.h b/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_server_connection.h
deleted file mode 100644
index df99cc1a40..0000000000
--- a/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_server_connection.h
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_server_connection.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MRCP_SERVER_CONNECTION_H
-#define MRCP_SERVER_CONNECTION_H
-
-/**
- * @file mrcp_server_connection.h
- * @brief MRCPv2 Server Connection
- */
-
-#include "apt_task.h"
-#include "mrcp_connection_types.h"
-
-APT_BEGIN_EXTERN_C
-
-/**
- * Create connection agent.
- * @param id the identifier of the engine
- * @param listen_ip the IP address to listen on
- * @param listen_port the port to listen on
- * @param max_connection_count the number of max MRCPv2 connections
- * @param force_new_connection the policy used in o/a for connection establishment
- * @param pool the pool to allocate memory from
- */
-MRCP_DECLARE(mrcp_connection_agent_t*) mrcp_server_connection_agent_create(
- const char *id,
- const char *listen_ip,
- apr_port_t listen_port,
- apr_size_t max_connection_count,
- apt_bool_t force_new_connection,
- apr_pool_t *pool);
-
-/**
- * Destroy connection agent.
- * @param agent the agent to destroy
- */
-MRCP_DECLARE(apt_bool_t) mrcp_server_connection_agent_destroy(mrcp_connection_agent_t *agent);
-
-/**
- * Start connection agent and wait for incoming requests.
- * @param agent the agent to start
- */
-MRCP_DECLARE(apt_bool_t) mrcp_server_connection_agent_start(mrcp_connection_agent_t *agent);
-
-/**
- * Terminate connection agent.
- * @param agent the agent to terminate
- */
-MRCP_DECLARE(apt_bool_t) mrcp_server_connection_agent_terminate(mrcp_connection_agent_t *agent);
-
-/**
- * Set connection event handler.
- * @param agent the agent to set event hadler for
- * @param obj the external object to associate with the agent
- * @param vtable the event handler virtual methods
- */
-MRCP_DECLARE(void) mrcp_server_connection_agent_handler_set(
- mrcp_connection_agent_t *agent,
- void *obj,
- const mrcp_connection_event_vtable_t *vtable);
-
-/**
- * Set MRCP resource factory.
- * @param agent the agent to set resource factory for
- * @param resource_factory the MRCP resource factory to set
- */
-MRCP_DECLARE(void) mrcp_server_connection_resource_factory_set(
- mrcp_connection_agent_t *agent,
- const mrcp_resource_factory_t *resource_factory);
-
-/**
- * Set rx buffer size.
- * @param agent the agent to set buffer size for
- * @param size the size of rx buffer to set
- */
-MRCP_DECLARE(void) mrcp_server_connection_rx_size_set(
- mrcp_connection_agent_t *agent,
- apr_size_t size);
-
-/**
- * Set tx buffer size.
- * @param agent the agent to set buffer size for
- * @param size the size of the rx buffer to set
- */
-MRCP_DECLARE(void) mrcp_server_connection_tx_size_set(
- mrcp_connection_agent_t *agent,
- apr_size_t size);
-
-/**
- * Get task.
- * @param agent the agent to get task from
- */
-MRCP_DECLARE(apt_task_t*) mrcp_server_connection_agent_task_get(const mrcp_connection_agent_t *agent);
-
-/**
- * Get external object.
- * @param agent the agent to get object from
- */
-MRCP_DECLARE(void*) mrcp_server_connection_agent_object_get(const mrcp_connection_agent_t *agent);
-
-/**
- * Get string identifier.
- * @param agent the agent to get identifier of
- */
-MRCP_DECLARE(const char*) mrcp_server_connection_agent_id_get(const mrcp_connection_agent_t *agent);
-
-
-/**
- * Create control channel.
- * @param agent the agent to create channel for
- * @param obj the external object to associate with the control channel
- * @param pool the pool to allocate memory from
- */
-MRCP_DECLARE(mrcp_control_channel_t*) mrcp_server_control_channel_create(
- mrcp_connection_agent_t *agent,
- void *obj,
- apr_pool_t *pool);
-
-/**
- * Add MRCPv2 control channel.
- * @param channel the control channel to add
- * @param descriptor the control descriptor
- */
-MRCP_DECLARE(apt_bool_t) mrcp_server_control_channel_add(
- mrcp_control_channel_t *channel,
- mrcp_control_descriptor_t *descriptor);
-
-/**
- * Modify MRCPv2 control channel.
- * @param channel the control channel to modify
- * @param descriptor the control descriptor
- */
-MRCP_DECLARE(apt_bool_t) mrcp_server_control_channel_modify(
- mrcp_control_channel_t *channel,
- mrcp_control_descriptor_t *descriptor);
-
-/**
- * Remove MRCPv2 control channel.
- * @param channel the control channel to remove
- */
-MRCP_DECLARE(apt_bool_t) mrcp_server_control_channel_remove(mrcp_control_channel_t *channel);
-
-/**
- * Destroy MRCPv2 control channel.
- * @param channel the control channel to destroy
- */
-MRCP_DECLARE(apt_bool_t) mrcp_server_control_channel_destroy(mrcp_control_channel_t *channel);
-
-/**
- * Send MRCPv2 message.
- * @param channel the control channel to send message through
- * @param message the message to send
- */
-MRCP_DECLARE(apt_bool_t) mrcp_server_control_message_send(mrcp_control_channel_t *channel, mrcp_message_t *message);
-
-
-APT_END_EXTERN_C
-
-#endif /* MRCP_SERVER_CONNECTION_H */
diff --git a/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2010.vcxproj.filters b/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2010.vcxproj.filters
deleted file mode 100644
index 576ef8ae7e..0000000000
--- a/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2010.vcxproj.filters
+++ /dev/null
@@ -1,47 +0,0 @@
-
-
-
-
- {93995380-89BD-4b04-88EB-625FBE52EBFB}
- h;hpp;hxx;hm;inl;inc;xsd
-
-
- {a92d3b8c-d54d-416c-b458-dc57ac24d2e9}
- cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
-
-
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
-
\ No newline at end of file
diff --git a/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2017.vcxproj b/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2017.vcxproj
deleted file mode 100644
index 40a20105bf..0000000000
--- a/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2017.vcxproj
+++ /dev/null
@@ -1,134 +0,0 @@
-
-
-
-
- Debug
- Win32
-
-
- Debug
- x64
-
-
- Release
- Win32
-
-
- Release
- x64
-
-
-
- mrcpv2transport
- {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}
- mrcpv2transport
- Win32Proj
-
-
-
- StaticLibrary
- Unicode
- true
- $(DefaultPlatformToolset)
-
-
- StaticLibrary
- Unicode
- $(DefaultPlatformToolset)
-
-
- StaticLibrary
- Unicode
- true
- $(DefaultPlatformToolset)
-
-
- StaticLibrary
- Unicode
- $(DefaultPlatformToolset)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <_ProjectFileVersion>10.0.30319.1
- $(PlatformName)\$(Configuration)\
- $(PlatformName)\$(Configuration)\
- $(SolutionDir)$(PlatformName)\$(Configuration)\
- $(PlatformName)\$(Configuration)\
- $(PlatformName)\$(Configuration)\
- $(PlatformName)\$(Configuration)\
- $(SolutionDir)$(PlatformName)\$(Configuration)\
- $(PlatformName)\$(Configuration)\
-
-
-
- APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)
-
-
-
-
- X64
-
-
- APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)
- ProgramDatabase
-
-
-
-
- APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)
-
-
-
-
- X64
-
-
- APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {f6c55d93-b927-4483-bb69-15aef3dd2dff}
-
-
-
-
-
-
\ No newline at end of file
diff --git a/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.vcproj b/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.vcproj
deleted file mode 100644
index 526f1e36a3..0000000000
--- a/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.vcproj
+++ /dev/null
@@ -1,296 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.vcxproj b/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.vcxproj
deleted file mode 100644
index 4d99d355c3..0000000000
--- a/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.vcxproj
+++ /dev/null
@@ -1,125 +0,0 @@
-
-
-
-
- Debug
- Win32
-
-
- Debug
- x64
-
-
- Release
- Win32
-
-
- Release
- x64
-
-
-
- {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}
- mrcpv2transport
- Win32Proj
-
-
-
- StaticLibrary
- Unicode
- true
-
-
- StaticLibrary
- Unicode
-
-
- StaticLibrary
- Unicode
- true
-
-
- StaticLibrary
- Unicode
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <_ProjectFileVersion>10.0.30319.1
- AllRules.ruleset
-
-
- AllRules.ruleset
-
-
- AllRules.ruleset
-
-
- AllRules.ruleset
-
-
-
-
-
- X64
-
-
- ProgramDatabase
-
-
-
-
- X64
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {1c320193-46a6-4b34-9c56-8ab584fc1b56}
- false
-
-
-
-
-
-
\ No newline at end of file
diff --git a/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.vcxproj.filters b/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.vcxproj.filters
deleted file mode 100644
index d573ce6367..0000000000
--- a/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.vcxproj.filters
+++ /dev/null
@@ -1,50 +0,0 @@
-
-
-
-
- {93995380-89BD-4b04-88EB-625FBE52EBFB}
- h;hpp;hxx;hm;inl;inc;xsd
-
-
- {119450fa-653a-4fdc-9017-a4350ff3066c}
- cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
-
-
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
-
\ No newline at end of file
diff --git a/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_ca_factory.c b/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_ca_factory.c
deleted file mode 100644
index b588ee200c..0000000000
--- a/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_ca_factory.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_ca_factory.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include
-#include "mrcp_ca_factory.h"
-
-/** Factory of MRCPv2 connection agents */
-struct mrcp_ca_factory_t {
- /** Array of pointers to agents */
- apr_array_header_t *agent_arr;
- /** Index of the current agent */
- int index;
-};
-
-/** Create factory of connection agents. */
-MRCP_DECLARE(mrcp_ca_factory_t*) mrcp_ca_factory_create(apr_pool_t *pool)
-{
- mrcp_ca_factory_t *factory = apr_palloc(pool,sizeof(mrcp_ca_factory_t));
- factory->agent_arr = apr_array_make(pool,1,sizeof(mrcp_connection_agent_t*));
- factory->index = 0;
- return factory;
-}
-
-/** Add connection agent to factory. */
-MRCP_DECLARE(apt_bool_t) mrcp_ca_factory_agent_add(mrcp_ca_factory_t *factory, mrcp_connection_agent_t *agent)
-{
- mrcp_connection_agent_t **slot;
- if(!agent)
- return FALSE;
-
- slot = apr_array_push(factory->agent_arr);
- *slot = agent;
- return TRUE;
-}
-
-/** Determine whether factory is empty. */
-MRCP_DECLARE(apt_bool_t) mrcp_ca_factory_is_empty(const mrcp_ca_factory_t *factory)
-{
- return apr_is_empty_array(factory->agent_arr);
-}
-
-/** Select next available agent. */
-MRCP_DECLARE(mrcp_connection_agent_t*) mrcp_ca_factory_agent_select(mrcp_ca_factory_t *factory)
-{
- mrcp_connection_agent_t *agent = APR_ARRAY_IDX(factory->agent_arr, factory->index, mrcp_connection_agent_t*);
- if(++factory->index == factory->agent_arr->nelts) {
- factory->index = 0;
- }
- return agent;
-}
diff --git a/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_client_connection.c b/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_client_connection.c
deleted file mode 100644
index 359df52f47..0000000000
--- a/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_client_connection.c
+++ /dev/null
@@ -1,696 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_client_connection.c 2249 2014-11-19 05:26:24Z achaloyan@gmail.com $
- */
-
-#include "mrcp_connection.h"
-#include "mrcp_client_connection.h"
-#include "mrcp_control_descriptor.h"
-#include "mrcp_resource_factory.h"
-#include "mrcp_message.h"
-#include "apt_text_stream.h"
-#include "apt_poller_task.h"
-#include "apt_log.h"
-
-
-struct mrcp_connection_agent_t {
- /** List (ring) of MRCP connections */
- APR_RING_HEAD(mrcp_connection_head_t, mrcp_connection_t) connection_list;
-
- apr_pool_t *pool;
- apt_poller_task_t *task;
- const mrcp_resource_factory_t *resource_factory;
-
- apr_uint32_t request_timeout;
- apt_bool_t offer_new_connection;
- apr_size_t tx_buffer_size;
- apr_size_t rx_buffer_size;
-
- void *obj;
- const mrcp_connection_event_vtable_t *vtable;
-};
-
-typedef enum {
- CONNECTION_TASK_MSG_ADD_CHANNEL,
- CONNECTION_TASK_MSG_MODIFY_CHANNEL,
- CONNECTION_TASK_MSG_REMOVE_CHANNEL,
- CONNECTION_TASK_MSG_SEND_MESSAGE
-} connection_task_msg_type_e;
-
-typedef struct connection_task_msg_t connection_task_msg_t;
-struct connection_task_msg_t {
- connection_task_msg_type_e type;
- mrcp_connection_agent_t *agent;
- mrcp_control_channel_t *channel;
- mrcp_control_descriptor_t *descriptor;
- mrcp_message_t *message;
-};
-
-
-static apt_bool_t mrcp_client_agent_msg_process(apt_task_t *task, apt_task_msg_t *task_msg);
-static apt_bool_t mrcp_client_poller_signal_process(void *obj, const apr_pollfd_t *descriptor);
-static void mrcp_client_timer_proc(apt_timer_t *timer, void *obj);
-
-/** Create connection agent. */
-MRCP_DECLARE(mrcp_connection_agent_t*) mrcp_client_connection_agent_create(
- const char *id,
- apr_size_t max_connection_count,
- apt_bool_t offer_new_connection,
- apr_pool_t *pool)
-{
- apt_task_t *task;
- apt_task_vtable_t *vtable;
- apt_task_msg_pool_t *msg_pool;
- mrcp_connection_agent_t *agent;
-
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create MRCPv2 Agent [%s] [%"APR_SIZE_T_FMT"]",
- id, max_connection_count);
- agent = apr_palloc(pool,sizeof(mrcp_connection_agent_t));
- agent->pool = pool;
- agent->request_timeout = 0;
- agent->offer_new_connection = offer_new_connection;
- agent->rx_buffer_size = MRCP_STREAM_BUFFER_SIZE;
- agent->tx_buffer_size = MRCP_STREAM_BUFFER_SIZE;
-
- msg_pool = apt_task_msg_pool_create_dynamic(sizeof(connection_task_msg_t),pool);
-
- agent->task = apt_poller_task_create(
- max_connection_count,
- mrcp_client_poller_signal_process,
- agent,
- msg_pool,
- pool);
- if(!agent->task) {
- return NULL;
- }
-
- task = apt_poller_task_base_get(agent->task);
- if(task) {
- apt_task_name_set(task,id);
- }
-
- vtable = apt_poller_task_vtable_get(agent->task);
- if(vtable) {
- vtable->process_msg = mrcp_client_agent_msg_process;
- }
-
- APR_RING_INIT(&agent->connection_list, mrcp_connection_t, link);
- return agent;
-}
-
-/** Destroy connection agent. */
-MRCP_DECLARE(apt_bool_t) mrcp_client_connection_agent_destroy(mrcp_connection_agent_t *agent)
-{
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Destroy MRCPv2 Agent [%s]",
- mrcp_client_connection_agent_id_get(agent));
- return apt_poller_task_destroy(agent->task);
-}
-
-/** Start connection agent. */
-MRCP_DECLARE(apt_bool_t) mrcp_client_connection_agent_start(mrcp_connection_agent_t *agent)
-{
- return apt_poller_task_start(agent->task);
-}
-
-/** Terminate connection agent. */
-MRCP_DECLARE(apt_bool_t) mrcp_client_connection_agent_terminate(mrcp_connection_agent_t *agent)
-{
- return apt_poller_task_terminate(agent->task);
-}
-
-/** Set connection event handler. */
-MRCP_DECLARE(void) mrcp_client_connection_agent_handler_set(
- mrcp_connection_agent_t *agent,
- void *obj,
- const mrcp_connection_event_vtable_t *vtable)
-{
- agent->obj = obj;
- agent->vtable = vtable;
-}
-
-/** Set MRCP resource factory */
-MRCP_DECLARE(void) mrcp_client_connection_resource_factory_set(
- mrcp_connection_agent_t *agent,
- const mrcp_resource_factory_t *resource_factroy)
-{
- agent->resource_factory = resource_factroy;
-}
-
-/** Set rx buffer size */
-MRCP_DECLARE(void) mrcp_client_connection_rx_size_set(
- mrcp_connection_agent_t *agent,
- apr_size_t size)
-{
- if(size < MRCP_STREAM_BUFFER_SIZE) {
- size = MRCP_STREAM_BUFFER_SIZE;
- }
- agent->rx_buffer_size = size;
-}
-
-/** Set tx buffer size */
-MRCP_DECLARE(void) mrcp_client_connection_tx_size_set(
- mrcp_connection_agent_t *agent,
- apr_size_t size)
-{
- if(size < MRCP_STREAM_BUFFER_SIZE) {
- size = MRCP_STREAM_BUFFER_SIZE;
- }
- agent->tx_buffer_size = size;
-}
-
-/** Set request timeout */
-MRCP_DECLARE(void) mrcp_client_connection_timeout_set(
- mrcp_connection_agent_t *agent,
- apr_size_t timeout)
-{
- agent->request_timeout = (apr_uint32_t)timeout;
-}
-
-/** Get task */
-MRCP_DECLARE(apt_task_t*) mrcp_client_connection_agent_task_get(const mrcp_connection_agent_t *agent)
-{
- return apt_poller_task_base_get(agent->task);
-}
-
-/** Get external object */
-MRCP_DECLARE(void*) mrcp_client_connection_agent_object_get(const mrcp_connection_agent_t *agent)
-{
- return agent->obj;
-}
-
-/** Get string identifier */
-MRCP_DECLARE(const char*) mrcp_client_connection_agent_id_get(const mrcp_connection_agent_t *agent)
-{
- apt_task_t *task = apt_poller_task_base_get(agent->task);
- return apt_task_name_get(task);
-}
-
-
-/** Create control channel */
-MRCP_DECLARE(mrcp_control_channel_t*) mrcp_client_control_channel_create(mrcp_connection_agent_t *agent, void *obj, apr_pool_t *pool)
-{
- mrcp_control_channel_t *channel = apr_palloc(pool,sizeof(mrcp_control_channel_t));
- channel->agent = agent;
- channel->connection = NULL;
- channel->active_request = NULL;
- channel->request_timer = NULL;
- channel->removed = FALSE;
- channel->obj = obj;
- channel->log_obj = NULL;
- channel->pool = pool;
-
- channel->request_timer = apt_poller_task_timer_create(
- agent->task,
- mrcp_client_timer_proc,
- channel,
- pool);
- return channel;
-}
-
-/** Set the logger object */
-MRCP_DECLARE(void) mrcp_client_control_channel_log_obj_set(mrcp_control_channel_t *channel, void *log_obj)
-{
- channel->log_obj = log_obj;
-}
-
-/** Destroy MRCPv2 control channel */
-MRCP_DECLARE(apt_bool_t) mrcp_client_control_channel_destroy(mrcp_control_channel_t *channel)
-{
- if(channel && channel->connection && channel->removed == TRUE) {
- mrcp_connection_t *connection = channel->connection;
- channel->connection = NULL;
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Destroy TCP/MRCPv2 Connection %s",connection->id);
- mrcp_connection_destroy(connection);
- }
- return TRUE;
-}
-
-/** Signal task message */
-static apt_bool_t mrcp_client_control_message_signal(
- connection_task_msg_type_e type,
- mrcp_connection_agent_t *agent,
- mrcp_control_channel_t *channel,
- mrcp_control_descriptor_t *descriptor,
- mrcp_message_t *message)
-{
- apt_task_t *task = apt_poller_task_base_get(agent->task);
- apt_task_msg_t *task_msg = apt_task_msg_get(task);
- if(task_msg) {
- connection_task_msg_t *msg = (connection_task_msg_t*)task_msg->data;
- msg->type = type;
- msg->agent = agent;
- msg->channel = channel;
- msg->descriptor = descriptor;
- msg->message = message;
- apt_task_msg_signal(task,task_msg);
- }
- return TRUE;
-}
-
-/** Add MRCPv2 control channel */
-MRCP_DECLARE(apt_bool_t) mrcp_client_control_channel_add(mrcp_control_channel_t *channel, mrcp_control_descriptor_t *descriptor)
-{
- return mrcp_client_control_message_signal(CONNECTION_TASK_MSG_ADD_CHANNEL,channel->agent,channel,descriptor,NULL);
-}
-
-/** Modify MRCPv2 control channel */
-MRCP_DECLARE(apt_bool_t) mrcp_client_control_channel_modify(mrcp_control_channel_t *channel, mrcp_control_descriptor_t *descriptor)
-{
- return mrcp_client_control_message_signal(CONNECTION_TASK_MSG_MODIFY_CHANNEL,channel->agent,channel,descriptor,NULL);
-}
-
-/** Remove MRCPv2 control channel */
-MRCP_DECLARE(apt_bool_t) mrcp_client_control_channel_remove(mrcp_control_channel_t *channel)
-{
- return mrcp_client_control_message_signal(CONNECTION_TASK_MSG_REMOVE_CHANNEL,channel->agent,channel,NULL,NULL);
-}
-
-/** Send MRCPv2 message */
-MRCP_DECLARE(apt_bool_t) mrcp_client_control_message_send(mrcp_control_channel_t *channel, mrcp_message_t *message)
-{
- return mrcp_client_control_message_signal(CONNECTION_TASK_MSG_SEND_MESSAGE,channel->agent,channel,NULL,message);
-}
-
-static mrcp_connection_t* mrcp_client_agent_connection_create(mrcp_connection_agent_t *agent, mrcp_control_descriptor_t *descriptor)
-{
- char *local_ip = NULL;
- char *remote_ip = NULL;
- mrcp_connection_t *connection = mrcp_connection_create();
-
- apr_sockaddr_info_get(&connection->r_sockaddr,descriptor->ip.buf,APR_INET,descriptor->port,0,connection->pool);
- if(!connection->r_sockaddr) {
- mrcp_connection_destroy(connection);
- return NULL;
- }
-
- if(apr_socket_create(&connection->sock,connection->r_sockaddr->family,SOCK_STREAM,APR_PROTO_TCP,connection->pool) != APR_SUCCESS) {
- mrcp_connection_destroy(connection);
- return NULL;
- }
-
- apr_socket_opt_set(connection->sock, APR_SO_NONBLOCK, 0);
- apr_socket_timeout_set(connection->sock, -1);
- apr_socket_opt_set(connection->sock, APR_SO_REUSEADDR, 1);
-
- if(apr_socket_connect(connection->sock, connection->r_sockaddr) != APR_SUCCESS) {
- apr_socket_close(connection->sock);
- mrcp_connection_destroy(connection);
- return NULL;
- }
-
- if(apr_socket_addr_get(&connection->l_sockaddr,APR_LOCAL,connection->sock) != APR_SUCCESS) {
- apr_socket_close(connection->sock);
- mrcp_connection_destroy(connection);
- return NULL;
- }
-
- apr_sockaddr_ip_get(&local_ip,connection->l_sockaddr);
- apr_sockaddr_ip_get(&remote_ip,connection->r_sockaddr);
- connection->id = apr_psprintf(connection->pool,"%s:%hu <-> %s:%hu",
- local_ip,connection->l_sockaddr->port,
- remote_ip,connection->r_sockaddr->port);
-
- memset(&connection->sock_pfd,0,sizeof(apr_pollfd_t));
- connection->sock_pfd.desc_type = APR_POLL_SOCKET;
- connection->sock_pfd.reqevents = APR_POLLIN;
- connection->sock_pfd.desc.s = connection->sock;
- connection->sock_pfd.client_data = connection;
- if(apt_poller_task_descriptor_add(agent->task, &connection->sock_pfd) != TRUE) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Add to Pollset %s",connection->id);
- apr_socket_close(connection->sock);
- mrcp_connection_destroy(connection);
- return NULL;
- }
-
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Established TCP/MRCPv2 Connection %s",connection->id);
- connection->agent = agent;
- APR_RING_INSERT_TAIL(&agent->connection_list,connection,mrcp_connection_t,link);
-
- connection->parser = mrcp_parser_create(agent->resource_factory,connection->pool);
- connection->generator = mrcp_generator_create(agent->resource_factory,connection->pool);
-
- connection->tx_buffer_size = agent->tx_buffer_size;
- connection->tx_buffer = apr_palloc(connection->pool,connection->tx_buffer_size+1);
-
- connection->rx_buffer_size = agent->rx_buffer_size;
- connection->rx_buffer = apr_palloc(connection->pool,connection->rx_buffer_size+1);
- apt_text_stream_init(&connection->rx_stream,connection->rx_buffer,connection->rx_buffer_size);
-
- if(apt_log_masking_get() != APT_LOG_MASKING_NONE) {
- connection->verbose = FALSE;
- mrcp_parser_verbose_set(connection->parser,TRUE);
- mrcp_generator_verbose_set(connection->generator,TRUE);
- }
-
- return connection;
-}
-
-static mrcp_connection_t* mrcp_client_agent_connection_find(mrcp_connection_agent_t *agent, mrcp_control_descriptor_t *descriptor)
-{
- apr_sockaddr_t *sockaddr;
- mrcp_connection_t *connection;
-
- for(connection = APR_RING_FIRST(&agent->connection_list);
- connection != APR_RING_SENTINEL(&agent->connection_list, mrcp_connection_t, link);
- connection = APR_RING_NEXT(connection, link)) {
- if(apr_sockaddr_info_get(&sockaddr,descriptor->ip.buf,APR_INET,descriptor->port,0,connection->pool) == APR_SUCCESS) {
- if(apr_sockaddr_equal(sockaddr,connection->r_sockaddr) != 0 &&
- descriptor->port == connection->r_sockaddr->port) {
- return connection;
- }
- }
- }
-
- return NULL;
-}
-
-static apt_bool_t mrcp_client_agent_connection_remove(mrcp_connection_agent_t *agent, mrcp_connection_t *connection)
-{
- /* remove from the list */
- APR_RING_REMOVE(connection,link);
-
- if(connection->sock) {
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Close TCP/MRCPv2 Connection %s",connection->id);
- apt_poller_task_descriptor_remove(agent->task,&connection->sock_pfd);
- apr_socket_close(connection->sock);
- connection->sock = NULL;
- }
- return TRUE;
-}
-
-static apt_bool_t mrcp_client_agent_channel_add(mrcp_connection_agent_t *agent, mrcp_control_channel_t *channel, mrcp_control_descriptor_t *descriptor)
-{
- if(agent->offer_new_connection == TRUE) {
- descriptor->connection_type = MRCP_CONNECTION_TYPE_NEW;
- }
- else {
- descriptor->connection_type = MRCP_CONNECTION_TYPE_EXISTING;
- if(APR_RING_EMPTY(&agent->connection_list, mrcp_connection_t, link)) {
- /* offer new connection if there is no established connection yet */
- descriptor->connection_type = MRCP_CONNECTION_TYPE_NEW;
- }
- }
- /* send response */
- return mrcp_control_channel_add_respond(agent->vtable,channel,descriptor,TRUE);
-}
-
-static apt_bool_t mrcp_client_agent_channel_modify(mrcp_connection_agent_t *agent, mrcp_control_channel_t *channel, mrcp_control_descriptor_t *descriptor)
-{
- apt_bool_t status = TRUE;
- if(descriptor->port) {
- if(!channel->connection) {
- mrcp_connection_t *connection = NULL;
- apt_id_resource_generate(&descriptor->session_id,&descriptor->resource_name,'@',&channel->identifier,channel->pool);
- /* no connection yet */
- if(descriptor->connection_type == MRCP_CONNECTION_TYPE_EXISTING) {
- /* try to find existing connection */
- connection = mrcp_client_agent_connection_find(agent,descriptor);
- if(!connection) {
- apt_obj_log(APT_LOG_MARK,APT_PRIO_WARNING,channel->log_obj,"Found No Existing TCP/MRCPv2 Connection");
- }
- }
- if(!connection) {
- /* create new connection */
- connection = mrcp_client_agent_connection_create(agent,descriptor);
- if(!connection) {
- apt_obj_log(APT_LOG_MARK,APT_PRIO_WARNING,channel->log_obj,"Failed to Establish TCP/MRCPv2 Connection");
- }
- }
-
- if(connection) {
- mrcp_connection_channel_add(connection,channel);
- apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,channel->log_obj,"Add Control Channel <%s> %s [%d]",
- channel->identifier.buf,
- connection->id,
- apr_hash_count(connection->channel_table));
- if(descriptor->connection_type == MRCP_CONNECTION_TYPE_NEW) {
- /* set connection type to existing for the next offers / if any */
- descriptor->connection_type = MRCP_CONNECTION_TYPE_EXISTING;
- }
- }
- else {
- descriptor->port = 0;
- status = FALSE;
- }
- }
- }
- /* send response */
- return mrcp_control_channel_modify_respond(agent->vtable,channel,descriptor,status);
-}
-
-static apt_bool_t mrcp_client_agent_channel_remove(mrcp_connection_agent_t *agent, mrcp_control_channel_t *channel)
-{
- if(channel->connection) {
- mrcp_connection_t *connection = channel->connection;
- mrcp_connection_channel_remove(connection,channel);
- apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,channel->log_obj,"Remove Control Channel <%s> [%d]",
- channel->identifier.buf,
- apr_hash_count(connection->channel_table));
- if(!connection->access_count) {
- mrcp_client_agent_connection_remove(agent,connection);
- /* set connection to be destroyed on channel destroy */
- channel->connection = connection;
- channel->removed = TRUE;
- }
- }
-
- /* send response */
- return mrcp_control_channel_remove_respond(agent->vtable,channel,TRUE);
-}
-
-static apt_bool_t mrcp_client_agent_request_cancel(mrcp_connection_agent_t *agent, mrcp_control_channel_t *channel, mrcp_message_t *message)
-{
- mrcp_message_t *response;
- apt_obj_log(APT_LOG_MARK,APT_PRIO_WARNING,channel->log_obj,"Cancel MRCP Request <%s@%s> [%d]",
- MRCP_MESSAGE_SIDRES(message),
- message->start_line.request_id);
- response = mrcp_response_create(message,message->pool);
- response->start_line.status_code = MRCP_STATUS_CODE_METHOD_FAILED;
- return mrcp_connection_message_receive(agent->vtable,channel,response);
-}
-
-static apt_bool_t mrcp_client_agent_disconnect_raise(mrcp_connection_agent_t *agent, mrcp_connection_t *connection)
-{
- mrcp_control_channel_t *channel;
- void *val;
- apr_hash_index_t *it = apr_hash_first(connection->pool,connection->channel_table);
- /* walk through the list of channels and raise disconnect event for them */
- for(; it; it = apr_hash_next(it)) {
- apr_hash_this(it,NULL,NULL,&val);
- channel = val;
- if(!channel) continue;
-
- if(channel->active_request) {
- mrcp_client_agent_request_cancel(channel->agent,channel,channel->active_request);
- channel->active_request = NULL;
- if(channel->request_timer) {
- apt_timer_kill(channel->request_timer);
- }
- }
- else if(agent->vtable->on_disconnect){
- agent->vtable->on_disconnect(channel);
- }
- }
- return TRUE;
-}
-
-static apt_bool_t mrcp_client_agent_messsage_send(mrcp_connection_agent_t *agent, mrcp_control_channel_t *channel, mrcp_message_t *message)
-{
- apt_bool_t status = FALSE;
- mrcp_connection_t *connection = channel->connection;
- apt_text_stream_t stream;
- apt_message_status_e result;
-
- if(!connection || !connection->sock) {
- apt_obj_log(APT_LOG_MARK,APT_PRIO_WARNING,channel->log_obj,"Null MRCPv2 Connection "APT_SIDRES_FMT,MRCP_MESSAGE_SIDRES(message));
- mrcp_client_agent_request_cancel(agent,channel,message);
- return FALSE;
- }
-
- do {
- apt_text_stream_init(&stream,connection->tx_buffer,connection->tx_buffer_size);
- result = mrcp_generator_run(connection->generator,message,&stream);
- if(result != APT_MESSAGE_STATUS_INVALID) {
- stream.text.length = stream.pos - stream.text.buf;
- *stream.pos = '\0';
-
- apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,channel->log_obj,"Send MRCPv2 Data %s [%"APR_SIZE_T_FMT" bytes]\n%.*s",
- connection->id,
- stream.text.length,
- connection->verbose == TRUE ? stream.text.length : 0,
- stream.text.buf);
-
- if(apr_socket_send(connection->sock,stream.text.buf,&stream.text.length) == APR_SUCCESS) {
- status = TRUE;
- }
- else {
- apt_obj_log(APT_LOG_MARK,APT_PRIO_WARNING,channel->log_obj,"Failed to Send MRCPv2 Data %s",
- connection->id);
- }
- }
- else {
- apt_obj_log(APT_LOG_MARK,APT_PRIO_WARNING,channel->log_obj,"Failed to Generate MRCPv2 Data %s",
- connection->id);
- }
- }
- while(result == APT_MESSAGE_STATUS_INCOMPLETE);
-
- if(status == TRUE) {
- channel->active_request = message;
- if(channel->request_timer && agent->request_timeout) {
- apt_timer_set(channel->request_timer,agent->request_timeout);
- }
- }
- else {
- mrcp_client_agent_request_cancel(agent,channel,message);
- }
- return status;
-}
-
-static apt_bool_t mrcp_client_message_handler(mrcp_connection_t *connection, mrcp_message_t *message, apt_message_status_e status)
-{
- if(status == APT_MESSAGE_STATUS_COMPLETE) {
- /* message is completely parsed */
- mrcp_control_channel_t *channel;
- apt_str_t identifier;
- apt_id_resource_generate(&message->channel_id.session_id,&message->channel_id.resource_name,'@',&identifier,message->pool);
- channel = mrcp_connection_channel_find(connection,&identifier);
- if(channel) {
- mrcp_connection_agent_t *agent = connection->agent;
- if(message->start_line.message_type == MRCP_MESSAGE_TYPE_RESPONSE) {
- if(!channel->active_request ||
- channel->active_request->start_line.request_id != message->start_line.request_id) {
- apt_obj_log(APT_LOG_MARK,APT_PRIO_WARNING,channel->log_obj,"Unexpected MRCP Response "APT_SIDRES_FMT" [%d]",
- MRCP_MESSAGE_SIDRES(message),
- message->start_line.request_id);
- return FALSE;
- }
- if(channel->request_timer) {
- apt_timer_kill(channel->request_timer);
- }
- channel->active_request = NULL;
- }
-
- mrcp_connection_message_receive(agent->vtable,channel,message);
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Find Channel "APT_SIDRES_FMT" in Connection %s [%d]",
- MRCP_MESSAGE_SIDRES(message),
- connection->id,
- apr_hash_count(connection->channel_table));
- }
- }
- return TRUE;
-}
-
-/* Receive MRCP message through TCP/MRCPv2 connection */
-static apt_bool_t mrcp_client_poller_signal_process(void *obj, const apr_pollfd_t *descriptor)
-{
- mrcp_connection_agent_t *agent = obj;
- mrcp_connection_t *connection = descriptor->client_data;
- apr_status_t status;
- apr_size_t offset;
- apr_size_t length;
- apt_text_stream_t *stream;
- mrcp_message_t *message;
- apt_message_status_e msg_status;
-
- if(!connection || !connection->sock) {
- return FALSE;
- }
- stream = &connection->rx_stream;
-
- /* calculate offset remaining from the previous receive / if any */
- offset = stream->pos - stream->text.buf;
- /* calculate available length */
- length = connection->rx_buffer_size - offset;
-
- status = apr_socket_recv(connection->sock,stream->pos,&length);
- if(status == APR_EOF || length == 0) {
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"TCP/MRCPv2 Peer Disconnected %s",connection->id);
- apt_poller_task_descriptor_remove(agent->task,&connection->sock_pfd);
- apr_socket_close(connection->sock);
- connection->sock = NULL;
-
- mrcp_client_agent_disconnect_raise(agent,connection);
- return TRUE;
- }
-
- /* calculate actual length of the stream */
- stream->text.length = offset + length;
- stream->pos[length] = '\0';
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Receive MRCPv2 Data %s [%"APR_SIZE_T_FMT" bytes]\n%.*s",
- connection->id,
- length,
- connection->verbose == TRUE ? length : 0,
- stream->pos);
-
- /* reset pos */
- apt_text_stream_reset(stream);
-
- do {
- msg_status = mrcp_parser_run(connection->parser,stream,&message);
- if(mrcp_client_message_handler(connection,message,msg_status) == FALSE) {
- return FALSE;
- }
- }
- while(apt_text_is_eos(stream) == FALSE);
-
- /* scroll remaining stream */
- apt_text_stream_scroll(stream);
- return TRUE;
-}
-
-/* Process task message */
-static apt_bool_t mrcp_client_agent_msg_process(apt_task_t *task, apt_task_msg_t *task_msg)
-{
- apt_poller_task_t *poller_task = apt_task_object_get(task);
- mrcp_connection_agent_t *agent = apt_poller_task_object_get(poller_task);
- connection_task_msg_t *msg = (connection_task_msg_t*) task_msg->data;
-
- switch(msg->type) {
- case CONNECTION_TASK_MSG_ADD_CHANNEL:
- mrcp_client_agent_channel_add(agent,msg->channel,msg->descriptor);
- break;
- case CONNECTION_TASK_MSG_MODIFY_CHANNEL:
- mrcp_client_agent_channel_modify(agent,msg->channel,msg->descriptor);
- break;
- case CONNECTION_TASK_MSG_REMOVE_CHANNEL:
- mrcp_client_agent_channel_remove(agent,msg->channel);
- break;
- case CONNECTION_TASK_MSG_SEND_MESSAGE:
- mrcp_client_agent_messsage_send(agent,msg->channel,msg->message);
- break;
- }
-
- return TRUE;
-}
-
-/* Timer callback */
-static void mrcp_client_timer_proc(apt_timer_t *timer, void *obj)
-{
- mrcp_control_channel_t *channel = obj;
- if(!channel) {
- return;
- }
-
- if(channel->request_timer == timer) {
- if(channel->active_request) {
- mrcp_client_agent_request_cancel(channel->agent,channel,channel->active_request);
- channel->active_request = NULL;
- }
- }
-}
diff --git a/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_connection.c b/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_connection.c
deleted file mode 100644
index bf9dc75d2c..0000000000
--- a/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_connection.c
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_connection.c 2170 2014-09-09 05:19:48Z achaloyan@gmail.com $
- */
-
-#include "mrcp_connection.h"
-#include "apt_pool.h"
-
-mrcp_connection_t* mrcp_connection_create(void)
-{
- mrcp_connection_t *connection;
- apr_pool_t *pool = apt_pool_create();
- if(!pool) {
- return NULL;
- }
-
- connection = apr_palloc(pool,sizeof(mrcp_connection_t));
- connection->pool = pool;
- apt_string_reset(&connection->remote_ip);
- connection->l_sockaddr = NULL;
- connection->r_sockaddr = NULL;
- connection->sock = NULL;
- connection->id = NULL;
- connection->verbose = TRUE;
- connection->access_count = 0;
- APR_RING_ELEM_INIT(connection,link);
- connection->channel_table = apr_hash_make(pool);
- connection->parser = NULL;
- connection->generator = NULL;
- connection->rx_buffer = NULL;
- connection->rx_buffer_size = 0;
- connection->tx_buffer = NULL;
- connection->tx_buffer_size = 0;
-
- return connection;
-}
-
-void mrcp_connection_destroy(mrcp_connection_t *connection)
-{
- if(connection && connection->pool) {
- apr_pool_destroy(connection->pool);
- }
-}
-
-apt_bool_t mrcp_connection_channel_add(mrcp_connection_t *connection, mrcp_control_channel_t *channel)
-{
- if(!connection || !channel) {
- return FALSE;
- }
- apr_hash_set(connection->channel_table,channel->identifier.buf,channel->identifier.length,channel);
- channel->connection = connection;
- connection->access_count++;
- return TRUE;
-}
-
-mrcp_control_channel_t* mrcp_connection_channel_find(const mrcp_connection_t *connection, const apt_str_t *identifier)
-{
- if(!connection || !identifier) {
- return NULL;
- }
- return apr_hash_get(connection->channel_table,identifier->buf,identifier->length);
-}
-
-apt_bool_t mrcp_connection_channel_remove(mrcp_connection_t *connection, mrcp_control_channel_t *channel)
-{
- if(!connection || !channel) {
- return FALSE;
- }
- apr_hash_set(connection->channel_table,channel->identifier.buf,channel->identifier.length,NULL);
- channel->connection = NULL;
- connection->access_count--;
- return TRUE;
-}
-
-apt_bool_t mrcp_connection_disconnect_raise(mrcp_connection_t *connection, const mrcp_connection_event_vtable_t *vtable)
-{
- if(vtable && vtable->on_disconnect) {
- mrcp_control_channel_t *channel;
- void *val;
- apr_hash_index_t *it = apr_hash_first(connection->pool,connection->channel_table);
- /* walk through the list of channels and raise disconnect event for them */
- for(; it; it = apr_hash_next(it)) {
- apr_hash_this(it,NULL,NULL,&val);
- channel = val;
- if(channel) {
- vtable->on_disconnect(channel);
- }
- }
- }
- return TRUE;
-}
diff --git a/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_control_descriptor.c b/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_control_descriptor.c
deleted file mode 100644
index 2339e8fb56..0000000000
--- a/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_control_descriptor.c
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_control_descriptor.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include "apt_string_table.h"
-#include "mrcp_control_descriptor.h"
-
-/** String table of mrcp proto types (mrcp_proto_type_e) */
-static const apt_str_table_item_t mrcp_proto_type_table[] = {
- {{"TCP/MRCPv2", 10},4},
- {{"TCP/TLS/MRCPv2",14},4}
-};
-
-/** String table of mrcp attributes (mrcp_attrib_e) */
-static const apt_str_table_item_t mrcp_attrib_table[] = {
- {{"setup", 5},0},
- {{"connection",10},1},
- {{"resource", 8},0},
- {{"channel", 7},1},
- {{"cmid", 4},1}
-};
-
-/** String table of mrcp setup attribute values (mrcp_setup_type_e) */
-static const apt_str_table_item_t mrcp_setup_value_table[] = {
- {{"active", 6},0},
- {{"passive", 7},0}
-};
-
-/** String table of mrcp connection attribute values (mrcp_connection_type_e) */
-static const apt_str_table_item_t mrcp_connection_value_table[] = {
- {{"new", 3},0},
- {{"existing", 8},0}
-};
-
-
-MRCP_DECLARE(const apt_str_t*) mrcp_proto_get(mrcp_proto_type_e proto)
-{
- return apt_string_table_str_get(mrcp_proto_type_table,MRCP_PROTO_COUNT,proto);
-}
-
-MRCP_DECLARE(mrcp_proto_type_e) mrcp_proto_find(const apt_str_t *attrib)
-{
- return apt_string_table_id_find(mrcp_proto_type_table,MRCP_PROTO_COUNT,attrib);
-}
-
-MRCP_DECLARE(const apt_str_t*) mrcp_attrib_str_get(mrcp_attrib_e attrib_id)
-{
- return apt_string_table_str_get(mrcp_attrib_table,MRCP_ATTRIB_COUNT,attrib_id);
-}
-
-MRCP_DECLARE(mrcp_attrib_e) mrcp_attrib_id_find(const apt_str_t *attrib)
-{
- return apt_string_table_id_find(mrcp_attrib_table,MRCP_ATTRIB_COUNT,attrib);
-}
-
-MRCP_DECLARE(const apt_str_t*) mrcp_setup_type_get(mrcp_setup_type_e setup_type)
-{
- return apt_string_table_str_get(mrcp_setup_value_table,MRCP_SETUP_TYPE_COUNT,setup_type);
-}
-
-MRCP_DECLARE(mrcp_setup_type_e) mrcp_setup_type_find(const apt_str_t *attrib)
-{
- return apt_string_table_id_find(mrcp_setup_value_table,MRCP_SETUP_TYPE_COUNT,attrib);
-}
-
-MRCP_DECLARE(const apt_str_t*) mrcp_connection_type_get(mrcp_connection_type_e connection_type)
-{
- return apt_string_table_str_get(mrcp_connection_value_table,MRCP_CONNECTION_TYPE_COUNT,connection_type);
-}
-
-MRCP_DECLARE(mrcp_connection_type_e) mrcp_connection_type_find(const apt_str_t *attrib)
-{
- return apt_string_table_id_find(mrcp_connection_value_table,MRCP_CONNECTION_TYPE_COUNT,attrib);
-}
-
-/** Create MRCP control descriptor */
-MRCP_DECLARE(mrcp_control_descriptor_t*) mrcp_control_descriptor_create(apr_pool_t *pool)
-{
- mrcp_control_descriptor_t *descriptor;
- descriptor = apr_palloc(pool,sizeof(mrcp_control_descriptor_t));
-
- apt_string_reset(&descriptor->ip);
- descriptor->port = 0;
- descriptor->proto = MRCP_PROTO_UNKNOWN;
- descriptor->setup_type = MRCP_SETUP_TYPE_UNKNOWN;
- descriptor->connection_type = MRCP_CONNECTION_TYPE_UNKNOWN;
- apt_string_reset(&descriptor->resource_name);
- apt_string_reset(&descriptor->session_id);
- descriptor->cmid_arr = apr_array_make(pool,1,sizeof(apr_size_t));
- descriptor->id = 0;
- return descriptor;
-}
-
-/** Create MRCP control offer */
-MRCP_DECLARE(mrcp_control_descriptor_t*) mrcp_control_offer_create(apr_pool_t *pool)
-{
- mrcp_control_descriptor_t *offer = mrcp_control_descriptor_create(pool);
- offer->proto = MRCP_PROTO_TCP;
- offer->port = TCP_DISCARD_PORT;
- offer->setup_type = MRCP_SETUP_TYPE_ACTIVE;
- offer->connection_type = MRCP_CONNECTION_TYPE_EXISTING;
- return offer;
-}
-
-/** Create MRCP control answer */
-MRCP_DECLARE(mrcp_control_descriptor_t*) mrcp_control_answer_create(mrcp_control_descriptor_t *offer, apr_pool_t *pool)
-{
- mrcp_control_descriptor_t *answer = mrcp_control_descriptor_create(pool);
- if(offer) {
- *answer = *offer;
- answer->cmid_arr = apr_array_copy(pool,offer->cmid_arr);
- }
- answer->setup_type = MRCP_SETUP_TYPE_PASSIVE;
- return answer;
-}
-
-/** Add cmid to cmid_arr */
-MRCP_DECLARE(void) mrcp_cmid_add(apr_array_header_t *cmid_arr, apr_size_t cmid)
-{
- APR_ARRAY_PUSH(cmid_arr, apr_size_t) = cmid;
-}
-
-/** Find cmid in cmid_arr */
-MRCP_DECLARE(apt_bool_t) mrcp_cmid_find(const apr_array_header_t *cmid_arr, apr_size_t cmid)
-{
- int i;
- for(i=0; inelts; i++) {
- if(APR_ARRAY_IDX(cmid_arr,i,apr_size_t) == cmid) {
- return TRUE;
- }
- }
- return FALSE;
-}
diff --git a/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_server_connection.c b/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_server_connection.c
deleted file mode 100644
index 3a77ff23d4..0000000000
--- a/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_server_connection.c
+++ /dev/null
@@ -1,715 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_server_connection.c 2249 2014-11-19 05:26:24Z achaloyan@gmail.com $
- */
-
-#include "mrcp_connection.h"
-#include "mrcp_server_connection.h"
-#include "mrcp_control_descriptor.h"
-#include "mrcp_resource_factory.h"
-#include "mrcp_message.h"
-#include "apt_text_stream.h"
-#include "apt_poller_task.h"
-#include "apt_pool.h"
-#include "apt_log.h"
-
-
-struct mrcp_connection_agent_t {
- apr_pool_t *pool;
- apt_poller_task_t *task;
- const mrcp_resource_factory_t *resource_factory;
-
- /** List (ring) of MRCP connections */
- APR_RING_HEAD(mrcp_connection_head_t, mrcp_connection_t) connection_list;
- /** Table of pending control channels */
- apr_hash_t *pending_channel_table;
-
- apt_bool_t force_new_connection;
- apr_size_t tx_buffer_size;
- apr_size_t rx_buffer_size;
-
- /* Listening socket */
- apr_sockaddr_t *sockaddr;
- apr_socket_t *listen_sock;
- apr_pollfd_t listen_sock_pfd;
-
- void *obj;
- const mrcp_connection_event_vtable_t *vtable;
-};
-
-typedef enum {
- CONNECTION_TASK_MSG_ADD_CHANNEL,
- CONNECTION_TASK_MSG_MODIFY_CHANNEL,
- CONNECTION_TASK_MSG_REMOVE_CHANNEL,
- CONNECTION_TASK_MSG_SEND_MESSAGE
-} connection_task_msg_type_e;
-
-typedef struct connection_task_msg_t connection_task_msg_t;
-struct connection_task_msg_t {
- connection_task_msg_type_e type;
- mrcp_connection_agent_t *agent;
- mrcp_control_channel_t *channel;
- mrcp_control_descriptor_t *descriptor;
- mrcp_message_t *message;
-};
-
-static apt_bool_t mrcp_server_agent_on_destroy(apt_task_t *task);
-static apt_bool_t mrcp_server_agent_msg_process(apt_task_t *task, apt_task_msg_t *task_msg);
-static apt_bool_t mrcp_server_poller_signal_process(void *obj, const apr_pollfd_t *descriptor);
-
-static apt_bool_t mrcp_server_agent_listening_socket_create(mrcp_connection_agent_t *agent);
-static void mrcp_server_agent_listening_socket_destroy(mrcp_connection_agent_t *agent);
-
-
-/** Create connection agent */
-MRCP_DECLARE(mrcp_connection_agent_t*) mrcp_server_connection_agent_create(
- const char *id,
- const char *listen_ip,
- apr_port_t listen_port,
- apr_size_t max_connection_count,
- apt_bool_t force_new_connection,
- apr_pool_t *pool)
-{
- apt_task_t *task;
- apt_task_vtable_t *vtable;
- apt_task_msg_pool_t *msg_pool;
- mrcp_connection_agent_t *agent;
-
- if(!listen_ip) {
- return NULL;
- }
-
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create MRCPv2 Agent [%s] %s:%hu [%"APR_SIZE_T_FMT"]",
- id,listen_ip,listen_port,max_connection_count);
- agent = apr_palloc(pool,sizeof(mrcp_connection_agent_t));
- agent->pool = pool;
- agent->sockaddr = NULL;
- agent->listen_sock = NULL;
- agent->force_new_connection = force_new_connection;
- agent->rx_buffer_size = MRCP_STREAM_BUFFER_SIZE;
- agent->tx_buffer_size = MRCP_STREAM_BUFFER_SIZE;
-
- apr_sockaddr_info_get(&agent->sockaddr,listen_ip,APR_INET,listen_port,0,pool);
- if(!agent->sockaddr) {
- return NULL;
- }
-
- msg_pool = apt_task_msg_pool_create_dynamic(sizeof(connection_task_msg_t),pool);
-
- agent->task = apt_poller_task_create(
- max_connection_count + 1,
- mrcp_server_poller_signal_process,
- agent,
- msg_pool,
- pool);
- if(!agent->task) {
- return NULL;
- }
-
- task = apt_poller_task_base_get(agent->task);
- if(task) {
- apt_task_name_set(task,id);
- }
-
- vtable = apt_poller_task_vtable_get(agent->task);
- if(vtable) {
- vtable->destroy = mrcp_server_agent_on_destroy;
- vtable->process_msg = mrcp_server_agent_msg_process;
- }
-
- APR_RING_INIT(&agent->connection_list, mrcp_connection_t, link);
- agent->pending_channel_table = apr_hash_make(pool);
-
- if(mrcp_server_agent_listening_socket_create(agent) != TRUE) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Listening Socket [%s] %s:%hu",
- id,
- listen_ip,
- listen_port);
- }
- return agent;
-}
-
-static apt_bool_t mrcp_server_agent_on_destroy(apt_task_t *task)
-{
- apt_poller_task_t *poller_task = apt_task_object_get(task);
- mrcp_connection_agent_t *agent = apt_poller_task_object_get(poller_task);
-
- mrcp_server_agent_listening_socket_destroy(agent);
- apt_poller_task_cleanup(poller_task);
- return TRUE;
-}
-
-/** Destroy connection agent. */
-MRCP_DECLARE(apt_bool_t) mrcp_server_connection_agent_destroy(mrcp_connection_agent_t *agent)
-{
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Destroy MRCPv2 Agent [%s]",
- mrcp_server_connection_agent_id_get(agent));
- return apt_poller_task_destroy(agent->task);
-}
-
-/** Start connection agent. */
-MRCP_DECLARE(apt_bool_t) mrcp_server_connection_agent_start(mrcp_connection_agent_t *agent)
-{
- return apt_poller_task_start(agent->task);
-}
-
-/** Terminate connection agent. */
-MRCP_DECLARE(apt_bool_t) mrcp_server_connection_agent_terminate(mrcp_connection_agent_t *agent)
-{
- return apt_poller_task_terminate(agent->task);
-}
-
-/** Set connection event handler. */
-MRCP_DECLARE(void) mrcp_server_connection_agent_handler_set(
- mrcp_connection_agent_t *agent,
- void *obj,
- const mrcp_connection_event_vtable_t *vtable)
-{
- agent->obj = obj;
- agent->vtable = vtable;
-}
-
-/** Set MRCP resource factory */
-MRCP_DECLARE(void) mrcp_server_connection_resource_factory_set(
- mrcp_connection_agent_t *agent,
- const mrcp_resource_factory_t *resource_factroy)
-{
- agent->resource_factory = resource_factroy;
-}
-
-/** Set rx buffer size */
-MRCP_DECLARE(void) mrcp_server_connection_rx_size_set(
- mrcp_connection_agent_t *agent,
- apr_size_t size)
-{
- if(size < MRCP_STREAM_BUFFER_SIZE) {
- size = MRCP_STREAM_BUFFER_SIZE;
- }
- agent->rx_buffer_size = size;
-}
-
-/** Set tx buffer size */
-MRCP_DECLARE(void) mrcp_server_connection_tx_size_set(
- mrcp_connection_agent_t *agent,
- apr_size_t size)
-{
- if(size < MRCP_STREAM_BUFFER_SIZE) {
- size = MRCP_STREAM_BUFFER_SIZE;
- }
- agent->tx_buffer_size = size;
-}
-
-/** Get task */
-MRCP_DECLARE(apt_task_t*) mrcp_server_connection_agent_task_get(const mrcp_connection_agent_t *agent)
-{
- return apt_poller_task_base_get(agent->task);
-}
-
-/** Get external object */
-MRCP_DECLARE(void*) mrcp_server_connection_agent_object_get(const mrcp_connection_agent_t *agent)
-{
- return agent->obj;
-}
-
-/** Get string identifier */
-MRCP_DECLARE(const char*) mrcp_server_connection_agent_id_get(const mrcp_connection_agent_t *agent)
-{
- apt_task_t *task = apt_poller_task_base_get(agent->task);
- return apt_task_name_get(task);
-}
-
-
-/** Create MRCPv2 control channel */
-MRCP_DECLARE(mrcp_control_channel_t*) mrcp_server_control_channel_create(mrcp_connection_agent_t *agent, void *obj, apr_pool_t *pool)
-{
- mrcp_control_channel_t *channel = apr_palloc(pool,sizeof(mrcp_control_channel_t));
- channel->agent = agent;
- channel->connection = NULL;
- channel->active_request = NULL;
- channel->request_timer = NULL;
- channel->removed = FALSE;
- channel->obj = obj;
- channel->log_obj = NULL;
- channel->pool = pool;
- return channel;
-}
-
-/** Destroy MRCPv2 control channel */
-MRCP_DECLARE(apt_bool_t) mrcp_server_control_channel_destroy(mrcp_control_channel_t *channel)
-{
- if(channel && channel->connection && channel->removed == TRUE) {
- mrcp_connection_t *connection = channel->connection;
- channel->connection = NULL;
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Destroy TCP/MRCPv2 Connection %s",connection->id);
- mrcp_connection_destroy(connection);
- }
- return TRUE;
-}
-
-/** Signal task message */
-static apt_bool_t mrcp_server_control_message_signal(
- connection_task_msg_type_e type,
- mrcp_connection_agent_t *agent,
- mrcp_control_channel_t *channel,
- mrcp_control_descriptor_t *descriptor,
- mrcp_message_t *message)
-{
- apt_task_t *task = apt_poller_task_base_get(agent->task);
- apt_task_msg_t *task_msg = apt_task_msg_get(task);
- if(task_msg) {
- connection_task_msg_t *msg = (connection_task_msg_t*)task_msg->data;
- msg->type = type;
- msg->agent = agent;
- msg->channel = channel;
- msg->descriptor = descriptor;
- msg->message = message;
- apt_task_msg_signal(task,task_msg);
- }
- return TRUE;
-}
-
-/** Add MRCPv2 control channel */
-MRCP_DECLARE(apt_bool_t) mrcp_server_control_channel_add(mrcp_control_channel_t *channel, mrcp_control_descriptor_t *descriptor)
-{
- return mrcp_server_control_message_signal(CONNECTION_TASK_MSG_ADD_CHANNEL,channel->agent,channel,descriptor,NULL);
-}
-
-/** Modify MRCPv2 control channel */
-MRCP_DECLARE(apt_bool_t) mrcp_server_control_channel_modify(mrcp_control_channel_t *channel, mrcp_control_descriptor_t *descriptor)
-{
- return mrcp_server_control_message_signal(CONNECTION_TASK_MSG_MODIFY_CHANNEL,channel->agent,channel,descriptor,NULL);
-}
-
-/** Remove MRCPv2 control channel */
-MRCP_DECLARE(apt_bool_t) mrcp_server_control_channel_remove(mrcp_control_channel_t *channel)
-{
- return mrcp_server_control_message_signal(CONNECTION_TASK_MSG_REMOVE_CHANNEL,channel->agent,channel,NULL,NULL);
-}
-
-/** Send MRCPv2 message */
-MRCP_DECLARE(apt_bool_t) mrcp_server_control_message_send(mrcp_control_channel_t *channel, mrcp_message_t *message)
-{
- return mrcp_server_control_message_signal(CONNECTION_TASK_MSG_SEND_MESSAGE,channel->agent,channel,NULL,message);
-}
-
-/** Create listening socket and add it to pollset */
-static apt_bool_t mrcp_server_agent_listening_socket_create(mrcp_connection_agent_t *agent)
-{
- apr_status_t status;
- if(!agent->sockaddr) {
- return FALSE;
- }
-
- /* create listening socket */
- status = apr_socket_create(&agent->listen_sock, agent->sockaddr->family, SOCK_STREAM, APR_PROTO_TCP, agent->pool);
- if(status != APR_SUCCESS) {
- return FALSE;
- }
-
- apr_socket_opt_set(agent->listen_sock, APR_SO_NONBLOCK, 0);
- apr_socket_timeout_set(agent->listen_sock, -1);
- apr_socket_opt_set(agent->listen_sock, APR_SO_REUSEADDR, 1);
-
- status = apr_socket_bind(agent->listen_sock, agent->sockaddr);
- if(status != APR_SUCCESS) {
- apr_socket_close(agent->listen_sock);
- agent->listen_sock = NULL;
- return FALSE;
- }
- status = apr_socket_listen(agent->listen_sock, SOMAXCONN);
- if(status != APR_SUCCESS) {
- apr_socket_close(agent->listen_sock);
- agent->listen_sock = NULL;
- return FALSE;
- }
-
- /* add listening socket to pollset */
- memset(&agent->listen_sock_pfd,0,sizeof(apr_pollfd_t));
- agent->listen_sock_pfd.desc_type = APR_POLL_SOCKET;
- agent->listen_sock_pfd.reqevents = APR_POLLIN;
- agent->listen_sock_pfd.desc.s = agent->listen_sock;
- agent->listen_sock_pfd.client_data = agent->listen_sock;
- if(apt_poller_task_descriptor_add(agent->task, &agent->listen_sock_pfd) != TRUE) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Add Listening Socket to Pollset [%s]",
- apt_task_name_get(apt_poller_task_base_get(agent->task)));
- apr_socket_close(agent->listen_sock);
- agent->listen_sock = NULL;
- return FALSE;
- }
-
- return TRUE;
-}
-
-/** Remove from pollset and destroy listening socket */
-static void mrcp_server_agent_listening_socket_destroy(mrcp_connection_agent_t *agent)
-{
- if(agent->listen_sock) {
- apt_poller_task_descriptor_remove(agent->task,&agent->listen_sock_pfd);
- apr_socket_close(agent->listen_sock);
- agent->listen_sock = NULL;
- }
-}
-
-static mrcp_control_channel_t* mrcp_connection_channel_associate(mrcp_connection_agent_t *agent, mrcp_connection_t *connection, const mrcp_message_t *message)
-{
- apt_str_t identifier;
- mrcp_control_channel_t *channel;
- if(!connection || !message) {
- return NULL;
- }
- apt_id_resource_generate(&message->channel_id.session_id,&message->channel_id.resource_name,'@',&identifier,connection->pool);
- channel = mrcp_connection_channel_find(connection,&identifier);
- if(!channel) {
- channel = apr_hash_get(agent->pending_channel_table,identifier.buf,identifier.length);
- if(channel) {
- apr_hash_set(agent->pending_channel_table,identifier.buf,identifier.length,NULL);
- mrcp_connection_channel_add(connection,channel);
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Assign Control Channel <%s> to Connection %s [%d] -> [%d]",
- channel->identifier.buf,
- connection->id,
- apr_hash_count(agent->pending_channel_table),
- apr_hash_count(connection->channel_table));
- }
- }
- return channel;
-}
-
-static mrcp_connection_t* mrcp_connection_find(mrcp_connection_agent_t *agent, const apt_str_t *remote_ip)
-{
- mrcp_connection_t *connection;
- if(!agent || !remote_ip) {
- return NULL;
- }
-
- for(connection = APR_RING_FIRST(&agent->connection_list);
- connection != APR_RING_SENTINEL(&agent->connection_list, mrcp_connection_t, link);
- connection = APR_RING_NEXT(connection, link)) {
- if(apt_string_compare(&connection->remote_ip,remote_ip) == TRUE) {
- return connection;
- }
- }
-
- return NULL;
-}
-
-static apt_bool_t mrcp_connection_remove(mrcp_connection_agent_t *agent, mrcp_connection_t *connection)
-{
- APR_RING_REMOVE(connection,link);
- return TRUE;
-}
-
-static apt_bool_t mrcp_server_agent_connection_accept(mrcp_connection_agent_t *agent)
-{
- char *local_ip = NULL;
- char *remote_ip = NULL;
-
- mrcp_connection_t *connection = mrcp_connection_create();
-
- if(apr_socket_accept(&connection->sock,agent->listen_sock,connection->pool) != APR_SUCCESS) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Accept Connection");
- mrcp_connection_destroy(connection);
- return FALSE;
- }
-
- if(apr_socket_addr_get(&connection->r_sockaddr,APR_REMOTE,connection->sock) != APR_SUCCESS ||
- apr_socket_addr_get(&connection->l_sockaddr,APR_LOCAL,connection->sock) != APR_SUCCESS) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Get Socket Address");
- apr_socket_close(connection->sock);
- mrcp_connection_destroy(connection);
- return FALSE;
- }
-
- apr_sockaddr_ip_get(&local_ip,connection->l_sockaddr);
- apr_sockaddr_ip_get(&remote_ip,connection->r_sockaddr);
- apt_string_set(&connection->remote_ip,remote_ip);
- connection->id = apr_psprintf(connection->pool,"%s:%hu <-> %s:%hu",
- local_ip,connection->l_sockaddr->port,
- remote_ip,connection->r_sockaddr->port);
-
- if(apr_hash_count(agent->pending_channel_table) == 0) {
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Reject Unexpected TCP/MRCPv2 Connection %s",connection->id);
- apr_socket_close(connection->sock);
- mrcp_connection_destroy(connection);
- return FALSE;
- }
-
- memset(&connection->sock_pfd,0,sizeof(apr_pollfd_t));
- connection->sock_pfd.desc_type = APR_POLL_SOCKET;
- connection->sock_pfd.reqevents = APR_POLLIN;
- connection->sock_pfd.desc.s = connection->sock;
- connection->sock_pfd.client_data = connection;
- if(apt_poller_task_descriptor_add(agent->task, &connection->sock_pfd) != TRUE) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Add to Pollset %s",connection->id);
- apr_socket_close(connection->sock);
- mrcp_connection_destroy(connection);
- return FALSE;
- }
-
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Accepted TCP/MRCPv2 Connection %s",connection->id);
- connection->agent = agent;
- APR_RING_INSERT_TAIL(&agent->connection_list,connection,mrcp_connection_t,link);
-
- connection->parser = mrcp_parser_create(agent->resource_factory,connection->pool);
- connection->generator = mrcp_generator_create(agent->resource_factory,connection->pool);
-
- connection->tx_buffer_size = agent->tx_buffer_size;
- connection->tx_buffer = apr_palloc(connection->pool,connection->tx_buffer_size+1);
-
- connection->rx_buffer_size = agent->rx_buffer_size;
- connection->rx_buffer = apr_palloc(connection->pool,connection->rx_buffer_size+1);
- apt_text_stream_init(&connection->rx_stream,connection->rx_buffer,connection->rx_buffer_size);
-
- if(apt_log_masking_get() != APT_LOG_MASKING_NONE) {
- connection->verbose = FALSE;
- mrcp_parser_verbose_set(connection->parser,TRUE);
- mrcp_generator_verbose_set(connection->generator,TRUE);
- }
- return TRUE;
-}
-
-static apt_bool_t mrcp_server_agent_connection_close(mrcp_connection_agent_t *agent, mrcp_connection_t *connection)
-{
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"TCP/MRCPv2 Peer Disconnected %s",connection->id);
- apt_poller_task_descriptor_remove(agent->task,&connection->sock_pfd);
- apr_socket_close(connection->sock);
- connection->sock = NULL;
- if(!connection->access_count) {
- mrcp_connection_remove(agent,connection);
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Destroy TCP/MRCPv2 Connection %s",connection->id);
- mrcp_connection_destroy(connection);
- }
- return TRUE;
-}
-
-static apt_bool_t mrcp_server_agent_channel_add(mrcp_connection_agent_t *agent, mrcp_control_channel_t *channel, mrcp_control_descriptor_t *offer)
-{
- mrcp_control_descriptor_t *answer = mrcp_control_answer_create(offer,channel->pool);
- apt_id_resource_generate(&offer->session_id,&offer->resource_name,'@',&channel->identifier,channel->pool);
- if(offer->port) {
- answer->port = agent->sockaddr->port;
- }
- if(offer->connection_type == MRCP_CONNECTION_TYPE_EXISTING) {
- if(agent->force_new_connection == TRUE) {
- /* force client to establish new connection */
- answer->connection_type = MRCP_CONNECTION_TYPE_NEW;
- }
- else {
- mrcp_connection_t *connection = NULL;
- /* try to find any existing connection */
- connection = mrcp_connection_find(agent,&offer->ip);
- if(!connection) {
- /* no existing conection found, force the new one */
- answer->connection_type = MRCP_CONNECTION_TYPE_NEW;
- }
- }
- }
-
- apr_hash_set(agent->pending_channel_table,channel->identifier.buf,channel->identifier.length,channel);
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Add Pending Control Channel <%s> [%d]",
- channel->identifier.buf,
- apr_hash_count(agent->pending_channel_table));
- /* send response */
- return mrcp_control_channel_add_respond(agent->vtable,channel,answer,TRUE);
-}
-
-static apt_bool_t mrcp_server_agent_channel_modify(mrcp_connection_agent_t *agent, mrcp_control_channel_t *channel, mrcp_control_descriptor_t *offer)
-{
- mrcp_control_descriptor_t *answer = mrcp_control_answer_create(offer,channel->pool);
- if(offer->port) {
- answer->port = agent->sockaddr->port;
- }
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Modify Control Channel <%s>",channel->identifier.buf);
- /* send response */
- return mrcp_control_channel_modify_respond(agent->vtable,channel,answer,TRUE);
-}
-
-static apt_bool_t mrcp_server_agent_channel_remove(mrcp_connection_agent_t *agent, mrcp_control_channel_t *channel)
-{
- mrcp_connection_t *connection = channel->connection;
- if(connection) {
- mrcp_connection_channel_remove(connection,channel);
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Remove Control Channel <%s> [%d]",
- channel->identifier.buf,
- apr_hash_count(connection->channel_table));
- if(!connection->access_count) {
- if(!connection->sock) {
- mrcp_connection_remove(agent,connection);
- /* set connection to be destroyed on channel destroy */
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Mark Connection for Removal %s",connection->id);
- channel->connection = connection;
- channel->removed = TRUE;
- }
- }
- }
- else {
- apr_hash_set(agent->pending_channel_table,channel->identifier.buf,channel->identifier.length,NULL);
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Remove Pending Control Channel <%s> [%d]",
- channel->identifier.buf,
- apr_hash_count(agent->pending_channel_table));
- }
- /* send response */
- return mrcp_control_channel_remove_respond(agent->vtable,channel,TRUE);
-}
-
-static apt_bool_t mrcp_server_agent_messsage_send(mrcp_connection_agent_t *agent, mrcp_connection_t *connection, mrcp_message_t *message)
-{
- apt_bool_t status = FALSE;
- apt_text_stream_t stream;
- apt_message_status_e result;
- if(!connection || !connection->sock) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Null MRCPv2 Connection "APT_SIDRES_FMT,MRCP_MESSAGE_SIDRES(message));
- return FALSE;
- }
-
- do {
- apt_text_stream_init(&stream,connection->tx_buffer,connection->tx_buffer_size);
- result = mrcp_generator_run(connection->generator,message,&stream);
- if(result != APT_MESSAGE_STATUS_INVALID) {
- stream.text.length = stream.pos - stream.text.buf;
- *stream.pos = '\0';
-
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Send MRCPv2 Data %s [%"APR_SIZE_T_FMT" bytes]\n%.*s",
- connection->id,
- stream.text.length,
- connection->verbose == TRUE ? stream.text.length : 0,
- stream.text.buf);
-
- if(apr_socket_send(connection->sock,stream.text.buf,&stream.text.length) == APR_SUCCESS) {
- status = TRUE;
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Send MRCPv2 Data");
- }
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Generate MRCPv2 Data");
- }
- }
- while(result == APT_MESSAGE_STATUS_INCOMPLETE);
-
- return status;
-}
-
-static apt_bool_t mrcp_server_message_handler(mrcp_connection_t *connection, mrcp_message_t *message, apt_message_status_e status)
-{
- mrcp_connection_agent_t *agent = connection->agent;
- if(status == APT_MESSAGE_STATUS_COMPLETE) {
- /* message is completely parsed */
- mrcp_control_channel_t *channel = mrcp_connection_channel_associate(agent,connection,message);
- if(channel) {
- mrcp_connection_message_receive(agent->vtable,channel,message);
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Find Channel "APT_SIDRES_FMT" in Connection %s",
- MRCP_MESSAGE_SIDRES(message),
- connection->id);
- }
- }
- else if(status == APT_MESSAGE_STATUS_INVALID) {
- /* error case */
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Parse MRCPv2 Data");
- if(message && message->resource) {
- mrcp_message_t *response;
- response = mrcp_response_create(message,message->pool);
- response->start_line.status_code = MRCP_STATUS_CODE_UNRECOGNIZED_MESSAGE;
- if(mrcp_server_agent_messsage_send(agent,connection,response) == FALSE) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Send MRCPv2 Response");
- }
- }
- }
- return TRUE;
-}
-
-/* Receive MRCP message through TCP/MRCPv2 connection */
-static apt_bool_t mrcp_server_poller_signal_process(void *obj, const apr_pollfd_t *descriptor)
-{
- mrcp_connection_agent_t *agent = obj;
- mrcp_connection_t *connection = descriptor->client_data;
- apr_status_t status;
- apr_size_t offset;
- apr_size_t length;
- apt_text_stream_t *stream;
- mrcp_message_t *message;
- apt_message_status_e msg_status;
-
- if(descriptor->desc.s == agent->listen_sock) {
- return mrcp_server_agent_connection_accept(agent);
- }
-
- if(!connection || !connection->sock) {
- return FALSE;
- }
- stream = &connection->rx_stream;
-
- /* calculate offset remaining from the previous receive / if any */
- offset = stream->pos - stream->text.buf;
- /* calculate available length */
- length = connection->rx_buffer_size - offset;
-
- status = apr_socket_recv(connection->sock,stream->pos,&length);
- if(status == APR_EOF || length == 0) {
- return mrcp_server_agent_connection_close(agent,connection);
- }
-
- /* calculate actual length of the stream */
- stream->text.length = offset + length;
- stream->pos[length] = '\0';
-
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Receive MRCPv2 Data %s [%"APR_SIZE_T_FMT" bytes]\n%.*s",
- connection->id,
- length,
- connection->verbose == TRUE ? length : 0,
- stream->pos);
-
- /* reset pos */
- apt_text_stream_reset(stream);
-
- do {
- msg_status = mrcp_parser_run(connection->parser,stream,&message);
- if(mrcp_server_message_handler(connection,message,msg_status) == FALSE) {
- return FALSE;
- }
- }
- while(apt_text_is_eos(stream) == FALSE);
-
- /* scroll remaining stream */
- apt_text_stream_scroll(stream);
- return TRUE;
-}
-
-/* Process task message */
-static apt_bool_t mrcp_server_agent_msg_process(apt_task_t *task, apt_task_msg_t *task_msg)
-{
- apt_poller_task_t *poller_task = apt_task_object_get(task);
- mrcp_connection_agent_t *agent = apt_poller_task_object_get(poller_task);
- connection_task_msg_t *msg = (connection_task_msg_t*) task_msg->data;
- switch(msg->type) {
- case CONNECTION_TASK_MSG_ADD_CHANNEL:
- mrcp_server_agent_channel_add(agent,msg->channel,msg->descriptor);
- break;
- case CONNECTION_TASK_MSG_MODIFY_CHANNEL:
- mrcp_server_agent_channel_modify(agent,msg->channel,msg->descriptor);
- break;
- case CONNECTION_TASK_MSG_REMOVE_CHANNEL:
- mrcp_server_agent_channel_remove(agent,msg->channel);
- break;
- case CONNECTION_TASK_MSG_SEND_MESSAGE:
- mrcp_server_agent_messsage_send(agent,msg->channel->connection,msg->message);
- break;
- }
-
- return TRUE;
-}
diff --git a/libs/unimrcp/libs/uni-rtsp/Makefile.am b/libs/unimrcp/libs/uni-rtsp/Makefile.am
deleted file mode 100644
index f058b8d94b..0000000000
--- a/libs/unimrcp/libs/uni-rtsp/Makefile.am
+++ /dev/null
@@ -1,22 +0,0 @@
-MAINTAINERCLEANFILES = Makefile.in
-
-AM_CPPFLAGS = -I$(top_srcdir)/libs/uni-rtsp/include \
- -I$(top_srcdir)/libs/apr-toolkit/include \
- $(UNIMRCP_APR_INCLUDES)
-
-noinst_LTLIBRARIES = libunirtsp.la
-
-include_HEADERS = include/rtsp.h \
- include/rtsp_header.h \
- include/rtsp_start_line.h \
- include/rtsp_message.h \
- include/rtsp_stream.h \
- include/rtsp_server.h \
- include/rtsp_client.h
-
-libunirtsp_la_SOURCES = src/rtsp_header.c \
- src/rtsp_start_line.c \
- src/rtsp_message.c \
- src/rtsp_stream.c \
- src/rtsp_server.c \
- src/rtsp_client.c
diff --git a/libs/unimrcp/libs/uni-rtsp/include/rtsp.h b/libs/unimrcp/libs/uni-rtsp/include/rtsp.h
deleted file mode 100644
index 89ecb81776..0000000000
--- a/libs/unimrcp/libs/uni-rtsp/include/rtsp.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: rtsp.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef RTSP_H
-#define RTSP_H
-
-/**
- * @file rtsp.h
- * @brief RTSP Core Definitions
- */
-
-#include
-#include
-
-/** Library export/import defines */
-#ifdef WIN32
-#ifdef RTSP_STATIC_LIB
-#define RTSP_DECLARE(type) type __stdcall
-#else
-#ifdef RTSP_LIB_EXPORT
-#define RTSP_DECLARE(type) __declspec(dllexport) type __stdcall
-#else
-#define RTSP_DECLARE(type) __declspec(dllimport) type __stdcall
-#endif
-#endif
-#else
-#define RTSP_DECLARE(type) type
-#endif
-
-#endif /* RTSP_H */
diff --git a/libs/unimrcp/libs/uni-rtsp/include/rtsp_client.h b/libs/unimrcp/libs/uni-rtsp/include/rtsp_client.h
deleted file mode 100644
index 811ccb304f..0000000000
--- a/libs/unimrcp/libs/uni-rtsp/include/rtsp_client.h
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: rtsp_client.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef RTSP_CLIENT_H
-#define RTSP_CLIENT_H
-
-/**
- * @file rtsp_client.h
- * @brief RTSP Client
- */
-
-#include "apt_task.h"
-#include "rtsp_message.h"
-
-APT_BEGIN_EXTERN_C
-
-/** Opaque RTSP client declaration */
-typedef struct rtsp_client_t rtsp_client_t;
-/** Opaque RTSP client session declaration */
-typedef struct rtsp_client_session_t rtsp_client_session_t;
-
-/** RTSP client vtable declaration */
-typedef struct rtsp_client_vtable_t rtsp_client_vtable_t;
-
-/** RTSP client vtable */
-struct rtsp_client_vtable_t {
- /** Sesssion termination response handler */
- apt_bool_t (*on_session_terminate_response)(rtsp_client_t *client, rtsp_client_session_t *session);
- /** Sesssion termination event handler */
- apt_bool_t (*on_session_terminate_event)(rtsp_client_t *client, rtsp_client_session_t *session);
- /** Sesssion setup response handler */
- apt_bool_t (*on_session_response)(rtsp_client_t *client, rtsp_client_session_t *session, rtsp_message_t *request, rtsp_message_t *response);
- /** Sesssion event handler */
- apt_bool_t (*on_session_event)(rtsp_client_t *client, rtsp_client_session_t *session, rtsp_message_t *message);
-};
-
-/**
- * Create RTSP client.
- * @param id the identifier of the client
- * @param max_connection_count the number of max RTSP connections
- * @param request_timeout the request timeout to set
- * @param obj the external object to send event to
- * @param handler the response/event handler
- * @param pool the pool to allocate memory from
- */
-RTSP_DECLARE(rtsp_client_t*) rtsp_client_create(
- const char *id,
- apr_size_t max_connection_count,
- apr_size_t request_timeout,
- void *obj,
- const rtsp_client_vtable_t *handler,
- apr_pool_t *pool);
-
-/**
- * Destroy RTSP client.
- * @param client the client to destroy
- */
-RTSP_DECLARE(apt_bool_t) rtsp_client_destroy(rtsp_client_t *client);
-
-/**
- * Start client and wait for incoming requests.
- * @param client the client to start
- */
-RTSP_DECLARE(apt_bool_t) rtsp_client_start(rtsp_client_t *client);
-
-/**
- * Terminate client.
- * @param client the client to terminate
- */
-RTSP_DECLARE(apt_bool_t) rtsp_client_terminate(rtsp_client_t *client);
-
-/**
- * Get task.
- * @param client the client to get task from
- */
-RTSP_DECLARE(apt_task_t*) rtsp_client_task_get(const rtsp_client_t *client);
-
-/**
- * Get external object.
- * @param client the client to get object from
- */
-RTSP_DECLARE(void*) rtsp_client_object_get(const rtsp_client_t *client);
-
-
-/**
- * Create RTSP session.
- * @param client the client to create session for
- * @param server_ip the IP address of RTSP server
- * @param server_port the port of RTSP server
- * @param resource_location the location of RTSP resource (path in RTSP URI)
- */
-RTSP_DECLARE(rtsp_client_session_t*) rtsp_client_session_create(
- rtsp_client_t *client,
- const char *server_ip,
- apr_port_t server_port,
- const char *resource_location);
-
-/**
- * Destroy RTSP session.
- * @param session the session to destroy
- */
-RTSP_DECLARE(void) rtsp_client_session_destroy(rtsp_client_session_t *session);
-
-/**
- * Terminate RTSP session.
- * @param client the client to use
- * @param session the session to terminate
- */
-RTSP_DECLARE(apt_bool_t) rtsp_client_session_terminate(rtsp_client_t *client, rtsp_client_session_t *session);
-
-/**
- * Send RTSP message.
- * @param client the client to use
- * @param session the session to send RTSP request for
- * @param message the RTSP request to send
- */
-RTSP_DECLARE(apt_bool_t) rtsp_client_session_request(rtsp_client_t *client, rtsp_client_session_t *session, rtsp_message_t *message);
-
-/**
- * Get object associated with the session.
- * @param session the session to get object from
- */
-RTSP_DECLARE(void*) rtsp_client_session_object_get(const rtsp_client_session_t *session);
-
-/**
- * Set object associated with the session.
- * @param session the session to set object for
- * @param obj the object to set
- */
-RTSP_DECLARE(void) rtsp_client_session_object_set(rtsp_client_session_t *session, void *obj);
-
-/**
- * Get the session identifier.
- * @param session the session to get identifier from
- */
-RTSP_DECLARE(const apt_str_t*) rtsp_client_session_id_get(const rtsp_client_session_t *session);
-
-APT_END_EXTERN_C
-
-#endif /* RTSP_CLIENT_H */
diff --git a/libs/unimrcp/libs/uni-rtsp/include/rtsp_header.h b/libs/unimrcp/libs/uni-rtsp/include/rtsp_header.h
deleted file mode 100644
index 7d5c6cb350..0000000000
--- a/libs/unimrcp/libs/uni-rtsp/include/rtsp_header.h
+++ /dev/null
@@ -1,232 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: rtsp_header.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef RTSP_HEADER_H
-#define RTSP_HEADER_H
-
-/**
- * @file rtsp_header.h
- * @brief RTSP Header
- */
-
-#include "rtsp.h"
-#include "apt_header_field.h"
-
-APT_BEGIN_EXTERN_C
-
-/** RTSP transport protocol */
-typedef enum{
- RTSP_TRANSPORT_RTP,
-
- RTSP_TRANSPORT_COUNT,
- RTSP_TRANSPORT_NONE = RTSP_TRANSPORT_COUNT
-} rtsp_transport_e;
-
-/** RTSP transport profile */
-typedef enum{
- RTSP_PROFILE_AVP,
- RTSP_PROFILE_SAVP,
-
- RTSP_PROFILE_COUNT,
- RTSP_PROFILE_NONE = RTSP_PROFILE_COUNT
-} rtsp_profile_e;
-
-/** RTSP lower-transport */
-typedef enum{
- RTSP_LOWER_TRANSPORT_UDP,
- RTSP_LOWER_TRANSPORT_TCP,
-
- RTSP_LOWER_TRANSPORT_COUNT,
- RTSP_LOWER_TRANSPORT_NONE = RTSP_LOWER_TRANSPORT_COUNT
-} rtsp_lower_transport_e;
-
-/** RTSP transport attributes */
-typedef enum{
- RTSP_TRANSPORT_ATTRIB_CLIENT_PORT,
- RTSP_TRANSPORT_ATTRIB_SERVER_PORT,
- RTSP_TRANSPORT_ATTRIB_SOURCE,
- RTSP_TRANSPORT_ATTRIB_DESTINATION,
- RTSP_TRANSPORT_ATTRIB_UNICAST,
- RTSP_TRANSPORT_ATTRIB_MULTICAST,
- RTSP_TRANSPORT_ATTRIB_MODE,
-
- RTSP_TRANSPORT_ATTRIB_COUNT,
- RTSP_TRANSPORT_ATTRIB_NONE = RTSP_TRANSPORT_ATTRIB_COUNT
-} rtsp_transport_attrib_e;
-
-/** RTSP delivery */
-typedef enum{
- RTSP_DELIVERY_UNICAST,
- RTSP_DELIVERY_MULTICAST,
-
- RTSP_DELIVERY_COUNT,
- RTSP_DELIVERY_NONE = RTSP_DELIVERY_COUNT
-} rtsp_delivery_e;
-
-/** RTSP header fields */
-typedef enum{
- RTSP_HEADER_FIELD_CSEQ,
- RTSP_HEADER_FIELD_TRANSPORT,
- RTSP_HEADER_FIELD_SESSION_ID,
- RTSP_HEADER_FIELD_RTP_INFO,
- RTSP_HEADER_FIELD_CONTENT_TYPE,
- RTSP_HEADER_FIELD_CONTENT_LENGTH,
-
- RTSP_HEADER_FIELD_COUNT,
- RTSP_HEADER_FIELD_UNKNOWN = RTSP_HEADER_FIELD_COUNT
-} rtsp_header_field_id;
-
-/** RTSP content types */
-typedef enum {
- RTSP_CONTENT_TYPE_SDP,
- RTSP_CONTENT_TYPE_MRCP,
-
- RTSP_CONTENT_TYPE_COUNT,
- RTSP_CONTENT_TYPE_NONE = RTSP_CONTENT_TYPE_COUNT
-} rtsp_content_type_e;
-
-
-
-/** RTSP/RTP port range declaration */
-typedef struct rtsp_port_range_t rtsp_port_range_t;
-/** RTSP transport declaration */
-typedef struct rtsp_transport_t rtsp_transport_t;
-/** RTSP header declaration */
-typedef struct rtsp_header_t rtsp_header_t;
-
-/** RTSP/RTP port range */
-struct rtsp_port_range_t {
- /** Min (low) port */
- apr_port_t min;
- /** Max (high) port */
- apr_port_t max;
-};
-
-/** RTSP transport */
-struct rtsp_transport_t {
- /** Transport profile */
- rtsp_transport_e protocol;
- /** Transport profile */
- rtsp_profile_e profile;
- /** Lower transport */
- rtsp_lower_transport_e lower_protocol;
- /** Delivery method */
- rtsp_delivery_e delivery;
- /** Client port range */
- rtsp_port_range_t client_port_range;
- /** Server port range */
- rtsp_port_range_t server_port_range;
- /** Source IP address */
- apt_str_t source;
- /** Destination IP address */
- apt_str_t destination;
- /** Mode indicates the method to support (either PLAY or RECORD) */
- apt_str_t mode;
-};
-
-/** RTSP header */
-struct rtsp_header_t {
- /** Sequence number */
- apr_size_t cseq;
- /** Transport */
- rtsp_transport_t transport;
- /** Session identifier */
- apt_str_t session_id;
- /** RTP-info */
- apt_str_t rtp_info;
-
- /** Content type */
- rtsp_content_type_e content_type;
- /** Content length */
- apr_size_t content_length;
-
- /** Header section (collection of header fields)*/
- apt_header_section_t header_section;
-};
-
-
-/** Initialize port range */
-static APR_INLINE void rtsp_port_range_init(rtsp_port_range_t *port_range)
-{
- port_range->min = 0;
- port_range->max = 0;
-}
-
-/** Initialize port range */
-static APR_INLINE apt_bool_t rtsp_port_range_is_valid(const rtsp_port_range_t *port_range)
-{
- return (port_range->min == 0 && port_range->max == 0) == FALSE;
-}
-
-/** Initialize transport */
-static APR_INLINE void rtsp_transport_init(rtsp_transport_t *transport)
-{
- transport->protocol = RTSP_TRANSPORT_RTP;
- transport->profile = RTSP_PROFILE_NONE;
- transport->lower_protocol = RTSP_LOWER_TRANSPORT_NONE;
- rtsp_port_range_init(&transport->client_port_range);
- rtsp_port_range_init(&transport->server_port_range);
- apt_string_reset(&transport->source);
- apt_string_reset(&transport->destination);
- apt_string_reset(&transport->mode);
-}
-
-/** Initialize header */
-static APR_INLINE void rtsp_header_init(rtsp_header_t *header, apr_pool_t *pool)
-{
- header->cseq = 0;
- rtsp_transport_init(&header->transport);
- apt_string_reset(&header->session_id);
- apt_string_reset(&header->rtp_info);
- header->content_type = RTSP_CONTENT_TYPE_NONE;
- header->content_length = 0;
-
- apt_header_section_init(&header->header_section);
- apt_header_section_array_alloc(&header->header_section,RTSP_HEADER_FIELD_COUNT,pool);
-}
-
-
-/** Add RTSP header field */
-RTSP_DECLARE(apt_bool_t) rtsp_header_field_add(rtsp_header_t *header, apt_header_field_t *header_field, apr_pool_t *pool);
-
-/** Parse RTSP header fields */
-RTSP_DECLARE(apt_bool_t) rtsp_header_fields_parse(rtsp_header_t *header, apr_pool_t *pool);
-
-/** Add RTSP header field property */
-RTSP_DECLARE(apt_bool_t) rtsp_header_property_add(rtsp_header_t *header, rtsp_header_field_id id, apr_pool_t *pool);
-
-/** Remove RTSP header field property */
-static APR_INLINE apt_bool_t rtsp_header_property_remove(rtsp_header_t *header, rtsp_header_field_id id)
-{
- apt_header_field_t *header_field = apt_header_section_field_get(&header->header_section,id);
- if(header_field) {
- return apt_header_section_field_remove(&header->header_section,header_field);
- }
- return FALSE;
-}
-
-/** Check RTSP header field property */
-static APR_INLINE apt_bool_t rtsp_header_property_check(const rtsp_header_t *header, rtsp_header_field_id id)
-{
- return apt_header_section_field_check(&header->header_section,id);
-}
-
-
-APT_END_EXTERN_C
-
-#endif /* RTSP_HEADER_H */
diff --git a/libs/unimrcp/libs/uni-rtsp/include/rtsp_message.h b/libs/unimrcp/libs/uni-rtsp/include/rtsp_message.h
deleted file mode 100644
index a636bc4de7..0000000000
--- a/libs/unimrcp/libs/uni-rtsp/include/rtsp_message.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: rtsp_message.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef RTSP_MESSAGE_H
-#define RTSP_MESSAGE_H
-
-/**
- * @file rtsp_message.h
- * @brief RTSP Message Definition
- */
-
-#include "rtsp_start_line.h"
-#include "rtsp_header.h"
-
-APT_BEGIN_EXTERN_C
-
-/** RTSP message declaration */
-typedef struct rtsp_message_t rtsp_message_t;
-
-/** RTSP message */
-struct rtsp_message_t {
- /** RTSP mesage type (request/response) */
- rtsp_start_line_t start_line;
- /** RTSP header */
- rtsp_header_t header;
- /** RTSP message body */
- apt_str_t body;
-
- /** Pool to allocate memory from */
- apr_pool_t *pool;
-};
-
-/**
- * Create RTSP message.
- * @param message_type the message type
- * @param pool the pool to allocate memory from
- */
-RTSP_DECLARE(rtsp_message_t*) rtsp_message_create(rtsp_message_type_e message_type, apr_pool_t *pool);
-
-/**
- * Create RTSP request message.
- * @param pool the pool to allocate memory from
- */
-RTSP_DECLARE(rtsp_message_t*) rtsp_request_create(apr_pool_t *pool);
-
-/**
- * Create RTSP response message.
- * @param request the request to create response to
- * @param status_code the status code of the response
- * @param reason the reason phrase id of the response
- * @param pool the pool to allocate memory from
- */
-RTSP_DECLARE(rtsp_message_t*) rtsp_response_create(const rtsp_message_t *request, rtsp_status_code_e status_code, rtsp_reason_phrase_e reason, apr_pool_t *pool);
-
-/**
- * Destroy RTSP message
- * @param message the message to destroy
- */
-RTSP_DECLARE(void) rtsp_message_destroy(rtsp_message_t *message);
-
-APT_END_EXTERN_C
-
-#endif /* RTSP_MESSAGE_H */
diff --git a/libs/unimrcp/libs/uni-rtsp/include/rtsp_server.h b/libs/unimrcp/libs/uni-rtsp/include/rtsp_server.h
deleted file mode 100644
index 768ed2c23a..0000000000
--- a/libs/unimrcp/libs/uni-rtsp/include/rtsp_server.h
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: rtsp_server.h 2252 2014-11-21 02:45:15Z achaloyan@gmail.com $
- */
-
-#ifndef RTSP_SERVER_H
-#define RTSP_SERVER_H
-
-/**
- * @file rtsp_server.h
- * @brief RTSP Server
- */
-
-#include "apt_task.h"
-#include "rtsp_message.h"
-
-APT_BEGIN_EXTERN_C
-
-/** Opaque RTSP server declaration */
-typedef struct rtsp_server_t rtsp_server_t;
-/** Opaque RTSP server session declaration */
-typedef struct rtsp_server_session_t rtsp_server_session_t;
-
-/** RTSP server vtable declaration */
-typedef struct rtsp_server_vtable_t rtsp_server_vtable_t;
-
-/** RTSP server vtable declaration */
-struct rtsp_server_vtable_t {
- /** Virtual create session */
- apt_bool_t (*create_session)(rtsp_server_t *server, rtsp_server_session_t *session);
- /** Virtual terminate session */
- apt_bool_t (*terminate_session)(rtsp_server_t *server, rtsp_server_session_t *session);
- /** Virtual message handler */
- apt_bool_t (*handle_message)(rtsp_server_t *server, rtsp_server_session_t *session, rtsp_message_t *message);
-};
-
-/**
- * Create RTSP server.
- * @param id the identifier of the server
- * @param listen_ip the listen IP address
- * @param listen_port the listen port
- * @param max_connection_count the number of max RTSP connections
- * @param obj the external object to send events to
- * @param handler the request handler
- * @param pool the pool to allocate memory from
- */
-RTSP_DECLARE(rtsp_server_t*) rtsp_server_create(
- const char *id,
- const char *listen_ip,
- apr_port_t listen_port,
- apr_size_t max_connection_count,
- void *obj,
- const rtsp_server_vtable_t *handler,
- apr_pool_t *pool);
-
-/**
- * Destroy RTSP server.
- * @param server the server to destroy
- */
-RTSP_DECLARE(apt_bool_t) rtsp_server_destroy(rtsp_server_t *server);
-
-/**
- * Start server and wait for incoming requests.
- * @param server the server to start
- */
-RTSP_DECLARE(apt_bool_t) rtsp_server_start(rtsp_server_t *server);
-
-/**
- * Terminate server.
- * @param server the server to terminate
- */
-RTSP_DECLARE(apt_bool_t) rtsp_server_terminate(rtsp_server_t *server);
-
-/**
- * Get task.
- * @param server the server to get task from
- */
-RTSP_DECLARE(apt_task_t*) rtsp_server_task_get(const rtsp_server_t *server);
-
-/**
- * Get external object.
- * @param server the server to get object from
- */
-RTSP_DECLARE(void*) rtsp_server_object_get(const rtsp_server_t *server);
-
-/**
- * Send RTSP message.
- * @param server the server to use
- * @param session the session to send RTSP response for
- * @param message the RTSP response to send
- */
-RTSP_DECLARE(apt_bool_t) rtsp_server_session_respond(rtsp_server_t *server, rtsp_server_session_t *session, rtsp_message_t *message);
-
-/**
- * Terminate RTSP session (respond to terminate request).
- * @param server the server to use
- * @param session the session to terminate
- */
-RTSP_DECLARE(apt_bool_t) rtsp_server_session_terminate(rtsp_server_t *server, rtsp_server_session_t *session);
-
-/**
- * Get object associated with the session.
- * @param session the session to get object from
- */
-RTSP_DECLARE(void*) rtsp_server_session_object_get(const rtsp_server_session_t *session);
-
-/**
- * Set object associated with the session.
- * @param session the session to set object for
- * @param obj the object to set
- */
-RTSP_DECLARE(void) rtsp_server_session_object_set(rtsp_server_session_t *session, void *obj);
-
-/**
- * Get the session identifier.
- * @param session the session to get identifier from
- */
-RTSP_DECLARE(const apt_str_t*) rtsp_server_session_id_get(const rtsp_server_session_t *session);
-
-/**
- * Get active (in-progress) session request.
- * @param session the session to get from
- */
-RTSP_DECLARE(const rtsp_message_t*) rtsp_server_session_request_get(const rtsp_server_session_t *session);
-
-/**
- * Get the session destination (client) IP address.
- * @param session the session to get IP address from
- */
-RTSP_DECLARE(const char*) rtsp_server_session_destination_get(const rtsp_server_session_t *session);
-
-APT_END_EXTERN_C
-
-#endif /* RTSP_SERVER_H */
diff --git a/libs/unimrcp/libs/uni-rtsp/include/rtsp_start_line.h b/libs/unimrcp/libs/uni-rtsp/include/rtsp_start_line.h
deleted file mode 100644
index dd53193d43..0000000000
--- a/libs/unimrcp/libs/uni-rtsp/include/rtsp_start_line.h
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: rtsp_start_line.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef RTSP_START_LINE_H
-#define RTSP_START_LINE_H
-
-/**
- * @file rtsp_start_line.h
- * @brief RTSP Start Line (request-line/status-line)
- */
-
-#include "rtsp.h"
-#include "apt_text_stream.h"
-
-APT_BEGIN_EXTERN_C
-
-/** Protocol version */
-typedef enum {
- /** Unknown version */
- RTSP_VERSION_UNKNOWN = 0,
- /** RTSP 1.0 */
- RTSP_VERSION_1 = 1,
-} rtsp_version_e;
-
-/** RTSP message types */
-typedef enum {
- RTSP_MESSAGE_TYPE_UNKNOWN,
- RTSP_MESSAGE_TYPE_REQUEST,
- RTSP_MESSAGE_TYPE_RESPONSE
-} rtsp_message_type_e;
-
-/** RTSP methods */
-typedef enum{
- RTSP_METHOD_SETUP,
- RTSP_METHOD_ANNOUNCE,
- RTSP_METHOD_TEARDOWN,
- RTSP_METHOD_DESCRIBE,
-
- RTSP_METHOD_COUNT,
- RTSP_METHOD_UNKNOWN = RTSP_METHOD_COUNT
-} rtsp_method_id;
-
-/** Status codes */
-typedef enum {
- RTSP_STATUS_CODE_UNKNOWN = 0,
- /** Success codes (2xx) */
- RTSP_STATUS_CODE_OK = 200,
- RTSP_STATUS_CODE_CREATED = 201,
- /** Failure codec (4xx) */
- RTSP_STATUS_CODE_BAD_REQUEST = 400,
- RTSP_STATUS_CODE_UNAUTHORIZED = 401,
- RTSP_STATUS_CODE_NOT_FOUND = 404,
- RTSP_STATUS_CODE_METHOD_NOT_ALLOWED = 405,
- RTSP_STATUS_CODE_NOT_ACCEPTABLE = 406,
- RTSP_STATUS_CODE_PROXY_AUTH_REQUIRED = 407,
- RTSP_STATUS_CODE_REQUEST_TIMEOUT = 408,
- RTSP_STATUS_CODE_SESSION_NOT_FOUND = 454,
-
- RTSP_STATUS_CODE_INTERNAL_SERVER_ERROR = 500,
- RTSP_STATUS_CODE_NOT_IMPLEMENTED = 501,
-} rtsp_status_code_e;
-
-/** Reason phrases */
-typedef enum {
- RTSP_REASON_PHRASE_OK,
- RTSP_REASON_PHRASE_CREATED,
- RTSP_REASON_PHRASE_BAD_REQUEST,
- RTSP_REASON_PHRASE_UNAUTHORIZED,
- RTSP_REASON_PHRASE_NOT_FOUND,
- RTSP_REASON_PHRASE_METHOD_NOT_ALLOWED,
- RTSP_REASON_PHRASE_NOT_ACCEPTABLE,
- RTSP_REASON_PHRASE_PROXY_AUTH_REQUIRED,
- RTSP_REASON_PHRASE_REQUEST_TIMEOUT,
- RTSP_REASON_PHRASE_SESSION_NOT_FOUND,
- RTSP_REASON_PHRASE_INTERNAL_SERVER_ERROR,
- RTSP_REASON_PHRASE_NOT_IMPLEMENTED,
- RTSP_REASON_PHRASE_COUNT,
-
- /** Unknown reason phrase */
- RTSP_REASON_PHRASE_UNKNOWN = RTSP_REASON_PHRASE_COUNT
-} rtsp_reason_phrase_e;
-
-
-/** RTSP request-line declaration */
-typedef struct rtsp_request_line_t rtsp_request_line_t;
-/** RTSP status-line declaration */
-typedef struct rtsp_status_line_t rtsp_status_line_t;
-/** RTSP start-line declaration */
-typedef struct rtsp_start_line_t rtsp_start_line_t;
-
-/** RTSP request-line */
-struct rtsp_request_line_t {
- /** Method name */
- apt_str_t method_name;
- /** Method id */
- rtsp_method_id method_id;
- /** RTSP URL */
- apt_str_t url;
- /** Resource name parsed from RTSP URL */
- const char *resource_name;
- /** Version of protocol in use */
- rtsp_version_e version;
-};
-
-/** RTSP status-line */
-struct rtsp_status_line_t {
- /** Version of protocol in use */
- rtsp_version_e version;
- /** success or failure or other status of the request */
- rtsp_status_code_e status_code;
- /** Reason phrase */
- apt_str_t reason;
-};
-
-/** RTSP start-line */
-struct rtsp_start_line_t {
- /** RTSP message type */
- rtsp_message_type_e message_type;
- /** RTSP start-line */
- union {
- rtsp_request_line_t request_line;
- rtsp_status_line_t status_line;
- } common;
-};
-
-
-static APR_INLINE void rtsp_request_line_init(rtsp_request_line_t *request_line)
-{
- apt_string_reset(&request_line->method_name);
- request_line->method_id = RTSP_METHOD_UNKNOWN;
- apt_string_reset(&request_line->url);
- request_line->resource_name = NULL;
- request_line->version = RTSP_VERSION_1;
-}
-
-static APR_INLINE void rtsp_status_line_init(rtsp_status_line_t *status_line)
-{
- status_line->version = RTSP_VERSION_1;
- status_line->status_code = RTSP_STATUS_CODE_OK;
- apt_string_reset(&status_line->reason);
-}
-
-/** Initialize RTSP start-line */
-static APR_INLINE void rtsp_start_line_init(rtsp_start_line_t *start_line, rtsp_message_type_e message_type)
-{
- start_line->message_type = message_type;
- if(message_type == RTSP_MESSAGE_TYPE_REQUEST) {
- rtsp_request_line_init(&start_line->common.request_line);
- }
- else if(message_type == RTSP_MESSAGE_TYPE_RESPONSE) {
- rtsp_status_line_init(&start_line->common.status_line);
- }
-}
-
-/** Parse RTSP start-line */
-RTSP_DECLARE(apt_bool_t) rtsp_start_line_parse(rtsp_start_line_t *start_line, apt_str_t *str, apr_pool_t *pool);
-
-/** Generate RTSP start-line */
-RTSP_DECLARE(apt_bool_t) rtsp_start_line_generate(rtsp_start_line_t *start_line, apt_text_stream_t *text_stream);
-
-/** Get reason phrase by status code */
-RTSP_DECLARE(const apt_str_t*) rtsp_reason_phrase_get(rtsp_reason_phrase_e reason);
-
-APT_END_EXTERN_C
-
-#endif /* RTSP_START_LINE_H */
diff --git a/libs/unimrcp/libs/uni-rtsp/include/rtsp_stream.h b/libs/unimrcp/libs/uni-rtsp/include/rtsp_stream.h
deleted file mode 100644
index a4cc4e1385..0000000000
--- a/libs/unimrcp/libs/uni-rtsp/include/rtsp_stream.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: rtsp_stream.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef RTSP_STREAM_H
-#define RTSP_STREAM_H
-
-/**
- * @file rtsp_stream.h
- * @brief RTSP Stream Parser and Generator
- */
-
-#include "rtsp_message.h"
-#include "apt_text_message.h"
-
-APT_BEGIN_EXTERN_C
-
-/** Opaque RTSP parser declaration */
-typedef struct rtsp_parser_t rtsp_parser_t;
-/** Opaque RTSP generator declaration */
-typedef struct rtsp_generator_t rtsp_generator_t;
-
-
-/** Create RTSP stream parser */
-RTSP_DECLARE(rtsp_parser_t*) rtsp_parser_create(apr_pool_t *pool);
-
-/** Parse RTSP stream */
-RTSP_DECLARE(apt_message_status_e) rtsp_parser_run(rtsp_parser_t *parser, apt_text_stream_t *stream, rtsp_message_t **message);
-
-
-/** Create RTSP stream generator */
-RTSP_DECLARE(rtsp_generator_t*) rtsp_generator_create(apr_pool_t *pool);
-
-/** Generate RTSP stream */
-RTSP_DECLARE(apt_message_status_e) rtsp_generator_run(rtsp_generator_t *generator, rtsp_message_t *message, apt_text_stream_t *stream);
-
-
-APT_END_EXTERN_C
-
-#endif /* RTSP_STREAM_H */
diff --git a/libs/unimrcp/libs/uni-rtsp/src/rtsp_client.c b/libs/unimrcp/libs/uni-rtsp/src/rtsp_client.c
deleted file mode 100644
index bf783aba65..0000000000
--- a/libs/unimrcp/libs/uni-rtsp/src/rtsp_client.c
+++ /dev/null
@@ -1,992 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: rtsp_client.c 2249 2014-11-19 05:26:24Z achaloyan@gmail.com $
- */
-
-#ifdef WIN32
-#pragma warning(disable: 4127)
-#endif
-#include
-#include
-#include "rtsp_client.h"
-#include "rtsp_stream.h"
-#include "apt_poller_task.h"
-#include "apt_text_stream.h"
-#include "apt_pool.h"
-#include "apt_obj_list.h"
-#include "apt_log.h"
-
-#define RTSP_STREAM_BUFFER_SIZE 1024
-
-typedef struct rtsp_client_connection_t rtsp_client_connection_t;
-
-typedef enum {
- TERMINATION_STATE_NONE,
- TERMINATION_STATE_REQUESTED,
- TERMINATION_STATE_INPROGRESS
-} termination_state_e;
-
-/** RTSP client */
-struct rtsp_client_t {
- apr_pool_t *pool;
- apt_poller_task_t *task;
-
- /** List (ring) of RTSP connections */
- APR_RING_HEAD(rtsp_client_connection_head_t, rtsp_client_connection_t) connection_list;
-
- apr_uint32_t request_timeout;
-
- void *obj;
- const rtsp_client_vtable_t *vtable;
-};
-
-/** RTSP connection */
-struct rtsp_client_connection_t {
- /** Ring entry */
- APR_RING_ENTRY(rtsp_client_connection_t) link;
-
- /** Memory pool */
- apr_pool_t *pool;
- /** Connected socket */
- apr_socket_t *sock;
- /** Socket poll descriptor */
- apr_pollfd_t sock_pfd;
- /** String identifier used for traces */
- const char *id;
- /** RTSP client, connection belongs to */
- rtsp_client_t *client;
-
- /** Handle table (rtsp_client_session_t*) */
- apr_hash_t *handle_table;
- /** Session table (rtsp_client_session_t*) */
- apr_hash_t *session_table;
-
- /** Inprogress request/session queue (rtsp_client_session_t*) */
- apt_obj_list_t *inprogress_request_queue;
-
- /** Last CSeq sent */
- apr_size_t last_cseq;
-
- char rx_buffer[RTSP_STREAM_BUFFER_SIZE];
- apt_text_stream_t rx_stream;
- rtsp_parser_t *parser;
-
- char tx_buffer[RTSP_STREAM_BUFFER_SIZE];
- apt_text_stream_t tx_stream;
- rtsp_generator_t *generator;
-};
-
-/** RTSP session */
-struct rtsp_client_session_t {
- apr_pool_t *pool;
- void *obj;
-
- /** Connection */
- rtsp_client_connection_t *connection;
- /** Session identifier */
- apt_str_t id;
-
- apt_str_t server_ip;
- apr_port_t server_port;
- apt_str_t resource_location;
-
- /** In-progress request */
- rtsp_message_t *active_request;
- /** Pending request queue (rtsp_message_t*) */
- apt_obj_list_t *pending_request_queue;
-
- /** Timer used for request timeouts */
- apt_timer_t *request_timer;
-
- /** Resource table */
- apr_hash_t *resource_table;
-
- /** termination state (none -> requested -> terminating) */
- termination_state_e term_state;
-};
-
-typedef enum {
- TASK_MSG_SEND_MESSAGE,
- TASK_MSG_TERMINATE_SESSION
-} task_msg_data_type_e;
-
-typedef struct task_msg_data_t task_msg_data_t;
-
-struct task_msg_data_t {
- task_msg_data_type_e type;
- rtsp_client_t *client;
- rtsp_client_session_t *session;
- rtsp_message_t *message;
-};
-
-static apt_bool_t rtsp_client_task_msg_process(apt_task_t *task, apt_task_msg_t *msg);
-
-static apt_bool_t rtsp_client_poller_signal_process(void *obj, const apr_pollfd_t *descriptor);
-
-static apt_bool_t rtsp_client_message_handler(rtsp_client_connection_t *rtsp_connection, rtsp_message_t *message, apt_message_status_e status);
-static apt_bool_t rtsp_client_message_send(rtsp_client_t *client, rtsp_client_connection_t *connection, rtsp_message_t *message);
-static apt_bool_t rtsp_client_session_message_process(rtsp_client_t *client, rtsp_client_session_t *session, rtsp_message_t *message);
-static apt_bool_t rtsp_client_session_response_process(rtsp_client_t *client, rtsp_client_session_t *session, rtsp_message_t *request, rtsp_message_t *response);
-
-static void rtsp_client_timer_proc(apt_timer_t *timer, void *obj);
-
-/** Get string identifier */
-static const char* rtsp_client_id_get(const rtsp_client_t *client)
-{
- apt_task_t *task = apt_poller_task_base_get(client->task);
- return apt_task_name_get(task);
-}
-
-/** Create RTSP client */
-RTSP_DECLARE(rtsp_client_t*) rtsp_client_create(
- const char *id,
- apr_size_t max_connection_count,
- apr_size_t request_timeout,
- void *obj,
- const rtsp_client_vtable_t *handler,
- apr_pool_t *pool)
-{
- apt_task_t *task;
- apt_task_vtable_t *vtable;
- apt_task_msg_pool_t *msg_pool;
- rtsp_client_t *client;
-
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create RTSP Client [%s] [%"APR_SIZE_T_FMT"]",
- id, max_connection_count);
- client = apr_palloc(pool,sizeof(rtsp_client_t));
- client->pool = pool;
- client->obj = obj;
- client->vtable = handler;
-
- msg_pool = apt_task_msg_pool_create_dynamic(sizeof(task_msg_data_t),pool);
-
- client->task = apt_poller_task_create(
- max_connection_count,
- rtsp_client_poller_signal_process,
- client,
- msg_pool,
- pool);
- if(!client->task) {
- return NULL;
- }
-
- task = apt_poller_task_base_get(client->task);
- if(task) {
- apt_task_name_set(task,id);
- }
-
- vtable = apt_poller_task_vtable_get(client->task);
- if(vtable) {
- vtable->process_msg = rtsp_client_task_msg_process;
- }
-
- APR_RING_INIT(&client->connection_list, rtsp_client_connection_t, link);
- client->request_timeout = (apr_uint32_t)request_timeout;
- return client;
-}
-
-/** Destroy RTSP client */
-RTSP_DECLARE(apt_bool_t) rtsp_client_destroy(rtsp_client_t *client)
-{
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Destroy RTSP Client [%s]",
- rtsp_client_id_get(client));
- return apt_poller_task_destroy(client->task);
-}
-
-/** Start connection agent */
-RTSP_DECLARE(apt_bool_t) rtsp_client_start(rtsp_client_t *client)
-{
- return apt_poller_task_start(client->task);
-}
-
-/** Terminate connection agent */
-RTSP_DECLARE(apt_bool_t) rtsp_client_terminate(rtsp_client_t *client)
-{
- return apt_poller_task_terminate(client->task);
-}
-
-/** Get task */
-RTSP_DECLARE(apt_task_t*) rtsp_client_task_get(const rtsp_client_t *client)
-{
- return apt_poller_task_base_get(client->task);
-}
-
-/** Get external object */
-RTSP_DECLARE(void*) rtsp_client_object_get(const rtsp_client_t *client)
-{
- return client->obj;
-}
-
-/** Get object associated with the session */
-RTSP_DECLARE(void*) rtsp_client_session_object_get(const rtsp_client_session_t *session)
-{
- return session->obj;
-}
-
-/** Set object associated with the session */
-RTSP_DECLARE(void) rtsp_client_session_object_set(rtsp_client_session_t *session, void *obj)
-{
- session->obj = obj;
-}
-
-/** Get the session identifier */
-RTSP_DECLARE(const apt_str_t*) rtsp_client_session_id_get(const rtsp_client_session_t *session)
-{
- return &session->id;
-}
-
-/** Signal task message */
-static apt_bool_t rtsp_client_control_message_signal(
- task_msg_data_type_e type,
- rtsp_client_t *client,
- rtsp_client_session_t *session,
- rtsp_message_t *message)
-{
- apt_task_t *task = apt_poller_task_base_get(client->task);
- apt_task_msg_t *task_msg = apt_task_msg_get(task);
- if(task_msg) {
- task_msg_data_t *data = (task_msg_data_t*)task_msg->data;
- data->type = type;
- data->client = client;
- data->session = session;
- data->message = message;
- apt_task_msg_signal(task,task_msg);
- }
- return TRUE;
-}
-
-/** Create RTSP session handle */
-RTSP_DECLARE(rtsp_client_session_t*) rtsp_client_session_create(
- rtsp_client_t *client,
- const char *server_ip,
- apr_port_t server_port,
- const char *resource_location)
-{
- rtsp_client_session_t *session;
- apr_pool_t *pool = apt_pool_create();
- session = apr_palloc(pool,sizeof(rtsp_client_session_t));
- session->pool = pool;
- session->obj = NULL;
- session->connection = NULL;
- session->active_request = NULL;
- session->pending_request_queue = apt_list_create(pool);
- session->request_timer = apt_poller_task_timer_create(
- client->task,
- rtsp_client_timer_proc,
- session,
- pool);
- session->resource_table = apr_hash_make(pool);
- session->term_state = TERMINATION_STATE_NONE;
-
- apt_string_assign(&session->server_ip,server_ip,pool);
- session->server_port = server_port;
- apt_string_assign(&session->resource_location,resource_location,pool);
- apt_string_reset(&session->id);
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create RTSP Handle "APT_PTR_FMT,session);
- return session;
-}
-
-/** Destroy RTSP session handle */
-RTSP_DECLARE(void) rtsp_client_session_destroy(rtsp_client_session_t *session)
-{
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Destroy RTSP Handle "APT_PTR_FMT,session);
- if(session && session->pool) {
- apr_pool_destroy(session->pool);
- }
-}
-
-/** Signal terminate request */
-RTSP_DECLARE(apt_bool_t) rtsp_client_session_terminate(rtsp_client_t *client, rtsp_client_session_t *session)
-{
- return rtsp_client_control_message_signal(TASK_MSG_TERMINATE_SESSION,client,session,NULL);
-}
-
-/** Signal RTSP message */
-RTSP_DECLARE(apt_bool_t) rtsp_client_session_request(rtsp_client_t *client, rtsp_client_session_t *session, rtsp_message_t *message)
-{
- return rtsp_client_control_message_signal(TASK_MSG_SEND_MESSAGE,client,session,message);
-}
-
-
-/** Create connection */
-static apt_bool_t rtsp_client_connect(rtsp_client_t *client, rtsp_client_connection_t *connection, const char *ip, apr_port_t port)
-{
- char *local_ip = NULL;
- char *remote_ip = NULL;
- apr_sockaddr_t *l_sockaddr = NULL;
- apr_sockaddr_t *r_sockaddr = NULL;
-
- if(apr_sockaddr_info_get(&r_sockaddr,ip,APR_INET,port,0,connection->pool) != APR_SUCCESS) {
- return FALSE;
- }
-
- if(apr_socket_create(&connection->sock,r_sockaddr->family,SOCK_STREAM,APR_PROTO_TCP,connection->pool) != APR_SUCCESS) {
- return FALSE;
- }
-
- apr_socket_opt_set(connection->sock, APR_SO_NONBLOCK, 0);
- apr_socket_timeout_set(connection->sock, -1);
- apr_socket_opt_set(connection->sock, APR_SO_REUSEADDR, 1);
-
- if(apr_socket_connect(connection->sock,r_sockaddr) != APR_SUCCESS) {
- apr_socket_close(connection->sock);
- connection->sock = NULL;
- return FALSE;
- }
-
- if(apr_socket_addr_get(&l_sockaddr,APR_LOCAL,connection->sock) != APR_SUCCESS) {
- apr_socket_close(connection->sock);
- connection->sock = NULL;
- return FALSE;
- }
-
- apr_sockaddr_ip_get(&local_ip,l_sockaddr);
- apr_sockaddr_ip_get(&remote_ip,r_sockaddr);
- connection->id = apr_psprintf(connection->pool,"%s:%hu <-> %s:%hu",
- local_ip,l_sockaddr->port,
- remote_ip,r_sockaddr->port);
-
- memset(&connection->sock_pfd,0,sizeof(apr_pollfd_t));
- connection->sock_pfd.desc_type = APR_POLL_SOCKET;
- connection->sock_pfd.reqevents = APR_POLLIN;
- connection->sock_pfd.desc.s = connection->sock;
- connection->sock_pfd.client_data = connection;
- if(apt_poller_task_descriptor_add(client->task,&connection->sock_pfd) != TRUE) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Add to Pollset %s",connection->id);
- apr_socket_close(connection->sock);
- connection->sock = NULL;
- return FALSE;
- }
-
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Established RTSP Connection %s",connection->id);
- return TRUE;
-}
-
-/** Close connection */
-static apt_bool_t rtsp_client_connection_close(rtsp_client_t *client, rtsp_client_connection_t *connection)
-{
- if(connection->sock) {
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Close RTSP Connection %s",connection->id);
- apt_poller_task_descriptor_remove(client->task,&connection->sock_pfd);
- apr_socket_close(connection->sock);
- connection->sock = NULL;
- }
- return TRUE;
-}
-
-
-/* Create RTSP connection */
-static apt_bool_t rtsp_client_connection_create(rtsp_client_t *client, rtsp_client_session_t *session)
-{
- rtsp_client_connection_t *rtsp_connection;
- apr_pool_t *pool = apt_pool_create();
- if(!pool) {
- return FALSE;
- }
-
- rtsp_connection = apr_palloc(pool,sizeof(rtsp_client_connection_t));
- rtsp_connection->pool = pool;
- rtsp_connection->sock = NULL;
- APR_RING_ELEM_INIT(rtsp_connection,link);
-
- if(rtsp_client_connect(client,rtsp_connection,session->server_ip.buf,session->server_port) == FALSE) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Connect to RTSP Server %s:%hu",
- session->server_ip.buf,session->server_port);
- apr_pool_destroy(pool);
- return FALSE;
- }
- rtsp_connection->handle_table = apr_hash_make(pool);
- rtsp_connection->session_table = apr_hash_make(pool);
- rtsp_connection->inprogress_request_queue = apt_list_create(pool);
- apt_text_stream_init(&rtsp_connection->rx_stream,rtsp_connection->rx_buffer,sizeof(rtsp_connection->rx_buffer)-1);
- apt_text_stream_init(&rtsp_connection->tx_stream,rtsp_connection->tx_buffer,sizeof(rtsp_connection->tx_buffer)-1);
- rtsp_connection->parser = rtsp_parser_create(pool);
- rtsp_connection->generator = rtsp_generator_create(pool);
- rtsp_connection->last_cseq = 0;
-
- rtsp_connection->client = client;
- APR_RING_INSERT_TAIL(&client->connection_list,rtsp_connection,rtsp_client_connection_t,link);
- session->connection = rtsp_connection;
- return TRUE;
-}
-
-/* Destroy RTSP connection */
-static apt_bool_t rtsp_client_connection_destroy(rtsp_client_connection_t *rtsp_connection)
-{
- rtsp_client_t *client = rtsp_connection->client;
- APR_RING_REMOVE(rtsp_connection,link);
- rtsp_client_connection_close(client,rtsp_connection);
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Destroy RTSP Connection %s",rtsp_connection->id);
- apr_pool_destroy(rtsp_connection->pool);
-
- return TRUE;
-}
-
-/* Respond to session termination request */
-static apt_bool_t rtsp_client_session_terminate_respond(rtsp_client_t *client, rtsp_client_session_t *session)
-{
- rtsp_client_connection_t *rtsp_connection = session->connection;
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Remove RTSP Handle "APT_PTR_FMT,session);
- apr_hash_set(rtsp_connection->handle_table,session,sizeof(void*),NULL);
-
- session->term_state = TERMINATION_STATE_NONE;
- client->vtable->on_session_terminate_response(client,session);
- return TRUE;
-}
-
-/* Teardown session resources */
-static apt_bool_t rtsp_client_session_resources_teardown(rtsp_client_t *client, rtsp_client_session_t *session)
-{
- void *val;
- rtsp_message_t *setup_request;
- rtsp_message_t *teardown_request;
- apr_hash_index_t *it;
-
- /* set termination state to in-progress and teardown remaining resources */
- session->term_state = TERMINATION_STATE_INPROGRESS;
- it = apr_hash_first(session->pool,session->resource_table);
- for(; it; it = apr_hash_next(it)) {
- apr_hash_this(it,NULL,NULL,&val);
- setup_request = val;
- if(!setup_request) continue;
-
- teardown_request = rtsp_request_create(session->pool);
- teardown_request->start_line.common.request_line.resource_name = setup_request->start_line.common.request_line.resource_name;
- teardown_request->start_line.common.request_line.method_id = RTSP_METHOD_TEARDOWN;
- rtsp_client_session_message_process(client,session,teardown_request);
- }
- return TRUE;
-}
-
-/* Process session termination request */
-static apt_bool_t rtsp_client_session_terminate_process(rtsp_client_t *client, rtsp_client_session_t *session)
-{
- rtsp_client_connection_t *rtsp_connection = session->connection;
- if(!rtsp_connection) {
- client->vtable->on_session_terminate_response(client,session);
- return FALSE;
- }
-
- if(session->active_request) {
- /* set termination state to requested */
- session->term_state = TERMINATION_STATE_REQUESTED;
- }
- else {
- rtsp_client_session_resources_teardown(client,session);
-
- /* respond immediately if no resources left */
- if(apr_hash_count(session->resource_table) == 0) {
- rtsp_client_session_terminate_respond(client,session);
-
- if(apr_hash_count(rtsp_connection->handle_table) == 0) {
- rtsp_client_connection_destroy(rtsp_connection);
- }
- }
- }
-
- return TRUE;
-}
-
-static apt_bool_t rtsp_client_session_url_generate(rtsp_client_session_t *session, rtsp_message_t *message)
-{
- apt_str_t *url = &message->start_line.common.request_line.url;
- if(session->resource_location.length) {
- url->buf = apr_psprintf(message->pool,"rtsp://%s:%hu/%s/%s",
- session->server_ip.buf,
- session->server_port,
- session->resource_location.buf,
- message->start_line.common.request_line.resource_name);
- }
- else {
- url->buf = apr_psprintf(message->pool,"rtsp://%s:%hu/%s",
- session->server_ip.buf,
- session->server_port,
- message->start_line.common.request_line.resource_name);
- }
- url->length = strlen(url->buf);
- return TRUE;
-}
-
-static apt_bool_t rtsp_client_request_push(rtsp_client_connection_t *rtsp_connection, rtsp_client_session_t *session, rtsp_message_t *message)
-{
- /* add request to inprogress request queue */
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Push RTSP Request to In-Progress Queue "APT_PTRSID_FMT" CSeq:%"APR_SIZE_T_FMT,
- session,
- message->header.session_id.buf ? message->header.session_id.buf : "new",
- message->header.cseq);
- apt_list_push_back(rtsp_connection->inprogress_request_queue,session,session->pool);
- session->active_request = message;
- if(rtsp_connection->client->request_timeout) {
- apt_timer_set(session->request_timer,rtsp_connection->client->request_timeout);
- }
- return TRUE;
-}
-
-static apt_bool_t rtsp_client_request_pop(rtsp_client_connection_t *rtsp_connection, rtsp_message_t *response, rtsp_message_t **ret_request, rtsp_client_session_t **ret_session)
-{
- rtsp_client_session_t *session;
- apt_list_elem_t *elem = apt_list_first_elem_get(rtsp_connection->inprogress_request_queue);
- while(elem) {
- session = apt_list_elem_object_get(elem);
- if(session->active_request && session->active_request->header.cseq == response->header.cseq) {
- if(ret_session) {
- *ret_session = session;
- }
- if(ret_request) {
- *ret_request = session->active_request;
- }
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Pop In-Progress RTSP Request "APT_PTR_FMT" CSeq:%"APR_SIZE_T_FMT,
- session,
- response->header.cseq);
- apt_list_elem_remove(rtsp_connection->inprogress_request_queue,elem);
- session->active_request = NULL;
- apt_timer_kill(session->request_timer);
- return TRUE;
- }
- elem = apt_list_next_elem_get(rtsp_connection->inprogress_request_queue,elem);
- }
- return FALSE;
-}
-
-/* Process outgoing RTSP request */
-static apt_bool_t rtsp_client_session_request_process(rtsp_client_t *client, rtsp_client_session_t *session, rtsp_message_t *message)
-{
- if(!session->connection) {
- /* create RTSP connection */
- if(rtsp_client_connection_create(client,session) == FALSE) {
- /* respond with error */
- return FALSE;
- }
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Add RTSP Handle "APT_PTR_FMT,session);
- apr_hash_set(session->connection->handle_table,session,sizeof(void*),session);
- }
-
- rtsp_client_session_url_generate(session,message);
-
- if(session->id.length) {
- message->header.session_id = session->id;
- rtsp_header_property_add(&message->header,RTSP_HEADER_FIELD_SESSION_ID,message->pool);
- }
-
- message->header.cseq = ++session->connection->last_cseq;
- rtsp_header_property_add(&message->header,RTSP_HEADER_FIELD_CSEQ,message->pool);
-
- if(rtsp_client_message_send(client,session->connection,message) == FALSE) {
- /* respond with error */
- return FALSE;
- }
-
- return rtsp_client_request_push(session->connection,session,message);
-}
-
-/* Process pending RTSP requests */
-static apt_bool_t rtsp_client_session_pending_requests_process(rtsp_client_t *client, rtsp_client_session_t *session)
-{
- rtsp_message_t *request = apt_list_pop_front(session->pending_request_queue);
- if(!request) {
- /* pending queue is empty, no in-progress request */
- return FALSE;
- }
-
- /* process pending request; get the next one, if current is failed */
- do {
- rtsp_message_t *response;
- if(rtsp_client_session_request_process(client,session,request) == TRUE) {
- return TRUE;
- }
-
- /* respond with error */
- response = rtsp_response_create(
- request,
- RTSP_STATUS_CODE_INTERNAL_SERVER_ERROR,
- RTSP_REASON_PHRASE_INTERNAL_SERVER_ERROR,
- session->pool);
- rtsp_client_session_response_process(client,session,request,response);
-
- /* process the next pending request / if any */
- request = apt_list_pop_front(session->pending_request_queue);
- }
- while(request);
-
- /* no in-progress request */
- return FALSE;
-}
-
-
-/* Process outgoing RTSP message */
-static apt_bool_t rtsp_client_session_message_process(rtsp_client_t *client, rtsp_client_session_t *session, rtsp_message_t *message)
-{
- if(session->active_request) {
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Push RTSP Request to Pending Queue "APT_PTR_FMT,session);
- apt_list_push_back(session->pending_request_queue,message,message->pool);
- return TRUE;
- }
-
- if(rtsp_client_session_request_process(client,session,message) == FALSE) {
- /* respond with error in case request cannot be processed */
- rtsp_message_t *response = rtsp_response_create(
- message,
- RTSP_STATUS_CODE_INTERNAL_SERVER_ERROR,
- RTSP_REASON_PHRASE_INTERNAL_SERVER_ERROR,
- session->pool);
- rtsp_client_session_response_process(client,session,message,response);
- }
- return TRUE;
-}
-
-/* Process incoming RTSP event (request) */
-static apt_bool_t rtsp_client_session_event_process(rtsp_client_t *client, rtsp_client_connection_t *rtsp_connection, rtsp_message_t *message)
-{
- rtsp_message_t *response = NULL;
- rtsp_client_session_t *session = NULL;
- if(rtsp_header_property_check(&message->header,RTSP_HEADER_FIELD_SESSION_ID) == TRUE) {
- /* find existing session */
- session = apr_hash_get(
- rtsp_connection->session_table,
- message->header.session_id.buf,
- message->header.session_id.length);
- }
-
- if(session) {
- response = rtsp_response_create(message,RTSP_STATUS_CODE_OK,RTSP_REASON_PHRASE_OK,message->pool);
- if(rtsp_header_property_check(&message->header,RTSP_HEADER_FIELD_SESSION_ID) == TRUE) {
- response->header.session_id = message->header.session_id;
- rtsp_header_property_add(&response->header,RTSP_HEADER_FIELD_SESSION_ID,message->pool);
- }
- client->vtable->on_session_event(client,session,message);
- }
- else {
- response = rtsp_response_create(message,RTSP_STATUS_CODE_NOT_FOUND,RTSP_REASON_PHRASE_NOT_FOUND,message->pool);
- }
-
- return rtsp_client_message_send(client,rtsp_connection,response);
-}
-
-/* Process incoming RTSP response */
-static apt_bool_t rtsp_client_session_response_process(rtsp_client_t *client, rtsp_client_session_t *session, rtsp_message_t *request, rtsp_message_t *response)
-{
- const char *resource_name;
- if(request->start_line.common.request_line.method_id == RTSP_METHOD_SETUP &&
- response->start_line.common.status_line.status_code == RTSP_STATUS_CODE_OK) {
-
- if(apr_hash_count(session->resource_table) == 0) {
- if(rtsp_header_property_check(&response->header,RTSP_HEADER_FIELD_SESSION_ID) == TRUE) {
- session->id = response->header.session_id;
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Add RTSP Session "APT_PTRSID_FMT,
- session,
- session->id.buf);
- apr_hash_set(session->connection->session_table,session->id.buf,session->id.length,session);
- }
- }
-
- /* add resource */
- resource_name = request->start_line.common.request_line.resource_name;
- apr_hash_set(session->resource_table,resource_name,APR_HASH_KEY_STRING,request);
- }
- else if(request->start_line.common.request_line.method_id == RTSP_METHOD_TEARDOWN) {
- /* remove resource */
- resource_name = request->start_line.common.request_line.resource_name;
- apr_hash_set(session->resource_table,resource_name,APR_HASH_KEY_STRING,NULL);
-
- if(apr_hash_count(session->resource_table) == 0) {
- if(session->connection) {
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Remove RTSP Session "APT_PTRSID_FMT,
- session,
- session->id.buf);
- apr_hash_set(session->connection->session_table,session->id.buf,session->id.length,NULL);
- }
- }
- }
-
- if(session->term_state != TERMINATION_STATE_INPROGRESS) {
- client->vtable->on_session_response(client,session,request,response);
- }
-
- return TRUE;
-}
-
-/* Raise RTSP session terminate event */
-static apt_bool_t rtsp_client_session_terminate_raise(rtsp_client_t *client, rtsp_client_session_t *session)
-{
- rtsp_message_t *request;
- rtsp_message_t *response;
-
- /* cancel pending requests */
- do {
- request = apt_list_pop_front(session->pending_request_queue);
- if(request) {
- response = rtsp_response_create(
- session->active_request,
- RTSP_STATUS_CODE_INTERNAL_SERVER_ERROR,
- RTSP_REASON_PHRASE_INTERNAL_SERVER_ERROR,
- session->pool);
- rtsp_client_session_response_process(client,session,request,response);
- }
- }
- while(request);
-
- if(session->term_state == TERMINATION_STATE_NONE) {
- client->vtable->on_session_terminate_event(client,session);
- }
- else {
- rtsp_client_session_terminate_respond(client,session);
- }
- return TRUE;
-}
-
-/* Cancel RTSP request */
-static apt_bool_t rtsp_client_request_cancel(rtsp_client_t *client, rtsp_client_session_t *session, rtsp_status_code_e status_code, rtsp_reason_phrase_e reason)
-{
- rtsp_message_t *request;
- rtsp_message_t *response;
- if(!session->active_request) {
- return FALSE;
- }
-
- request = session->active_request;
- response = rtsp_response_create(
- request,
- status_code,
- reason,
- session->pool);
-
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Cancel RTSP Request "APT_PTRSID_FMT" CSeq:%"APR_SIZE_T_FMT" [%d]",
- session,
- request->header.session_id.buf ? request->header.session_id.buf : "new",
- request->header.cseq,
- status_code);
-
- return rtsp_client_message_handler(session->connection, response, APT_MESSAGE_STATUS_COMPLETE);
-}
-
-/* RTSP connection disconnected */
-static apt_bool_t rtsp_client_on_disconnect(rtsp_client_t *client, rtsp_client_connection_t *rtsp_connection)
-{
- rtsp_client_session_t *session;
- apr_size_t remaining_handles;
-
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"RTSP Peer Disconnected %s", rtsp_connection->id);
- rtsp_client_connection_close(client,rtsp_connection);
-
- /* Cancel in-progreess requests */
- do {
- session = apt_list_pop_front(rtsp_connection->inprogress_request_queue);
- if(session) {
- if(rtsp_client_request_cancel(
- client,
- session,
- RTSP_STATUS_CODE_INTERNAL_SERVER_ERROR,
- RTSP_REASON_PHRASE_INTERNAL_SERVER_ERROR) == TRUE) {
- apt_timer_kill(session->request_timer);
- }
- }
- }
- while(session);
-
- /* Walk through RTSP handles and raise termination event for them */
- remaining_handles = apr_hash_count(rtsp_connection->handle_table);
- if(remaining_handles) {
- void *val;
- apr_hash_index_t *it;
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Terminate Remaining RTSP Handles [%"APR_SIZE_T_FMT"]",remaining_handles);
- it = apr_hash_first(rtsp_connection->pool,rtsp_connection->session_table);
- for(; it; it = apr_hash_next(it)) {
- apr_hash_this(it,NULL,NULL,&val);
- session = val;
- if(session) {
- rtsp_client_session_terminate_raise(client,session);
- }
- }
- }
-
- return TRUE;
-}
-
-/* Send RTSP message through RTSP connection */
-static apt_bool_t rtsp_client_message_send(rtsp_client_t *client, rtsp_client_connection_t *rtsp_connection, rtsp_message_t *message)
-{
- apt_bool_t status = FALSE;
- apt_text_stream_t *stream;
- apt_message_status_e result;
-
- if(!rtsp_connection || !rtsp_connection->sock) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"No RTSP Connection");
- return FALSE;
- }
- stream = &rtsp_connection->tx_stream;
-
- do {
- stream->text.length = sizeof(rtsp_connection->tx_buffer)-1;
- apt_text_stream_reset(stream);
- result = rtsp_generator_run(rtsp_connection->generator,message,stream);
- if(result != APT_MESSAGE_STATUS_INVALID) {
- stream->text.length = stream->pos - stream->text.buf;
- *stream->pos = '\0';
-
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Send RTSP Data %s [%"APR_SIZE_T_FMT" bytes]\n%s",
- rtsp_connection->id,
- stream->text.length,
- stream->text.buf);
- if(apr_socket_send(rtsp_connection->sock,stream->text.buf,&stream->text.length) == APR_SUCCESS) {
- status = TRUE;
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Send RTSP Data");
- }
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Generate RTSP Data");
- }
- }
- while(result == APT_MESSAGE_STATUS_INCOMPLETE);
-
- return status;
-}
-
-/** Return TRUE to proceed with the next message in the stream (if any) */
-static apt_bool_t rtsp_client_message_handler(rtsp_client_connection_t *rtsp_connection, rtsp_message_t *message, apt_message_status_e status)
-{
- if(status != APT_MESSAGE_STATUS_COMPLETE) {
- /* message is not completely parsed, nothing to do */
- return TRUE;
- }
- /* process parsed message */
- if(message->start_line.message_type == RTSP_MESSAGE_TYPE_RESPONSE) {
- rtsp_message_t *request;
- rtsp_client_session_t *session;
- /* at first, pop in-progress request/session */
- if(rtsp_client_request_pop(rtsp_connection,message,&request,&session) == FALSE) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unexpected RTSP Response Received CSeq:%"APR_SIZE_T_FMT,
- message->header.cseq);
- return TRUE;
- }
-
- /* next, process session response */
- rtsp_client_session_response_process(rtsp_connection->client,session,request,message);
-
- /* process session pending requests */
- if(rtsp_client_session_pending_requests_process(rtsp_connection->client,session) == FALSE) {
- /* no in-progress request, check the termination state now */
- if(session->term_state != TERMINATION_STATE_NONE) {
- if(session->term_state == TERMINATION_STATE_REQUESTED) {
- rtsp_client_session_resources_teardown(rtsp_connection->client,session);
- }
-
- /* respond if no resources left */
- if(apr_hash_count(session->resource_table) == 0) {
- rtsp_client_session_terminate_respond(rtsp_connection->client,session);
-
- if(apr_hash_count(rtsp_connection->handle_table) == 0) {
- rtsp_client_connection_destroy(rtsp_connection);
- /* return FALSE to indicate connection has been destroyed */
- return FALSE;
- }
- }
- }
- }
- }
- else if(message->start_line.message_type == RTSP_MESSAGE_TYPE_REQUEST) {
- rtsp_client_session_event_process(rtsp_connection->client,rtsp_connection,message);
- }
- return TRUE;
-}
-
-/* Receive RTSP message through RTSP connection */
-static apt_bool_t rtsp_client_poller_signal_process(void *obj, const apr_pollfd_t *descriptor)
-{
- rtsp_client_t *client = obj;
- rtsp_client_connection_t *rtsp_connection = descriptor->client_data;
- apr_status_t status;
- apr_size_t offset;
- apr_size_t length;
- apt_text_stream_t *stream;
- rtsp_message_t *message;
- apt_message_status_e msg_status;
-
- if(!rtsp_connection || !rtsp_connection->sock) {
- return FALSE;
- }
- stream = &rtsp_connection->rx_stream;
-
- /* calculate offset remaining from the previous receive / if any */
- offset = stream->pos - stream->text.buf;
- /* calculate available length */
- length = sizeof(rtsp_connection->rx_buffer) - 1 - offset;
-
- status = apr_socket_recv(rtsp_connection->sock,stream->pos,&length);
- if(status == APR_EOF || length == 0) {
- return rtsp_client_on_disconnect(client,rtsp_connection);
- }
-
- /* calculate actual length of the stream */
- stream->text.length = offset + length;
- stream->pos[length] = '\0';
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Receive RTSP Data %s [%"APR_SIZE_T_FMT" bytes]\n%s",
- rtsp_connection->id,
- length,
- stream->pos);
-
- /* reset pos */
- apt_text_stream_reset(stream);
-
- do {
- msg_status = rtsp_parser_run(rtsp_connection->parser,stream,&message);
- if(rtsp_client_message_handler(rtsp_connection,message,msg_status) == FALSE) {
- return FALSE;
- }
- }
- while(apt_text_is_eos(stream) == FALSE);
-
- /* scroll remaining stream */
- apt_text_stream_scroll(stream);
- return TRUE;
-}
-
-/* Process task message */
-static apt_bool_t rtsp_client_task_msg_process(apt_task_t *task, apt_task_msg_t *task_msg)
-{
- apt_poller_task_t *poller_task = apt_task_object_get(task);
- rtsp_client_t *client = apt_poller_task_object_get(poller_task);
-
- task_msg_data_t *data = (task_msg_data_t*) task_msg->data;
- switch(data->type) {
- case TASK_MSG_SEND_MESSAGE:
- rtsp_client_session_message_process(client,data->session,data->message);
- break;
- case TASK_MSG_TERMINATE_SESSION:
- rtsp_client_session_terminate_process(client,data->session);
- break;
- }
-
- return TRUE;
-}
-
-/* Timer callback */
-static void rtsp_client_timer_proc(apt_timer_t *timer, void *obj)
-{
- rtsp_client_session_t *session = obj;
- if(!session || !session->connection || !session->connection->client) {
- return;
- }
-
- if(session->request_timer == timer) {
- rtsp_client_request_cancel(
- session->connection->client,
- session,
- RTSP_STATUS_CODE_REQUEST_TIMEOUT,
- RTSP_REASON_PHRASE_REQUEST_TIMEOUT);
- }
-}
diff --git a/libs/unimrcp/libs/uni-rtsp/src/rtsp_header.c b/libs/unimrcp/libs/uni-rtsp/src/rtsp_header.c
deleted file mode 100644
index 4aee7d7dd0..0000000000
--- a/libs/unimrcp/libs/uni-rtsp/src/rtsp_header.c
+++ /dev/null
@@ -1,420 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: rtsp_header.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include "rtsp_header.h"
-#include "apt_string_table.h"
-#include "apt_text_stream.h"
-
-/** String table of RTSP header fields (rtsp_header_field_id) */
-static const apt_str_table_item_t rtsp_header_string_table[] = {
- {{"CSeq", 4},1},
- {{"Transport", 9},0},
- {{"Session", 7},0},
- {{"RTP-Info", 8},0},
- {{"Content-Type", 12},8},
- {{"Content-Length",14},8}
-};
-
-/** String table of RTSP content types (rtsp_content_type) */
-static const apt_str_table_item_t rtsp_content_type_string_table[] = {
- {{"application/sdp", 15},12},
- {{"application/mrcp",16},12}
-};
-
-/** String table of RTSP transport protocols (rtsp_transport_e) */
-static const apt_str_table_item_t rtsp_transport_string_table[] = {
- {{"RTP", 3},0}
-};
-
-/** String table of RTSP lower transport protocols (rtsp_lower_transport_e) */
-static const apt_str_table_item_t rtsp_lower_transport_string_table[] = {
- {{"UDP", 3},0},
- {{"TCP", 3},0}
-};
-
-/** String table of RTSP transport profiles (rtsp_profile_e) */
-static const apt_str_table_item_t rtsp_profile_string_table[] = {
- {{"AVP", 3},0},
- {{"SAVP",4},0}
-};
-
-/** String table of RTSP transport attributes (rtsp_transport_attrib_e) */
-static const apt_str_table_item_t rtsp_transport_attrib_string_table[] = {
- {{"client_port", 11},0},
- {{"server_port", 11},2},
- {{"source", 6},2},
- {{"destination", 11},0},
- {{"unicast", 7},0},
- {{"multicast", 9},1},
- {{"mode", 4},2}
-};
-
-/** Parse RTSP transport port range */
-static apt_bool_t rtsp_port_range_parse(rtsp_port_range_t *port_range, apt_text_stream_t *stream)
-{
- apt_str_t value;
- /* read min value */
- if(apt_text_field_read(stream,'-',TRUE,&value) == FALSE) {
- return FALSE;
- }
- port_range->min = (apr_port_t)apt_size_value_parse(&value);
-
- /* read optional max value */
- if(apt_text_field_read(stream,';',TRUE,&value) == TRUE) {
- port_range->max = (apr_port_t)apt_size_value_parse(&value);
- }
-
- return TRUE;
-}
-
-/** Generate RTSP transport port range */
-static apt_bool_t rtsp_port_range_generate(rtsp_transport_attrib_e attrib, const rtsp_port_range_t *port_range, apt_text_stream_t *text_stream)
-{
- const apt_str_t *str;
- str = apt_string_table_str_get(rtsp_transport_attrib_string_table,RTSP_TRANSPORT_ATTRIB_COUNT,attrib);
- if(!str) {
- return FALSE;
- }
- apt_text_string_insert(text_stream,str);
- apt_text_char_insert(text_stream,'=');
- apt_text_size_value_insert(text_stream,port_range->min);
- if(port_range->max > port_range->min) {
- apt_text_char_insert(text_stream,'-');
- apt_text_size_value_insert(text_stream,port_range->max);
- }
- return TRUE;
-}
-
-/** Parse text value of RTSP transport attrib (source/destination, e.t.c) */
-static apt_bool_t rtsp_transport_attrib_value_parse(apt_str_t *value, apt_text_stream_t *stream, apr_pool_t *pool)
-{
- apt_str_t field;
- /* read value */
- if(apt_text_field_read(stream,';',TRUE,&field) == FALSE) {
- return FALSE;
- }
- apt_string_copy(value,&field,pool);
- return TRUE;
-}
-
-/** Parse RTSP transport */
-static apt_bool_t rtsp_transport_attrib_parse(rtsp_transport_t *transport, const apt_str_t *field, apr_pool_t *pool)
-{
- rtsp_transport_attrib_e attrib;
- apt_str_t name;
- apt_text_stream_t stream;
-
- stream.text = *field;
- apt_text_stream_reset(&stream);
-
- /* read attrib name */
- if(apt_text_field_read(&stream,'=',TRUE,&name) == FALSE) {
- return FALSE;
- }
-
- attrib = apt_string_table_id_find(rtsp_transport_attrib_string_table,RTSP_TRANSPORT_ATTRIB_COUNT,&name);
- switch(attrib) {
- case RTSP_TRANSPORT_ATTRIB_CLIENT_PORT:
- rtsp_port_range_parse(&transport->client_port_range,&stream);
- break;
- case RTSP_TRANSPORT_ATTRIB_SERVER_PORT:
- rtsp_port_range_parse(&transport->client_port_range,&stream);
- break;
- case RTSP_TRANSPORT_ATTRIB_SOURCE:
- rtsp_transport_attrib_value_parse(&transport->source,&stream,pool);
- break;
- case RTSP_TRANSPORT_ATTRIB_DESTINATION:
- rtsp_transport_attrib_value_parse(&transport->destination,&stream,pool);
- break;
- case RTSP_TRANSPORT_ATTRIB_UNICAST:
- transport->delivery = RTSP_DELIVERY_UNICAST;
- break;
- case RTSP_TRANSPORT_ATTRIB_MULTICAST:
- transport->delivery = RTSP_DELIVERY_MULTICAST;
- break;
- case RTSP_TRANSPORT_ATTRIB_MODE:
- rtsp_transport_attrib_value_parse(&transport->mode,&stream,pool);
- break;
- default:
- break;
- }
- return TRUE;
-}
-
-/** Parse RTSP transport protocol (RTP/AVP[/UDP]) */
-static apt_bool_t rtsp_transport_protocol_parse(rtsp_transport_t *transport, const apt_str_t *value)
-{
- apt_str_t field;
- apt_text_stream_t stream;
-
- stream.text = *value;
- apt_text_stream_reset(&stream);
-
- /* set the defaults */
- transport->protocol = RTSP_TRANSPORT_RTP;
- transport->profile = RTSP_PROFILE_AVP;
- transport->lower_protocol = RTSP_LOWER_TRANSPORT_UDP;
-
- /* read transport protocol (RTP) */
- if(apt_text_field_read(&stream,'/',TRUE,&field) == FALSE) {
- return FALSE;
- }
- transport->protocol = apt_string_table_id_find(rtsp_transport_string_table,RTSP_TRANSPORT_COUNT,&field);
- if(transport->protocol >= RTSP_TRANSPORT_COUNT) {
- return FALSE;
- }
-
- /* read transport profile (AVP) */
- if(apt_text_field_read(&stream,'/',TRUE,&field) == FALSE) {
- return FALSE;
- }
- transport->profile = apt_string_table_id_find(rtsp_profile_string_table,RTSP_PROFILE_COUNT,&field);
- if(transport->profile >= RTSP_PROFILE_COUNT) {
- return FALSE;
- }
-
- /* read optional lower transport protocol (UDP) */
- if(apt_text_field_read(&stream,'/',TRUE,&field) == TRUE) {
- transport->lower_protocol = apt_string_table_id_find(rtsp_lower_transport_string_table,RTSP_LOWER_TRANSPORT_COUNT,&field);
- if(transport->lower_protocol >= RTSP_LOWER_TRANSPORT_COUNT) {
- return FALSE;
- }
- }
-
- return TRUE;
-}
-
-/** Parse RTSP transport */
-static apt_bool_t rtsp_transport_parse(rtsp_transport_t *transport, const apt_str_t *value, apr_pool_t *pool)
-{
- apt_str_t field;
- apt_text_stream_t stream;
-
- apt_text_stream_init(&stream,value->buf,value->length);
- /* read transport protocol (RTP/AVP[/UDP]) */
- if(apt_text_field_read(&stream,';',TRUE,&field) == FALSE) {
- return FALSE;
- }
-
- /* parse transport protocol (RTP/AVP[/UDP]) */
- if(rtsp_transport_protocol_parse(transport,&field) == FALSE) {
- return FALSE;
- }
-
- /* read transport attributes */
- while(apt_text_field_read(&stream,';',TRUE,&field) == TRUE) {
- rtsp_transport_attrib_parse(transport,&field,pool);
- }
-
- return TRUE;
-}
-
-/** Generate RTSP transport */
-static apt_bool_t rtsp_transport_generate(const rtsp_transport_t *transport, apt_str_t *value, apr_pool_t *pool)
-{
- char buf[256];
- apt_text_stream_t text_stream;
- const apt_str_t *protocol = apt_string_table_str_get(rtsp_transport_string_table,RTSP_TRANSPORT_COUNT,transport->protocol);
- const apt_str_t *profile = apt_string_table_str_get(rtsp_profile_string_table,RTSP_PROFILE_COUNT,transport->profile);
- if(!protocol || !profile) {
- return FALSE;
- }
-
- apt_text_stream_init(&text_stream,buf,sizeof(buf));
- apt_text_string_insert(&text_stream,protocol);
- apt_text_char_insert(&text_stream,'/');
- apt_text_string_insert(&text_stream,profile);
-
- if(transport->delivery != RTSP_DELIVERY_NONE) {
- const apt_str_t *delivery = NULL;
- rtsp_transport_attrib_e attrib = RTSP_TRANSPORT_ATTRIB_NONE;
- if(transport->delivery == RTSP_DELIVERY_UNICAST) {
- attrib = RTSP_TRANSPORT_ATTRIB_UNICAST;
- }
- else if(transport->delivery == RTSP_DELIVERY_MULTICAST) {
- attrib = RTSP_TRANSPORT_ATTRIB_MULTICAST;
- }
- delivery = apt_string_table_str_get(rtsp_transport_attrib_string_table,RTSP_TRANSPORT_ATTRIB_COUNT,attrib);
- if(!delivery) {
- return FALSE;
- }
-
- apt_text_char_insert(&text_stream,';');
- apt_text_string_insert(&text_stream,delivery);
- }
-
- if(rtsp_port_range_is_valid(&transport->client_port_range) == TRUE) {
- apt_text_char_insert(&text_stream,';');
- rtsp_port_range_generate(RTSP_TRANSPORT_ATTRIB_CLIENT_PORT,&transport->client_port_range,&text_stream);
- }
- if(rtsp_port_range_is_valid(&transport->server_port_range) == TRUE) {
- apt_text_char_insert(&text_stream,';');
- rtsp_port_range_generate(RTSP_TRANSPORT_ATTRIB_SERVER_PORT,&transport->server_port_range,&text_stream);
- }
-
- if(transport->mode.length) {
- const apt_str_t *str;
- str = apt_string_table_str_get(rtsp_transport_attrib_string_table,RTSP_TRANSPORT_ATTRIB_COUNT,RTSP_TRANSPORT_ATTRIB_MODE);
- if(str) {
- apt_text_char_insert(&text_stream,';');
- apt_text_string_insert(&text_stream,str);
- apt_text_char_insert(&text_stream,'=');
- apt_text_string_insert(&text_stream,&transport->mode);
- }
- }
- value->length = text_stream.pos - text_stream.text.buf;
- value->buf = apr_palloc(pool,value->length + 1);
- memcpy(value->buf,text_stream.text.buf,value->length);
- value->buf[value->length] = '\0';
- return TRUE;
-}
-
-/** Parse RTSP transport */
-static apt_bool_t rtsp_session_id_parse(apt_str_t *session_id, const apt_str_t *value, apr_pool_t *pool)
-{
- char *sep;
- if(!value->buf) {
- return FALSE;
- }
- apt_string_copy(session_id,value,pool);
- sep = strchr(session_id->buf,';');
- if(sep) {
- session_id->length = sep - session_id->buf;
- *sep = '\0';
- }
- return TRUE;
-}
-
-/** Parse RTSP header field value */
-static apt_bool_t rtsp_header_field_value_parse(rtsp_header_t *header, rtsp_header_field_id id, const apt_str_t *value, apr_pool_t *pool)
-{
- apt_bool_t status = TRUE;
- switch(id) {
- case RTSP_HEADER_FIELD_CSEQ:
- header->cseq = apt_size_value_parse(value);
- break;
- case RTSP_HEADER_FIELD_TRANSPORT:
- status = rtsp_transport_parse(&header->transport,value,pool);
- break;
- case RTSP_HEADER_FIELD_SESSION_ID:
- status = rtsp_session_id_parse(&header->session_id,value,pool);
- break;
- case RTSP_HEADER_FIELD_RTP_INFO:
- header->rtp_info = *value;
- break;
- case RTSP_HEADER_FIELD_CONTENT_TYPE:
- header->content_type = apt_string_table_id_find(rtsp_content_type_string_table,RTSP_CONTENT_TYPE_COUNT,value);
- break;
- case RTSP_HEADER_FIELD_CONTENT_LENGTH:
- header->content_length = apt_size_value_parse(value);
- break;
- default:
- status = FALSE;
- }
- return status;
-}
-
-/** Generate RTSP header field value */
-static apt_bool_t rtsp_header_field_value_generate(const rtsp_header_t *header, rtsp_header_field_id id, apt_str_t *value, apr_pool_t *pool)
-{
- switch(id) {
- case RTSP_HEADER_FIELD_CSEQ:
- apt_size_value_generate(header->cseq,value,pool);
- break;
- case RTSP_HEADER_FIELD_TRANSPORT:
- rtsp_transport_generate(&header->transport,value,pool);
- break;
- case RTSP_HEADER_FIELD_SESSION_ID:
- *value = header->session_id;
- break;
- case RTSP_HEADER_FIELD_RTP_INFO:
- *value = header->rtp_info;
- break;
- case RTSP_HEADER_FIELD_CONTENT_TYPE:
- {
- const apt_str_t *name = apt_string_table_str_get(rtsp_content_type_string_table,RTSP_CONTENT_TYPE_COUNT,header->content_type);
- if(name) {
- *value = *name;
- }
- break;
- }
- case RTSP_HEADER_FIELD_CONTENT_LENGTH:
- apt_size_value_generate(header->content_length,value,pool);
- break;
- default:
- break;
- }
- return TRUE;
-}
-
-/** Add RTSP header field */
-RTSP_DECLARE(apt_bool_t) rtsp_header_field_add(rtsp_header_t *header, apt_header_field_t *header_field, apr_pool_t *pool)
-{
- /* parse header field (name-value) */
- header_field->id = apt_string_table_id_find(
- rtsp_header_string_table,
- RTSP_HEADER_FIELD_COUNT,
- &header_field->name);
- if(apt_string_is_empty(&header_field->value) == FALSE) {
- rtsp_header_field_value_parse(header,header_field->id,&header_field->value,pool);
- }
-
- return apt_header_section_field_add(&header->header_section,header_field);
-}
-
-/** Parse RTSP header fields */
-RTSP_DECLARE(apt_bool_t) rtsp_header_fields_parse(rtsp_header_t *header, apr_pool_t *pool)
-{
- apt_header_field_t *header_field;
- for(header_field = APR_RING_FIRST(&header->header_section.ring);
- header_field != APR_RING_SENTINEL(&header->header_section.ring, apt_header_field_t, link);
- header_field = APR_RING_NEXT(header_field, link)) {
-
- header_field->id = apt_string_table_id_find(
- rtsp_header_string_table,
- RTSP_HEADER_FIELD_COUNT,
- &header_field->name);
- if(apt_string_is_empty(&header_field->value) == FALSE) {
- rtsp_header_field_value_parse(header,header_field->id,&header_field->value,pool);
- }
- apt_header_section_field_set(&header->header_section,header_field);
- }
- return TRUE;
-}
-
-/** Add RTSP header field property */
-RTSP_DECLARE(apt_bool_t) rtsp_header_property_add(rtsp_header_t *header, rtsp_header_field_id id, apr_pool_t *pool)
-{
- apt_header_field_t *header_field;
- header_field = apt_header_section_field_get(&header->header_section,id);
- if(header_field) {
- /* such header field already exists, just (re)generate value */
- return rtsp_header_field_value_generate(header,id,&header_field->value,pool);
- }
-
- header_field = apt_header_field_alloc(pool);
- if(rtsp_header_field_value_generate(header,id,&header_field->value,pool) == TRUE) {
- const apt_str_t *name = apt_string_table_str_get(rtsp_header_string_table,RTSP_HEADER_FIELD_COUNT,id);
- if(name) {
- header_field->name = *name;
- header_field->id = id;
- return apt_header_section_field_insert(&header->header_section,header_field);
- }
- }
- return FALSE;
-}
diff --git a/libs/unimrcp/libs/uni-rtsp/src/rtsp_message.c b/libs/unimrcp/libs/uni-rtsp/src/rtsp_message.c
deleted file mode 100644
index 59fd7168e0..0000000000
--- a/libs/unimrcp/libs/uni-rtsp/src/rtsp_message.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: rtsp_message.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include "rtsp_message.h"
-
-/** Initialize RTSP message */
-static APR_INLINE void rtsp_message_init(rtsp_message_t *message, rtsp_message_type_e message_type, apr_pool_t *pool)
-{
- message->pool = pool;
- rtsp_start_line_init(&message->start_line,message_type);
- rtsp_header_init(&message->header,pool);
- apt_string_reset(&message->body);
-}
-
-/** Create RTSP message */
-RTSP_DECLARE(rtsp_message_t*) rtsp_message_create(rtsp_message_type_e message_type, apr_pool_t *pool)
-{
- rtsp_message_t *message = apr_palloc(pool,sizeof(rtsp_message_t));
- rtsp_message_init(message,message_type,pool);
- return message;
-}
-
-/** Create RTSP request message */
-RTSP_DECLARE(rtsp_message_t*) rtsp_request_create(apr_pool_t *pool)
-{
- rtsp_message_t *request = rtsp_message_create(RTSP_MESSAGE_TYPE_REQUEST,pool);
- request->start_line.common.request_line.version = RTSP_VERSION_1;
- return request;
-}
-
-/** Create RTSP response message */
-RTSP_DECLARE(rtsp_message_t*) rtsp_response_create(const rtsp_message_t *request, rtsp_status_code_e status_code, rtsp_reason_phrase_e reason, apr_pool_t *pool)
-{
- const apt_str_t *reason_str;
- rtsp_status_line_t *status_line;
- rtsp_message_t *response = rtsp_message_create(RTSP_MESSAGE_TYPE_RESPONSE,pool);
- status_line = &response->start_line.common.status_line;
- status_line->version = request->start_line.common.request_line.version;
- status_line->status_code = status_code;
- reason_str = rtsp_reason_phrase_get(reason);
- if(reason_str) {
- apt_string_copy(&status_line->reason,reason_str,pool);
- }
-
- if(rtsp_header_property_check(&request->header,RTSP_HEADER_FIELD_CSEQ) == TRUE) {
- response->header.cseq = request->header.cseq;
- rtsp_header_property_add(&response->header,RTSP_HEADER_FIELD_CSEQ,response->pool);
- }
-
- if(rtsp_header_property_check(&request->header,RTSP_HEADER_FIELD_TRANSPORT) == TRUE) {
- const rtsp_transport_t *req_transport = &request->header.transport;
- rtsp_transport_t *res_transport = &response->header.transport;
- if(req_transport->mode.length) {
- apt_string_copy(&res_transport->mode,&req_transport->mode,pool);
- }
- }
-
- return response;
-}
-
-/** Destroy RTSP message */
-RTSP_DECLARE(void) rtsp_message_destroy(rtsp_message_t *message)
-{
- /* nothing to do message is allocated from pool */
-}
diff --git a/libs/unimrcp/libs/uni-rtsp/src/rtsp_server.c b/libs/unimrcp/libs/uni-rtsp/src/rtsp_server.c
deleted file mode 100644
index 428634fde2..0000000000
--- a/libs/unimrcp/libs/uni-rtsp/src/rtsp_server.c
+++ /dev/null
@@ -1,889 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: rtsp_server.c 2252 2014-11-21 02:45:15Z achaloyan@gmail.com $
- */
-
-#ifdef WIN32
-#pragma warning(disable: 4127)
-#endif
-#include
-#include
-#include "rtsp_server.h"
-#include "rtsp_stream.h"
-#include "apt_poller_task.h"
-#include "apt_text_stream.h"
-#include "apt_pool.h"
-#include "apt_obj_list.h"
-#include "apt_log.h"
-
-#define RTSP_SESSION_ID_HEX_STRING_LENGTH 16
-#define RTSP_STREAM_BUFFER_SIZE 1024
-
-typedef struct rtsp_server_connection_t rtsp_server_connection_t;
-
-/** RTSP server */
-struct rtsp_server_t {
- apr_pool_t *pool;
- apt_poller_task_t *task;
-
- /** List (ring) of RTSP connections */
- APR_RING_HEAD(rtsp_server_connection_head_t, rtsp_server_connection_t) connection_list;
-
- /* Listening socket descriptor */
- apr_sockaddr_t *sockaddr;
- apr_socket_t *listen_sock;
- apr_pollfd_t listen_sock_pfd;
-
- void *obj;
- const rtsp_server_vtable_t *vtable;
-};
-
-/** RTSP connection */
-struct rtsp_server_connection_t {
- /** Ring entry */
- APR_RING_ENTRY(rtsp_server_connection_t) link;
-
- /** Memory pool */
- apr_pool_t *pool;
- /** Client IP address */
- char *client_ip;
- /** Accepted socket */
- apr_socket_t *sock;
- /** Socket poll descriptor */
- apr_pollfd_t sock_pfd;
- /** String identifier used for traces */
- const char *id;
-
- /** RTSP server, connection belongs to */
- rtsp_server_t *server;
-
- /** Session table (rtsp_server_session_t*) */
- apr_hash_t *session_table;
-
- char rx_buffer[RTSP_STREAM_BUFFER_SIZE];
- apt_text_stream_t rx_stream;
- rtsp_parser_t *parser;
-
- char tx_buffer[RTSP_STREAM_BUFFER_SIZE];
- apt_text_stream_t tx_stream;
- rtsp_generator_t *generator;
-};
-
-/** RTSP session */
-struct rtsp_server_session_t {
- apr_pool_t *pool;
- void *obj;
- rtsp_server_connection_t *connection;
-
- /** Session identifier */
- apt_str_t id;
-
- /** Last cseq sent */
- apr_size_t last_cseq;
-
- /** In-progress request */
- rtsp_message_t *active_request;
- /** request queue */
- apt_obj_list_t *request_queue;
-
- /** Resource table */
- apr_hash_t *resource_table;
-
- /** In-progress termination request */
- apt_bool_t terminating;
-};
-
-typedef enum {
- TASK_MSG_SEND_MESSAGE,
- TASK_MSG_TERMINATE_SESSION
-} task_msg_data_type_e;
-
-typedef struct task_msg_data_t task_msg_data_t;
-
-struct task_msg_data_t {
- task_msg_data_type_e type;
- rtsp_server_t *server;
- rtsp_server_session_t *session;
- rtsp_message_t *message;
-};
-
-static apt_bool_t rtsp_server_on_destroy(apt_task_t *task);
-static apt_bool_t rtsp_server_task_msg_process(apt_task_t *task, apt_task_msg_t *msg);
-static apt_bool_t rtsp_server_poller_signal_process(void *obj, const apr_pollfd_t *descriptor);
-static apt_bool_t rtsp_server_message_send(rtsp_server_t *server, rtsp_server_connection_t *connection, rtsp_message_t *message);
-
-static apt_bool_t rtsp_server_listening_socket_create(rtsp_server_t *server);
-static void rtsp_server_listening_socket_destroy(rtsp_server_t *server);
-
-/** Get string identifier */
-static const char* rtsp_server_id_get(const rtsp_server_t *server)
-{
- apt_task_t *task = apt_poller_task_base_get(server->task);
- return apt_task_name_get(task);
-}
-
-/** Create RTSP server */
-RTSP_DECLARE(rtsp_server_t*) rtsp_server_create(
- const char *id,
- const char *listen_ip,
- apr_port_t listen_port,
- apr_size_t max_connection_count,
- void *obj,
- const rtsp_server_vtable_t *handler,
- apr_pool_t *pool)
-{
- apt_task_t *task;
- apt_task_vtable_t *vtable;
- apt_task_msg_pool_t *msg_pool;
- rtsp_server_t *server;
-
- if(!listen_ip) {
- return NULL;
- }
-
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create RTSP Server [%s] %s:%hu [%"APR_SIZE_T_FMT"]",
- id,
- listen_ip,
- listen_port,
- max_connection_count);
- server = apr_palloc(pool,sizeof(rtsp_server_t));
- server->pool = pool;
- server->obj = obj;
- server->vtable = handler;
-
- server->listen_sock = NULL;
- server->sockaddr = NULL;
- apr_sockaddr_info_get(&server->sockaddr,listen_ip,APR_INET,listen_port,0,pool);
- if(!server->sockaddr) {
- return NULL;
- }
-
- msg_pool = apt_task_msg_pool_create_dynamic(sizeof(task_msg_data_t),pool);
-
- server->task = apt_poller_task_create(
- max_connection_count + 1,
- rtsp_server_poller_signal_process,
- server,
- msg_pool,
- pool);
- if(!server->task) {
- return NULL;
- }
-
- task = apt_poller_task_base_get(server->task);
- if(task) {
- apt_task_name_set(task,id);
- }
-
- vtable = apt_poller_task_vtable_get(server->task);
- if(vtable) {
- vtable->destroy = rtsp_server_on_destroy;
- vtable->process_msg = rtsp_server_task_msg_process;
- }
-
- APR_RING_INIT(&server->connection_list, rtsp_server_connection_t, link);
-
- if(rtsp_server_listening_socket_create(server) != TRUE) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Listening Socket [%s] %s:%hu",
- id,
- listen_ip,
- listen_port);
- }
- return server;
-}
-
-static apt_bool_t rtsp_server_on_destroy(apt_task_t *task)
-{
- apt_poller_task_t *poller_task = apt_task_object_get(task);
- rtsp_server_t *server = apt_poller_task_object_get(poller_task);
-
- rtsp_server_listening_socket_destroy(server);
- apt_poller_task_cleanup(poller_task);
- return TRUE;
-}
-
-/** Destroy RTSP server */
-RTSP_DECLARE(apt_bool_t) rtsp_server_destroy(rtsp_server_t *server)
-{
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Destroy RTSP Server [%s]",
- rtsp_server_id_get(server));
- return apt_poller_task_destroy(server->task);
-}
-
-/** Start connection agent */
-RTSP_DECLARE(apt_bool_t) rtsp_server_start(rtsp_server_t *server)
-{
- return apt_poller_task_start(server->task);
-}
-
-/** Terminate connection agent */
-RTSP_DECLARE(apt_bool_t) rtsp_server_terminate(rtsp_server_t *server)
-{
- return apt_poller_task_terminate(server->task);
-}
-
-/** Get task */
-RTSP_DECLARE(apt_task_t*) rtsp_server_task_get(const rtsp_server_t *server)
-{
- return apt_poller_task_base_get(server->task);
-}
-
-/** Get external object */
-RTSP_DECLARE(void*) rtsp_server_object_get(const rtsp_server_t *server)
-{
- return server->obj;
-}
-
-/** Get object associated with the session */
-RTSP_DECLARE(void*) rtsp_server_session_object_get(const rtsp_server_session_t *session)
-{
- return session->obj;
-}
-
-/** Set object associated with the session */
-RTSP_DECLARE(void) rtsp_server_session_object_set(rtsp_server_session_t *session, void *obj)
-{
- session->obj = obj;
-}
-
-/** Get the session identifier */
-RTSP_DECLARE(const apt_str_t*) rtsp_server_session_id_get(const rtsp_server_session_t *session)
-{
- return &session->id;
-}
-
-/** Get active request */
-RTSP_DECLARE(const rtsp_message_t*) rtsp_server_session_request_get(const rtsp_server_session_t *session)
-{
- return session->active_request;
-}
-
-/** Get the session destination (client) IP address */
-RTSP_DECLARE(const char*) rtsp_server_session_destination_get(const rtsp_server_session_t *session)
-{
- if(session->connection) {
- return session->connection->client_ip;
- }
- return NULL;
-}
-
-/** Signal task message */
-static apt_bool_t rtsp_server_control_message_signal(
- task_msg_data_type_e type,
- rtsp_server_t *server,
- rtsp_server_session_t *session,
- rtsp_message_t *message)
-{
- apt_task_t *task = apt_poller_task_base_get(server->task);
- apt_task_msg_t *task_msg = apt_task_msg_get(task);
- if(task_msg) {
- task_msg_data_t *data = (task_msg_data_t*)task_msg->data;
- data->type = type;
- data->server = server;
- data->session = session;
- data->message = message;
- apt_task_msg_signal(task,task_msg);
- }
- return TRUE;
-}
-
-/** Signal RTSP message */
-RTSP_DECLARE(apt_bool_t) rtsp_server_session_respond(rtsp_server_t *server, rtsp_server_session_t *session, rtsp_message_t *message)
-{
- return rtsp_server_control_message_signal(TASK_MSG_SEND_MESSAGE,server,session,message);
-}
-
-/** Signal terminate response */
-RTSP_DECLARE(apt_bool_t) rtsp_server_session_terminate(rtsp_server_t *server, rtsp_server_session_t *session)
-{
- return rtsp_server_control_message_signal(TASK_MSG_TERMINATE_SESSION,server,session,NULL);
-}
-
-/* Create RTSP session */
-static rtsp_server_session_t* rtsp_server_session_create(rtsp_server_t *server)
-{
- rtsp_server_session_t *session;
- apr_pool_t *pool = apt_pool_create();
- session = apr_palloc(pool,sizeof(rtsp_server_session_t));
- session->pool = pool;
- session->obj = NULL;
- session->last_cseq = 0;
- session->active_request = NULL;
- session->request_queue = apt_list_create(pool);
- session->resource_table = apr_hash_make(pool);
- session->terminating = FALSE;
-
- apt_unique_id_generate(&session->id,RTSP_SESSION_ID_HEX_STRING_LENGTH,pool);
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create RTSP Session "APT_SID_FMT,session->id.buf);
- if(server->vtable->create_session(server,session) != TRUE) {
- apr_pool_destroy(pool);
- return NULL;
- }
- return session;
-}
-
-/* Destroy RTSP session */
-static void rtsp_server_session_destroy(rtsp_server_session_t *session)
-{
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Destroy RTSP Session "APT_SID_FMT,
- session ? session->id.buf : "(null)");
- if(session && session->pool) {
- apr_pool_destroy(session->pool);
- }
-}
-
-/** Destroy RTSP connection */
-static void rtsp_server_connection_destroy(rtsp_server_connection_t *rtsp_connection)
-{
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Destroy RTSP Connection %s",rtsp_connection->id);
- apr_pool_destroy(rtsp_connection->pool);
-}
-
-/* Finally terminate RTSP session */
-static apt_bool_t rtsp_server_session_do_terminate(rtsp_server_t *server, rtsp_server_session_t *session)
-{
- rtsp_server_connection_t *rtsp_connection = session->connection;
-
- if(session->active_request) {
- rtsp_message_t *response = rtsp_response_create(session->active_request,
- RTSP_STATUS_CODE_OK,RTSP_REASON_PHRASE_OK,session->active_request->pool);
- if(response) {
- if(session->id.buf) {
- response->header.session_id = session->id;
- rtsp_header_property_add(&response->header,RTSP_HEADER_FIELD_SESSION_ID,response->pool);
- }
-
- if(rtsp_connection) {
- rtsp_server_message_send(server,rtsp_connection,response);
- }
- }
- }
-
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Remove RTSP Session "APT_SID_FMT,session->id.buf);
- if(rtsp_connection) {
- apr_hash_set(rtsp_connection->session_table,session->id.buf,session->id.length,NULL);
- }
- rtsp_server_session_destroy(session);
-
- if(rtsp_connection && !rtsp_connection->sock) {
- if(apr_hash_count(rtsp_connection->session_table) == 0) {
- rtsp_server_connection_destroy(rtsp_connection);
- }
- }
- return TRUE;
-}
-
-static apt_bool_t rtsp_server_error_respond(rtsp_server_t *server, rtsp_server_connection_t *rtsp_connection, rtsp_message_t *request,
- rtsp_status_code_e status_code, rtsp_reason_phrase_e reason)
-{
- /* send error response to client */
- rtsp_message_t *response = rtsp_response_create(request,status_code,reason,request->pool);
- if(rtsp_server_message_send(server,rtsp_connection,response) == FALSE) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Send RTSP Response");
- return FALSE;
- }
- return TRUE;
-}
-
-static apt_bool_t rtsp_server_session_terminate_request(rtsp_server_t *server, rtsp_server_session_t *session)
-{
- session->terminating = TRUE;
- return server->vtable->terminate_session(server,session);
-}
-
-static apt_bool_t rtsp_server_session_message_handle(rtsp_server_t *server, rtsp_server_session_t *session, rtsp_message_t *message)
-{
- if(message->start_line.common.request_line.method_id == RTSP_METHOD_TEARDOWN) {
- /* remove resource */
- const char *resource_name = message->start_line.common.request_line.resource_name;
- apr_hash_set(session->resource_table,resource_name,APR_HASH_KEY_STRING,NULL);
-
- if(apr_hash_count(session->resource_table) == 0) {
- rtsp_server_session_terminate_request(server,session);
- return TRUE;
- }
- }
-
- if(server->vtable->handle_message(server,session,message) != TRUE) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Handle Message "APT_SID_FMT,session->id.buf);
- rtsp_server_error_respond(server,session->connection,message,
- RTSP_STATUS_CODE_INTERNAL_SERVER_ERROR,
- RTSP_REASON_PHRASE_INTERNAL_SERVER_ERROR);
- return FALSE;
- }
- return TRUE;
-}
-
-/* Process incoming SETUP/DESCRIBE request */
-static rtsp_server_session_t* rtsp_server_session_setup_process(rtsp_server_t *server, rtsp_server_connection_t *rtsp_connection, rtsp_message_t *message)
-{
- rtsp_server_session_t *session = NULL;
- if(message->start_line.common.request_line.method_id == RTSP_METHOD_SETUP) {
- /* create new session */
- session = rtsp_server_session_create(server);
- if(!session) {
- return NULL;
- }
- session->connection = rtsp_connection;
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Add RTSP Session "APT_SID_FMT,session->id.buf);
- apr_hash_set(rtsp_connection->session_table,session->id.buf,session->id.length,session);
- }
- else if(message->start_line.common.request_line.method_id == RTSP_METHOD_DESCRIBE) {
- /* create new session as a communication object */
- session = rtsp_server_session_create(server);
- if(!session) {
- return NULL;
- }
- session->connection = rtsp_connection;
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Add RTSP Session "APT_SID_FMT,session->id.buf);
- apr_hash_set(rtsp_connection->session_table,session->id.buf,session->id.length,session);
- }
- else {
- /* error case */
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Missing RTSP Session-ID");
- rtsp_server_error_respond(server,rtsp_connection,message,
- RTSP_STATUS_CODE_BAD_REQUEST,
- RTSP_REASON_PHRASE_BAD_REQUEST);
- }
- return session;
-}
-
-/* Process incoming RTSP request */
-static apt_bool_t rtsp_server_session_request_process(rtsp_server_t *server, rtsp_server_connection_t *rtsp_connection, rtsp_message_t *message)
-{
- rtsp_server_session_t *session = NULL;
- if(message->start_line.message_type != RTSP_MESSAGE_TYPE_REQUEST) {
- /* received response to ANNOUNCE request/event */
- return TRUE;
- }
-
- if(rtsp_header_property_check(&message->header,RTSP_HEADER_FIELD_SESSION_ID) != TRUE) {
- /* no session-id specified */
- session = rtsp_server_session_setup_process(server,rtsp_connection,message);
- if(session) {
- session->active_request = message;
- if(rtsp_server_session_message_handle(server,session,message) != TRUE) {
- rtsp_server_session_destroy(session);
- }
- }
- else {
- /* error case, failed to create a session */
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create RTSP Session");
- return rtsp_server_error_respond(server,rtsp_connection,message,
- RTSP_STATUS_CODE_NOT_ACCEPTABLE,
- RTSP_REASON_PHRASE_NOT_ACCEPTABLE);
- }
- return TRUE;
- }
-
- /* existing session */
- session = apr_hash_get(
- rtsp_connection->session_table,
- message->header.session_id.buf,
- message->header.session_id.length);
- if(!session) {
- /* error case, no such session */
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"No Such RTSP Session "APT_SID_FMT,message->header.session_id.buf);
- return rtsp_server_error_respond(server,rtsp_connection,message,
- RTSP_STATUS_CODE_NOT_FOUND,
- RTSP_REASON_PHRASE_NOT_FOUND);
- }
-
- if(session->terminating == TRUE) {
- /* error case, session is being terminated */
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Not Acceptable Request "APT_SID_FMT,message->header.session_id.buf);
- return rtsp_server_error_respond(server,rtsp_connection,message,
- RTSP_STATUS_CODE_NOT_ACCEPTABLE,
- RTSP_REASON_PHRASE_NOT_ACCEPTABLE);
- }
-
- if(session->active_request) {
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Push RTSP Request to Queue "APT_SID_FMT,session->id.buf);
- apt_list_push_back(session->request_queue,message,message->pool);
- return TRUE;
- }
-
- /* handle the request */
- session->active_request = message;
- rtsp_server_session_message_handle(server,session,message);
- return TRUE;
-}
-
-/* Process outgoing RTSP response */
-static apt_bool_t rtsp_server_session_response_process(rtsp_server_t *server, rtsp_server_session_t *session, rtsp_message_t *message)
-{
- apt_bool_t terminate = FALSE;
- rtsp_message_t *request = NULL;
- if(message->start_line.message_type == RTSP_MESSAGE_TYPE_REQUEST) {
- /* RTSP ANNOUNCE request (asynch event) */
- const char *resource_name = message->start_line.common.request_line.resource_name;
- if(resource_name) {
- request = apr_hash_get(session->resource_table,resource_name,APR_HASH_KEY_STRING);
- }
- if(!request) {
- return FALSE;
- }
- message->start_line.common.request_line.url = request->start_line.common.request_line.url;
- message->header.cseq = session->last_cseq;
- rtsp_header_property_add(&message->header,RTSP_HEADER_FIELD_CSEQ,message->pool);
-
- if(session->id.buf) {
- message->header.session_id = session->id;
- rtsp_header_property_add(&message->header,RTSP_HEADER_FIELD_SESSION_ID,message->pool);
- }
- rtsp_server_message_send(server,session->connection,message);
- return TRUE;
- }
-
- if(!session->active_request) {
- /* unexpected response */
- return FALSE;
- }
-
- request = session->active_request;
- if(request->start_line.common.request_line.method_id == RTSP_METHOD_DESCRIBE) {
- terminate = TRUE;
- }
- else {
- if(session->id.buf) {
- message->header.session_id = session->id;
- rtsp_header_property_add(&message->header,RTSP_HEADER_FIELD_SESSION_ID,message->pool);
- }
- if(request->start_line.common.request_line.method_id == RTSP_METHOD_SETUP) {
- if(message->start_line.common.status_line.status_code == RTSP_STATUS_CODE_OK) {
- /* add resource */
- const char *resource_name = request->start_line.common.request_line.resource_name;
- apr_hash_set(session->resource_table,resource_name,APR_HASH_KEY_STRING,request);
- }
- else if(apr_hash_count(session->resource_table) == 0) {
- terminate = TRUE;
- }
- }
- }
-
- session->last_cseq = message->header.cseq;
- rtsp_server_message_send(server,session->connection,message);
-
- if(terminate == TRUE) {
- session->active_request = NULL;
- rtsp_server_session_terminate_request(server,session);
- return TRUE;
- }
-
- session->active_request = apt_list_pop_front(session->request_queue);
- if(session->active_request) {
- rtsp_server_session_message_handle(server,session,session->active_request);
- }
- return TRUE;
-}
-
-/* Send RTSP message through RTSP connection */
-static apt_bool_t rtsp_server_message_send(rtsp_server_t *server, rtsp_server_connection_t *rtsp_connection, rtsp_message_t *message)
-{
- apt_bool_t status = FALSE;
- apt_text_stream_t *stream;
- apt_message_status_e result;
-
- if(!rtsp_connection || !rtsp_connection->sock) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"No RTSP Connection");
- return FALSE;
- }
- stream = &rtsp_connection->tx_stream;
-
- do {
- stream->text.length = sizeof(rtsp_connection->tx_buffer)-1;
- apt_text_stream_reset(stream);
- result = rtsp_generator_run(rtsp_connection->generator,message,stream);
- if(result != APT_MESSAGE_STATUS_INVALID) {
- stream->text.length = stream->pos - stream->text.buf;
- *stream->pos = '\0';
-
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Send RTSP Data %s [%"APR_SIZE_T_FMT" bytes]\n%s",
- rtsp_connection->id,
- stream->text.length,
- stream->text.buf);
- if(apr_socket_send(rtsp_connection->sock,stream->text.buf,&stream->text.length) == APR_SUCCESS) {
- status = TRUE;
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Send RTSP Data");
- }
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Generate RTSP Data");
- }
- }
- while(result == APT_MESSAGE_STATUS_INCOMPLETE);
-
- return status;
-}
-
-static apt_bool_t rtsp_server_message_handler(rtsp_server_connection_t *rtsp_connection, rtsp_message_t *message, apt_message_status_e status)
-{
- if(status == APT_MESSAGE_STATUS_COMPLETE) {
- /* message is completely parsed */
- apt_str_t *destination;
- destination = &message->header.transport.destination;
- if(!destination->buf && rtsp_connection->client_ip) {
- apt_string_assign(destination,rtsp_connection->client_ip,rtsp_connection->pool);
- }
- rtsp_server_session_request_process(rtsp_connection->server,rtsp_connection,message);
- }
- else if(status == APT_MESSAGE_STATUS_INVALID) {
- /* error case */
- rtsp_message_t *response;
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Parse RTSP Data");
- if(message) {
- response = rtsp_response_create(message,RTSP_STATUS_CODE_BAD_REQUEST,
- RTSP_REASON_PHRASE_BAD_REQUEST,message->pool);
- if(rtsp_server_message_send(rtsp_connection->server,rtsp_connection,response) == FALSE) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Send RTSP Response");
- }
- }
- }
- return TRUE;
-}
-
-/** Create listening socket and add it to pollset */
-static apt_bool_t rtsp_server_listening_socket_create(rtsp_server_t *server)
-{
- apr_status_t status;
-
- if(!server->sockaddr) {
- return FALSE;
- }
-
- /* create listening socket */
- status = apr_socket_create(&server->listen_sock, server->sockaddr->family, SOCK_STREAM, APR_PROTO_TCP, server->pool);
- if(status != APR_SUCCESS) {
- return FALSE;
- }
-
- apr_socket_opt_set(server->listen_sock, APR_SO_NONBLOCK, 0);
- apr_socket_timeout_set(server->listen_sock, -1);
- apr_socket_opt_set(server->listen_sock, APR_SO_REUSEADDR, 1);
-
- status = apr_socket_bind(server->listen_sock, server->sockaddr);
- if(status != APR_SUCCESS) {
- apr_socket_close(server->listen_sock);
- server->listen_sock = NULL;
- return FALSE;
- }
- status = apr_socket_listen(server->listen_sock, SOMAXCONN);
- if(status != APR_SUCCESS) {
- apr_socket_close(server->listen_sock);
- server->listen_sock = NULL;
- return FALSE;
- }
-
- /* add listening socket to pollset */
- memset(&server->listen_sock_pfd,0,sizeof(apr_pollfd_t));
- server->listen_sock_pfd.desc_type = APR_POLL_SOCKET;
- server->listen_sock_pfd.reqevents = APR_POLLIN;
- server->listen_sock_pfd.desc.s = server->listen_sock;
- server->listen_sock_pfd.client_data = server->listen_sock;
- if(apt_poller_task_descriptor_add(server->task, &server->listen_sock_pfd) != TRUE) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Add Listening Socket to Pollset");
- apr_socket_close(server->listen_sock);
- server->listen_sock = NULL;
- return FALSE;
- }
-
- return TRUE;
-}
-
-/** Remove from pollset and destroy listening socket */
-static void rtsp_server_listening_socket_destroy(rtsp_server_t *server)
-{
- if(server->listen_sock) {
- apt_poller_task_descriptor_remove(server->task,&server->listen_sock_pfd);
- apr_socket_close(server->listen_sock);
- server->listen_sock = NULL;
- }
-}
-
-/* Accept RTSP connection */
-static apt_bool_t rtsp_server_connection_accept(rtsp_server_t *server)
-{
- rtsp_server_connection_t *rtsp_connection;
- char *local_ip = NULL;
- char *remote_ip = NULL;
- apr_sockaddr_t *l_sockaddr = NULL;
- apr_sockaddr_t *r_sockaddr = NULL;
- apr_pool_t *pool = apt_pool_create();
- if(!pool) {
- return FALSE;
- }
-
- rtsp_connection = apr_palloc(pool,sizeof(rtsp_server_connection_t));
- rtsp_connection->pool = pool;
- rtsp_connection->sock = NULL;
- rtsp_connection->client_ip = NULL;
- APR_RING_ELEM_INIT(rtsp_connection,link);
-
- if(apr_socket_accept(&rtsp_connection->sock,server->listen_sock,rtsp_connection->pool) != APR_SUCCESS) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Accept RTSP Connection");
- apr_pool_destroy(pool);
- return FALSE;
- }
-
- if(apr_socket_addr_get(&l_sockaddr,APR_LOCAL,rtsp_connection->sock) != APR_SUCCESS ||
- apr_socket_addr_get(&r_sockaddr,APR_REMOTE,rtsp_connection->sock) != APR_SUCCESS) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Get RTSP Socket Address");
- apr_pool_destroy(pool);
- return FALSE;
- }
-
- apr_sockaddr_ip_get(&local_ip,l_sockaddr);
- apr_sockaddr_ip_get(&remote_ip,r_sockaddr);
- rtsp_connection->client_ip = remote_ip;
- rtsp_connection->id = apr_psprintf(pool,"%s:%hu <-> %s:%hu",
- local_ip,l_sockaddr->port,
- remote_ip,r_sockaddr->port);
-
- memset(&rtsp_connection->sock_pfd,0,sizeof(apr_pollfd_t));
- rtsp_connection->sock_pfd.desc_type = APR_POLL_SOCKET;
- rtsp_connection->sock_pfd.reqevents = APR_POLLIN;
- rtsp_connection->sock_pfd.desc.s = rtsp_connection->sock;
- rtsp_connection->sock_pfd.client_data = rtsp_connection;
- if(apt_poller_task_descriptor_add(server->task,&rtsp_connection->sock_pfd) != TRUE) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Add to Pollset %s",rtsp_connection->id);
- apr_socket_close(rtsp_connection->sock);
- apr_pool_destroy(pool);
- return FALSE;
- }
-
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Accepted TCP Connection %s",rtsp_connection->id);
- rtsp_connection->session_table = apr_hash_make(rtsp_connection->pool);
- apt_text_stream_init(&rtsp_connection->rx_stream,rtsp_connection->rx_buffer,sizeof(rtsp_connection->rx_buffer)-1);
- apt_text_stream_init(&rtsp_connection->tx_stream,rtsp_connection->tx_buffer,sizeof(rtsp_connection->tx_buffer)-1);
- rtsp_connection->parser = rtsp_parser_create(rtsp_connection->pool);
- rtsp_connection->generator = rtsp_generator_create(rtsp_connection->pool);
- rtsp_connection->server = server;
- APR_RING_INSERT_TAIL(&server->connection_list,rtsp_connection,rtsp_server_connection_t,link);
- return TRUE;
-}
-
-/** Close connection */
-static apt_bool_t rtsp_server_connection_close(rtsp_server_t *server, rtsp_server_connection_t *rtsp_connection)
-{
- apr_size_t remaining_sessions = 0;
- if(!rtsp_connection || !rtsp_connection->sock) {
- return FALSE;
- }
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Close RTSP Connection %s",rtsp_connection->id);
- apt_poller_task_descriptor_remove(server->task,&rtsp_connection->sock_pfd);
- apr_socket_close(rtsp_connection->sock);
- rtsp_connection->sock = NULL;
-
- APR_RING_REMOVE(rtsp_connection,link);
-
- remaining_sessions = apr_hash_count(rtsp_connection->session_table);
- if(remaining_sessions) {
- rtsp_server_session_t *session;
- void *val;
- apr_hash_index_t *it;
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Terminate Remaining RTSP Sessions [%"APR_SIZE_T_FMT"]",
- remaining_sessions);
- it = apr_hash_first(rtsp_connection->pool,rtsp_connection->session_table);
- for(; it; it = apr_hash_next(it)) {
- apr_hash_this(it,NULL,NULL,&val);
- session = val;
- if(session && session->terminating == FALSE) {
- rtsp_server_session_terminate_request(server,session);
- }
- }
- }
- else {
- rtsp_server_connection_destroy(rtsp_connection);
- }
- return TRUE;
-}
-
-
-/* Receive RTSP message through RTSP connection */
-static apt_bool_t rtsp_server_poller_signal_process(void *obj, const apr_pollfd_t *descriptor)
-{
- rtsp_server_t *server = obj;
- rtsp_server_connection_t *rtsp_connection = descriptor->client_data;
- apr_status_t status;
- apr_size_t offset;
- apr_size_t length;
- apt_text_stream_t *stream;
- rtsp_message_t *message;
- apt_message_status_e msg_status;
-
- if(descriptor->desc.s == server->listen_sock) {
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Accept Connection");
- return rtsp_server_connection_accept(server);
- }
-
- if(!rtsp_connection || !rtsp_connection->sock) {
- return FALSE;
- }
- stream = &rtsp_connection->rx_stream;
-
- /* calculate offset remaining from the previous receive / if any */
- offset = stream->pos - stream->text.buf;
- /* calculate available length */
- length = sizeof(rtsp_connection->rx_buffer) - 1 - offset;
-
- status = apr_socket_recv(rtsp_connection->sock,stream->pos,&length);
- if(status == APR_EOF || length == 0) {
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"RTSP Peer Disconnected %s",rtsp_connection->id);
- return rtsp_server_connection_close(server,rtsp_connection);
- }
-
- /* calculate actual length of the stream */
- stream->text.length = offset + length;
- stream->pos[length] = '\0';
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Receive RTSP Data %s [%"APR_SIZE_T_FMT" bytes]\n%s",
- rtsp_connection->id,
- length,
- stream->pos);
-
- /* reset pos */
- apt_text_stream_reset(stream);
-
- do {
- msg_status = rtsp_parser_run(rtsp_connection->parser,stream,&message);
- rtsp_server_message_handler(rtsp_connection,message,msg_status);
- }
- while(apt_text_is_eos(stream) == FALSE);
-
- /* scroll remaining stream */
- apt_text_stream_scroll(stream);
- return TRUE;
-}
-
-/* Process task message */
-static apt_bool_t rtsp_server_task_msg_process(apt_task_t *task, apt_task_msg_t *task_msg)
-{
- apt_poller_task_t *poller_task = apt_task_object_get(task);
- rtsp_server_t *server = apt_poller_task_object_get(poller_task);
-
- task_msg_data_t *data = (task_msg_data_t*) task_msg->data;
- switch(data->type) {
- case TASK_MSG_SEND_MESSAGE:
- rtsp_server_session_response_process(server,data->session,data->message);
- break;
- case TASK_MSG_TERMINATE_SESSION:
- rtsp_server_session_do_terminate(server,data->session);
- break;
- }
-
- return TRUE;
-}
diff --git a/libs/unimrcp/libs/uni-rtsp/src/rtsp_start_line.c b/libs/unimrcp/libs/uni-rtsp/src/rtsp_start_line.c
deleted file mode 100644
index a374675af3..0000000000
--- a/libs/unimrcp/libs/uni-rtsp/src/rtsp_start_line.c
+++ /dev/null
@@ -1,261 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: rtsp_start_line.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include "rtsp_start_line.h"
-#include "apt_string_table.h"
-#include "apt_log.h"
-
-/** Protocol name used in version string */
-#define RTSP_NAME "RTSP"
-#define RTSP_NAME_LENGTH (sizeof(RTSP_NAME)-1)
-
-/** Separators used in RTSP version string parse/generate */
-#define RTSP_NAME_VERSION_SEPARATOR '/'
-#define RTSP_VERSION_MAJOR_MINOR_SEPARATOR '.'
-
-/** String table of RTSP methods (rtsp_method_id) */
-static const apt_str_table_item_t rtsp_method_string_table[] = {
- {{"SETUP", 5},0},
- {{"ANNOUNCE", 8},0},
- {{"TEARDOWN", 8},0},
- {{"DESCRIBE", 8},0}
-};
-
-/** String table of RTSP reason phrases (rtsp_reason_phrase_e) */
-static const apt_str_table_item_t rtsp_reason_string_table[] = {
- {{"OK", 2},0},
- {{"Created", 7},0},
- {{"Bad Request", 11},0},
- {{"Unauthorized", 12},0},
- {{"Not Found", 9},4},
- {{"Method Not Allowed", 18},0},
- {{"Not Acceptable", 14},4},
- {{"Proxy Auth Required", 19},0},
- {{"Request Timeout", 15},0},
- {{"Session Not Found", 17},0},
- {{"Internal Server Error", 21},0},
- {{"Not Implemented", 15},4}
-};
-
-/** Parse RTSP URI */
-static apt_bool_t rtsp_resource_uri_parse(const apt_str_t *field, rtsp_request_line_t *request_line, apr_pool_t *pool)
-{
- char *str;
- apt_str_t *url = &request_line->url;
- if(!field->length || !field->buf) {
- return FALSE;
- }
-
- apt_string_copy(url,field,pool);
- if(url->buf[url->length-1] == '/') {
- url->length--;
- url->buf[url->length] = '\0';
- }
-
- str = strrchr(url->buf,'/');
- if(str) {
- str++;
- }
- request_line->resource_name = str;
- return TRUE;
-}
-
-/** Parse RTSP version */
-static rtsp_version_e rtsp_version_parse(const apt_str_t *field)
-{
- rtsp_version_e version = RTSP_VERSION_UNKNOWN;
- const char *pos;
- if(field->length <= RTSP_NAME_LENGTH || strncasecmp(field->buf,RTSP_NAME,RTSP_NAME_LENGTH) != 0) {
- /* unexpected protocol name */
- return version;
- }
-
- pos = field->buf + RTSP_NAME_LENGTH;
- if(*pos == RTSP_NAME_VERSION_SEPARATOR) {
- pos++;
- switch(*pos) {
- case '1': version = RTSP_VERSION_1; break;
- default: ;
- }
- }
- return version;
-}
-
-/** Generate RTSP version */
-static apt_bool_t rtsp_version_generate(rtsp_version_e version, apt_text_stream_t *stream)
-{
- if(stream->pos + RTSP_NAME_LENGTH + 1 >= stream->end) {
- return FALSE;
- }
- memcpy(stream->pos,RTSP_NAME,RTSP_NAME_LENGTH);
- stream->pos += RTSP_NAME_LENGTH;
- *stream->pos++ = RTSP_NAME_VERSION_SEPARATOR;
-
- if(apt_text_size_value_insert(stream,version) == FALSE) {
- return FALSE;
- }
-
- if(stream->pos + 2 >= stream->end) {
- return FALSE;
- }
- *stream->pos++ = RTSP_VERSION_MAJOR_MINOR_SEPARATOR;
- *stream->pos++ = '0';
- return TRUE;
-}
-
-/** Parse RTSP status-code */
-static APR_INLINE rtsp_status_code_e rtsp_status_code_parse(const apt_str_t *field)
-{
- return apt_size_value_parse(field);
-}
-
-/** Generate RTSP status-code */
-static APR_INLINE apt_bool_t rtsp_status_code_generate(rtsp_status_code_e status_code, apt_text_stream_t *stream)
-{
- return apt_text_size_value_insert(stream,status_code);
-}
-
-/** Generate RTSP request-line */
-static apt_bool_t rtsp_request_line_generate(rtsp_request_line_t *start_line, apt_text_stream_t *stream)
-{
- const apt_str_t *method_name = apt_string_table_str_get(rtsp_method_string_table,RTSP_METHOD_COUNT,start_line->method_id);
- if(!method_name) {
- return FALSE;
- }
- start_line->method_name = *method_name;
- if(apt_text_string_insert(stream,&start_line->method_name) == FALSE) {
- return FALSE;
- }
- if(apt_text_space_insert(stream) == FALSE) {
- return FALSE;
- }
-
- if(apt_text_string_insert(stream,&start_line->url) == FALSE) {
- return FALSE;
- }
- if(apt_text_space_insert(stream) == FALSE) {
- return FALSE;
- }
-
- return rtsp_version_generate(start_line->version,stream);
-}
-
-/** Generate RTSP status-line */
-static apt_bool_t rtsp_status_line_generate(rtsp_status_line_t *start_line, apt_text_stream_t *stream)
-{
- if(rtsp_version_generate(start_line->version,stream) == FALSE) {
- return FALSE;
- }
- if(apt_text_space_insert(stream) == FALSE) {
- return FALSE;
- }
-
- if(rtsp_status_code_generate(start_line->status_code,stream) == FALSE) {
- return FALSE;
- }
- if(apt_text_space_insert(stream) == FALSE) {
- return FALSE;
- }
-
- return apt_text_string_insert(stream,&start_line->reason);
-}
-
-/** Parse RTSP start-line */
-RTSP_DECLARE(apt_bool_t) rtsp_start_line_parse(rtsp_start_line_t *start_line, apt_str_t *str, apr_pool_t *pool)
-{
- apt_text_stream_t line;
- apt_str_t field;
-
- apt_text_stream_init(&line,str->buf,str->length);
- if(apt_text_field_read(&line,APT_TOKEN_SP,TRUE,&field) == FALSE) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot read the first field in start-line");
- return FALSE;
- }
-
- if(field.buf == strstr(field.buf,RTSP_NAME)) {
- /* parsing RTSP response */
- rtsp_status_line_t *status_line = &start_line->common.status_line;
- start_line->message_type = RTSP_MESSAGE_TYPE_RESPONSE;
- rtsp_status_line_init(status_line);
-
- status_line->version = rtsp_version_parse(&field);
-
- if(apt_text_field_read(&line,APT_TOKEN_SP,TRUE,&field) == FALSE) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot parse status-code in status-line");
- return FALSE;
- }
- status_line->status_code = rtsp_status_code_parse(&field);
-
- if(apt_text_field_read(&line,APT_TOKEN_SP,TRUE,&field) == FALSE) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot parse reason phrase in status-line");
- return FALSE;
- }
- apt_string_copy(&status_line->reason,&field,pool);
- }
- else {
- /* parsing RTSP request */
- rtsp_request_line_t *request_line = &start_line->common.request_line;
- start_line->message_type = RTSP_MESSAGE_TYPE_REQUEST;
- rtsp_request_line_init(request_line);
-
- apt_string_copy(&request_line->method_name,&field,pool);
- request_line->method_id = apt_string_table_id_find(rtsp_method_string_table,RTSP_METHOD_COUNT,&field);
-
- if(apt_text_field_read(&line,APT_TOKEN_SP,TRUE,&field) == FALSE) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot parse URL in request-line");
- return FALSE;
- }
- rtsp_resource_uri_parse(&field,request_line,pool);
-
- if(apt_text_field_read(&line,APT_TOKEN_SP,TRUE,&field) == FALSE) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot parse version in request-line");
- return FALSE;
- }
- request_line->version = rtsp_version_parse(&field);
- }
-
- return TRUE;
-}
-
-/** Generate RTSP start-line */
-RTSP_DECLARE(apt_bool_t) rtsp_start_line_generate(rtsp_start_line_t *start_line, apt_text_stream_t *stream)
-{
- apt_bool_t status = FALSE;
- switch(start_line->message_type) {
- case RTSP_MESSAGE_TYPE_REQUEST:
- status = rtsp_request_line_generate(&start_line->common.request_line,stream);
- break;
- case RTSP_MESSAGE_TYPE_RESPONSE:
- status = rtsp_status_line_generate(&start_line->common.status_line,stream);
- break;
- default:
- break;
- }
-
- if(status == FALSE) {
- return FALSE;
- }
-
- return apt_text_eol_insert(stream);
-}
-
-/** Get reason phrase by status code */
-RTSP_DECLARE(const apt_str_t*) rtsp_reason_phrase_get(rtsp_reason_phrase_e reason)
-{
- return apt_string_table_str_get(rtsp_reason_string_table,RTSP_REASON_PHRASE_COUNT,reason);
-}
diff --git a/libs/unimrcp/libs/uni-rtsp/src/rtsp_stream.c b/libs/unimrcp/libs/uni-rtsp/src/rtsp_stream.c
deleted file mode 100644
index 945e7a9874..0000000000
--- a/libs/unimrcp/libs/uni-rtsp/src/rtsp_stream.c
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: rtsp_stream.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include "rtsp_stream.h"
-#include "apt_log.h"
-
-/** RTSP parser */
-struct rtsp_parser_t {
- apt_message_parser_t *base;
-};
-
-/** RTSP generator */
-struct rtsp_generator_t {
- apt_message_generator_t *base;
-};
-
-/** Create message and read start line */
-static apt_bool_t rtsp_parser_on_start(apt_message_parser_t *parser, apt_message_context_t *context, apt_text_stream_t *stream, apr_pool_t *pool);
-/** Header section handler */
-static apt_bool_t rtsp_parser_on_header_complete(apt_message_parser_t *parser, apt_message_context_t *context);
-
-static const apt_message_parser_vtable_t parser_vtable = {
- rtsp_parser_on_start,
- rtsp_parser_on_header_complete,
- NULL
-};
-
-
-/** Initialize by generating message start line and return header section and body */
-apt_bool_t rtsp_generator_on_start(apt_message_generator_t *generator, apt_message_context_t *context, apt_text_stream_t *stream);
-
-static const apt_message_generator_vtable_t generator_vtable = {
- rtsp_generator_on_start,
- NULL,
- NULL
-};
-
-
-/** Create RTSP parser */
-RTSP_DECLARE(rtsp_parser_t*) rtsp_parser_create(apr_pool_t *pool)
-{
- rtsp_parser_t *parser = apr_palloc(pool,sizeof(rtsp_parser_t));
- parser->base = apt_message_parser_create(parser,&parser_vtable,pool);
- return parser;
-}
-
-/** Parse RTSP stream */
-RTSP_DECLARE(apt_message_status_e) rtsp_parser_run(rtsp_parser_t *parser, apt_text_stream_t *stream, rtsp_message_t **message)
-{
- return apt_message_parser_run(parser->base,stream,(void**)message);
-}
-
-/** Create message and read start line */
-static apt_bool_t rtsp_parser_on_start(apt_message_parser_t *parser, apt_message_context_t *context, apt_text_stream_t *stream, apr_pool_t *pool)
-{
- rtsp_message_t *message;
- apt_str_t start_line;
- /* read start line */
- if(apt_text_line_read(stream,&start_line) == FALSE) {
- return FALSE;
- }
-
- message = rtsp_message_create(RTSP_MESSAGE_TYPE_UNKNOWN,pool);
- if(rtsp_start_line_parse(&message->start_line,&start_line,message->pool) == FALSE) {
- return FALSE;
- }
-
- context->message = message;
- context->header = &message->header.header_section;
- context->body = &message->body;
- return TRUE;
-}
-
-/** Header section handler */
-static apt_bool_t rtsp_parser_on_header_complete(apt_message_parser_t *parser, apt_message_context_t *context)
-{
- rtsp_message_t *rtsp_message = context->message;
- rtsp_header_fields_parse(&rtsp_message->header,rtsp_message->pool);
-
- if(context->body && rtsp_header_property_check(&rtsp_message->header,RTSP_HEADER_FIELD_CONTENT_LENGTH) == TRUE) {
- context->body->length = rtsp_message->header.content_length;
- }
-
- return TRUE;
-}
-
-/** Create RTSP stream generator */
-RTSP_DECLARE(rtsp_generator_t*) rtsp_generator_create(apr_pool_t *pool)
-{
- rtsp_generator_t *generator = apr_palloc(pool,sizeof(rtsp_generator_t));
- generator->base = apt_message_generator_create(generator,&generator_vtable,pool);
- return generator;
-}
-
-
-/** Generate RTSP stream */
-RTSP_DECLARE(apt_message_status_e) rtsp_generator_run(rtsp_generator_t *generator, rtsp_message_t *message, apt_text_stream_t *stream)
-{
- return apt_message_generator_run(generator->base,message,stream);
-}
-
-/** Initialize by generating message start line and return header section and body */
-apt_bool_t rtsp_generator_on_start(apt_message_generator_t *generator, apt_message_context_t *context, apt_text_stream_t *stream)
-{
- rtsp_message_t *rtsp_message = context->message;
- context->header = &rtsp_message->header.header_section;
- context->body = &rtsp_message->body;
- return rtsp_start_line_generate(&rtsp_message->start_line,stream);
-}
diff --git a/libs/unimrcp/libs/uni-rtsp/unirtsp.2010.vcxproj.filters b/libs/unimrcp/libs/uni-rtsp/unirtsp.2010.vcxproj.filters
deleted file mode 100644
index 5a1581a2c3..0000000000
--- a/libs/unimrcp/libs/uni-rtsp/unirtsp.2010.vcxproj.filters
+++ /dev/null
@@ -1,56 +0,0 @@
-
-
-
-
- {93995380-89BD-4b04-88EB-625FBE52EBFB}
- h;hpp;hxx;hm;inl;inc;xsd
-
-
- {fd4564ef-9f34-4f23-992d-37f127e289a2}
- cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
-
-
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
-
\ No newline at end of file
diff --git a/libs/unimrcp/libs/uni-rtsp/unirtsp.2017.vcxproj b/libs/unimrcp/libs/uni-rtsp/unirtsp.2017.vcxproj
deleted file mode 100644
index 1b368a09e6..0000000000
--- a/libs/unimrcp/libs/uni-rtsp/unirtsp.2017.vcxproj
+++ /dev/null
@@ -1,141 +0,0 @@
-
-
-
-
- Debug
- Win32
-
-
- Debug
- x64
-
-
- Release
- Win32
-
-
- Release
- x64
-
-
-
- unirtsp
- {504B3154-7A4F-459D-9877-B951021C3F1F}
- unirtsp
- Win32Proj
-
-
-
- StaticLibrary
- Unicode
- true
- $(DefaultPlatformToolset)
-
-
- StaticLibrary
- Unicode
- $(DefaultPlatformToolset)
-
-
- StaticLibrary
- Unicode
- true
- $(DefaultPlatformToolset)
-
-
- StaticLibrary
- Unicode
- $(DefaultPlatformToolset)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <_ProjectFileVersion>10.0.30319.1
- $(PlatformName)\$(Configuration)\
- $(PlatformName)\$(Configuration)\
- $(SolutionDir)$(PlatformName)\$(Configuration)\
- $(PlatformName)\$(Configuration)\
- $(PlatformName)\$(Configuration)\
- $(PlatformName)\$(Configuration)\
- $(SolutionDir)$(PlatformName)\$(Configuration)\
- $(PlatformName)\$(Configuration)\
-
-
-
- codecs;%(AdditionalIncludeDirectories)
- APT_STATIC_LIB;%(PreprocessorDefinitions)
-
-
-
-
- X64
-
-
- codecs;%(AdditionalIncludeDirectories)
- APT_STATIC_LIB;%(PreprocessorDefinitions)
- ProgramDatabase
-
-
-
-
- codecs;%(AdditionalIncludeDirectories)
- APT_STATIC_LIB;%(PreprocessorDefinitions)
-
-
-
-
- X64
-
-
- codecs;%(AdditionalIncludeDirectories)
- APT_STATIC_LIB;%(PreprocessorDefinitions)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {f6c55d93-b927-4483-bb69-15aef3dd2dff}
-
-
-
-
-
-
\ No newline at end of file
diff --git a/libs/unimrcp/libs/uni-rtsp/unirtsp.vcproj b/libs/unimrcp/libs/uni-rtsp/unirtsp.vcproj
deleted file mode 100644
index c2e59e70fb..0000000000
--- a/libs/unimrcp/libs/uni-rtsp/unirtsp.vcproj
+++ /dev/null
@@ -1,304 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/libs/unimrcp/libs/uni-rtsp/unirtsp.vcxproj b/libs/unimrcp/libs/uni-rtsp/unirtsp.vcxproj
deleted file mode 100644
index 82cedac8fe..0000000000
--- a/libs/unimrcp/libs/uni-rtsp/unirtsp.vcxproj
+++ /dev/null
@@ -1,127 +0,0 @@
-
-
-
-
- Debug
- Win32
-
-
- Debug
- x64
-
-
- Release
- Win32
-
-
- Release
- x64
-
-
-
- {504B3154-7A4F-459D-9877-B951021C3F1F}
- unirtsp
- Win32Proj
-
-
-
- StaticLibrary
- Unicode
- true
-
-
- StaticLibrary
- Unicode
-
-
- StaticLibrary
- Unicode
- true
-
-
- StaticLibrary
- Unicode
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <_ProjectFileVersion>10.0.30319.1
- AllRules.ruleset
-
-
- AllRules.ruleset
-
-
- AllRules.ruleset
-
-
- AllRules.ruleset
-
-
-
-
-
- X64
-
-
- ProgramDatabase
-
-
-
-
- X64
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {13deeca0-bdd4-4744-a1a2-8eb0a44df3d2}
- false
-
-
-
-
-
-
\ No newline at end of file
diff --git a/libs/unimrcp/libs/uni-rtsp/unirtsp.vcxproj.filters b/libs/unimrcp/libs/uni-rtsp/unirtsp.vcxproj.filters
deleted file mode 100644
index 1a8db5806c..0000000000
--- a/libs/unimrcp/libs/uni-rtsp/unirtsp.vcxproj.filters
+++ /dev/null
@@ -1,56 +0,0 @@
-
-
-
-
- {93995380-89BD-4b04-88EB-625FBE52EBFB}
- h;hpp;hxx;hm;inl;inc;xsd
-
-
- {8ffd50c3-3b28-438d-a305-071644d5f115}
- cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
-
-
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
- include
-
-
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
-
\ No newline at end of file
diff --git a/libs/unimrcp/modules/Makefile.am b/libs/unimrcp/modules/Makefile.am
deleted file mode 100644
index 7c5ba9768e..0000000000
--- a/libs/unimrcp/modules/Makefile.am
+++ /dev/null
@@ -1,3 +0,0 @@
-MAINTAINERCLEANFILES = Makefile.in
-
-SUBDIRS = mrcp-sofiasip mrcp-unirtsp
diff --git a/libs/unimrcp/modules/mrcp-sofiasip/Makefile.am b/libs/unimrcp/modules/mrcp-sofiasip/Makefile.am
deleted file mode 100644
index f343037623..0000000000
--- a/libs/unimrcp/modules/mrcp-sofiasip/Makefile.am
+++ /dev/null
@@ -1,22 +0,0 @@
-MAINTAINERCLEANFILES = Makefile.in
-
-AM_CPPFLAGS = -I$(top_srcdir)/modules/mrcp-sofiasip/include \
- -I$(top_srcdir)/libs/mrcpv2-transport/include \
- -I$(top_srcdir)/libs/mrcp-signaling/include \
- -I$(top_srcdir)/libs/mrcp/include \
- -I$(top_srcdir)/libs/mrcp/message/include \
- -I$(top_srcdir)/libs/mrcp/control/include \
- -I$(top_srcdir)/libs/mrcp/resources/include \
- -I$(top_srcdir)/libs/mpf/include \
- -I$(top_srcdir)/libs/apr-toolkit/include \
- $(UNIMRCP_APR_INCLUDES) $(UNIMRCP_SOFIA_INCLUDES)
-
-noinst_LTLIBRARIES = libmrcpsofiasip.la
-
-include_HEADERS = include/mrcp_sdp.h \
- include/mrcp_sofiasip_server_agent.h \
- include/mrcp_sofiasip_client_agent.h
-libmrcpsofiasip_la_SOURCES = src/mrcp_sdp.c \
- src/mrcp_sofiasip_server_agent.c \
- src/mrcp_sofiasip_client_agent.c \
- src/mrcp_sofiasip_logger.c
diff --git a/libs/unimrcp/modules/mrcp-sofiasip/include/mrcp_sdp.h b/libs/unimrcp/modules/mrcp-sofiasip/include/mrcp_sdp.h
deleted file mode 100644
index 5c4b5c74ef..0000000000
--- a/libs/unimrcp/modules/mrcp-sofiasip/include/mrcp_sdp.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_sdp.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MRCP_SDP_H
-#define MRCP_SDP_H
-
-/**
- * @file mrcp_sdp.h
- * @brief MRCP SDP Transformations
- */
-
-#include "mrcp_sig_types.h"
-
-APT_BEGIN_EXTERN_C
-
-/** Generate SDP string by MRCP descriptor */
-MRCP_DECLARE(apr_size_t) sdp_string_generate_by_mrcp_descriptor(char *buffer, apr_size_t size, const mrcp_session_descriptor_t *descriptor, apt_bool_t offer);
-
-/** Generate MRCP descriptor by SDP session */
-MRCP_DECLARE(apt_bool_t) mrcp_descriptor_generate_by_sdp_session(mrcp_session_descriptor_t* descriptor, const sdp_session_t *sdp, const char *force_destination_ip, apr_pool_t *pool);
-
-/** Generate SDP resource discovery string */
-MRCP_DECLARE(apr_size_t) sdp_resource_discovery_string_generate(const char *ip, const char *origin, char *buffer, apr_size_t size);
-
-APT_END_EXTERN_C
-
-#endif /* MRCP_SDP_H */
diff --git a/libs/unimrcp/modules/mrcp-sofiasip/include/mrcp_sofiasip_client_agent.h b/libs/unimrcp/modules/mrcp-sofiasip/include/mrcp_sofiasip_client_agent.h
deleted file mode 100644
index 4dd605a8cd..0000000000
--- a/libs/unimrcp/modules/mrcp-sofiasip/include/mrcp_sofiasip_client_agent.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_sofiasip_client_agent.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MRCP_SOFIASIP_CLIENT_AGENT_H
-#define MRCP_SOFIASIP_CLIENT_AGENT_H
-
-/**
- * @file mrcp_sofiasip_client_agent.h
- * @brief Implementation of MRCP Signaling Interface using Sofia-SIP
- */
-
-#include
-#include "mrcp_sig_agent.h"
-
-APT_BEGIN_EXTERN_C
-
-/** Sofia-SIP config declaration */
-typedef struct mrcp_sofia_client_config_t mrcp_sofia_client_config_t;
-
-/** Sofia-SIP config */
-struct mrcp_sofia_client_config_t {
- /** Local IP address */
- char *local_ip;
- /** External (NAT) IP address */
- char *ext_ip;
- /** Local SIP port */
- apr_port_t local_port;
- /** Local SIP user name */
- char *local_user_name;
- /** User agent name */
- char *user_agent_name;
- /** SDP origin */
- char *origin;
- /** SIP transport */
- char *transport;
- /** SIP T1 timer */
- apr_size_t sip_t1;
- /** SIP T2 timer */
- apr_size_t sip_t2;
- /** SIP T4 timer */
- apr_size_t sip_t4;
- /** SIP T1x64 timer */
- apr_size_t sip_t1x64;
- /** Print out SIP messages to the console */
- apt_bool_t tport_log;
- /** Dump SIP messages to the specified file */
- char *tport_dump_file;
-};
-
-/**
- * Create Sofia-SIP signaling agent.
- */
-MRCP_DECLARE(mrcp_sig_agent_t*) mrcp_sofiasip_client_agent_create(const char *id, mrcp_sofia_client_config_t *config, apr_pool_t *pool);
-
-/**
- * Allocate Sofia-SIP config.
- */
-MRCP_DECLARE(mrcp_sofia_client_config_t*) mrcp_sofiasip_client_config_alloc(apr_pool_t *pool);
-
-/**
- * Initialize Sofia-SIP logger.
- */
-MRCP_DECLARE(apt_bool_t) mrcp_sofiasip_client_logger_init(const char *name, const char *level_str, apt_bool_t redirect);
-
-APT_END_EXTERN_C
-
-#endif /* MRCP_SOFIASIP_CLIENT_AGENT_H */
diff --git a/libs/unimrcp/modules/mrcp-sofiasip/include/mrcp_sofiasip_server_agent.h b/libs/unimrcp/modules/mrcp-sofiasip/include/mrcp_sofiasip_server_agent.h
deleted file mode 100644
index 4cc78c6fbf..0000000000
--- a/libs/unimrcp/modules/mrcp-sofiasip/include/mrcp_sofiasip_server_agent.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_sofiasip_server_agent.h 2252 2014-11-21 02:45:15Z achaloyan@gmail.com $
- */
-
-#ifndef MRCP_SOFIASIP_SERVER_AGENT_H
-#define MRCP_SOFIASIP_SERVER_AGENT_H
-
-/**
- * @file mrcp_sofiasip_server_agent.h
- * @brief Implementation of MRCP Signaling Interface using Sofia-SIP
- */
-
-#include
-#include "mrcp_sig_agent.h"
-
-APT_BEGIN_EXTERN_C
-
-/** Sofia-SIP config declaration */
-typedef struct mrcp_sofia_server_config_t mrcp_sofia_server_config_t;
-
-/** Sofia-SIP config */
-struct mrcp_sofia_server_config_t {
- /** Local IP address to bind to */
- char *local_ip;
- /** External (NAT) IP address */
- char *ext_ip;
- /** Local port to bind to */
- apr_port_t local_port;
- /** SIP user name */
- char *user_name;
- /** User agent name */
- char *user_agent_name;
- /** SDP origin */
- char *origin;
- /** SIP transport */
- char *transport;
- /** Force destination IP address. Should be used only in case
- SDP contains incorrect connection address (local IP address behind NAT) */
- apt_bool_t force_destination;
- /** SIP T1 timer */
- apr_size_t sip_t1;
- /** SIP T2 timer */
- apr_size_t sip_t2;
- /** SIP T4 timer */
- apr_size_t sip_t4;
- /** SIP T1x64 timer */
- apr_size_t sip_t1x64;
- /** Print out SIP messages to the console */
- apt_bool_t tport_log;
- /** Dump SIP messages to the specified file */
- char *tport_dump_file;
-};
-
-/**
- * Create Sofia-SIP signaling agent.
- */
-MRCP_DECLARE(mrcp_sig_agent_t*) mrcp_sofiasip_server_agent_create(const char *id, mrcp_sofia_server_config_t *config, apr_pool_t *pool);
-
-/**
- * Allocate Sofia-SIP config.
- */
-MRCP_DECLARE(mrcp_sofia_server_config_t*) mrcp_sofiasip_server_config_alloc(apr_pool_t *pool);
-
-/**
- * Initialize Sofia-SIP logger.
- */
-MRCP_DECLARE(apt_bool_t) mrcp_sofiasip_server_logger_init(const char *name, const char *level_str, apt_bool_t redirect);
-
-APT_END_EXTERN_C
-
-#endif /* MRCP_SOFIASIP_SERVER_AGENT_H */
diff --git a/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2010.vcxproj.filters b/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2010.vcxproj.filters
deleted file mode 100644
index 33ff479678..0000000000
--- a/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2010.vcxproj.filters
+++ /dev/null
@@ -1,38 +0,0 @@
-
-
-
-
- {93995380-89BD-4b04-88EB-625FBE52EBFB}
- h;hpp;hxx;hm;inl;inc;xsd
-
-
- {6e92b598-880e-4fe5-88fb-f69df8e06a57}
- cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
-
-
-
-
- include
-
-
- include
-
-
- include
-
-
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
-
\ No newline at end of file
diff --git a/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2017.vcxproj b/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2017.vcxproj
deleted file mode 100644
index c8d8f65306..0000000000
--- a/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2017.vcxproj
+++ /dev/null
@@ -1,143 +0,0 @@
-
-
-
-
- Debug
- Win32
-
-
- Debug
- x64
-
-
- Release
- Win32
-
-
- Release
- x64
-
-
-
- mrcpsofiasip
- {746F3632-5BB2-4570-9453-31D6D58A7D8E}
- mrcpsofiasip
- Win32Proj
-
-
-
- StaticLibrary
- Unicode
- true
- $(DefaultPlatformToolset)
-
-
- StaticLibrary
- Unicode
- $(DefaultPlatformToolset)
-
-
- StaticLibrary
- Unicode
- true
- $(DefaultPlatformToolset)
-
-
- StaticLibrary
- Unicode
- $(DefaultPlatformToolset)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <_ProjectFileVersion>10.0.30319.1
- $(PlatformName)\$(Configuration)\
- $(PlatformName)\$(Configuration)\
- $(SolutionDir)$(PlatformName)\$(Configuration)\
- $(PlatformName)\$(Configuration)\
- $(PlatformName)\$(Configuration)\
- $(PlatformName)\$(Configuration)\
- $(SolutionDir)$(PlatformName)\$(Configuration)\
- $(PlatformName)\$(Configuration)\
-
-
-
- include;%(AdditionalIncludeDirectories)
- APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;LIBSOFIA_SIP_UA_STATIC;%(PreprocessorDefinitions)
-
-
-
-
- X64
-
-
- include;%(AdditionalIncludeDirectories)
- APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;LIBSOFIA_SIP_UA_STATIC;%(PreprocessorDefinitions)
- ProgramDatabase
-
-
-
-
- include;%(AdditionalIncludeDirectories)
- APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;LIBSOFIA_SIP_UA_STATIC;%(PreprocessorDefinitions)
-
-
-
-
- X64
-
-
- include;%(AdditionalIncludeDirectories)
- APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;LIBSOFIA_SIP_UA_STATIC;%(PreprocessorDefinitions)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {70a49bc2-7500-41d0-b75d-edcc5be987a0}
-
-
-
-
-
-
\ No newline at end of file
diff --git a/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.vcproj b/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.vcproj
deleted file mode 100644
index 20f9ce8e3a..0000000000
--- a/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.vcproj
+++ /dev/null
@@ -1,288 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.vcxproj b/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.vcxproj
deleted file mode 100644
index cd2e9a2251..0000000000
--- a/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.vcxproj
+++ /dev/null
@@ -1,147 +0,0 @@
-
-
-
-
- Debug
- Win32
-
-
- Debug
- x64
-
-
- Release
- Win32
-
-
- Release
- x64
-
-
-
- {746F3632-5BB2-4570-9453-31D6D58A7D8E}
- mrcpsofiasip
- Win32Proj
-
-
-
- StaticLibrary
- Unicode
- true
-
-
- StaticLibrary
- Unicode
-
-
- StaticLibrary
- Unicode
- true
-
-
- StaticLibrary
- Unicode
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <_ProjectFileVersion>10.0.30319.1
- AllRules.ruleset
-
-
- AllRules.ruleset
-
-
- AllRules.ruleset
-
-
- AllRules.ruleset
-
-
-
-
-
- include;%(AdditionalIncludeDirectories)
-
-
-
-
- include;%(AdditionalIncludeDirectories)
-
-
-
-
- X64
-
-
- include;%(AdditionalIncludeDirectories)
- ProgramDatabase
-
-
-
-
- X64
-
-
- include;%(AdditionalIncludeDirectories)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {12a49562-bab9-43a3-a21d-15b60bbb4c31}
- false
-
-
- {a9edac04-6a5f-4ba7-bc0d-cce7b255b6ea}
- false
-
-
-
-
-
-
\ No newline at end of file
diff --git a/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.vcxproj.filters b/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.vcxproj.filters
deleted file mode 100644
index d0579e36d8..0000000000
--- a/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.vcxproj.filters
+++ /dev/null
@@ -1,38 +0,0 @@
-
-
-
-
- {93995380-89BD-4b04-88EB-625FBE52EBFB}
- h;hpp;hxx;hm;inl;inc;xsd
-
-
- {5256b9c6-18be-48fc-aaa3-8e2c17df7f8d}
- cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
-
-
-
-
- include
-
-
- include
-
-
- include
-
-
-
-
- src
-
-
- src
-
-
- src
-
-
- src
-
-
-
\ No newline at end of file
diff --git a/libs/unimrcp/modules/mrcp-sofiasip/src/mrcp_sdp.c b/libs/unimrcp/modules/mrcp-sofiasip/src/mrcp_sdp.c
deleted file mode 100644
index 16fcfee97d..0000000000
--- a/libs/unimrcp/modules/mrcp-sofiasip/src/mrcp_sdp.c
+++ /dev/null
@@ -1,421 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_sdp.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include
-#include
-#include
-#include "mrcp_sdp.h"
-#include "mrcp_session_descriptor.h"
-#include "mrcp_control_descriptor.h"
-#include "mpf_rtp_attribs.h"
-#include "mpf_rtp_pt.h"
-#include "apt_text_stream.h"
-#include "apt_log.h"
-
-#if _MSC_VER >= 1900
-#pragma warning(disable: 4477)
-// 'snprintf' : format string '%d' requires an argument of type 'int', but variadic argument 1 has type 'apr_size_t' 264
-// 'snprintf' : format string '%d' requires an argument of type 'int', but variadic argument 1 has type 'const apr_size_t' 198
-#endif
-
-static apr_size_t sdp_rtp_media_generate(char *buffer, apr_size_t size, const mrcp_session_descriptor_t *descriptor, const mpf_rtp_media_descriptor_t *audio_descriptor);
-static apr_size_t sdp_control_media_generate(char *buffer, apr_size_t size, const mrcp_session_descriptor_t *descriptor, const mrcp_control_descriptor_t *control_media, apt_bool_t offer);
-
-static apt_bool_t mpf_rtp_media_generate(mpf_rtp_media_descriptor_t *rtp_media, const sdp_media_t *sdp_media, const apt_str_t *ip, apr_pool_t *pool);
-static apt_bool_t mrcp_control_media_generate(mrcp_control_descriptor_t *mrcp_media, const sdp_media_t *sdp_media, const apt_str_t *ip, apr_pool_t *pool);
-
-/** Generate SDP string by MRCP descriptor */
-MRCP_DECLARE(apr_size_t) sdp_string_generate_by_mrcp_descriptor(char *buffer, apr_size_t size, const mrcp_session_descriptor_t *descriptor, apt_bool_t offer)
-{
- apr_size_t i;
- apr_size_t count;
- apr_size_t audio_index = 0;
- mpf_rtp_media_descriptor_t *audio_media;
- apr_size_t video_index = 0;
- mpf_rtp_media_descriptor_t *video_media;
- apr_size_t control_index = 0;
- mrcp_control_descriptor_t *control_media;
- apr_size_t offset = 0;
- const char *ip = descriptor->ext_ip.buf ? descriptor->ext_ip.buf : (descriptor->ip.buf ? descriptor->ip.buf : "0.0.0.0");
- buffer[0] = '\0';
- offset += snprintf(buffer+offset,size-offset,
- "v=0\r\n"
- "o=%s 0 0 IN IP4 %s\r\n"
- "s=-\r\n"
- "c=IN IP4 %s\r\n"
- "t=0 0\r\n",
- descriptor->origin.buf ? descriptor->origin.buf : "-",
- ip,
- ip);
- count = mrcp_session_media_count_get(descriptor);
- for(i=0; iid == i) {
- /* generate audio media */
- audio_index++;
- offset += sdp_rtp_media_generate(buffer+offset,size-offset,descriptor,audio_media);
- continue;
- }
- video_media = mrcp_session_video_media_get(descriptor,video_index);
- if(video_media && video_media->id == i) {
- /* generate video media */
- video_index++;
- offset += sdp_rtp_media_generate(buffer+offset,size-offset,descriptor,video_media);
- continue;
- }
- control_media = mrcp_session_control_media_get(descriptor,control_index);
- if(control_media && control_media->id == i) {
- /** generate mrcp control media */
- control_index++;
- offset += sdp_control_media_generate(buffer+offset,size-offset,descriptor,control_media,offer);
- continue;
- }
- }
- return offset;
-}
-
-/** Generate MRCP descriptor by SDP session */
-MRCP_DECLARE(apt_bool_t) mrcp_descriptor_generate_by_sdp_session(mrcp_session_descriptor_t* descriptor, const sdp_session_t *sdp, const char *force_destination_ip, apr_pool_t *pool)
-{
- sdp_media_t *sdp_media;
-
- if(!sdp) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Invalid SDP Message");
- return FALSE;
- }
-
- if(force_destination_ip) {
- apt_string_assign(&descriptor->ip,force_destination_ip,pool);
- }
- else if(sdp->sdp_connection) {
- apt_string_assign(&descriptor->ip,sdp->sdp_connection->c_address,pool);
- }
-
- for(sdp_media=sdp->sdp_media; sdp_media; sdp_media=sdp_media->m_next) {
- switch(sdp_media->m_type) {
- case sdp_media_audio:
- {
- mpf_rtp_media_descriptor_t *media = apr_palloc(pool,sizeof(mpf_rtp_media_descriptor_t));
- mpf_rtp_media_descriptor_init(media);
- media->id = mrcp_session_audio_media_add(descriptor,media);
- mpf_rtp_media_generate(media,sdp_media,&descriptor->ip,pool);
- break;
- }
- case sdp_media_video:
- {
- mpf_rtp_media_descriptor_t *media = apr_palloc(pool,sizeof(mpf_rtp_media_descriptor_t));
- mpf_rtp_media_descriptor_init(media);
- media->id = mrcp_session_video_media_add(descriptor,media);
- mpf_rtp_media_generate(media,sdp_media,&descriptor->ip,pool);
- break;
- }
- case sdp_media_application:
- {
- mrcp_control_descriptor_t *control_media = mrcp_control_descriptor_create(pool);
- control_media->id = mrcp_session_control_media_add(descriptor,control_media);
- mrcp_control_media_generate(control_media,sdp_media,&descriptor->ip,pool);
- break;
- }
- default:
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Not Supported SDP Media [%s]", sdp_media->m_type_name);
- break;
- }
- }
- return TRUE;
-}
-
-/** Generate SDP media by RTP media descriptor */
-static apr_size_t sdp_rtp_media_generate(char *buffer, apr_size_t size, const mrcp_session_descriptor_t *descriptor, const mpf_rtp_media_descriptor_t *audio_media)
-{
- apr_size_t offset = 0;
- if(audio_media->state == MPF_MEDIA_ENABLED) {
- int codec_count = 0;
- int i;
- mpf_codec_descriptor_t *codec_descriptor;
- apr_array_header_t *descriptor_arr = audio_media->codec_list.descriptor_arr;
- const apt_str_t *direction_str;
- if(!descriptor_arr) {
- return 0;
- }
-
- offset += snprintf(buffer+offset,size-offset,"m=audio %d RTP/AVP",audio_media->port);
- for(i=0; inelts; i++) {
- codec_descriptor = &APR_ARRAY_IDX(descriptor_arr,i,mpf_codec_descriptor_t);
- if(codec_descriptor->enabled == TRUE) {
- offset += snprintf(buffer+offset,size-offset," %d",codec_descriptor->payload_type);
- codec_count++;
- }
- }
- if(!codec_count){
- /* SDP m line should have at least one media format listed; use a reserved RTP payload type */
- offset += snprintf(buffer+offset,size-offset," %d",RTP_PT_RESERVED);
- }
- offset += snprintf(buffer+offset,size-offset,"\r\n");
-
- if(descriptor->ip.length && audio_media->ip.length &&
- apt_string_compare(&descriptor->ip,&audio_media->ip) != TRUE) {
- const char *media_ip = audio_media->ext_ip.buf ? audio_media->ext_ip.buf : audio_media->ip.buf;
- offset += snprintf(buffer+offset,size-offset,"c=IN IP4 %s\r\n",media_ip);
- }
-
- for(i=0; inelts; i++) {
- codec_descriptor = &APR_ARRAY_IDX(descriptor_arr,i,mpf_codec_descriptor_t);
- if(codec_descriptor->enabled == TRUE && codec_descriptor->name.buf) {
- offset += snprintf(buffer+offset,size-offset,"a=rtpmap:%d %s/%d\r\n",
- codec_descriptor->payload_type,
- codec_descriptor->name.buf,
- codec_descriptor->sampling_rate);
- if(codec_descriptor->format.buf) {
- offset += snprintf(buffer+offset,size-offset,"a=fmtp:%d %s\r\n",
- codec_descriptor->payload_type,
- codec_descriptor->format.buf);
- }
- }
- }
-
- direction_str = mpf_rtp_direction_str_get(audio_media->direction);
- if(direction_str) {
- offset += snprintf(buffer+offset,size-offset,"a=%s\r\n",direction_str->buf);
- }
-
- if(audio_media->ptime) {
- offset += snprintf(buffer+offset,size-offset,"a=ptime:%hu\r\n",audio_media->ptime);
- }
- }
- else {
- offset += snprintf(buffer+offset,size-offset,"m=audio 0 RTP/AVP %d\r\n",RTP_PT_RESERVED);
- }
-
- offset += snprintf(buffer+offset,size-offset,"a=mid:%"APR_SIZE_T_FMT"\r\n",audio_media->mid);
- return offset;
-}
-
-/** Generate SDP media by MRCP control media descriptor */
-static apr_size_t sdp_control_media_generate(char *buffer, apr_size_t size, const mrcp_session_descriptor_t *descriptor, const mrcp_control_descriptor_t *control_media, apt_bool_t offer)
-{
- int i;
- apr_size_t offset = 0;
- const apt_str_t *proto;
- const apt_str_t *setup_type;
- const apt_str_t *connection_type;
- proto = mrcp_proto_get(control_media->proto);
- setup_type = mrcp_setup_type_get(control_media->setup_type);
- connection_type = mrcp_connection_type_get(control_media->connection_type);
- if(offer == TRUE) { /* offer */
- if(control_media->port) {
- offset += snprintf(buffer+offset,size-offset,
- "m=application %d %s 1\r\n"
- "a=setup:%s\r\n"
- "a=connection:%s\r\n"
- "a=resource:%s\r\n",
- control_media->port,
- proto ? proto->buf : "",
- setup_type ? setup_type->buf : "",
- connection_type ? connection_type->buf : "",
- control_media->resource_name.buf);
-
- }
- else {
- offset += snprintf(buffer+offset,size-offset,
- "m=application %d %s 1\r\n"
- "a=resource:%s\r\n",
- control_media->port,
- proto ? proto->buf : "",
- control_media->resource_name.buf);
- }
- }
- else { /* answer */
- if(control_media->port) {
- offset += snprintf(buffer+offset,size-offset,
- "m=application %d %s 1\r\n"
- "a=setup:%s\r\n"
- "a=connection:%s\r\n"
- "a=channel:%s@%s\r\n",
- control_media->port,
- proto ? proto->buf : "",
- setup_type ? setup_type->buf : "",
- connection_type ? connection_type->buf : "",
- control_media->session_id.buf,
- control_media->resource_name.buf);
- }
- else {
- offset += snprintf(buffer+offset,size-offset,
- "m=application %d %s 1\r\n"
- "a=channel:%s@%s\r\n",
- control_media->port,
- proto ? proto->buf : "",
- control_media->session_id.buf,
- control_media->resource_name.buf);
- }
- }
-
- for(i=0; icmid_arr->nelts; i++) {
- offset += snprintf(buffer+offset,size-offset,
- "a=cmid:%"APR_SIZE_T_FMT"\r\n",
- APR_ARRAY_IDX(control_media->cmid_arr,i,apr_size_t));
- }
-
- return offset;
-}
-
-/** Generate RTP media descriptor by SDP media */
-static apt_bool_t mpf_rtp_media_generate(mpf_rtp_media_descriptor_t *rtp_media, const sdp_media_t *sdp_media, const apt_str_t *ip, apr_pool_t *pool)
-{
- mpf_rtp_attrib_e id;
- apt_str_t name;
- sdp_attribute_t *attrib = NULL;
- sdp_rtpmap_t *map;
- mpf_codec_descriptor_t *codec;
- for(attrib = sdp_media->m_attributes; attrib; attrib=attrib->a_next) {
- apt_string_set(&name,attrib->a_name);
- id = mpf_rtp_attrib_id_find(&name);
- switch(id) {
- case RTP_ATTRIB_MID:
- rtp_media->mid = atoi(attrib->a_value);
- break;
- case RTP_ATTRIB_PTIME:
- rtp_media->ptime = (apr_uint16_t)atoi(attrib->a_value);
- break;
- default:
- break;
- }
- }
-
- mpf_codec_list_init(&rtp_media->codec_list,5,pool);
- for(map = sdp_media->m_rtpmaps; map; map = map->rm_next) {
- codec = mpf_codec_list_add(&rtp_media->codec_list);
- if(codec) {
- codec->payload_type = (apr_byte_t)map->rm_pt;
- apt_string_assign(&codec->name,map->rm_encoding,pool);
- codec->sampling_rate = (apr_uint16_t)map->rm_rate;
- codec->channel_count = 1;
- }
- }
-
- switch(sdp_media->m_mode) {
- case sdp_inactive:
- rtp_media->direction = STREAM_DIRECTION_NONE;
- break;
- case sdp_sendonly:
- rtp_media->direction = STREAM_DIRECTION_SEND;
- break;
- case sdp_recvonly:
- rtp_media->direction = STREAM_DIRECTION_RECEIVE;
- break;
- case sdp_sendrecv:
- rtp_media->direction = STREAM_DIRECTION_DUPLEX;
- break;
- }
-
- if(sdp_media->m_connections) {
- apt_string_assign(&rtp_media->ip,sdp_media->m_connections->c_address,pool);
- }
- else {
- rtp_media->ip = *ip;
- }
- if(sdp_media->m_port) {
- rtp_media->port = (apr_port_t)sdp_media->m_port;
- rtp_media->state = MPF_MEDIA_ENABLED;
- }
- else {
- rtp_media->state = MPF_MEDIA_DISABLED;
- }
- return TRUE;
-}
-
-/** Generate MRCP control media by SDP media */
-static apt_bool_t mrcp_control_media_generate(mrcp_control_descriptor_t *control_media, const sdp_media_t *sdp_media, const apt_str_t *ip, apr_pool_t *pool)
-{
- mrcp_attrib_e id;
- apt_str_t name;
- apt_str_t value;
- sdp_attribute_t *attrib = NULL;
- apt_string_set(&name,sdp_media->m_proto_name);
- control_media->proto = mrcp_proto_find(&name);
- if(control_media->proto != MRCP_PROTO_TCP) {
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Not supported SDP Proto [%s], expected [%s]",sdp_media->m_proto_name,mrcp_proto_get(MRCP_PROTO_TCP)->buf);
- return FALSE;
- }
-
- for(attrib = sdp_media->m_attributes; attrib; attrib=attrib->a_next) {
- apt_string_set(&name,attrib->a_name);
- id = mrcp_attrib_id_find(&name);
- switch(id) {
- case MRCP_ATTRIB_SETUP:
- apt_string_set(&value,attrib->a_value);
- control_media->setup_type = mrcp_setup_type_find(&value);
- break;
- case MRCP_ATTRIB_CONNECTION:
- apt_string_set(&value,attrib->a_value);
- control_media->connection_type = mrcp_connection_type_find(&value);
- break;
- case MRCP_ATTRIB_RESOURCE:
- apt_string_assign(&control_media->resource_name,attrib->a_value,pool);
- break;
- case MRCP_ATTRIB_CHANNEL:
- apt_string_set(&value,attrib->a_value);
- apt_id_resource_parse(&value,'@',&control_media->session_id,&control_media->resource_name,pool);
- break;
- case MRCP_ATTRIB_CMID:
- mrcp_cmid_add(control_media->cmid_arr,atoi(attrib->a_value));
- break;
- default:
- break;
- }
- }
-
- if(sdp_media->m_connections) {
- apt_string_assign(&control_media->ip,sdp_media->m_connections->c_address,pool);
- }
- else {
- control_media->ip = *ip;
- }
- control_media->port = (apr_port_t)sdp_media->m_port;
- return TRUE;
-}
-
-/** Generate SDP resource discovery string */
-MRCP_DECLARE(apr_size_t) sdp_resource_discovery_string_generate(const char *ip, const char *origin, char *buffer, apr_size_t size)
-{
- apr_size_t offset = 0;
- if(!ip) {
- ip = "0.0.0.0";
- }
- if(!origin) {
- origin = "-";
- }
- buffer[0] = '\0';
- offset += snprintf(buffer+offset,size-offset,
- "v=0\r\n"
- "o=%s 0 0 IN IP4 %s\r\n"
- "s=-\r\n"
- "c=IN IP4 %s\r\n"
- "t=0 0\r\n"
- "m=application 0 TCP/MRCPv2 1\r\n"
- "a=resource:speechsynth\r\n"
- "a=resource:speechrecog\r\n"
- "m=audio 0 RTP/AVP 0 8 96 101\r\n"
- "a=rtpmap:0 PCMU/8000\r\n"
- "a=rtpmap:8 PCMA/8000\r\n"
- "a=rtpmap:96 L16/8000\r\n"
- "a=rtpmap:101 telephone-event/8000\r\n",
- origin,
- ip,
- ip);
- return offset;
-}
diff --git a/libs/unimrcp/modules/mrcp-sofiasip/src/mrcp_sofiasip_client_agent.c b/libs/unimrcp/modules/mrcp-sofiasip/src/mrcp_sofiasip_client_agent.c
deleted file mode 100644
index fded058da1..0000000000
--- a/libs/unimrcp/modules/mrcp-sofiasip/src/mrcp_sofiasip_client_agent.c
+++ /dev/null
@@ -1,637 +0,0 @@
-/*
- * Copyright 2008-2014 Arsen Chaloyan
- *
- * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id: mrcp_sofiasip_client_agent.c 2253 2014-11-21 02:57:19Z achaloyan@gmail.com $
- */
-
-typedef struct mrcp_sofia_agent_t mrcp_sofia_agent_t;
-#define NUA_MAGIC_T mrcp_sofia_agent_t
-
-typedef struct mrcp_sofia_session_t mrcp_sofia_session_t;
-#define NUA_HMAGIC_T mrcp_sofia_session_t
-
-#include
-#include