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
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
+++ /dev/null
-#!/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
#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
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
</input>
]]>
</alias>
- <alias name="input_voice_yesno_unimrcp" target="call">
- <![CDATA[
- <input xmlns="urn:xmpp:rayo:input:1" mode="voice" recognizer="unimrcp">
- <grammar content-type="application/srgs+xml>
- <![CDATA[
- <grammar xmlns="http://www.w3.org/2001/06/grammar"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.w3.org/2001/06/grammar http://www.w3.org/TR/speech-grammar/grammar.xsd"
- xml:lang="en-US" version="1.0">
- <rule id="yesno"><one-of><item>yes</item><item>no</item></one-of></rule></grammar>
- ]]]]><![CDATA[>
- </grammar>
- </input>
- ]]>
- </alias>
- <alias name="input_voice_yesno_unimrcp_timeout" target="call">
- <![CDATA[
- <input xmlns="urn:xmpp:rayo:input:1" mode="voice" recognizer="unimrcp" max-silence="5000" initial-timeout="5000">
- <grammar content-type="application/srgs+xml>
- <![CDATA[
- <grammar xmlns="http://www.w3.org/2001/06/grammar"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.w3.org/2001/06/grammar http://www.w3.org/TR/speech-grammar/grammar.xsd"
- xml:lang="en-US" version="1.0">
- <rule id="yesno"><one-of><item>yes</item><item>no</item></one-of></rule></grammar>
- ]]]]><![CDATA[>
- </grammar>
- </input>
- ]]>
- </alias>
<alias name="input_voice_yesno_pocketsphinx" target="call">
<![CDATA[
+++ /dev/null
-<configuration name="unimrcp.conf" description="UniMRCP Client">
- <settings>
- <!-- UniMRCP profile to use for TTS -->
- <param name="default-tts-profile" value="voxeo-prophecy8.0-mrcp1"/>
- <!-- UniMRCP profile to use for ASR -->
- <param name="default-asr-profile" value="voxeo-prophecy8.0-mrcp1"/>
- <!-- UniMRCP logging level to appear in freeswitch.log. Options are:
- EMERGENCY|ALERT|CRITICAL|ERROR|WARNING|NOTICE|INFO|DEBUG -->
- <param name="log-level" value="DEBUG"/>
- <!-- Enable events for profile creation, open, and close -->
- <param name="enable-profile-events" value="false"/>
-
- <param name="max-connection-count" value="100"/>
- <param name="offer-new-connection" value="1"/>
- <param name="request-timeout" value="3000"/>
- </settings>
-
- <profiles>
- <X-PRE-PROCESS cmd="include" data="../mrcp_profiles/*.xml"/>
- </profiles>
-
-</configuration>
-
+++ /dev/null
-<include>
- <!-- Loquendo MRCP Server 7 MRCPv2 -->
- <profile name="loquendo7-mrcp2" version="2">
- <!--param name="client-ext-ip" value="auto"-->
- <param name="client-ip" value="auto"/>
- <param name="client-port" value="5090"/>
- <param name="server-ip" value="10.5.5.152"/>
- <param name="server-port" value="5060"/>
- <!--param name="force-destination" value="1"/-->
- <param name="sip-transport" value="udp"/>
- <!--param name="ua-name" value="FreeSWITCH"/-->
- <!--param name="sdp-origin" value="FreeSWITCH"/-->
- <!--param name="rtp-ext-ip" value="auto"/-->
- <param name="rtp-ip" value="auto"/>
- <param name="rtp-port-min" value="4000"/>
- <param name="rtp-port-max" value="5000"/>
- <!--param name="playout-delay" value="50"/-->
- <!--param name="max-playout-delay" value="200"/-->
- <!--param name="ptime" value="20"/-->
- <param name="codecs" value="PCMU PCMA L16/96/8000"/>
- <param name="jsgf-mime-type" value="application/jsgf"/>
-
- <!-- Add any default MRCP params for SPEAK requests here -->
- <synthparams>
- </synthparams>
-
- <!-- Add any default MRCP params for RECOGNIZE requests here -->
- <recogparams>
- <!--param name="start-input-timers" value="false"/-->
- </recogparams>
- </profile>
-</include>
+++ /dev/null
-<include>
- <!-- Nuance MRCP 1.0.0 Server -->
- <profile name="nuance-mrcp1" version="1">
- <param name="server-ip" value="10.5.5.152"/>
- <param name="server-port" value="554"/>
- <param name="resource-location" value=""/>
- <param name="speechsynth" value="synthesizer"/>
- <param name="speechrecog" value="recognizer"/>
- <!--param name="rtp-ext-ip" value="auto"/-->
- <param name="rtp-ip" value="auto"/>
- <param name="rtp-port-min" value="4000"/>
- <param name="rtp-port-max" value="5000"/>
- <!-- enable/disable rtcp support -->
- <param name="rtcp" value="1"/>
- <!-- rtcp bye policies (rtcp must be enabled first)
- 0 - disable rtcp bye
- 1 - send rtcp bye at the end of session
- 2 - send rtcp bye also at the end of each talkspurt (input)
- -->
- <param name="rtcp-bye" value="2"/>
- <!-- rtcp transmission interval in msec (set 0 to disable) -->
- <param name="rtcp-tx-interval" value="5000"/>
- <!-- period (timeout) to check for new rtcp messages in msec (set 0 to disable) -->
- <param name="rtcp-rx-resolution" value="1000"/>
- <!--param name="playout-delay" value="50"/-->
- <!--param name="max-playout-delay" value="200"/-->
- <!--param name="ptime" value="20"/-->
- <param name="codecs" value="PCMU PCMA L16/96/8000"/>
-
- <!-- Add any default MRCP params for SPEAK requests here -->
- <synthparams>
- </synthparams>
-
- <!-- Add any default MRCP params for RECOGNIZE requests here -->
- <recogparams>
- <!--param name="start-input-timers" value="false"/-->
- </recogparams>
- </profile>
-</include>
+++ /dev/null
-<include>
- <!-- Nuance Speech Server 5.0 MRCPv1 -->
- <profile name="nuance5-mrcp1" version="1">
- <param name="server-ip" value="10.5.5.152"/>
- <param name="server-port" value="4900"/>
- <param name="resource-location" value="media"/>
- <param name="speechsynth" value="speechsynthesizer"/>
- <param name="speechrecog" value="speechrecognizer"/>
- <!--param name="rtp-ext-ip" value="auto"/-->
- <param name="rtp-ip" value="auto"/>
- <param name="rtp-port-min" value="4000"/>
- <param name="rtp-port-max" value="5000"/>
- <!-- enable/disable rtcp support -->
- <param name="rtcp" value="1"/>
- <!-- rtcp bye policies (rtcp must be enabled first)
- 0 - disable rtcp bye
- 1 - send rtcp bye at the end of session
- 2 - send rtcp bye also at the end of each talkspurt (input)
- -->
- <param name="rtcp-bye" value="2"/>
- <!-- rtcp transmission interval in msec (set 0 to disable) -->
- <param name="rtcp-tx-interval" value="5000"/>
- <!-- period (timeout) to check for new rtcp messages in msec (set 0 to disable) -->
- <param name="rtcp-rx-resolution" value="1000"/>
- <!--param name="playout-delay" value="50"/-->
- <!--param name="max-playout-delay" value="200"/-->
- <!--param name="ptime" value="20"/-->
- <param name="codecs" value="PCMU PCMA L16/96/8000"/>
-
- <!-- Add any default MRCP params for SPEAK requests here -->
- <synthparams>
- </synthparams>
-
- <!-- Add any default MRCP params for RECOGNIZE requests here -->
- <recogparams>
- <!--param name="start-input-timers" value="false"/-->
- </recogparams>
- </profile>
-</include>
+++ /dev/null
-<include>
- <!-- Nuance Speech Server 5.0 MRCPv2 -->
- <profile name="nuance5-mrcp2" version="2">
- <!--param name="client-ext-ip" value="auto"-->
- <param name="client-ip" value="auto"/>
- <param name="client-port" value="5090"/>
- <param name="server-ip" value="10.5.5.152"/>
- <param name="server-port" value="5060"/>
- <!--param name="force-destination" value="1"/-->
- <param name="sip-transport" value="udp"/>
- <!--param name="ua-name" value="FreeSWITCH"/-->
- <!--param name="sdp-origin" value="FreeSWITCH"/-->
- <!--param name="rtp-ext-ip" value="auto"/-->
- <param name="rtp-ip" value="auto"/>
- <param name="rtp-port-min" value="4000"/>
- <param name="rtp-port-max" value="5000"/>
- <!-- enable/disable rtcp support -->
- <param name="rtcp" value="1"/>
- <!-- rtcp bye policies (rtcp must be enabled first)
- 0 - disable rtcp bye
- 1 - send rtcp bye at the end of session
- 2 - send rtcp bye also at the end of each talkspurt (input)
- -->
- <param name="rtcp-bye" value="2"/>
- <!-- rtcp transmission interval in msec (set 0 to disable) -->
- <param name="rtcp-tx-interval" value="5000"/>
- <!-- period (timeout) to check for new rtcp messages in msec (set 0 to disable) -->
- <param name="rtcp-rx-resolution" value="1000"/>
- <!--param name="playout-delay" value="50"/-->
- <!--param name="max-playout-delay" value="200"/-->
- <!--param name="ptime" value="20"/-->
- <param name="codecs" value="PCMU PCMA L16/96/8000"/>
-
- <!-- Add any default MRCP params for SPEAK requests here -->
- <synthparams>
- </synthparams>
-
- <!-- Add any default MRCP params for RECOGNIZE requests here -->
- <recogparams>
- <!--param name="start-input-timers" value="false"/-->
- </recogparams>
- </profile>
-</include>
+++ /dev/null
-<include>
- <!-- UniMRCP Server MRCPv1 -->
- <profile name="unimrcpserver-mrcp1" version="1">
- <param name="server-ip" value="10.5.5.152"/>
- <param name="server-port" value="1554"/>
- <param name="resource-location" value=""/>
- <param name="speechsynth" value="speechsynthesizer"/>
- <param name="speechrecog" value="speechrecognizer"/>
- <!--param name="rtp-ext-ip" value="auto"/-->
- <param name="rtp-ip" value="auto"/>
- <param name="rtp-port-min" value="4000"/>
- <param name="rtp-port-max" value="5000"/>
- <!--param name="playout-delay" value="50"/-->
- <!--param name="max-playout-delay" value="200"/-->
- <!--param name="ptime" value="20"/-->
- <param name="codecs" value="PCMU PCMA L16/96/8000"/>
-
- <!-- Add any default MRCP params for SPEAK requests here -->
- <synthparams>
- </synthparams>
-
- <!-- Add any default MRCP params for RECOGNIZE requests here -->
- <recogparams>
- <!--param name="start-input-timers" value="false"/-->
- </recogparams>
- </profile>
-</include>
+++ /dev/null
-<include>
- <!-- Vestec VASRE MRCP Server -->
- <profile name="vestec-mrcp-v1" version="1">
- <param name="server-ip" value="127.0.0.1"/>
- <param name="server-port" value="1554"/>
- <param name="resource-location" value=""/>
- <param name="speechsynth" value="speechsynthesizer"/>
- <param name="speechrecog" value="speechrecognizer"/>
- <param name="rtp-ip" value="auto"/>
- <param name="rtp-port-min" value="14000"/>
- <param name="rtp-port-max" value="15000"/>
- <!--param name="playout-delay" value="50"/-->
- <!--param name="max-playout-delay" value="200"/-->
- <!--param name="ptime" value="20"/-->
- <param name="codecs" value="PCMU PCMA L16/96/8000"/>
-
- <!-- Add any default MRCP params for SPEAK requests here -->
- <synthparams>
- </synthparams>
-
- <!-- Add any default MRCP params for RECOGNIZE requests here -->
- <recogparams>
- <!--param name="start-input-timers" value="false"/-->
- </recogparams>
- </profile>
-</include>
+++ /dev/null
-<include>
- <!-- Voxeo Prophecy 8.0 MRCPv1 -->
- <profile name="voxeo-prophecy8.0-mrcp1" version="1">
- <param name="server-ip" value="99.185.85.31"/>
- <param name="server-port" value="554"/>
- <param name="resource-location" value=""/>
- <param name="speechsynth" value="synthesizer"/>
- <param name="speechrecog" value="recognizer"/>
- <!--param name="rtp-ext-ip" value="auto"/-->
- <param name="rtp-ip" value="auto"/>
- <param name="rtp-port-min" value="4000"/>
- <param name="rtp-port-max" value="5000"/>
- <!--param name="playout-delay" value="50"/-->
- <!--param name="max-playout-delay" value="200"/-->
- <!--param name="ptime" value="20"/-->
- <param name="codecs" value="PCMU PCMA L16/96/8000"/>
-
- <!-- Add any default MRCP params for SPEAK requests here -->
- <synthparams>
- </synthparams>
-
- <!-- Add any default MRCP params for RECOGNIZE requests here -->
- <recogparams>
- <!--param name="start-input-timers" value="false"/-->
- </recogparams>
- </profile>
-</include>
# 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], [
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
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
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}),
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}),
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
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
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
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
######################################################################################################################
# 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"
######################################################################################################################
#
%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
%files asrtts-tts-commandline
%{MODINSTDIR}/mod_tts_commandline.so*
-%files asrtts-unimrcp
-%{MODINSTDIR}/mod_unimrcp.so*
-
######################################################################################################################
#
# CODEC Packages
/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
libg722_1/config/compile
pcre/compile
srtp/build/compile
-unimrcp/build/compile
/pcre-*/
/speex-*/
/curl-*/
libyuv/convert
srtp/configure
tiff-4.0.2/configure
-unimrcp/configure
zlib-*/
zlib-*
libpq-*/
+++ /dev/null
-Mon Nov 17 11:06:30 EST 2014
+++ /dev/null
-Author(s):
- Arsen Chaloyan <achaloyan@gmail.com>
-
-
-Contributor(s):
- Kamil Shakirov <kamils80@gmail.com>
- Anthony Masse <amasse.atwork@gmail.com>
- Vlad Socaciu <Curatica@gmail.com>
- Garmt <garmt.noname@gmail.com>
- Patrick Nunes <pnunes29@gmail.com>
- Bayram Boyraz <bayramboyraz@gmail.com>
- Mahmoud Hassan <firstmahmoud2002@gmail.com>
- Michael Jerris <mike@jerris.com>
- Carlos Pina Soares
- Chaitanya Chokkareddy <chaitanya.chokkareddy@gmail.com>
- Tomas Valenta <tomas.valenta@speechtech.cz>
- Danijel Korzinek <danijel.korzinek@gmail.com>
+++ /dev/null
-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 <offer-new-connection>.
- * 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 <instance> and <input> 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 <speak> 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.
+++ /dev/null
-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
- <UserMacro
- Name="AprDir"
- Value="$(SolutionDir)libs\apr"
- />
- <UserMacro
- Name="AprUtilDir"
- Value="$(SolutionDir)libs\apr-util"
- />
-
-sofiasip.vsprops
- <UserMacro
- Name="SofiaDir"
- Value="$(SolutionDir)libs\sofia-sip"
- />
-
-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
+++ /dev/null
-
- 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.
+++ /dev/null
-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)
+++ /dev/null
-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 <Pekka.Pessi@nokia.com>
-
-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 <steveu@coppice.org>
-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.
----------------------------------------------------
+++ /dev/null
-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
+++ /dev/null
-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])
+++ /dev/null
-#! /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
+++ /dev/null
-MAINTAINERCLEANFILES = Makefile.in
-
-SUBDIRS = pkgconfig
-
-include_HEADERS = uni_version.h uni_revision.h
+++ /dev/null
-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])
-])
+++ /dev/null
-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<<EOF
-#! /bin/sh
-#
-# Created by configure
-
-EOF
- if test -n "$CC"; then
- echo "CC=\"$CC\"; export CC" >> $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 <apr.h>
-#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(<<AC_TYPE_NAME>>, translit(sizeof_$2, [a-z *], [A-Z_P]))dnl
-dnl The cache variable name.
-define(<<AC_CV_NAME>>, 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 <stdio.h>
-$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 <errno.h>
-#include <string.h>
-#include <stdio.h>
-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 <sys/types.h>
-#include <dirent.h>
-],[
-#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 <sys/types.h>
-#include <dirent.h>
-],[
-#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 <sys/types.h>
-#include <dirent.h>
-],[
-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 <sys/types.h> should be available everywhere!
- cat > conftest.c <<EOF
-#include <sys/types.h>
- 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])])
-])
+++ /dev/null
-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.
+++ /dev/null
-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`
- ])
-])
+++ /dev/null
-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)
-])
+++ /dev/null
-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)
-])
+++ /dev/null
-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
-])
+++ /dev/null
-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"])
-])
+++ /dev/null
-#!/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
+++ /dev/null
-#!/bin/sh\r
-#\r
-# unimrcp-server This shell script takes care of starting and stopping the UniMRCP server.\r
-#\r
-# chkconfig: 2345 65 35\r
-# description: UniMRCP is an open source MRCP v1 & v2 server.\r
-\r
-# Some global variables\r
-\r
-# Application\r
-APP_NAME="unimrcpserver"\r
-APP_LONG_NAME="UniMRCP Server"\r
-UNIMRCP_DIR="/usr/local/unimrcp/"\r
-DAEMON_ARGS="-d -r ${UNIMRCP_DIR}"\r
-APP_ARGS="-o 2"\r
-\r
-EXEC="${UNIMRCP_DIR}bin/${APP_NAME}"\r
-\r
-# sudo user\r
-USERNAME=root\r
-\r
-# Priority at which to run the server. See "man nice" for valid priorities.\r
-# nice is only used if a priority is specified.\r
-PRIORITY=\r
-\r
-# Location of the pid file.\r
-PIDDIR="/var/run/"\r
-pid=\r
-\r
-if [ -e $PIDDIR ]; then\r
- echo\r
-else\r
- mkdir $PIDDIR\r
-fi\r
-\r
-# Allow configuration overrides in /etc/sysconfig/$APP_NAME\r
-CONFIGFILE=/etc/sysconfig/$APP_NAME\r
-\r
-[ -x $CONFIGFILE ] && . $CONFIGFILE\r
-\r
-# Do not modify anything beyond this point\r
-#-----------------------------------------------------------------------------\r
-\r
-# Get the fully qualified path to the script\r
-case $0 in\r
- /*)\r
- SCRIPT="$0"\r
- ;;\r
- *)\r
- PWD=`pwd`\r
- SCRIPT="$PWD/$0"\r
- ;;\r
-esac\r
-\r
-# Change spaces to ":" so the tokens can be parsed.\r
-SCRIPT=`echo $SCRIPT | sed -e 's; ;:;g'`\r
-# Get the real path to this script, resolving any symbolic links\r
-TOKENS=`echo $SCRIPT | sed -e 's;/; ;g'`\r
-REALPATH=\r
-for C in $TOKENS; do\r
- REALPATH="$REALPATH/$C"\r
- while [ -h "$REALPATH" ] ; do\r
- LS="`ls -ld "$REALPATH"`"\r
- LINK="`expr "$LS" : '.*-> \(.*\)$'`"\r
- if expr "$LINK" : '/.*' > /dev/null; then\r
- REALPATH="$LINK"\r
- else\r
- REALPATH="`dirname "$REALPATH"`""/$LINK"\r
- fi\r
- done\r
-done\r
-# Change ":" chars back to spaces.\r
-REALPATH=`echo $REALPATH | sed -e 's;:; ;g'`\r
-\r
-# Change the current directory to the location of the script\r
-cd "`dirname "$REALPATH"`"\r
-\r
-chown $USERNAME $PIDDIR\r
-\r
-# Process ID\r
-PIDFILE="$PIDDIR/$APP_NAME.pid"\r
-\r
-# Resolve the location of the 'ps' command\r
-PSEXE="/usr/bin/ps"\r
-if [ ! -x $PSEXE ]\r
-then\r
- PSEXE="/bin/ps"\r
- if [ ! -x $PSEXE ]\r
- then\r
- echo "Unable to locate 'ps'."\r
- echo "Please report this with the location on your system."\r
- exit 1\r
- fi\r
-fi\r
-\r
-# Build the nice clause\r
-if [ "X$PRIORITY" = "X" ]\r
-then\r
- CMDNICE=""\r
-else\r
- CMDNICE="nice -$PRIORITY"\r
-fi\r
-\r
-getpid() {\r
- if [ -f $PIDFILE ]\r
- then\r
- if [ -r $PIDFILE ]\r
- then\r
- pid=`cat $PIDFILE`\r
- if [ "X$pid" != "X" ]\r
- then\r
- # Verify that a process with this pid is still running.\r
- pid=`$PSEXE -p $pid | grep $pid | grep -v grep | awk '{print $1}' | tail -1`\r
- if [ "X$pid" = "X" ]\r
- then\r
- # This is a stale pid file.\r
- rm -f $PIDFILE\r
- echo "Removed stale pid file: $PIDFILE"\r
- fi\r
- fi\r
- else\r
- echo "Cannot read $PIDFILE."\r
- exit 1\r
- fi\r
- fi\r
-}\r
-\r
-testpid() {\r
- pid=`$PSEXE -p $pid | grep $pid | grep -v grep | awk '{print $1}' | tail -1`\r
- if [ "X$pid" = "X" ]\r
- then\r
- # Process is gone so remove the pid file.\r
- rm -f $PIDFILE\r
- fi\r
-}\r
-\r
-console() {\r
- echo "Running $APP_LONG_NAME..."\r
- getpid\r
- if [ "X$pid" = "X" ]\r
- then\r
- exec sudo -u $USERNAME $CMDNICE $EXEC $APP_ARGS\r
- echo $pid > $PIDFILE\r
- else\r
- echo "$APP_LONG_NAME is already running."\r
- exit 1\r
- fi\r
-}\r
-\r
-start() {\r
- echo "Starting $APP_LONG_NAME..."\r
- getpid\r
- if [ "X$pid" = "X" ]\r
- then\r
- sudo -u $USERNAME $CMDNICE $EXEC $DAEMON_ARGS $APP_ARGS\r
- pid=`$PSEXE -C $APP_NAME -o pid=`\r
- echo $pid > $PIDFILE\r
- else\r
- echo "$APP_LONG_NAME is already running."\r
- exit 1\r
- fi\r
-}\r
-\r
-stopit() {\r
- echo "Stopping $APP_LONG_NAME..."\r
- getpid\r
- if [ "X$pid" = "X" ]\r
- then\r
- echo "$APP_LONG_NAME was not running."\r
- else\r
- # Running so try to stop it.\r
- sudo -u $USERNAME kill $pid\r
- if [ $? -ne 0 ]\r
- then\r
- # An explanation for the failure should have been given\r
- echo "Unable to stop $APP_LONG_NAME."\r
- exit 1\r
- fi\r
-\r
- # We can not predict how long it will take for the wrapper to\r
- # actually stop as it depends on settings in wrapper.conf.\r
- # Loop until it does.\r
- savepid=$pid\r
- CNT=0\r
- TOTCNT=0\r
- while [ "X$pid" != "X" ]\r
- do\r
- # Loop for up to 5 minutes\r
- if [ "$TOTCNT" -lt "300" ]\r
- then\r
- if [ "$CNT" -lt "5" ]\r
- then\r
- CNT=`expr $CNT + 1`\r
- else\r
- echo "Waiting for $APP_LONG_NAME to exit..."\r
- CNT=0\r
- fi\r
- TOTCNT=`expr $TOTCNT + 1`\r
-\r
- sleep 1\r
-\r
- testpid\r
- else\r
- pid=\r
- fi\r
- done\r
-\r
- pid=$savepid\r
- testpid\r
- if [ "X$pid" != "X" ]\r
- then\r
- echo "Timed out waiting for $APP_LONG_NAME to exit."\r
- echo " Attempting a forced exit..."\r
- kill -9 $pid\r
- fi\r
-\r
- pid=$savepid\r
- testpid\r
- if [ "X$pid" != "X" ]\r
- then\r
- echo "Failed to stop $APP_LONG_NAME."\r
- exit 1\r
- else\r
- echo "Stopped $APP_LONG_NAME."\r
- fi\r
- fi\r
-}\r
-\r
-status() {\r
- getpid\r
- if [ "X$pid" = "X" ]\r
- then\r
- echo "$APP_LONG_NAME is not running."\r
- exit 1\r
- else\r
- echo "$APP_LONG_NAME is running ($pid)."\r
- exit 0\r
- fi\r
-}\r
-\r
-case "$1" in\r
-\r
- 'console')\r
- console\r
- ;;\r
-\r
- 'start')\r
- start\r
- ;;\r
-\r
- 'stop')\r
- stopit\r
- ;;\r
-\r
- 'restart')\r
- stopit\r
- start\r
- ;;\r
-\r
- 'status')\r
- status\r
- ;;\r
-\r
- *)\r
- echo "Usage: $0 { console | start | stop | restart | status }"\r
- exit 1\r
- ;;\r
-esac\r
-\r
-exit 0\r
+++ /dev/null
-MAINTAINERCLEANFILES = Makefile.in
-
-pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = unimrcpclient.pc unimrcpserver.pc unimrcpplugin.pc
+++ /dev/null
-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}
+++ /dev/null
-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}
+++ /dev/null
-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}
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ImportGroup Label="PropertySheets">
- <Import Project="$(ProjectDir)..\..\build\props\unibase.props" Condition=" '$(UniBaseImported)' == '' "/>
- </ImportGroup>
- <PropertyGroup Label="UserMacros">
- <AprDir>$(LibRootDir)libs\apr</AprDir>
- <AprUtilDir>$(LibRootDir)libs\apr-util</AprUtilDir>
- <AprIconvDir>$(LibRootDir)libs\apr-iconv</AprIconvDir>
- </PropertyGroup>
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- </PropertyGroup>
- <PropertyGroup>
- <AprImported>true</AprImported>
- </PropertyGroup>
- <ItemDefinitionGroup>
- <ClCompile>
- <AdditionalIncludeDirectories>$(AprDir)\include;$(AprUtilDir)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemGroup>
- <BuildMacro Include="AprDir">
- <Value>$(AprDir)</Value>
- </BuildMacro>
- <BuildMacro Include="AprUtilDir">
- <Value>$(AprUtilDir)</Value>
- </BuildMacro>
- <BuildMacro Include="AprIconvDir">
- <Value>$(AprIconvDir)</Value>
- </BuildMacro>
- </ItemGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ImportGroup Label="PropertySheets">
- <Import Project="apr.props" Condition=" '$(AprImported)' == '' "/>
- </ImportGroup>
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- </PropertyGroup>
- <PropertyGroup>
- <AptImported>true</AptImported>
- </PropertyGroup>
- <ItemDefinitionGroup>
- <ClCompile>
- <AdditionalIncludeDirectories>$(ProjectRootDir)libs\apr-toolkit\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>APT_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- </ClCompile>
- </ItemDefinitionGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ImportGroup Label="PropertySheets">
- <Import Project="apt.props" Condition=" '$(AptImported)' == '' "/>
- </ImportGroup>
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- </PropertyGroup>
- <PropertyGroup>
- <MpfImported>true</MpfImported>
- </PropertyGroup>
- <ItemDefinitionGroup>
- <ClCompile>
- <AdditionalIncludeDirectories>$(ProjectRootDir)libs\mpf\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>MPF_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- </ClCompile>
- </ItemDefinitionGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ImportGroup Label="PropertySheets">
- <Import Project="apt.props" Condition=" '$(AptImported)' == '' "/>
- </ImportGroup>
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- </PropertyGroup>
- <PropertyGroup>
- <MrcpImported>true</MrcpImported>
- </PropertyGroup>
- <ItemDefinitionGroup>
- <ClCompile>
- <AdditionalIncludeDirectories>$(ProjectRootDir)libs\mrcp\include;$(ProjectRootDir)libs\mrcp\message\include;$(ProjectRootDir)libs\mrcp\control\include;$(ProjectRootDir)libs\mrcp\resources\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>MRCP_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- </ClCompile>
- </ItemDefinitionGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ImportGroup Label="PropertySheets">
- <Import Project="mrcpsignaling.props" />
- <Import Project="mrcpv2transport.props" />
- </ImportGroup>
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- </PropertyGroup>
- <ItemDefinitionGroup>
- <ClCompile>
- <AdditionalIncludeDirectories>$(ProjectRootDir)libs\mrcp-client\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- </ClCompile>
- </ItemDefinitionGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ImportGroup Label="PropertySheets">
- <Import Project="mpf.props" Condition=" '$(MpfImported)' == '' " />
- <Import Project="mrcp.props" Condition=" '$(MrcpImported)' == '' "/>
- </ImportGroup>
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- </PropertyGroup>
- <ItemDefinitionGroup>
- <ClCompile>
- <AdditionalIncludeDirectories>$(ProjectRootDir)libs\mrcp-engine\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- </ClCompile>
- </ItemDefinitionGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ImportGroup Label="PropertySheets">
- <Import Project="mrcpengine.props" />
- <Import Project="mrcpsignaling.props" />
- <Import Project="mrcpv2transport.props" />
- </ImportGroup>
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- </PropertyGroup>
- <ItemDefinitionGroup>
- <ClCompile>
- <AdditionalIncludeDirectories>$(ProjectRootDir)libs\mrcp-server\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- </ClCompile>
- </ItemDefinitionGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ImportGroup Label="PropertySheets">
- <Import Project="mpf.props" Condition=" '$(MpfImported)' == '' " />
- <Import Project="mrcp.props" Condition=" '$(MrcpImported)' == '' "/>
- </ImportGroup>
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- </PropertyGroup>
- <ItemDefinitionGroup>
- <ClCompile>
- <AdditionalIncludeDirectories>$(ProjectRootDir)libs\mrcp-signaling\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- </ClCompile>
- </ItemDefinitionGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ImportGroup Label="PropertySheets">
- <Import Project="mrcp.props" Condition=" '$(MrcpImported)' == '' "/>
- </ImportGroup>
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- </PropertyGroup>
- <ItemDefinitionGroup>
- <ClCompile>
- <AdditionalIncludeDirectories>$(ProjectRootDir)libs\mrcpv2-transport\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- </ClCompile>
- </ItemDefinitionGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ImportGroup Label="PropertySheets">
- <Import Project="unimrcpsdk.props"/>
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup />
- <ItemDefinitionGroup>
- <Link>
- <AdditionalDependencies>libunimrcpclient.lib mrcpsofiasip.lib mrcpunirtsp.lib unirtsp.lib mrcpclient.lib mrcpv2transport.lib mrcpsignaling.lib libsofia_sip_ua.lib ws2_32.lib winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
- </Link>
- </ItemDefinitionGroup>
- <ItemGroup />
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ImportGroup Label="PropertySheets">
- <Import Project="unimrcpsdk.props"/>
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup />
- <ItemDefinitionGroup>
- <Link>
- <AdditionalDependencies>mrcpengine.lib;%(AdditionalDependencies)</AdditionalDependencies>
- </Link>
- </ItemDefinitionGroup>
- <ItemGroup />
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ImportGroup Label="PropertySheets" />
- <PropertyGroup Label="UserMacros">
- <ProjectRootDir>C:\Program Files\UniMRCP</ProjectRootDir>
- </PropertyGroup>
- <PropertyGroup />
- <ItemDefinitionGroup>
- <ClCompile>
- <AdditionalIncludeDirectories>$(ProjectRootDir)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- </ClCompile>
- <Link>
- <AdditionalLibraryDirectories>$(ProjectRootDir)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <AdditionalDependencies>mrcp.lib;mpf.lib;aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies)</AdditionalDependencies>
- </Link>
- </ItemDefinitionGroup>
- <ItemGroup>
- <BuildMacro Include="ProjectRootDir">
- <Value>$(ProjectRootDir)</Value>
- </BuildMacro>
- </ItemGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ImportGroup Label="PropertySheets">
- <Import Project="unimrcpsdk.props"/>
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup />
- <ItemDefinitionGroup>
- <Link>
- <AdditionalDependencies>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)</AdditionalDependencies>
- </Link>
- </ItemDefinitionGroup>
- <ItemGroup />
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ImportGroup Label="PropertySheets">
- <Import Project="$(ProjectDir)..\..\build\props\unibase.props" Condition=" '$(UniBaseImported)' == '' "/>
- </ImportGroup>
- <PropertyGroup Label="UserMacros">
- <SofiaDir>$(LibRootDir)libs\sofia-sip</SofiaDir>
- </PropertyGroup>
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- </PropertyGroup>
- <PropertyGroup>
- <SofiaSipImported>true</SofiaSipImported>
- </PropertyGroup>
- <ItemDefinitionGroup>
- <ClCompile>
- <AdditionalIncludeDirectories>$(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)</AdditionalIncludeDirectories>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemGroup>
- <BuildMacro Include="SofiaDir">
- <Value>$(SofiaDir)</Value>
- </BuildMacro>
- </ItemGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup Label="UserMacros">
- <ProjectRootDir>$(ProjectDir)..\..\</ProjectRootDir>
- <LibRootDir>$(SolutionDir)</LibRootDir>
- </PropertyGroup>
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- </PropertyGroup>
- <PropertyGroup>
- <UniBaseImported>true</UniBaseImported>
- </PropertyGroup>
- <ItemDefinitionGroup>
- <ClCompile>
- <PreprocessorDefinitions>WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <WarningLevel>Level4</WarningLevel>
- <TreatWarningAsError>true</TreatWarningAsError>
- <DisableSpecificWarnings>4100;%(DisableSpecificWarnings)</DisableSpecificWarnings>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemGroup>
- <BuildMacro Include="ProjectRootDir">
- <Value>$(ProjectRootDir)</Value>
- </BuildMacro>
- <BuildMacro Include="LibRootDir">
- <Value>$(LibRootDir)</Value>
- </BuildMacro>
- </ItemGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ImportGroup Label="PropertySheets">
- <Import Project="apr.props" Condition=" '$(AprImported)' == '' "/>
- <Import Project="sofiasip.props" Condition=" '$(SofiaSipImported)' == '' "/>
- </ImportGroup>
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- <OutDir>$(SolutionDir)$(PlatformName)\$(Configuration)\bin\</OutDir>
- <IntDir>$(PlatformName)\$(Configuration)\</IntDir>
- </PropertyGroup>
- <ItemDefinitionGroup>
- <ClCompile>
- <PreprocessorDefinitions>_WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- </ClCompile>
- <Link>
- <AdditionalLibraryDirectories>$(AprDir)\$(Platform)\$(Configuration);$(AprUtilDir)\$(Platform)\$(Configuration);$(SofiaDir)\win32\libsofia-sip-ua\$(Platform)\$(Configuration);$(SolutionDir)$(Platform)\$(Configuration)\lib;$(SolutionDir)$(Platform)\$(Configuration)\bin;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <TargetMachine>MachineX64</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ImportGroup Label="PropertySheets">
- <Import Project="apr.props" Condition=" '$(AprImported)' == '' "/>
- <Import Project="sofiasip.props" Condition=" '$(SofiaSipImported)' == '' "/>
- </ImportGroup>
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- <OutDir>$(SolutionDir)$(Configuration)\bin\</OutDir>
- <IntDir>$(Configuration)\</IntDir>
- </PropertyGroup>
- <ItemDefinitionGroup>
- <Link>
- <AdditionalLibraryDirectories>$(AprDir)\$(Configuration);$(AprUtilDir)\$(Configuration);$(SofiaDir)\win32\libsofia-sip-ua\$(Configuration);$(SolutionDir)$(Configuration)\lib;$(SolutionDir)$(Configuration)\bin;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <TargetMachine>MachineX86</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ImportGroup Label="PropertySheets">
- <Import Project="$(ProjectDir)..\..\build\props\unibase.props" Condition=" '$(UniBaseImported)' == '' "/>
- </ImportGroup>
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- <LinkIncremental>true</LinkIncremental>
- </PropertyGroup>
- <ItemDefinitionGroup>
- <ClCompile>
- <Optimization>Disabled</Optimization>
- <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <MinimalRebuild>true</MinimalRebuild>
- <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
- <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- <Link>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- </Link>
- </ItemDefinitionGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- <OutDir>$(SolutionDir)$(PlatformName)\$(Configuration)\lib\</OutDir>
- <IntDir>$(PlatformName)\$(Configuration)\</IntDir>
- </PropertyGroup>
- <ItemDefinitionGroup>
- <ClCompile>
- <PreprocessorDefinitions>_WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- </ClCompile>
- </ItemDefinitionGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- <OutDir>$(SolutionDir)$(Configuration)\lib\</OutDir>
- <IntDir>$(Configuration)\</IntDir>
- </PropertyGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ImportGroup Label="PropertySheets">
- <Import Project="mrcpclient.props" />
- <Import Project="sofiasip.props" Condition=" '$(SofiaSipImported)' == '' "/>
- </ImportGroup>
- <PropertyGroup Label="UserMacros">
- <UniMRCPClientLibs>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</UniMRCPClientLibs>
- </PropertyGroup>
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- </PropertyGroup>
- <ItemDefinitionGroup>
- <ClCompile>
- <AdditionalIncludeDirectories>$(ProjectRootDir)platforms\libunimrcp-client\include;$(ProjectRootDir)build;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemGroup>
- <BuildMacro Include="UniMRCPClientLibs">
- <Value>$(UniMRCPClientLibs)</Value>
- </BuildMacro>
- </ItemGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ImportGroup Label="PropertySheets">
- <Import Project="mrcpserver.props" />
- <Import Project="sofiasip.props" Condition=" '$(SofiaSipImported)' == '' "/>
- </ImportGroup>
- <PropertyGroup Label="UserMacros">
- <UniMRCPServerLibs>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</UniMRCPServerLibs>
- </PropertyGroup>
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- </PropertyGroup>
- <ItemDefinitionGroup>
- <ClCompile>
- <AdditionalIncludeDirectories>$(ProjectRootDir)platforms\libunimrcp-server\include;$(ProjectRootDir)build;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemGroup>
- <BuildMacro Include="UniMRCPServerLibs">
- <Value>$(UniMRCPServerLibs)</Value>
- </BuildMacro>
- </ItemGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ImportGroup Label="PropertySheets">
- <Import Project="apr.props" Condition=" '$(AprImported)' == '' "/>
- <Import Project="mrcpengine.props" />
- </ImportGroup>
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- <OutDir>$(SolutionDir)$(PlatformName)\$(Configuration)\plugin\</OutDir>
- <IntDir>$(PlatformName)\$(Configuration)\</IntDir>
- </PropertyGroup>
- <ItemDefinitionGroup>
- <ClCompile>
- <PreprocessorDefinitions>_WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- </ClCompile>
- <Link>
- <AdditionalLibraryDirectories>$(AprDir)\$(Platform)\$(Configuration);$(AprUtilDir)\$(Platform)\$(Configuration);$(SolutionDir)$(Platform)\$(Configuration)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <AdditionalDependencies>mrcpengine.lib;mrcp.lib;mpf.lib;aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <TargetMachine>MachineX64</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ImportGroup Label="PropertySheets">
- <Import Project="apr.props" Condition=" '$(AprImported)' == '' "/>
- <Import Project="mrcpengine.props" />
- </ImportGroup>
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- <OutDir>$(SolutionDir)$(Configuration)\plugin\</OutDir>
- <IntDir>$(Configuration)\</IntDir>
- </PropertyGroup>
- <ItemDefinitionGroup>
- <Link>
- <AdditionalLibraryDirectories>$(AprDir)\$(Configuration);$(AprUtilDir)\$(Configuration);$(SolutionDir)$(Configuration)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <AdditionalDependencies>mrcpengine.lib;mrcp.lib;mpf.lib;aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <TargetMachine>MachineX86</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ImportGroup Label="PropertySheets">
- <Import Project="$(ProjectDir)..\..\build\props\unibase.props" Condition=" '$(UniBaseImported)' == '' "/>
- </ImportGroup>
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- </PropertyGroup>
- <ItemDefinitionGroup>
- <ClCompile>
- <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- </ItemDefinitionGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ImportGroup Label="PropertySheets">
- <Import Project="apt.props" Condition=" '$(AptImported)' == '' "/>
- </ImportGroup>
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- </PropertyGroup>
- <ItemDefinitionGroup>
- <ClCompile>
- <AdditionalIncludeDirectories>$(ProjectRootDir)libs\uni-rtsp\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>RTSP_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- </ClCompile>
- </ItemDefinitionGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-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
+++ /dev/null
-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)
+++ /dev/null
-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)
+++ /dev/null
-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
+++ /dev/null
-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)
+++ /dev/null
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="prepare"
- ProjectGUID="{01D63BF5-7798-4746-852A-4B45229BB735}"
- RootNamespace="prepare"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- <Platform
- Name="x64"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="10"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\apr.vsprops;$(ProjectDir)..\..\build\vsprops\sofiasip.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- CommandLine="xcopy "$(AprDir)\$(ConfigurationName)\libapr-1.dll" "$(SolutionDir)$(ConfigurationName)\bin\" /Y
xcopy "$(AprUtilDir)\$(ConfigurationName)\libaprutil-1.dll" "$(SolutionDir)$(ConfigurationName)\bin\" /Y

if exist "$(AprIconvDir)\$(ConfigurationName)\libapriconv-1.dll" (
xcopy "$(AprIconvDir)\$(ConfigurationName)\libapriconv-1.dll" "$(SolutionDir)$(ConfigurationName)\bin\" /Y
if exist "$(AprIconvDir)\$(ConfigurationName)\iconv" (
if not exist "$(SolutionDir)$(ConfigurationName)\bin\iconv" mkdir "$(SolutionDir)$(ConfigurationName)\bin\iconv"
xcopy "$(AprIconvDir)\$(ConfigurationName)\iconv\*.so" "$(SolutionDir)$(ConfigurationName)\bin\iconv\" /Y
)
)

xcopy "$(SofiaDir)\win32\libsofia-sip-ua\$(ConfigurationName)\libsofia_sip_ua.dll" "$(SolutionDir)$(ConfigurationName)\bin\" /Y
xcopy "$(SofiaDir)\win32\pthread\$(ConfigurationName)\pthreadVC2.dll" "$(SolutionDir)$(ConfigurationName)\bin\" /Y

if not exist "$(SolutionDir)$(ConfigurationName)\conf" (
xcopy "$(SolutionDir)conf\*.xml" "$(SolutionDir)$(ConfigurationName)\conf\" /Y
xcopy "$(SolutionDir)conf\*.xsd" "$(SolutionDir)$(ConfigurationName)\conf\" /Y
xcopy "$(SolutionDir)conf\client-profiles\*.xml" "$(SolutionDir)$(ConfigurationName)\conf\client-profiles\" /Y
)

if not exist "$(SolutionDir)$(ConfigurationName)\data" xcopy "$(SolutionDir)data\*" "$(SolutionDir)$(ConfigurationName)\data\" /Y
if not exist "$(SolutionDir)$(ConfigurationName)\log" mkdir "$(SolutionDir)$(ConfigurationName)\log\"
if not exist "$(SolutionDir)$(ConfigurationName)\var" mkdir "$(SolutionDir)$(ConfigurationName)\var\"
"
- ExcludedFromBuild="false"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|x64"
- OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
- IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
- ConfigurationType="10"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\apr.vsprops;$(ProjectDir)..\..\build\vsprops\sofiasip.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- CommandLine="xcopy "$(AprDir)\$(PlatformName)\$(ConfigurationName)\libapr-1.dll" "$(SolutionDir)$(PlatformName)\$(ConfigurationName)\bin\" /Y
xcopy "$(AprUtilDir)\$(PlatformName)\$(ConfigurationName)\libaprutil-1.dll" "$(SolutionDir)$(PlatformName)\$(ConfigurationName)\bin\" /Y

if exist "$(AprIconvDir)\$(PlatformName)\$(ConfigurationName)\libapriconv-1.dll" (
xcopy "$(AprIconvDir)\$(PlatformName)\$(ConfigurationName)\libapriconv-1.dll" "$(SolutionDir)$(PlatformName)\$(ConfigurationName)\bin\" /Y
if exist "$(AprIconvDir)\$(PlatformName)\$(ConfigurationName)\iconv" (
if not exist "$(SolutionDir)$(PlatformName)\$(ConfigurationName)\bin\iconv" mkdir "$(SolutionDir)$(PlatformName)\$(ConfigurationName)\bin\iconv"
xcopy "$(AprIconvDir)\$(PlatformName)\$(ConfigurationName)\iconv\*.so" "$(SolutionDir)$(PlatformName)\$(ConfigurationName)\bin\iconv\" /Y
)
)

xcopy "$(SofiaDir)\win32\libsofia-sip-ua\$(PlatformName)\$(ConfigurationName)\libsofia_sip_ua.dll" "$(SolutionDir)$(PlatformName)\$(ConfigurationName)\bin\" /Y
xcopy "$(SofiaDir)\win32\pthread\$(PlatformName)\$(ConfigurationName)\pthreadVC2.dll" "$(SolutionDir)$(PlatformName)\$(ConfigurationName)\bin\" /Y

if not exist "$(SolutionDir)$(PlatformName)\$(ConfigurationName)\conf" (
xcopy "$(SolutionDir)conf\*.xml" "$(SolutionDir)$(PlatformName)\$(ConfigurationName)\conf\" /Y
xcopy "$(SolutionDir)conf\*.xsd" "$(SolutionDir)$(PlatformName)\$(ConfigurationName)\conf\" /Y
xcopy "$(SolutionDir)conf\client-profiles\*.xml" "$(SolutionDir)$(PlatformName)\$(ConfigurationName)\conf\client-profiles\" /Y
)

if not exist "$(SolutionDir)$(PlatformName)\$(ConfigurationName)\data" xcopy "$(SolutionDir)data\*" "$(SolutionDir)$(PlatformName)\$(ConfigurationName)\data\" /Y
if not exist "$(SolutionDir)$(PlatformName)\$(ConfigurationName)\log" mkdir "$(SolutionDir)$(PlatformName)\$(ConfigurationName)\log\"
if not exist "$(SolutionDir)$(PlatformName)\$(ConfigurationName)\var" mkdir "$(SolutionDir)$(PlatformName)\$(ConfigurationName)\var\"
"
- ExcludedFromBuild="false"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="10"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\apr.vsprops;$(ProjectDir)..\..\build\vsprops\sofiasip.vsprops"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- CommandLine="xcopy "$(AprDir)\$(ConfigurationName)\libapr-1.dll" "$(SolutionDir)$(ConfigurationName)\bin\" /Y
xcopy "$(AprUtilDir)\$(ConfigurationName)\libaprutil-1.dll" "$(SolutionDir)$(ConfigurationName)\bin\" /Y

if exist "$(AprIconvDir)\$(ConfigurationName)\libapriconv-1.dll" (
xcopy "$(AprIconvDir)\$(ConfigurationName)\libapriconv-1.dll" "$(SolutionDir)$(ConfigurationName)\bin\" /Y
if exist "$(AprIconvDir)\$(ConfigurationName)\iconv" (
if not exist "$(SolutionDir)$(ConfigurationName)\bin\iconv" mkdir "$(SolutionDir)$(ConfigurationName)\bin\iconv"
xcopy "$(AprIconvDir)\$(ConfigurationName)\iconv\*.so" "$(SolutionDir)$(ConfigurationName)\bin\iconv\" /Y
)
)

xcopy "$(SofiaDir)\win32\libsofia-sip-ua\$(ConfigurationName)\libsofia_sip_ua.dll" "$(SolutionDir)$(ConfigurationName)\bin\" /Y
xcopy "$(SofiaDir)\win32\pthread\$(ConfigurationName)\pthreadVC2.dll" "$(SolutionDir)$(ConfigurationName)\bin\" /Y

if not exist "$(SolutionDir)$(ConfigurationName)\conf" (
xcopy "$(SolutionDir)conf\*.xml" "$(SolutionDir)$(ConfigurationName)\conf\" /Y
xcopy "$(SolutionDir)conf\*.xsd" "$(SolutionDir)$(ConfigurationName)\conf\" /Y
xcopy "$(SolutionDir)conf\client-profiles\*.xml" "$(SolutionDir)$(ConfigurationName)\conf\client-profiles\" /Y
)

if not exist "$(SolutionDir)$(ConfigurationName)\data" xcopy "$(SolutionDir)data\*" "$(SolutionDir)$(ConfigurationName)\data\" /Y
if not exist "$(SolutionDir)$(ConfigurationName)\log" mkdir "$(SolutionDir)$(ConfigurationName)\log\"
if not exist "$(SolutionDir)$(ConfigurationName)\var" mkdir "$(SolutionDir)$(ConfigurationName)\var\"
"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|x64"
- OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
- IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
- ConfigurationType="10"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\apr.vsprops;$(ProjectDir)..\..\build\vsprops\sofiasip.vsprops"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- CommandLine="xcopy "$(AprDir)\$(PlatformName)\$(ConfigurationName)\libapr-1.dll" "$(SolutionDir)$(PlatformName)\$(ConfigurationName)\bin\" /Y
xcopy "$(AprUtilDir)\$(PlatformName)\$(ConfigurationName)\libaprutil-1.dll" "$(SolutionDir)$(PlatformName)\$(ConfigurationName)\bin\" /Y

if exist "$(AprIconvDir)\$(PlatformName)\$(ConfigurationName)\libapriconv-1.dll" (
xcopy "$(AprIconvDir)\$(PlatformName)\$(ConfigurationName)\libapriconv-1.dll" "$(SolutionDir)$(PlatformName)\$(ConfigurationName)\bin\" /Y
if exist "$(AprIconvDir)\$(PlatformName)\$(ConfigurationName)\iconv" (
if not exist "$(SolutionDir)$(PlatformName)\$(ConfigurationName)\bin\iconv" mkdir "$(SolutionDir)$(PlatformName)\$(ConfigurationName)\bin\iconv"
xcopy "$(AprIconvDir)\$(PlatformName)\$(ConfigurationName)\iconv\*.so" "$(SolutionDir)$(PlatformName)\$(ConfigurationName)\bin\iconv\" /Y
)
)

xcopy "$(SofiaDir)\win32\libsofia-sip-ua\$(PlatformName)\$(ConfigurationName)\libsofia_sip_ua.dll" "$(SolutionDir)$(PlatformName)\$(ConfigurationName)\bin\" /Y
xcopy "$(SofiaDir)\win32\pthread\$(PlatformName)\$(ConfigurationName)\pthreadVC2.dll" "$(SolutionDir)$(PlatformName)\$(ConfigurationName)\bin\" /Y

if not exist "$(SolutionDir)$(PlatformName)\$(ConfigurationName)\conf" (
xcopy "$(SolutionDir)conf\*.xml" "$(SolutionDir)$(PlatformName)\$(ConfigurationName)\conf\" /Y
xcopy "$(SolutionDir)conf\*.xsd" "$(SolutionDir)$(PlatformName)\$(ConfigurationName)\conf\" /Y
xcopy "$(SolutionDir)conf\client-profiles\*.xml" "$(SolutionDir)$(PlatformName)\$(ConfigurationName)\conf\client-profiles\" /Y
)

if not exist "$(SolutionDir)$(PlatformName)\$(ConfigurationName)\data" xcopy "$(SolutionDir)data\*" "$(SolutionDir)$(PlatformName)\$(ConfigurationName)\data\" /Y
if not exist "$(SolutionDir)$(PlatformName)\$(ConfigurationName)\log" mkdir "$(SolutionDir)$(PlatformName)\$(ConfigurationName)\log\"
if not exist "$(SolutionDir)$(PlatformName)\$(ConfigurationName)\var" mkdir "$(SolutionDir)$(PlatformName)\$(ConfigurationName)\var\"
"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{01D63BF5-7798-4746-852A-4B45229BB735}</ProjectGuid>
- <RootNamespace>prepare</RootNamespace>
- <Keyword>Win32Proj</Keyword>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>Utility</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>Utility</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>Utility</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>Utility</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\apr.props" />
- <Import Project="$(ProjectDir)..\..\build\props\sofiasip.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\apr.props" />
- <Import Project="$(ProjectDir)..\..\build\props\sofiasip.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\apr.props" />
- <Import Project="$(ProjectDir)..\..\build\props\sofiasip.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\apr.props" />
- <Import Project="$(ProjectDir)..\..\build\props\sofiasip.props" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
- <PreBuildEventUseInBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</PreBuildEventUseInBuild>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir>
- <PreBuildEventUseInBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</PreBuildEventUseInBuild>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <PreBuildEvent>
- <Command>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\"
-</Command>
- </PreBuildEvent>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <PreBuildEvent>
- <Command>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\"
-</Command>
- </PreBuildEvent>
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <PreBuildEvent>
- <Command>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\"
-</Command>
- </PreBuildEvent>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <PreBuildEvent>
- <Command>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\"
-</Command>
- </PreBuildEvent>
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- </ItemDefinitionGroup>
- <ItemGroup>
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-/*
- * 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 <windows.h>
-#include <apr_getopt.h>
-#include <apr_file_info.h>
-#include <apr_strings.h>
-#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;
-}
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\r
-<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">\r
- <assemblyIdentity version="1.0.0.0" processorArchitecture="X86" name="<AppName>" type="win32"/>\r
- <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">\r
- <security>\r
- <requestedPrivileges>\r
- <requestedExecutionLevel level="requireAdministrator"/>\r
- </requestedPrivileges>\r
- </security>\r
- </trustInfo>\r
-</assembly>\r
+++ /dev/null
-#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
+++ /dev/null
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="unimrcpservice"
- ProjectGUID="{4714EF49-BFD5-4B22-95F7-95A07F1EAC25}"
- RootNamespace="unimrcpservice"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- <Platform
- Name="x64"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- ConfigurationType="1"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unibin.vsprops;$(ProjectDir)..\..\build\vsprops\apt.vsprops"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="aprtoolkit.lib libaprutil-1.lib libapr-1.lib"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- AdditionalManifestFiles="unimrcpservice.exe.manifest"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- ConfigurationType="1"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unibin.vsprops;$(ProjectDir)..\..\build\vsprops\apt.vsprops"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="aprtoolkit.lib libaprutil-1.lib libapr-1.lib"
- LinkTimeCodeGeneration="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- AdditionalManifestFiles="unimrcpservice.exe.manifest"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|x64"
- ConfigurationType="1"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unibin-x64.vsprops;$(ProjectDir)..\..\build\vsprops\apt.vsprops"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="aprtoolkit.lib libaprutil-1.lib libapr-1.lib"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- AdditionalManifestFiles="unimrcpservice.exe.manifest"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|x64"
- ConfigurationType="1"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unibin-x64.vsprops;$(ProjectDir)..\..\build\vsprops\apt.vsprops"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="aprtoolkit.lib libaprutil-1.lib libapr-1.lib"
- LinkTimeCodeGeneration="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- AdditionalManifestFiles="unimrcpservice.exe.manifest"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="src"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath=".\unimrcp_service.c"
- >
- </File>
- </Filter>
- <File
- RelativePath=".\unimrcpservice.rc"
- >
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCResourceCompilerTool"
- AdditionalIncludeDirectories="..\..\build"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCResourceCompilerTool"
- AdditionalIncludeDirectories="..\..\build"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug|x64"
- >
- <Tool
- Name="VCResourceCompilerTool"
- AdditionalIncludeDirectories="..\..\build"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|x64"
- >
- <Tool
- Name="VCResourceCompilerTool"
- AdditionalIncludeDirectories="..\..\build"
- />
- </FileConfiguration>
- </File>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{4714EF49-BFD5-4B22-95F7-95A07F1EAC25}</ProjectGuid>
- <RootNamespace>unimrcpservice</RootNamespace>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unibin.props" />
- <Import Project="$(ProjectDir)..\..\build\props\apt.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" />
- <Import Project="$(ProjectDir)..\..\build\props\unibin.props" />
- <Import Project="$(ProjectDir)..\..\build\props\apt.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unibin-x64.props" />
- <Import Project="$(ProjectDir)..\..\build\props\apt.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" />
- <Import Project="$(ProjectDir)..\..\build\props\unibin-x64.props" />
- <Import Project="$(ProjectDir)..\..\build\props\apt.props" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <Link>
- <AdditionalDependencies>aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <Link>
- <AdditionalDependencies>aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
- <UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- <Link>
- <AdditionalDependencies>aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <Link>
- <AdditionalDependencies>aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
- <UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
- </Link>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="unimrcp_service.c" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\libs\apr-toolkit\aprtoolkit.vcxproj">
- <Project>{13deeca0-bdd4-4744-a1a2-8eb0a44df3d2}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- </ItemGroup>
- <ItemGroup>
- <ResourceCompile Include="unimrcpservice.rc">
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\build;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\build;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\build;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\build;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- </ResourceCompile>
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="src">
- <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="unimrcp_service.c">
- <Filter>src</Filter>
- </ClCompile>
- </ItemGroup>
- <ItemGroup>
- <ResourceCompile Include="unimrcpservice.rc" />
- </ItemGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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.
- *
- * <a href="http://apr.apache.org/versioning.html"> APR's Version Numbering </a>
- */
-
-/** 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 */
+++ /dev/null
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="apr"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unibase.vsprops"
- >
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(AprDir)\include";"$(AprUtilDir)\include""
- />
- <UserMacro
- Name="AprDir"
- Value="$(LibRootDir)libs\apr"
- />
- <UserMacro
- Name="AprUtilDir"
- Value="$(LibRootDir)libs\apr-util"
- />
- <UserMacro
- Name="AprIconvDir"
- Value="$(LibRootDir)libs\apr-iconv"
- />
-</VisualStudioPropertySheet>
+++ /dev/null
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="apt"
- InheritedPropertySheets="apr.vsprops"
- >
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(ProjectRootDir)libs\apr-toolkit\include""
- PreprocessorDefinitions="APT_STATIC_LIB"
- />
-</VisualStudioPropertySheet>
+++ /dev/null
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="mpf"
- InheritedPropertySheets="apt.vsprops"
- >
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(ProjectRootDir)libs\mpf\include""
- PreprocessorDefinitions="MPF_STATIC_LIB"
- />
-</VisualStudioPropertySheet>
+++ /dev/null
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="mrcp"
- InheritedPropertySheets=".\apt.vsprops"
- >
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(ProjectRootDir)libs\mrcp\include";"$(ProjectRootDir)libs\mrcp\message\include";"$(ProjectRootDir)libs\mrcp\control\include";"$(ProjectRootDir)libs\mrcp\resources\include""
- PreprocessorDefinitions="MRCP_STATIC_LIB"
- />
-</VisualStudioPropertySheet>
+++ /dev/null
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="mrcpclient"
- InheritedPropertySheets=".\mrcpsignaling.vsprops;.\mrcpv2transport.vsprops"
- >
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(ProjectRootDir)libs\mrcp-client\include""
- />
-</VisualStudioPropertySheet>
+++ /dev/null
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="mrcpengine"
- InheritedPropertySheets=".\mpf.vsprops;.\mrcp.vsprops"
- >
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(ProjectRootDir)libs\mrcp-engine\include""
- />
-</VisualStudioPropertySheet>
+++ /dev/null
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="mrcpserver"
- InheritedPropertySheets=".\mrcpengine.vsprops;.\mrcpsignaling.vsprops;.\mrcpv2transport.vsprops"
- >
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(ProjectRootDir)libs\mrcp-server\include""
- />
-</VisualStudioPropertySheet>
+++ /dev/null
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="mrcpsignaling"
- InheritedPropertySheets=".\mpf.vsprops;.\mrcp.vsprops"
- >
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(ProjectRootDir)libs\mrcp-signaling\include""
- />
-</VisualStudioPropertySheet>
+++ /dev/null
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="mrcpv2transport"
- InheritedPropertySheets=".\mrcp.vsprops"
- >
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(ProjectRootDir)libs\mrcpv2-transport\include""
- />
-</VisualStudioPropertySheet>
+++ /dev/null
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="unimrcpclient"
- InheritedPropertySheets="unimrcpsdk.vsprops"
- >
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libunimrcpclient.lib mrcpsofiasip.lib mrcpunirtsp.lib unirtsp.lib mrcpclient.lib mrcpv2transport.lib mrcpsignaling.lib libsofia_sip_ua.lib ws2_32.lib winmm.lib"
- />
-</VisualStudioPropertySheet>
+++ /dev/null
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="unimrcpplugin"
- InheritedPropertySheets="unimrcpsdk.vsprops"
- >
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="mrcpengine.lib"
- />
-</VisualStudioPropertySheet>
+++ /dev/null
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="unimrcpsdk"
- >
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(ProjectRootDir)\include""
- PreprocessorDefinitions="APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalLibraryDirectories=""$(ProjectRootDir)\lib""
- AdditionalDependencies="mrcp.lib mpf.lib aprtoolkit.lib libaprutil-1.lib libapr-1.lib"
- />
- <UserMacro
- Name="ProjectRootDir"
- Value="C:\Program Files\UniMRCP"
- />
-</VisualStudioPropertySheet>
+++ /dev/null
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="unimrcpserver"
- InheritedPropertySheets="unimrcpsdk.vsprops"
- >
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="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"
- />
-</VisualStudioPropertySheet>
+++ /dev/null
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="sofiasip"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unibase.vsprops"
- >
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(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""
- />
- <UserMacro
- Name="SofiaDir"
- Value="$(LibRootDir)libs\sofia-sip"
- />
-</VisualStudioPropertySheet>
+++ /dev/null
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="unibase"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions="WIN32"
- WarningLevel="4"
- WarnAsError="true"
- DisableSpecificWarnings="4100"
- />
- <UserMacro
- Name="ProjectRootDir"
- Value="$(ProjectDir)..\..\"
- />
- <UserMacro
- Name="LibRootDir"
- Value="$(SolutionDir)"
- />
-</VisualStudioPropertySheet>
+++ /dev/null
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="unibin-x64"
- OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)\bin"
- IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
- InheritedPropertySheets="apr.vsprops;sofiasip.vsprops"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions="_WIN64"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalLibraryDirectories="$(AprDir)\$(PlatformName)\$(ConfigurationName);$(AprUtilDir)\$(PlatformName)\$(ConfigurationName);$(SofiaDir)\win32\libsofia-sip-ua\$(PlatformName)\$(ConfigurationName);$(SolutionDir)$(PlatformName)\$(ConfigurationName)\lib;$(SolutionDir)$(PlatformName)\$(ConfigurationName)\bin"
- TargetMachine="17"
- />
-</VisualStudioPropertySheet>
+++ /dev/null
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="unibin"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)\bin"
- IntermediateDirectory="$(ConfigurationName)"
- InheritedPropertySheets="apr.vsprops;sofiasip.vsprops"
- >
- <Tool
- Name="VCLinkerTool"
- AdditionalLibraryDirectories="$(AprDir)\$(ConfigurationName);$(AprUtilDir)\$(ConfigurationName);$(SofiaDir)\win32\libsofia-sip-ua\$(ConfigurationName);$(SolutionDir)$(ConfigurationName)\lib;$(SolutionDir)$(ConfigurationName)\bin"
- TargetMachine="1"
- />
-</VisualStudioPropertySheet>
+++ /dev/null
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="unidebug"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unibase.vsprops"
- >
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- PreprocessorDefinitions="_DEBUG"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCLinkerTool"
- LinkIncremental="2"
- GenerateDebugInformation="true"
- />
-</VisualStudioPropertySheet>
+++ /dev/null
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="unilib-x64"
- OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)\lib"
- IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions="_WIN64"
- />
- <Tool
- Name="VCLinkerTool"
- TargetMachine="17"
- />
-</VisualStudioPropertySheet>
+++ /dev/null
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="unilib"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)\lib"
- IntermediateDirectory="$(ConfigurationName)"
- >
- <Tool
- Name="VCLinkerTool"
- TargetMachine="1"
- />
-</VisualStudioPropertySheet>
+++ /dev/null
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="unimrcpclient"
- InheritedPropertySheets=".\mrcpclient.vsprops;.\sofiasip.vsprops"
- >
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(ProjectRootDir)platforms\libunimrcp-client\include";"$(ProjectRootDir)build""
- />
- <UserMacro
- Name="UniMRCPClientLibs"
- Value="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"
- />
-</VisualStudioPropertySheet>
+++ /dev/null
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="unimrcpserver"
- InheritedPropertySheets=".\mrcpserver.vsprops;.\sofiasip.vsprops"
- >
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(ProjectRootDir)platforms\libunimrcp-server\include";"$(ProjectRootDir)build""
- />
- <UserMacro
- Name="UniMRCPServerLibs"
- Value="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"
- />
-</VisualStudioPropertySheet>
+++ /dev/null
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="uniplugin-x64"
- OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)\plugin"
- IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
- InheritedPropertySheets="apr.vsprops;mrcpengine.vsprops"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions="_WIN64"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalLibraryDirectories="$(AprDir)\$(PlatformName)\$(ConfigurationName);$(AprUtilDir)\$(PlatformName)\$(ConfigurationName);$(SolutionDir)$(PlatformName)\$(ConfigurationName)\lib"
- AdditionalDependencies="mrcpengine.lib mrcp.lib mpf.lib aprtoolkit.lib libaprutil-1.lib libapr-1.lib ws2_32.lib"
- TargetMachine="17"
- />
-</VisualStudioPropertySheet>
+++ /dev/null
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="uniplugin"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)\plugin"
- IntermediateDirectory="$(ConfigurationName)"
- InheritedPropertySheets="apr.vsprops;mrcpengine.vsprops"
- >
- <Tool
- Name="VCLinkerTool"
- AdditionalLibraryDirectories="$(AprDir)\$(ConfigurationName);$(AprUtilDir)\$(ConfigurationName);$(SolutionDir)$(ConfigurationName)\lib"
- AdditionalDependencies="mrcpengine.lib mrcp.lib mpf.lib aprtoolkit.lib libaprutil-1.lib libapr-1.lib ws2_32.lib"
- TargetMachine="1"
- />
-</VisualStudioPropertySheet>
+++ /dev/null
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="unirelease"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unibase.vsprops"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions="NDEBUG;"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- DebugInformationFormat="3"
- />
-</VisualStudioPropertySheet>
+++ /dev/null
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioPropertySheet
- ProjectType="Visual C++"
- Version="8.00"
- Name="unirtsp"
- InheritedPropertySheets="apt.vsprops"
- >
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(ProjectRootDir)libs\uni-rtsp\include""
- PreprocessorDefinitions="RTSP_STATIC_LIB"
- />
-</VisualStudioPropertySheet>
+++ /dev/null
-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
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- UniMRCP client document -->
-<unimrcpclient xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:noNamespaceSchemaLocation="../unimrcpclient.xsd"
- version="1.0">
- <settings>
- <!-- SIP MRCPv2 settings -->
- <sip-settings id="LumenVox-SIP-Settings">
- <!-- Server address should be explicitly specified, it defaults to "ip" address set in the properties. -->
- <!-- <server-ip>10.10.0.1</server-ip> -->
- <server-port>5060</server-port>
- <!-- <force-destination>true</force-destination> -->
- </sip-settings>
-
- <!-- RTSP MRCPv1 settings -->
- <rtsp-settings id="LumenVox-RTSP-Settings">
- <!-- Server address should be explicitly specified, it defaults to "ip" address set in the properties. -->
- <!-- <server-ip>10.10.0.1</server-ip> -->
- <server-port>554</server-port>
- <!-- <force-destination>true</force-destination> -->
- <resource-location></resource-location>
- <resource-map>
- <param name="speechrecog" value="recognizer"/>
- </resource-map>
- </rtsp-settings>
- </settings>
-
- <profiles>
- <!-- LumenVox MRCPv2 profile -->
- <mrcpv2-profile id="lv2">
- <sip-uac>SIP-Agent-1</sip-uac>
- <mrcpv2-uac>MRCPv2-Agent-1</mrcpv2-uac>
- <media-engine>Media-Engine-1</media-engine>
- <rtp-factory>RTP-Factory-1</rtp-factory>
- <sip-settings>LumenVox-SIP-Settings</sip-settings>
- <rtp-settings>RTP-Settings-1</rtp-settings>
- </mrcpv2-profile>
-
- <!-- LumenVox MRCPv1 profile -->
- <mrcpv1-profile id="lv1">
- <rtsp-uac>RTSP-Agent-1</rtsp-uac>
- <media-engine>Media-Engine-1</media-engine>
- <rtp-factory>RTP-Factory-1</rtp-factory>
- <rtsp-settings>LumenVox-RTSP-Settings</rtsp-settings>
- <rtp-settings>RTP-Settings-1</rtp-settings>
- </mrcpv1-profile>
-
- <!-- more profiles might be added here -->
- </profiles>
-</unimrcpclient>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- UniMRCP client document -->
-<unimrcpclient xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:noNamespaceSchemaLocation="../unimrcpclient.xsd"
- version="1.0">
- <settings>
- <!-- SIP MRCPv2 settings -->
- <sip-settings id="Nuance-SIP-Settings">
- <!-- Server address should be explicitly specified, it defaults to "ip" address set in the properties. -->
- <!-- <server-ip>10.10.0.1</server-ip> -->
- <server-port>5060</server-port>
- <!-- <force-destination>true</force-destination> -->
- <!-- <feature-tags>*;+mrcpv2.speechrecog;+mrcpv2.speechrecog.grammars="http://grammars.example.com/biggrammar.gram"</feature-tags> -->
- </sip-settings>
-
- <!-- RTSP MRCPv1 settings -->
- <rtsp-settings id="Nuance-RTSP-Settings">
- <!-- Server address should be explicitly specified, it defaults to "ip" address set in the properties. -->
- <!-- <server-ip>10.10.0.1</server-ip> -->
- <server-port>4900</server-port>
- <!-- <force-destination>true</force-destination> -->
- <resource-location>media</resource-location>
- <resource-map>
- <param name="speechsynth" value="speechsynthesizer"/>
- <param name="speechrecog" value="speechrecognizer"/>
- </resource-map>
- </rtsp-settings>
-
- <!-- RTP/RTCP settings -->
- <rtp-settings id="Nuance-RTP-Settings">
- <jitter-buffer>
- <adaptive>1</adaptive>
- <playout-delay>50</playout-delay>
- <max-playout-delay>600</max-playout-delay>
- <time-skew-detection>1</time-skew-detection>
- </jitter-buffer>
- <ptime>20</ptime>
- <codecs>PCMU PCMA L16/96/8000 telephone-event/101/8000</codecs>
- <!-- enable/disable RTCP support -->
- <rtcp enable="true">
- <!-- RTCP BYE policies (RTCP must be enabled first)
- 0 - disable RTCP BYE
- 1 - send RTCP BYE at the end of session
- 2 - send RTCP BYE also at the end of each talkspurt (input)
- -->
- <rtcp-bye>2</rtcp-bye>
- <!-- rtcp transmission interval in msec (set 0 to disable) -->
- <tx-interval>5000</tx-interval>
- <!-- period (timeout) to check for new rtcp messages in msec (set 0 to disable) -->
- <rx-resolution>1000</rx-resolution>
- </rtcp>
- </rtp-settings>
-
- </settings>
-
- <profiles>
- <!-- Nuance MRCPv2 profile -->
- <mrcpv2-profile id="nss2">
- <sip-uac>SIP-Agent-1</sip-uac>
- <mrcpv2-uac>MRCPv2-Agent-1</mrcpv2-uac>
- <media-engine>Media-Engine-1</media-engine>
- <rtp-factory>RTP-Factory-1</rtp-factory>
- <sip-settings>Nuance-SIP-Settings</sip-settings>
- <rtp-settings>Nuance-RTP-Settings</rtp-settings>
- </mrcpv2-profile>
-
- <!-- Nuance MRCPv1 profile -->
- <mrcpv1-profile id="nss1">
- <rtsp-uac>RTSP-Agent-1</rtsp-uac>
- <media-engine>Media-Engine-1</media-engine>
- <rtp-factory>RTP-Factory-1</rtp-factory>
- <rtsp-settings>Nuance-RTSP-Settings</rtsp-settings>
- <rtp-settings>Nuance-RTP-Settings</rtp-settings>
- </mrcpv1-profile>
-
- <!-- more profiles might be added here -->
- </profiles>
-</unimrcpclient>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- UniMRCP client document -->
-<unimrcpclient xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:noNamespaceSchemaLocation="../unimrcpclient.xsd"
- version="1.0">
- <settings>
- <!-- RTSP MRCPv1 settings -->
- <rtsp-settings id="SpeechPro-RTSP-Settings">
- <!-- Server address should be explicitly specified, it defaults to "ip" address set in the properties. -->
- <!-- <server-ip>10.10.0.1</server-ip> -->
- <server-port>8000</server-port>
- <!-- <force-destination>true</force-destination> -->
- <resource-location></resource-location>
- <resource-map>
- <param name="speechsynth" value="tts"/>
- <param name="speechrecog" value="asr"/>
- </resource-map>
- </rtsp-settings>
- </settings>
-
- <profiles>
- <!-- SpeechPro MRCPv1 profile -->
- <mrcpv1-profile id="sp1">
- <rtsp-uac>RTSP-Agent-1</rtsp-uac>
- <media-engine>Media-Engine-1</media-engine>
- <rtp-factory>RTP-Factory-1</rtp-factory>
- <rtsp-settings>SpeechPro-RTSP-Settings</rtsp-settings>
- <rtp-settings>RTP-Settings-1</rtp-settings>
- </mrcpv1-profile>
-
- <!-- more profiles might be added here -->
- </profiles>
-</unimrcpclient>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- UniMRCP client document -->
-<unimrcpclient xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:noNamespaceSchemaLocation="../unimrcpclient.xsd"
- version="1.0">
- <settings>
- <!-- SIP MRCPv2 settings -->
- <sip-settings id="UniMRCP-SIP-Settings">
- <!-- Server address should be explicitly specified, it defaults to "ip" address set in the properties. -->
- <!-- <server-ip>10.10.0.1</server-ip> -->
- <server-port>8060</server-port>
- <!-- <force-destination>true</force-destination> -->
- </sip-settings>
-
- <!-- RTSP MRCPv1 settings -->
- <rtsp-settings id="UniMRCP-RTSP-Settings">
- <!-- Server address should be explicitly specified, it defaults to "ip" address set in the properties. -->
- <!-- <server-ip>10.10.0.1</server-ip> -->
- <server-port>1554</server-port>
- <!-- <force-destination>true</force-destination> -->
- <resource-location>media</resource-location>
- <resource-map>
- <param name="speechsynth" value="speechsynthesizer"/>
- <param name="speechrecog" value="speechrecognizer"/>
- </resource-map>
- </rtsp-settings>
- </settings>
-
- <profiles>
- <!-- UniMRCP MRCPv2 profile -->
- <mrcpv2-profile id="uni2">
- <sip-uac>SIP-Agent-1</sip-uac>
- <mrcpv2-uac>MRCPv2-Agent-1</mrcpv2-uac>
- <media-engine>Media-Engine-1</media-engine>
- <rtp-factory>RTP-Factory-1</rtp-factory>
- <sip-settings>UniMRCP-SIP-Settings</sip-settings>
- <rtp-settings>RTP-Settings-1</rtp-settings>
- </mrcpv2-profile>
-
- <!-- UniMRCP MRCPv1 profile -->
- <mrcpv1-profile id="uni1">
- <rtsp-uac>RTSP-Agent-1</rtsp-uac>
- <media-engine>Media-Engine-1</media-engine>
- <rtp-factory>RTP-Factory-1</rtp-factory>
- <rtsp-settings>UniMRCP-RTSP-Settings</rtsp-settings>
- <rtp-settings>RTP-Settings-1</rtp-settings>
- </mrcpv1-profile>
-
- <!-- more profiles might be added here -->
- </profiles>
-</unimrcpclient>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Directories Layout
-
-The root element of the document is <dirlayout>, which accepts an optional
-attribute rootdir. The rootdir attribute defaults to "../" and can be specified
-as an absolute or relative path. For instance,
-
- <dirlayout rootdir="../">
- <dirlayout rootdir="C:\unimrcp">
- <dirlayout rootdir="/usr/local/unimrcp">
-
-Each subdirectory can be specified as an absolute path or a name relative to
-the rootdir path. For instance,
-
- <confdir>conf</confdir>
- <confdir>C:\unimrcp\conf</confdir>
- <confdir>/etc/conf</confdir>
--->
-
-<dirlayout>
- <confdir>conf</confdir>
- <plugindir>plugin</plugindir>
- <logdir>log</logdir>
- <datadir>data</datadir>
- <vardir>var</vardir>
-</dirlayout>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Logger Document -->
-<aptlogger>
- <!-- Set the log priority to one of
- EMERGENCY system is unusable
- ALERT action must be taken immediately
- CRITICAL critical condition
- ERROR error condition
- WARNING warning condition
- NOTICE normal, but significant condition
- INFO informational message
- DEBUG debug-level message
- -->
- <priority>INFO</priority>
-
- <!-- Set the log output mode
- CONSOLE console output
- FILE log file output
- CONSOLE,FILE both console and the log file output
- -->
- <output>CONSOLE</output>
-
- <!-- Set the format of the log messages
- DATE date output
- TIME time output
- PRIORITY priority output
- MARK file:line marker output
- THREAD calling thread identifier output
- -->
- <headers>DATE,TIME,PRIORITY</headers>
-
- <!-- Set the log masking mode
- NONE log everything as is
- COMPLETE mask private data completely
- ENCRYPTED enrcypt private data
- -->
- <masking>NONE</masking>
-</aptlogger>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-UniMRCP Client Scenarios.
-There are predefined, named scenarios, which you can customize and use.
-Currently available scenarios are
-1. class="Synthesizer"
-2. class="Recognizer"
-3. class="Recorder"
-4. class="DtmfRecognizer"
-5. class="Params"
-6. class="Verifier"
-
-More than one scenario of the same type (class) can be defined.
-The name (not class) of the scenario is used to run it from console.
-For instance,
-> run synth
--->
-
-<umcscenarios>
- <scenario name="synth" class="Synthesizer" profile="uni2">
- <resource-discovery enable="0"/>
- <speak enable="1" content-type="application/synthesis+ssml" content-location="speak.xml"/>
- <!-- <speak enable="1" content-type="text/plain" content-location="speak.txt"/> -->
-
- <termination enable="1">
- <capabilities>
- <codec name="LPCM" rates="8000 16000"/>
- <!-- <codec name="PCMU" rates="8000 16000"/> -->
- </capabilities>
- </termination>
- <!--
- <rtp-termination enable="1" ip="127.0.0.1" port="5678">
- <codecs="PCMU PCMA L16/96/8000 PCMU/97/16000 telephone-event/101/8000"/>
- </rtp-termination>
- -->
- </scenario>
-
- <scenario name="recog" class="Recognizer" profile="uni2">
- <resource-discovery enable="0"/>
- <define-grammar enable="1" content-type="application/srgs+xml" content-location="grammar.xml"/>
- <!-- <define-grammar enable="1" content-type="application/grammar+xml" content-location="grammar.xml"/> -->
- <!-- <define-grammar enable="1" content-type="application/x-jsgf" content-location="grammar.jsgf"/> -->
- <recognize enable="1"/>
- <!-- <recognize enable="1" audio-source="one-8kHz.pcm"/> -->
- <!-- <recognize enable="1" content-type="application/srgs+xml" content-location="grammar.xml"/> -->
-
- <termination enable="1">
- <capabilities>
- <codec name="LPCM" rates="8000 16000"/>
- <!-- <codec name="PCMU" rates="8000 16000"/> -->
- </capabilities>
- </termination>
- <!--
- <rtp-termination enable="1" ip="127.0.0.1" port="5678">
- <codecs="PCMU PCMA L16/96/8000 PCMU/97/16000 telephone-event/101/8000"/>
- </rtp-termination>
- -->
- </scenario>
-
- <scenario name="rec" class="Recorder" profile="uni2">
- <resource-discovery enable="0"/>
- <record enable="1"/>
-
- <termination enable="1">
- <capabilities>
- <codec name="LPCM" rates="8000 16000"/>
- <!-- <codec name="PCMU" rates="8000 16000"/> -->
- </capabilities>
- </termination>
- <!--
- <rtp-termination enable="1" ip="127.0.0.1" port="5678">
- <codecs="PCMU PCMA L16/96/8000 PCMU/97/16000 telephone-event/101/8000"/>
- </rtp-termination>
- -->
- </scenario>
-
- <scenario name="dtmf" class="DtmfRecognizer" profile="uni2">
- <resource-discovery enable="0"/>
- <recognize enable="1" content-type="text/uri-list" grammar="builtin:dtmf/digits" digits="1234"/> -->
-
- <termination enable="1">
- <capabilities>
- <codec name="LPCM" rates="8000 16000"/>
- <!-- <codec name="PCMU" rates="8000 16000"/> -->
- </capabilities>
- </termination>
- <!--
- <rtp-termination enable="1" ip="127.0.0.1" port="5678">
- <codecs="PCMU PCMA L16/96/8000 PCMU/97/16000 telephone-event/101/8000"/>
- </rtp-termination>
- -->
- </scenario>
-
- <scenario name="params" class="Params" profile="uni2"/>
-
- <scenario name="verify" class="Verifier" profile="uni2">
- <resource-discovery enable="0"/>
- <verify repository-uri="http://www.example.com/voiceprintdbase/" verification-mode="verify" voiceprint-identifier="johnsmith"/>
-
- <termination enable="1">
- <capabilities>
- <codec name="LPCM" rates="8000 16000"/>
- <!-- <codec name="PCMU" rates="8000 16000"/> -->
- </capabilities>
- </termination>
- <!--
- <rtp-termination enable="1" ip="127.0.0.1" port="5678">
- <codecs="PCMU PCMA L16/96/8000 PCMU/97/16000 telephone-event/101/8000"/>
- </rtp-termination>
- -->
- </scenario>
- <!-- It'd be great to have scriptable custom scenarios as well.
- <scenario name="custom" class="UmcXml">
- </scenario>
- -->
-
-</umcscenarios>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- UniMRCP client document -->
-<unimrcpclient xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:noNamespaceSchemaLocation="unimrcpclient.xsd"
- version="1.0"
- subfolder="client-profiles">
- <properties>
- <!-- If the attribute "type" is set to "auto", IP address is
- determined implicitly by the hostname. This is the default setting. -->
- <ip type="auto"/>
-
- <!-- If the attribute "type" is set to "iface", IP address is
- determined by the specified name of network interface/adapter. -->
- <!-- <ip type="iface">eth0</ip>-->
-
- <!-- IP address can also be specified explicitly. -->
- <!-- <ip>10.10.0.1</ip> -->
-
- <!-- <ext-ip>a.b.c.d</ext-ip> -->
- <!-- <server-ip>a.b.c.d</server-ip> -->
- </properties>
-
- <components>
- <!-- Factory of MRCP resources -->
- <resource-factory>
- <resource id="speechsynth" enable="true"/>
- <resource id="speechrecog" enable="true"/>
- <resource id="recorder" enable="true"/>
- <resource id="speakverify" enable="true"/>
- </resource-factory>
-
- <!-- SofiaSIP MRCPv2 signaling agent -->
- <sip-uac id="SIP-Agent-1" type="SofiaSIP">
- <!-- By default, "ip" and "ext-ip" addresses set in the properties will be used.
- They still can be explicitly specified (overriden) here.
- -->
- <!-- <sip-ip>10.10.0.1</sip-ip> -->
- <!-- <sip-ext-ip>a.b.c.d</sip-ext-ip> -->
- <sip-port>8062</sip-port>
- <sip-transport>udp</sip-transport>
- <ua-name>UniMRCP SofiaSIP</ua-name>
- <sdp-origin>UniMRCPClient</sdp-origin>
- <!-- <sip-t1>500</sip-t1> -->
- <!-- <sip-t2>4000</sip-t2> -->
- <!-- <sip-t4>4000</sip-t4> -->
- <!-- <sip-t1x64>32000</sip-t1x64> -->
- <!-- <sip-message-output>true</sip-message-output> -->
- <!-- <sip-message-dump>sofia-sip-uac.log</sip-message-dump> -->
- </sip-uac>
-
- <!-- UniRTSP MRCPv1 signaling agent -->
- <rtsp-uac id="RTSP-Agent-1" type="UniRTSP">
- <max-connection-count>100</max-connection-count>
- <!-- <request-timeout>5000</request-timeout> -->
- <sdp-origin>UniMRCPClient</sdp-origin>
- </rtsp-uac>
-
- <!-- MRCPv2 connection agent -->
- <mrcpv2-uac id="MRCPv2-Agent-1">
- <max-connection-count>100</max-connection-count>
- <offer-new-connection>false</offer-new-connection>
- <rx-buffer-size>1024</rx-buffer-size>
- <tx-buffer-size>1024</tx-buffer-size>
- <!-- <request-timeout>5000</request-timeout> -->
- </mrcpv2-uac>
-
- <!-- Media processing engine -->
- <media-engine id="Media-Engine-1">
- <realtime-rate>1</realtime-rate>
- </media-engine>
-
- <!-- Factory of RTP terminations -->
- <rtp-factory id="RTP-Factory-1">
- <!-- By default, "ip" and "ext-ip" addresses set in the properties will be used.
- They still can be explicitly specified (overriden) here.
- -->
- <!-- <rtp-ip>10.10.0.1</rtp-ip> -->
- <!-- <rtp-ext-ip>a.b.c.d</rtp-ext-ip> -->
- <rtp-port-min>4000</rtp-port-min>
- <rtp-port-max>5000</rtp-port-max>
- </rtp-factory>
- </components>
-
- <settings>
- <!-- common (default) RTP/RTCP settings -->
- <rtp-settings id="RTP-Settings-1">
- <jitter-buffer>
- <adaptive>1</adaptive>
- <playout-delay>50</playout-delay>
- <max-playout-delay>600</max-playout-delay>
- <time-skew-detection>1</time-skew-detection>
- </jitter-buffer>
- <ptime>20</ptime>
- <codecs>PCMU PCMA L16/96/8000 telephone-event/101/8000</codecs>
- <!-- <codecs>PCMU PCMA L16/96/8000 PCMU/97/16000 PCMA/98/16000 L16/99/16000</codecs> -->
- <!-- enable/disable RTCP support -->
- <rtcp enable="false">
- <!-- RTCP BYE policies (RTCP must be enabled first)
- 0 - disable RTCP BYE
- 1 - send RTCP BYE at the end of session
- 2 - send RTCP BYE also at the end of each talkspurt (input)
- -->
- <rtcp-bye>1</rtcp-bye>
- <!-- rtcp transmission interval in msec (set 0 to disable) -->
- <tx-interval>5000</tx-interval>
- <!-- period (timeout) to check for new rtcp messages in msec (set 0 to disable) -->
- <rx-resolution>1000</rx-resolution>
- </rtcp>
- </rtp-settings>
- </settings>
-</unimrcpclient>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
- <xsd:element name="unimrcpclient">
- <xsd:annotation>
- <xsd:documentation>UniMRCP client document</xsd:documentation>
- </xsd:annotation>
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="properties" minOccurs="0">
- <xsd:annotation>
- <xsd:documentation>Generic properties</xsd:documentation>
- </xsd:annotation>
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="ip" minOccurs="0">
- <xsd:complexType>
- <xsd:attribute name="type" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="ext-ip" minOccurs="0">
- <xsd:complexType>
- <xsd:attribute name="type" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="server-ip" minOccurs="0">
- <xsd:complexType>
- <xsd:attribute name="type" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="components" minOccurs="0">
- <xsd:annotation>
- <xsd:documentation>Common components</xsd:documentation>
- </xsd:annotation>
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="resource-factory" minOccurs="0">
- <xsd:annotation>
- <xsd:documentation>Factory of MRCP resources</xsd:documentation>
- </xsd:annotation>
- <xsd:complexType>
- <xsd:sequence maxOccurs="unbounded">
- <xsd:element name="resource">
- <xsd:complexType>
- <xsd:attribute name="id" type="xsd:string" use="required" />
- <xsd:attribute name="enable" type="xsd:boolean" use="optional" />
- </xsd:complexType>
- </xsd:element>
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="sip-uac" minOccurs="0" maxOccurs="unbounded">
- <xsd:annotation>
- <xsd:documentation>SIP signaling agent</xsd:documentation>
- </xsd:annotation>
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="sip-ip" type="xsd:string" minOccurs="0" />
- <xsd:element name="sip-ext-ip" type="xsd:string" minOccurs="0" />
- <xsd:element name="sip-port" type="xsd:short" />
- <xsd:element name="sip-transport" type="xsd:string" />
- <xsd:element name="ua-name" type="xsd:string" minOccurs="0" />
- <xsd:element name="sdp-origin" type="xsd:string" minOccurs="0" />
- <xsd:element name="sip-t1" type="xsd:long" minOccurs="0" />
- <xsd:element name="sip-t2" type="xsd:long" minOccurs="0" />
- <xsd:element name="sip-t4" type="xsd:long" minOccurs="0" />
- <xsd:element name="sip-t1x64" type="xsd:long" minOccurs="0" />
- <xsd:element name="sip-message-output" type="xsd:boolean" />
- <xsd:element name="sip-message-dump" type="xsd:string" />
- </xsd:sequence>
- <xsd:attribute name="id" type="xsd:string" use="required" />
- <xsd:attribute name="type" type="xsd:string" use="required" />
- <xsd:attribute name="enable" type="xsd:boolean" use="optional" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="rtsp-uac" minOccurs="0" maxOccurs="unbounded">
- <xsd:annotation>
- <xsd:documentation>RTSP signaling agent</xsd:documentation>
- </xsd:annotation>
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="max-connection-count" type="xsd:short" minOccurs="0" />
- <xsd:element name="request-timeout" type="xsd:long" minOccurs="0" />
- <xsd:element name="sdp-origin" type="xsd:string" minOccurs="0" />
- </xsd:sequence>
- <xsd:attribute name="id" type="xsd:string" use="required" />
- <xsd:attribute name="type" type="xsd:string" use="required" />
- <xsd:attribute name="enable" type="xsd:boolean" use="optional" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="mrcpv2-uac" minOccurs="0" maxOccurs="unbounded">
- <xsd:annotation>
- <xsd:documentation>MRCPv2 connection agent</xsd:documentation>
- </xsd:annotation>
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="max-connection-count" type="xsd:short" minOccurs="0" />
- <xsd:element name="offer-new-connection" type="xsd:boolean" minOccurs="0" />
- <xsd:element name="rx-buffer-size" type="xsd:long" minOccurs="0" />
- <xsd:element name="tx-buffer-size" type="xsd:long" minOccurs="0" />
- <xsd:element name="request-timeout" type="xsd:long" minOccurs="0" />
- </xsd:sequence>
- <xsd:attribute name="id" type="xsd:string" use="required" />
- <xsd:attribute name="enable" type="xsd:boolean" use="optional" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="media-engine" minOccurs="0" maxOccurs="unbounded">
- <xsd:annotation>
- <xsd:documentation>Media processing engine</xsd:documentation>
- </xsd:annotation>
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="realtime-rate" type="xsd:short" minOccurs="0" />
- </xsd:sequence>
- <xsd:attribute name="id" type="xsd:string" use="required" />
- <xsd:attribute name="enable" type="xsd:boolean" use="optional" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="rtp-factory" minOccurs="0" maxOccurs="unbounded">
- <xsd:annotation>
- <xsd:documentation>Factory of RTP terminations</xsd:documentation>
- </xsd:annotation>
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="rtp-ip" type="xsd:string" minOccurs="0" />
- <xsd:element name="rtp-ext-ip" type="xsd:string" minOccurs="0" />
- <xsd:element name="rtp-port-min" type="xsd:short" />
- <xsd:element name="rtp-port-max" type="xsd:short" />
- </xsd:sequence>
- <xsd:attribute name="id" type="xsd:string" use="required" />
- <xsd:attribute name="enable" type="xsd:boolean" use="optional" />
- </xsd:complexType>
- </xsd:element>
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="settings" minOccurs="0">
- <xsd:annotation>
- <xsd:documentation>Settings</xsd:documentation>
- </xsd:annotation>
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="sip-settings" minOccurs="0" maxOccurs="unbounded">
- <xsd:annotation>
- <xsd:documentation>SIP settings</xsd:documentation>
- </xsd:annotation>
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="server-ip" type="xsd:string" minOccurs="0" />
- <xsd:element name="server-port" type="xsd:short" />
- <xsd:element name="force-destination" type="xsd:boolean" default="false" minOccurs="0" />
- <xsd:element name="feature-tags" type="xsd:string" minOccurs="0" />
- </xsd:sequence>
- <xsd:attribute name="id" type="xsd:string" use="required" />
- <xsd:attribute name="enable" type="xsd:boolean" use="optional" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="rtsp-settings" minOccurs="0" maxOccurs="unbounded">
- <xsd:annotation>
- <xsd:documentation>RTSP settings</xsd:documentation>
- </xsd:annotation>
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="server-ip" type="xsd:string" minOccurs="0" />
- <xsd:element name="server-port" type="xsd:short" />
- <xsd:element name="force-destination" type="xsd:boolean" default="false" minOccurs="0" />
- <xsd:element name="resource-location" type="xsd:string" />
- <xsd:element name="resource-map">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="param" maxOccurs="unbounded">
- <xsd:complexType>
- <xsd:attribute name="name" type="xsd:string" use="required" />
- <xsd:attribute name="value" type="xsd:string" use="required" />
- </xsd:complexType>
- </xsd:element>
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
- </xsd:sequence>
- <xsd:attribute name="id" type="xsd:string" use="required" />
- <xsd:attribute name="enable" type="xsd:boolean" use="optional" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="rtp-settings" minOccurs="0" maxOccurs="unbounded">
- <xsd:annotation>
- <xsd:documentation>RTP settings</xsd:documentation>
- </xsd:annotation>
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="jitter-buffer" minOccurs="0">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="adaptive" type="xsd:byte" />
- <xsd:element name="playout-delay" type="xsd:long" />
- <xsd:element name="max-playout-delay" type="xsd:long" />
- <xsd:element name="time-skew-detection" type="xsd:byte" />
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="ptime" type="xsd:long" minOccurs="0" />
- <xsd:element name="codecs" type="xsd:string" />
- <xsd:element name="rtcp" minOccurs="0">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="rtcp-bye" type="xsd:int" />
- <xsd:element name="tx-interval" type="xsd:long" />
- <xsd:element name="rx-resolution" type="xsd:long" />
- </xsd:sequence>
- <xsd:attribute name="enable" type="xsd:boolean" use="optional" />
- </xsd:complexType>
- </xsd:element>
- </xsd:sequence>
- <xsd:attribute name="id" type="xsd:string" use="required" />
- <xsd:attribute name="enable" type="xsd:boolean" use="optional" />
- </xsd:complexType>
- </xsd:element>
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="profiles" minOccurs="0">
- <xsd:annotation>
- <xsd:documentation>Profiles</xsd:documentation>
- </xsd:annotation>
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="mrcpv2-profile" minOccurs="0" maxOccurs="unbounded">
- <xsd:annotation>
- <xsd:documentation>MRCPv2 profile</xsd:documentation>
- </xsd:annotation>
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="sip-uac" type="xsd:string" />
- <xsd:element name="mrcpv2-uac" type="xsd:string" />
- <xsd:element name="media-engine" type="xsd:string" />
- <xsd:element name="rtp-factory" type="xsd:string" />
- <xsd:element name="sip-settings" type="xsd:string" />
- <xsd:element name="rtp-settings" type="xsd:string" />
- </xsd:sequence>
- <xsd:attribute name="id" type="xsd:string" use="required" />
- <xsd:attribute name="enable" type="xsd:boolean" use="optional" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="mrcpv1-profile" minOccurs="0" maxOccurs="unbounded">
- <xsd:annotation>
- <xsd:documentation>MRCPv1 profile</xsd:documentation>
- </xsd:annotation>
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="rtsp-uac" type="xsd:string" />
- <xsd:element name="media-engine" type="xsd:string" />
- <xsd:element name="rtp-factory" type="xsd:string" />
- <xsd:element name="rtsp-settings" type="xsd:string" />
- <xsd:element name="rtp-settings" type="xsd:string" />
- </xsd:sequence>
- <xsd:attribute name="id" type="xsd:string" use="required" />
- <xsd:attribute name="enable" type="xsd:boolean" use="optional" />
- </xsd:complexType>
- </xsd:element>
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="misc" minOccurs="0">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="sofiasip-logger" type="xsd:string" />
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
- </xsd:sequence>
- <xsd:attribute name="version" type="xsd:string" use="required" />
- <xsd:attribute name="subfolder" type="xsd:string" use="optional" />
- </xsd:complexType>
- </xsd:element>
-</xsd:schema>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- UniMRCP server document -->
-<unimrcpserver xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="unimrcpserver.xsd" version="1.0">
- <properties>
- <!-- If the attribute "type" is set to "auto", IP address is
- determined implicitly by the hostname. This is the default setting. -->
- <ip type="auto"/>
-
- <!-- If the attribute "type" is set to "iface", IP address is
- determined by the specified name of network interface/adapter. -->
- <!-- <ip type="iface">eth0</ip>-->
-
- <!-- IP address can also be specified explicitly. -->
- <!-- <ip>10.10.0.1</ip> -->
-
- <!-- <ext-ip>a.b.c.d</ext-ip> -->
- </properties>
-
- <components>
- <!-- Factory of MRCP resources -->
- <resource-factory>
- <resource id="speechsynth" enable="true"/>
- <resource id="speechrecog" enable="true"/>
- <resource id="recorder" enable="true"/>
- <resource id="speakverify" enable="true"/>
- </resource-factory>
-
- <!-- SofiaSIP MRCPv2 signaling agent -->
- <sip-uas id="SIP-Agent-1" type="SofiaSIP">
- <!-- By default, "ip" and "ext-ip" addresses set in the properties will be used.
- They still can be explicitly specified (overriden) here.
- -->
- <!-- <sip-ip>10.10.0.1</sip-ip> -->
- <!-- <sip-ext-ip>a.b.c.d</sip-ext-ip> -->
- <sip-port>8060</sip-port>
- <sip-transport>udp,tcp</sip-transport>
- <!-- <force-destination>true</force-destination> -->
- <ua-name>UniMRCP SofiaSIP</ua-name>
- <sdp-origin>UniMRCPServer</sdp-origin>
- <!-- <sip-t1>500</sip-t1> -->
- <!-- <sip-t2>4000</sip-t2> -->
- <!-- <sip-t4>4000</sip-t4> -->
- <!-- <sip-t1x64>32000</sip-t1x64> -->
- <!-- <sip-message-output>true</sip-message-output> -->
- <!-- <sip-message-dump>sofia-sip-uas.log</sip-message-dump> -->
- </sip-uas>
-
- <!-- UniRTSP MRCPv1 signaling agent -->
- <rtsp-uas id="RTSP-Agent-1" type="UniRTSP">
- <!-- By default, "ip" and "ext-ip" addresses set in the properties will be used.
- They still can be explicitly specified (overriden) here.
- -->
- <!-- <rtsp-ip>10.10.0.1</rtsp-ip> -->
- <!-- <rtsp-ext-ip>a.b.c.d</rtsp-ext-ip> -->
- <rtsp-port>1554</rtsp-port>
- <!-- <force-destination>true</force-destination> -->
- <resource-map>
- <param name="speechsynth" value="speechsynthesizer"/>
- <param name="speechrecog" value="speechrecognizer"/>
- </resource-map>
- <max-connection-count>100</max-connection-count>
- <sdp-origin>UniMRCPServer</sdp-origin>
- </rtsp-uas>
-
- <!-- MRCPv2 connection agent -->
- <mrcpv2-uas id="MRCPv2-Agent-1">
- <!-- By default, "ip" set in the properties will be used.
- It still can be explicitly specified (overriden) here.
- -->
- <!-- <mrcp-ip>10.10.0.1</mrcp-ip> -->
- <mrcp-port>1544</mrcp-port>
- <max-connection-count>100</max-connection-count>
- <force-new-connection>false</force-new-connection>
- <rx-buffer-size>1024</rx-buffer-size>
- <tx-buffer-size>1024</tx-buffer-size>
- </mrcpv2-uas>
-
- <!-- Media processing engine -->
- <media-engine id="Media-Engine-1">
- <realtime-rate>1</realtime-rate>
- </media-engine>
-
- <!-- Factory of RTP terminations -->
- <rtp-factory id="RTP-Factory-1">
- <!-- By default, "ip" and "ext-ip" addresses set in the properties will be used.
- They still can be explicitly specified (overriden) here.
- -->
- <!-- <rtp-ip>10.10.0.1</rtp-ip> -->
- <!-- <rtp-ext-ip>a.b.c.d</rtp-ext-ip> -->
- <rtp-port-min>5000</rtp-port-min>
- <rtp-port-max>6000</rtp-port-max>
- </rtp-factory>
-
- <!-- Factory of plugins (MRCP engines) -->
- <plugin-factory>
- <engine id="Demo-Synth-1" name="demosynth" enable="true"/>
- <engine id="Demo-Recog-1" name="demorecog" enable="true"/>
- <engine id="Demo-Verifier-1" name="demoverifier" enable="true"/>
- <engine id="Recorder-1" name="mrcprecorder" enable="true"/>
-
- <!-- Engines may have additional named and generic params
- <engine id="Your-Engine-1" name="yourengine" enable="false">
- <max-channel-count>100</max-channel-count>
- <param name="..." value="..."/>
- </engine>
- -->
- </plugin-factory>
- </components>
-
- <settings>
- <!-- RTP/RTCP settings -->
- <rtp-settings id="RTP-Settings-1">
- <jitter-buffer>
- <adaptive>1</adaptive>
- <playout-delay>50</playout-delay>
- <max-playout-delay>600</max-playout-delay>
- <time-skew-detection>1</time-skew-detection>
- </jitter-buffer>
- <ptime>20</ptime>
- <codecs own-preference="false">PCMU PCMA L16/96/8000 telephone-event/101/8000</codecs>
- <!-- <codecs own-preference="false">PCMU PCMA L16/96/8000 PCMU/97/16000 PCMA/98/16000 L16/99/16000</codecs> -->
- <!-- enable/disable RTCP support -->
- <rtcp enable="false">
- <!-- RTCP BYE policies (RTCP must be enabled first)
- 0 - disable RTCP BYE
- 1 - send RTCP BYE at the end of session
- 2 - send RTCP BYE also at the end of each talkspurt (input)
- -->
- <rtcp-bye>1</rtcp-bye>
- <!-- rtcp transmission interval in msec (set 0 to disable) -->
- <tx-interval>5000</tx-interval>
- <!-- period (timeout) to check for new rtcp messages in msec (set 0 to disable) -->
- <rx-resolution>1000</rx-resolution>
- </rtcp>
- </rtp-settings>
- </settings>
-
-
- <profiles>
- <!-- MRCPv2 default profile -->
- <mrcpv2-profile id="uni2">
- <sip-uas>SIP-Agent-1</sip-uas>
- <mrcpv2-uas>MRCPv2-Agent-1</mrcpv2-uas>
- <media-engine>Media-Engine-1</media-engine>
- <rtp-factory>RTP-Factory-1</rtp-factory>
- <rtp-settings>RTP-Settings-1</rtp-settings>
-
- <!-- It's possible to define profile based map of resources and engines.
- <resource-engine-map>
- <param name="speechsynth" value="Flite-1"/>
- <param name="speechrecog" value="PocketSphinx-1"/>
- </resource-engine-map>
- -->
- </mrcpv2-profile>
-
- <!-- MRCPv1 default profile -->
- <mrcpv1-profile id="uni1">
- <rtsp-uas>RTSP-Agent-1</rtsp-uas>
- <media-engine>Media-Engine-1</media-engine>
- <rtp-factory>RTP-Factory-1</rtp-factory>
- <rtp-settings>RTP-Settings-1</rtp-settings>
- </mrcpv1-profile>
-
- <!-- more profiles might be added here -->
- </profiles>
-</unimrcpserver>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
- <xsd:element name="unimrcpserver">
- <xsd:annotation>
- <xsd:documentation>UniMRCP server document</xsd:documentation>
- </xsd:annotation>
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="properties" minOccurs="0">
- <xsd:annotation>
- <xsd:documentation>Generic properties</xsd:documentation>
- </xsd:annotation>
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="ip" minOccurs="0">
- <xsd:complexType>
- <xsd:attribute name="type" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="ext-ip" minOccurs="0">
- <xsd:complexType>
- <xsd:attribute name="type" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="components" minOccurs="0">
- <xsd:annotation>
- <xsd:documentation>Common components</xsd:documentation>
- </xsd:annotation>
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="resource-factory" minOccurs="0">
- <xsd:annotation>
- <xsd:documentation>Factory of MRCP resources</xsd:documentation>
- </xsd:annotation>
- <xsd:complexType>
- <xsd:sequence maxOccurs="unbounded">
- <xsd:element name="resource">
- <xsd:complexType>
- <xsd:attribute name="id" type="xsd:string" use="required" />
- <xsd:attribute name="enable" type="xsd:boolean" use="optional" />
- </xsd:complexType>
- </xsd:element>
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="sip-uas" minOccurs="0" maxOccurs="unbounded">
- <xsd:annotation>
- <xsd:documentation>SIP signaling agent</xsd:documentation>
- </xsd:annotation>
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="sip-ip" type="xsd:string" minOccurs="0" />
- <xsd:element name="sip-ext-ip" type="xsd:string" minOccurs="0" />
- <xsd:element name="sip-port" type="xsd:short" />
- <xsd:element name="sip-transport" type="xsd:string" />
- <xsd:element name="force-destination" type="xsd:boolean" default="false" minOccurs="0" />
- <xsd:element name="ua-name" type="xsd:string" minOccurs="0" />
- <xsd:element name="sdp-origin" type="xsd:string" minOccurs="0" />
- <xsd:element name="sip-t1" type="xsd:long" minOccurs="0" />
- <xsd:element name="sip-t2" type="xsd:long" minOccurs="0" />
- <xsd:element name="sip-t4" type="xsd:long" minOccurs="0" />
- <xsd:element name="sip-t1x64" type="xsd:long" minOccurs="0" />
- <xsd:element name="sip-message-output" type="xsd:boolean" />
- <xsd:element name="sip-message-dump" type="xsd:string" />
- </xsd:sequence>
- <xsd:attribute name="id" type="xsd:string" use="required" />
- <xsd:attribute name="type" type="xsd:string" use="required" />
- <xsd:attribute name="enable" type="xsd:boolean" use="optional" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="rtsp-uas" minOccurs="0" maxOccurs="unbounded">
- <xsd:annotation>
- <xsd:documentation>RTSP signaling agent</xsd:documentation>
- </xsd:annotation>
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="rtsp-ip" type="xsd:string" minOccurs="0" />
- <xsd:element name="rtsp-ext-ip" type="xsd:string" minOccurs="0" />
- <xsd:element name="rtsp-port" type="xsd:string" />
- <xsd:element name="resource-map">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="param" maxOccurs="unbounded">
- <xsd:complexType>
- <xsd:attribute name="name" type="xsd:string" use="required" />
- <xsd:attribute name="value" type="xsd:string" use="required" />
- </xsd:complexType>
- </xsd:element>
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="max-connection-count" type="xsd:short" minOccurs="0" />
- <xsd:element name="sdp-origin" type="xsd:string" minOccurs="0" />
- </xsd:sequence>
- <xsd:attribute name="id" type="xsd:string" use="required" />
- <xsd:attribute name="type" type="xsd:string" use="required" />
- <xsd:attribute name="enable" type="xsd:boolean" use="optional" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="mrcpv2-uas" minOccurs="0" maxOccurs="unbounded">
- <xsd:annotation>
- <xsd:documentation>MRCPv2 connection agent</xsd:documentation>
- </xsd:annotation>
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="mrcp-ip" type="xsd:string" minOccurs="0" />
- <xsd:element name="mrcp-port" type="xsd:string" />
- <xsd:element name="max-connection-count" type="xsd:short" minOccurs="0" />
- <xsd:element name="force-new-connection" type="xsd:boolean" minOccurs="0" />
- <xsd:element name="rx-buffer-size" type="xsd:long" minOccurs="0" />
- <xsd:element name="tx-buffer-size" type="xsd:long" minOccurs="0" />
- </xsd:sequence>
- <xsd:attribute name="id" type="xsd:string" use="required" />
- <xsd:attribute name="enable" type="xsd:boolean" use="optional" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="media-engine" minOccurs="0" maxOccurs="unbounded">
- <xsd:annotation>
- <xsd:documentation>Media processing engine</xsd:documentation>
- </xsd:annotation>
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="realtime-rate" type="xsd:short" minOccurs="0" />
- </xsd:sequence>
- <xsd:attribute name="id" type="xsd:string" use="required" />
- <xsd:attribute name="enable" type="xsd:boolean" use="optional" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="rtp-factory" minOccurs="0" maxOccurs="unbounded">
- <xsd:annotation>
- <xsd:documentation>Factory of RTP terminations</xsd:documentation>
- </xsd:annotation>
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="rtp-ip" type="xsd:string" minOccurs="0" />
- <xsd:element name="rtp-ext-ip" type="xsd:string" minOccurs="0" />
- <xsd:element name="rtp-port-min" type="xsd:short" />
- <xsd:element name="rtp-port-max" type="xsd:short" />
- </xsd:sequence>
- <xsd:attribute name="id" type="xsd:string" use="required" />
- <xsd:attribute name="enable" type="xsd:boolean" use="optional" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="plugin-factory" minOccurs="0">
- <xsd:annotation>
- <xsd:documentation>Factory of plugins (MRCP engines)</xsd:documentation>
- </xsd:annotation>
- <xsd:complexType>
- <xsd:sequence maxOccurs="unbounded">
- <xsd:element name="engine">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="max-channel-count" minOccurs="0" />
- <xsd:element name="param" minOccurs="0" maxOccurs="unbounded">
- <xsd:complexType>
- <xsd:attribute name="name" type="xsd:string" use="required" />
- <xsd:attribute name="value" type="xsd:string" use="required" />
- </xsd:complexType>
- </xsd:element>
- </xsd:sequence>
- <xsd:attribute name="id" type="xsd:string" use="required" />
- <xsd:attribute name="name" type="xsd:string" use="required" />
- <xsd:attribute name="enable" type="xsd:boolean" use="optional" />
- </xsd:complexType>
- </xsd:element>
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="settings" minOccurs="0">
- <xsd:annotation>
- <xsd:documentation>Settings</xsd:documentation>
- </xsd:annotation>
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="rtp-settings" minOccurs="0" maxOccurs="unbounded">
- <xsd:annotation>
- <xsd:documentation>RTP settings</xsd:documentation>
- </xsd:annotation>
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="jitter-buffer" minOccurs="0">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="adaptive" type="xsd:byte" />
- <xsd:element name="playout-delay" type="xsd:long" />
- <xsd:element name="max-playout-delay" type="xsd:long" />
- <xsd:element name="time-skew-detection" type="xsd:byte" />
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="ptime" type="xsd:long" minOccurs="0" />
- <xsd:element name="codecs">
- <xsd:complexType>
- <xsd:simpleContent>
- <xsd:extension base="xsd:string">
- <xsd:attribute name="own-preference" type="xsd:boolean" use="optional" />
- </xsd:extension>
- </xsd:simpleContent>
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="rtcp" minOccurs="0">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="rtcp-bye" type="xsd:int" />
- <xsd:element name="tx-interval" type="xsd:long" />
- <xsd:element name="rx-resolution" type="xsd:long" />
- </xsd:sequence>
- <xsd:attribute name="enable" type="xsd:boolean" use="optional" />
- </xsd:complexType>
- </xsd:element>
- </xsd:sequence>
- <xsd:attribute name="id" type="xsd:string" use="required" />
- <xsd:attribute name="enable" type="xsd:boolean" use="optional" />
- </xsd:complexType>
- </xsd:element>
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="profiles" minOccurs="0">
- <xsd:annotation>
- <xsd:documentation>Profiles</xsd:documentation>
- </xsd:annotation>
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="mrcpv2-profile" minOccurs="0" maxOccurs="unbounded">
- <xsd:annotation>
- <xsd:documentation>MRCPv2 profile</xsd:documentation>
- </xsd:annotation>
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="sip-uas" type="xsd:string" />
- <xsd:element name="mrcpv2-uas" type="xsd:string" />
- <xsd:element name="media-engine" type="xsd:string" />
- <xsd:element name="rtp-factory" type="xsd:string" />
- <xsd:element name="rtp-settings" type="xsd:string" />
- </xsd:sequence>
- <xsd:attribute name="id" type="xsd:string" use="required" />
- <xsd:attribute name="enable" type="xsd:boolean" use="optional" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="mrcpv1-profile" minOccurs="0" maxOccurs="unbounded">
- <xsd:annotation>
- <xsd:documentation>MRCPv1 profile</xsd:documentation>
- </xsd:annotation>
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="rtsp-uas" type="xsd:string" />
- <xsd:element name="media-engine" type="xsd:string" />
- <xsd:element name="rtp-factory" type="xsd:string" />
- <xsd:element name="rtp-settings" type="xsd:string" />
- </xsd:sequence>
- <xsd:attribute name="id" type="xsd:string" use="required" />
- <xsd:attribute name="enable" type="xsd:boolean" use="optional" />
- </xsd:complexType>
- </xsd:element>
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="misc" minOccurs="0">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="sofiasip-logger" type="xsd:string" />
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
- </xsd:sequence>
- <xsd:attribute name="version" type="xsd:string" use="required" />
- <xsd:attribute name="subfolder" type="xsd:string" use="optional" />
- </xsd:complexType>
- </xsd:element>
-</xsd:schema>
\ No newline at end of file
+++ /dev/null
-##
-## 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.
-<Layout classic>
- 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}
-</Layout>
+++ /dev/null
-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 '********************************************************************'
+++ /dev/null
-#! /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
+++ /dev/null
-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
+++ /dev/null
-#JSGF V1.0;
-grammar digits;
-public <numbers> = (one | two | three);
+++ /dev/null
-
---break
-Content-Type:text/uri-list
-Content-Length: 22
-
-builtin:grammar/digits
-
---break
-Content-Type:application/srgs+xml
-Content-Length: 230
-
-<?xml version="1.0"?>
-<grammar root="digit" version="1.0" xml:lang="en-US"
- xmlns="http://www.w3.org/2001/06/grammar">
- <rule id="digit" scope="public">
- <item>one two three four five</item>
- </rule>
-</grammar>
---break--
\ No newline at end of file
+++ /dev/null
-#ABNF 1.0;
-language en-US;
-mode voice;
-public $digit = one | two | three;
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0"?>
-<grammar xmlns="http://www.w3.org/2001/06/grammar" xml:lang="en-US" version="1.0" mode="voice" root="digit">
- <rule id="digit">
- <one-of>
- <item>one</item>
- <item>two</item>
- <item>three</item>
- </one-of>
- </rule>
-</grammar>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0"?>
-<result>
- <verification-result>
- <voiceprint id="johnsmith">
- <incremental>
- <utterance-length> 500 </utterance-length>
- <device> cellular-phone </device>
- <gender> male </gender>
- <decision> accepted </decision>
- <verification-score> 0.85 </verification-score>
- </incremental>
- <cumulative>
- <utterance-length> 1500 </utterance-length>
- <device> cellular-phone </device>
- <gender> male </gender>
- <decision> accepted </decision>
- <verification-score> 0.75 </verification-score>
- </cumulative>
- </voiceprint>
- </verification-result>
-</result>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0"?>
-<result>
- <interpretation grammar="session:request1@form-level.store" confidence="0.97">
- <instance>one</instance>
- <input mode="speech">one</input>
- </interpretation>
-</result>
\ No newline at end of file
+++ /dev/null
-Welcome to Uni MRCP.
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0"?>
-<speak version="1.0" xml:lang="en-US" xmlns="http://www.w3.org/2001/10/synthesis">
- <p>
- <s>Welcome to Uni MRCP.</s>
- </p>
-</speak>
\ No newline at end of file
+++ /dev/null
-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
+++ /dev/null
-/**
-@mainpage UniMRCP API Reference
-
-<br>
-@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++
-<br>
-<br>
-@section _ Source Tree Structure
-
-<br>
-@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.
-
-<br>
-@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.
-
-<br>
-@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.
-
-<br>
-@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.
-
-<br>
-@section Dependencies
-
-- <a href="http://apr.apache.org"> APR - Apache Portable Runtime Library </a>
-- <a href="http://sofia-sip.sourceforge.net"> Sofia-SIP - SIP User Agent Library </a>
-
-<br>
-@section Project Links
-
-- <a href="http://www.unimrcp.org"> Website </a>
-- <a href="http://www.unimrcp.org/downloads"> Downloads </a>
-- <a href="http://www.unimrcp.org/documentation"> Documentation </a>
-- <a href="http://code.google.com/p/unimrcp/issues/list"> Issue Tracker </a>
-- <a href="http://groups.google.com/group/unimrcp"> Discussion Group </a>
-<br>
-
-*/
+++ /dev/null
-MAINTAINERCLEANFILES = Makefile.in
-
-SUBDIRS = apr-toolkit mpf mrcp mrcp-signaling mrcpv2-transport mrcp-engine mrcp-server mrcp-client uni-rtsp
+++ /dev/null
-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
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectName>aprtoolkit</ProjectName>
- <ProjectGuid>{13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}</ProjectGuid>
- <RootNamespace>aprtoolkit</RootNamespace>
- <Keyword>Win32Proj</Keyword>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />
- <Import Project="$(ProjectDir)..\..\build\props\apt.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.props" />
- <Import Project="$(ProjectDir)..\..\build\props\apt.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />
- <Import Project="$(ProjectDir)..\..\build\props\apt.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.props" />
- <Import Project="$(ProjectDir)..\..\build\props\apt.props" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(PlatformName)\$(Configuration)\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(PlatformName)\$(Configuration)\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(PlatformName)\$(Configuration)\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(PlatformName)\$(Configuration)\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(PlatformName)\$(Configuration)\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(PlatformName)\$(Configuration)\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(PlatformName)\$(Configuration)\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(PlatformName)\$(Configuration)\</IntDir>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <PreprocessorDefinitions>APT_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <PreprocessorDefinitions>APT_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <PreprocessorDefinitions>APT_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <PreprocessorDefinitions>APT_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClInclude Include="include\apt.h" />
- <ClInclude Include="include\apt_consumer_task.h" />
- <ClInclude Include="include\apt_cyclic_queue.h" />
- <ClInclude Include="include\apt_dir_layout.h" />
- <ClInclude Include="include\apt_header_field.h" />
- <ClInclude Include="include\apt_log.h" />
- <ClInclude Include="include\apt_multipart_content.h" />
- <ClInclude Include="include\apt_net.h" />
- <ClInclude Include="include\apt_nlsml_doc.h" />
- <ClInclude Include="include\apt_obj_list.h" />
- <ClInclude Include="include\apt_pair.h" />
- <ClInclude Include="include\apt_pollset.h" />
- <ClInclude Include="include\apt_poller_task.h" />
- <ClInclude Include="include\apt_pool.h" />
- <ClInclude Include="include\apt_string.h" />
- <ClInclude Include="include\apt_string_table.h" />
- <ClInclude Include="include\apt_task.h" />
- <ClInclude Include="include\apt_task_msg.h" />
- <ClInclude Include="include\apt_test_suite.h" />
- <ClInclude Include="include\apt_text_message.h" />
- <ClInclude Include="include\apt_text_stream.h" />
- <ClInclude Include="include\apt_time_queue.h" />
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="src\apt_consumer_task.c" />
- <ClCompile Include="src\apt_cyclic_queue.c" />
- <ClCompile Include="src\apt_dir_layout.c" />
- <ClCompile Include="src\apt_header_field.c" />
- <ClCompile Include="src\apt_log.c" />
- <ClCompile Include="src\apt_multipart_content.c" />
- <ClCompile Include="src\apt_net.c" />
- <ClCompile Include="src\apt_nlsml_doc.c" />
- <ClCompile Include="src\apt_obj_list.c" />
- <ClCompile Include="src\apt_pair.c" />
- <ClCompile Include="src\apt_poller_task.c" />
- <ClCompile Include="src\apt_pollset.c" />
- <ClCompile Include="src\apt_pool.c" />
- <ClCompile Include="src\apt_string_table.c" />
- <ClCompile Include="src\apt_task.c" />
- <ClCompile Include="src\apt_task_msg.c" />
- <ClCompile Include="src\apt_test_suite.c" />
- <ClCompile Include="src\apt_text_message.c" />
- <ClCompile Include="src\apt_text_stream.c" />
- <ClCompile Include="src\apt_timer_queue.c" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\..\win32\apr-util\libaprutil.2017.vcxproj">
- <Project>{f057da7f-79e5-4b00-845c-ef446ef055e3}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="aprtoolkit"
- ProjectGUID="{13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}"
- RootNamespace="aprtoolkit"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- <Platform
- Name="x64"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- ConfigurationType="4"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unilib.vsprops;$(ProjectDir)..\..\build\vsprops\apt.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- ConfigurationType="4"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unilib.vsprops;$(ProjectDir)..\..\build\vsprops\apt.vsprops"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|x64"
- ConfigurationType="4"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unilib-x64.vsprops;$(ProjectDir)..\..\build\vsprops\apt.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|x64"
- ConfigurationType="4"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unilib-x64.vsprops;$(ProjectDir)..\..\build\vsprops\apt.vsprops"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="include"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- <File
- RelativePath=".\include\apt.h"
- >
- </File>
- <File
- RelativePath=".\include\apt_consumer_task.h"
- >
- </File>
- <File
- RelativePath=".\include\apt_cyclic_queue.h"
- >
- </File>
- <File
- RelativePath=".\include\apt_dir_layout.h"
- >
- </File>
- <File
- RelativePath=".\include\apt_header_field.h"
- >
- </File>
- <File
- RelativePath=".\include\apt_log.h"
- >
- </File>
- <File
- RelativePath=".\include\apt_multipart_content.h"
- >
- </File>
- <File
- RelativePath=".\include\apt_net.h"
- >
- </File>
- <File
- RelativePath=".\include\apt_nlsml_doc.h"
- >
- </File>
- <File
- RelativePath=".\include\apt_obj_list.h"
- >
- </File>
- <File
- RelativePath=".\include\apt_pair.h"
- >
- </File>
- <File
- RelativePath=".\include\apt_poller_task.h"
- >
- </File>
- <File
- RelativePath=".\include\apt_pollset.h"
- >
- </File>
- <File
- RelativePath=".\include\apt_pool.h"
- >
- </File>
- <File
- RelativePath=".\include\apt_string.h"
- >
- </File>
- <File
- RelativePath=".\include\apt_string_table.h"
- >
- </File>
- <File
- RelativePath=".\include\apt_task.h"
- >
- </File>
- <File
- RelativePath=".\include\apt_task_msg.h"
- >
- </File>
- <File
- RelativePath=".\include\apt_test_suite.h"
- >
- </File>
- <File
- RelativePath=".\include\apt_text_message.h"
- >
- </File>
- <File
- RelativePath=".\include\apt_text_stream.h"
- >
- </File>
- <File
- RelativePath=".\include\apt_timer_queue.h"
- >
- </File>
- </Filter>
- <Filter
- Name="src"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- >
- <File
- RelativePath=".\src\apt_consumer_task.c"
- >
- </File>
- <File
- RelativePath=".\src\apt_cyclic_queue.c"
- >
- </File>
- <File
- RelativePath=".\src\apt_dir_layout.c"
- >
- </File>
- <File
- RelativePath=".\src\apt_header_field.c"
- >
- </File>
- <File
- RelativePath=".\src\apt_log.c"
- >
- </File>
- <File
- RelativePath=".\src\apt_multipart_content.c"
- >
- </File>
- <File
- RelativePath=".\src\apt_net.c"
- >
- </File>
- <File
- RelativePath=".\src\apt_nlsml_doc.c"
- >
- </File>
- <File
- RelativePath=".\src\apt_obj_list.c"
- >
- </File>
- <File
- RelativePath=".\src\apt_pair.c"
- >
- </File>
- <File
- RelativePath=".\src\apt_poller_task.c"
- >
- </File>
- <File
- RelativePath=".\src\apt_pollset.c"
- >
- </File>
- <File
- RelativePath=".\src\apt_pool.c"
- >
- </File>
- <File
- RelativePath=".\src\apt_string_table.c"
- >
- </File>
- <File
- RelativePath=".\src\apt_task.c"
- >
- </File>
- <File
- RelativePath=".\src\apt_task_msg.c"
- >
- </File>
- <File
- RelativePath=".\src\apt_test_suite.c"
- >
- </File>
- <File
- RelativePath=".\src\apt_text_message.c"
- >
- </File>
- <File
- RelativePath=".\src\apt_text_stream.c"
- >
- </File>
- <File
- RelativePath=".\src\apt_timer_queue.c"
- >
- </File>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}</ProjectGuid>
- <RootNamespace>aprtoolkit</RootNamespace>
- <Keyword>Win32Proj</Keyword>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unilib.props" />
- <Import Project="$(ProjectDir)..\..\build\props\apt.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" />
- <Import Project="$(ProjectDir)..\..\build\props\unilib.props" />
- <Import Project="$(ProjectDir)..\..\build\props\apt.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unilib-x64.props" />
- <Import Project="$(ProjectDir)..\..\build\props\apt.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" />
- <Import Project="$(ProjectDir)..\..\build\props\unilib-x64.props" />
- <Import Project="$(ProjectDir)..\..\build\props\apt.props" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
- </PropertyGroup>
- <ItemDefinitionGroup>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClInclude Include="include\apt.h" />
- <ClInclude Include="include\apt_consumer_task.h" />
- <ClInclude Include="include\apt_cyclic_queue.h" />
- <ClInclude Include="include\apt_dir_layout.h" />
- <ClInclude Include="include\apt_header_field.h" />
- <ClInclude Include="include\apt_log.h" />
- <ClInclude Include="include\apt_multipart_content.h" />
- <ClInclude Include="include\apt_net.h" />
- <ClInclude Include="include\apt_nlsml_doc.h" />
- <ClInclude Include="include\apt_obj_list.h" />
- <ClInclude Include="include\apt_pair.h" />
- <ClInclude Include="include\apt_poller_task.h" />
- <ClInclude Include="include\apt_pollset.h" />
- <ClInclude Include="include\apt_pool.h" />
- <ClInclude Include="include\apt_string.h" />
- <ClInclude Include="include\apt_string_table.h" />
- <ClInclude Include="include\apt_task.h" />
- <ClInclude Include="include\apt_task_msg.h" />
- <ClInclude Include="include\apt_test_suite.h" />
- <ClInclude Include="include\apt_text_message.h" />
- <ClInclude Include="include\apt_text_stream.h" />
- <ClInclude Include="include\apt_timer_queue.h" />
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="src\apt_consumer_task.c" />
- <ClCompile Include="src\apt_cyclic_queue.c" />
- <ClCompile Include="src\apt_dir_layout.c" />
- <ClCompile Include="src\apt_header_field.c" />
- <ClCompile Include="src\apt_log.c" />
- <ClCompile Include="src\apt_multipart_content.c" />
- <ClCompile Include="src\apt_net.c" />
- <ClCompile Include="src\apt_nlsml_doc.c" />
- <ClCompile Include="src\apt_obj_list.c" />
- <ClCompile Include="src\apt_pair.c" />
- <ClCompile Include="src\apt_poller_task.c" />
- <ClCompile Include="src\apt_pollset.c" />
- <ClCompile Include="src\apt_pool.c" />
- <ClCompile Include="src\apt_string_table.c" />
- <ClCompile Include="src\apt_task.c" />
- <ClCompile Include="src\apt_task_msg.c" />
- <ClCompile Include="src\apt_test_suite.c" />
- <ClCompile Include="src\apt_text_message.c" />
- <ClCompile Include="src\apt_text_stream.c" />
- <ClCompile Include="src\apt_timer_queue.c" />
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="include">
- <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
- </Filter>
- <Filter Include="src">
- <UniqueIdentifier>{4e9335ac-20e8-4284-ad77-20ad9190c94d}</UniqueIdentifier>
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="include\apt.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\apt_consumer_task.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\apt_cyclic_queue.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\apt_dir_layout.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\apt_header_field.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\apt_log.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\apt_multipart_content.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\apt_net.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\apt_nlsml_doc.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\apt_obj_list.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\apt_pair.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\apt_poller_task.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\apt_pollset.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\apt_pool.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\apt_string.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\apt_string_table.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\apt_task.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\apt_task_msg.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\apt_test_suite.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\apt_text_message.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\apt_text_stream.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\apt_timer_queue.h">
- <Filter>include</Filter>
- </ClInclude>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="src\apt_consumer_task.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\apt_cyclic_queue.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\apt_dir_layout.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\apt_header_field.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\apt_log.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\apt_multipart_content.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\apt_net.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\apt_nlsml_doc.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\apt_obj_list.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\apt_pair.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\apt_poller_task.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\apt_pollset.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\apt_pool.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\apt_string_table.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\apt_task.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\apt_task_msg.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\apt_test_suite.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\apt_text_message.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\apt_text_stream.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\apt_timer_queue.c">
- <Filter>src</Filter>
- </ClCompile>
- </ItemGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-/*
- * 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 <apr.h>
-#include <apr_pools.h>
-#include <apr_strings.h>
-
-#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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 <apr_ring.h>
-#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 */
+++ /dev/null
-/*
- * 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 <stdio.h>
-#include <stdarg.h>
-#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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 <apr_xml.h>
-#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 <result> element.
- * Each <result> element may contain one or more <interpretation>, <enrollment-result>,
- * <verification-result> elements, and an optional <grammar> 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 <interpretation> 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 <instance> and <input> 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 <apr_tables.h>
-#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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 <apr_poll.h>
-#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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 <apr_time.h>
-#include <apr_queue.h>
-#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;
-}
+++ /dev/null
-/*
- * 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 <stdlib.h>
-#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;
-}
+++ /dev/null
-/*
- * 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 <apr_file_info.h>
-#include <apr_xml.h>
-#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; i<count; i++) {
- if(strcasecmp(labels[i],name) == 0) {
- if(id)
- *id = i;
- return TRUE;
- }
- }
- return FALSE;
-}
-
-static apr_xml_doc* apt_dir_layout_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;
-}
-
-static APR_INLINE apr_status_t apt_dir_is_path_absolute(const char *path, apr_pool_t *pool)
-{
- const char *root_path;
- const char *file_path = path;
- return apr_filepath_root(&root_path,&file_path,0,pool);
-}
-
-static char* apt_dir_layout_subdir_parse(const char *root_dir_path, const apr_xml_elem *elem, apr_pool_t *pool)
-{
- char *path;
- char *full_path = NULL;
- apr_status_t status;
-
- if(!elem || !elem->first_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);
-}
+++ /dev/null
-/*
- * 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;
-}
+++ /dev/null
-/*
- * 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 <apr_time.h>
-#include <apr_file_io.h>
-#include <apr_portable.h>
-#include <apr_xml.h>
-#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_index<file_data->max_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;
-}
+++ /dev/null
-/*
- * 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 <stdlib.h>
-#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;
-}
+++ /dev/null
-/*
- * 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 <apr_network_io.h>
-#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 <iphlpapi.h>
-#pragma comment(lib, "IPHLPAPI.lib")
-#else
-#include <netdb.h>
-#include <ifaddrs.h>
-#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);
-}
+++ /dev/null
-/*
- * 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 <stdlib.h>
-#ifdef WIN32
-#pragma warning(disable: 4127)
-#endif
-#include <apr_ring.h>
-
-#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 <result> */
- 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 <instance> 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 <input> 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 <interpretation> 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 <enrollment-result> 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 <verification-result> 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 <interpretation>, <enrollment-result>, <verification-result> 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;
-}
+++ /dev/null
-/*
- * 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 <apr_ring.h>
-#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;
-}
+++ /dev/null
-/*
- * 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; i<arr->nelts; 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; i<arr->nelts; 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;
-}
+++ /dev/null
-/*
- * 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;
-}
+++ /dev/null
-/*
- * 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 <apr_poll.h>
-#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
+++ /dev/null
-/*
- * 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;
-}
+++ /dev/null
-/*
- * 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 <ctype.h>
-#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; i<size; i++) {
- item = &table[i];
- if(item->value.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;
-}
+++ /dev/null
-/*
- * 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 <apr_ring.h>
-#include <apr_thread_proc.h>
-#include <apr_thread_cond.h>
-#include <apr_portable.h>
-#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;
-}
+++ /dev/null
-/*
- * 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 <stdlib.h>
-#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);
-}
+++ /dev/null
-/*
- * 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;
-}
+++ /dev/null
-/*
- * 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; i<folded_lines->nelts; 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 <CR> and <LF> */
- if(stream->pos == stream->end && *(stream->pos-1)== APT_TOKEN_CR) {
- /* if this is the case be prepared to skip <LF> 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 <LF> occurred as a result of message segmentation between <CR> and <LF> */
- 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;
-}
+++ /dev/null
-/*
- * 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 <stdlib.h>
-#include <stdio.h>
-#include <apr_uuid.h>
-#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<CRLF>
- name: value<CRLF>
- name: value<CRLF>
- name: value<LF>
- name:<CRLF> (only name, no value)
- <CRLF> (empty header)
- Malformed header fields are:
- name:value (missing end of line <CRLF>)
- name<CRLF> (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; i<arr->nelts; 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; i<arr->nelts; 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; i<count; i++) {
- sprintf(hex_str+i*2,"%02x",uuid.data[i]);
- }
- hex_str[length] = '\0';
-
- id->buf = hex_str;
- id->length = length;
- return TRUE;
-}
+++ /dev/null
-/*
- * 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 <apr_ring.h>
-#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;
-}
+++ /dev/null
-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
+++ /dev/null
-/*
- * SpanDSP - a series of DSP components for telephony
- *
- * g711.c - A-law and u-law transcoding routines
- *
- * Written by Steve Underwood <steveu@coppice.org>
- *
- * 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 ------------------------------------------------------------*/
+++ /dev/null
-/*
- * SpanDSP - a series of DSP components for telephony
- *
- * g711.h - In line A-law and u-law conversion routines
- *
- * Written by Steve Underwood <steveu@coppice.org>
- *
- * 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 ------------------------------------------------------------*/
+++ /dev/null
-/*
- * 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 <apt.h>
-
-/** 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 <stdio.h>
-#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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 <apr_tables.h>
-#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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 <apr_network_io.h>
-#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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 <stdio.h>
-#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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>\r
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
- <ItemGroup>\r
- <Filter Include="codecs">\r
- <UniqueIdentifier>{3d69fc35-a195-4376-9508-ef77d7b27e71}</UniqueIdentifier>\r
- </Filter>\r
- <Filter Include="codecs\g711">\r
- <UniqueIdentifier>{81e2eace-c57a-4135-92cd-cc3575dfb088}</UniqueIdentifier>\r
- </Filter>\r
- <Filter Include="include">\r
- <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>\r
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>\r
- </Filter>\r
- <Filter Include="src">\r
- <UniqueIdentifier>{6fc3533a-b688-477d-914d-e0ffb15aa9a9}</UniqueIdentifier>\r
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>\r
- </Filter>\r
- </ItemGroup>\r
- <ItemGroup>\r
- <ClCompile Include="codecs\g711\g711.c">\r
- <Filter>codecs\g711</Filter>\r
- </ClCompile>\r
- <ClCompile Include="src\mpf_activity_detector.c">\r
- <Filter>src</Filter>\r
- </ClCompile>\r
- <ClCompile Include="src\mpf_audio_file_stream.c">\r
- <Filter>src</Filter>\r
- </ClCompile>\r
- <ClCompile Include="src\mpf_bridge.c">\r
- <Filter>src</Filter>\r
- </ClCompile>\r
- <ClCompile Include="src\mpf_buffer.c">\r
- <Filter>src</Filter>\r
- </ClCompile>\r
- <ClCompile Include="src\mpf_codec_descriptor.c">\r
- <Filter>src</Filter>\r
- </ClCompile>\r
- <ClCompile Include="src\mpf_codec_g711.c">\r
- <Filter>src</Filter>\r
- </ClCompile>\r
- <ClCompile Include="src\mpf_codec_linear.c">\r
- <Filter>src</Filter>\r
- </ClCompile>\r
- <ClCompile Include="src\mpf_codec_manager.c">\r
- <Filter>src</Filter>\r
- </ClCompile>\r
- <ClCompile Include="src\mpf_context.c">\r
- <Filter>src</Filter>\r
- </ClCompile>\r
- <ClCompile Include="src\mpf_decoder.c">\r
- <Filter>src</Filter>\r
- </ClCompile>\r
- <ClCompile Include="src\mpf_dtmf_detector.c">\r
- <Filter>src</Filter>\r
- </ClCompile>\r
- <ClCompile Include="src\mpf_dtmf_generator.c">\r
- <Filter>src</Filter>\r
- </ClCompile>\r
- <ClCompile Include="src\mpf_encoder.c">\r
- <Filter>src</Filter>\r
- </ClCompile>\r
- <ClCompile Include="src\mpf_engine.c">\r
- <Filter>src</Filter>\r
- </ClCompile>\r
- <ClCompile Include="src\mpf_file_termination_factory.c">\r
- <Filter>src</Filter>\r
- </ClCompile>\r
- <ClCompile Include="src\mpf_frame_buffer.c">\r
- <Filter>src</Filter>\r
- </ClCompile>\r
- <ClCompile Include="src\mpf_jitter_buffer.c">\r
- <Filter>src</Filter>\r
- </ClCompile>\r
- <ClCompile Include="src\mpf_mixer.c">\r
- <Filter>src</Filter>\r
- </ClCompile>\r
- <ClCompile Include="src\mpf_multiplier.c">\r
- <Filter>src</Filter>\r
- </ClCompile>\r
- <ClCompile Include="src\mpf_named_event.c">\r
- <Filter>src</Filter>\r
- </ClCompile>\r
- <ClCompile Include="src\mpf_resampler.c">\r
- <Filter>src</Filter>\r
- </ClCompile>\r
- <ClCompile Include="src\mpf_rtp_attribs.c">\r
- <Filter>src</Filter>\r
- </ClCompile>\r
- <ClCompile Include="src\mpf_rtp_stream.c">\r
- <Filter>src</Filter>\r
- </ClCompile>\r
- <ClCompile Include="src\mpf_rtp_termination_factory.c">\r
- <Filter>src</Filter>\r
- </ClCompile>\r
- <ClCompile Include="src\mpf_scheduler.c">\r
- <Filter>src</Filter>\r
- </ClCompile>\r
- <ClCompile Include="src\mpf_stream.c">\r
- <Filter>src</Filter>\r
- </ClCompile>\r
- <ClCompile Include="src\mpf_termination.c">\r
- <Filter>src</Filter>\r
- </ClCompile>\r
- <ClCompile Include="src\mpf_termination_factory.c">\r
- <Filter>src</Filter>\r
- </ClCompile>\r
- <ClCompile Include="src\mpf_engine_factory.c">\r
- <Filter>src</Filter>\r
- </ClCompile>\r
- </ItemGroup>\r
- <ItemGroup>\r
- <ClInclude Include="codecs\g711\g711.h">\r
- <Filter>codecs\g711</Filter>\r
- </ClInclude>\r
- <ClInclude Include="include\mpf.h">\r
- <Filter>include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="include\mpf_activity_detector.h">\r
- <Filter>include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="include\mpf_audio_file_descriptor.h">\r
- <Filter>include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="include\mpf_audio_file_stream.h">\r
- <Filter>include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="include\mpf_bridge.h">\r
- <Filter>include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="include\mpf_buffer.h">\r
- <Filter>include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="include\mpf_codec.h">\r
- <Filter>include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="include\mpf_codec_descriptor.h">\r
- <Filter>include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="include\mpf_codec_manager.h">\r
- <Filter>include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="include\mpf_context.h">\r
- <Filter>include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="include\mpf_decoder.h">\r
- <Filter>include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="include\mpf_dtmf_detector.h">\r
- <Filter>include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="include\mpf_dtmf_generator.h">\r
- <Filter>include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="include\mpf_encoder.h">\r
- <Filter>include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="include\mpf_engine.h">\r
- <Filter>include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="include\mpf_file_termination_factory.h">\r
- <Filter>include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="include\mpf_frame.h">\r
- <Filter>include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="include\mpf_frame_buffer.h">\r
- <Filter>include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="include\mpf_jitter_buffer.h">\r
- <Filter>include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="include\mpf_message.h">\r
- <Filter>include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="include\mpf_mixer.h">\r
- <Filter>include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="include\mpf_multiplier.h">\r
- <Filter>include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="include\mpf_named_event.h">\r
- <Filter>include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="include\mpf_object.h">\r
- <Filter>include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="include\mpf_resampler.h">\r
- <Filter>include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="include\mpf_rtcp_packet.h">\r
- <Filter>include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="include\mpf_rtp_attribs.h">\r
- <Filter>include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="include\mpf_rtp_defs.h">\r
- <Filter>include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="include\mpf_rtp_descriptor.h">\r
- <Filter>include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="include\mpf_rtp_header.h">\r
- <Filter>include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="include\mpf_rtp_pt.h">\r
- <Filter>include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="include\mpf_rtp_stat.h">\r
- <Filter>include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="include\mpf_rtp_stream.h">\r
- <Filter>include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="include\mpf_rtp_termination_factory.h">\r
- <Filter>include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="include\mpf_scheduler.h">\r
- <Filter>include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="include\mpf_stream.h">\r
- <Filter>include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="include\mpf_stream_descriptor.h">\r
- <Filter>include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="include\mpf_termination.h">\r
- <Filter>include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="include\mpf_termination_factory.h">\r
- <Filter>include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="include\mpf_types.h">\r
- <Filter>include</Filter>\r
- </ClInclude>\r
- </ItemGroup>\r
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>\r
-<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
- <ItemGroup Label="ProjectConfigurations">\r
- <ProjectConfiguration Include="Debug|Win32">\r
- <Configuration>Debug</Configuration>\r
- <Platform>Win32</Platform>\r
- </ProjectConfiguration>\r
- <ProjectConfiguration Include="Debug|x64">\r
- <Configuration>Debug</Configuration>\r
- <Platform>x64</Platform>\r
- </ProjectConfiguration>\r
- <ProjectConfiguration Include="Release|Win32">\r
- <Configuration>Release</Configuration>\r
- <Platform>Win32</Platform>\r
- </ProjectConfiguration>\r
- <ProjectConfiguration Include="Release|x64">\r
- <Configuration>Release</Configuration>\r
- <Platform>x64</Platform>\r
- </ProjectConfiguration>\r
- </ItemGroup>\r
- <PropertyGroup Label="Globals">\r
- <ProjectName>mpf</ProjectName>\r
- <ProjectGuid>{B5A00BFA-6083-4FAE-A097-71642D6473B5}</ProjectGuid>\r
- <RootNamespace>mpf</RootNamespace>\r
- <Keyword>Win32Proj</Keyword>\r
- </PropertyGroup>\r
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />\r
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">\r
- <ConfigurationType>StaticLibrary</ConfigurationType>\r
- <CharacterSet>Unicode</CharacterSet>\r
- <WholeProgramOptimization>true</WholeProgramOptimization>\r
- <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>\r
- </PropertyGroup>\r
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">\r
- <ConfigurationType>StaticLibrary</ConfigurationType>\r
- <CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>\r
- </PropertyGroup>\r
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">\r
- <ConfigurationType>StaticLibrary</ConfigurationType>\r
- <CharacterSet>Unicode</CharacterSet>\r
- <WholeProgramOptimization>true</WholeProgramOptimization>\r
- <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>\r
- </PropertyGroup>\r
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">\r
- <ConfigurationType>StaticLibrary</ConfigurationType>\r
- <CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>\r
- </PropertyGroup>\r
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />\r
- <ImportGroup Label="ExtensionSettings">\r
- </ImportGroup>\r
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">\r
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />\r
- <Import Project="$(ProjectDir)..\..\build\props\mpf.props" />\r
- </ImportGroup>\r
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">\r
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.props" />\r
- <Import Project="$(ProjectDir)..\..\build\props\mpf.props" />\r
- </ImportGroup>\r
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">\r
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />\r
- <Import Project="$(ProjectDir)..\..\build\props\mpf.props" />\r
- </ImportGroup>\r
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">\r
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.props" />\r
- <Import Project="$(ProjectDir)..\..\build\props\mpf.props" />\r
- </ImportGroup>\r
- <PropertyGroup Label="UserMacros" />\r
- <PropertyGroup>\r
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>\r
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(PlatformName)\$(Configuration)\</OutDir>\r
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(PlatformName)\$(Configuration)\</IntDir>\r
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(PlatformName)\$(Configuration)\</OutDir>\r
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(PlatformName)\$(Configuration)\</IntDir>\r
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(PlatformName)\$(Configuration)\</OutDir>\r
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(PlatformName)\$(Configuration)\</IntDir>\r
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(PlatformName)\$(Configuration)\</OutDir>\r
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(PlatformName)\$(Configuration)\</IntDir>\r
- </PropertyGroup>\r
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
- <ClCompile>\r
- <AdditionalIncludeDirectories>codecs;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
- <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
- </ClCompile>\r
- </ItemDefinitionGroup>\r
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">\r
- <Midl>\r
- <TargetEnvironment>X64</TargetEnvironment>\r
- </Midl>\r
- <ClCompile>\r
- <AdditionalIncludeDirectories>codecs;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
- <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
- <TreatWarningAsError>false</TreatWarningAsError>\r
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>\r
- </ClCompile>\r
- </ItemDefinitionGroup>\r
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
- <ClCompile>\r
- <AdditionalIncludeDirectories>codecs;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
- <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
- </ClCompile>\r
- </ItemDefinitionGroup>\r
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">\r
- <Midl>\r
- <TargetEnvironment>X64</TargetEnvironment>\r
- </Midl>\r
- <ClCompile>\r
- <AdditionalIncludeDirectories>codecs;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
- <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
- <TreatWarningAsError>false</TreatWarningAsError>\r
- </ClCompile>\r
- </ItemDefinitionGroup>\r
- <ItemGroup>\r
- <ClCompile Include="codecs\g711\g711.c" />\r
- <ClCompile Include="src\mpf_activity_detector.c" />\r
- <ClCompile Include="src\mpf_audio_file_stream.c" />\r
- <ClCompile Include="src\mpf_bridge.c" />\r
- <ClCompile Include="src\mpf_buffer.c" />\r
- <ClCompile Include="src\mpf_codec_descriptor.c" />\r
- <ClCompile Include="src\mpf_codec_g711.c" />\r
- <ClCompile Include="src\mpf_codec_linear.c" />\r
- <ClCompile Include="src\mpf_codec_manager.c" />\r
- <ClCompile Include="src\mpf_context.c" />\r
- <ClCompile Include="src\mpf_decoder.c" />\r
- <ClCompile Include="src\mpf_dtmf_detector.c" />\r
- <ClCompile Include="src\mpf_dtmf_generator.c" />\r
- <ClCompile Include="src\mpf_encoder.c" />\r
- <ClCompile Include="src\mpf_engine.c" />\r
- <ClCompile Include="src\mpf_engine_factory.c" />\r
- <ClCompile Include="src\mpf_file_termination_factory.c" />\r
- <ClCompile Include="src\mpf_frame_buffer.c" />\r
- <ClCompile Include="src\mpf_jitter_buffer.c" />\r
- <ClCompile Include="src\mpf_mixer.c" />\r
- <ClCompile Include="src\mpf_multiplier.c" />\r
- <ClCompile Include="src\mpf_named_event.c" />\r
- <ClCompile Include="src\mpf_resampler.c" />\r
- <ClCompile Include="src\mpf_rtp_attribs.c" />\r
- <ClCompile Include="src\mpf_rtp_stream.c" />\r
- <ClCompile Include="src\mpf_rtp_termination_factory.c" />\r
- <ClCompile Include="src\mpf_scheduler.c" />\r
- <ClCompile Include="src\mpf_stream.c" />\r
- <ClCompile Include="src\mpf_termination.c" />\r
- <ClCompile Include="src\mpf_termination_factory.c" />\r
- </ItemGroup>\r
- <ItemGroup>\r
- <ClInclude Include="codecs\g711\g711.h" />\r
- <ClInclude Include="include\mpf.h" />\r
- <ClInclude Include="include\mpf_activity_detector.h" />\r
- <ClInclude Include="include\mpf_audio_file_descriptor.h" />\r
- <ClInclude Include="include\mpf_audio_file_stream.h" />\r
- <ClInclude Include="include\mpf_bridge.h" />\r
- <ClInclude Include="include\mpf_buffer.h" />\r
- <ClInclude Include="include\mpf_codec.h" />\r
- <ClInclude Include="include\mpf_codec_descriptor.h" />\r
- <ClInclude Include="include\mpf_codec_manager.h" />\r
- <ClInclude Include="include\mpf_context.h" />\r
- <ClInclude Include="include\mpf_decoder.h" />\r
- <ClInclude Include="include\mpf_dtmf_detector.h" />\r
- <ClInclude Include="include\mpf_dtmf_generator.h" />\r
- <ClInclude Include="include\mpf_encoder.h" />\r
- <ClInclude Include="include\mpf_engine.h" />\r
- <ClInclude Include="include\mpf_file_termination_factory.h" />\r
- <ClInclude Include="include\mpf_frame.h" />\r
- <ClInclude Include="include\mpf_frame_buffer.h" />\r
- <ClInclude Include="include\mpf_jitter_buffer.h" />\r
- <ClInclude Include="include\mpf_message.h" />\r
- <ClInclude Include="include\mpf_mixer.h" />\r
- <ClInclude Include="include\mpf_multiplier.h" />\r
- <ClInclude Include="include\mpf_named_event.h" />\r
- <ClInclude Include="include\mpf_object.h" />\r
- <ClInclude Include="include\mpf_resampler.h" />\r
- <ClInclude Include="include\mpf_rtcp_packet.h" />\r
- <ClInclude Include="include\mpf_rtp_attribs.h" />\r
- <ClInclude Include="include\mpf_rtp_defs.h" />\r
- <ClInclude Include="include\mpf_rtp_descriptor.h" />\r
- <ClInclude Include="include\mpf_rtp_header.h" />\r
- <ClInclude Include="include\mpf_rtp_pt.h" />\r
- <ClInclude Include="include\mpf_rtp_stat.h" />\r
- <ClInclude Include="include\mpf_rtp_stream.h" />\r
- <ClInclude Include="include\mpf_rtp_termination_factory.h" />\r
- <ClInclude Include="include\mpf_scheduler.h" />\r
- <ClInclude Include="include\mpf_stream.h" />\r
- <ClInclude Include="include\mpf_stream_descriptor.h" />\r
- <ClInclude Include="include\mpf_termination.h" />\r
- <ClInclude Include="include\mpf_termination_factory.h" />\r
- <ClInclude Include="include\mpf_types.h" />\r
- </ItemGroup>\r
- <ItemGroup>\r
- <ProjectReference Include="..\..\..\win32\apr\libapr.2017.vcxproj">\r
- <Project>{f6c55d93-b927-4483-bb69-15aef3dd2dff}</Project>\r
- </ProjectReference>\r
- </ItemGroup>\r
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />\r
- <ImportGroup Label="ExtensionTargets">\r
- </ImportGroup>\r
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="mpf"
- ProjectGUID="{B5A00BFA-6083-4FAE-A097-71642D6473B5}"
- RootNamespace="mpf"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- <Platform
- Name="x64"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- ConfigurationType="4"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unilib.vsprops;$(ProjectDir)..\..\build\vsprops\mpf.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="codecs"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- ConfigurationType="4"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unilib.vsprops;$(ProjectDir)..\..\build\vsprops\mpf.vsprops"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="codecs"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|x64"
- ConfigurationType="4"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unilib-x64.vsprops;$(ProjectDir)..\..\build\vsprops\mpf.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="codecs"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|x64"
- ConfigurationType="4"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unilib-x64.vsprops;$(ProjectDir)..\..\build\vsprops\mpf.vsprops"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="codecs"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="codecs"
- >
- <Filter
- Name="g711"
- >
- <File
- RelativePath=".\codecs\g711\g711.c"
- >
- </File>
- <File
- RelativePath=".\codecs\g711\g711.h"
- >
- </File>
- </Filter>
- </Filter>
- <Filter
- Name="include"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- <File
- RelativePath=".\include\mpf.h"
- >
- </File>
- <File
- RelativePath=".\include\mpf_activity_detector.h"
- >
- </File>
- <File
- RelativePath=".\include\mpf_audio_file_descriptor.h"
- >
- </File>
- <File
- RelativePath=".\include\mpf_audio_file_stream.h"
- >
- </File>
- <File
- RelativePath=".\include\mpf_bridge.h"
- >
- </File>
- <File
- RelativePath=".\include\mpf_buffer.h"
- >
- </File>
- <File
- RelativePath=".\include\mpf_codec.h"
- >
- </File>
- <File
- RelativePath=".\include\mpf_codec_descriptor.h"
- >
- </File>
- <File
- RelativePath=".\include\mpf_codec_manager.h"
- >
- </File>
- <File
- RelativePath=".\include\mpf_context.h"
- >
- </File>
- <File
- RelativePath=".\include\mpf_decoder.h"
- >
- </File>
- <File
- RelativePath=".\include\mpf_dtmf_detector.h"
- >
- </File>
- <File
- RelativePath=".\include\mpf_dtmf_generator.h"
- >
- </File>
- <File
- RelativePath=".\include\mpf_encoder.h"
- >
- </File>
- <File
- RelativePath=".\include\mpf_engine.h"
- >
- </File>
- <File
- RelativePath=".\include\mpf_engine_factory.h"
- >
- </File>
- <File
- RelativePath=".\include\mpf_file_termination_factory.h"
- >
- </File>
- <File
- RelativePath=".\include\mpf_frame.h"
- >
- </File>
- <File
- RelativePath=".\include\mpf_frame_buffer.h"
- >
- </File>
- <File
- RelativePath=".\include\mpf_jitter_buffer.h"
- >
- </File>
- <File
- RelativePath=".\include\mpf_message.h"
- >
- </File>
- <File
- RelativePath=".\include\mpf_mixer.h"
- >
- </File>
- <File
- RelativePath=".\include\mpf_multiplier.h"
- >
- </File>
- <File
- RelativePath=".\include\mpf_named_event.h"
- >
- </File>
- <File
- RelativePath=".\include\mpf_object.h"
- >
- </File>
- <File
- RelativePath=".\include\mpf_resampler.h"
- >
- </File>
- <File
- RelativePath=".\include\mpf_rtcp_packet.h"
- >
- </File>
- <File
- RelativePath=".\include\mpf_rtp_attribs.h"
- >
- </File>
- <File
- RelativePath=".\include\mpf_rtp_defs.h"
- >
- </File>
- <File
- RelativePath=".\include\mpf_rtp_descriptor.h"
- >
- </File>
- <File
- RelativePath=".\include\mpf_rtp_header.h"
- >
- </File>
- <File
- RelativePath=".\include\mpf_rtp_pt.h"
- >
- </File>
- <File
- RelativePath=".\include\mpf_rtp_stat.h"
- >
- </File>
- <File
- RelativePath=".\include\mpf_rtp_stream.h"
- >
- </File>
- <File
- RelativePath=".\include\mpf_rtp_termination_factory.h"
- >
- </File>
- <File
- RelativePath=".\include\mpf_scheduler.h"
- >
- </File>
- <File
- RelativePath=".\include\mpf_stream.h"
- >
- </File>
- <File
- RelativePath=".\include\mpf_stream_descriptor.h"
- >
- </File>
- <File
- RelativePath=".\include\mpf_termination.h"
- >
- </File>
- <File
- RelativePath=".\include\mpf_termination_factory.h"
- >
- </File>
- <File
- RelativePath=".\include\mpf_types.h"
- >
- </File>
- </Filter>
- <Filter
- Name="src"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- >
- <File
- RelativePath=".\src\mpf_activity_detector.c"
- >
- </File>
- <File
- RelativePath=".\src\mpf_audio_file_stream.c"
- >
- </File>
- <File
- RelativePath=".\src\mpf_bridge.c"
- >
- </File>
- <File
- RelativePath=".\src\mpf_buffer.c"
- >
- </File>
- <File
- RelativePath=".\src\mpf_codec_descriptor.c"
- >
- </File>
- <File
- RelativePath=".\src\mpf_codec_g711.c"
- >
- </File>
- <File
- RelativePath=".\src\mpf_codec_linear.c"
- >
- </File>
- <File
- RelativePath=".\src\mpf_codec_manager.c"
- >
- </File>
- <File
- RelativePath=".\src\mpf_context.c"
- >
- </File>
- <File
- RelativePath=".\src\mpf_decoder.c"
- >
- </File>
- <File
- RelativePath=".\src\mpf_dtmf_detector.c"
- >
- </File>
- <File
- RelativePath=".\src\mpf_dtmf_generator.c"
- >
- </File>
- <File
- RelativePath=".\src\mpf_encoder.c"
- >
- </File>
- <File
- RelativePath=".\src\mpf_engine.c"
- >
- </File>
- <File
- RelativePath=".\src\mpf_engine_factory.c"
- >
- </File>
- <File
- RelativePath=".\src\mpf_file_termination_factory.c"
- >
- </File>
- <File
- RelativePath=".\src\mpf_frame_buffer.c"
- >
- </File>
- <File
- RelativePath=".\src\mpf_jitter_buffer.c"
- >
- </File>
- <File
- RelativePath=".\src\mpf_mixer.c"
- >
- </File>
- <File
- RelativePath=".\src\mpf_multiplier.c"
- >
- </File>
- <File
- RelativePath=".\src\mpf_named_event.c"
- >
- </File>
- <File
- RelativePath=".\src\mpf_resampler.c"
- >
- </File>
- <File
- RelativePath=".\src\mpf_rtp_attribs.c"
- >
- </File>
- <File
- RelativePath=".\src\mpf_rtp_stream.c"
- >
- </File>
- <File
- RelativePath=".\src\mpf_rtp_termination_factory.c"
- >
- </File>
- <File
- RelativePath=".\src\mpf_scheduler.c"
- >
- </File>
- <File
- RelativePath=".\src\mpf_stream.c"
- >
- </File>
- <File
- RelativePath=".\src\mpf_termination.c"
- >
- </File>
- <File
- RelativePath=".\src\mpf_termination_factory.c"
- >
- </File>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{B5A00BFA-6083-4FAE-A097-71642D6473B5}</ProjectGuid>
- <RootNamespace>mpf</RootNamespace>
- <Keyword>Win32Proj</Keyword>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unilib.props" />
- <Import Project="$(ProjectDir)..\..\build\props\mpf.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" />
- <Import Project="$(ProjectDir)..\..\build\props\unilib.props" />
- <Import Project="$(ProjectDir)..\..\build\props\mpf.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unilib-x64.props" />
- <Import Project="$(ProjectDir)..\..\build\props\mpf.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" />
- <Import Project="$(ProjectDir)..\..\build\props\unilib-x64.props" />
- <Import Project="$(ProjectDir)..\..\build\props\mpf.props" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <AdditionalIncludeDirectories>codecs;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <AdditionalIncludeDirectories>codecs;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <AdditionalIncludeDirectories>codecs;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <AdditionalIncludeDirectories>codecs;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="codecs\g711\g711.c" />
- <ClCompile Include="src\mpf_activity_detector.c" />
- <ClCompile Include="src\mpf_audio_file_stream.c" />
- <ClCompile Include="src\mpf_bridge.c" />
- <ClCompile Include="src\mpf_buffer.c" />
- <ClCompile Include="src\mpf_codec_descriptor.c" />
- <ClCompile Include="src\mpf_codec_g711.c" />
- <ClCompile Include="src\mpf_codec_linear.c" />
- <ClCompile Include="src\mpf_codec_manager.c" />
- <ClCompile Include="src\mpf_context.c" />
- <ClCompile Include="src\mpf_decoder.c" />
- <ClCompile Include="src\mpf_dtmf_detector.c" />
- <ClCompile Include="src\mpf_dtmf_generator.c" />
- <ClCompile Include="src\mpf_encoder.c" />
- <ClCompile Include="src\mpf_engine.c" />
- <ClCompile Include="src\mpf_engine_factory.c" />
- <ClCompile Include="src\mpf_file_termination_factory.c" />
- <ClCompile Include="src\mpf_frame_buffer.c" />
- <ClCompile Include="src\mpf_jitter_buffer.c" />
- <ClCompile Include="src\mpf_mixer.c" />
- <ClCompile Include="src\mpf_multiplier.c" />
- <ClCompile Include="src\mpf_named_event.c" />
- <ClCompile Include="src\mpf_resampler.c" />
- <ClCompile Include="src\mpf_rtp_attribs.c" />
- <ClCompile Include="src\mpf_rtp_stream.c" />
- <ClCompile Include="src\mpf_rtp_termination_factory.c" />
- <ClCompile Include="src\mpf_scheduler.c" />
- <ClCompile Include="src\mpf_stream.c" />
- <ClCompile Include="src\mpf_termination.c" />
- <ClCompile Include="src\mpf_termination_factory.c" />
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="codecs\g711\g711.h" />
- <ClInclude Include="include\mpf.h" />
- <ClInclude Include="include\mpf_activity_detector.h" />
- <ClInclude Include="include\mpf_audio_file_descriptor.h" />
- <ClInclude Include="include\mpf_audio_file_stream.h" />
- <ClInclude Include="include\mpf_bridge.h" />
- <ClInclude Include="include\mpf_buffer.h" />
- <ClInclude Include="include\mpf_codec.h" />
- <ClInclude Include="include\mpf_codec_descriptor.h" />
- <ClInclude Include="include\mpf_codec_manager.h" />
- <ClInclude Include="include\mpf_context.h" />
- <ClInclude Include="include\mpf_decoder.h" />
- <ClInclude Include="include\mpf_dtmf_detector.h" />
- <ClInclude Include="include\mpf_dtmf_generator.h" />
- <ClInclude Include="include\mpf_encoder.h" />
- <ClInclude Include="include\mpf_engine.h" />
- <ClInclude Include="include\mpf_engine_factory.h" />
- <ClInclude Include="include\mpf_file_termination_factory.h" />
- <ClInclude Include="include\mpf_frame.h" />
- <ClInclude Include="include\mpf_frame_buffer.h" />
- <ClInclude Include="include\mpf_jitter_buffer.h" />
- <ClInclude Include="include\mpf_message.h" />
- <ClInclude Include="include\mpf_mixer.h" />
- <ClInclude Include="include\mpf_multiplier.h" />
- <ClInclude Include="include\mpf_named_event.h" />
- <ClInclude Include="include\mpf_object.h" />
- <ClInclude Include="include\mpf_resampler.h" />
- <ClInclude Include="include\mpf_rtcp_packet.h" />
- <ClInclude Include="include\mpf_rtp_attribs.h" />
- <ClInclude Include="include\mpf_rtp_defs.h" />
- <ClInclude Include="include\mpf_rtp_descriptor.h" />
- <ClInclude Include="include\mpf_rtp_header.h" />
- <ClInclude Include="include\mpf_rtp_pt.h" />
- <ClInclude Include="include\mpf_rtp_stat.h" />
- <ClInclude Include="include\mpf_rtp_stream.h" />
- <ClInclude Include="include\mpf_rtp_termination_factory.h" />
- <ClInclude Include="include\mpf_scheduler.h" />
- <ClInclude Include="include\mpf_stream.h" />
- <ClInclude Include="include\mpf_stream_descriptor.h" />
- <ClInclude Include="include\mpf_termination.h" />
- <ClInclude Include="include\mpf_termination_factory.h" />
- <ClInclude Include="include\mpf_types.h" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\apr-toolkit\aprtoolkit.vcxproj">
- <Project>{13deeca0-bdd4-4744-a1a2-8eb0a44df3d2}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="codecs">
- <UniqueIdentifier>{33a3a10a-4697-4720-8c24-20340757326e}</UniqueIdentifier>
- </Filter>
- <Filter Include="codecs\g711">
- <UniqueIdentifier>{148f1b8f-859b-4dd9-96b0-0474d7bb875b}</UniqueIdentifier>
- </Filter>
- <Filter Include="include">
- <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
- </Filter>
- <Filter Include="src">
- <UniqueIdentifier>{35011b8a-6a42-4e9f-b55b-a84db1d929a8}</UniqueIdentifier>
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="codecs\g711\g711.c">
- <Filter>codecs\g711</Filter>
- </ClCompile>
- <ClCompile Include="src\mpf_activity_detector.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\mpf_audio_file_stream.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\mpf_bridge.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\mpf_buffer.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\mpf_codec_descriptor.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\mpf_codec_g711.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\mpf_codec_linear.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\mpf_codec_manager.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\mpf_context.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\mpf_decoder.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\mpf_dtmf_detector.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\mpf_dtmf_generator.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\mpf_encoder.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\mpf_engine.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\mpf_file_termination_factory.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\mpf_frame_buffer.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\mpf_jitter_buffer.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\mpf_mixer.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\mpf_multiplier.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\mpf_named_event.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\mpf_resampler.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\mpf_rtp_attribs.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\mpf_rtp_stream.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\mpf_rtp_termination_factory.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\mpf_scheduler.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\mpf_stream.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\mpf_termination.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\mpf_termination_factory.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\mpf_engine_factory.c">
- <Filter>src</Filter>
- </ClCompile>
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="codecs\g711\g711.h">
- <Filter>codecs\g711</Filter>
- </ClInclude>
- <ClInclude Include="include\mpf.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mpf_activity_detector.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mpf_audio_file_descriptor.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mpf_audio_file_stream.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mpf_bridge.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mpf_buffer.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mpf_codec.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mpf_codec_descriptor.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mpf_codec_manager.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mpf_context.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mpf_decoder.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mpf_dtmf_detector.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mpf_dtmf_generator.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mpf_encoder.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mpf_engine.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mpf_file_termination_factory.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mpf_frame.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mpf_frame_buffer.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mpf_jitter_buffer.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mpf_message.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mpf_mixer.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mpf_multiplier.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mpf_named_event.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mpf_object.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mpf_resampler.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mpf_rtcp_packet.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mpf_rtp_attribs.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mpf_rtp_defs.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mpf_rtp_descriptor.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mpf_rtp_header.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mpf_rtp_pt.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mpf_rtp_stat.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mpf_rtp_stream.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mpf_rtp_termination_factory.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mpf_scheduler.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mpf_stream.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mpf_stream_descriptor.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mpf_termination.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mpf_termination_factory.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mpf_types.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mpf_engine_factory.h">
- <Filter>include</Filter>
- </ClInclude>
- </ItemGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-/*
- * 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;
-}
+++ /dev/null
-/*
- * 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);
- }
-}
+++ /dev/null
-/*
- * 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);
-}
+++ /dev/null
-/*
- * 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 <apr_ring.h>
-#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;
-}
+++ /dev/null
-/*
- * 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; i<codec_list->descriptor_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; i<capabilities->attrib_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; i<codec_list->descriptor_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; i<codec_list1->descriptor_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; i<codec_list2->descriptor_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;
-}
+++ /dev/null
-/*
- * 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; i<frame_out->size; 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; i<frame_in->size; 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; i<frame_out->size; 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; i<frame_out->size; 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; i<frame_in->size; 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; i<frame_out->size; 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);
-}
+++ /dev/null
-/*
- * 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 <apr_want.h>
-#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; i<samples; i++) {
- buf_out[i] = htons(buf_in[i]);
- }
-
- return TRUE;
-}
-
-static apt_bool_t l16_decode(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; i<samples; i++) {
- buf_out[i] = ntohs(buf_in[i]);
- }
-
- return TRUE;
-}
-
-static const mpf_codec_vtable_t l16_vtable = {
- l16_open,
- l16_close,
- l16_encode,
- l16_decode,
- NULL,
- NULL
-};
-
-static const mpf_codec_attribs_t l16_attribs = {
- {L16_CODEC_NAME, L16_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 */
-};
-
-mpf_codec_t* mpf_codec_l16_create(apr_pool_t *pool)
-{
- return mpf_codec_create(&l16_vtable,&l16_attribs,NULL,pool);
-}
+++ /dev/null
-/*
- * 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.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include <stdlib.h>
-#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; i<codec_manager->codec_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; i<codec_manager->codec_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; i<codec_manager->codec_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;
-}
+++ /dev/null
-/*
- * 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 <apr_ring.h>
-#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; i<context->capacity; 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; j<context->capacity; 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; i<context->capacity; 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; i<context->capacity; 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; j<context->capacity && k<context->count; 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; i<context->capacity && k<context->count; 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; j<context->capacity; 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; i<context->capacity && k<context->count; 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; i<context->mpf_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; i<context->mpf_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; j<context->capacity; 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; j<context->capacity && k<header_item1->tx_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; i<context->capacity && k<header_item1->rx_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;
-}
+++ /dev/null
-/*
- * 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;
-}
+++ /dev/null
-/*
- * 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 <math.h>
-
-#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;
-}
+++ /dev/null
-/*
- * 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 <math.h>
-
-#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;
-}
+++ /dev/null
-/*
- * 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;
-}
+++ /dev/null
-/*
- * 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; i<request->count; 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);
-}
+++ /dev/null
-/*
- * 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 <apr_tables.h>
-#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; i<mpf_factory->engines_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;
-}
+++ /dev/null
-/*
- * 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;
-}
+++ /dev/null
-/*
- * 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; i<buffer->frame_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;
-}
+++ /dev/null
-/*
- * 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; i<jb->frame_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;
-}
+++ /dev/null
-/*
- * 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; i<samples; i++) {
- /* overflow MUST be considered */
- mix_buf[i] = mix_buf[i] + buf[i];
- }
- mix_frame->type |= 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; i<mixer->source_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; i<mixer->source_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; i<mixer->source_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; i<source_count; i++) {
- source = source_arr[i];
- if(!source) continue;
-
- if(mpf_audio_stream_rx_validate(source,NULL,NULL,pool) == FALSE) {
- continue;
- }
-
- 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 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;
-}
+++ /dev/null
-/*
- * 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; i<multiplier->sink_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; i<multiplier->sink_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; i<multiplier->sink_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; i<sink_count; i++) {
- sink = sink_arr[i];
- if(!sink) continue;
-
- if(mpf_audio_stream_tx_validate(sink,NULL,NULL,pool) == FALSE) {
- continue;
- }
-
- 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 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;
-}
+++ /dev/null
-/*
- * 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 */
-}
+++ /dev/null
-/*
- * 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;
-}
+++ /dev/null
-/*
- * 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);
-}
+++ /dev/null
-/*
- * 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 <apr_network_io.h>
-#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);
-}
+++ /dev/null
-/*
- * 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 <apr_tables.h>
-#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; i<rtp_termination_factory->media_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; i<rtp_termination_factory->media_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; i<rtp_termination_factory->media_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;
-}
+++ /dev/null
-/*
- * 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 <mmsystem.h>
-#include <windows.h>
-
-#ifndef TIME_KILL_SYNCHRONOUS
-#define TIME_KILL_SYNCHRONOUS 0x0100
-#endif
-
-#else
-#include <apr_thread_proc.h>
-#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
+++ /dev/null
-/*
- * 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);
- }
- }
-}
+++ /dev/null
-/*
- * 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;
-}
+++ /dev/null
-/*
- * 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;
-}
+++ /dev/null
-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
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>\r
-<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
- <ItemGroup Label="ProjectConfigurations">\r
- <ProjectConfiguration Include="Debug|Win32">\r
- <Configuration>Debug</Configuration>\r
- <Platform>Win32</Platform>\r
- </ProjectConfiguration>\r
- <ProjectConfiguration Include="Debug|x64">\r
- <Configuration>Debug</Configuration>\r
- <Platform>x64</Platform>\r
- </ProjectConfiguration>\r
- <ProjectConfiguration Include="Release|Win32">\r
- <Configuration>Release</Configuration>\r
- <Platform>Win32</Platform>\r
- </ProjectConfiguration>\r
- <ProjectConfiguration Include="Release|x64">\r
- <Configuration>Release</Configuration>\r
- <Platform>x64</Platform>\r
- </ProjectConfiguration>\r
- </ItemGroup>\r
- <PropertyGroup Label="Globals">\r
- <ProjectName>mrcpclient</ProjectName>\r
- <ProjectGuid>{72782932-37CC-46AE-8C7F-9A7B1A6EE108}</ProjectGuid>\r
- <RootNamespace>mrcpclient</RootNamespace>\r
- <Keyword>Win32Proj</Keyword>\r
- </PropertyGroup>\r
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />\r
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">\r
- <ConfigurationType>StaticLibrary</ConfigurationType>\r
- <CharacterSet>Unicode</CharacterSet>\r
- <WholeProgramOptimization>true</WholeProgramOptimization>\r
- <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>\r
- </PropertyGroup>\r
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">\r
- <ConfigurationType>StaticLibrary</ConfigurationType>\r
- <CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>\r
- </PropertyGroup>\r
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">\r
- <ConfigurationType>StaticLibrary</ConfigurationType>\r
- <CharacterSet>Unicode</CharacterSet>\r
- <WholeProgramOptimization>true</WholeProgramOptimization>\r
- <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>\r
- </PropertyGroup>\r
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">\r
- <ConfigurationType>StaticLibrary</ConfigurationType>\r
- <CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>\r
- </PropertyGroup>\r
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />\r
- <ImportGroup Label="ExtensionSettings">\r
- </ImportGroup>\r
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">\r
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />\r
- <Import Project="$(ProjectDir)..\..\build\props\mrcpclient.props" />\r
- </ImportGroup>\r
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">\r
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.props" />\r
- <Import Project="$(ProjectDir)..\..\build\props\mrcpclient.props" />\r
- </ImportGroup>\r
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">\r
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />\r
- <Import Project="$(ProjectDir)..\..\build\props\mrcpclient.props" />\r
- </ImportGroup>\r
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">\r
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.props" />\r
- <Import Project="$(ProjectDir)..\..\build\props\mrcpclient.props" />\r
- </ImportGroup>\r
- <PropertyGroup Label="UserMacros" />\r
- <PropertyGroup>\r
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>\r
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(PlatformName)\$(Configuration)\</OutDir>\r
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(PlatformName)\$(Configuration)\</IntDir>\r
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(PlatformName)\$(Configuration)\</OutDir>\r
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(PlatformName)\$(Configuration)\</IntDir>\r
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(PlatformName)\$(Configuration)\</OutDir>\r
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(PlatformName)\$(Configuration)\</IntDir>\r
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(PlatformName)\$(Configuration)\</OutDir>\r
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(PlatformName)\$(Configuration)\</IntDir>\r
- </PropertyGroup>\r
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
- <ClCompile>\r
- <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
- </ClCompile>\r
- </ItemDefinitionGroup>\r
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">\r
- <Midl>\r
- <TargetEnvironment>X64</TargetEnvironment>\r
- </Midl>\r
- <ClCompile>\r
- <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>\r
- </ClCompile>\r
- </ItemDefinitionGroup>\r
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
- <ClCompile>\r
- <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
- </ClCompile>\r
- </ItemDefinitionGroup>\r
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">\r
- <Midl>\r
- <TargetEnvironment>X64</TargetEnvironment>\r
- </Midl>\r
- <ClCompile>\r
- <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
- </ClCompile>\r
- </ItemDefinitionGroup>\r
- <ItemGroup>\r
- <ClInclude Include="include\mrcp_application.h" />\r
- <ClInclude Include="include\mrcp_client.h" />\r
- <ClInclude Include="include\mrcp_client_session.h" />\r
- <ClInclude Include="include\mrcp_client_types.h" />\r
- </ItemGroup>\r
- <ItemGroup>\r
- <ClCompile Include="src\mrcp_application.c" />\r
- <ClCompile Include="src\mrcp_client.c" />\r
- <ClCompile Include="src\mrcp_client_session.c" />\r
- </ItemGroup>\r
- <ItemGroup>\r
- <ProjectReference Include="..\..\..\win32\apr\libapr.2017.vcxproj">\r
- <Project>{f6c55d93-b927-4483-bb69-15aef3dd2dff}</Project>\r
- </ProjectReference>\r
- </ItemGroup>\r
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />\r
- <ImportGroup Label="ExtensionTargets">\r
- </ImportGroup>\r
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="mrcpclient"
- ProjectGUID="{72782932-37CC-46AE-8C7F-9A7B1A6EE108}"
- RootNamespace="mrcpclient"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- <Platform
- Name="x64"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- ConfigurationType="4"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unilib.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpclient.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- ConfigurationType="4"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unilib.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpclient.vsprops"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|x64"
- ConfigurationType="4"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unilib-x64.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpclient.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|x64"
- ConfigurationType="4"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unilib-x64.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpclient.vsprops"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="include"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- <File
- RelativePath=".\include\mrcp_application.h"
- >
- </File>
- <File
- RelativePath=".\include\mrcp_client.h"
- >
- </File>
- <File
- RelativePath=".\include\mrcp_client_session.h"
- >
- </File>
- <File
- RelativePath=".\include\mrcp_client_types.h"
- >
- </File>
- </Filter>
- <Filter
- Name="src"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- >
- <File
- RelativePath=".\src\mrcp_application.c"
- >
- </File>
- <File
- RelativePath=".\src\mrcp_client.c"
- >
- </File>
- <File
- RelativePath=".\src\mrcp_client_session.c"
- >
- </File>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{72782932-37CC-46AE-8C7F-9A7B1A6EE108}</ProjectGuid>
- <RootNamespace>mrcpclient</RootNamespace>
- <Keyword>Win32Proj</Keyword>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unilib.props" />
- <Import Project="$(ProjectDir)..\..\build\props\mrcpclient.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" />
- <Import Project="$(ProjectDir)..\..\build\props\unilib.props" />
- <Import Project="$(ProjectDir)..\..\build\props\mrcpclient.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unilib-x64.props" />
- <Import Project="$(ProjectDir)..\..\build\props\mrcpclient.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" />
- <Import Project="$(ProjectDir)..\..\build\props\unilib-x64.props" />
- <Import Project="$(ProjectDir)..\..\build\props\mrcpclient.props" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClInclude Include="include\mrcp_application.h" />
- <ClInclude Include="include\mrcp_client.h" />
- <ClInclude Include="include\mrcp_client_session.h" />
- <ClInclude Include="include\mrcp_client_types.h" />
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="src\mrcp_application.c" />
- <ClCompile Include="src\mrcp_client.c" />
- <ClCompile Include="src\mrcp_client_session.c" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\mrcp-signaling\mrcpsignaling.vcxproj">
- <Project>{12a49562-bab9-43a3-a21d-15b60bbb4c31}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- <ProjectReference Include="..\mrcpv2-transport\mrcpv2transport.vcxproj">
- <Project>{a9edac04-6a5f-4ba7-bc0d-cce7b255b6ea}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="include">
- <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
- </Filter>
- <Filter Include="src">
- <UniqueIdentifier>{dc4325fe-8e7a-4a40-ab63-4173d85cf131}</UniqueIdentifier>
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="include\mrcp_application.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mrcp_client.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mrcp_client_session.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mrcp_client_types.h">
- <Filter>include</Filter>
- </ClInclude>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="src\mrcp_application.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\mrcp_client.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\mrcp_client_session.c">
- <Filter>src</Filter>
- </ClCompile>
- </ItemGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-/*
- * 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;
-}
+++ /dev/null
-/*
- * 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 <apr_thread_cond.h>
-#include <apr_hash.h>
-#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);
-}
+++ /dev/null
-/*
- * 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; i<session->channels->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; i<session->channels->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; i<session->terminations->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; i<session->channels->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; i<session->channels->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; i<session->channels->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; i<session->terminations->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; i<MRCP_RESOURCE_TYPE_COUNT; i++) {
- resource = mrcp_resource_get(session->profile->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; i<mpf_message_container->count; 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; i<count; i++) {
- /* get existing channel */
- channel = APR_ARRAY_IDX(session->channels,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; i<count; i++) {
- mpf_rtp_media_descriptor_t *remote_media;
- mpf_rtp_termination_descriptor_t *rtp_descriptor;
- /* get existing termination */
- slot = &APR_ARRAY_IDX(session->terminations,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;
-}
+++ /dev/null
-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
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 <apr_tables.h>
-#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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="mrcpengine"
- ProjectGUID="{843425BE-9A9A-44F4-A4E3-4B57D6ABD53C}"
- RootNamespace="mrcpengine"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- <Platform
- Name="x64"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- ConfigurationType="4"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unilib.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpengine.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- ConfigurationType="4"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unilib.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpengine.vsprops"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|x64"
- ConfigurationType="4"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unilib-x64.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpengine.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|x64"
- ConfigurationType="4"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unilib-x64.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpengine.vsprops"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="include"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- <File
- RelativePath=".\include\mrcp_engine_factory.h"
- >
- </File>
- <File
- RelativePath=".\include\mrcp_engine_iface.h"
- >
- </File>
- <File
- RelativePath=".\include\mrcp_engine_impl.h"
- >
- </File>
- <File
- RelativePath=".\include\mrcp_engine_loader.h"
- >
- </File>
- <File
- RelativePath=".\include\mrcp_engine_plugin.h"
- >
- </File>
- <File
- RelativePath=".\include\mrcp_engine_types.h"
- >
- </File>
- <File
- RelativePath=".\include\mrcp_recog_engine.h"
- >
- </File>
- <File
- RelativePath=".\include\mrcp_recog_state_machine.h"
- >
- </File>
- <File
- RelativePath=".\include\mrcp_recorder_engine.h"
- >
- </File>
- <File
- RelativePath=".\include\mrcp_recorder_state_machine.h"
- >
- </File>
- <File
- RelativePath=".\include\mrcp_resource_engine.h"
- >
- </File>
- <File
- RelativePath=".\include\mrcp_state_machine.h"
- >
- </File>
- <File
- RelativePath=".\include\mrcp_synth_engine.h"
- >
- </File>
- <File
- RelativePath=".\include\mrcp_synth_state_machine.h"
- >
- </File>
- <File
- RelativePath=".\include\mrcp_verifier_engine.h"
- >
- </File>
- <File
- RelativePath=".\include\mrcp_verifier_state_machine.h"
- >
- </File>
- </Filter>
- <Filter
- Name="src"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- >
- <File
- RelativePath=".\src\mrcp_engine_factory.c"
- >
- </File>
- <File
- RelativePath=".\src\mrcp_engine_iface.c"
- >
- </File>
- <File
- RelativePath=".\src\mrcp_engine_impl.c"
- >
- </File>
- <File
- RelativePath=".\src\mrcp_engine_loader.c"
- >
- </File>
- <File
- RelativePath=".\src\mrcp_recog_state_machine.c"
- >
- </File>
- <File
- RelativePath=".\src\mrcp_recorder_state_machine.c"
- >
- </File>
- <File
- RelativePath=".\src\mrcp_synth_state_machine.c"
- >
- </File>
- <File
- RelativePath=".\src\mrcp_verifier_state_machine.c"
- >
- </File>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{843425BE-9A9A-44F4-A4E3-4B57D6ABD53C}</ProjectGuid>
- <RootNamespace>mrcpengine</RootNamespace>
- <Keyword>Win32Proj</Keyword>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unilib.props" />
- <Import Project="$(ProjectDir)..\..\build\props\mrcpengine.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" />
- <Import Project="$(ProjectDir)..\..\build\props\unilib.props" />
- <Import Project="$(ProjectDir)..\..\build\props\mrcpengine.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unilib-x64.props" />
- <Import Project="$(ProjectDir)..\..\build\props\mrcpengine.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" />
- <Import Project="$(ProjectDir)..\..\build\props\unilib-x64.props" />
- <Import Project="$(ProjectDir)..\..\build\props\mrcpengine.props" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClInclude Include="include\mrcp_engine_factory.h" />
- <ClInclude Include="include\mrcp_engine_iface.h" />
- <ClInclude Include="include\mrcp_engine_impl.h" />
- <ClInclude Include="include\mrcp_engine_loader.h" />
- <ClInclude Include="include\mrcp_engine_plugin.h" />
- <ClInclude Include="include\mrcp_engine_types.h" />
- <ClInclude Include="include\mrcp_recog_engine.h" />
- <ClInclude Include="include\mrcp_recog_state_machine.h" />
- <ClInclude Include="include\mrcp_recorder_engine.h" />
- <ClInclude Include="include\mrcp_recorder_state_machine.h" />
- <ClInclude Include="include\mrcp_resource_engine.h" />
- <ClInclude Include="include\mrcp_state_machine.h" />
- <ClInclude Include="include\mrcp_synth_engine.h" />
- <ClInclude Include="include\mrcp_synth_state_machine.h" />
- <ClInclude Include="include\mrcp_verifier_engine.h" />
- <ClInclude Include="include\mrcp_verifier_state_machine.h" />
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="src\mrcp_engine_factory.c" />
- <ClCompile Include="src\mrcp_engine_iface.c" />
- <ClCompile Include="src\mrcp_engine_impl.c" />
- <ClCompile Include="src\mrcp_engine_loader.c" />
- <ClCompile Include="src\mrcp_recog_state_machine.c" />
- <ClCompile Include="src\mrcp_recorder_state_machine.c" />
- <ClCompile Include="src\mrcp_synth_state_machine.c" />
- <ClCompile Include="src\mrcp_verifier_state_machine.c" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\mpf\mpf.vcxproj">
- <Project>{b5a00bfa-6083-4fae-a097-71642d6473b5}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- <ProjectReference Include="..\mrcp\mrcp.vcxproj">
- <Project>{1c320193-46a6-4b34-9c56-8ab584fc1b56}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="include">
- <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
- </Filter>
- <Filter Include="src">
- <UniqueIdentifier>{dd062ad2-9a06-4efc-8e17-328567b52854}</UniqueIdentifier>
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="include\mrcp_engine_factory.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mrcp_engine_iface.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mrcp_engine_impl.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mrcp_engine_loader.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mrcp_engine_plugin.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mrcp_engine_types.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mrcp_recog_engine.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mrcp_recog_state_machine.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mrcp_recorder_engine.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mrcp_recorder_state_machine.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mrcp_resource_engine.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mrcp_state_machine.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mrcp_synth_engine.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mrcp_synth_state_machine.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mrcp_verifier_engine.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mrcp_verifier_state_machine.h">
- <Filter>include</Filter>
- </ClInclude>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="src\mrcp_engine_factory.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\mrcp_engine_iface.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\mrcp_engine_impl.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\mrcp_engine_loader.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\mrcp_recog_state_machine.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\mrcp_recorder_state_machine.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\mrcp_synth_state_machine.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\mrcp_verifier_state_machine.c">
- <Filter>src</Filter>
- </ClCompile>
- </ItemGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-/*
- * 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 <apr_hash.h>
-#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);
-}
+++ /dev/null
-/*
- * 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;
-}
+++ /dev/null
-/*
- * 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;
-}
+++ /dev/null
-/*
- * 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 <apr_dso.h>
-#include <apr_hash.h>
-#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;
-}
+++ /dev/null
-/*
- * 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;
-}
+++ /dev/null
-/*
- * 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;
-}
+++ /dev/null
-/*
- * 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;
-}
+++ /dev/null
-/*
- * 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;
-}
+++ /dev/null
-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
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 <apr_hash.h>
-#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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="mrcpserver"
- ProjectGUID="{18B1F35A-10F8-4287-9B37-2D10501B0B38}"
- RootNamespace="mrcpserver"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- <Platform
- Name="x64"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- ConfigurationType="4"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unilib.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpserver.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- ConfigurationType="4"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unilib.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpserver.vsprops"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|x64"
- ConfigurationType="4"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unilib-x64.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpserver.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|x64"
- ConfigurationType="4"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unilib-x64.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpserver.vsprops"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="include"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- <File
- RelativePath=".\include\mrcp_server.h"
- >
- </File>
- <File
- RelativePath=".\include\mrcp_server_session.h"
- >
- </File>
- <File
- RelativePath=".\include\mrcp_server_types.h"
- >
- </File>
- </Filter>
- <Filter
- Name="src"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- >
- <File
- RelativePath=".\src\mrcp_server.c"
- >
- </File>
- <File
- RelativePath=".\src\mrcp_server_session.c"
- >
- </File>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{18B1F35A-10F8-4287-9B37-2D10501B0B38}</ProjectGuid>
- <RootNamespace>mrcpserver</RootNamespace>
- <Keyword>Win32Proj</Keyword>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unilib.props" />
- <Import Project="$(ProjectDir)..\..\build\props\mrcpserver.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" />
- <Import Project="$(ProjectDir)..\..\build\props\unilib.props" />
- <Import Project="$(ProjectDir)..\..\build\props\mrcpserver.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unilib-x64.props" />
- <Import Project="$(ProjectDir)..\..\build\props\mrcpserver.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" />
- <Import Project="$(ProjectDir)..\..\build\props\unilib-x64.props" />
- <Import Project="$(ProjectDir)..\..\build\props\mrcpserver.props" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClInclude Include="include\mrcp_server.h" />
- <ClInclude Include="include\mrcp_server_session.h" />
- <ClInclude Include="include\mrcp_server_types.h" />
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="src\mrcp_server.c" />
- <ClCompile Include="src\mrcp_server_session.c" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\mrcp-engine\mrcpengine.vcxproj">
- <Project>{843425be-9a9a-44f4-a4e3-4b57d6abd53c}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- <ProjectReference Include="..\mrcp-signaling\mrcpsignaling.vcxproj">
- <Project>{12a49562-bab9-43a3-a21d-15b60bbb4c31}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- <ProjectReference Include="..\mrcpv2-transport\mrcpv2transport.vcxproj">
- <Project>{a9edac04-6a5f-4ba7-bc0d-cce7b255b6ea}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="include">
- <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
- </Filter>
- <Filter Include="src">
- <UniqueIdentifier>{4557fd27-79b0-442d-809b-82996c7da820}</UniqueIdentifier>
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="include\mrcp_server.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mrcp_server_session.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mrcp_server_types.h">
- <Filter>include</Filter>
- </ClInclude>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="src\mrcp_server.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\mrcp_server_session.c">
- <Filter>src</Filter>
- </ClCompile>
- </ItemGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-/*
- * 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; i<MRCP_RESOURCE_TYPE_COUNT; i++) {
- resource = mrcp_resource_get(server->resource_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);
-}
+++ /dev/null
-/*
- * 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; i<offer->control_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; i<offer->audio_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; i<offer->video_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; i<session->channels->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; i<session->terminations->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; i<session->channels->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; i<session->channels->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; i<count; i++) {
- channel = APR_ARRAY_IDX(session->channels,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(; i<descriptor->control_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; i<session->channels->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; i<slot->channels->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; i<count; i++) {
- /* get existing termination */
- slot = &APR_ARRAY_IDX(session->terminations,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(; i<descriptor->audio_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; i<session->channels->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; i<session->terminations->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; i<session->channels->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; i<session->channels->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; i<mpf_message_container->count; 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;
-}
+++ /dev/null
-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
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 <apr_network_io.h>
-#include <apr_tables.h>
-#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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>\r
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
- <ItemGroup>\r
- <Filter Include="include">\r
- <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>\r
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>\r
- </Filter>\r
- <Filter Include="src">\r
- <UniqueIdentifier>{f3dc550f-1a0f-4b9e-b077-3b6940dc5531}</UniqueIdentifier>\r
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>\r
- </Filter>\r
- </ItemGroup>\r
- <ItemGroup>\r
- <ClInclude Include="include\mrcp_session.h">\r
- <Filter>include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="include\mrcp_session_descriptor.h">\r
- <Filter>include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="include\mrcp_sig_agent.h">\r
- <Filter>include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="include\mrcp_sig_types.h">\r
- <Filter>include</Filter>\r
- </ClInclude>\r
- </ItemGroup>\r
- <ItemGroup>\r
- <ClCompile Include="src\mrcp_session_descriptor.c">\r
- <Filter>src</Filter>\r
- </ClCompile>\r
- <ClCompile Include="src\mrcp_sig_agent.c">\r
- <Filter>src</Filter>\r
- </ClCompile>\r
- </ItemGroup>\r
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>\r
-<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
- <ItemGroup Label="ProjectConfigurations">\r
- <ProjectConfiguration Include="Debug|Win32">\r
- <Configuration>Debug</Configuration>\r
- <Platform>Win32</Platform>\r
- </ProjectConfiguration>\r
- <ProjectConfiguration Include="Debug|x64">\r
- <Configuration>Debug</Configuration>\r
- <Platform>x64</Platform>\r
- </ProjectConfiguration>\r
- <ProjectConfiguration Include="Release|Win32">\r
- <Configuration>Release</Configuration>\r
- <Platform>Win32</Platform>\r
- </ProjectConfiguration>\r
- <ProjectConfiguration Include="Release|x64">\r
- <Configuration>Release</Configuration>\r
- <Platform>x64</Platform>\r
- </ProjectConfiguration>\r
- </ItemGroup>\r
- <PropertyGroup Label="Globals">\r
- <ProjectName>mrcpsignaling</ProjectName>\r
- <ProjectGuid>{12A49562-BAB9-43A3-A21D-15B60BBB4C31}</ProjectGuid>\r
- <RootNamespace>mrcpsignaling</RootNamespace>\r
- <Keyword>Win32Proj</Keyword>\r
- </PropertyGroup>\r
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />\r
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">\r
- <ConfigurationType>StaticLibrary</ConfigurationType>\r
- <CharacterSet>Unicode</CharacterSet>\r
- <WholeProgramOptimization>true</WholeProgramOptimization>\r
- <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>\r
- </PropertyGroup>\r
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">\r
- <ConfigurationType>StaticLibrary</ConfigurationType>\r
- <CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>\r
- </PropertyGroup>\r
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">\r
- <ConfigurationType>StaticLibrary</ConfigurationType>\r
- <CharacterSet>Unicode</CharacterSet>\r
- <WholeProgramOptimization>true</WholeProgramOptimization>\r
- <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>\r
- </PropertyGroup>\r
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">\r
- <ConfigurationType>StaticLibrary</ConfigurationType>\r
- <CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>\r
- </PropertyGroup>\r
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />\r
- <ImportGroup Label="ExtensionSettings">\r
- </ImportGroup>\r
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">\r
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />\r
- <Import Project="$(ProjectDir)..\..\build\props\mrcpsignaling.props" />\r
- </ImportGroup>\r
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">\r
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.props" />\r
- <Import Project="$(ProjectDir)..\..\build\props\mrcpsignaling.props" />\r
- </ImportGroup>\r
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">\r
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />\r
- <Import Project="$(ProjectDir)..\..\build\props\mrcpsignaling.props" />\r
- </ImportGroup>\r
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">\r
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.props" />\r
- <Import Project="$(ProjectDir)..\..\build\props\mrcpsignaling.props" />\r
- </ImportGroup>\r
- <PropertyGroup Label="UserMacros" />\r
- <PropertyGroup>\r
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>\r
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(PlatformName)\$(Configuration)\</OutDir>\r
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(PlatformName)\$(Configuration)\</IntDir>\r
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(PlatformName)\$(Configuration)\</OutDir>\r
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(PlatformName)\$(Configuration)\</IntDir>\r
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(PlatformName)\$(Configuration)\</OutDir>\r
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(PlatformName)\$(Configuration)\</IntDir>\r
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(PlatformName)\$(Configuration)\</OutDir>\r
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(PlatformName)\$(Configuration)\</IntDir>\r
- </PropertyGroup>\r
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
- <ClCompile>\r
- <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
- </ClCompile>\r
- </ItemDefinitionGroup>\r
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">\r
- <Midl>\r
- <TargetEnvironment>X64</TargetEnvironment>\r
- </Midl>\r
- <ClCompile>\r
- <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>\r
- </ClCompile>\r
- </ItemDefinitionGroup>\r
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
- <ClCompile>\r
- <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
- </ClCompile>\r
- </ItemDefinitionGroup>\r
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">\r
- <Midl>\r
- <TargetEnvironment>X64</TargetEnvironment>\r
- </Midl>\r
- <ClCompile>\r
- <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
- </ClCompile>\r
- </ItemDefinitionGroup>\r
- <ItemGroup>\r
- <ClInclude Include="include\mrcp_session.h" />\r
- <ClInclude Include="include\mrcp_session_descriptor.h" />\r
- <ClInclude Include="include\mrcp_sig_agent.h" />\r
- <ClInclude Include="include\mrcp_sig_types.h" />\r
- </ItemGroup>\r
- <ItemGroup>\r
- <ClCompile Include="src\mrcp_session_descriptor.c" />\r
- <ClCompile Include="src\mrcp_sig_agent.c" />\r
- </ItemGroup>\r
- <ItemGroup>\r
- <ProjectReference Include="..\..\..\win32\apr\libapr.2017.vcxproj">\r
- <Project>{f6c55d93-b927-4483-bb69-15aef3dd2dff}</Project>\r
- </ProjectReference>\r
- </ItemGroup>\r
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />\r
- <ImportGroup Label="ExtensionTargets">\r
- </ImportGroup>\r
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="mrcpsignaling"
- ProjectGUID="{12A49562-BAB9-43A3-A21D-15B60BBB4C31}"
- RootNamespace="mrcpsignaling"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- <Platform
- Name="x64"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- ConfigurationType="4"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unilib.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpsignaling.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- ConfigurationType="4"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unilib.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpsignaling.vsprops"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|x64"
- ConfigurationType="4"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unilib-x64.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpsignaling.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|x64"
- ConfigurationType="4"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unilib-x64.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpsignaling.vsprops"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="include"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- <File
- RelativePath=".\include\mrcp_session.h"
- >
- </File>
- <File
- RelativePath=".\include\mrcp_session_descriptor.h"
- >
- </File>
- <File
- RelativePath=".\include\mrcp_sig_agent.h"
- >
- </File>
- <File
- RelativePath=".\include\mrcp_sig_types.h"
- >
- </File>
- </Filter>
- <Filter
- Name="src"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- >
- <File
- RelativePath=".\src\mrcp_session_descriptor.c"
- >
- </File>
- <File
- RelativePath=".\src\mrcp_sig_agent.c"
- >
- </File>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{12A49562-BAB9-43A3-A21D-15B60BBB4C31}</ProjectGuid>
- <RootNamespace>mrcpsignaling</RootNamespace>
- <Keyword>Win32Proj</Keyword>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unilib.props" />
- <Import Project="$(ProjectDir)..\..\build\props\mrcpsignaling.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" />
- <Import Project="$(ProjectDir)..\..\build\props\unilib.props" />
- <Import Project="$(ProjectDir)..\..\build\props\mrcpsignaling.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unilib-x64.props" />
- <Import Project="$(ProjectDir)..\..\build\props\mrcpsignaling.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" />
- <Import Project="$(ProjectDir)..\..\build\props\unilib-x64.props" />
- <Import Project="$(ProjectDir)..\..\build\props\mrcpsignaling.props" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClInclude Include="include\mrcp_session.h" />
- <ClInclude Include="include\mrcp_session_descriptor.h" />
- <ClInclude Include="include\mrcp_sig_agent.h" />
- <ClInclude Include="include\mrcp_sig_types.h" />
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="src\mrcp_session_descriptor.c" />
- <ClCompile Include="src\mrcp_sig_agent.c" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\mpf\mpf.vcxproj">
- <Project>{b5a00bfa-6083-4fae-a097-71642d6473b5}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- <ProjectReference Include="..\mrcp\mrcp.vcxproj">
- <Project>{1c320193-46a6-4b34-9c56-8ab584fc1b56}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="include">
- <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
- </Filter>
- <Filter Include="src">
- <UniqueIdentifier>{38ec7b90-673c-4c54-9c3a-13d5270556a0}</UniqueIdentifier>
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="include\mrcp_session.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mrcp_session_descriptor.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mrcp_sig_agent.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mrcp_sig_types.h">
- <Filter>include</Filter>
- </ClInclude>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="src\mrcp_session_descriptor.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\mrcp_sig_agent.c">
- <Filter>src</Filter>
- </ClCompile>
- </ItemGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-/*
- * 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";
-}
+++ /dev/null
-/*
- * 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);
- }
-}
+++ /dev/null
-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
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 <apr_hash.h>
-#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; i<resource_count; i++) {
- resource_factory->resource_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);
-}
+++ /dev/null
-/*
- * 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; id<MRCP_RESOURCE_TYPE_COUNT; id++) {
- mrcp_resource_load_by_id(loader,id);
- }
- return TRUE;
-}
-
-/** Load MRCP resource by resource name */
-MRCP_DECLARE(apt_bool_t) mrcp_resource_load(mrcp_resource_loader_t *loader, const apt_str_t *name)
-{
- mrcp_resource_id id = apt_string_table_id_find(
- mrcp_resource_string_table,
- MRCP_RESOURCE_TYPE_COUNT,
- name);
-
- mrcp_resource_t *resource = mrcp_resource_create_by_id(id,loader->pool);
- 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;
-}
+++ /dev/null
-/*
- * 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;
-}
+++ /dev/null
-/*
- * 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 <apt.h>
-#include <apt_dir_layout.h>
-
-/** 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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; i<request_id_list->count; 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; i<request_id_list->count; i++) {
- if(request_id_list->ids[i] == request_id) {
- return TRUE;
- }
- }
- return FALSE;
-}
+++ /dev/null
-/*
- * 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);
-}
+++ /dev/null
-/*
- * 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;
-}
+++ /dev/null
-/*
- * 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);
-}
+++ /dev/null
-/*
- * 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 <stdlib.h>
-#include <stdio.h>
-#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;
-}
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>\r
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
- <ItemGroup>\r
- <Filter Include="include">\r
- <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>\r
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>\r
- </Filter>\r
- <Filter Include="message">\r
- <UniqueIdentifier>{19ad4bde-c4f4-4937-9073-ca2780341d76}</UniqueIdentifier>\r
- </Filter>\r
- <Filter Include="message\include">\r
- <UniqueIdentifier>{8ec996ac-8a0a-4bf0-9b3c-535616585109}</UniqueIdentifier>\r
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>\r
- </Filter>\r
- <Filter Include="message\src">\r
- <UniqueIdentifier>{5ba77874-7c17-4748-b5ba-b07b7f0a2169}</UniqueIdentifier>\r
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>\r
- </Filter>\r
- <Filter Include="control">\r
- <UniqueIdentifier>{f30fd049-a10d-4aea-b4bb-3eb674690fdd}</UniqueIdentifier>\r
- </Filter>\r
- <Filter Include="control\include">\r
- <UniqueIdentifier>{7e71717b-6f22-4c59-ba50-7b5a15516b2f}</UniqueIdentifier>\r
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>\r
- </Filter>\r
- <Filter Include="control\src">\r
- <UniqueIdentifier>{c66dbb84-ce9d-4408-b54d-4d0ec51069fb}</UniqueIdentifier>\r
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>\r
- </Filter>\r
- <Filter Include="resources">\r
- <UniqueIdentifier>{f20cfd62-4bb9-42de-bf1c-d578c8cd1a18}</UniqueIdentifier>\r
- </Filter>\r
- <Filter Include="resources\include">\r
- <UniqueIdentifier>{039a4834-7ddb-40e7-9177-55d11ef1e733}</UniqueIdentifier>\r
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>\r
- </Filter>\r
- <Filter Include="resources\src">\r
- <UniqueIdentifier>{dc087d31-8ecf-473c-baa1-f3091e16014d}</UniqueIdentifier>\r
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>\r
- </Filter>\r
- </ItemGroup>\r
- <ItemGroup>\r
- <ClInclude Include="include\mrcp.h">\r
- <Filter>include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="include\mrcp_types.h">\r
- <Filter>include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="message\include\mrcp_generic_header.h">\r
- <Filter>message\include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="message\include\mrcp_header_accessor.h">\r
- <Filter>message\include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="message\include\mrcp_message.h">\r
- <Filter>message\include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="message\include\mrcp_start_line.h">\r
- <Filter>message\include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="control\include\mrcp_resource.h">\r
- <Filter>control\include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="control\include\mrcp_resource_factory.h">\r
- <Filter>control\include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="control\include\mrcp_resource_loader.h">\r
- <Filter>control\include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="control\include\mrcp_stream.h">\r
- <Filter>control\include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="resources\include\mrcp_recog_header.h">\r
- <Filter>resources\include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="resources\include\mrcp_recog_resource.h">\r
- <Filter>resources\include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="resources\include\mrcp_recorder_header.h">\r
- <Filter>resources\include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="resources\include\mrcp_recorder_resource.h">\r
- <Filter>resources\include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="resources\include\mrcp_synth_header.h">\r
- <Filter>resources\include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="resources\include\mrcp_synth_resource.h">\r
- <Filter>resources\include</Filter>\r
- </ClInclude>\r
- </ItemGroup>\r
- <ItemGroup>\r
- <ClCompile Include="message\src\mrcp_generic_header.c">\r
- <Filter>message\src</Filter>\r
- </ClCompile>\r
- <ClCompile Include="message\src\mrcp_header_accessor.c">\r
- <Filter>message\src</Filter>\r
- </ClCompile>\r
- <ClCompile Include="message\src\mrcp_message.c">\r
- <Filter>message\src</Filter>\r
- </ClCompile>\r
- <ClCompile Include="message\src\mrcp_start_line.c">\r
- <Filter>message\src</Filter>\r
- </ClCompile>\r
- <ClCompile Include="control\src\mrcp_resource_factory.c">\r
- <Filter>control\src</Filter>\r
- </ClCompile>\r
- <ClCompile Include="control\src\mrcp_resource_loader.c">\r
- <Filter>control\src</Filter>\r
- </ClCompile>\r
- <ClCompile Include="control\src\mrcp_stream.c">\r
- <Filter>control\src</Filter>\r
- </ClCompile>\r
- <ClCompile Include="resources\src\mrcp_recog_header.c">\r
- <Filter>resources\src</Filter>\r
- </ClCompile>\r
- <ClCompile Include="resources\src\mrcp_recog_resource.c">\r
- <Filter>resources\src</Filter>\r
- </ClCompile>\r
- <ClCompile Include="resources\src\mrcp_recorder_header.c">\r
- <Filter>resources\src</Filter>\r
- </ClCompile>\r
- <ClCompile Include="resources\src\mrcp_recorder_resource.c">\r
- <Filter>resources\src</Filter>\r
- </ClCompile>\r
- <ClCompile Include="resources\src\mrcp_synth_header.c">\r
- <Filter>resources\src</Filter>\r
- </ClCompile>\r
- <ClCompile Include="resources\src\mrcp_synth_resource.c">\r
- <Filter>resources\src</Filter>\r
- </ClCompile>\r
- </ItemGroup>\r
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>\r
-<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
- <ItemGroup Label="ProjectConfigurations">\r
- <ProjectConfiguration Include="Debug|Win32">\r
- <Configuration>Debug</Configuration>\r
- <Platform>Win32</Platform>\r
- </ProjectConfiguration>\r
- <ProjectConfiguration Include="Debug|x64">\r
- <Configuration>Debug</Configuration>\r
- <Platform>x64</Platform>\r
- </ProjectConfiguration>\r
- <ProjectConfiguration Include="Release|Win32">\r
- <Configuration>Release</Configuration>\r
- <Platform>Win32</Platform>\r
- </ProjectConfiguration>\r
- <ProjectConfiguration Include="Release|x64">\r
- <Configuration>Release</Configuration>\r
- <Platform>x64</Platform>\r
- </ProjectConfiguration>\r
- </ItemGroup>\r
- <PropertyGroup Label="Globals">\r
- <ProjectName>mrcp</ProjectName>\r
- <ProjectGuid>{1C320193-46A6-4B34-9C56-8AB584FC1B56}</ProjectGuid>\r
- <RootNamespace>mrcp</RootNamespace>\r
- <Keyword>Win32Proj</Keyword>\r
- </PropertyGroup>\r
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />\r
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">\r
- <ConfigurationType>StaticLibrary</ConfigurationType>\r
- <CharacterSet>Unicode</CharacterSet>\r
- <WholeProgramOptimization>true</WholeProgramOptimization>\r
- <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>\r
- </PropertyGroup>\r
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">\r
- <ConfigurationType>StaticLibrary</ConfigurationType>\r
- <CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>\r
- </PropertyGroup>\r
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">\r
- <ConfigurationType>StaticLibrary</ConfigurationType>\r
- <CharacterSet>Unicode</CharacterSet>\r
- <WholeProgramOptimization>true</WholeProgramOptimization>\r
- <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>\r
- </PropertyGroup>\r
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">\r
- <ConfigurationType>StaticLibrary</ConfigurationType>\r
- <CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>\r
- </PropertyGroup>\r
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />\r
- <ImportGroup Label="ExtensionSettings">\r
- </ImportGroup>\r
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">\r
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />\r
- <Import Project="$(ProjectDir)..\..\build\props\mrcp.props" />\r
- </ImportGroup>\r
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">\r
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.props" />\r
- <Import Project="$(ProjectDir)..\..\build\props\mrcp.props" />\r
- </ImportGroup>\r
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">\r
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />\r
- <Import Project="$(ProjectDir)..\..\build\props\mrcp.props" />\r
- </ImportGroup>\r
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">\r
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.props" />\r
- <Import Project="$(ProjectDir)..\..\build\props\mrcp.props" />\r
- </ImportGroup>\r
- <PropertyGroup Label="UserMacros" />\r
- <PropertyGroup>\r
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>\r
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(PlatformName)\$(Configuration)\</OutDir>\r
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(PlatformName)\$(Configuration)\</IntDir>\r
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(PlatformName)\$(Configuration)\</OutDir>\r
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(PlatformName)\$(Configuration)\</IntDir>\r
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(PlatformName)\$(Configuration)\</OutDir>\r
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(PlatformName)\$(Configuration)\</IntDir>\r
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(PlatformName)\$(Configuration)\</OutDir>\r
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(PlatformName)\$(Configuration)\</IntDir>\r
- </PropertyGroup>\r
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
- <ClCompile>\r
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
- <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
- </ClCompile>\r
- </ItemDefinitionGroup>\r
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">\r
- <Midl>\r
- <TargetEnvironment>X64</TargetEnvironment>\r
- </Midl>\r
- <ClCompile>\r
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
- <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>\r
- </ClCompile>\r
- </ItemDefinitionGroup>\r
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
- <ClCompile>\r
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
- <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
- </ClCompile>\r
- </ItemDefinitionGroup>\r
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">\r
- <Midl>\r
- <TargetEnvironment>X64</TargetEnvironment>\r
- </Midl>\r
- <ClCompile>\r
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
- <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
- </ClCompile>\r
- </ItemDefinitionGroup>\r
- <ItemGroup>\r
- <ClInclude Include="include\mrcp.h" />\r
- <ClInclude Include="include\mrcp_types.h" />\r
- <ClInclude Include="message\include\mrcp_generic_header.h" />\r
- <ClInclude Include="message\include\mrcp__header.h" />\r
- <ClInclude Include="message\include\mrcp_header_accessor.h" />\r
- <ClInclude Include="message\include\mrcp_message.h" />\r
- <ClInclude Include="message\include\mrcp_start_line.h" />\r
- <ClInclude Include="control\include\mrcp_resource.h" />\r
- <ClInclude Include="control\include\mrcp_resource_factory.h" />\r
- <ClInclude Include="control\include\mrcp_resource_loader.h" />\r
- <ClInclude Include="control\include\mrcp_stream.h" />\r
- <ClInclude Include="resources\include\mrcp_recog_header.h" />\r
- <ClInclude Include="resources\include\mrcp_recog_resource.h" />\r
- <ClInclude Include="resources\include\mrcp_recorder_header.h" />\r
- <ClInclude Include="resources\include\mrcp_recorder_resource.h" />\r
- <ClInclude Include="resources\include\mrcp_synth_header.h" />\r
- <ClInclude Include="resources\include\mrcp_synth_resource.h" />\r
- <ClInclude Include="resources\include\mrcp_verifier_header.h" />\r
- <ClInclude Include="resources\include\mrcp_verifier_resource.h" />\r
- </ItemGroup>\r
- <ItemGroup>\r
- <ClCompile Include="message\src\mrcp_generic_header.c" />\r
- <ClCompile Include="message\src\mrcp_header.c" />\r
- <ClCompile Include="message\src\mrcp_header_accessor.c" />\r
- <ClCompile Include="message\src\mrcp_message.c" />\r
- <ClCompile Include="message\src\mrcp_start_line.c" />\r
- <ClCompile Include="control\src\mrcp_resource_factory.c" />\r
- <ClCompile Include="control\src\mrcp_resource_loader.c" />\r
- <ClCompile Include="control\src\mrcp_stream.c" />\r
- <ClCompile Include="resources\src\mrcp_recog_header.c" />\r
- <ClCompile Include="resources\src\mrcp_recog_resource.c" />\r
- <ClCompile Include="resources\src\mrcp_recorder_header.c" />\r
- <ClCompile Include="resources\src\mrcp_recorder_resource.c" />\r
- <ClCompile Include="resources\src\mrcp_synth_header.c" />\r
- <ClCompile Include="resources\src\mrcp_synth_resource.c" />\r
- <ClCompile Include="resources\src\mrcp_verifier_header.c" />\r
- <ClCompile Include="resources\src\mrcp_verifier_resource.c" />\r
- </ItemGroup>\r
- <ItemGroup>\r
- <ProjectReference Include="..\..\..\win32\apr\libapr.2017.vcxproj">\r
- <Project>{f6c55d93-b927-4483-bb69-15aef3dd2dff}</Project>\r
- </ProjectReference>\r
- </ItemGroup>\r
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />\r
- <ImportGroup Label="ExtensionTargets">\r
- </ImportGroup>\r
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="mrcp"
- ProjectGUID="{1C320193-46A6-4B34-9C56-8AB584FC1B56}"
- RootNamespace="mrcp"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- <Platform
- Name="x64"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- ConfigurationType="4"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unilib.vsprops;$(ProjectDir)..\..\build\vsprops\mrcp.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- ConfigurationType="4"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unilib.vsprops;$(ProjectDir)..\..\build\vsprops\mrcp.vsprops"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|x64"
- ConfigurationType="4"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unilib-x64.vsprops;$(ProjectDir)..\..\build\vsprops\mrcp.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|x64"
- ConfigurationType="4"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unilib-x64.vsprops;$(ProjectDir)..\..\build\vsprops\mrcp.vsprops"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="include"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- <File
- RelativePath=".\include\mrcp.h"
- >
- </File>
- <File
- RelativePath=".\include\mrcp_types.h"
- >
- </File>
- </Filter>
- <Filter
- Name="message"
- >
- <Filter
- Name="include"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- >
- <File
- RelativePath=".\message\include\mrcp_generic_header.h"
- >
- </File>
- <File
- RelativePath=".\message\include\mrcp_header.h"
- >
- </File>
- <File
- RelativePath=".\message\include\mrcp_header_accessor.h"
- >
- </File>
- <File
- RelativePath=".\message\include\mrcp_message.h"
- >
- </File>
- <File
- RelativePath=".\message\include\mrcp_start_line.h"
- >
- </File>
- </Filter>
- <Filter
- Name="src"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- >
- <File
- RelativePath=".\message\src\mrcp_generic_header.c"
- >
- </File>
- <File
- RelativePath=".\message\src\mrcp_header.c"
- >
- </File>
- <File
- RelativePath=".\message\src\mrcp_header_accessor.c"
- >
- </File>
- <File
- RelativePath=".\message\src\mrcp_message.c"
- >
- </File>
- <File
- RelativePath=".\message\src\mrcp_start_line.c"
- >
- </File>
- </Filter>
- </Filter>
- <Filter
- Name="control"
- >
- <Filter
- Name="include"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- >
- <File
- RelativePath=".\control\include\mrcp_resource.h"
- >
- </File>
- <File
- RelativePath=".\control\include\mrcp_resource_factory.h"
- >
- </File>
- <File
- RelativePath=".\control\include\mrcp_resource_loader.h"
- >
- </File>
- <File
- RelativePath=".\control\include\mrcp_stream.h"
- >
- </File>
- </Filter>
- <Filter
- Name="src"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- >
- <File
- RelativePath=".\control\src\mrcp_resource_factory.c"
- >
- </File>
- <File
- RelativePath=".\control\src\mrcp_resource_loader.c"
- >
- </File>
- <File
- RelativePath=".\control\src\mrcp_stream.c"
- >
- </File>
- </Filter>
- </Filter>
- <Filter
- Name="resources"
- >
- <Filter
- Name="include"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- >
- <File
- RelativePath=".\resources\include\mrcp_recog_header.h"
- >
- </File>
- <File
- RelativePath=".\resources\include\mrcp_recog_resource.h"
- >
- </File>
- <File
- RelativePath=".\resources\include\mrcp_recorder_header.h"
- >
- </File>
- <File
- RelativePath=".\resources\include\mrcp_recorder_resource.h"
- >
- </File>
- <File
- RelativePath=".\resources\include\mrcp_synth_header.h"
- >
- </File>
- <File
- RelativePath=".\resources\include\mrcp_synth_resource.h"
- >
- </File>
- <File
- RelativePath=".\resources\include\mrcp_verifier_header.h"
- >
- </File>
- <File
- RelativePath=".\resources\include\mrcp_verifier_resource.h"
- >
- </File>
- </Filter>
- <Filter
- Name="src"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- >
- <File
- RelativePath=".\resources\src\mrcp_recog_header.c"
- >
- </File>
- <File
- RelativePath=".\resources\src\mrcp_recog_resource.c"
- >
- </File>
- <File
- RelativePath=".\resources\src\mrcp_recorder_header.c"
- >
- </File>
- <File
- RelativePath=".\resources\src\mrcp_recorder_resource.c"
- >
- </File>
- <File
- RelativePath=".\resources\src\mrcp_synth_header.c"
- >
- </File>
- <File
- RelativePath=".\resources\src\mrcp_synth_resource.c"
- >
- </File>
- <File
- RelativePath=".\resources\src\mrcp_verifier_header.c"
- >
- </File>
- <File
- RelativePath=".\resources\src\mrcp_verifier_resource.c"
- >
- </File>
- </Filter>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{1C320193-46A6-4B34-9C56-8AB584FC1B56}</ProjectGuid>
- <RootNamespace>mrcp</RootNamespace>
- <Keyword>Win32Proj</Keyword>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unilib.props" />
- <Import Project="$(ProjectDir)..\..\build\props\mrcp.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" />
- <Import Project="$(ProjectDir)..\..\build\props\unilib.props" />
- <Import Project="$(ProjectDir)..\..\build\props\mrcp.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unilib-x64.props" />
- <Import Project="$(ProjectDir)..\..\build\props\mrcp.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" />
- <Import Project="$(ProjectDir)..\..\build\props\unilib-x64.props" />
- <Import Project="$(ProjectDir)..\..\build\props\mrcp.props" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClInclude Include="include\mrcp.h" />
- <ClInclude Include="include\mrcp_types.h" />
- <ClInclude Include="message\include\mrcp_generic_header.h" />
- <ClInclude Include="message\include\mrcp_header.h" />
- <ClInclude Include="message\include\mrcp_header_accessor.h" />
- <ClInclude Include="message\include\mrcp_message.h" />
- <ClInclude Include="message\include\mrcp_start_line.h" />
- <ClInclude Include="control\include\mrcp_resource.h" />
- <ClInclude Include="control\include\mrcp_resource_factory.h" />
- <ClInclude Include="control\include\mrcp_resource_loader.h" />
- <ClInclude Include="control\include\mrcp_stream.h" />
- <ClInclude Include="resources\include\mrcp_recog_header.h" />
- <ClInclude Include="resources\include\mrcp_recog_resource.h" />
- <ClInclude Include="resources\include\mrcp_recorder_header.h" />
- <ClInclude Include="resources\include\mrcp_recorder_resource.h" />
- <ClInclude Include="resources\include\mrcp_synth_header.h" />
- <ClInclude Include="resources\include\mrcp_synth_resource.h" />
- <ClInclude Include="resources\include\mrcp_verifier_header.h" />
- <ClInclude Include="resources\include\mrcp_verifier_resource.h" />
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="message\src\mrcp_generic_header.c" />
- <ClCompile Include="message\src\mrcp_header.c" />
- <ClCompile Include="message\src\mrcp_header_accessor.c" />
- <ClCompile Include="message\src\mrcp_message.c" />
- <ClCompile Include="message\src\mrcp_start_line.c" />
- <ClCompile Include="control\src\mrcp_resource_factory.c" />
- <ClCompile Include="control\src\mrcp_resource_loader.c" />
- <ClCompile Include="control\src\mrcp_stream.c" />
- <ClCompile Include="resources\src\mrcp_recog_header.c" />
- <ClCompile Include="resources\src\mrcp_recog_resource.c" />
- <ClCompile Include="resources\src\mrcp_recorder_header.c" />
- <ClCompile Include="resources\src\mrcp_recorder_resource.c" />
- <ClCompile Include="resources\src\mrcp_synth_header.c" />
- <ClCompile Include="resources\src\mrcp_synth_resource.c" />
- <ClCompile Include="resources\src\mrcp_verifier_header.c" />
- <ClCompile Include="resources\src\mrcp_verifier_resource.c" />
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="include">
- <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
- </Filter>
- <Filter Include="message">
- <UniqueIdentifier>{235b9544-2004-49c6-96de-a5830544296e}</UniqueIdentifier>
- </Filter>
- <Filter Include="message\include">
- <UniqueIdentifier>{64717899-118b-46de-8646-d7312b19ce00}</UniqueIdentifier>
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
- </Filter>
- <Filter Include="message\src">
- <UniqueIdentifier>{1b656d42-e8f0-4126-85da-9bb8a470cfaa}</UniqueIdentifier>
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
- </Filter>
- <Filter Include="control">
- <UniqueIdentifier>{39545f85-6811-4878-af3f-26d813012ea3}</UniqueIdentifier>
- </Filter>
- <Filter Include="control\include">
- <UniqueIdentifier>{e165b2a9-81db-4030-9e72-7189ee45182b}</UniqueIdentifier>
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
- </Filter>
- <Filter Include="control\src">
- <UniqueIdentifier>{a4e3b1a7-762d-4fcf-83e8-f52675aab2ff}</UniqueIdentifier>
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
- </Filter>
- <Filter Include="resources">
- <UniqueIdentifier>{35e8458d-fc25-4066-b4be-ab452a6da8a9}</UniqueIdentifier>
- </Filter>
- <Filter Include="resources\include">
- <UniqueIdentifier>{8bbdedd2-2c1e-4474-8dbb-fcecf1f9a869}</UniqueIdentifier>
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
- </Filter>
- <Filter Include="resources\src">
- <UniqueIdentifier>{1d167695-a5d2-4f87-8bd3-ea21cea5a368}</UniqueIdentifier>
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="include\mrcp.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mrcp_types.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="message\include\mrcp_generic_header.h">
- <Filter>message\include</Filter>
- </ClInclude>
- <ClInclude Include="message\include\mrcp_header.h">
- <Filter>message\include</Filter>
- </ClInclude>
- <ClInclude Include="message\include\mrcp_header_accessor.h">
- <Filter>message\include</Filter>
- </ClInclude>
- <ClInclude Include="message\include\mrcp_message.h">
- <Filter>message\include</Filter>
- </ClInclude>
- <ClInclude Include="message\include\mrcp_start_line.h">
- <Filter>message\include</Filter>
- </ClInclude>
- <ClInclude Include="control\include\mrcp_resource.h">
- <Filter>control\include</Filter>
- </ClInclude>
- <ClInclude Include="control\include\mrcp_resource_factory.h">
- <Filter>control\include</Filter>
- </ClInclude>
- <ClInclude Include="control\include\mrcp_resource_loader.h">
- <Filter>control\include</Filter>
- </ClInclude>
- <ClInclude Include="control\include\mrcp_stream.h">
- <Filter>control\include</Filter>
- </ClInclude>
- <ClInclude Include="resources\include\mrcp_recog_header.h">
- <Filter>resources\include</Filter>
- </ClInclude>
- <ClInclude Include="resources\include\mrcp_recog_resource.h">
- <Filter>resources\include</Filter>
- </ClInclude>
- <ClInclude Include="resources\include\mrcp_recorder_header.h">
- <Filter>resources\include</Filter>
- </ClInclude>
- <ClInclude Include="resources\include\mrcp_recorder_resource.h">
- <Filter>resources\include</Filter>
- </ClInclude>
- <ClInclude Include="resources\include\mrcp_synth_header.h">
- <Filter>resources\include</Filter>
- </ClInclude>
- <ClInclude Include="resources\include\mrcp_synth_resource.h">
- <Filter>resources\include</Filter>
- </ClInclude>
- <ClInclude Include="resources\include\mrcp_verifier_header.h">
- <Filter>resources\include</Filter>
- </ClInclude>
- <ClInclude Include="resources\include\mrcp_verifier_resource.h">
- <Filter>resources\include</Filter>
- </ClInclude>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="message\src\mrcp_generic_header.c">
- <Filter>message\src</Filter>
- </ClCompile>
- <ClCompile Include="message\src\mrcp_header.c">
- <Filter>message\src</Filter>
- </ClCompile>
- <ClCompile Include="message\src\mrcp_header_accessor.c">
- <Filter>message\src</Filter>
- </ClCompile>
- <ClCompile Include="message\src\mrcp_message.c">
- <Filter>message\src</Filter>
- </ClCompile>
- <ClCompile Include="message\src\mrcp_start_line.c">
- <Filter>message\src</Filter>
- </ClCompile>
- <ClCompile Include="control\src\mrcp_resource_factory.c">
- <Filter>control\src</Filter>
- </ClCompile>
- <ClCompile Include="control\src\mrcp_resource_loader.c">
- <Filter>control\src</Filter>
- </ClCompile>
- <ClCompile Include="control\src\mrcp_stream.c">
- <Filter>control\src</Filter>
- </ClCompile>
- <ClCompile Include="resources\src\mrcp_recog_header.c">
- <Filter>resources\src</Filter>
- </ClCompile>
- <ClCompile Include="resources\src\mrcp_recog_resource.c">
- <Filter>resources\src</Filter>
- </ClCompile>
- <ClCompile Include="resources\src\mrcp_recorder_header.c">
- <Filter>resources\src</Filter>
- </ClCompile>
- <ClCompile Include="resources\src\mrcp_recorder_resource.c">
- <Filter>resources\src</Filter>
- </ClCompile>
- <ClCompile Include="resources\src\mrcp_synth_header.c">
- <Filter>resources\src</Filter>
- </ClCompile>
- <ClCompile Include="resources\src\mrcp_synth_resource.c">
- <Filter>resources\src</Filter>
- </ClCompile>
- <ClCompile Include="resources\src\mrcp_verifier_header.c">
- <Filter>resources\src</Filter>
- </ClCompile>
- <ClCompile Include="resources\src\mrcp_verifier_resource.c">
- <Filter>resources\src</Filter>
- </ClCompile>
- </ItemGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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);
-}
+++ /dev/null
-/*
- * 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;
-}
+++ /dev/null
-/*
- * 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);
-}
+++ /dev/null
-/*
- * 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;
-}
+++ /dev/null
-/*
- * 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);
-}
+++ /dev/null
-/*
- * 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;
-}
+++ /dev/null
-/*
- * 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);
-}
+++ /dev/null
-/*
- * 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;
-}
+++ /dev/null
-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
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 <apr_poll.h>
-#include <apr_hash.h>
-#ifdef WIN32
-#pragma warning(disable: 4127)
-#endif
-#include <apr_ring.h>
-#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 */
+++ /dev/null
-/*
- * 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 <apr_network_io.h>
-#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 */
+++ /dev/null
-/*
- * 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 <apr_tables.h>
-#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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>\r
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
- <ItemGroup>\r
- <Filter Include="include">\r
- <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>\r
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>\r
- </Filter>\r
- <Filter Include="src">\r
- <UniqueIdentifier>{a92d3b8c-d54d-416c-b458-dc57ac24d2e9}</UniqueIdentifier>\r
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>\r
- </Filter>\r
- </ItemGroup>\r
- <ItemGroup>\r
- <ClInclude Include="include\mrcp_client_connection.h">\r
- <Filter>include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="include\mrcp_connection.h">\r
- <Filter>include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="include\mrcp_connection_types.h">\r
- <Filter>include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="include\mrcp_control_descriptor.h">\r
- <Filter>include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="include\mrcp_server_connection.h">\r
- <Filter>include</Filter>\r
- </ClInclude>\r
- </ItemGroup>\r
- <ItemGroup>\r
- <ClCompile Include="src\mrcp_client_connection.c">\r
- <Filter>src</Filter>\r
- </ClCompile>\r
- <ClCompile Include="src\mrcp_connection.c">\r
- <Filter>src</Filter>\r
- </ClCompile>\r
- <ClCompile Include="src\mrcp_control_descriptor.c">\r
- <Filter>src</Filter>\r
- </ClCompile>\r
- <ClCompile Include="src\mrcp_server_connection.c">\r
- <Filter>src</Filter>\r
- </ClCompile>\r
- <ClCompile Include="src\mrcp_ca_factory.c">\r
- <Filter>src</Filter>\r
- </ClCompile>\r
- </ItemGroup>\r
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>\r
-<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
- <ItemGroup Label="ProjectConfigurations">\r
- <ProjectConfiguration Include="Debug|Win32">\r
- <Configuration>Debug</Configuration>\r
- <Platform>Win32</Platform>\r
- </ProjectConfiguration>\r
- <ProjectConfiguration Include="Debug|x64">\r
- <Configuration>Debug</Configuration>\r
- <Platform>x64</Platform>\r
- </ProjectConfiguration>\r
- <ProjectConfiguration Include="Release|Win32">\r
- <Configuration>Release</Configuration>\r
- <Platform>Win32</Platform>\r
- </ProjectConfiguration>\r
- <ProjectConfiguration Include="Release|x64">\r
- <Configuration>Release</Configuration>\r
- <Platform>x64</Platform>\r
- </ProjectConfiguration>\r
- </ItemGroup>\r
- <PropertyGroup Label="Globals">\r
- <ProjectName>mrcpv2transport</ProjectName>\r
- <ProjectGuid>{A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}</ProjectGuid>\r
- <RootNamespace>mrcpv2transport</RootNamespace>\r
- <Keyword>Win32Proj</Keyword>\r
- </PropertyGroup>\r
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />\r
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">\r
- <ConfigurationType>StaticLibrary</ConfigurationType>\r
- <CharacterSet>Unicode</CharacterSet>\r
- <WholeProgramOptimization>true</WholeProgramOptimization>\r
- <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>\r
- </PropertyGroup>\r
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">\r
- <ConfigurationType>StaticLibrary</ConfigurationType>\r
- <CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>\r
- </PropertyGroup>\r
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">\r
- <ConfigurationType>StaticLibrary</ConfigurationType>\r
- <CharacterSet>Unicode</CharacterSet>\r
- <WholeProgramOptimization>true</WholeProgramOptimization>\r
- <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>\r
- </PropertyGroup>\r
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">\r
- <ConfigurationType>StaticLibrary</ConfigurationType>\r
- <CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>\r
- </PropertyGroup>\r
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />\r
- <ImportGroup Label="ExtensionSettings">\r
- </ImportGroup>\r
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">\r
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />\r
- <Import Project="$(ProjectDir)..\..\build\props\mrcpv2transport.props" />\r
- </ImportGroup>\r
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">\r
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.props" />\r
- <Import Project="$(ProjectDir)..\..\build\props\mrcpv2transport.props" />\r
- </ImportGroup>\r
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">\r
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />\r
- <Import Project="$(ProjectDir)..\..\build\props\mrcpv2transport.props" />\r
- </ImportGroup>\r
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">\r
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.props" />\r
- <Import Project="$(ProjectDir)..\..\build\props\mrcpv2transport.props" />\r
- </ImportGroup>\r
- <PropertyGroup Label="UserMacros" />\r
- <PropertyGroup>\r
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>\r
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(PlatformName)\$(Configuration)\</OutDir>\r
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(PlatformName)\$(Configuration)\</IntDir>\r
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(PlatformName)\$(Configuration)\</OutDir>\r
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(PlatformName)\$(Configuration)\</IntDir>\r
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(PlatformName)\$(Configuration)\</OutDir>\r
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(PlatformName)\$(Configuration)\</IntDir>\r
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(PlatformName)\$(Configuration)\</OutDir>\r
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(PlatformName)\$(Configuration)\</IntDir>\r
- </PropertyGroup>\r
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
- <ClCompile>\r
- <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
- </ClCompile>\r
- </ItemDefinitionGroup>\r
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">\r
- <Midl>\r
- <TargetEnvironment>X64</TargetEnvironment>\r
- </Midl>\r
- <ClCompile>\r
- <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>\r
- </ClCompile>\r
- </ItemDefinitionGroup>\r
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
- <ClCompile>\r
- <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
- </ClCompile>\r
- </ItemDefinitionGroup>\r
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">\r
- <Midl>\r
- <TargetEnvironment>X64</TargetEnvironment>\r
- </Midl>\r
- <ClCompile>\r
- <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
- </ClCompile>\r
- </ItemDefinitionGroup>\r
- <ItemGroup>\r
- <ClInclude Include="include\mrcp_client_connection.h" />\r
- <ClInclude Include="include\mrcp_connection.h" />\r
- <ClInclude Include="include\mrcp_connection_types.h" />\r
- <ClInclude Include="include\mrcp_control_descriptor.h" />\r
- <ClInclude Include="include\mrcp_server_connection.h" />\r
- </ItemGroup>\r
- <ItemGroup>\r
- <ClCompile Include="src\mrcp_ca_factory.c" />\r
- <ClCompile Include="src\mrcp_client_connection.c" />\r
- <ClCompile Include="src\mrcp_connection.c" />\r
- <ClCompile Include="src\mrcp_control_descriptor.c" />\r
- <ClCompile Include="src\mrcp_server_connection.c" />\r
- </ItemGroup>\r
- <ItemGroup>\r
- <ProjectReference Include="..\..\..\win32\apr\libapr.2017.vcxproj">\r
- <Project>{f6c55d93-b927-4483-bb69-15aef3dd2dff}</Project>\r
- </ProjectReference>\r
- </ItemGroup>\r
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />\r
- <ImportGroup Label="ExtensionTargets">\r
- </ImportGroup>\r
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="mrcpv2transport"
- ProjectGUID="{A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}"
- RootNamespace="mrcpv2transport"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- <Platform
- Name="x64"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- ConfigurationType="4"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unilib.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpv2transport.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- ConfigurationType="4"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unilib.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpv2transport.vsprops"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|x64"
- ConfigurationType="4"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unilib-x64.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpv2transport.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|x64"
- ConfigurationType="4"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unilib-x64.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpv2transport.vsprops"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="include"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- <File
- RelativePath=".\include\mrcp_ca_factory.h"
- >
- </File>
- <File
- RelativePath=".\include\mrcp_client_connection.h"
- >
- </File>
- <File
- RelativePath=".\include\mrcp_connection.h"
- >
- </File>
- <File
- RelativePath=".\include\mrcp_connection_types.h"
- >
- </File>
- <File
- RelativePath=".\include\mrcp_control_descriptor.h"
- >
- </File>
- <File
- RelativePath=".\include\mrcp_server_connection.h"
- >
- </File>
- </Filter>
- <Filter
- Name="src"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- >
- <File
- RelativePath=".\src\mrcp_ca_factory.c"
- >
- </File>
- <File
- RelativePath=".\src\mrcp_client_connection.c"
- >
- </File>
- <File
- RelativePath=".\src\mrcp_connection.c"
- >
- </File>
- <File
- RelativePath=".\src\mrcp_control_descriptor.c"
- >
- </File>
- <File
- RelativePath=".\src\mrcp_server_connection.c"
- >
- </File>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}</ProjectGuid>
- <RootNamespace>mrcpv2transport</RootNamespace>
- <Keyword>Win32Proj</Keyword>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unilib.props" />
- <Import Project="$(ProjectDir)..\..\build\props\mrcpv2transport.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unilib.props" />
- <Import Project="$(ProjectDir)..\..\build\props\mrcpv2transport.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unilib-x64.props" />
- <Import Project="$(ProjectDir)..\..\build\props\mrcpv2transport.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unilib-x64.props" />
- <Import Project="$(ProjectDir)..\..\build\props\mrcpv2transport.props" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClInclude Include="include\mrcp_ca_factory.h" />
- <ClInclude Include="include\mrcp_client_connection.h" />
- <ClInclude Include="include\mrcp_connection.h" />
- <ClInclude Include="include\mrcp_connection_types.h" />
- <ClInclude Include="include\mrcp_control_descriptor.h" />
- <ClInclude Include="include\mrcp_server_connection.h" />
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="src\mrcp_ca_factory.c" />
- <ClCompile Include="src\mrcp_client_connection.c" />
- <ClCompile Include="src\mrcp_connection.c" />
- <ClCompile Include="src\mrcp_control_descriptor.c" />
- <ClCompile Include="src\mrcp_server_connection.c" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\mrcp\mrcp.vcxproj">
- <Project>{1c320193-46a6-4b34-9c56-8ab584fc1b56}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="include">
- <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
- </Filter>
- <Filter Include="src">
- <UniqueIdentifier>{119450fa-653a-4fdc-9017-a4350ff3066c}</UniqueIdentifier>
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="include\mrcp_client_connection.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mrcp_connection.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mrcp_connection_types.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mrcp_control_descriptor.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mrcp_server_connection.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mrcp_ca_factory.h">
- <Filter>include</Filter>
- </ClInclude>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="src\mrcp_client_connection.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\mrcp_connection.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\mrcp_control_descriptor.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\mrcp_server_connection.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\mrcp_ca_factory.c">
- <Filter>src</Filter>
- </ClCompile>
- </ItemGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-/*
- * 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 <apr_tables.h>
-#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;
-}
+++ /dev/null
-/*
- * 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;
- }
- }
-}
+++ /dev/null
-/*
- * 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;
-}
+++ /dev/null
-/*
- * 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; i<cmid_arr->nelts; i++) {
- if(APR_ARRAY_IDX(cmid_arr,i,apr_size_t) == cmid) {
- return TRUE;
- }
- }
- return FALSE;
-}
+++ /dev/null
-/*
- * 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;
-}
+++ /dev/null
-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
+++ /dev/null
-/*
- * 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 <apt.h>
-#include <apr_network_io.h>
-
-/** 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 <apr_ring.h>
-#include <apr_hash.h>
-#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);
- }
-}
+++ /dev/null
-/*
- * 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;
-}
+++ /dev/null
-/*
- * 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 */
-}
+++ /dev/null
-/*
- * 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 <apr_ring.h>
-#include <apr_hash.h>
-#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;
-}
+++ /dev/null
-/*
- * 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);
-}
+++ /dev/null
-/*
- * 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);
-}
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>\r
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
- <ItemGroup>\r
- <Filter Include="include">\r
- <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>\r
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>\r
- </Filter>\r
- <Filter Include="src">\r
- <UniqueIdentifier>{fd4564ef-9f34-4f23-992d-37f127e289a2}</UniqueIdentifier>\r
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>\r
- </Filter>\r
- </ItemGroup>\r
- <ItemGroup>\r
- <ClInclude Include="include\rtsp.h">\r
- <Filter>include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="include\rtsp_client.h">\r
- <Filter>include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="include\rtsp_header.h">\r
- <Filter>include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="include\rtsp_message.h">\r
- <Filter>include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="include\rtsp_server.h">\r
- <Filter>include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="include\rtsp_start_line.h">\r
- <Filter>include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="include\rtsp_stream.h">\r
- <Filter>include</Filter>\r
- </ClInclude>\r
- </ItemGroup>\r
- <ItemGroup>\r
- <ClCompile Include="src\rtsp_client.c">\r
- <Filter>src</Filter>\r
- </ClCompile>\r
- <ClCompile Include="src\rtsp_header.c">\r
- <Filter>src</Filter>\r
- </ClCompile>\r
- <ClCompile Include="src\rtsp_message.c">\r
- <Filter>src</Filter>\r
- </ClCompile>\r
- <ClCompile Include="src\rtsp_server.c">\r
- <Filter>src</Filter>\r
- </ClCompile>\r
- <ClCompile Include="src\rtsp_start_line.c">\r
- <Filter>src</Filter>\r
- </ClCompile>\r
- <ClCompile Include="src\rtsp_stream.c">\r
- <Filter>src</Filter>\r
- </ClCompile>\r
- </ItemGroup>\r
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>\r
-<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
- <ItemGroup Label="ProjectConfigurations">\r
- <ProjectConfiguration Include="Debug|Win32">\r
- <Configuration>Debug</Configuration>\r
- <Platform>Win32</Platform>\r
- </ProjectConfiguration>\r
- <ProjectConfiguration Include="Debug|x64">\r
- <Configuration>Debug</Configuration>\r
- <Platform>x64</Platform>\r
- </ProjectConfiguration>\r
- <ProjectConfiguration Include="Release|Win32">\r
- <Configuration>Release</Configuration>\r
- <Platform>Win32</Platform>\r
- </ProjectConfiguration>\r
- <ProjectConfiguration Include="Release|x64">\r
- <Configuration>Release</Configuration>\r
- <Platform>x64</Platform>\r
- </ProjectConfiguration>\r
- </ItemGroup>\r
- <PropertyGroup Label="Globals">\r
- <ProjectName>unirtsp</ProjectName>\r
- <ProjectGuid>{504B3154-7A4F-459D-9877-B951021C3F1F}</ProjectGuid>\r
- <RootNamespace>unirtsp</RootNamespace>\r
- <Keyword>Win32Proj</Keyword>\r
- </PropertyGroup>\r
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />\r
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">\r
- <ConfigurationType>StaticLibrary</ConfigurationType>\r
- <CharacterSet>Unicode</CharacterSet>\r
- <WholeProgramOptimization>true</WholeProgramOptimization>\r
- <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>\r
- </PropertyGroup>\r
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">\r
- <ConfigurationType>StaticLibrary</ConfigurationType>\r
- <CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>\r
- </PropertyGroup>\r
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">\r
- <ConfigurationType>StaticLibrary</ConfigurationType>\r
- <CharacterSet>Unicode</CharacterSet>\r
- <WholeProgramOptimization>true</WholeProgramOptimization>\r
- <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>\r
- </PropertyGroup>\r
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">\r
- <ConfigurationType>StaticLibrary</ConfigurationType>\r
- <CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>\r
- </PropertyGroup>\r
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />\r
- <ImportGroup Label="ExtensionSettings">\r
- </ImportGroup>\r
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">\r
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />\r
- <Import Project="$(ProjectDir)..\..\build\props\unirtsp.props" />\r
- </ImportGroup>\r
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">\r
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.props" />\r
- <Import Project="$(ProjectDir)..\..\build\props\unirtsp.props" />\r
- </ImportGroup>\r
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">\r
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />\r
- <Import Project="$(ProjectDir)..\..\build\props\unirtsp.props" />\r
- </ImportGroup>\r
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">\r
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.props" />\r
- <Import Project="$(ProjectDir)..\..\build\props\unirtsp.props" />\r
- </ImportGroup>\r
- <PropertyGroup Label="UserMacros" />\r
- <PropertyGroup>\r
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>\r
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(PlatformName)\$(Configuration)\</OutDir>\r
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(PlatformName)\$(Configuration)\</IntDir>\r
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(PlatformName)\$(Configuration)\</OutDir>\r
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(PlatformName)\$(Configuration)\</IntDir>\r
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(PlatformName)\$(Configuration)\</OutDir>\r
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(PlatformName)\$(Configuration)\</IntDir>\r
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(PlatformName)\$(Configuration)\</OutDir>\r
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(PlatformName)\$(Configuration)\</IntDir>\r
- </PropertyGroup>\r
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
- <ClCompile>\r
- <AdditionalIncludeDirectories>codecs;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
- <PreprocessorDefinitions>APT_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
- </ClCompile>\r
- </ItemDefinitionGroup>\r
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">\r
- <Midl>\r
- <TargetEnvironment>X64</TargetEnvironment>\r
- </Midl>\r
- <ClCompile>\r
- <AdditionalIncludeDirectories>codecs;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
- <PreprocessorDefinitions>APT_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>\r
- </ClCompile>\r
- </ItemDefinitionGroup>\r
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
- <ClCompile>\r
- <AdditionalIncludeDirectories>codecs;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
- <PreprocessorDefinitions>APT_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
- </ClCompile>\r
- </ItemDefinitionGroup>\r
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">\r
- <Midl>\r
- <TargetEnvironment>X64</TargetEnvironment>\r
- </Midl>\r
- <ClCompile>\r
- <AdditionalIncludeDirectories>codecs;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
- <PreprocessorDefinitions>APT_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
- </ClCompile>\r
- </ItemDefinitionGroup>\r
- <ItemGroup>\r
- <ClInclude Include="include\rtsp.h" />\r
- <ClInclude Include="include\rtsp_client.h" />\r
- <ClInclude Include="include\rtsp_header.h" />\r
- <ClInclude Include="include\rtsp_message.h" />\r
- <ClInclude Include="include\rtsp_server.h" />\r
- <ClInclude Include="include\rtsp_start_line.h" />\r
- <ClInclude Include="include\rtsp_stream.h" />\r
- </ItemGroup>\r
- <ItemGroup>\r
- <ClCompile Include="src\rtsp_client.c" />\r
- <ClCompile Include="src\rtsp_header.c" />\r
- <ClCompile Include="src\rtsp_message.c" />\r
- <ClCompile Include="src\rtsp_server.c" />\r
- <ClCompile Include="src\rtsp_start_line.c" />\r
- <ClCompile Include="src\rtsp_stream.c" />\r
- </ItemGroup>\r
- <ItemGroup>\r
- <ProjectReference Include="..\..\..\win32\apr\libapr.2017.vcxproj">\r
- <Project>{f6c55d93-b927-4483-bb69-15aef3dd2dff}</Project>\r
- </ProjectReference>\r
- </ItemGroup>\r
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />\r
- <ImportGroup Label="ExtensionTargets">\r
- </ImportGroup>\r
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="unirtsp"
- ProjectGUID="{504B3154-7A4F-459D-9877-B951021C3F1F}"
- RootNamespace="unirtsp"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- <Platform
- Name="x64"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- ConfigurationType="4"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unilib.vsprops;$(ProjectDir)..\..\build\vsprops\unirtsp.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- ConfigurationType="4"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unilib.vsprops;$(ProjectDir)..\..\build\vsprops\unirtsp.vsprops"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|x64"
- ConfigurationType="4"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unilib-x64.vsprops;$(ProjectDir)..\..\build\vsprops\unirtsp.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|x64"
- ConfigurationType="4"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unilib-x64.vsprops;$(ProjectDir)..\..\build\vsprops\unirtsp.vsprops"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="include"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- <File
- RelativePath=".\include\rtsp.h"
- >
- </File>
- <File
- RelativePath=".\include\rtsp_client.h"
- >
- </File>
- <File
- RelativePath=".\include\rtsp_header.h"
- >
- </File>
- <File
- RelativePath=".\include\rtsp_message.h"
- >
- </File>
- <File
- RelativePath=".\include\rtsp_server.h"
- >
- </File>
- <File
- RelativePath=".\include\rtsp_start_line.h"
- >
- </File>
- <File
- RelativePath=".\include\rtsp_stream.h"
- >
- </File>
- </Filter>
- <Filter
- Name="src"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- >
- <File
- RelativePath=".\src\rtsp_client.c"
- >
- </File>
- <File
- RelativePath=".\src\rtsp_header.c"
- >
- </File>
- <File
- RelativePath=".\src\rtsp_message.c"
- >
- </File>
- <File
- RelativePath=".\src\rtsp_server.c"
- >
- </File>
- <File
- RelativePath=".\src\rtsp_start_line.c"
- >
- </File>
- <File
- RelativePath=".\src\rtsp_stream.c"
- >
- </File>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{504B3154-7A4F-459D-9877-B951021C3F1F}</ProjectGuid>
- <RootNamespace>unirtsp</RootNamespace>
- <Keyword>Win32Proj</Keyword>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unilib.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unirtsp.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" />
- <Import Project="$(ProjectDir)..\..\build\props\unilib.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unirtsp.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unilib-x64.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unirtsp.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" />
- <Import Project="$(ProjectDir)..\..\build\props\unilib-x64.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unirtsp.props" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClInclude Include="include\rtsp.h" />
- <ClInclude Include="include\rtsp_client.h" />
- <ClInclude Include="include\rtsp_header.h" />
- <ClInclude Include="include\rtsp_message.h" />
- <ClInclude Include="include\rtsp_server.h" />
- <ClInclude Include="include\rtsp_start_line.h" />
- <ClInclude Include="include\rtsp_stream.h" />
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="src\rtsp_client.c" />
- <ClCompile Include="src\rtsp_header.c" />
- <ClCompile Include="src\rtsp_message.c" />
- <ClCompile Include="src\rtsp_server.c" />
- <ClCompile Include="src\rtsp_start_line.c" />
- <ClCompile Include="src\rtsp_stream.c" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\apr-toolkit\aprtoolkit.vcxproj">
- <Project>{13deeca0-bdd4-4744-a1a2-8eb0a44df3d2}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="include">
- <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
- </Filter>
- <Filter Include="src">
- <UniqueIdentifier>{8ffd50c3-3b28-438d-a305-071644d5f115}</UniqueIdentifier>
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="include\rtsp.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\rtsp_client.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\rtsp_header.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\rtsp_message.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\rtsp_server.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\rtsp_start_line.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\rtsp_stream.h">
- <Filter>include</Filter>
- </ClInclude>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="src\rtsp_client.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\rtsp_header.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\rtsp_message.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\rtsp_server.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\rtsp_start_line.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\rtsp_stream.c">
- <Filter>src</Filter>
- </ClCompile>
- </ItemGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-MAINTAINERCLEANFILES = Makefile.in
-
-SUBDIRS = mrcp-sofiasip mrcp-unirtsp
+++ /dev/null
-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
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 <apr_network_io.h>
-#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 */
+++ /dev/null
-/*
- * 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 <apr_network_io.h>
-#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 */
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>\r
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
- <ItemGroup>\r
- <Filter Include="include">\r
- <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>\r
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>\r
- </Filter>\r
- <Filter Include="src">\r
- <UniqueIdentifier>{6e92b598-880e-4fe5-88fb-f69df8e06a57}</UniqueIdentifier>\r
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>\r
- </Filter>\r
- </ItemGroup>\r
- <ItemGroup>\r
- <ClInclude Include="include\mrcp_sdp.h">\r
- <Filter>include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="include\mrcp_sofiasip_client_agent.h">\r
- <Filter>include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="include\mrcp_sofiasip_server_agent.h">\r
- <Filter>include</Filter>\r
- </ClInclude>\r
- </ItemGroup>\r
- <ItemGroup>\r
- <ClCompile Include="src\mrcp_sdp.c">\r
- <Filter>src</Filter>\r
- </ClCompile>\r
- <ClCompile Include="src\mrcp_sofiasip_client_agent.c">\r
- <Filter>src</Filter>\r
- </ClCompile>\r
- <ClCompile Include="src\mrcp_sofiasip_server_agent.c">\r
- <Filter>src</Filter>\r
- </ClCompile>\r
- <ClCompile Include="src\mrcp_sofiasip_logger.c">\r
- <Filter>src</Filter>\r
- </ClCompile>\r
- </ItemGroup>\r
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectName>mrcpsofiasip</ProjectName>
- <ProjectGuid>{746F3632-5BB2-4570-9453-31D6D58A7D8E}</ProjectGuid>
- <RootNamespace>mrcpsofiasip</RootNamespace>
- <Keyword>Win32Proj</Keyword>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />
- <Import Project="$(ProjectDir)..\..\build\props\sofiasip.props" />
- <Import Project="$(ProjectDir)..\..\build\props\mrcpv2transport.props" />
- <Import Project="$(ProjectDir)..\..\build\props\mrcpsignaling.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.props" />
- <Import Project="$(ProjectDir)..\..\build\props\sofiasip.props" />
- <Import Project="$(ProjectDir)..\..\build\props\mrcpv2transport.props" />
- <Import Project="$(ProjectDir)..\..\build\props\mrcpsignaling.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />
- <Import Project="$(ProjectDir)..\..\build\props\sofiasip.props" />
- <Import Project="$(ProjectDir)..\..\build\props\mrcpv2transport.props" />
- <Import Project="$(ProjectDir)..\..\build\props\mrcpsignaling.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.props" />
- <Import Project="$(ProjectDir)..\..\build\props\sofiasip.props" />
- <Import Project="$(ProjectDir)..\..\build\props\mrcpv2transport.props" />
- <Import Project="$(ProjectDir)..\..\build\props\mrcpsignaling.props" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(PlatformName)\$(Configuration)\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(PlatformName)\$(Configuration)\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(PlatformName)\$(Configuration)\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(PlatformName)\$(Configuration)\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(PlatformName)\$(Configuration)\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(PlatformName)\$(Configuration)\</IntDir>
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(PlatformName)\$(Configuration)\</OutDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(PlatformName)\$(Configuration)\</IntDir>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;LIBSOFIA_SIP_UA_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;LIBSOFIA_SIP_UA_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;LIBSOFIA_SIP_UA_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;LIBSOFIA_SIP_UA_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClInclude Include="include\mrcp_sdp.h" />
- <ClInclude Include="include\mrcp_sofiasip_client_agent.h" />
- <ClInclude Include="include\mrcp_sofiasip_server_agent.h" />
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="src\mrcp_sdp.c" />
- <ClCompile Include="src\mrcp_sofiasip_client_agent.c" />
- <ClCompile Include="src\mrcp_sofiasip_logger.c" />
- <ClCompile Include="src\mrcp_sofiasip_server_agent.c" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\..\win32\sofia\libsofia_sip_ua_static.2017.vcxproj">
- <Project>{70a49bc2-7500-41d0-b75d-edcc5be987a0}</Project>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="mrcpsofiasip"
- ProjectGUID="{746F3632-5BB2-4570-9453-31D6D58A7D8E}"
- RootNamespace="mrcpsofiasip"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- <Platform
- Name="x64"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- ConfigurationType="4"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unilib.vsprops;$(ProjectDir)..\..\build\vsprops\sofiasip.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpv2transport.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpsignaling.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="include"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- ConfigurationType="4"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unilib.vsprops;$(ProjectDir)..\..\build\vsprops\sofiasip.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpv2transport.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpsignaling.vsprops"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="include"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|x64"
- ConfigurationType="4"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unilib-x64.vsprops;$(ProjectDir)..\..\build\vsprops\sofiasip.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpv2transport.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpsignaling.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="include"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|x64"
- ConfigurationType="4"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unilib-x64.vsprops;$(ProjectDir)..\..\build\vsprops\sofiasip.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpv2transport.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpsignaling.vsprops"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="include"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="include"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- <File
- RelativePath=".\include\mrcp_sdp.h"
- >
- </File>
- <File
- RelativePath=".\include\mrcp_sofiasip_client_agent.h"
- >
- </File>
- <File
- RelativePath=".\include\mrcp_sofiasip_server_agent.h"
- >
- </File>
- <File
- RelativePath=".\include\mrcp_sofiasip_log.h"
- >
- </File>
- </Filter>
- <Filter
- Name="src"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- >
- <File
- RelativePath=".\src\mrcp_sdp.c"
- >
- </File>
- <File
- RelativePath=".\src\mrcp_sofiasip_client_agent.c"
- >
- </File>
- <File
- RelativePath=".\src\mrcp_sofiasip_logger.c"
- >
- </File>
- <File
- RelativePath=".\src\mrcp_sofiasip_server_agent.c"
- >
- </File>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{746F3632-5BB2-4570-9453-31D6D58A7D8E}</ProjectGuid>
- <RootNamespace>mrcpsofiasip</RootNamespace>
- <Keyword>Win32Proj</Keyword>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unilib.props" />
- <Import Project="$(ProjectDir)..\..\build\props\sofiasip.props" />
- <Import Project="$(ProjectDir)..\..\build\props\mrcpv2transport.props" />
- <Import Project="$(ProjectDir)..\..\build\props\mrcpsignaling.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" />
- <Import Project="$(ProjectDir)..\..\build\props\unilib.props" />
- <Import Project="$(ProjectDir)..\..\build\props\sofiasip.props" />
- <Import Project="$(ProjectDir)..\..\build\props\mrcpv2transport.props" />
- <Import Project="$(ProjectDir)..\..\build\props\mrcpsignaling.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unilib-x64.props" />
- <Import Project="$(ProjectDir)..\..\build\props\sofiasip.props" />
- <Import Project="$(ProjectDir)..\..\build\props\mrcpv2transport.props" />
- <Import Project="$(ProjectDir)..\..\build\props\mrcpsignaling.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" />
- <Import Project="$(ProjectDir)..\..\build\props\unilib-x64.props" />
- <Import Project="$(ProjectDir)..\..\build\props\sofiasip.props" />
- <Import Project="$(ProjectDir)..\..\build\props\mrcpv2transport.props" />
- <Import Project="$(ProjectDir)..\..\build\props\mrcpsignaling.props" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClInclude Include="include\mrcp_sdp.h" />
- <ClInclude Include="include\mrcp_sofiasip_client_agent.h" />
- <ClInclude Include="include\mrcp_sofiasip_server_agent.h" />
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="src\mrcp_sdp.c" />
- <ClCompile Include="src\mrcp_sofiasip_client_agent.c" />
- <ClCompile Include="src\mrcp_sofiasip_logger.c" />
- <ClCompile Include="src\mrcp_sofiasip_server_agent.c" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\libs\mrcp-signaling\mrcpsignaling.vcxproj">
- <Project>{12a49562-bab9-43a3-a21d-15b60bbb4c31}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- <ProjectReference Include="..\..\libs\mrcpv2-transport\mrcpv2transport.vcxproj">
- <Project>{a9edac04-6a5f-4ba7-bc0d-cce7b255b6ea}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="include">
- <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
- </Filter>
- <Filter Include="src">
- <UniqueIdentifier>{5256b9c6-18be-48fc-aaa3-8e2c17df7f8d}</UniqueIdentifier>
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="include\mrcp_sdp.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mrcp_sofiasip_client_agent.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mrcp_sofiasip_server_agent.h">
- <Filter>include</Filter>
- </ClInclude>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="src\mrcp_sdp.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\mrcp_sofiasip_client_agent.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\mrcp_sofiasip_server_agent.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\mrcp_sofiasip_logger.c">
- <Filter>src</Filter>
- </ClCompile>
- </ItemGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-/*
- * 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 <stdlib.h>
-#include <apr_general.h>
-#include <sofia-sip/sdp.h>
-#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; i<count; i++) {
- audio_media = mrcp_session_audio_media_get(descriptor,audio_index);
- if(audio_media && audio_media->id == 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; i<descriptor_arr->nelts; 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; i<descriptor_arr->nelts; 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; i<control_media->cmid_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;
-}
+++ /dev/null
-/*
- * 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 <sofia-sip/su.h>
-#include <sofia-sip/nua.h>
-#include <sofia-sip/sip_status.h>
-#include <sofia-sip/sip_header.h>
-#include <sofia-sip/sdp.h>
-#include <sofia-sip/tport.h>
-#include <sofia-sip/sofia_features.h>
-#undef strcasecmp
-#undef strncasecmp
-#include <apr_general.h>
-
-#include "mrcp_sofiasip_client_agent.h"
-#include "mrcp_session.h"
-#include "mrcp_session_descriptor.h"
-#include "mrcp_sdp.h"
-#include "apt_log.h"
-
-struct mrcp_sofia_agent_t {
- mrcp_sig_agent_t *sig_agent;
-
- mrcp_sofia_client_config_t *config;
- char *sip_contact_str;
- char *sip_from_str;
- char *sip_bind_str;
-
- su_root_t *root;
- nua_t *nua;
-};
-
-struct mrcp_sofia_session_t {
- mrcp_session_t *session;
- const mrcp_sig_settings_t *sip_settings;
-
- su_home_t *home;
- nua_handle_t *nh;
- enum nua_callstate nua_state;
-
- apt_bool_t terminate_requested;
- mrcp_session_descriptor_t *descriptor;
- apr_thread_mutex_t *mutex;
-};
-
-/* Task Interface */
-static void mrcp_sofia_task_initialize(apt_task_t *task);
-static apt_bool_t mrcp_sofia_task_run(apt_task_t *task);
-static apt_bool_t mrcp_sofia_task_terminate(apt_task_t *task);
-
-/* MRCP Signaling Interface */
-static apt_bool_t mrcp_sofia_session_offer(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor);
-static apt_bool_t mrcp_sofia_session_terminate_request(mrcp_session_t *session);
-static apt_bool_t mrcp_sofia_session_discover_request(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor);
-
-static const mrcp_session_request_vtable_t session_request_vtable = {
- mrcp_sofia_session_offer,
- mrcp_sofia_session_terminate_request,
- NULL,
- mrcp_sofia_session_discover_request
-};
-
-static apt_bool_t mrcp_sofia_config_validate(mrcp_sofia_agent_t *sofia_agent, mrcp_sofia_client_config_t *config, apr_pool_t *pool);
-static apt_bool_t mrcp_sofia_session_create(mrcp_session_t *session, const mrcp_sig_settings_t *settings);
-
-static void mrcp_sofia_event_callback( nua_event_t nua_event,
- int status,
- char const *phrase,
- nua_t *nua,
- mrcp_sofia_agent_t *sofia_agent,
- nua_handle_t *nh,
- mrcp_sofia_session_t *sofia_session,
- sip_t const *sip,
- tagi_t tags[]);
-
-apt_bool_t mrcp_sofiasip_log_init(const char *name, const char *level_str, apt_bool_t redirect);
-
-/** 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)
-{
- apt_task_t *task;
- apt_task_vtable_t *vtable;
- mrcp_sofia_agent_t *sofia_agent;
- sofia_agent = apr_palloc(pool,sizeof(mrcp_sofia_agent_t));
- sofia_agent->sig_agent = mrcp_signaling_agent_create(id,sofia_agent,pool);
- sofia_agent->sig_agent->create_client_session = mrcp_sofia_session_create;
- sofia_agent->root = NULL;
- sofia_agent->nua = NULL;
-
- if(mrcp_sofia_config_validate(sofia_agent,config,pool) == FALSE) {
- return NULL;
- }
-
- task = apt_task_create(sofia_agent,NULL,pool);
- if(!task) {
- return NULL;
- }
- apt_task_name_set(task,id);
- vtable = apt_task_vtable_get(task);
- if(vtable) {
- vtable->on_pre_run = mrcp_sofia_task_initialize;
- vtable->run = mrcp_sofia_task_run;
- vtable->terminate = mrcp_sofia_task_terminate;
- }
- sofia_agent->sig_agent->task = task;
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create SofiaSIP Agent [%s] ["SOFIA_SIP_VERSION"] %s",
- id,sofia_agent->sip_bind_str);
- return sofia_agent->sig_agent;
-}
-
-/** Allocate Sofia-SIP config */
-MRCP_DECLARE(mrcp_sofia_client_config_t*) mrcp_sofiasip_client_config_alloc(apr_pool_t *pool)
-{
- mrcp_sofia_client_config_t *config = apr_palloc(pool,sizeof(mrcp_sofia_client_config_t));
- config->local_ip = NULL;
- config->ext_ip = NULL;
- config->local_port = 0;
- config->local_user_name = NULL;
-
- config->user_agent_name = NULL;
- config->origin = NULL;
- config->transport = NULL;
-
- config->sip_t1 = 0;
- config->sip_t2 = 0;
- config->sip_t4 = 0;
- config->sip_t1x64 = 0;
-
- config->tport_log = FALSE;
- config->tport_dump_file = NULL;
-
- return config;
-}
-
-MRCP_DECLARE(apt_bool_t) mrcp_sofiasip_client_logger_init(const char *name, const char *level_str, apt_bool_t redirect)
-{
- return mrcp_sofiasip_log_init(name,level_str,redirect);
-}
-
-static apt_bool_t mrcp_sofia_config_validate(mrcp_sofia_agent_t *sofia_agent, mrcp_sofia_client_config_t *config, apr_pool_t *pool)
-{
- if(!config->local_ip) {
- return FALSE;
- }
-
- sofia_agent->config = config;
- if(config->ext_ip) {
- /* Use external IP address in Contact and From headers, if behind NAT */
- sofia_agent->sip_contact_str = apr_psprintf(pool,"sip:%s:%hu", config->ext_ip, config->local_port);
- sofia_agent->sip_from_str = apr_psprintf(pool,"sip:%s:%hu", config->ext_ip, config->local_port);
- }
- else {
- sofia_agent->sip_contact_str = NULL; /* Let Sofia-SIP implicitly set Contact header by default */
- sofia_agent->sip_from_str = apr_psprintf(pool,"sip:%s:%hu", config->local_ip, config->local_port);
- }
-
- if(config->transport) {
- sofia_agent->sip_bind_str = apr_psprintf(pool,"sip:%s:%hu;transport=%s",
- config->local_ip,
- config->local_port,
- config->transport);
- }
- else {
- sofia_agent->sip_bind_str = apr_psprintf(pool,"sip:%s:%hu",
- config->local_ip,
- config->local_port);
- }
- return TRUE;
-}
-
-static void mrcp_sofia_task_initialize(apt_task_t *task)
-{
- mrcp_sofia_agent_t *sofia_agent = apt_task_object_get(task);
- mrcp_sofia_client_config_t *sofia_config = sofia_agent->config;
-
- /* Initialize Sofia-SIP library and create event loop */
- su_init();
- sofia_agent->root = su_root_create(NULL);
-
- /* Create a user agent instance. The stack will call the 'event_callback()'
- * callback when events such as succesful registration to network,
- * an incoming call, etc, occur.
- */
- sofia_agent->nua = nua_create(
- sofia_agent->root, /* Event loop */
- mrcp_sofia_event_callback, /* Callback for processing events */
- sofia_agent, /* Additional data to pass to callback */
- NUTAG_URL(sofia_agent->sip_bind_str), /* Address to bind to */
- NUTAG_AUTOANSWER(0),
- NUTAG_APPL_METHOD("OPTIONS"),
- TAG_IF(sofia_config->sip_t1,NTATAG_SIP_T1(sofia_config->sip_t1)),
- TAG_IF(sofia_config->sip_t2,NTATAG_SIP_T2(sofia_config->sip_t2)),
- TAG_IF(sofia_config->sip_t4,NTATAG_SIP_T4(sofia_config->sip_t4)),
- TAG_IF(sofia_config->sip_t1x64,NTATAG_SIP_T1X64(sofia_config->sip_t1x64)),
- SIPTAG_USER_AGENT_STR(sofia_config->user_agent_name),
- TAG_IF(sofia_config->tport_log == TRUE,TPTAG_LOG(1)), /* Print out SIP messages to the console */
- TAG_IF(sofia_config->tport_dump_file,TPTAG_DUMP(sofia_config->tport_dump_file)), /* Dump SIP messages to the file */
- TAG_END()); /* Last tag should always finish the sequence */
- if(!sofia_agent->nua) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create NUA [%s] %s",
- apt_task_name_get(task),
- sofia_agent->sip_bind_str);
- }
-}
-
-static apt_bool_t mrcp_sofia_task_run(apt_task_t *task)
-{
- mrcp_sofia_agent_t *sofia_agent = apt_task_object_get(task);
-
- if(sofia_agent->nua) {
- /* Run event loop */
- su_root_run(sofia_agent->root);
-
- /* Destroy allocated resources */
- nua_destroy(sofia_agent->nua);
- sofia_agent->nua = NULL;
- }
- su_root_destroy(sofia_agent->root);
- sofia_agent->root = NULL;
- su_deinit();
-
- apt_task_terminate_request_process(task);
- return TRUE;
-}
-
-static apt_bool_t mrcp_sofia_task_terminate(apt_task_t *task)
-{
- mrcp_sofia_agent_t *sofia_agent = apt_task_object_get(task);
- if(sofia_agent->nua) {
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Send Shutdown Signal to NUA [%s]",
- apt_task_name_get(task));
- nua_shutdown(sofia_agent->nua);
- }
- return TRUE;
-}
-
-static APR_INLINE mrcp_sofia_agent_t* mrcp_sofia_agent_get(mrcp_session_t *session)
-{
- return session->signaling_agent->obj;
-}
-
-static apt_bool_t mrcp_sofia_session_create(mrcp_session_t *session, const mrcp_sig_settings_t *settings)
-{
- const char *sip_to_str;
- mrcp_sofia_agent_t *sofia_agent = mrcp_sofia_agent_get(session);
- mrcp_sofia_session_t *sofia_session;
- session->request_vtable = &session_request_vtable;
-
- if(!sofia_agent->nua) {
- return FALSE;
- }
-
- sofia_session = apr_palloc(session->pool,sizeof(mrcp_sofia_session_t));
- sofia_session->mutex = NULL;
- sofia_session->home = su_home_new(sizeof(*sofia_session->home));
- sofia_session->session = session;
- sofia_session->sip_settings = settings;
- sofia_session->terminate_requested = FALSE;
- sofia_session->descriptor = NULL;
- session->obj = sofia_session;
-
- if(settings->user_name && *settings->user_name != '\0') {
- sip_to_str = apr_psprintf(session->pool,"sip:%s@%s:%hu",
- settings->user_name,
- settings->server_ip,
- settings->server_port);
- }
- else {
- sip_to_str = apr_psprintf(session->pool,"sip:%s:%hu",
- settings->server_ip,
- settings->server_port);
- }
-
- sofia_session->nh = nua_handle(
- sofia_agent->nua,
- sofia_session,
- SIPTAG_TO_STR(sip_to_str),
- SIPTAG_FROM_STR(sofia_agent->sip_from_str),
- TAG_IF(sofia_agent->sip_contact_str,SIPTAG_CONTACT_STR(sofia_agent->sip_contact_str)),
- TAG_IF(settings->feature_tags,SIPTAG_ACCEPT_CONTACT_STR(settings->feature_tags)),
- TAG_END());
- sofia_session->nua_state = nua_callstate_init;
-
- apr_thread_mutex_create(&sofia_session->mutex,APR_THREAD_MUTEX_DEFAULT,session->pool);
- return TRUE;
-}
-
-static apt_bool_t mrcp_sofia_session_cleanup(mrcp_sofia_session_t *sofia_session)
-{
- if(sofia_session->mutex) {
- apr_thread_mutex_destroy(sofia_session->mutex);
- sofia_session->mutex = NULL;
- }
- if(sofia_session->home) {
- su_home_unref(sofia_session->home);
- sofia_session->home = NULL;
- }
- return TRUE;
-}
-
-static apt_bool_t mrcp_sofia_session_unref(mrcp_sofia_session_t *sofia_session)
-{
- if(sofia_session->nh) {
- nua_handle_bind(sofia_session->nh, NULL);
- nua_handle_destroy(sofia_session->nh);
- sofia_session->nh = NULL;
- }
- sofia_session->session = NULL;
- return TRUE;
-}
-
-static apt_bool_t mrcp_sofia_session_offer(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor)
-{
- char sdp_str[2048];
- const char *local_sdp_str = NULL;
- apt_bool_t res = FALSE;
- mrcp_sofia_session_t *sofia_session = session->obj;
- if(!sofia_session) {
- return FALSE;
- }
-
- if(session->signaling_agent) {
- mrcp_sofia_agent_t *sofia_agent = mrcp_sofia_agent_get(session);
- if(sofia_agent) {
- if(sofia_agent->config->origin) {
- apt_string_set(&descriptor->origin,sofia_agent->config->origin);
- }
- }
- }
- if(sdp_string_generate_by_mrcp_descriptor(sdp_str,sizeof(sdp_str),descriptor,TRUE) > 0) {
- local_sdp_str = sdp_str;
- sofia_session->descriptor = descriptor;
- apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,session->log_obj,"Local SDP "APT_NAMESID_FMT"\n%s",
- session->name,
- MRCP_SESSION_SID(session),
- local_sdp_str);
- }
-
- apr_thread_mutex_lock(sofia_session->mutex);
-
- if(sofia_session->nh) {
- res = TRUE;
- nua_invite(sofia_session->nh,
- TAG_IF(local_sdp_str,SOATAG_USER_SDP_STR(local_sdp_str)),
- TAG_END());
- }
-
- apr_thread_mutex_unlock(sofia_session->mutex);
- return res;
-}
-
-static apt_bool_t mrcp_sofia_session_terminate_request(mrcp_session_t *session)
-{
- mrcp_sofia_session_t *sofia_session = session->obj;
- if(!sofia_session) {
- return FALSE;
- }
-
- sofia_session->terminate_requested = FALSE;
- apr_thread_mutex_lock(sofia_session->mutex);
- if(sofia_session->nh) {
- sofia_session->terminate_requested = TRUE;
- nua_bye(sofia_session->nh,TAG_END());
- }
- apr_thread_mutex_unlock(sofia_session->mutex);
-
- if(sofia_session->terminate_requested == FALSE) {
- mrcp_sofia_session_cleanup(sofia_session);
- mrcp_session_terminate_response(session);
- }
- return TRUE;
-}
-
-static apt_bool_t mrcp_sofia_session_discover_request(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor)
-{
- apt_bool_t res = FALSE;
- mrcp_sofia_session_t *sofia_session = session->obj;
- if(!sofia_session) {
- return FALSE;
- }
-
- apr_thread_mutex_lock(sofia_session->mutex);
- if(sofia_session->nh) {
- res = TRUE;
- nua_options(sofia_session->nh,TAG_END());
- }
- apr_thread_mutex_unlock(sofia_session->mutex);
- return res;
-}
-
-static void mrcp_sofia_on_session_ready(
- int status,
- mrcp_sofia_agent_t *sofia_agent,
- nua_handle_t *nh,
- mrcp_sofia_session_t *sofia_session,
- sip_t const *sip,
- tagi_t tags[])
-{
- mrcp_session_t *session = sofia_session->session;
- const char *remote_sdp_str = NULL;
- mrcp_session_descriptor_t *descriptor = mrcp_session_descriptor_create(session->pool);
- descriptor->response_code = status;
-
- tl_gets(tags,
- SOATAG_REMOTE_SDP_STR_REF(remote_sdp_str),
- TAG_END());
-
- if(remote_sdp_str) {
- sdp_parser_t *parser = NULL;
- sdp_session_t *sdp = NULL;
- const char *force_destination_ip = NULL;
- apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,session->log_obj,"Remote SDP "APT_NAMESID_FMT"\n%s",
- session->name,
- MRCP_SESSION_SID(session),
- remote_sdp_str);
-
- parser = sdp_parse(sofia_session->home,remote_sdp_str,(int)strlen(remote_sdp_str),0);
- sdp = sdp_session(parser);
- if(sofia_session->sip_settings->force_destination == TRUE) {
- force_destination_ip = sofia_session->sip_settings->server_ip;
- }
-
- mrcp_descriptor_generate_by_sdp_session(descriptor,sdp,force_destination_ip,session->pool);
- sdp_parser_free(parser);
- }
-
- mrcp_session_answer(session,descriptor);
-}
-
-static void mrcp_sofia_on_session_redirect(
- int status,
- mrcp_sofia_agent_t *sofia_agent,
- nua_handle_t *nh,
- mrcp_sofia_session_t *sofia_session,
- sip_t const *sip,
- tagi_t tags[])
-{
- mrcp_session_t *session = sofia_session->session;
- sip_to_t *sip_to;
- sip_contact_t *sip_contact;
- if(!sip || !sip->sip_contact) {
- return;
- }
- sip_contact = sip->sip_contact;
-
- apr_thread_mutex_lock(sofia_session->mutex);
-
- sip_to = sip_to_create(sofia_session->home, (const url_string_t *) sip_contact->m_url);
-
- apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,session->log_obj,"Redirect "APT_NAMESID_FMT" to "URL_PRINT_FORMAT,
- session->name,
- MRCP_SESSION_SID(session),
- URL_PRINT_ARGS(sip_to->a_url));
-
- if(sofia_session->nh) {
- nua_handle_bind(sofia_session->nh, NULL);
- nua_handle_destroy(sofia_session->nh);
- sofia_session->nh = NULL;
- }
-
- sofia_session->nh = nua_handle(
- sofia_agent->nua,
- sofia_session,
- SIPTAG_TO(sip_to),
- SIPTAG_FROM_STR(sofia_agent->sip_from_str),
- TAG_IF(sofia_agent->sip_contact_str,SIPTAG_CONTACT_STR(sofia_agent->sip_contact_str)),
- TAG_END());
-
- apr_thread_mutex_unlock(sofia_session->mutex);
-
- mrcp_sofia_session_offer(sofia_session->session,sofia_session->descriptor);
-}
-
-static void mrcp_sofia_on_session_terminate(
- int status,
- mrcp_sofia_agent_t *sofia_agent,
- nua_handle_t *nh,
- mrcp_sofia_session_t *sofia_session,
- sip_t const *sip,
- tagi_t tags[])
-{
- mrcp_session_t *session;
- apt_bool_t terminate_requested;
-
- apr_thread_mutex_lock(sofia_session->mutex);
- terminate_requested = sofia_session->terminate_requested;
- session = sofia_session->session;
- mrcp_sofia_session_unref(sofia_session);
- apr_thread_mutex_unlock(sofia_session->mutex);
-
- if(terminate_requested == TRUE) {
- sofia_session->nua_state = nua_callstate_terminated;
- mrcp_sofia_session_cleanup(sofia_session);
- mrcp_session_terminate_response(session);
- return;
- }
-
- if(sofia_session->nua_state == nua_callstate_ready) {
- mrcp_session_terminate_event(session);
- }
- else {
- mrcp_session_descriptor_t *descriptor = mrcp_session_descriptor_create(session->pool);
- descriptor->response_code = status;
- mrcp_session_answer(session,descriptor);
- }
- sofia_session->nua_state = nua_callstate_terminated;
-}
-
-static void mrcp_sofia_on_state_change(
- int status,
- mrcp_sofia_agent_t *sofia_agent,
- nua_handle_t *nh,
- mrcp_sofia_session_t *sofia_session,
- sip_t const *sip,
- tagi_t tags[])
-{
- int nua_state = nua_callstate_init;
- tl_gets(tags,
- NUTAG_CALLSTATE_REF(nua_state),
- TAG_END());
-
- if(!sofia_session || !sofia_session->session) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"SIP Call State [%s]", nua_callstate_name(nua_state));
- return;
- }
- apt_obj_log(APT_LOG_MARK,APT_PRIO_NOTICE,sofia_session->session->log_obj,"SIP Call State %s [%s]",
- sofia_session->session->name,
- nua_callstate_name(nua_state));
-
- if(nua_state == nua_callstate_terminated) {
- mrcp_sofia_on_session_terminate(status,sofia_agent,nh,sofia_session,sip,tags);
- return;
- }
-
- if(nua_state == nua_callstate_ready) {
- mrcp_sofia_on_session_ready(status,sofia_agent,nh,sofia_session,sip,tags);
- }
- sofia_session->nua_state = nua_state;
-}
-
-static void mrcp_sofia_on_resource_discover(
- int status,
- mrcp_sofia_agent_t *sofia_agent,
- nua_handle_t *nh,
- mrcp_sofia_session_t *sofia_session,
- sip_t const *sip,
- tagi_t tags[])
-{
- mrcp_session_t *session = sofia_session->session;
- if(session) {
- const char *remote_sdp_str = NULL;
- mrcp_session_descriptor_t *descriptor = mrcp_session_descriptor_create(session->pool);
- descriptor->response_code = status;
-
- if(sip->sip_payload) {
- remote_sdp_str = sip->sip_payload->pl_data;
- }
-
- if(remote_sdp_str) {
- sdp_parser_t *parser = NULL;
- sdp_session_t *sdp = NULL;
- apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,session->obj,"Resource Discovery SDP %s\n%s",
- session->name,
- remote_sdp_str);
-
- parser = sdp_parse(sofia_session->home,remote_sdp_str,(int)strlen(remote_sdp_str),0);
- sdp = sdp_session(parser);
- mrcp_descriptor_generate_by_sdp_session(descriptor,sdp,NULL,session->pool);
- sdp_parser_free(parser);
- }
-
- mrcp_session_discover_response(session,descriptor);
- }
-}
-
-/** This callback will be called by SIP stack to process incoming events */
-static void mrcp_sofia_event_callback(
- nua_event_t nua_event,
- int status,
- char const *phrase,
- nua_t *nua,
- mrcp_sofia_agent_t *sofia_agent,
- nua_handle_t *nh,
- mrcp_sofia_session_t *sofia_session,
- sip_t const *sip,
- tagi_t tags[])
-{
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Receive SIP Event [%s] Status %d %s [%s]",
- nua_event_name(nua_event),
- status,
- phrase,
- sofia_agent->sig_agent->id);
-
- switch(nua_event) {
- case nua_i_state:
- mrcp_sofia_on_state_change(status,sofia_agent,nh,sofia_session,sip,tags);
- break;
- case nua_r_invite:
- if(status >= 300 && status < 400) {
- mrcp_sofia_on_session_redirect(status,sofia_agent,nh,sofia_session,sip,tags);
- }
- break;
- case nua_r_options:
- mrcp_sofia_on_resource_discover(status,sofia_agent,nh,sofia_session,sip,tags);
- break;
- case nua_r_shutdown:
- /* if status < 200, shutdown still in progress */
- if(status >= 200) {
- /* break main loop of sofia thread */
- su_root_break(sofia_agent->root);
- }
- break;
- default:
- break;
- }
-}
+++ /dev/null
-/*
- * 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_logger.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include <stdlib.h>
-#include <apr_general.h>
-#include <sofia-sip/su_log.h>
-#include "apt_log.h"
-
-SOFIAPUBVAR su_log_t tport_log[]; /* Transport event debug */
-SOFIAPUBVAR su_log_t nea_log[]; /* Event engine debug */
-SOFIAPUBVAR su_log_t nta_log[]; /* Transaction engine debug */
-SOFIAPUBVAR su_log_t nua_log[]; /* User Agent engine debug */
-SOFIAPUBVAR su_log_t soa_log[]; /* SDP Offer/Answer engine debug */
-SOFIAPUBVAR su_log_t su_log_default[]; /* Default debug */
-
-static void mrcp_sofiasip_log(void *stream, char const *format, va_list arg_ptr)
-{
- if(format) {
- /* use generic vsnprintf() since apr_vformatter doesn't support
- the format %p widely used by SofiaSIP. */
- char buf[4096];
- int len = vsnprintf(buf, sizeof(buf), format, arg_ptr);
- if(len <= 0)
- return;
- if(buf[len-1] == '\n') {
- /* remove trailing '\n' since apt logger appends it anyway */
- len--;
- buf[len] = '\0';
- }
- apt_log(APT_LOG_MARK, APT_PRIO_DEBUG, "%.*s", len, buf);
- }
-}
-
-static su_log_t* mrcp_sofiasip_logger_get(const char *name)
-{
- if (!strcasecmp(name,"tport"))
- return tport_log;
- else if (!strcasecmp(name,"nea"))
- return nea_log;
- else if (!strcasecmp(name,"nta"))
- return nta_log;
- else if (!strcasecmp(name,"nua"))
- return nua_log;
- else if (!strcasecmp(name,"soa"))
- return soa_log;
- else if (!strcasecmp(name,"default"))
- return su_log_default;
- return NULL;
-}
-
-apt_bool_t mrcp_sofiasip_log_init(const char *name, const char *level_str, apt_bool_t redirect)
-{
- su_log_t *logger = mrcp_sofiasip_logger_get(name);
- if(!logger) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown SofiaSIP Logger <%s>",name);
- return FALSE;
- }
-
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Init SofiaSIP Logger [%s] level:%s redirect:%d",
- name, level_str, redirect);
- su_log_init(logger);
-
- if(redirect == TRUE) {
- su_log_redirect(logger, mrcp_sofiasip_log, NULL);
- }
-
- if(level_str) {
- int level = atoi(level_str);
- if(level >=0 && level < 10) {
- su_log_set_level(logger, level);
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown SofiaSIP Log Level [%s]: must be in range [0..9]",level_str);
- }
- }
- return TRUE;
-}
+++ /dev/null
-/*
- * 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.c 2250 2014-11-19 05:41:12Z 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 <sofia-sip/su.h>
-#include <sofia-sip/nua.h>
-#include <sofia-sip/sip_status.h>
-#include <sofia-sip/sdp.h>
-#include <sofia-sip/tport.h>
-#include <sofia-sip/sofia_features.h>
-#undef strcasecmp
-#undef strncasecmp
-#include <apr_general.h>
-
-#include "mrcp_sofiasip_server_agent.h"
-#include "mrcp_session.h"
-#include "mrcp_session_descriptor.h"
-#include "mrcp_sdp.h"
-#include "apt_log.h"
-
-struct mrcp_sofia_agent_t {
- mrcp_sig_agent_t *sig_agent;
-
- mrcp_sofia_server_config_t *config;
- char *sip_contact_str;
- char *sip_bind_str;
-
- su_root_t *root;
- nua_t *nua;
-};
-
-struct mrcp_sofia_session_t {
- mrcp_session_t *session;
- su_home_t *home;
- nua_handle_t *nh;
-};
-
-/* Task Interface */
-static void mrcp_sofia_task_initialize(apt_task_t *task);
-static apt_bool_t mrcp_sofia_task_run(apt_task_t *task);
-static apt_bool_t mrcp_sofia_task_terminate(apt_task_t *task);
-
-/* MRCP Signaling Interface */
-static apt_bool_t mrcp_sofia_on_session_answer(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor);
-static apt_bool_t mrcp_sofia_on_session_terminate(mrcp_session_t *session);
-
-static const mrcp_session_response_vtable_t session_response_vtable = {
- mrcp_sofia_on_session_answer,
- mrcp_sofia_on_session_terminate,
- NULL /* mrcp_sofia_on_session_control */,
- NULL /* mrcp_sofia_on_session_discover */
-};
-
-static apt_bool_t mrcp_sofia_config_validate(mrcp_sofia_agent_t *sofia_agent, mrcp_sofia_server_config_t *config, apr_pool_t *pool);
-
-static void mrcp_sofia_event_callback( nua_event_t nua_event,
- int status,
- char const *phrase,
- nua_t *nua,
- mrcp_sofia_agent_t *sofia_agent,
- nua_handle_t *nh,
- mrcp_sofia_session_t *sofia_session,
- sip_t const *sip,
- tagi_t tags[]);
-
-apt_bool_t mrcp_sofiasip_log_init(const char *name, const char *level_str, apt_bool_t redirect);
-
-/** 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)
-{
- apt_task_t *task;
- apt_task_vtable_t *vtable;
- mrcp_sofia_agent_t *sofia_agent;
- sofia_agent = apr_palloc(pool,sizeof(mrcp_sofia_agent_t));
- sofia_agent->sig_agent = mrcp_signaling_agent_create(id,sofia_agent,pool);
- sofia_agent->config = config;
- sofia_agent->root = NULL;
- sofia_agent->nua = NULL;
-
- if(mrcp_sofia_config_validate(sofia_agent,config,pool) == FALSE) {
- return NULL;
- }
-
- task = apt_task_create(sofia_agent,NULL,pool);
- if(!task) {
- return NULL;
- }
- apt_task_name_set(task,id);
- vtable = apt_task_vtable_get(task);
- if(vtable) {
- vtable->on_pre_run = mrcp_sofia_task_initialize;
- vtable->run = mrcp_sofia_task_run;
- vtable->terminate = mrcp_sofia_task_terminate;
- }
- sofia_agent->sig_agent->task = task;
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create SofiaSIP Agent [%s] ["SOFIA_SIP_VERSION"] %s",
- id,sofia_agent->sip_bind_str);
- return sofia_agent->sig_agent;
-}
-
-/** Allocate Sofia-SIP config */
-MRCP_DECLARE(mrcp_sofia_server_config_t*) mrcp_sofiasip_server_config_alloc(apr_pool_t *pool)
-{
- mrcp_sofia_server_config_t *config = apr_palloc(pool,sizeof(mrcp_sofia_server_config_t));
- config->local_ip = NULL;
- config->ext_ip = NULL;
- config->local_port = 0;
- config->user_name = NULL;
- config->user_agent_name = NULL;
- config->origin = NULL;
- config->transport = NULL;
- config->force_destination = FALSE;
- config->sip_t1 = 0;
- config->sip_t2 = 0;
- config->sip_t4 = 0;
- config->sip_t1x64 = 0;
-
- config->tport_log = FALSE;
- config->tport_dump_file = NULL;
-
- return config;
-}
-
-MRCP_DECLARE(apt_bool_t) mrcp_sofiasip_server_logger_init(const char *name, const char *level_str, apt_bool_t redirect)
-{
- return mrcp_sofiasip_log_init(name,level_str,redirect);
-}
-
-static apt_bool_t mrcp_sofia_config_validate(mrcp_sofia_agent_t *sofia_agent, mrcp_sofia_server_config_t *config, apr_pool_t *pool)
-{
- sofia_agent->config = config;
- sofia_agent->sip_contact_str = NULL; /* Let Sofia-SIP implicitly set Contact header by default */
- if(config->ext_ip) {
- /* Use external IP address in Contact header, if behind NAT */
- sofia_agent->sip_contact_str = apr_psprintf(pool,"sip:%s:%hu",config->ext_ip,config->local_port);
- }
- if(config->transport) {
- sofia_agent->sip_bind_str = apr_psprintf(pool,"sip:%s:%hu;transport=%s",
- config->local_ip,
- config->local_port,
- config->transport);
- }
- else {
- sofia_agent->sip_bind_str = apr_psprintf(pool,"sip:%s:%hu",
- config->local_ip,
- config->local_port);
- }
- return TRUE;
-}
-
-static void mrcp_sofia_task_initialize(apt_task_t *task)
-{
- mrcp_sofia_agent_t *sofia_agent = apt_task_object_get(task);
- mrcp_sofia_server_config_t *sofia_config = sofia_agent->config;
-
- /* Initialize Sofia-SIP library and create event loop */
- su_init();
- sofia_agent->root = su_root_create(NULL);
-
- /* Create a user agent instance. The stack will call the 'event_callback()'
- * callback when events such as succesful registration to network,
- * an incoming call, etc, occur.
- */
- sofia_agent->nua = nua_create(
- sofia_agent->root, /* Event loop */
- mrcp_sofia_event_callback, /* Callback for processing events */
- sofia_agent, /* Additional data to pass to callback */
- NUTAG_URL(sofia_agent->sip_bind_str), /* Address to bind to */
- NUTAG_AUTOANSWER(0),
- NUTAG_APPL_METHOD("OPTIONS"),
- TAG_IF(sofia_config->sip_t1,NTATAG_SIP_T1(sofia_config->sip_t1)),
- TAG_IF(sofia_config->sip_t2,NTATAG_SIP_T2(sofia_config->sip_t2)),
- TAG_IF(sofia_config->sip_t4,NTATAG_SIP_T4(sofia_config->sip_t4)),
- TAG_IF(sofia_config->sip_t1x64,NTATAG_SIP_T1X64(sofia_config->sip_t1x64)),
- SIPTAG_USER_AGENT_STR(sofia_config->user_agent_name),
- TAG_IF(sofia_config->tport_log == TRUE,TPTAG_LOG(1)), /* Print out SIP messages to the console */
- TAG_IF(sofia_config->tport_dump_file,TPTAG_DUMP(sofia_config->tport_dump_file)), /* Dump SIP messages to the file */
- TAG_END()); /* Last tag should always finish the sequence */
- if(!sofia_agent->nua) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create NUA [%s] %s",
- apt_task_name_get(task),
- sofia_agent->sip_bind_str);
- }
-}
-
-static apt_bool_t mrcp_sofia_task_run(apt_task_t *task)
-{
- mrcp_sofia_agent_t *sofia_agent = apt_task_object_get(task);
-
- if(sofia_agent->nua) {
- /* Run event loop */
- su_root_run(sofia_agent->root);
-
- /* Destroy allocated resources */
- nua_destroy(sofia_agent->nua);
- sofia_agent->nua = NULL;
- }
- su_root_destroy(sofia_agent->root);
- sofia_agent->root = NULL;
- su_deinit();
-
- apt_task_terminate_request_process(task);
- return TRUE;
-}
-
-static apt_bool_t mrcp_sofia_task_terminate(apt_task_t *task)
-{
- mrcp_sofia_agent_t *sofia_agent = apt_task_object_get(task);
- if(sofia_agent->nua) {
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Send Shutdown Signal to NUA [%s]",
- apt_task_name_get(task));
- nua_shutdown(sofia_agent->nua);
- }
- return TRUE;
-}
-
-static mrcp_sofia_session_t* mrcp_sofia_session_create(mrcp_sofia_agent_t *sofia_agent, nua_handle_t *nh)
-{
- mrcp_sofia_session_t *sofia_session;
- mrcp_session_t* session = sofia_agent->sig_agent->create_server_session(sofia_agent->sig_agent);
- if(!session) {
- return NULL;
- }
- session->response_vtable = &session_response_vtable;
- session->event_vtable = NULL;
-
- sofia_session = apr_palloc(session->pool,sizeof(mrcp_sofia_session_t));
- sofia_session->home = su_home_new(sizeof(*sofia_session->home));
- sofia_session->session = session;
- session->obj = sofia_session;
-
- nua_handle_bind(nh, sofia_session);
- sofia_session->nh = nh;
- return sofia_session;
-}
-
-static int sip_status_get(mrcp_session_status_e status)
-{
- switch (status) {
- case MRCP_SESSION_STATUS_OK:
- return 200;
- case MRCP_SESSION_STATUS_NO_SUCH_RESOURCE:
- return 404;
- case MRCP_SESSION_STATUS_UNACCEPTABLE_RESOURCE:
- return 406;
- case MRCP_SESSION_STATUS_UNAVAILABLE_RESOURCE:
- return 480;
- case MRCP_SESSION_STATUS_ERROR:
- return 500;
- }
- return 200;
-}
-
-static apt_bool_t mrcp_sofia_on_session_answer(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor)
-{
- mrcp_sofia_session_t *sofia_session = session->obj;
- mrcp_sofia_agent_t *sofia_agent = session->signaling_agent->obj;
- const char *local_sdp_str = NULL;
- char sdp_str[2048];
-
- if(!sofia_agent || !sofia_session || !sofia_session->nh) {
- return FALSE;
- }
-
- if(descriptor->status != MRCP_SESSION_STATUS_OK) {
- int status = sip_status_get(descriptor->status);
- nua_respond(sofia_session->nh, status, sip_status_phrase(status),
- TAG_IF(sofia_agent->sip_contact_str,SIPTAG_CONTACT_STR(sofia_agent->sip_contact_str)),
- TAG_END());
- return TRUE;
- }
-
- if(sofia_agent->config->origin) {
- apt_string_set(&descriptor->origin,sofia_agent->config->origin);
- }
-
- if(sdp_string_generate_by_mrcp_descriptor(sdp_str,sizeof(sdp_str),descriptor,FALSE) > 0) {
- local_sdp_str = sdp_str;
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Local SDP "APT_NAMESID_FMT"\n%s",
- session->name,
- MRCP_SESSION_SID(session),
- local_sdp_str);
- }
-
- nua_respond(sofia_session->nh, SIP_200_OK,
- TAG_IF(sofia_agent->sip_contact_str,SIPTAG_CONTACT_STR(sofia_agent->sip_contact_str)),
- TAG_IF(local_sdp_str,SOATAG_USER_SDP_STR(local_sdp_str)),
- SOATAG_AUDIO_AUX("telephone-event"),
- NUTAG_AUTOANSWER(0),
- TAG_END());
-
- return TRUE;
-}
-
-static apt_bool_t mrcp_sofia_on_session_terminate(mrcp_session_t *session)
-{
- mrcp_sofia_session_t *sofia_session = session->obj;
- if(sofia_session) {
- if(sofia_session->nh) {
- nua_handle_bind(sofia_session->nh, NULL);
- nua_handle_destroy(sofia_session->nh);
- }
- if(sofia_session->home) {
- su_home_unref(sofia_session->home);
- sofia_session->home = NULL;
- }
- sofia_session->session = NULL;
- }
-
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Destroy Session "APT_SID_FMT, MRCP_SESSION_SID(session));
- mrcp_session_destroy(session);
- return TRUE;
-}
-
-static void mrcp_sofia_on_call_receive(mrcp_sofia_agent_t *sofia_agent,
- nua_handle_t *nh,
- mrcp_sofia_session_t *sofia_session,
- sip_t const *sip,
- tagi_t tags[])
-{
- apt_bool_t status = FALSE;
- const char *remote_sdp_str = NULL;
- mrcp_session_descriptor_t *descriptor;
-
- if(!sofia_session) {
- sofia_session = mrcp_sofia_session_create(sofia_agent,nh);
- if(!sofia_session) {
- nua_respond(nh, SIP_488_NOT_ACCEPTABLE, TAG_END());
- return;
- }
- }
-
- descriptor = mrcp_session_descriptor_create(sofia_session->session->pool);
-
- tl_gets(tags,
- SOATAG_REMOTE_SDP_STR_REF(remote_sdp_str),
- TAG_END());
-
- if(remote_sdp_str) {
- sdp_parser_t *parser = NULL;
- sdp_session_t *sdp = NULL;
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Remote SDP "APT_NAMESID_FMT"\n%s",
- sofia_session->session->name,
- MRCP_SESSION_SID(sofia_session->session),
- remote_sdp_str);
-
- parser = sdp_parse(sofia_session->home,remote_sdp_str,(int)strlen(remote_sdp_str),0);
- sdp = sdp_session(parser);
- status = mrcp_descriptor_generate_by_sdp_session(descriptor,sdp,NULL,sofia_session->session->pool);
- sdp_parser_free(parser);
- }
-
- if(status == FALSE) {
- nua_respond(nh, SIP_400_BAD_REQUEST, TAG_END());
- return;
- }
-
- mrcp_session_offer(sofia_session->session,descriptor);
-}
-
-static void mrcp_sofia_on_call_terminate(mrcp_sofia_agent_t *sofia_agent,
- nua_handle_t *nh,
- mrcp_sofia_session_t *sofia_session,
- sip_t const *sip,
- tagi_t tags[])
-{
- if(sofia_session) {
- mrcp_session_terminate_request(sofia_session->session);
- }
-}
-
-static void mrcp_sofia_on_state_change(mrcp_sofia_agent_t *sofia_agent,
- nua_handle_t *nh,
- mrcp_sofia_session_t *sofia_session,
- sip_t const *sip,
- tagi_t tags[])
-{
- int nua_state = nua_callstate_init;
- tl_gets(tags,
- NUTAG_CALLSTATE_REF(nua_state),
- TAG_END());
-
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"SIP Call State %s [%s]",
- sofia_session ? sofia_session->session->name : "",
- nua_callstate_name(nua_state));
-
- switch(nua_state) {
- case nua_callstate_received:
- mrcp_sofia_on_call_receive(sofia_agent,nh,sofia_session,sip,tags);
- break;
- case nua_callstate_terminated:
- mrcp_sofia_on_call_terminate(sofia_agent,nh,sofia_session,sip,tags);
- break;
- }
-}
-
-static void mrcp_sofia_on_resource_discover(mrcp_sofia_agent_t *sofia_agent,
- nua_handle_t *nh,
- mrcp_sofia_session_t *sofia_session,
- sip_t const *sip,
- tagi_t tags[])
-{
- char sdp_str[2048];
- const char *local_sdp_str = NULL;
-
- const char *ip = sofia_agent->config->ext_ip ?
- sofia_agent->config->ext_ip : sofia_agent->config->local_ip;
-
- if(sdp_resource_discovery_string_generate(ip,sofia_agent->config->origin,sdp_str,sizeof(sdp_str)) > 0) {
- local_sdp_str = sdp_str;
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Resource Discovery SDP\n[%s]\n",
- local_sdp_str);
- }
-
- nua_respond(nh, SIP_200_OK,
- NUTAG_WITH_CURRENT(sofia_agent->nua),
- TAG_IF(sofia_agent->sip_contact_str,SIPTAG_CONTACT_STR(sofia_agent->sip_contact_str)),
- TAG_IF(local_sdp_str,SOATAG_USER_SDP_STR(local_sdp_str)),
- SOATAG_AUDIO_AUX("telephone-event"),
- TAG_END());
-}
-
-/** This callback will be called by SIP stack to process incoming events */
-static void mrcp_sofia_event_callback( nua_event_t nua_event,
- int status,
- char const *phrase,
- nua_t *nua,
- mrcp_sofia_agent_t *sofia_agent,
- nua_handle_t *nh,
- mrcp_sofia_session_t *sofia_session,
- sip_t const *sip,
- tagi_t tags[])
-{
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Receive SIP Event [%s] Status %d %s [%s]",
- nua_event_name(nua_event),
- status,
- phrase,
- sofia_agent->sig_agent->id);
-
- switch(nua_event) {
- case nua_i_state:
- mrcp_sofia_on_state_change(sofia_agent,nh,sofia_session,sip,tags);
- break;
- case nua_i_options:
- mrcp_sofia_on_resource_discover(sofia_agent,nh,sofia_session,sip,tags);
- break;
- case nua_r_shutdown:
- /* if status < 200, shutdown still in progress */
- if(status >= 200) {
- /* break main loop of sofia thread */
- su_root_break(sofia_agent->root);
- }
- break;
- default:
- break;
- }
-}
+++ /dev/null
-MAINTAINERCLEANFILES = Makefile.in
-
-AM_CPPFLAGS = -I$(top_srcdir)/modules/mrcp-unirtsp/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/uni-rtsp/include \
- -I$(top_srcdir)/libs/apr-toolkit/include \
- $(UNIMRCP_APR_INCLUDES) $(UNIMRCP_SOFIA_INCLUDES)
-
-noinst_LTLIBRARIES = libmrcpunirtsp.la
-
-include_HEADERS = include/mrcp_unirtsp_sdp.h \
- include/mrcp_unirtsp_server_agent.h \
- include/mrcp_unirtsp_client_agent.h
-libmrcpunirtsp_la_SOURCES = src/mrcp_unirtsp_sdp.c \
- src/mrcp_unirtsp_server_agent.c \
- src/mrcp_unirtsp_client_agent.c
-libmrcpunirtsp_la_LIBADD = $(top_builddir)/libs/uni-rtsp/libunirtsp.la
+++ /dev/null
-/*
- * 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_unirtsp_client_agent.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MRCP_UNIRTSP_CLIENT_AGENT_H
-#define MRCP_UNIRTSP_CLIENT_AGENT_H
-
-/**
- * @file mrcp_unirtsp_client_agent.h
- * @brief Implementation of MRCP Signaling Interface using UniRTSP
- */
-
-#include <apr_network_io.h>
-#include "apt_string.h"
-#include "mrcp_sig_agent.h"
-
-APT_BEGIN_EXTERN_C
-
-/** Declaration of UniRTSP agent config */
-typedef struct rtsp_client_config_t rtsp_client_config_t;
-
-/** Configuration of UniRTSP agent */
-struct rtsp_client_config_t {
- /** SDP origin */
- char *origin;
- /** Number of max RTSP connections */
- apr_size_t max_connection_count;
- /** Request timeout */
- apr_size_t request_timeout;
-};
-
-/**
- * Create UniRTSP signaling agent.
- */
-MRCP_DECLARE(mrcp_sig_agent_t*) mrcp_unirtsp_client_agent_create(const char *id, rtsp_client_config_t *config, apr_pool_t *pool);
-
-/**
- * Allocate UniRTSP config.
- */
-MRCP_DECLARE(rtsp_client_config_t*) mrcp_unirtsp_client_config_alloc(apr_pool_t *pool);
-
-
-APT_END_EXTERN_C
-
-#endif /* MRCP_UNIRTSP_CLIENT_AGENT_H */
+++ /dev/null
-/*
- * 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_unirtsp_sdp.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef MRCP_UNIRTSP_SDP_H
-#define MRCP_UNIRTSP_SDP_H
-
-/**
- * @file mrcp_unirtsp_sdp.h
- * @brief MRCP RTSP SDP Transformations
- */
-
-#include "mrcp_session_descriptor.h"
-
-APT_BEGIN_EXTERN_C
-
-/** Generate MRCP descriptor by RTSP request */
-MRCP_DECLARE(mrcp_session_descriptor_t*) mrcp_descriptor_generate_by_rtsp_request(
- const rtsp_message_t *request,
- const char *force_destination_ip,
- const apr_table_t *resource_map,
- apr_pool_t *pool,
- su_home_t *home);
-
-/** Generate MRCP descriptor by RTSP response */
-MRCP_DECLARE(mrcp_session_descriptor_t*) mrcp_descriptor_generate_by_rtsp_response(
- const rtsp_message_t *request,
- const rtsp_message_t *response,
- const char *force_destination_ip,
- const apr_table_t *resource_map,
- apr_pool_t *pool,
- su_home_t *home);
-
-/** Generate RTSP request by MRCP descriptor */
-MRCP_DECLARE(rtsp_message_t*) rtsp_request_generate_by_mrcp_descriptor(
- const mrcp_session_descriptor_t *descriptor,
- const apr_table_t *resource_map,
- apr_pool_t *pool);
-/** Generate RTSP response by MRCP descriptor */
-MRCP_DECLARE(rtsp_message_t*) rtsp_response_generate_by_mrcp_descriptor(
- const rtsp_message_t *request,
- const mrcp_session_descriptor_t *descriptor,
- const apr_table_t *resource_map,
- apr_pool_t *pool);
-
-/** Generate RTSP resource discovery request */
-MRCP_DECLARE(rtsp_message_t*) rtsp_resource_discovery_request_generate(
- const char *resource_name,
- const apr_table_t *resource_map,
- apr_pool_t *pool);
-
-/** Generate resource discovery descriptor by RTSP response */
-MRCP_DECLARE(mrcp_session_descriptor_t*) mrcp_resource_discovery_response_generate(
- const rtsp_message_t *request,
- const rtsp_message_t *response,
- const apr_table_t *resource_map,
- apr_pool_t *pool,
- su_home_t *home);
-
-/** Generate RTSP resource discovery response */
-MRCP_DECLARE(rtsp_message_t*) rtsp_resource_discovery_response_generate(
- const rtsp_message_t *request,
- const char *ip,
- const char *origin,
- apr_pool_t *pool);
-
-
-/** Get MRCP resource name by RTSP resource name */
-MRCP_DECLARE(const char*) mrcp_name_get_by_rtsp_name(const apr_table_t *resource_map, const char *rtsp_name);
-/** Get RTSP resource name by MRCP resource name */
-MRCP_DECLARE(const char*) rtsp_name_get_by_mrcp_name(const apr_table_t *resource_map, const char *mrcp_name);
-
-APT_END_EXTERN_C
-
-#endif /* MRCP_UNIRTSP_SDP_H */
+++ /dev/null
-/*
- * 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_unirtsp_server_agent.h 2252 2014-11-21 02:45:15Z achaloyan@gmail.com $
- */
-
-#ifndef MRCP_UNIRTSP_SERVER_AGENT_H
-#define MRCP_UNIRTSP_SERVER_AGENT_H
-
-/**
- * @file mrcp_unirtsp_server_agent.h
- * @brief Implementation of MRCP Signaling Interface using UniRTSP
- */
-
-#include <apr_network_io.h>
-#include "mrcp_sig_agent.h"
-
-APT_BEGIN_EXTERN_C
-
-/** UniRTSP config declaration */
-typedef struct rtsp_server_config_t rtsp_server_config_t;
-
-/** UniRTSP config */
-struct rtsp_server_config_t {
- /** Local IP address to bind to */
- char *local_ip;
- /** Local port to bind to */
- apr_port_t local_port;
-
- /** Resource location */
- char *resource_location;
- /** SDP origin */
- char *origin;
-
- /** Map of the MRCP resource names */
- apr_table_t *resource_map;
-
- /** Number of max RTSP connections */
- apr_size_t max_connection_count;
-
- /** 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;
-};
-
-/**
- * Create UniRTSP signaling agent.
- */
-MRCP_DECLARE(mrcp_sig_agent_t*) mrcp_unirtsp_server_agent_create(const char *id, rtsp_server_config_t *config, apr_pool_t *pool);
-
-/**
- * Allocate UniRTSP config.
- */
-MRCP_DECLARE(rtsp_server_config_t*) mrcp_unirtsp_server_config_alloc(apr_pool_t *pool);
-
-APT_END_EXTERN_C
-
-#endif /* MRCP_UNIRTSP_SERVER_AGENT_H */
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>\r
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
- <ItemGroup>\r
- <Filter Include="include">\r
- <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>\r
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>\r
- </Filter>\r
- <Filter Include="src">\r
- <UniqueIdentifier>{f87f8ada-12d1-412b-bd14-7e62df3f92a0}</UniqueIdentifier>\r
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>\r
- </Filter>\r
- </ItemGroup>\r
- <ItemGroup>\r
- <ClInclude Include="include\mrcp_unirtsp_client_agent.h">\r
- <Filter>include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="include\mrcp_unirtsp_sdp.h">\r
- <Filter>include</Filter>\r
- </ClInclude>\r
- <ClInclude Include="include\mrcp_unirtsp_server_agent.h">\r
- <Filter>include</Filter>\r
- </ClInclude>\r
- </ItemGroup>\r
- <ItemGroup>\r
- <ClCompile Include="src\mrcp_unirtsp_client_agent.c">\r
- <Filter>src</Filter>\r
- </ClCompile>\r
- <ClCompile Include="src\mrcp_unirtsp_sdp.c">\r
- <Filter>src</Filter>\r
- </ClCompile>\r
- <ClCompile Include="src\mrcp_unirtsp_server_agent.c">\r
- <Filter>src</Filter>\r
- </ClCompile>\r
- </ItemGroup>\r
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>\r
-<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
- <ItemGroup Label="ProjectConfigurations">\r
- <ProjectConfiguration Include="Debug|Win32">\r
- <Configuration>Debug</Configuration>\r
- <Platform>Win32</Platform>\r
- </ProjectConfiguration>\r
- <ProjectConfiguration Include="Debug|x64">\r
- <Configuration>Debug</Configuration>\r
- <Platform>x64</Platform>\r
- </ProjectConfiguration>\r
- <ProjectConfiguration Include="Release|Win32">\r
- <Configuration>Release</Configuration>\r
- <Platform>Win32</Platform>\r
- </ProjectConfiguration>\r
- <ProjectConfiguration Include="Release|x64">\r
- <Configuration>Release</Configuration>\r
- <Platform>x64</Platform>\r
- </ProjectConfiguration>\r
- </ItemGroup>\r
- <PropertyGroup Label="Globals">\r
- <ProjectName>mrcpunirtsp</ProjectName>\r
- <ProjectGuid>{DEB01ACB-D65F-4A62-AED9-58C1054499E9}</ProjectGuid>\r
- <RootNamespace>mrcpunirtsp</RootNamespace>\r
- <Keyword>Win32Proj</Keyword>\r
- </PropertyGroup>\r
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />\r
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">\r
- <ConfigurationType>StaticLibrary</ConfigurationType>\r
- <CharacterSet>Unicode</CharacterSet>\r
- <WholeProgramOptimization>true</WholeProgramOptimization>\r
- <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>\r
- </PropertyGroup>\r
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">\r
- <ConfigurationType>StaticLibrary</ConfigurationType>\r
- <CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>\r
- </PropertyGroup>\r
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">\r
- <ConfigurationType>StaticLibrary</ConfigurationType>\r
- <CharacterSet>Unicode</CharacterSet>\r
- <WholeProgramOptimization>true</WholeProgramOptimization>\r
- <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>\r
- </PropertyGroup>\r
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">\r
- <ConfigurationType>StaticLibrary</ConfigurationType>\r
- <CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>\r
- </PropertyGroup>\r
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />\r
- <ImportGroup Label="ExtensionSettings">\r
- </ImportGroup>\r
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">\r
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />\r
- <Import Project="$(ProjectDir)..\..\build\props\mrcpsignaling.props" />\r
- <Import Project="$(ProjectDir)..\..\build\props\unirtsp.props" />\r
- <Import Project="$(ProjectDir)..\..\build\props\sofiasip.props" />\r
- </ImportGroup>\r
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">\r
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.props" />\r
- <Import Project="$(ProjectDir)..\..\build\props\mrcpsignaling.props" />\r
- <Import Project="$(ProjectDir)..\..\build\props\unirtsp.props" />\r
- <Import Project="$(ProjectDir)..\..\build\props\sofiasip.props" />\r
- </ImportGroup>\r
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">\r
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />\r
- <Import Project="$(ProjectDir)..\..\build\props\mrcpsignaling.props" />\r
- <Import Project="$(ProjectDir)..\..\build\props\unirtsp.props" />\r
- <Import Project="$(ProjectDir)..\..\build\props\sofiasip.props" />\r
- </ImportGroup>\r
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">\r
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.props" />\r
- <Import Project="$(ProjectDir)..\..\build\props\mrcpsignaling.props" />\r
- <Import Project="$(ProjectDir)..\..\build\props\unirtsp.props" />\r
- <Import Project="$(ProjectDir)..\..\build\props\sofiasip.props" />\r
- </ImportGroup>\r
- <PropertyGroup Label="UserMacros" />\r
- <PropertyGroup>\r
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>\r
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(PlatformName)\$(Configuration)\</OutDir>\r
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(PlatformName)\$(Configuration)\</IntDir>\r
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(PlatformName)\$(Configuration)\</OutDir>\r
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(PlatformName)\$(Configuration)\</IntDir>\r
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(PlatformName)\$(Configuration)\</OutDir>\r
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(PlatformName)\$(Configuration)\</IntDir>\r
- <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(PlatformName)\$(Configuration)\</OutDir>\r
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(PlatformName)\$(Configuration)\</IntDir>\r
- </PropertyGroup>\r
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
- <ClCompile>\r
- <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
- <PreprocessorDefinitions>APT_STATIC_LIB;RTSP_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;LIBSOFIA_SIP_UA_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
- <DisableSpecificWarnings>4456;4100;%(DisableSpecificWarnings)</DisableSpecificWarnings>\r
- </ClCompile>\r
- </ItemDefinitionGroup>\r
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">\r
- <Midl>\r
- <TargetEnvironment>X64</TargetEnvironment>\r
- </Midl>\r
- <ClCompile>\r
- <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
- <PreprocessorDefinitions>APT_STATIC_LIB;RTSP_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;LIBSOFIA_SIP_UA_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>\r
- <DisableSpecificWarnings>4456;4100;%(DisableSpecificWarnings)</DisableSpecificWarnings>\r
- </ClCompile>\r
- </ItemDefinitionGroup>\r
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
- <ClCompile>\r
- <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
- <PreprocessorDefinitions>APT_STATIC_LIB;RTSP_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;LIBSOFIA_SIP_UA_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
- <DisableSpecificWarnings>4456;4100;%(DisableSpecificWarnings)</DisableSpecificWarnings>\r
- </ClCompile>\r
- </ItemDefinitionGroup>\r
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">\r
- <Midl>\r
- <TargetEnvironment>X64</TargetEnvironment>\r
- </Midl>\r
- <ClCompile>\r
- <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
- <PreprocessorDefinitions>APT_STATIC_LIB;RTSP_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;LIBSOFIA_SIP_UA_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
- <DisableSpecificWarnings>4456;4100;%(DisableSpecificWarnings)</DisableSpecificWarnings>\r
- </ClCompile>\r
- </ItemDefinitionGroup>\r
- <ItemGroup>\r
- <ClInclude Include="include\mrcp_unirtsp_client_agent.h" />\r
- <ClInclude Include="include\mrcp_unirtsp_sdp.h" />\r
- <ClInclude Include="include\mrcp_unirtsp_server_agent.h" />\r
- </ItemGroup>\r
- <ItemGroup>\r
- <ClCompile Include="src\mrcp_unirtsp_client_agent.c" />\r
- <ClCompile Include="src\mrcp_unirtsp_sdp.c" />\r
- <ClCompile Include="src\mrcp_unirtsp_server_agent.c" />\r
- </ItemGroup>\r
- <ItemGroup>\r
- <ProjectReference Include="..\..\..\win32\sofia\libsofia_sip_ua_static.2017.vcxproj">\r
- <Project>{70a49bc2-7500-41d0-b75d-edcc5be987a0}</Project>\r
- </ProjectReference>\r
- </ItemGroup>\r
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />\r
- <ImportGroup Label="ExtensionTargets">\r
- </ImportGroup>\r
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="mrcpunirtsp"
- ProjectGUID="{DEB01ACB-D65F-4A62-AED9-58C1054499E9}"
- RootNamespace="mrcpunirtsp"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- <Platform
- Name="x64"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- ConfigurationType="4"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unilib.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpsignaling.vsprops;$(ProjectDir)..\..\build\vsprops\unirtsp.vsprops;$(ProjectDir)..\..\build\vsprops\sofiasip.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="include"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- ConfigurationType="4"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unilib.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpsignaling.vsprops;$(ProjectDir)..\..\build\vsprops\unirtsp.vsprops;$(ProjectDir)..\..\build\vsprops\sofiasip.vsprops"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="include"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|x64"
- ConfigurationType="4"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unilib-x64.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpsignaling.vsprops;$(ProjectDir)..\..\build\vsprops\unirtsp.vsprops;$(ProjectDir)..\..\build\vsprops\sofiasip.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="include"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|x64"
- ConfigurationType="4"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unilib-x64.vsprops;$(ProjectDir)..\..\build\vsprops\mrcpsignaling.vsprops;$(ProjectDir)..\..\build\vsprops\unirtsp.vsprops;$(ProjectDir)..\..\build\vsprops\sofiasip.vsprops"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="include"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="include"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- <File
- RelativePath=".\include\mrcp_unirtsp_client_agent.h"
- >
- </File>
- <File
- RelativePath=".\include\mrcp_unirtsp_sdp.h"
- >
- </File>
- <File
- RelativePath=".\include\mrcp_unirtsp_server_agent.h"
- >
- </File>
- </Filter>
- <Filter
- Name="src"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- >
- <File
- RelativePath=".\src\mrcp_unirtsp_client_agent.c"
- >
- </File>
- <File
- RelativePath=".\src\mrcp_unirtsp_sdp.c"
- >
- </File>
- <File
- RelativePath=".\src\mrcp_unirtsp_server_agent.c"
- >
- </File>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{DEB01ACB-D65F-4A62-AED9-58C1054499E9}</ProjectGuid>
- <RootNamespace>mrcpunirtsp</RootNamespace>
- <Keyword>Win32Proj</Keyword>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unilib.props" />
- <Import Project="$(ProjectDir)..\..\build\props\mrcpsignaling.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unirtsp.props" />
- <Import Project="$(ProjectDir)..\..\build\props\sofiasip.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unilib.props" />
- <Import Project="$(ProjectDir)..\..\build\props\mrcpsignaling.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unirtsp.props" />
- <Import Project="$(ProjectDir)..\..\build\props\sofiasip.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unilib-x64.props" />
- <Import Project="$(ProjectDir)..\..\build\props\mrcpsignaling.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unirtsp.props" />
- <Import Project="$(ProjectDir)..\..\build\props\sofiasip.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unilib-x64.props" />
- <Import Project="$(ProjectDir)..\..\build\props\mrcpsignaling.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unirtsp.props" />
- <Import Project="$(ProjectDir)..\..\build\props\sofiasip.props" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClInclude Include="include\mrcp_unirtsp_client_agent.h" />
- <ClInclude Include="include\mrcp_unirtsp_sdp.h" />
- <ClInclude Include="include\mrcp_unirtsp_server_agent.h" />
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="src\mrcp_unirtsp_client_agent.c" />
- <ClCompile Include="src\mrcp_unirtsp_sdp.c" />
- <ClCompile Include="src\mrcp_unirtsp_server_agent.c" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\libs\mrcp-signaling\mrcpsignaling.vcxproj">
- <Project>{12a49562-bab9-43a3-a21d-15b60bbb4c31}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- <ProjectReference Include="..\..\libs\uni-rtsp\unirtsp.vcxproj">
- <Project>{504b3154-7a4f-459d-9877-b951021c3f1f}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="include">
- <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
- </Filter>
- <Filter Include="src">
- <UniqueIdentifier>{1ae8fa5f-5d29-4bd7-a332-b2e917a801ca}</UniqueIdentifier>
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="include\mrcp_unirtsp_client_agent.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mrcp_unirtsp_sdp.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\mrcp_unirtsp_server_agent.h">
- <Filter>include</Filter>
- </ClInclude>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="src\mrcp_unirtsp_client_agent.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\mrcp_unirtsp_sdp.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\mrcp_unirtsp_server_agent.c">
- <Filter>src</Filter>
- </ClCompile>
- </ItemGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-/*
- * 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_unirtsp_client_agent.c 2253 2014-11-21 02:57:19Z achaloyan@gmail.com $
- */
-
-#include <apr_general.h>
-#include <sofia-sip/sdp.h>
-
-#include "mrcp_unirtsp_client_agent.h"
-#include "mrcp_session.h"
-#include "mrcp_session_descriptor.h"
-#include "mrcp_message.h"
-#include "mrcp_stream.h"
-#include "mrcp_resource_factory.h"
-#include "rtsp_client.h"
-#include "mrcp_unirtsp_sdp.h"
-#include "apt_consumer_task.h"
-#include "apt_log.h"
-
-
-typedef struct mrcp_unirtsp_agent_t mrcp_unirtsp_agent_t;
-typedef struct mrcp_unirtsp_session_t mrcp_unirtsp_session_t;
-
-struct mrcp_unirtsp_agent_t {
- mrcp_sig_agent_t *sig_agent;
- rtsp_client_t *rtsp_client;
-
- rtsp_client_config_t *config;
-};
-
-struct mrcp_unirtsp_session_t {
- mrcp_message_t *mrcp_message;
- mrcp_session_t *mrcp_session;
- rtsp_client_session_t *rtsp_session;
- const mrcp_sig_settings_t *rtsp_settings;
- su_home_t *home;
-};
-
-
-static apt_bool_t mrcp_unirtsp_session_offer(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor);
-static apt_bool_t mrcp_unirtsp_session_terminate(mrcp_session_t *session);
-static apt_bool_t mrcp_unirtsp_session_control(mrcp_session_t *session, mrcp_message_t *message);
-static apt_bool_t mrcp_unirtsp_resource_discover(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor);
-
-static const mrcp_session_request_vtable_t session_request_vtable = {
- mrcp_unirtsp_session_offer,
- mrcp_unirtsp_session_terminate,
- mrcp_unirtsp_session_control,
- mrcp_unirtsp_resource_discover
-};
-
-static apt_bool_t mrcp_unirtsp_on_session_terminate_response(rtsp_client_t *client, rtsp_client_session_t *session);
-static apt_bool_t mrcp_unirtsp_on_session_terminate_event(rtsp_client_t *client, rtsp_client_session_t *session);
-static apt_bool_t mrcp_unirtsp_on_session_response(rtsp_client_t *client, rtsp_client_session_t *session, rtsp_message_t *request, rtsp_message_t *response);
-static apt_bool_t mrcp_unirtsp_on_session_event(rtsp_client_t *client, rtsp_client_session_t *session, rtsp_message_t *message);
-
-static const rtsp_client_vtable_t session_response_vtable = {
- mrcp_unirtsp_on_session_terminate_response,
- mrcp_unirtsp_on_session_terminate_event,
- mrcp_unirtsp_on_session_response,
- mrcp_unirtsp_on_session_event
-};
-
-static apt_bool_t mrcp_unirtsp_session_create(mrcp_session_t *session, const mrcp_sig_settings_t *settings);
-static apt_bool_t rtsp_config_validate(mrcp_unirtsp_agent_t *agent, rtsp_client_config_t *config, apr_pool_t *pool);
-static apt_bool_t mrcp_unirtsp_on_resource_discover(mrcp_unirtsp_agent_t *agent, mrcp_unirtsp_session_t *session, rtsp_message_t *request, rtsp_message_t *response);
-
-
-/** Create UniRTSP Signaling Agent */
-MRCP_DECLARE(mrcp_sig_agent_t*) mrcp_unirtsp_client_agent_create(const char *id, rtsp_client_config_t *config, apr_pool_t *pool)
-{
- apt_task_t *task;
- mrcp_unirtsp_agent_t *agent;
- agent = apr_palloc(pool,sizeof(mrcp_unirtsp_agent_t));
- agent->sig_agent = mrcp_signaling_agent_create(id,agent,pool);
- agent->sig_agent->create_client_session = mrcp_unirtsp_session_create;
- agent->config = config;
-
- if(rtsp_config_validate(agent,config,pool) == FALSE) {
- return NULL;
- }
-
- agent->rtsp_client = rtsp_client_create(
- id,
- config->max_connection_count,
- config->request_timeout,
- agent,
- &session_response_vtable,
- pool);
- if(!agent->rtsp_client) {
- return NULL;
- }
-
- task = rtsp_client_task_get(agent->rtsp_client);
- agent->sig_agent->task = task;
-
- return agent->sig_agent;
-}
-
-/** Allocate UniRTSP config */
-MRCP_DECLARE(rtsp_client_config_t*) mrcp_unirtsp_client_config_alloc(apr_pool_t *pool)
-{
- rtsp_client_config_t *config = apr_palloc(pool,sizeof(rtsp_client_config_t));
- config->origin = NULL;
- config->max_connection_count = 100;
- config->request_timeout = 0;
- return config;
-}
-
-static apt_bool_t rtsp_config_validate(mrcp_unirtsp_agent_t *agent, rtsp_client_config_t *config, apr_pool_t *pool)
-{
- agent->config = config;
- return TRUE;
-}
-
-static APR_INLINE mrcp_unirtsp_agent_t* client_agent_get(apt_task_t *task)
-{
- apt_consumer_task_t *consumer_task = apt_task_object_get(task);
- mrcp_unirtsp_agent_t *agent = apt_consumer_task_object_get(consumer_task);
- return agent;
-}
-
-static apt_bool_t mrcp_unirtsp_session_create(mrcp_session_t *mrcp_session, const mrcp_sig_settings_t *settings)
-{
- mrcp_unirtsp_agent_t *agent = mrcp_session->signaling_agent->obj;
- mrcp_unirtsp_session_t *session;
- mrcp_session->request_vtable = &session_request_vtable;
-
- session = apr_palloc(mrcp_session->pool,sizeof(mrcp_unirtsp_session_t));
- session->home = su_home_new(sizeof(*session->home));
- session->rtsp_settings = settings;
- session->mrcp_message = NULL;
- session->mrcp_session = mrcp_session;
- mrcp_session->obj = session;
-
- session->rtsp_session = rtsp_client_session_create(
- agent->rtsp_client,
- session->rtsp_settings->server_ip,
- session->rtsp_settings->server_port,
- session->rtsp_settings->resource_location);
- if(!session->rtsp_session) {
- su_home_unref(session->home);
- return FALSE;
- }
- rtsp_client_session_object_set(session->rtsp_session,session);
- return TRUE;
-}
-
-static void mrcp_unirtsp_session_destroy(mrcp_unirtsp_session_t *session)
-{
- if(session->home) {
- su_home_unref(session->home);
- session->home = NULL;
- }
- rtsp_client_session_object_set(session->rtsp_session,NULL);
- rtsp_client_session_destroy(session->rtsp_session);
-}
-
-static apt_bool_t mrcp_unirtsp_on_session_terminate_response(rtsp_client_t *rtsp_client, rtsp_client_session_t *rtsp_session)
-{
- mrcp_unirtsp_session_t *session = rtsp_client_session_object_get(rtsp_session);
-
- mrcp_unirtsp_session_destroy(session);
- mrcp_session_terminate_response(session->mrcp_session);
- return TRUE;
-}
-
-static apt_bool_t mrcp_unirtsp_on_session_terminate_event(rtsp_client_t *rtsp_client, rtsp_client_session_t *rtsp_session)
-{
- mrcp_unirtsp_session_t *session = rtsp_client_session_object_get(rtsp_session);
- mrcp_session_terminate_event(session->mrcp_session);
- return TRUE;
-}
-
-static apt_bool_t mrcp_unirtsp_on_announce_response(mrcp_unirtsp_agent_t *agent, mrcp_unirtsp_session_t *session, rtsp_message_t *message, const char *resource_name)
-{
- mrcp_message_t *mrcp_message = NULL;
-
- if(!session || !resource_name) {
- return FALSE;
- }
-
- if(rtsp_header_property_check(&message->header,RTSP_HEADER_FIELD_CONTENT_TYPE) == TRUE &&
- message->header.content_type == RTSP_CONTENT_TYPE_MRCP &&
- rtsp_header_property_check(&message->header,RTSP_HEADER_FIELD_CONTENT_LENGTH) == TRUE &&
- message->header.content_length > 0) {
-
- apt_text_stream_t text_stream;
- mrcp_parser_t *parser;
- apt_str_t resource_name_str;
-
- text_stream.text = message->body;
- apt_text_stream_reset(&text_stream);
- apt_string_set(&resource_name_str,resource_name);
-
- parser = mrcp_parser_create(agent->sig_agent->resource_factory,session->mrcp_session->pool);
- mrcp_parser_resource_set(parser,&resource_name_str);
- if(mrcp_parser_run(parser,&text_stream,&mrcp_message) == APT_MESSAGE_STATUS_COMPLETE) {
- mrcp_message->channel_id.session_id = message->header.session_id;
- }
- else {
- /* error case */
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Parse MRCPv1 Message");
- }
- }
- else {
- /* error case */
- }
-
- if(!mrcp_message) {
- if(!session->mrcp_message) {
- return FALSE;
- }
- mrcp_message = mrcp_response_create(session->mrcp_message,session->mrcp_session->pool);
- mrcp_message->start_line.status_code = MRCP_STATUS_CODE_METHOD_FAILED;
- }
-
- session->mrcp_message = NULL;
- mrcp_session_control_response(session->mrcp_session,mrcp_message);
- return TRUE;
-}
-
-static apt_bool_t mrcp_unirtsp_on_session_response(rtsp_client_t *rtsp_client, rtsp_client_session_t *rtsp_session, rtsp_message_t *request, rtsp_message_t *response)
-{
- apt_bool_t status = FALSE;
- mrcp_unirtsp_agent_t *agent = rtsp_client_object_get(rtsp_client);
- mrcp_unirtsp_session_t *session = rtsp_client_session_object_get(rtsp_session);
- if(!agent || !session) {
- return FALSE;
- }
-
- switch(request->start_line.common.request_line.method_id) {
- case RTSP_METHOD_SETUP:
- {
- const apt_str_t *session_id;
- const char *force_destination_ip = NULL;
- mrcp_session_descriptor_t *descriptor;
-
- if(session->rtsp_settings->force_destination == TRUE) {
- force_destination_ip = session->rtsp_settings->server_ip;
- }
-
- descriptor = mrcp_descriptor_generate_by_rtsp_response(
- request,
- response,
- force_destination_ip,
- session->rtsp_settings->resource_map,
- session->mrcp_session->pool,
- session->home);
- if(!descriptor) {
- return FALSE;
- }
- session_id = rtsp_client_session_id_get(session->rtsp_session);
- if(session_id) {
- apt_string_copy(
- &session->mrcp_session->id,
- session_id,
- session->mrcp_session->pool);
- }
- status = mrcp_session_answer(session->mrcp_session,descriptor);
- break;
- }
- case RTSP_METHOD_TEARDOWN:
- {
- mrcp_session_descriptor_t *descriptor;
- descriptor = mrcp_descriptor_generate_by_rtsp_response(
- request,
- response,
- NULL,
- session->rtsp_settings->resource_map,
- session->mrcp_session->pool,
- session->home);
- if(!descriptor) {
- return FALSE;
- }
- status = mrcp_session_answer(session->mrcp_session,descriptor);
- break;
- }
- case RTSP_METHOD_ANNOUNCE:
- {
- mrcp_unirtsp_agent_t *agent = rtsp_client_object_get(rtsp_client);
- const char *resource_name = mrcp_name_get_by_rtsp_name(
- session->rtsp_settings->resource_map,
- request->start_line.common.request_line.resource_name);
- mrcp_unirtsp_on_announce_response(agent,session,response,resource_name);
- break;
- }
- case RTSP_METHOD_DESCRIBE:
- {
- mrcp_unirtsp_agent_t *agent = rtsp_client_object_get(rtsp_client);
- mrcp_unirtsp_on_resource_discover(agent,session,request,response);
- break;
- }
- default:
- break;
- }
-
- return status;
-}
-
-static apt_bool_t mrcp_unirtsp_on_session_event(rtsp_client_t *rtsp_client, rtsp_client_session_t *rtsp_session, rtsp_message_t *message)
-{
- mrcp_unirtsp_agent_t *agent = rtsp_client_object_get(rtsp_client);
- mrcp_unirtsp_session_t *session = rtsp_client_session_object_get(rtsp_session);
- const char *resource_name;
-
- if(!session) {
- return FALSE;
- }
-
- resource_name = mrcp_name_get_by_rtsp_name(
- session->rtsp_settings->resource_map,
- message->start_line.common.request_line.resource_name);
- if(!resource_name) {
- return FALSE;
- }
-
- mrcp_unirtsp_on_announce_response(agent,session,message,resource_name);
- return TRUE;
-}
-
-static apt_bool_t mrcp_unirtsp_session_offer(mrcp_session_t *mrcp_session, mrcp_session_descriptor_t *descriptor)
-{
- mrcp_unirtsp_session_t *session = mrcp_session->obj;
- mrcp_unirtsp_agent_t *agent = mrcp_session->signaling_agent->obj;
- rtsp_message_t *request;
-
- if(agent->config->origin) {
- apt_string_set(&descriptor->origin,agent->config->origin);
- }
-
- request = rtsp_request_generate_by_mrcp_descriptor(descriptor,session->rtsp_settings->resource_map,mrcp_session->pool);
- return rtsp_client_session_request(agent->rtsp_client,session->rtsp_session,request);
-}
-
-static apt_bool_t mrcp_unirtsp_session_terminate(mrcp_session_t *mrcp_session)
-{
- mrcp_unirtsp_session_t *session = mrcp_session->obj;
- mrcp_unirtsp_agent_t *agent = mrcp_session->signaling_agent->obj;
-
- return rtsp_client_session_terminate(agent->rtsp_client,session->rtsp_session);
-}
-
-static apt_bool_t mrcp_unirtsp_session_control(mrcp_session_t *mrcp_session, mrcp_message_t *mrcp_message)
-{
- mrcp_unirtsp_session_t *session = mrcp_session->obj;
- mrcp_unirtsp_agent_t *agent = mrcp_session->signaling_agent->obj;
-
- char buffer[2000];
- apt_text_stream_t stream;
- rtsp_message_t *rtsp_message = NULL;
- apt_str_t *body;
-
- apt_text_stream_init(&stream,buffer,sizeof(buffer));
-
- mrcp_message->start_line.version = MRCP_VERSION_1;
- if(mrcp_message_generate(agent->sig_agent->resource_factory,mrcp_message,&stream) != TRUE) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Generate MRCPv1 Message");
- return FALSE;
- }
- stream.text.length = stream.pos - stream.text.buf;
-
- rtsp_message = rtsp_request_create(mrcp_session->pool);
- rtsp_message->start_line.common.request_line.resource_name = rtsp_name_get_by_mrcp_name(
- session->rtsp_settings->resource_map,
- mrcp_message->channel_id.resource_name.buf);
- rtsp_message->start_line.common.request_line.method_id = RTSP_METHOD_ANNOUNCE;
-
- body = &rtsp_message->body;
- body->length = mrcp_message->start_line.length;
- body->buf = apr_palloc(rtsp_message->pool,body->length+1);
- memcpy(body->buf,stream.text.buf,stream.text.length);
- if(mrcp_message->body.length) {
- memcpy(body->buf+stream.text.length,mrcp_message->body.buf,mrcp_message->body.length);
- }
- body->buf[body->length] = '\0';
-
- rtsp_message->header.content_type = RTSP_CONTENT_TYPE_MRCP;
- rtsp_header_property_add(&rtsp_message->header,RTSP_HEADER_FIELD_CONTENT_TYPE,rtsp_message->pool);
- rtsp_message->header.content_length = body->length;
- rtsp_header_property_add(&rtsp_message->header,RTSP_HEADER_FIELD_CONTENT_LENGTH,rtsp_message->pool);
-
- session->mrcp_message = mrcp_message;
- rtsp_client_session_request(agent->rtsp_client,session->rtsp_session,rtsp_message);
- return TRUE;
-}
-
-static apt_bool_t mrcp_unirtsp_resource_discover(mrcp_session_t *mrcp_session, mrcp_session_descriptor_t *descriptor)
-{
- mrcp_unirtsp_session_t *session = mrcp_session->obj;
- mrcp_unirtsp_agent_t *agent = mrcp_session->signaling_agent->obj;
- rtsp_message_t *request;
-
- if(!descriptor) {
- return FALSE;
- }
- request = rtsp_resource_discovery_request_generate(
- descriptor->resource_name.buf,
- session->rtsp_settings->resource_map,
- mrcp_session->pool);
- if(request) {
- rtsp_client_session_request(agent->rtsp_client,session->rtsp_session,request);
- }
- return TRUE;
-}
-
-static apt_bool_t mrcp_unirtsp_on_resource_discover(mrcp_unirtsp_agent_t *agent, mrcp_unirtsp_session_t *session, rtsp_message_t *request, rtsp_message_t *response)
-{
- mrcp_session_descriptor_t *descriptor;
- if(!session) {
- return FALSE;
- }
-
- descriptor = mrcp_resource_discovery_response_generate(
- request,
- response,
- session->rtsp_settings->resource_map,
- session->mrcp_session->pool,
- session->home);
- if(descriptor) {
- mrcp_session_discover_response(session->mrcp_session,descriptor);
- }
- return TRUE;
-}
+++ /dev/null
-/*
- * 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_unirtsp_sdp.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include <stdlib.h>
-#include <apr_general.h>
-#include <sofia-sip/sdp.h>
-#include "rtsp_message.h"
-#include "mrcp_unirtsp_sdp.h"
-#include "mpf_rtp_attribs.h"
-#include "mpf_rtp_pt.h"
-#include "apt_text_stream.h"
-#include "apt_log.h"
-
-/** 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; i<descriptor_arr->nelts; 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");
-
- for(i=0; i<descriptor_arr->nelts; 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);
- }
-
- 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_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 descriptor by SDP session */
-static apt_bool_t mrcp_descriptor_generate_by_rtsp_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(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;
- }
- default:
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Not Supported SDP Media [%s]", sdp_media->m_type_name);
- break;
- }
- }
- return TRUE;
-}
-
-/** Generate MRCP descriptor by RTSP request */
-MRCP_DECLARE(mrcp_session_descriptor_t*) mrcp_descriptor_generate_by_rtsp_request(
- const rtsp_message_t *request,
- const char *force_destination_ip,
- const apr_table_t *resource_map,
- apr_pool_t *pool,
- su_home_t *home)
-{
- mrcp_session_descriptor_t *descriptor = NULL;
- const char *resource_name = mrcp_name_get_by_rtsp_name(
- resource_map,
- request->start_line.common.request_line.resource_name);
- if(!resource_name) {
- return NULL;
- }
-
- if(request->start_line.common.request_line.method_id == RTSP_METHOD_SETUP) {
- if(rtsp_header_property_check(&request->header,RTSP_HEADER_FIELD_CONTENT_TYPE) == TRUE &&
- rtsp_header_property_check(&request->header,RTSP_HEADER_FIELD_CONTENT_LENGTH) == TRUE &&
- request->body.buf) {
-
- sdp_parser_t *parser;
- sdp_session_t *sdp;
-
- parser = sdp_parse(home,request->body.buf,request->body.length,0);
- sdp = sdp_session(parser);
- if(sdp) {
- descriptor = mrcp_session_descriptor_create(pool);
- mrcp_descriptor_generate_by_rtsp_sdp_session(descriptor,sdp,force_destination_ip,pool);
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Parse SDP Message");
- }
- sdp_parser_free(parser);
- }
- else {
- /* create default descriptor in case RTSP SETUP contains no SDP */
- mpf_rtp_media_descriptor_t *media;
- descriptor = mrcp_session_descriptor_create(pool);
- media = apr_palloc(pool,sizeof(mpf_rtp_media_descriptor_t));
- mpf_rtp_media_descriptor_init(media);
- media->state = MPF_MEDIA_ENABLED;
- media->id = mrcp_session_audio_media_add(descriptor,media);
- if(rtsp_header_property_check(&request->header,RTSP_HEADER_FIELD_TRANSPORT) == TRUE) {
- media->port = request->header.transport.client_port_range.min;
- media->ip = request->header.transport.destination;
- }
- }
-
- if(descriptor) {
- apt_string_assign(&descriptor->resource_name,resource_name,pool);
- descriptor->resource_state = TRUE;
- }
- }
- else if(request->start_line.common.request_line.method_id == RTSP_METHOD_TEARDOWN) {
- descriptor = mrcp_session_descriptor_create(pool);
- apt_string_assign(&descriptor->resource_name,resource_name,pool);
- descriptor->resource_state = FALSE;
- }
- return descriptor;
-}
-
-/** Generate MRCP descriptor by RTSP response */
-MRCP_DECLARE(mrcp_session_descriptor_t*) mrcp_descriptor_generate_by_rtsp_response(
- const rtsp_message_t *request,
- const rtsp_message_t *response,
- const char *force_destination_ip,
- const apr_table_t *resource_map,
- apr_pool_t *pool,
- su_home_t *home)
-{
- mrcp_session_descriptor_t *descriptor = NULL;
- const char *resource_name = mrcp_name_get_by_rtsp_name(
- resource_map,
- request->start_line.common.request_line.resource_name);
- if(!resource_name) {
- return NULL;
- }
-
- if(request->start_line.common.request_line.method_id == RTSP_METHOD_SETUP) {
- if(rtsp_header_property_check(&response->header,RTSP_HEADER_FIELD_CONTENT_TYPE) == TRUE &&
- rtsp_header_property_check(&response->header,RTSP_HEADER_FIELD_CONTENT_LENGTH) == TRUE &&
- response->body.buf) {
-
- sdp_parser_t *parser;
- sdp_session_t *sdp;
-
- parser = sdp_parse(home,response->body.buf,response->body.length,0);
- sdp = sdp_session(parser);
- if(sdp) {
- descriptor = mrcp_session_descriptor_create(pool);
- mrcp_descriptor_generate_by_rtsp_sdp_session(descriptor,sdp,force_destination_ip,pool);
-
- apt_string_assign(&descriptor->resource_name,resource_name,pool);
- descriptor->resource_state = TRUE;
- descriptor->response_code = response->start_line.common.status_line.status_code;
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Parse SDP Message");
- }
-
- sdp_parser_free(parser);
- }
- else {
- descriptor = mrcp_session_descriptor_create(pool);
- apt_string_assign(&descriptor->resource_name,resource_name,pool);
- descriptor->resource_state = FALSE;
- }
- }
- else if(request->start_line.common.request_line.method_id == RTSP_METHOD_TEARDOWN) {
- descriptor = mrcp_session_descriptor_create(pool);
- apt_string_assign(&descriptor->resource_name,resource_name,pool);
- descriptor->resource_state = FALSE;
- }
- return descriptor;
-}
-
-/** Generate RTSP request by MRCP descriptor */
-MRCP_DECLARE(rtsp_message_t*) rtsp_request_generate_by_mrcp_descriptor(const mrcp_session_descriptor_t *descriptor, const apr_table_t *resource_map, apr_pool_t *pool)
-{
- 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 offset = 0;
- char buffer[2048];
- apr_size_t size = sizeof(buffer);
- rtsp_message_t *request;
- const char *ip = descriptor->ext_ip.buf ? descriptor->ext_ip.buf : (descriptor->ip.buf ? descriptor->ip.buf : "0.0.0.0");
-
- request = rtsp_request_create(pool);
- request->start_line.common.request_line.resource_name = rtsp_name_get_by_mrcp_name(
- resource_map,
- descriptor->resource_name.buf);
- if(descriptor->resource_state != TRUE) {
- request->start_line.common.request_line.method_id = RTSP_METHOD_TEARDOWN;
- return request;
- }
-
- request->start_line.common.request_line.method_id = RTSP_METHOD_SETUP;
-
- 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; i<count; i++) {
- audio_media = mrcp_session_audio_media_get(descriptor,audio_index);
- if(audio_media && audio_media->id == i) {
- /* generate audio media */
- audio_index++;
- offset += sdp_rtp_media_generate(buffer+offset,size-offset,descriptor,audio_media);
- request->header.transport.client_port_range.min = audio_media->port;
- request->header.transport.client_port_range.max = audio_media->port+1;
- 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;
- }
- }
-
- request->header.transport.protocol = RTSP_TRANSPORT_RTP;
- request->header.transport.profile = RTSP_PROFILE_AVP;
- request->header.transport.delivery = RTSP_DELIVERY_UNICAST;
- rtsp_header_property_add(&request->header,RTSP_HEADER_FIELD_TRANSPORT,request->pool);
-
- if(offset) {
- apt_string_assign_n(&request->body,buffer,offset,pool);
- request->header.content_type = RTSP_CONTENT_TYPE_SDP;
- rtsp_header_property_add(&request->header,RTSP_HEADER_FIELD_CONTENT_TYPE,request->pool);
- request->header.content_length = offset;
- rtsp_header_property_add(&request->header,RTSP_HEADER_FIELD_CONTENT_LENGTH,request->pool);
- }
- return request;
-}
-
-/** Generate RTSP response by MRCP descriptor */
-MRCP_DECLARE(rtsp_message_t*) rtsp_response_generate_by_mrcp_descriptor(const rtsp_message_t *request, const mrcp_session_descriptor_t *descriptor, const apr_table_t *resource_map, apr_pool_t *pool)
-{
- rtsp_message_t *response = NULL;
-
- switch(descriptor->status) {
- case MRCP_SESSION_STATUS_OK:
- response = rtsp_response_create(request,RTSP_STATUS_CODE_OK,RTSP_REASON_PHRASE_OK,pool);
- break;
- case MRCP_SESSION_STATUS_NO_SUCH_RESOURCE:
- response = rtsp_response_create(request,RTSP_STATUS_CODE_NOT_FOUND,RTSP_REASON_PHRASE_NOT_FOUND,pool);
- break;
- case MRCP_SESSION_STATUS_UNACCEPTABLE_RESOURCE:
- case MRCP_SESSION_STATUS_UNAVAILABLE_RESOURCE:
- response = rtsp_response_create(request,RTSP_STATUS_CODE_NOT_ACCEPTABLE,RTSP_REASON_PHRASE_NOT_ACCEPTABLE,pool);
- break;
- case MRCP_SESSION_STATUS_ERROR:
- response = rtsp_response_create(request,RTSP_STATUS_CODE_INTERNAL_SERVER_ERROR,RTSP_REASON_PHRASE_INTERNAL_SERVER_ERROR,pool);
- break;
- }
-
- if(!response) {
- return NULL;
- }
-
- if(descriptor->status == MRCP_SESSION_STATUS_OK) {
- 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 offset = 0;
- char buffer[2048];
- apr_size_t size = sizeof(buffer);
- 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; i<count; i++) {
- audio_media = mrcp_session_audio_media_get(descriptor,audio_index);
- if(audio_media && audio_media->id == i) {
- /* generate audio media */
- rtsp_transport_t *transport;
- audio_index++;
- offset += sdp_rtp_media_generate(buffer+offset,size-offset,descriptor,audio_media);
- transport = &response->header.transport;
- transport->server_port_range.min = audio_media->port;
- transport->server_port_range.max = audio_media->port+1;
- transport->client_port_range = request->header.transport.client_port_range;
- 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;
- }
- }
-
- /* ok */
- response->header.transport.protocol = RTSP_TRANSPORT_RTP;
- response->header.transport.profile = RTSP_PROFILE_AVP;
- response->header.transport.delivery = RTSP_DELIVERY_UNICAST;
- rtsp_header_property_add(&response->header,RTSP_HEADER_FIELD_TRANSPORT,response->pool);
-
- if(offset) {
- apt_string_assign_n(&response->body,buffer,offset,pool);
- response->header.content_type = RTSP_CONTENT_TYPE_SDP;
- rtsp_header_property_add(&response->header,RTSP_HEADER_FIELD_CONTENT_TYPE,response->pool);
- response->header.content_length = offset;
- rtsp_header_property_add(&response->header,RTSP_HEADER_FIELD_CONTENT_LENGTH,response->pool);
- }
- }
- return response;
-}
-
-/** Generate RTSP resource discovery request */
-MRCP_DECLARE(rtsp_message_t*) rtsp_resource_discovery_request_generate(
- const char *resource_name,
- const apr_table_t *resource_map,
- apr_pool_t *pool)
-{
- rtsp_message_t *request = rtsp_request_create(pool);
- request->start_line.common.request_line.resource_name = rtsp_name_get_by_mrcp_name(
- resource_map,
- resource_name);
-
- request->start_line.common.request_line.method_id = RTSP_METHOD_DESCRIBE;
- return request;
-}
-
-/** Generate resource discovery descriptor by RTSP response */
-MRCP_DECLARE(mrcp_session_descriptor_t*) mrcp_resource_discovery_response_generate(
- const rtsp_message_t *request,
- const rtsp_message_t *response,
- const apr_table_t *resource_map,
- apr_pool_t *pool,
- su_home_t *home)
-{
- mrcp_session_descriptor_t *descriptor = NULL;
- const char *resource_name = mrcp_name_get_by_rtsp_name(
- resource_map,
- request->start_line.common.request_line.resource_name);
- if(!resource_name) {
- return NULL;
- }
-
- descriptor = mrcp_session_descriptor_create(pool);
- apt_string_assign(&descriptor->resource_name,resource_name,pool);
-
- if(rtsp_header_property_check(&response->header,RTSP_HEADER_FIELD_CONTENT_TYPE) == TRUE &&
- rtsp_header_property_check(&response->header,RTSP_HEADER_FIELD_CONTENT_LENGTH) == TRUE &&
- response->body.buf) {
-
- sdp_parser_t *parser;
- sdp_session_t *sdp;
-
- parser = sdp_parse(home,response->body.buf,response->body.length,0);
- sdp = sdp_session(parser);
- if(sdp) {
- mrcp_descriptor_generate_by_rtsp_sdp_session(descriptor,sdp,0,pool);
- descriptor->resource_state = TRUE;
- descriptor->response_code = response->start_line.common.status_line.status_code;
- }
- else {
- apt_string_assign(&descriptor->resource_name,resource_name,pool);
- descriptor->resource_state = TRUE;
- }
-
- sdp_parser_free(parser);
- }
- else {
- descriptor->resource_state = FALSE;
- }
- return descriptor;
-}
-
-/** Generate RTSP resource discovery response */
-MRCP_DECLARE(rtsp_message_t*) rtsp_resource_discovery_response_generate(
- const rtsp_message_t *request,
- const char *ip,
- const char *origin,
- apr_pool_t *pool)
-{
- rtsp_message_t *response = rtsp_response_create(request,RTSP_STATUS_CODE_OK,RTSP_REASON_PHRASE_OK,pool);
- if(response) {
- apr_size_t offset = 0;
- char buffer[2048];
- apr_size_t size = sizeof(buffer);
-
- 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=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);
-
- if(offset) {
- apt_string_assign_n(&response->body,buffer,offset,pool);
- response->header.content_type = RTSP_CONTENT_TYPE_SDP;
- rtsp_header_property_add(&response->header,RTSP_HEADER_FIELD_CONTENT_TYPE,response->pool);
- response->header.content_length = offset;
- rtsp_header_property_add(&response->header,RTSP_HEADER_FIELD_CONTENT_LENGTH,response->pool);
- }
- }
-
- return response;
-}
-
-/** Get MRCP resource name by RTSP resource name */
-MRCP_DECLARE(const char*) mrcp_name_get_by_rtsp_name(const apr_table_t *resource_map, const char *rtsp_name)
-{
- if(rtsp_name) {
- const apr_array_header_t *header = apr_table_elts(resource_map);
- apr_table_entry_t *entry = (apr_table_entry_t *)header->elts;
- int i;
- for(i=0; i<header->nelts; i++) {
- if(!entry[i].val) continue;
-
- if(strcasecmp(entry[i].val,rtsp_name) == 0) {
- return entry[i].key;
- }
- }
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown RTSP Resource Name [%s]", rtsp_name);
- }
- return "unknown";
-}
-
-/** Get RTSP resource name by MRCP resource name */
-MRCP_DECLARE(const char*) rtsp_name_get_by_mrcp_name(const apr_table_t *resource_map, const char *mrcp_name)
-{
- const char *rtsp_name = apr_table_get(resource_map,mrcp_name);
- if(rtsp_name) {
- return rtsp_name;
- }
- return mrcp_name;
-}
+++ /dev/null
-/*
- * 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_unirtsp_server_agent.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include <apr_general.h>
-#include <sofia-sip/sdp.h>
-
-#include "mrcp_unirtsp_server_agent.h"
-#include "mrcp_session.h"
-#include "mrcp_session_descriptor.h"
-#include "mrcp_message.h"
-#include "mrcp_resource_factory.h"
-#include "mrcp_stream.h"
-#include "rtsp_server.h"
-#include "mrcp_unirtsp_sdp.h"
-#include "apt_consumer_task.h"
-#include "apt_log.h"
-
-typedef struct mrcp_unirtsp_agent_t mrcp_unirtsp_agent_t;
-typedef struct mrcp_unirtsp_session_t mrcp_unirtsp_session_t;
-
-struct mrcp_unirtsp_agent_t {
- mrcp_sig_agent_t *sig_agent;
- rtsp_server_t *rtsp_server;
-
- rtsp_server_config_t *config;
-};
-
-struct mrcp_unirtsp_session_t {
- mrcp_session_t *mrcp_session;
- rtsp_server_session_t *rtsp_session;
- su_home_t *home;
-};
-
-
-static apt_bool_t mrcp_unirtsp_on_session_answer(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor);
-static apt_bool_t mrcp_unirtsp_on_session_terminate(mrcp_session_t *session);
-static apt_bool_t mrcp_unirtsp_on_session_control(mrcp_session_t *session, mrcp_message_t *message);
-
-static const mrcp_session_response_vtable_t session_response_vtable = {
- mrcp_unirtsp_on_session_answer,
- mrcp_unirtsp_on_session_terminate,
- mrcp_unirtsp_on_session_control,
- NULL /* mrcp_unirtsp_on_session_discover */
-};
-
-static apt_bool_t mrcp_unirtsp_session_create(rtsp_server_t *server, rtsp_server_session_t *session);
-static apt_bool_t mrcp_unirtsp_session_terminate(rtsp_server_t *server, rtsp_server_session_t *session);
-static apt_bool_t mrcp_unirtsp_message_handle(rtsp_server_t *server, rtsp_server_session_t *session, rtsp_message_t *message);
-
-static const rtsp_server_vtable_t session_request_vtable = {
- mrcp_unirtsp_session_create,
- mrcp_unirtsp_session_terminate,
- mrcp_unirtsp_message_handle
-};
-
-
-static apt_bool_t rtsp_config_validate(mrcp_unirtsp_agent_t *agent, rtsp_server_config_t *config, apr_pool_t *pool);
-
-
-/** Create UniRTSP Signaling Agent */
-MRCP_DECLARE(mrcp_sig_agent_t*) mrcp_unirtsp_server_agent_create(const char *id, rtsp_server_config_t *config, apr_pool_t *pool)
-{
- apt_task_t *task;
- mrcp_unirtsp_agent_t *agent;
- agent = apr_palloc(pool,sizeof(mrcp_unirtsp_agent_t));
- agent->sig_agent = mrcp_signaling_agent_create(id,agent,pool);
- agent->config = config;
-
- if(rtsp_config_validate(agent,config,pool) == FALSE) {
- return NULL;
- }
-
- agent->rtsp_server = rtsp_server_create(
- id,
- config->local_ip,
- config->local_port,
- config->max_connection_count,
- agent,
- &session_request_vtable,
- pool);
- if(!agent->rtsp_server) {
- return NULL;
- }
-
- task = rtsp_server_task_get(agent->rtsp_server);
- agent->sig_agent->task = task;
-
- return agent->sig_agent;
-}
-
-/** Allocate UniRTSP config */
-MRCP_DECLARE(rtsp_server_config_t*) mrcp_unirtsp_server_config_alloc(apr_pool_t *pool)
-{
- rtsp_server_config_t *config = apr_palloc(pool,sizeof(rtsp_server_config_t));
- config->local_ip = NULL;
- config->local_port = 0;
- config->origin = NULL;
- config->resource_location = NULL;
- config->resource_map = apr_table_make(pool,2);
- config->max_connection_count = 100;
- config->force_destination = FALSE;
- return config;
-}
-
-
-static apt_bool_t rtsp_config_validate(mrcp_unirtsp_agent_t *agent, rtsp_server_config_t *config, apr_pool_t *pool)
-{
- if(!config->local_ip) {
- return FALSE;
- }
- agent->config = config;
- return TRUE;
-}
-
-static APR_INLINE mrcp_unirtsp_agent_t* server_agent_get(apt_task_t *task)
-{
- apt_consumer_task_t *consumer_task = apt_task_object_get(task);
- mrcp_unirtsp_agent_t *agent = apt_consumer_task_object_get(consumer_task);
- return agent;
-}
-
-static apt_bool_t mrcp_unirtsp_session_create(rtsp_server_t *rtsp_server, rtsp_server_session_t *rtsp_session)
-{
- mrcp_unirtsp_agent_t *agent = rtsp_server_object_get(rtsp_server);
- const apt_str_t *session_id;
- mrcp_unirtsp_session_t *session;
- mrcp_session_t* mrcp_session = agent->sig_agent->create_server_session(agent->sig_agent);
- if(!mrcp_session) {
- return FALSE;
- }
- session_id = rtsp_server_session_id_get(rtsp_session);
- if(session_id) {
- mrcp_session->id = *session_id;
- }
- mrcp_session->response_vtable = &session_response_vtable;
- mrcp_session->event_vtable = NULL;
-
- session = apr_palloc(mrcp_session->pool,sizeof(mrcp_unirtsp_session_t));
- session->mrcp_session = mrcp_session;
- mrcp_session->obj = session;
-
- session->home = su_home_new(sizeof(*session->home));
-
- rtsp_server_session_object_set(rtsp_session,session);
- session->rtsp_session = rtsp_session;
- return TRUE;
-}
-
-static apt_bool_t mrcp_unirtsp_session_terminate(rtsp_server_t *rtsp_server, rtsp_server_session_t *rtsp_session)
-{
- mrcp_unirtsp_session_t *session = rtsp_server_session_object_get(rtsp_session);
- if(!session) {
- return FALSE;
- }
- return mrcp_session_terminate_request(session->mrcp_session);
-}
-
-static void mrcp_unirtsp_session_destroy(mrcp_unirtsp_session_t *session)
-{
- if(session->home) {
- su_home_unref(session->home);
- session->home = NULL;
- }
- rtsp_server_session_object_set(session->rtsp_session,NULL);
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Destroy Session "APT_SID_FMT,MRCP_SESSION_SID(session->mrcp_session));
- mrcp_session_destroy(session->mrcp_session);
-}
-
-static apt_bool_t mrcp_unirtsp_session_announce(mrcp_unirtsp_agent_t *agent, mrcp_unirtsp_session_t *session, rtsp_message_t *message)
-{
- const char *resource_name = mrcp_name_get_by_rtsp_name(
- agent->config->resource_map,
- message->start_line.common.request_line.resource_name);
- apt_bool_t status = TRUE;
-
- if(session && resource_name &&
- rtsp_header_property_check(&message->header,RTSP_HEADER_FIELD_CONTENT_TYPE) == TRUE &&
- message->header.content_type == RTSP_CONTENT_TYPE_MRCP &&
- rtsp_header_property_check(&message->header,RTSP_HEADER_FIELD_CONTENT_LENGTH) == TRUE &&
- message->header.content_length > 0) {
-
- apt_text_stream_t text_stream;
- mrcp_parser_t *parser;
- apt_str_t resource_name_str;
- mrcp_message_t *mrcp_message;
-
- text_stream.text = message->body;
- apt_text_stream_reset(&text_stream);
- apt_string_set(&resource_name_str,resource_name);
-
- parser = mrcp_parser_create(agent->sig_agent->resource_factory,session->mrcp_session->pool);
- mrcp_parser_resource_set(parser,&resource_name_str);
- if(mrcp_parser_run(parser,&text_stream,&mrcp_message) == APT_MESSAGE_STATUS_COMPLETE) {
- mrcp_message->channel_id.session_id = message->header.session_id;
- status = mrcp_session_control_request(session->mrcp_session,mrcp_message);
- }
- else {
- /* error response */
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Parse MRCPv1 Message");
- status = FALSE;
- }
- }
- else {
- /* error response */
- status = FALSE;
- }
- return status;
-}
-
-static apt_bool_t mrcp_unirtsp_message_handle(rtsp_server_t *rtsp_server, rtsp_server_session_t *rtsp_session, rtsp_message_t *rtsp_message)
-{
- apt_bool_t status = FALSE;
- mrcp_unirtsp_agent_t *agent = rtsp_server_object_get(rtsp_server);
- mrcp_unirtsp_session_t *session = rtsp_server_session_object_get(rtsp_session);
- if(!session) {
- return FALSE;
- }
-
- switch(rtsp_message->start_line.common.request_line.method_id) {
- case RTSP_METHOD_SETUP:
- case RTSP_METHOD_TEARDOWN:
- {
- const char *force_destination_ip = NULL;
- mrcp_session_descriptor_t *descriptor;
-
- if(agent->config->force_destination == TRUE) {
- force_destination_ip = rtsp_server_session_destination_get(rtsp_session);
- }
- descriptor = mrcp_descriptor_generate_by_rtsp_request(
- rtsp_message,
- force_destination_ip,
- agent->config->resource_map,
- session->mrcp_session->pool,
- session->home);
- if(!descriptor) {
- rtsp_message_t *response = rtsp_response_create(rtsp_message,
- RTSP_STATUS_CODE_BAD_REQUEST,
- RTSP_REASON_PHRASE_BAD_REQUEST,
- rtsp_message->pool);
- status = rtsp_server_session_respond(rtsp_server,session->rtsp_session,response);
- break;
- }
- status = mrcp_session_offer(session->mrcp_session,descriptor);
- break;
- }
- case RTSP_METHOD_ANNOUNCE:
- {
- status = mrcp_unirtsp_session_announce(agent,session,rtsp_message);
- break;
- }
- case RTSP_METHOD_DESCRIBE:
- {
- rtsp_message_t *response = rtsp_resource_discovery_response_generate(
- rtsp_message,
- agent->config->local_ip,
- agent->config->origin,
- session->mrcp_session->pool);
- status = rtsp_server_session_respond(rtsp_server,session->rtsp_session,response);
- break;
- }
- default:
- break;
- }
-
- return status;
-}
-
-static apt_bool_t mrcp_unirtsp_on_session_answer(mrcp_session_t *mrcp_session, mrcp_session_descriptor_t *descriptor)
-{
- mrcp_unirtsp_session_t *session = mrcp_session->obj;
- mrcp_unirtsp_agent_t *agent = mrcp_session->signaling_agent->obj;
- rtsp_message_t *response = NULL;
- const rtsp_message_t *request = rtsp_server_session_request_get(session->rtsp_session);
- if(!request) {
- return FALSE;
- }
-
- if(request->start_line.common.request_line.method_id == RTSP_METHOD_SETUP) {
- if(agent->config->origin) {
- apt_string_set(&descriptor->origin,agent->config->origin);
- }
-
- response = rtsp_response_generate_by_mrcp_descriptor(
- request,
- descriptor,
- agent->config->resource_map,
- mrcp_session->pool);
- }
- else if(request->start_line.common.request_line.method_id == RTSP_METHOD_TEARDOWN) {
- response = rtsp_response_create(request,RTSP_STATUS_CODE_OK,RTSP_REASON_PHRASE_OK,mrcp_session->pool);
- }
-
- if(!response) {
- return FALSE;
- }
- rtsp_server_session_respond(agent->rtsp_server,session->rtsp_session,response);
- return TRUE;
-}
-
-static apt_bool_t mrcp_unirtsp_on_session_terminate(mrcp_session_t *mrcp_session)
-{
- mrcp_unirtsp_session_t *session = mrcp_session->obj;
- rtsp_server_session_t *rtsp_session = session->rtsp_session;
- mrcp_unirtsp_agent_t *agent = mrcp_session->signaling_agent->obj;
-
- mrcp_unirtsp_session_destroy(session);
- rtsp_server_session_terminate(agent->rtsp_server,rtsp_session);
- return TRUE;
-}
-
-static apt_bool_t mrcp_unirtsp_on_session_control(mrcp_session_t *mrcp_session, mrcp_message_t *mrcp_message)
-{
- mrcp_unirtsp_session_t *session = mrcp_session->obj;
- mrcp_unirtsp_agent_t *agent = mrcp_session->signaling_agent->obj;
-
- char buffer[2000];
- apt_text_stream_t stream;
- rtsp_message_t *rtsp_message = NULL;
- apt_str_t *body;
-
- apt_text_stream_init(&stream,buffer,sizeof(buffer));
-
- mrcp_message->start_line.version = MRCP_VERSION_1;
- if(mrcp_message_generate(agent->sig_agent->resource_factory,mrcp_message,&stream) != TRUE) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Generate MRCPv1 Message");
- return FALSE;
- }
- stream.text.length = stream.pos - stream.text.buf;
-
- if(mrcp_message->start_line.message_type == MRCP_MESSAGE_TYPE_RESPONSE) {
- /* send RTSP response (OK) */
- const rtsp_message_t *request = rtsp_server_session_request_get(session->rtsp_session);
- if(request) {
- rtsp_message = rtsp_response_create(request,RTSP_STATUS_CODE_OK,RTSP_REASON_PHRASE_OK,mrcp_session->pool);
- }
- }
- else if(mrcp_message->start_line.message_type == MRCP_MESSAGE_TYPE_EVENT) {
- /* send RTSP announce */
- rtsp_message = rtsp_request_create(mrcp_session->pool);
- rtsp_message->start_line.common.request_line.resource_name = rtsp_name_get_by_mrcp_name(
- agent->config->resource_map,
- mrcp_message->channel_id.resource_name.buf);
- rtsp_message->start_line.common.request_line.method_id = RTSP_METHOD_ANNOUNCE;
- }
-
- if(!rtsp_message) {
- return FALSE;
- }
-
- body = &rtsp_message->body;
- body->length = mrcp_message->start_line.length;
- body->buf = apr_palloc(rtsp_message->pool,body->length+1);
- memcpy(body->buf,stream.text.buf,stream.text.length);
- if(mrcp_message->body.length) {
- memcpy(body->buf+stream.text.length,mrcp_message->body.buf,mrcp_message->body.length);
- }
- body->buf[body->length] = '\0';
-
- rtsp_message->header.content_type = RTSP_CONTENT_TYPE_MRCP;
- rtsp_header_property_add(&rtsp_message->header,RTSP_HEADER_FIELD_CONTENT_TYPE,rtsp_message->pool);
- rtsp_message->header.content_length = body->length;
- rtsp_header_property_add(&rtsp_message->header,RTSP_HEADER_FIELD_CONTENT_LENGTH,rtsp_message->pool);
-
- rtsp_server_session_respond(agent->rtsp_server,session->rtsp_session,rtsp_message);
- return TRUE;
-}
+++ /dev/null
-#include "setup.txt"
-#define release_dir "Release"
-OutputBaseFilename=unimrcp-sdk-{#= uni_version}
+++ /dev/null
-#include "setup.txt"
-#define release_dir "x64\Release"
-OutputBaseFilename=unimrcp-x64-sdk-{#= uni_version}
-ArchitecturesInstallIn64BitMode=x64
+++ /dev/null
-#include "setup.txt"
-#define uni_outdir "..\..\Release"
-OutputBaseFilename=unimrcp-{#= uni_version}
+++ /dev/null
-#include "setup.txt"
-#define uni_outdir "..\..\x64\Release"
-OutputBaseFilename=unimrcp-x64-{#= uni_version}
-ArchitecturesInstallIn64BitMode=x64
-ArchitecturesAllowed=x64
+++ /dev/null
-#define uni_version "1.2.0"
-#define uni_src "..\.."
-
-AppName=UniMRCP
-AppVerName=UniMRCP {#= uni_version}
-AppPublisher=UniMRCP
-AppPublisherURL=http://www.unimrcp.org/
-AppSupportURL=http://groups.google.com/group/unimrcp
-AppUpdatesURL=http://code.google.com/p/unimrcp/downloads/list
-DefaultDirName={pf}\UniMRCP
-DefaultGroupName=UniMRCP
-Compression=lzma
-InternalCompressLevel=max
-SolidCompression=true
+++ /dev/null
-[Setup]
-; include either setup-sdk-win32.txt or setup-sdk-x64.txt
-#include "setup-sdk-win32.txt"
-;#include "setup-sdk-x64.txt"
-
-[Types]
-Name: full; Description: Full installation
-Name: sdk; Description: SDK installation
-Name: docs; Description: Documentation installation
-Name: custom; Description: Custom installation; Flags: iscustom
-
-[Components]
-Name: sdk; Description: UniMRCP SDK (client, server and plugin development); Types: full sdk
-Name: docs; Description: UniMRCP documentation; Types: full docs
-Name: docs\design; Description: Design concepts; Types: full docs
-Name: docs\api; Description: API reference; Types: full docs
-
-[Files]
-Source: {#= uni_src}\libs\apr\include\*.h; DestDir: {app}\include; Components: sdk
-Source: {#= uni_src}\libs\apr-toolkit\include\*.h; DestDir: {app}\include; Components: sdk
-Source: {#= uni_src}\libs\mpf\include\*.h; DestDir: {app}\include; Components: sdk
-Source: {#= uni_src}\libs\mrcp\include\*.h; DestDir: {app}\include; Components: sdk
-Source: {#= uni_src}\libs\mrcp\message\include\*.h; DestDir: {app}\include; Components: sdk
-Source: {#= uni_src}\libs\mrcp\control\include\*.h; DestDir: {app}\include; Components: sdk
-Source: {#= uni_src}\libs\mrcp\resources\include\*.h; DestDir: {app}\include; Components: sdk
-Source: {#= uni_src}\libs\mrcp-engine\include\*.h; DestDir: {app}\include; Components: sdk
-Source: {#= uni_src}\libs\mrcp-signaling\include\*.h; DestDir: {app}\include; Components: sdk
-Source: {#= uni_src}\libs\mrcpv2-transport\include\*.h; DestDir: {app}\include; Components: sdk
-Source: {#= uni_src}\libs\mrcp-client\include\*.h; DestDir: {app}\include; Components: sdk
-Source: {#= uni_src}\libs\mrcp-server\include\*.h; DestDir: {app}\include; Components: sdk
-Source: {#= uni_src}\platforms\libunimrcp-client\include\*.h; DestDir: {app}\include; Components: sdk
-Source: {#= uni_src}\platforms\libunimrcp-server\include\*.h; DestDir: {app}\include; Components: sdk
-Source: {#= uni_src}\{#= release_dir}\lib\*.lib; DestDir: {app}\lib; Components: sdk
-Source: {#= uni_src}\libs\apr\{#= release_dir}\*.lib; DestDir: {app}\lib; Components: sdk
-Source: {#= uni_src}\libs\apr-util\{#= release_dir}\*.lib; DestDir: {app}\lib; Components: sdk
-Source: {#= uni_src}\libs\sofia-sip\win32\libsofia-sip-ua\{#= release_dir}\*.lib; DestDir: {app}\lib; Components: sdk
-Source: {#= uni_src}\build\*.h; DestDir: {app}\include; Components: sdk
-Source: {#= uni_src}\build\props\sdk\*.props; DestDir: {app}\props; Components: sdk; AfterInstall: SetProjectPath(ExpandConstant('{app}\props\unimrcpsdk.props'))
-Source: {#= uni_src}\build\vsprops\sdk\*.vsprops; DestDir: {app}\vsprops; Components: sdk; AfterInstall: SetProjectPath(ExpandConstant('{app}\vsprops\unimrcpsdk.vsprops'))
-Source: {#= uni_src}\docs\ea\*; DestDir: {app}\doc\ea; Components: docs/design; Flags: recursesubdirs
-Source: {#= uni_src}\docs\dox\*; DestDir: {app}\doc\dox; Components: docs/api; Flags: recursesubdirs
-
-[Icons]
-Name: {group}\UniMRCP Docs\Design concepts; Filename: {app}\doc\ea\index.htm; Components: docs\design
-Name: {group}\UniMRCP Docs\API; Filename: {app}\doc\dox\html\index.html; Components: docs\api
-Name: {group}\Uninstall; Filename: {uninstallexe}
-
-[Code]
-procedure SetProjectPath(PropertySheetFile: String);
-var
- Content: String;
-begin
- LoadStringFromFile (PropertySheetFile, Content);
- StringChange (Content, 'C:\Program Files\UniMRCP', ExpandConstant('{app}'));
- SaveStringToFile (PropertySheetFile, Content, False);
-end;
+++ /dev/null
-[Setup]
-; include either setup-win32.txt or setup-x64.txt
-#include "setup-win32.txt"
-;#include "setup-x64.txt"
-
-[Types]
-Name: full; Description: Full installation
-Name: server; Description: Server installation
-Name: client; Description: Client installation
-Name: custom; Description: Custom installation; Flags: iscustom
-
-[Components]
-Name: server; Description: UniMRCP server; Types: full server
-Name: server\recorder; Description: Recorder plugin; Types: full server
-Name: server\demosynth; Description: Demo synthesizer plugin; Types: full server
-Name: server\demorecog; Description: Demo recognizer plugin; Types: full server
-Name: server\demoverifier; Description: Demo verifier plugin; Types: full server
-Name: client; Description: UniMRCP client (sample applications); Types: full client
-
-[Dirs]
-Name: {app}\data; Permissions: everyone-full
-Name: {app}\log; Permissions: everyone-full
-
-[Files]
-Source: {#= uni_outdir}\bin\unimrcpserver.exe; DestDir: {app}\bin; Components: server
-Source: {#= uni_outdir}\bin\unimrcpservice.exe; DestDir: {app}\bin; Components: server
-Source: {#= uni_outdir}\bin\unimrcpclient.exe; DestDir: {app}\bin; Components: client
-Source: {#= uni_outdir}\bin\umc.exe; DestDir: {app}\bin; Components: client
-Source: {#= uni_outdir}\bin\*.dll; DestDir: {app}\bin; Components: server client
-Source: {#= uni_outdir}\plugin\mrcprecorder.dll; DestDir: {app}\plugin; Components: server/recorder
-Source: {#= uni_outdir}\plugin\demosynth.dll; DestDir: {app}\plugin; Components: server/demosynth
-Source: {#= uni_outdir}\plugin\demorecog.dll; DestDir: {app}\plugin; Components: server/demorecog
-Source: {#= uni_outdir}\plugin\demoverifier.dll; DestDir: {app}\plugin; Components: server/demoverifier
-Source: {#= uni_outdir}\conf\unimrcpserver.xml; DestDir: {app}\conf; Components: server
-Source: {#= uni_outdir}\conf\unimrcpclient.xml; DestDir: {app}\conf; Components: client
-Source: {#= uni_outdir}\conf\client-profiles\*.xml; DestDir: {app}\conf\client-profiles; Components: client
-Source: {#= uni_outdir}\conf\umcscenarios.xml; DestDir: {app}\conf; Components: client
-Source: {#= uni_outdir}\data\*.pcm; DestDir: {app}\data; Components: server client
-Source: {#= uni_outdir}\data\*.xml; DestDir: {app}\data; Components: server client
-Source: {#= uni_outdir}\data\*.txt; DestDir: {app}\data; Components: server client
-
-[Icons]
-Name: {group}\UniMRCP Server Console; Filename: {app}\bin\unimrcpserver.exe; Parameters: "--root-dir ""{app}"""; Components: server
-Name: {group}\UniMRCP Client Console; Filename: {app}\bin\unimrcpclient.exe; Parameters: "--root-dir ""{app}"""; Components: client
-Name: {group}\UniMRCP Service\Start Server; Filename: {app}\bin\unimrcpservice.exe; Parameters: --start; Components: server
-Name: {group}\UniMRCP Service\Stop Server; Filename: {app}\bin\unimrcpservice.exe; Parameters: --stop; Components: server
-Name: {group}\Uninstall; Filename: {uninstallexe}
-
-[Run]
-Filename: {app}\bin\unimrcpservice.exe; Description: Register service; Parameters: "--register ""{app}"""; Components: server
-
-[UninstallRun]
-Filename: {app}\bin\unimrcpservice.exe; Parameters: --unregister; Components: server
-
-[Code]
-var
- Content: String;
-
-procedure ModifyPluginConf(PluginName: String; Enable: Boolean);
-var
- TextFrom: String;
- TextTo: String;
-begin
- if Enable = True then
- begin
- TextFrom := 'class="' + PluginName + '" enable="0"';
- TextTo := 'class="' + PluginName + '" enable="1"';
- end
- else
- begin
- TextFrom := 'class="' + PluginName + '" enable="1"';
- TextTo := 'class="' + PluginName + '" enable="0"';
- end
- StringChange (Content, TextFrom, TextTo);
-end;
-
-procedure CurStepChanged(CurStep: TSetupStep);
-var
- CfgFile: String;
-begin
- if CurStep = ssPostInstall then
- begin
- CfgFile := ExpandConstant('{app}\conf\unimrcpserver.xml');
- LoadStringFromFile (CfgFile, Content);
- ModifyPluginConf ('mrcprecorder', IsComponentSelected('server\recorder'));
- ModifyPluginConf ('demosynth', IsComponentSelected('server\demosynth'));
- ModifyPluginConf ('demorecog', IsComponentSelected('server\demorecog'));
- ModifyPluginConf ('demoverifier', IsComponentSelected('server\demoverifier'));
- SaveStringToFile (CfgFile, Content, False);
- end
-end;
+++ /dev/null
-MAINTAINERCLEANFILES = Makefile.in
-
-SUBDIRS =
-
-if UNIMRCP_CLIENT_LIB
-SUBDIRS += libunimrcp-client
-endif
-
-if UNIMRCP_CLIENT_APP
-SUBDIRS += unimrcp-client
-endif
-
-if UMC
-SUBDIRS += umc
-endif
-
-if ASR_CLIENT
-SUBDIRS += libasr-client asr-client
-endif
-
-if UNIMRCP_SERVER_LIB
-SUBDIRS += libunimrcp-server
-endif
-
-if UNIMRCP_SERVER_APP
-SUBDIRS += unimrcp-server
-endif
+++ /dev/null
-AM_CPPFLAGS = -I$(top_srcdir)/platforms/libasr-client/include \
- $(UNIMRCP_CLIENTAPP_INCLUDES)
-
-bin_PROGRAMS = asrclient
-
-asrclient_SOURCES = src/main.c
-asrclient_LDADD = $(top_builddir)/platforms/libasr-client/libasrclient.la
-asrclient_LDFLAGS = $(UNIMRCP_CLIENTAPP_OPTS)
-
-include $(top_srcdir)/build/rules/uniclientapp.am
+++ /dev/null
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="asrclient"
- ProjectGUID="{6B83AC6D-01CE-4E1C-81CE-02AD8116C684}"
- RootNamespace="asrclient"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- <Platform
- Name="x64"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- ConfigurationType="1"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unibin.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpclient.vsprops"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="include;"..\libasr-client\include""
- RuntimeLibrary="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libasrclient.lib libapr-1.lib"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- ConfigurationType="1"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unibin.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpclient.vsprops"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="include;"..\libasr-client\include""
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libasrclient.lib libapr-1.lib"
- LinkTimeCodeGeneration="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|x64"
- ConfigurationType="1"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unibin-x64.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpclient.vsprops"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="include;"..\libasr-client\include""
- RuntimeLibrary="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libasrclient.lib libapr-1.lib"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|x64"
- ConfigurationType="1"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unibin-x64.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpclient.vsprops"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="include;"..\libasr-client\include""
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="libasrclient.lib libapr-1.lib"
- LinkTimeCodeGeneration="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="src"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath=".\src\main.c"
- >
- </File>
- </Filter>
- <Filter
- Name="include"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{6B83AC6D-01CE-4E1C-81CE-02AD8116C684}</ProjectGuid>
- <RootNamespace>asrclient</RootNamespace>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unibin.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unimrcpclient.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" />
- <Import Project="$(ProjectDir)..\..\build\props\unibin.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unimrcpclient.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unibin-x64.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unimrcpclient.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" />
- <Import Project="$(ProjectDir)..\..\build\props\unibin-x64.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unimrcpclient.props" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <AdditionalIncludeDirectories>include;..\libasr-client\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
- </ClCompile>
- <Link>
- <AdditionalDependencies>libasrclient.lib;libapr-1.lib;%(AdditionalDependencies)</AdditionalDependencies>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <AdditionalIncludeDirectories>include;..\libasr-client\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- </ClCompile>
- <Link>
- <AdditionalDependencies>libasrclient.lib;libapr-1.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <AdditionalIncludeDirectories>include;..\libasr-client\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- <Link>
- <AdditionalDependencies>libasrclient.lib;libapr-1.lib;%(AdditionalDependencies)</AdditionalDependencies>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <AdditionalIncludeDirectories>include;..\libasr-client\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- </ClCompile>
- <Link>
- <AdditionalDependencies>libasrclient.lib;libapr-1.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
- </Link>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="src\main.c" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\libasr-client\libasrclient.vcxproj">
- <Project>{272fafa8-2b2f-4716-b95f-3b37cf2e0cb3}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="src">
- <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
- </Filter>
- <Filter Include="include">
- <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="src\main.c">
- <Filter>src</Filter>
- </ClCompile>
- </ItemGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-/*
- * 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: main.c 2213 2014-11-06 03:02:45Z achaloyan@gmail.com $
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <apr_getopt.h>
-#include <apr_file_info.h>
-#include <apr_thread_proc.h>
-#include "asr_engine.h"
-
-typedef struct {
- const char *root_dir_path;
- apt_log_priority_e log_priority;
- apt_log_output_e log_output;
- apr_pool_t *pool;
-} client_options_t;
-
-typedef struct {
- asr_engine_t *engine;
- const char *grammar_file;
- const char *input_file;
- const char *profile;
-
- apr_thread_t *thread;
- apr_pool_t *pool;
-} asr_params_t;
-
-/** Thread function to run ASR scenario in */
-static void* APR_THREAD_FUNC asr_session_run(apr_thread_t *thread, void *data)
-{
- asr_params_t *params = data;
- asr_session_t *session = asr_session_create(params->engine,params->profile);
- if(session) {
- const char *result = asr_session_file_recognize(session,params->grammar_file,params->input_file);
- if(result) {
- printf("Recog Result [%s]",result);
- }
-
- asr_session_destroy(session);
- }
-
- /* destroy pool params allocated from */
- apr_pool_destroy(params->pool);
- return NULL;
-}
-
-/** Launch demo ASR session */
-static apt_bool_t asr_session_launch(asr_engine_t *engine, const char *grammar_file, const char *input_file, const char *profile)
-{
- apr_pool_t *pool;
- asr_params_t *params;
-
- /* create pool to allocate params from */
- apr_pool_create(&pool,NULL);
- params = apr_palloc(pool,sizeof(asr_params_t));
- params->pool = pool;
- params->engine = engine;
-
- if(grammar_file) {
- params->grammar_file = apr_pstrdup(pool,grammar_file);
- }
- else {
- params->grammar_file = "grammar.xml";
- }
-
- if(input_file) {
- params->input_file = apr_pstrdup(pool,input_file);
- }
- else {
- params->input_file = "one-8kHz.pcm";
- }
-
- if(profile) {
- params->profile = apr_pstrdup(pool,profile);
- }
- else {
- params->profile = "uni2";
- }
-
- /* Launch a thread to run demo ASR session in */
- if(apr_thread_create(¶ms->thread,NULL,asr_session_run,params,pool) != APR_SUCCESS) {
- apr_pool_destroy(pool);
- return FALSE;
- }
-
- return TRUE;
-}
-
-static apt_bool_t cmdline_process(asr_engine_t *engine, char *cmdline)
-{
- apt_bool_t running = TRUE;
- char *name;
- char *last;
- name = apr_strtok(cmdline, " ", &last);
-
- if(strcasecmp(name,"run") == 0) {
- char *grammar = apr_strtok(NULL, " ", &last);
- char *input = apr_strtok(NULL, " ", &last);
- char *profile = apr_strtok(NULL, " ", &last);
- asr_session_launch(engine,grammar,input,profile);
- }
- else if(strcasecmp(name,"loglevel") == 0) {
- char *priority = apr_strtok(NULL, " ", &last);
- if(priority) {
- asr_engine_log_priority_set(atol(priority));
- }
- }
- else if(strcasecmp(name,"exit") == 0 || strcmp(name,"quit") == 0) {
- running = FALSE;
- }
- else if(strcasecmp(name,"help") == 0) {
- printf("usage:\n"
- "\n- run [grammar_file] [audio_input_file] [profile_name] (run demo asr client)\n"
- " grammar_file is the name of grammar file, (path is relative to data dir)\n"
- " audio_input_file is the name of audio file, (path is relative to data dir)\n"
- " profile_name is one of 'uni2', 'uni1', ...\n"
- "\n examples: \n"
- " run\n"
- " run grammar.xml one.pcm\n"
- " run grammar.xml one.pcm uni1\n"
- "\n- loglevel [level] (set loglevel, one of 0,1...7)\n"
- "\n- quit, exit\n");
- }
- else {
- printf("unknown command: %s (input help for usage)\n",name);
- }
- return running;
-}
-
-static apt_bool_t cmdline_run(asr_engine_t *engine)
-{
- apt_bool_t running = TRUE;
- char cmdline[1024];
- apr_size_t i;
- do {
- printf(">");
- memset(&cmdline, 0, sizeof(cmdline));
- for(i = 0; i < sizeof(cmdline); i++) {
- cmdline[i] = (char) getchar();
- if(cmdline[i] == '\n') {
- cmdline[i] = '\0';
- break;
- }
- }
- if(*cmdline) {
- running = cmdline_process(engine,cmdline);
- }
- }
- while(running != 0);
- return TRUE;
-}
-
-static void usage(void)
-{
- printf(
- "\n"
- "Usage:\n"
- "\n"
- " asrclient [options]\n"
- "\n"
- " Available options:\n"
- "\n"
- " -r [--root-dir] path : Set the project root directory path.\n"
- "\n"
- " -l [--log-prio] priority : Set the log priority.\n"
- " (0-emergency, ..., 7-debug)\n"
- "\n"
- " -o [--log-output] mode : Set the log output mode.\n"
- " (0-none, 1-console only, 2-file only, 3-both)\n"
- "\n"
- " -h [--help] : Show the help.\n"
- "\n");
-}
-
-static void options_destroy(client_options_t *options)
-{
- if(options->pool) {
- apr_pool_destroy(options->pool);
- }
-}
-
-static client_options_t* options_load(int argc, const char * const *argv)
-{
- apr_status_t rv;
- apr_getopt_t *opt = NULL;
- int optch;
- const char *optarg;
- apr_pool_t *pool;
- client_options_t *options;
-
- const apr_getopt_option_t opt_option[] = {
- /* long-option, short-option, has-arg flag, description */
- { "root-dir", 'r', TRUE, "path to root dir" }, /* -r arg or --root-dir arg */
- { "log-prio", 'l', TRUE, "log priority" }, /* -l arg or --log-prio arg */
- { "log-output", 'o', TRUE, "log output mode" }, /* -o arg or --log-output arg */
- { "help", 'h', FALSE, "show help" }, /* -h or --help */
- { NULL, 0, 0, NULL }, /* end */
- };
-
- /* create APR pool to allocate options from */
- apr_pool_create(&pool,NULL);
- if(!pool) {
- return NULL;
- }
- options = apr_palloc(pool,sizeof(client_options_t));
- options->pool = pool;
- /* set the default options */
- options->root_dir_path = NULL;
- options->log_priority = APT_PRIO_INFO;
- options->log_output = APT_LOG_OUTPUT_CONSOLE;
-
-
- rv = apr_getopt_init(&opt, pool , argc, argv);
- if(rv != APR_SUCCESS) {
- options_destroy(options);
- return NULL;
- }
-
- while((rv = apr_getopt_long(opt, opt_option, &optch, &optarg)) == APR_SUCCESS) {
- switch(optch) {
- case 'r':
- options->root_dir_path = optarg;
- break;
- case 'l':
- if(optarg) {
- options->log_priority = atoi(optarg);
- }
- break;
- case 'o':
- if(optarg) {
- options->log_output = atoi(optarg);
- }
- break;
- case 'h':
- usage();
- return FALSE;
- }
- }
-
- if(rv != APR_EOF) {
- usage();
- options_destroy(options);
- return NULL;
- }
-
- return options;
-}
-
-int main(int argc, const char * const *argv)
-{
- client_options_t *options;
- asr_engine_t *engine;
-
- /* APR global initialization */
- if(apr_initialize() != APR_SUCCESS) {
- apr_terminate();
- return 0;
- }
-
- /* load options */
- options = options_load(argc,argv);
- if(!options) {
- apr_terminate();
- return 0;
- }
-
- /* create asr engine */
- engine = asr_engine_create(
- options->root_dir_path,
- options->log_priority,
- options->log_output);
- if(engine) {
- /* run command line */
- cmdline_run(engine);
- /* destroy demo framework */
- asr_engine_destroy(engine);
- }
-
- /* destroy options */
- options_destroy(options);
-
- /* APR global termination */
- apr_terminate();
- return 0;
-}
+++ /dev/null
-AM_CPPFLAGS = -I$(top_srcdir)/platforms/libasr-client/include \
- -I$(top_srcdir)/platforms/libunimrcp-client/include \
- $(UNIMRCP_CLIENTLIB_INCLUDES)
-
-lib_LTLIBRARIES = libasrclient.la
-
-include_HEADERS = include/asr_engine.h
-libasrclient_la_SOURCES = src/asr_engine.c
-libasrclient_la_LIBADD = $(top_builddir)/platforms/libunimrcp-client/libunimrcpclient.la
-libasrclient_la_LDFLAGS = $(UNIMRCP_CLIENTLIB_OPTS)
-
-include $(top_srcdir)/build/rules/uniclientlib.am
+++ /dev/null
-/*
- * Copyright 2009-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: asr_engine.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef ASR_ENGINE_H
-#define ASR_ENGINE_H
-
-/**
- * @file asr_engine.h
- * @brief Basic ASR engine on top of UniMRCP client library
- */
-
-#include "apt_log.h"
-
-/** Lib export/import defines (win32) */
-#ifdef WIN32
-#ifdef ASR_CLIENT_STATIC_LIB
-#define ASR_CLIENT_DECLARE(type) type __stdcall
-#else
-#ifdef ASR_CLIENT_LIB_EXPORT
-#define ASR_CLIENT_DECLARE(type) __declspec(dllexport) type __stdcall
-#else
-#define ASR_CLIENT_DECLARE(type) __declspec(dllimport) type __stdcall
-#endif
-#endif
-#else
-#define ASR_CLIENT_DECLARE(type) type
-#endif
-
-APT_BEGIN_EXTERN_C
-
-/** Opaque ASR engine */
-typedef struct asr_engine_t asr_engine_t;
-
-/** Opaque ASR session */
-typedef struct asr_session_t asr_session_t;
-
-
-/**
- * Create ASR engine.
- * @param root_dir_path the path to root directory
- * @param log_priority the log priority level
- * @param log_output the log output mode
- */
-ASR_CLIENT_DECLARE(asr_engine_t*) asr_engine_create(
- const char *root_dir_path,
- apt_log_priority_e log_priority,
- apt_log_output_e log_output);
-
-/**
- * Destroy ASR engine.
- * @param engine the engine to destroy
- */
-ASR_CLIENT_DECLARE(apt_bool_t) asr_engine_destroy(asr_engine_t *engine);
-
-
-
-/**
- * Create ASR session.
- * @param engine the engine session belongs to
- * @param profile the name of UniMRCP profile to use
- */
-ASR_CLIENT_DECLARE(asr_session_t*) asr_session_create(asr_engine_t *engine, const char *profile);
-
-/**
- * Initiate recognition based on specified grammar and input file.
- * @param session the session to run recognition in the scope of
- * @param grammar_file the name of the grammar file to use (path is relative to data dir)
- * @param input_file the name of the audio input file to use (path is relative to data dir)
- * @return the recognition result (input element of NLSML content)
- */
-ASR_CLIENT_DECLARE(const char*) asr_session_file_recognize(
- asr_session_t *session,
- const char *grammar_file,
- const char *input_file);
-
-/**
- * Initiate recognition based on specified grammar and input stream.
- * @param session the session to run recognition in the scope of
- * @param grammar_file the name of the grammar file to use (path is relative to data dir)
- * @param callback the callback to be called to get input media frames
- * @param obj the object to pass to the callback
- * @return the recognition result (input element of NLSML content)
- *
- * @remark Audio data should be streamed through
- * asr_session_stream_write() function calls.
- */
-ASR_CLIENT_DECLARE(const char*) asr_session_stream_recognize(
- asr_session_t *session,
- const char *grammar_file);
-
-/**
- * Write audio data to recognize.
- * @param session the session to write audio data for
- * @param data the audio data
- * @param size the size of data
- */
-ASR_CLIENT_DECLARE(apt_bool_t) asr_session_stream_write(
- asr_session_t *session,
- char *data,
- int size);
-
-/**
- * Destroy ASR session.
- * @param session the session to destroy
- */
-ASR_CLIENT_DECLARE(apt_bool_t) asr_session_destroy(asr_session_t *session);
-
-
-/**
- * Set log priority.
- * @param priority the priority to set
- */
-ASR_CLIENT_DECLARE(apt_bool_t) asr_engine_log_priority_set(apt_log_priority_e log_priority);
-
-
-APT_END_EXTERN_C
-
-#endif /* ASR_ENGINE_H */
+++ /dev/null
-<?xml version="1.0" encoding="Windows-1252"?>\r
-<VisualStudioProject\r
- ProjectType="Visual C++"\r
- Version="8.00"\r
- Name="libasrclient"\r
- ProjectGUID="{272FAFA8-2B2F-4716-B95F-3B37CF2E0CB3}"\r
- RootNamespace="libasrclient"\r
- Keyword="Win32Proj"\r
- >\r
- <Platforms>\r
- <Platform\r
- Name="Win32"\r
- />\r
- <Platform\r
- Name="x64"\r
- />\r
- </Platforms>\r
- <ToolFiles>\r
- </ToolFiles>\r
- <Configurations>\r
- <Configuration\r
- Name="Debug|Win32"\r
- ConfigurationType="2"\r
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unibin.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpclient.vsprops"\r
- CharacterSet="1"\r
- >\r
- <Tool\r
- Name="VCPreBuildEventTool"\r
- />\r
- <Tool\r
- Name="VCCustomBuildTool"\r
- />\r
- <Tool\r
- Name="VCXMLDataGeneratorTool"\r
- />\r
- <Tool\r
- Name="VCWebServiceProxyGeneratorTool"\r
- />\r
- <Tool\r
- Name="VCMIDLTool"\r
- />\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories="include"\r
- PreprocessorDefinitions="ASR_CLIENT_LIB_EXPORT"\r
- />\r
- <Tool\r
- Name="VCManagedResourceCompilerTool"\r
- />\r
- <Tool\r
- Name="VCResourceCompilerTool"\r
- />\r
- <Tool\r
- Name="VCPreLinkEventTool"\r
- />\r
- <Tool\r
- Name="VCLinkerTool"\r
- AdditionalDependencies="$(UniMRCPClientLibs)"\r
- />\r
- <Tool\r
- Name="VCALinkTool"\r
- />\r
- <Tool\r
- Name="VCManifestTool"\r
- />\r
- <Tool\r
- Name="VCXDCMakeTool"\r
- />\r
- <Tool\r
- Name="VCBscMakeTool"\r
- />\r
- <Tool\r
- Name="VCFxCopTool"\r
- />\r
- <Tool\r
- Name="VCAppVerifierTool"\r
- />\r
- <Tool\r
- Name="VCWebDeploymentTool"\r
- />\r
- <Tool\r
- Name="VCPostBuildEventTool"\r
- />\r
- </Configuration>\r
- <Configuration\r
- Name="Release|Win32"\r
- ConfigurationType="2"\r
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unibin.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpclient.vsprops"\r
- CharacterSet="1"\r
- WholeProgramOptimization="1"\r
- >\r
- <Tool\r
- Name="VCPreBuildEventTool"\r
- />\r
- <Tool\r
- Name="VCCustomBuildTool"\r
- />\r
- <Tool\r
- Name="VCXMLDataGeneratorTool"\r
- />\r
- <Tool\r
- Name="VCWebServiceProxyGeneratorTool"\r
- />\r
- <Tool\r
- Name="VCMIDLTool"\r
- />\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories="include"\r
- PreprocessorDefinitions="ASR_CLIENT_LIB_EXPORT"\r
- />\r
- <Tool\r
- Name="VCManagedResourceCompilerTool"\r
- />\r
- <Tool\r
- Name="VCResourceCompilerTool"\r
- />\r
- <Tool\r
- Name="VCPreLinkEventTool"\r
- />\r
- <Tool\r
- Name="VCLinkerTool"\r
- AdditionalDependencies="$(UniMRCPClientLibs)"\r
- />\r
- <Tool\r
- Name="VCALinkTool"\r
- />\r
- <Tool\r
- Name="VCManifestTool"\r
- />\r
- <Tool\r
- Name="VCXDCMakeTool"\r
- />\r
- <Tool\r
- Name="VCBscMakeTool"\r
- />\r
- <Tool\r
- Name="VCFxCopTool"\r
- />\r
- <Tool\r
- Name="VCAppVerifierTool"\r
- />\r
- <Tool\r
- Name="VCWebDeploymentTool"\r
- />\r
- <Tool\r
- Name="VCPostBuildEventTool"\r
- />\r
- </Configuration>\r
- <Configuration\r
- Name="Debug|x64"\r
- ConfigurationType="2"\r
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unibin-x64.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpclient.vsprops"\r
- CharacterSet="1"\r
- >\r
- <Tool\r
- Name="VCPreBuildEventTool"\r
- />\r
- <Tool\r
- Name="VCCustomBuildTool"\r
- />\r
- <Tool\r
- Name="VCXMLDataGeneratorTool"\r
- />\r
- <Tool\r
- Name="VCWebServiceProxyGeneratorTool"\r
- />\r
- <Tool\r
- Name="VCMIDLTool"\r
- TargetEnvironment="3"\r
- />\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories="include"\r
- PreprocessorDefinitions="ASR_CLIENT_LIB_EXPORT"\r
- DebugInformationFormat="3"\r
- />\r
- <Tool\r
- Name="VCManagedResourceCompilerTool"\r
- />\r
- <Tool\r
- Name="VCResourceCompilerTool"\r
- />\r
- <Tool\r
- Name="VCPreLinkEventTool"\r
- />\r
- <Tool\r
- Name="VCLinkerTool"\r
- AdditionalDependencies="$(UniMRCPClientLibs)"\r
- />\r
- <Tool\r
- Name="VCALinkTool"\r
- />\r
- <Tool\r
- Name="VCManifestTool"\r
- />\r
- <Tool\r
- Name="VCXDCMakeTool"\r
- />\r
- <Tool\r
- Name="VCBscMakeTool"\r
- />\r
- <Tool\r
- Name="VCFxCopTool"\r
- />\r
- <Tool\r
- Name="VCAppVerifierTool"\r
- />\r
- <Tool\r
- Name="VCWebDeploymentTool"\r
- />\r
- <Tool\r
- Name="VCPostBuildEventTool"\r
- />\r
- </Configuration>\r
- <Configuration\r
- Name="Release|x64"\r
- ConfigurationType="2"\r
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unibin-x64.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpclient.vsprops"\r
- CharacterSet="1"\r
- WholeProgramOptimization="1"\r
- >\r
- <Tool\r
- Name="VCPreBuildEventTool"\r
- />\r
- <Tool\r
- Name="VCCustomBuildTool"\r
- />\r
- <Tool\r
- Name="VCXMLDataGeneratorTool"\r
- />\r
- <Tool\r
- Name="VCWebServiceProxyGeneratorTool"\r
- />\r
- <Tool\r
- Name="VCMIDLTool"\r
- TargetEnvironment="3"\r
- />\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories="include"\r
- PreprocessorDefinitions="ASR_CLIENT_LIB_EXPORT"\r
- />\r
- <Tool\r
- Name="VCManagedResourceCompilerTool"\r
- />\r
- <Tool\r
- Name="VCResourceCompilerTool"\r
- />\r
- <Tool\r
- Name="VCPreLinkEventTool"\r
- />\r
- <Tool\r
- Name="VCLinkerTool"\r
- AdditionalDependencies="$(UniMRCPClientLibs)"\r
- />\r
- <Tool\r
- Name="VCALinkTool"\r
- />\r
- <Tool\r
- Name="VCManifestTool"\r
- />\r
- <Tool\r
- Name="VCXDCMakeTool"\r
- />\r
- <Tool\r
- Name="VCBscMakeTool"\r
- />\r
- <Tool\r
- Name="VCFxCopTool"\r
- />\r
- <Tool\r
- Name="VCAppVerifierTool"\r
- />\r
- <Tool\r
- Name="VCWebDeploymentTool"\r
- />\r
- <Tool\r
- Name="VCPostBuildEventTool"\r
- />\r
- </Configuration>\r
- </Configurations>\r
- <References>\r
- </References>\r
- <Files>\r
- <Filter\r
- Name="include"\r
- Filter="h;hpp;hxx;hm;inl;inc;xsd"\r
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"\r
- >\r
- <File\r
- RelativePath=".\include\asr_engine.h"\r
- >\r
- </File>\r
- </Filter>\r
- <Filter\r
- Name="src"\r
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"\r
- >\r
- <File\r
- RelativePath=".\src\asr_engine.c"\r
- >\r
- </File>\r
- </Filter>\r
- </Files>\r
- <Globals>\r
- </Globals>\r
-</VisualStudioProject>\r
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{272FAFA8-2B2F-4716-B95F-3B37CF2E0CB3}</ProjectGuid>
- <RootNamespace>libasrclient</RootNamespace>
- <Keyword>Win32Proj</Keyword>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unibin.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unimrcpclient.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" />
- <Import Project="$(ProjectDir)..\..\build\props\unibin.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unimrcpclient.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unibin-x64.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unimrcpclient.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" />
- <Import Project="$(ProjectDir)..\..\build\props\unibin-x64.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unimrcpclient.props" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>ASR_CLIENT_LIB_EXPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- </ClCompile>
- <Link>
- <AdditionalDependencies>$(UniMRCPClientLibs);%(AdditionalDependencies)</AdditionalDependencies>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>ASR_CLIENT_LIB_EXPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- </ClCompile>
- <Link>
- <AdditionalDependencies>$(UniMRCPClientLibs);%(AdditionalDependencies)</AdditionalDependencies>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>ASR_CLIENT_LIB_EXPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- <Link>
- <AdditionalDependencies>$(UniMRCPClientLibs);%(AdditionalDependencies)</AdditionalDependencies>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>ASR_CLIENT_LIB_EXPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- </ClCompile>
- <Link>
- <AdditionalDependencies>$(UniMRCPClientLibs);%(AdditionalDependencies)</AdditionalDependencies>
- </Link>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClInclude Include="include\asr_engine.h" />
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="src\asr_engine.c" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\libunimrcp-client\libunimrcpclient.vcxproj">
- <Project>{ee157390-1e85-416c-946e-620e32c9ad33}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="include">
- <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
- </Filter>
- <Filter Include="src">
- <UniqueIdentifier>{21e6c16e-f977-468a-9576-0c5981eb7da5}</UniqueIdentifier>
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="include\asr_engine.h">
- <Filter>include</Filter>
- </ClInclude>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="src\asr_engine.c">
- <Filter>src</Filter>
- </ClCompile>
- </ItemGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2009-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: asr_engine.c 2204 2014-10-31 01:01:42Z achaloyan@gmail.com $
- */
-
-#include <stdlib.h>
-
-/* APR includes */
-#include <apr_thread_cond.h>
-#include <apr_thread_proc.h>
-
-/* Common includes */
-#include "unimrcp_client.h"
-#include "mrcp_application.h"
-#include "mrcp_message.h"
-#include "mrcp_generic_header.h"
-/* Recognizer includes */
-#include "mrcp_recog_header.h"
-#include "mrcp_recog_resource.h"
-/* MPF includes */
-#include <mpf_frame_buffer.h>
-/* APT includes */
-#include "apt_nlsml_doc.h"
-#include "apt_log.h"
-#include "apt_pool.h"
-
-#include "asr_engine.h"
-
-typedef enum {
- INPUT_MODE_NONE,
- INPUT_MODE_FILE,
- INPUT_MODE_STREAM
-} input_mode_e;
-
-/** ASR engine on top of UniMRCP client stack */
-struct asr_engine_t {
- /** MRCP client stack */
- mrcp_client_t *mrcp_client;
- /** MRCP client stack */
- mrcp_application_t *mrcp_app;
- /** Memory pool */
- apr_pool_t *pool;
-};
-
-
-/** ASR session on top of UniMRCP session/channel */
-struct asr_session_t {
- /** Back pointer to engine */
- asr_engine_t *engine;
- /** MRCP session */
- mrcp_session_t *mrcp_session;
- /** MRCP channel */
- mrcp_channel_t *mrcp_channel;
- /** RECOGNITION-COMPLETE message */
- mrcp_message_t *recog_complete;
-
- /** Input mode (either file or stream) */
- input_mode_e input_mode;
- /** File to read media frames from */
- FILE *audio_in;
- /* Buffer of media frames */
- mpf_frame_buffer_t *media_buffer;
- /** Streaming is in-progress */
- apt_bool_t streaming;
-
- /** Conditional wait object */
- apr_thread_cond_t *wait_object;
- /** Mutex of the wait object */
- apr_thread_mutex_t *mutex;
-
- /** Message sent from client stack */
- const mrcp_app_message_t *app_message;
-};
-
-
-/** Declaration of recognizer audio stream methods */
-static apt_bool_t asr_stream_read(mpf_audio_stream_t *stream, mpf_frame_t *frame);
-
-static const mpf_audio_stream_vtable_t audio_stream_vtable = {
- NULL,
- NULL,
- NULL,
- asr_stream_read,
- NULL,
- NULL,
- NULL,
- NULL
-};
-
-static apt_bool_t app_message_handler(const mrcp_app_message_t *app_message);
-
-
-/** Create ASR engine */
-ASR_CLIENT_DECLARE(asr_engine_t*) asr_engine_create(
- const char *root_dir_path,
- apt_log_priority_e log_priority,
- apt_log_output_e log_output)
-{
- apr_pool_t *pool = NULL;
- apt_dir_layout_t *dir_layout;
- asr_engine_t *engine;
- mrcp_client_t *mrcp_client;
- mrcp_application_t *mrcp_app;
-
- /* create APR pool */
- pool = apt_pool_create();
- if(!pool) {
- return NULL;
- }
-
- /* create the structure of default directories layout */
- dir_layout = apt_default_dir_layout_create(root_dir_path,pool);
- /* create singleton logger */
- apt_log_instance_create(log_output,log_priority,pool);
-
- if((log_output & APT_LOG_OUTPUT_FILE) == APT_LOG_OUTPUT_FILE) {
- /* open the log file */
- const char *log_dir_path = apt_dir_layout_path_get(dir_layout,APT_LAYOUT_LOG_DIR);
- apt_log_file_open(log_dir_path,"unimrcpclient",MAX_LOG_FILE_SIZE,MAX_LOG_FILE_COUNT,FALSE,pool);
- }
-
- engine = apr_palloc(pool,sizeof(asr_engine_t));
- engine->pool = pool;
- engine->mrcp_client = NULL;
- engine->mrcp_app = NULL;
-
- /* create UniMRCP client stack */
- mrcp_client = unimrcp_client_create(dir_layout);
- if(!mrcp_client) {
- apt_log_instance_destroy();
- apr_pool_destroy(pool);
- return NULL;
- }
-
- /* create an application */
- mrcp_app = mrcp_application_create(
- app_message_handler,
- engine,
- pool);
- if(!mrcp_app) {
- mrcp_client_destroy(mrcp_client);
- apt_log_instance_destroy();
- apr_pool_destroy(pool);
- return NULL;
- }
-
- /* register application in client stack */
- mrcp_client_application_register(mrcp_client,mrcp_app,"ASRAPP");
-
- /* start client stack */
- if(mrcp_client_start(mrcp_client) != TRUE) {
- mrcp_client_destroy(mrcp_client);
- apt_log_instance_destroy();
- apr_pool_destroy(pool);
- return NULL;
- }
-
- engine->mrcp_client = mrcp_client;
- engine->mrcp_app = mrcp_app;
- return engine;
-}
-
-/** Destroy ASR engine */
-ASR_CLIENT_DECLARE(apt_bool_t) asr_engine_destroy(asr_engine_t *engine)
-{
- if(engine->mrcp_client) {
- /* shutdown client stack */
- mrcp_client_shutdown(engine->mrcp_client);
- /* destroy client stack */
- mrcp_client_destroy(engine->mrcp_client);
- engine->mrcp_client = NULL;
- engine->mrcp_app = NULL;
- }
-
- /* destroy singleton logger */
- apt_log_instance_destroy();
- /* destroy APR pool */
- apr_pool_destroy(engine->pool);
- return TRUE;
-}
-
-
-
-/** Destroy ASR session */
-static apt_bool_t asr_session_destroy_ex(asr_session_t *asr_session, apt_bool_t terminate)
-{
- if(terminate == TRUE) {
- apr_thread_mutex_lock(asr_session->mutex);
- if(mrcp_application_session_terminate(asr_session->mrcp_session) == TRUE) {
- apr_thread_cond_wait(asr_session->wait_object,asr_session->mutex);
- /* the response must be checked to be the valid one */
- }
- apr_thread_mutex_unlock(asr_session->mutex);
- }
-
- if(asr_session->audio_in) {
- fclose(asr_session->audio_in);
- asr_session->audio_in = NULL;
- }
-
- if(asr_session->mutex) {
- apr_thread_mutex_destroy(asr_session->mutex);
- asr_session->mutex = NULL;
- }
- if(asr_session->wait_object) {
- apr_thread_cond_destroy(asr_session->wait_object);
- asr_session->wait_object = NULL;
- }
- if(asr_session->media_buffer) {
- mpf_frame_buffer_destroy(asr_session->media_buffer);
- asr_session->media_buffer = NULL;
- }
-
- return mrcp_application_session_destroy(asr_session->mrcp_session);
-}
-
-/** Open audio input file */
-static apt_bool_t asr_input_file_open(asr_session_t *asr_session, const char *input_file)
-{
- const apt_dir_layout_t *dir_layout = mrcp_application_dir_layout_get(asr_session->engine->mrcp_app);
- apr_pool_t *pool = mrcp_application_session_pool_get(asr_session->mrcp_session);
- char *input_file_path = apt_datadir_filepath_get(dir_layout,input_file,pool);
- if(!input_file_path) {
- return FALSE;
- }
-
- if(asr_session->audio_in) {
- fclose(asr_session->audio_in);
- asr_session->audio_in = NULL;
- }
-
- asr_session->audio_in = fopen(input_file_path,"rb");
- if(!asr_session->audio_in) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot Open [%s]",input_file_path);
- return FALSE;
- }
-
- return TRUE;
-}
-
-/** MPF callback to read audio frame */
-static apt_bool_t asr_stream_read(mpf_audio_stream_t *stream, mpf_frame_t *frame)
-{
- asr_session_t *asr_session = stream->obj;
- if(asr_session && asr_session->streaming == TRUE) {
- if(asr_session->input_mode == INPUT_MODE_FILE) {
- if(asr_session->audio_in) {
- if(fread(frame->codec_frame.buffer,1,frame->codec_frame.size,asr_session->audio_in) == frame->codec_frame.size) {
- /* normal read */
- frame->type |= MEDIA_FRAME_TYPE_AUDIO;
- }
- else {
- /* file is over */
- asr_session->streaming = FALSE;
- }
- }
- }
- if(asr_session->input_mode == INPUT_MODE_STREAM) {
- if(asr_session->media_buffer) {
- mpf_frame_buffer_read(asr_session->media_buffer,frame);
- }
- }
- }
- return TRUE;
-}
-
-/** Create DEFINE-GRAMMAR request */
-static mrcp_message_t* define_grammar_message_create(asr_session_t *asr_session, const char *grammar_file)
-{
- /* create MRCP message */
- mrcp_message_t *mrcp_message = mrcp_application_message_create(
- asr_session->mrcp_session,
- asr_session->mrcp_channel,
- RECOGNIZER_DEFINE_GRAMMAR);
- if(mrcp_message) {
- mrcp_generic_header_t *generic_header;
-
- /* set message body */
- const apt_dir_layout_t *dir_layout = mrcp_application_dir_layout_get(asr_session->engine->mrcp_app);
- apr_pool_t *pool = mrcp_application_session_pool_get(asr_session->mrcp_session);
- char *grammar_file_path = apt_datadir_filepath_get(dir_layout,grammar_file,pool);
- if(grammar_file_path) {
- apr_finfo_t finfo;
- apr_file_t *grammar_file;
- apt_str_t *content = &mrcp_message->body;
-
- if(apr_file_open(&grammar_file,grammar_file_path,APR_FOPEN_READ|APR_FOPEN_BINARY,0,pool) != APR_SUCCESS) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Open Grammar File %s",grammar_file_path);
- return NULL;
- }
-
- if(apr_file_info_get(&finfo,APR_FINFO_SIZE,grammar_file) != APR_SUCCESS) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Get Grammar File Info %s",grammar_file_path);
- apr_file_close(grammar_file);
- return NULL;
- }
-
- content->length = (apr_size_t)finfo.size;
- content->buf = (char*) apr_palloc(pool,content->length+1);
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Load Grammar File Content size [%"APR_SIZE_T_FMT" bytes] %s",
- content->length,grammar_file_path);
- if(apr_file_read(grammar_file,content->buf,&content->length) != APR_SUCCESS) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Read Grammar File Content %s",grammar_file_path);
- apr_file_close(grammar_file);
- return NULL;
- }
- content->buf[content->length] = '\0';
- apr_file_close(grammar_file);
- }
-
- /* get/allocate generic header */
- generic_header = mrcp_generic_header_prepare(mrcp_message);
- if(generic_header) {
- /* set generic header fields */
- if(mrcp_message->start_line.version == MRCP_VERSION_2) {
- apt_string_assign(&generic_header->content_type,"application/srgs+xml",mrcp_message->pool);
- }
- else {
- apt_string_assign(&generic_header->content_type,"application/grammar+xml",mrcp_message->pool);
- }
- mrcp_generic_header_property_add(mrcp_message,GENERIC_HEADER_CONTENT_TYPE);
- apt_string_assign(&generic_header->content_id,"demo-grammar",mrcp_message->pool);
- mrcp_generic_header_property_add(mrcp_message,GENERIC_HEADER_CONTENT_ID);
- }
- }
- return mrcp_message;
-}
-
-/** Create RECOGNIZE request */
-static mrcp_message_t* recognize_message_create(asr_session_t *asr_session)
-{
- /* create MRCP message */
- mrcp_message_t *mrcp_message = mrcp_application_message_create(
- asr_session->mrcp_session,
- asr_session->mrcp_channel,
- RECOGNIZER_RECOGNIZE);
- if(mrcp_message) {
- mrcp_recog_header_t *recog_header;
- mrcp_generic_header_t *generic_header;
- /* get/allocate generic header */
- generic_header = mrcp_generic_header_prepare(mrcp_message);
- if(generic_header) {
- /* set generic header fields */
- apt_string_assign(&generic_header->content_type,"text/uri-list",mrcp_message->pool);
- mrcp_generic_header_property_add(mrcp_message,GENERIC_HEADER_CONTENT_TYPE);
- /* set message body */
- apt_string_assign(&mrcp_message->body,"session:demo-grammar",mrcp_message->pool);
- }
- /* get/allocate recognizer header */
- recog_header = mrcp_resource_header_prepare(mrcp_message);
- if(recog_header) {
- if(mrcp_message->start_line.version == MRCP_VERSION_2) {
- /* set recognizer header fields */
- recog_header->cancel_if_queue = FALSE;
- mrcp_resource_header_property_add(mrcp_message,RECOGNIZER_HEADER_CANCEL_IF_QUEUE);
- }
- recog_header->no_input_timeout = 5000;
- mrcp_resource_header_property_add(mrcp_message,RECOGNIZER_HEADER_NO_INPUT_TIMEOUT);
- recog_header->recognition_timeout = 20000;
- mrcp_resource_header_property_add(mrcp_message,RECOGNIZER_HEADER_RECOGNITION_TIMEOUT);
- recog_header->speech_complete_timeout = 400;
- mrcp_resource_header_property_add(mrcp_message,RECOGNIZER_HEADER_SPEECH_COMPLETE_TIMEOUT);
- recog_header->dtmf_term_timeout = 3000;
- mrcp_resource_header_property_add(mrcp_message,RECOGNIZER_HEADER_DTMF_TERM_TIMEOUT);
- recog_header->dtmf_interdigit_timeout = 3000;
- mrcp_resource_header_property_add(mrcp_message,RECOGNIZER_HEADER_DTMF_INTERDIGIT_TIMEOUT);
- recog_header->confidence_threshold = 0.5f;
- mrcp_resource_header_property_add(mrcp_message,RECOGNIZER_HEADER_CONFIDENCE_THRESHOLD);
- recog_header->start_input_timers = TRUE;
- mrcp_resource_header_property_add(mrcp_message,RECOGNIZER_HEADER_START_INPUT_TIMERS);
- }
- }
- return mrcp_message;
-}
-
-/** Get NLSML result */
-static const char* nlsml_result_get(mrcp_message_t *message)
-{
- nlsml_interpretation_t *interpretation;
- nlsml_instance_t *instance;
- nlsml_result_t *result = nlsml_result_parse(message->body.buf, message->body.length, message->pool);
- if(!result) {
- return NULL;
- }
-
- /* get first interpretation */
- interpretation = nlsml_first_interpretation_get(result);
- if(!interpretation) {
- return NULL;
- }
-
- /* get first instance */
- instance = nlsml_interpretation_first_instance_get(interpretation);
- if(!instance) {
- return NULL;
- }
-
- nlsml_instance_swi_suppress(instance);
- return nlsml_instance_content_generate(instance, message->pool);
-}
-
-
-/** Application message handler */
-static apt_bool_t app_message_handler(const mrcp_app_message_t *app_message)
-{
- if((app_message->message_type == MRCP_APP_MESSAGE_TYPE_SIGNALING &&
- app_message->sig_message.message_type == MRCP_SIG_MESSAGE_TYPE_RESPONSE) ||
- app_message->message_type == MRCP_APP_MESSAGE_TYPE_CONTROL) {
-
- asr_session_t *asr_session = mrcp_application_session_object_get(app_message->session);
- if(asr_session) {
- apr_thread_mutex_lock(asr_session->mutex);
- asr_session->app_message = app_message;
- apr_thread_cond_signal(asr_session->wait_object);
- apr_thread_mutex_unlock(asr_session->mutex);
- }
- }
- return TRUE;
-}
-
-/** Check signaling response */
-static apt_bool_t sig_response_check(const mrcp_app_message_t *app_message)
-{
- if(!app_message || app_message->message_type != MRCP_APP_MESSAGE_TYPE_SIGNALING) {
- return FALSE;
- }
-
- return (app_message->sig_message.status == MRCP_SIG_STATUS_CODE_SUCCESS) ? TRUE : FALSE;
-}
-
-/** Check MRCP response */
-static apt_bool_t mrcp_response_check(const mrcp_app_message_t *app_message, mrcp_request_state_e state)
-{
- mrcp_message_t *mrcp_message = NULL;
- if(app_message && app_message->message_type == MRCP_APP_MESSAGE_TYPE_CONTROL) {
- mrcp_message = app_message->control_message;
- }
-
- if(!mrcp_message || mrcp_message->start_line.message_type != MRCP_MESSAGE_TYPE_RESPONSE ) {
- return FALSE;
- }
-
- if(mrcp_message->start_line.status_code != MRCP_STATUS_CODE_SUCCESS &&
- mrcp_message->start_line.status_code != MRCP_STATUS_CODE_SUCCESS_WITH_IGNORE) {
- return FALSE;
- }
- return (mrcp_message->start_line.request_state == state) ? TRUE : FALSE;
-}
-
-/** Get MRCP event */
-static mrcp_message_t* mrcp_event_get(const mrcp_app_message_t *app_message)
-{
- mrcp_message_t *mrcp_message = NULL;
- if(app_message && app_message->message_type == MRCP_APP_MESSAGE_TYPE_CONTROL) {
- mrcp_message = app_message->control_message;
- }
-
- if(!mrcp_message || mrcp_message->start_line.message_type != MRCP_MESSAGE_TYPE_EVENT) {
- return NULL;
- }
- return mrcp_message;
-}
-
-/** Create ASR session */
-ASR_CLIENT_DECLARE(asr_session_t*) asr_session_create(asr_engine_t *engine, const char *profile)
-{
- mpf_termination_t *termination;
- mrcp_channel_t *channel;
- mrcp_session_t *session;
- const mrcp_app_message_t *app_message;
- apr_pool_t *pool;
- asr_session_t *asr_session;
- mpf_stream_capabilities_t *capabilities;
-
- /* create session */
- session = mrcp_application_session_create(engine->mrcp_app,profile,NULL);
- if(!session) {
- return NULL;
- }
- pool = mrcp_application_session_pool_get(session);
-
- asr_session = apr_palloc(pool,sizeof(asr_session_t));
- mrcp_application_session_object_set(session,asr_session);
-
- /* create source stream capabilities */
- capabilities = mpf_source_stream_capabilities_create(pool);
- /* add codec capabilities (Linear PCM) */
- mpf_codec_capabilities_add(
- &capabilities->codecs,
- MPF_SAMPLE_RATE_8000,
- "LPCM");
-
- termination = mrcp_application_audio_termination_create(
- session, /* session, termination belongs to */
- &audio_stream_vtable, /* virtual methods table of audio stream */
- capabilities, /* capabilities of audio stream */
- asr_session); /* object to associate */
-
- channel = mrcp_application_channel_create(
- session, /* session, channel belongs to */
- MRCP_RECOGNIZER_RESOURCE, /* MRCP resource identifier */
- termination, /* media termination, used to terminate audio stream */
- NULL, /* RTP descriptor, used to create RTP termination (NULL by default) */
- asr_session); /* object to associate */
-
- if(!channel) {
- mrcp_application_session_destroy(session);
- return NULL;
- }
-
- asr_session->engine = engine;
- asr_session->mrcp_session = session;
- asr_session->mrcp_channel = channel;
- asr_session->recog_complete = NULL;
- asr_session->input_mode = INPUT_MODE_NONE;
- asr_session->streaming = FALSE;
- asr_session->audio_in = NULL;
- asr_session->media_buffer = NULL;
- asr_session->mutex = NULL;
- asr_session->wait_object = NULL;
- asr_session->app_message = NULL;
-
- /* Create cond wait object and mutex */
- apr_thread_mutex_create(&asr_session->mutex,APR_THREAD_MUTEX_DEFAULT,pool);
- apr_thread_cond_create(&asr_session->wait_object,pool);
-
- /* Create media buffer */
- asr_session->media_buffer = mpf_frame_buffer_create(160,20,pool);
-
- /* Send add channel request and wait for the response */
- apr_thread_mutex_lock(asr_session->mutex);
- app_message = NULL;
- if(mrcp_application_channel_add(asr_session->mrcp_session,asr_session->mrcp_channel) == TRUE) {
- apr_thread_cond_wait(asr_session->wait_object,asr_session->mutex);
- app_message = asr_session->app_message;
- asr_session->app_message = NULL;
- }
- apr_thread_mutex_unlock(asr_session->mutex);
-
- if(sig_response_check(app_message) == FALSE) {
- asr_session_destroy_ex(asr_session,TRUE);
- return NULL;
- }
- return asr_session;
-}
-
-/** Initiate recognition based on specified grammar and input file */
-ASR_CLIENT_DECLARE(const char*) asr_session_file_recognize(
- asr_session_t *asr_session,
- const char *grammar_file,
- const char *input_file)
-{
- const mrcp_app_message_t *app_message;
- mrcp_message_t *mrcp_message;
-
- app_message = NULL;
- mrcp_message = define_grammar_message_create(asr_session,grammar_file);
- if(!mrcp_message) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create DEFINE-GRAMMAR Request");
- return NULL;
- }
-
- /* Send DEFINE-GRAMMAR request and wait for the response */
- apr_thread_mutex_lock(asr_session->mutex);
- if(mrcp_application_message_send(asr_session->mrcp_session,asr_session->mrcp_channel,mrcp_message) == TRUE) {
- apr_thread_cond_wait(asr_session->wait_object,asr_session->mutex);
- app_message = asr_session->app_message;
- asr_session->app_message = NULL;
- }
- apr_thread_mutex_unlock(asr_session->mutex);
-
- if(mrcp_response_check(app_message,MRCP_REQUEST_STATE_COMPLETE) == FALSE) {
- return NULL;
- }
-
- /* Reset prev recog result (if any) */
- asr_session->recog_complete = NULL;
-
- app_message = NULL;
- mrcp_message = recognize_message_create(asr_session);
- if(!mrcp_message) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create RECOGNIZE Request");
- return NULL;
- }
-
- /* Send RECOGNIZE request and wait for the response */
- apr_thread_mutex_lock(asr_session->mutex);
- if(mrcp_application_message_send(asr_session->mrcp_session,asr_session->mrcp_channel,mrcp_message) == TRUE) {
- apr_thread_cond_wait(asr_session->wait_object,asr_session->mutex);
- app_message = asr_session->app_message;
- asr_session->app_message = NULL;
- }
- apr_thread_mutex_unlock(asr_session->mutex);
-
- if(mrcp_response_check(app_message,MRCP_REQUEST_STATE_INPROGRESS) == FALSE) {
- return NULL;
- }
-
- /* Open input file and start streaming */
- asr_session->input_mode = INPUT_MODE_FILE;
- if(asr_input_file_open(asr_session,input_file) == FALSE) {
- return NULL;
- }
- asr_session->streaming = TRUE;
-
- /* Wait for events either START-OF-INPUT or RECOGNITION-COMPLETE */
- do {
- apr_thread_mutex_lock(asr_session->mutex);
- app_message = NULL;
- if(apr_thread_cond_timedwait(asr_session->wait_object,asr_session->mutex, 60 * 1000000) != APR_SUCCESS) {
- apr_thread_mutex_unlock(asr_session->mutex);
- return NULL;
- }
- app_message = asr_session->app_message;
- asr_session->app_message = NULL;
- apr_thread_mutex_unlock(asr_session->mutex);
-
- mrcp_message = mrcp_event_get(app_message);
- if(mrcp_message && mrcp_message->start_line.method_id == RECOGNIZER_RECOGNITION_COMPLETE) {
- asr_session->recog_complete = mrcp_message;
- }
- }
- while(!asr_session->recog_complete);
-
- /* Get results */
- return nlsml_result_get(asr_session->recog_complete);
-}
-
-/** Initiate recognition based on specified grammar and input stream */
-ASR_CLIENT_DECLARE(const char*) asr_session_stream_recognize(
- asr_session_t *asr_session,
- const char *grammar_file)
-{
- const mrcp_app_message_t *app_message;
- mrcp_message_t *mrcp_message;
-
- app_message = NULL;
- mrcp_message = define_grammar_message_create(asr_session,grammar_file);
- if(!mrcp_message) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create DEFINE-GRAMMAR Request");
- return NULL;
- }
-
- /* Send DEFINE-GRAMMAR request and wait for the response */
- apr_thread_mutex_lock(asr_session->mutex);
- if(mrcp_application_message_send(asr_session->mrcp_session,asr_session->mrcp_channel,mrcp_message) == TRUE) {
- apr_thread_cond_wait(asr_session->wait_object,asr_session->mutex);
- app_message = asr_session->app_message;
- asr_session->app_message = NULL;
- }
- apr_thread_mutex_unlock(asr_session->mutex);
-
- if(mrcp_response_check(app_message,MRCP_REQUEST_STATE_COMPLETE) == FALSE) {
- return NULL;
- }
-
- /* Reset prev recog result (if any) */
- asr_session->recog_complete = NULL;
-
- app_message = NULL;
- mrcp_message = recognize_message_create(asr_session);
- if(!mrcp_message) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create RECOGNIZE Request");
- return NULL;
- }
-
- /* Send RECOGNIZE request and wait for the response */
- apr_thread_mutex_lock(asr_session->mutex);
- if(mrcp_application_message_send(asr_session->mrcp_session,asr_session->mrcp_channel,mrcp_message) == TRUE) {
- apr_thread_cond_wait(asr_session->wait_object,asr_session->mutex);
- app_message = asr_session->app_message;
- asr_session->app_message = NULL;
- }
- apr_thread_mutex_unlock(asr_session->mutex);
-
- if(mrcp_response_check(app_message,MRCP_REQUEST_STATE_INPROGRESS) == FALSE) {
- return NULL;
- }
-
- /* Reset media buffer */
- mpf_frame_buffer_restart(asr_session->media_buffer);
-
- /* Set input mode and start streaming */
- asr_session->input_mode = INPUT_MODE_STREAM;
- asr_session->streaming = TRUE;
-
- /* Wait for events either START-OF-INPUT or RECOGNITION-COMPLETE */
- do {
- apr_thread_mutex_lock(asr_session->mutex);
- app_message = NULL;
- if(apr_thread_cond_timedwait(asr_session->wait_object,asr_session->mutex, 60 * 1000000) != APR_SUCCESS) {
- apr_thread_mutex_unlock(asr_session->mutex);
- return NULL;
- }
- app_message = asr_session->app_message;
- asr_session->app_message = NULL;
- apr_thread_mutex_unlock(asr_session->mutex);
-
- mrcp_message = mrcp_event_get(app_message);
- if(mrcp_message && mrcp_message->start_line.method_id == RECOGNIZER_RECOGNITION_COMPLETE) {
- asr_session->recog_complete = mrcp_message;
- }
- }
- while(!asr_session->recog_complete);
-
- /* Get results */
- return nlsml_result_get(asr_session->recog_complete);
-}
-
-/** Write audio frame to recognize */
-ASR_CLIENT_DECLARE(apt_bool_t) asr_session_stream_write(
- asr_session_t *asr_session,
- char *data,
- int size)
-{
- mpf_frame_t frame;
- frame.type = MEDIA_FRAME_TYPE_AUDIO;
- frame.marker = MPF_MARKER_NONE;
- frame.codec_frame.buffer = data;
- frame.codec_frame.size = size;
-
- if(mpf_frame_buffer_write(asr_session->media_buffer,&frame) != TRUE) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Write Audio [%d]",size);
- return FALSE;
- }
- return TRUE;
-}
-
-/** Destroy ASR session */
-ASR_CLIENT_DECLARE(apt_bool_t) asr_session_destroy(asr_session_t *asr_session)
-{
- return asr_session_destroy_ex(asr_session,TRUE);
-}
-
-/** Set log priority */
-ASR_CLIENT_DECLARE(apt_bool_t) asr_engine_log_priority_set(apt_log_priority_e log_priority)
-{
- return apt_log_priority_set(log_priority);
-}
+++ /dev/null
-AM_CPPFLAGS = -I$(top_srcdir)/platforms/libunimrcp-client/include \
- $(UNIMRCP_CLIENTLIB_INCLUDES)
-
-lib_LTLIBRARIES = libunimrcpclient.la
-
-include_HEADERS = include/unimrcp_client.h
-libunimrcpclient_la_SOURCES = src/unimrcp_client.c
-libunimrcpclient_la_LIBADD = $(UNIMRCP_CLIENTLIB_LIBS)
-libunimrcpclient_la_LDFLAGS = $(UNIMRCP_CLIENTLIB_OPTS)
-
-include $(top_srcdir)/build/rules/uniclientlib.am
+++ /dev/null
-/*
- * 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_client.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef UNIMRCP_CLIENT_H
-#define UNIMRCP_CLIENT_H
-
-/**
- * @file unimrcp_client.h
- * @brief UniMRCP Client
- */
-
-#include "mrcp_client.h"
-
-APT_BEGIN_EXTERN_C
-
-/**
- * Create UniMRCP client.
- * @param dir_layout the dir layout structure
- */
-MRCP_DECLARE(mrcp_client_t*) unimrcp_client_create(apt_dir_layout_t *dir_layout);
-
-/**
- * Create UniMRCP client.
- * @param xmlconfig XML configuration string
- */
-MRCP_DECLARE(mrcp_client_t*) unimrcp_client_create2(const char *xmlconfig);
-
-
-APT_END_EXTERN_C
-
-#endif /* UNIMRCP_CLIENT_H */
+++ /dev/null
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="libunimrcpclient"
- ProjectGUID="{EE157390-1E85-416C-946E-620E32C9AD33}"
- RootNamespace="libunimrcpclient"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- <Platform
- Name="x64"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- ConfigurationType="4"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unilib.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpclient.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(ProjectRootDir)modules\mrcp-sofiasip\include";"$(ProjectRootDir)modules\mrcp-unirtsp\include""
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- ConfigurationType="4"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unilib.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpclient.vsprops"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(ProjectRootDir)modules\mrcp-sofiasip\include";"$(ProjectRootDir)modules\mrcp-unirtsp\include""
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|x64"
- ConfigurationType="4"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unilib-x64.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpclient.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(ProjectRootDir)modules\mrcp-sofiasip\include";"$(ProjectRootDir)modules\mrcp-unirtsp\include""
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|x64"
- ConfigurationType="4"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unilib-x64.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpclient.vsprops"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(ProjectRootDir)modules\mrcp-sofiasip\include";"$(ProjectRootDir)modules\mrcp-unirtsp\include""
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="include"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- <File
- RelativePath="..\..\build\uni_revision.h"
- >
- </File>
- <File
- RelativePath="..\..\build\uni_version.h"
- >
- </File>
- <File
- RelativePath=".\include\unimrcp_client.h"
- >
- </File>
- </Filter>
- <Filter
- Name="src"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- >
- <File
- RelativePath=".\src\unimrcp_client.c"
- >
- </File>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{EE157390-1E85-416C-946E-620E32C9AD33}</ProjectGuid>
- <RootNamespace>libunimrcpclient</RootNamespace>
- <Keyword>Win32Proj</Keyword>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unilib.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unimrcpclient.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" />
- <Import Project="$(ProjectDir)..\..\build\props\unilib.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unimrcpclient.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unilib-x64.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unimrcpclient.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" />
- <Import Project="$(ProjectDir)..\..\build\props\unilib-x64.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unimrcpclient.props" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <AdditionalIncludeDirectories>$(ProjectRootDir)modules\mrcp-sofiasip\include;$(ProjectRootDir)modules\mrcp-unirtsp\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <AdditionalIncludeDirectories>$(ProjectRootDir)modules\mrcp-sofiasip\include;$(ProjectRootDir)modules\mrcp-unirtsp\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <AdditionalIncludeDirectories>$(ProjectRootDir)modules\mrcp-sofiasip\include;$(ProjectRootDir)modules\mrcp-unirtsp\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <AdditionalIncludeDirectories>$(ProjectRootDir)modules\mrcp-sofiasip\include;$(ProjectRootDir)modules\mrcp-unirtsp\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClInclude Include="..\..\build\uni_revision.h" />
- <ClInclude Include="..\..\build\uni_version.h" />
- <ClInclude Include="include\unimrcp_client.h" />
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="src\unimrcp_client.c" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\libs\mrcp-client\mrcpclient.vcxproj">
- <Project>{72782932-37cc-46ae-8c7f-9a7b1a6ee108}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- <ProjectReference Include="..\..\modules\mrcp-sofiasip\mrcpsofiasip.vcxproj">
- <Project>{746f3632-5bb2-4570-9453-31d6d58a7d8e}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- <ProjectReference Include="..\..\modules\mrcp-unirtsp\mrcpunirtsp.vcxproj">
- <Project>{deb01acb-d65f-4a62-aed9-58c1054499e9}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="include">
- <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
- </Filter>
- <Filter Include="src">
- <UniqueIdentifier>{15d2ec58-ba87-4dd8-9f7a-434f9e186e4e}</UniqueIdentifier>
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="..\..\build\uni_revision.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="..\..\build\uni_version.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\unimrcp_client.h">
- <Filter>include</Filter>
- </ClInclude>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="src\unimrcp_client.c">
- <Filter>src</Filter>
- </ClCompile>
- </ItemGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-/*
- * 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_client.c 2252 2014-11-21 02:45:15Z achaloyan@gmail.com $
- */
-
-#include <stdlib.h>
-#include <apr_xml.h>
-#include <apr_fnmatch.h>
-#include <apr_version.h>
-#include "uni_version.h"
-#include "uni_revision.h"
-#include "unimrcp_client.h"
-#include "mrcp_resource_loader.h"
-#include "mpf_engine.h"
-#include "mpf_engine_factory.h"
-#include "mpf_codec_manager.h"
-#include "mpf_rtp_termination_factory.h"
-#include "mrcp_sofiasip_client_agent.h"
-#include "mrcp_unirtsp_client_agent.h"
-#include "mrcp_client_connection.h"
-#include "mrcp_ca_factory.h"
-#include "apt_net.h"
-#include "apt_log.h"
-
-#define CONF_FILE_NAME "unimrcpclient.xml"
-
-#define DEFAULT_IP_ADDRESS "127.0.0.1"
-#define DEFAULT_SIP_PORT 8062
-#define DEFAULT_RTP_PORT_MIN 4000
-#define DEFAULT_RTP_PORT_MAX 5000
-
-#define DEFAULT_SOFIASIP_UA_NAME "UniMRCP SofiaSIP"
-#define DEFAULT_SDP_ORIGIN "UniMRCPClient"
-#define DEFAULT_RESOURCE_LOCATION "media"
-
-#define XML_FILE_BUFFER_LENGTH 16000
-
-/** UniMRCP client loader */
-typedef struct unimrcp_client_loader_t unimrcp_client_loader_t;
-
-/** UniMRCP client loader */
-struct unimrcp_client_loader_t {
- /** MRCP client */
- mrcp_client_t *client;
- /** Directory layout */
- apt_dir_layout_t *dir_layout;
- /** XML document */
- apr_xml_doc *doc;
- /** Pool to allocate memory from */
- apr_pool_t *pool;
-
- /** Default IP address (named property) */
- const char *ip;
- /** Default external (NAT) IP address (named property) */
- const char *ext_ip;
- /** Default server IP address (named property) */
- const char *server_ip;
-
- /** Implicitly detected, cached IP address */
- const char *auto_ip;
-};
-
-static apt_bool_t unimrcp_client_load(unimrcp_client_loader_t *loader, const char *dir_path, const char *file_name);
-static apt_bool_t unimrcp_client_load2(unimrcp_client_loader_t *loader, const char *xmlconfig);
-
-/** Initialize client -- common to unimrcp_client_create and unimrcp_client_create2 */
-static unimrcp_client_loader_t* unimrcp_client_init(apt_dir_layout_t *dir_layout)
-{
- apr_pool_t *pool;
- mrcp_client_t *client;
- unimrcp_client_loader_t *loader;
-
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"UniMRCP Client ["UNI_VERSION_STRING"] [r"UNI_REVISION_STRING"]");
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"APR ["APR_VERSION_STRING"]");
- client = mrcp_client_create(dir_layout);
- if(!client) {
- return NULL;
- }
- pool = mrcp_client_memory_pool_get(client);
- if(!pool) {
- return NULL;
- }
-
- loader = apr_palloc(pool,sizeof(unimrcp_client_loader_t));
- loader->dir_layout = dir_layout;
- loader->doc = NULL;
- loader->client = client;
- loader->pool = pool;
- loader->ip = NULL;
- loader->ext_ip = NULL;
- loader->server_ip = NULL;
- loader->auto_ip = NULL;
- return loader;
-}
-
-/** Create and load UniMRCP client using the directories layout */
-MRCP_DECLARE(mrcp_client_t*) unimrcp_client_create(apt_dir_layout_t *dir_layout)
-{
- const char *dir_path;
- unimrcp_client_loader_t *loader;
-
- if(!dir_layout) {
- return NULL;
- }
-
- loader = unimrcp_client_init(dir_layout);
- if (!loader)
- return NULL;
-
- dir_path = apt_dir_layout_path_get(dir_layout,APT_LAYOUT_CONF_DIR);
-
- if(unimrcp_client_load(loader,dir_path,CONF_FILE_NAME) == FALSE) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Load UniMRCP Client Document");
- }
-
- return loader->client;
-}
-
-/** Create UniMRCP client from XML string configuration */
-MRCP_DECLARE(mrcp_client_t*) unimrcp_client_create2(const char *xmlconfig)
-{
- unimrcp_client_loader_t *loader;
-
- loader = unimrcp_client_init(NULL);
- if (!loader)
- return NULL;
-
- if(unimrcp_client_load2(loader,xmlconfig) == FALSE) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Process UniMRCP Client Configuration");
- }
-
- return loader->client;
-}
-
-/** Check whether specified attribute is valid */
-static APR_INLINE apt_bool_t is_attr_valid(const apr_xml_attr *attr)
-{
- return (attr && attr->value && *attr->value != '\0');
-}
-
-/** Check whether specified attribute is enabled (true) */
-static APR_INLINE apt_bool_t is_attr_enabled(const apr_xml_attr *attr)
-{
- if(attr && strcasecmp(attr->value,"false") == 0) {
- return FALSE;
- }
- return TRUE;
-}
-
-/** Check whether cdata is valid */
-static APR_INLINE apt_bool_t is_cdata_valid(const apr_xml_elem *elem)
-{
- return (elem->first_cdata.first && elem->first_cdata.first->text);
-}
-
-/** Get text cdata */
-static APR_INLINE const char* cdata_text_get(const apr_xml_elem *elem)
-{
- return elem->first_cdata.first->text;
-}
-
-/** Get boolean cdata */
-static APR_INLINE apt_bool_t cdata_bool_get(const apr_xml_elem *elem)
-{
- return (strcasecmp(elem->first_cdata.first->text,"true") == 0) ? TRUE : FALSE;
-}
-
-/** Copy cdata */
-static APR_INLINE char* cdata_copy(const apr_xml_elem *elem, apr_pool_t *pool)
-{
- return apr_pstrdup(pool,elem->first_cdata.first->text);
-}
-
-/** Get generic "id" and "enable" attributes */
-static apt_bool_t header_attribs_get(const apr_xml_elem *elem, const apr_xml_attr **id, const apr_xml_attr **enable)
-{
- const apr_xml_attr *attr;
- if(!id || !enable) {
- return FALSE;
- }
-
- *id = NULL;
- *enable = NULL;
- for(attr = elem->attr; attr; attr = attr->next) {
- if(strcasecmp(attr->name,"id") == 0) {
- *id = attr;
- }
- else if(strcasecmp(attr->name,"enable") == 0) {
- *enable = attr;
- }
- }
-
- if(is_attr_valid(*id) == FALSE) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Missing Required Attribute <id> in Element <%s>",elem->name);
- return FALSE;
- }
- return TRUE;
-}
-
-/** Get profile attributes such as "id", "enable" and "tag" */
-static apt_bool_t profile_attribs_get(const apr_xml_elem *elem, const apr_xml_attr **id, const apr_xml_attr **enable, const apr_xml_attr **tag)
-{
- const apr_xml_attr *attr;
- if(!id || !enable || !tag) {
- return FALSE;
- }
-
- *id = NULL;
- *enable = NULL;
- *tag = NULL;
- for(attr = elem->attr; attr; attr = attr->next) {
- if(strcasecmp(attr->name,"id") == 0) {
- *id = attr;
- }
- else if(strcasecmp(attr->name,"enable") == 0) {
- *enable = attr;
- }
- else if(strcasecmp(attr->name,"tag") == 0) {
- *tag = attr;
- }
- }
-
- if(is_attr_valid(*id) == FALSE) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Missing Required Attribute <id> in Element <%s>",elem->name);
- return FALSE;
- }
- return TRUE;
-}
-
-/** Get generic "name" and "value" attributes */
-static apt_bool_t name_value_attribs_get(const apr_xml_elem *elem, const apr_xml_attr **name, const apr_xml_attr **value)
-{
- const apr_xml_attr *attr;
- if(!name || !value) {
- return FALSE;
- }
-
- *name = NULL;
- *value = NULL;
- for(attr = elem->attr; attr; attr = attr->next) {
- if(strcasecmp(attr->name,"name") == 0) {
- *name = attr;
- }
- else if(strcasecmp(attr->name,"value") == 0) {
- *value = attr;
- }
- }
- return (*name && *value) ? TRUE : FALSE;
-}
-
-static char* unimrcp_client_ip_address_get(unimrcp_client_loader_t *loader, const apr_xml_elem *elem, const char *default_ip)
-{
- const apr_xml_attr *attr = NULL;
- for(attr = elem->attr; attr; attr = attr->next) {
- if(strcasecmp(attr->name,"type") == 0) {
- break;
- }
- }
-
- if(attr && strcasecmp(attr->value,"auto") == 0) {
- /* implicitly detect IP address, if not already detected */
- if(!loader->auto_ip) {
- char *auto_addr = DEFAULT_IP_ADDRESS;
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Detecting IP Address");
- apt_ip_get(&auto_addr,loader->pool);
- loader->auto_ip = auto_addr;
- }
- return apr_pstrdup(loader->pool,loader->auto_ip);
- }
- else if(attr && strcasecmp(attr->value,"iface") == 0) {
- /* get IP address by network interface name */
- char *ip_addr = DEFAULT_IP_ADDRESS;
- if(is_cdata_valid(elem) == TRUE) {
- const char *iface_name = cdata_text_get(elem);
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Get IP Address by Interface [%s]", iface_name);
- apt_ip_get_by_iface(iface_name,&ip_addr,loader->pool);
- }
- return ip_addr;
- }
-
- if(is_cdata_valid(elem)) {
- /* use specified IP address */
- return cdata_copy(elem,loader->pool);
- }
-
- /* use default IP address */
- return apr_pstrdup(loader->pool,loader->ip);
-}
-
-
-
-/** Load resource */
-static apt_bool_t unimrcp_client_resource_load(mrcp_resource_loader_t *resource_loader, const apr_xml_elem *root, apr_pool_t *pool)
-{
- apt_str_t resource_class;
- const apr_xml_attr *id_attr;
- const apr_xml_attr *enable_attr;
- apt_string_reset(&resource_class);
-
- if(header_attribs_get(root,&id_attr,&enable_attr) == FALSE) {
- return FALSE;
- }
-
- if(is_attr_enabled(enable_attr) == FALSE) {
- return TRUE;
- }
-
- apt_string_set(&resource_class,id_attr->value);
- return mrcp_resource_load(resource_loader,&resource_class);
-}
-
-/** Load resource factory */
-static apt_bool_t unimrcp_client_resource_factory_load(unimrcp_client_loader_t *loader, const apr_xml_elem *root)
-{
- const apr_xml_elem *elem;
- mrcp_resource_factory_t *resource_factory;
- mrcp_resource_loader_t *resource_loader = mrcp_resource_loader_create(FALSE,loader->pool);
- if(!resource_loader) {
- return FALSE;
- }
-
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Resources");
- for(elem = root->first_child; elem; elem = elem->next) {
- if(strcasecmp(elem->name,"resource") == 0) {
- unimrcp_client_resource_load(resource_loader,elem,loader->pool);
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name);
- }
- }
-
- resource_factory = mrcp_resource_factory_get(resource_loader);
- return mrcp_client_resource_factory_register(loader->client,resource_factory);
-}
-
-/** Load SofiaSIP signaling agent */
-static apt_bool_t unimrcp_client_sip_uac_load(unimrcp_client_loader_t *loader, const apr_xml_elem *root, const char *id)
-{
- const apr_xml_elem *elem;
- mrcp_sig_agent_t *agent;
- mrcp_sofia_client_config_t *config;
-
- config = mrcp_sofiasip_client_config_alloc(loader->pool);
- config->local_port = DEFAULT_SIP_PORT;
- config->user_agent_name = DEFAULT_SOFIASIP_UA_NAME;
- config->origin = DEFAULT_SDP_ORIGIN;
-
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading SofiaSIP Agent <%s>",id);
- for(elem = root->first_child; elem; elem = elem->next) {
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Element <%s>",elem->name);
- if(strcasecmp(elem->name,"sip-ip") == 0) {
- config->local_ip = unimrcp_client_ip_address_get(loader,elem,loader->ip);
- }
- else if(strcasecmp(elem->name,"sip-ext-ip") == 0) {
- config->ext_ip = unimrcp_client_ip_address_get(loader,elem,loader->ext_ip);
- }
- else if(strcasecmp(elem->name,"sip-port") == 0) {
- if(is_cdata_valid(elem) == TRUE) {
- config->local_port = (apr_port_t)atol(cdata_text_get(elem));
- }
- }
- else if(strcasecmp(elem->name,"sip-transport") == 0) {
- if(is_cdata_valid(elem) == TRUE) {
- config->transport = cdata_copy(elem,loader->pool);
- }
- }
- else if(strcasecmp(elem->name,"ua-name") == 0) {
- if(is_cdata_valid(elem) == TRUE) {
- const apr_xml_attr *attr = NULL;
- for(attr = elem->attr; attr; attr = attr->next) {
- if(strcasecmp(attr->name,"appendversion") == 0) {
- break;
- }
- }
- if(is_attr_enabled(attr)) {
- config->user_agent_name = apr_psprintf(loader->pool,"%s "UNI_VERSION_STRING,cdata_text_get(elem));
- }
- else {
- config->user_agent_name = cdata_copy(elem,loader->pool);
- }
- }
- }
- else if(strcasecmp(elem->name,"sdp-origin") == 0) {
- if(is_cdata_valid(elem) == TRUE) {
- config->origin = cdata_copy(elem,loader->pool);
- }
- }
- else if(strcasecmp(elem->name,"sip-t1") == 0) {
- if(is_cdata_valid(elem) == TRUE) {
- config->sip_t1 = atol(cdata_text_get(elem));
- }
- }
- else if(strcasecmp(elem->name,"sip-t2") == 0) {
- if(is_cdata_valid(elem) == TRUE) {
- config->sip_t2 = atol(cdata_text_get(elem));
- }
- }
- else if(strcasecmp(elem->name,"sip-t4") == 0) {
- if(is_cdata_valid(elem) == TRUE) {
- config->sip_t4 = atol(cdata_text_get(elem));
- }
- }
- else if(strcasecmp(elem->name,"sip-t1x64") == 0) {
- if(is_cdata_valid(elem) == TRUE) {
- config->sip_t1x64 = atol(cdata_text_get(elem));
- }
- }
- else if(strcasecmp(elem->name,"sip-message-output") == 0) {
- if(is_cdata_valid(elem) == TRUE) {
- config->tport_log = cdata_bool_get(elem);
- }
- }
- else if(strcasecmp(elem->name,"sip-message-dump") == 0) {
- if(is_cdata_valid(elem) == TRUE) {
- const char *root_path;
- const char *path = cdata_text_get(elem);
- if(loader->dir_layout && apr_filepath_root(&root_path,&path,0,loader->pool) == APR_ERELATIVE)
- config->tport_dump_file = apt_dir_layout_path_compose(
- loader->dir_layout,
- APT_LAYOUT_LOG_DIR,
- path,
- loader->pool);
- else
- config->tport_dump_file = cdata_copy(elem,loader->pool);
- }
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name);
- }
- }
-
- if(!config->local_ip) {
- /* use default IP address if not specified */
- config->local_ip = apr_pstrdup(loader->pool,loader->ip);
- }
- if(!config->ext_ip && loader->ext_ip) {
- /* use default ext IP address if not specified */
- config->ext_ip = apr_pstrdup(loader->pool,loader->ext_ip);
- }
-
- agent = mrcp_sofiasip_client_agent_create(id,config,loader->pool);
- return mrcp_client_signaling_agent_register(loader->client,agent);
-}
-
-/** Load UniRTSP signaling agent */
-static apt_bool_t unimrcp_client_rtsp_uac_load(unimrcp_client_loader_t *loader, const apr_xml_elem *root, const char *id)
-{
- const apr_xml_elem *elem;
- mrcp_sig_agent_t *agent;
- rtsp_client_config_t *config;
-
- config = mrcp_unirtsp_client_config_alloc(loader->pool);
- config->origin = DEFAULT_SDP_ORIGIN;
-
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading UniRTSP Agent <%s>",id);
- for(elem = root->first_child; elem; elem = elem->next) {
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Element <%s>",elem->name);
- if(strcasecmp(elem->name,"sdp-origin") == 0) {
- if(is_cdata_valid(elem) == TRUE) {
- config->origin = cdata_copy(elem,loader->pool);
- }
- }
- else if(strcasecmp(elem->name,"max-connection-count") == 0) {
- if(is_cdata_valid(elem) == TRUE) {
- config->max_connection_count = atol(cdata_text_get(elem));
- }
- }
- else if(strcasecmp(elem->name,"request-timeout") == 0) {
- if(is_cdata_valid(elem) == TRUE) {
- config->request_timeout = atol(cdata_text_get(elem));
- }
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name);
- }
- }
-
- agent = mrcp_unirtsp_client_agent_create(id,config,loader->pool);
- return mrcp_client_signaling_agent_register(loader->client,agent);
-}
-
-/** Load MRCPv2 connection agent */
-static apt_bool_t unimrcp_client_mrcpv2_uac_load(unimrcp_client_loader_t *loader, const apr_xml_elem *root, const char *id)
-{
- const apr_xml_elem *elem;
- mrcp_connection_agent_t *agent;
- apr_size_t max_connection_count = 100;
- apt_bool_t offer_new_connection = FALSE;
- const char *rx_buffer_size = NULL;
- const char *tx_buffer_size = NULL;
- const char *request_timeout = NULL;
-
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading MRCPv2 Agent <%s>",id);
- for(elem = root->first_child; elem; elem = elem->next) {
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Element <%s>",elem->name);
- if(strcasecmp(elem->name,"max-connection-count") == 0) {
- if(is_cdata_valid(elem) == TRUE) {
- max_connection_count = atol(cdata_text_get(elem));
- }
- }
- else if(strcasecmp(elem->name,"offer-new-connection") == 0) {
- if(is_cdata_valid(elem) == TRUE) {
- offer_new_connection = cdata_bool_get(elem);
- }
- }
- else if(strcasecmp(elem->name,"rx-buffer-size") == 0) {
- if(is_cdata_valid(elem) == TRUE) {
- rx_buffer_size = cdata_text_get(elem);
- }
- }
- else if(strcasecmp(elem->name,"tx-buffer-size") == 0) {
- if(is_cdata_valid(elem) == TRUE) {
- tx_buffer_size = cdata_text_get(elem);
- }
- }
- else if(strcasecmp(elem->name,"request-timeout") == 0) {
- if(is_cdata_valid(elem) == TRUE) {
- request_timeout = cdata_text_get(elem);
- }
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name);
- }
- }
-
- agent = mrcp_client_connection_agent_create(id,max_connection_count,offer_new_connection,loader->pool);
- if(agent) {
- if(rx_buffer_size) {
- mrcp_client_connection_rx_size_set(agent,atol(rx_buffer_size));
- }
- if(tx_buffer_size) {
- mrcp_client_connection_tx_size_set(agent,atol(tx_buffer_size));
- }
- if(request_timeout) {
- mrcp_client_connection_timeout_set(agent,atol(request_timeout));
- }
- }
- return mrcp_client_connection_agent_register(loader->client,agent);
-}
-
-/** Load media engine */
-static apt_bool_t unimrcp_client_media_engine_load(unimrcp_client_loader_t *loader, const apr_xml_elem *root, const char *id)
-{
- const apr_xml_elem *elem;
- mpf_engine_t *media_engine;
- unsigned long realtime_rate = 1;
-
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Media Engine <%s>",id);
- for(elem = root->first_child; elem; elem = elem->next) {
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Element <%s>",elem->name);
- if(strcasecmp(elem->name,"realtime-rate") == 0) {
- if(is_cdata_valid(elem) == TRUE) {
- realtime_rate = atol(cdata_text_get(elem));
- }
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name);
- }
- }
-
- media_engine = mpf_engine_create(id,loader->pool);
- if(media_engine) {
- mpf_engine_scheduler_rate_set(media_engine,realtime_rate);
- }
- return mrcp_client_media_engine_register(loader->client,media_engine);
-}
-
-/** Load RTP factory */
-static apt_bool_t unimrcp_client_rtp_factory_load(unimrcp_client_loader_t *loader, const apr_xml_elem *root, const char *id)
-{
- const apr_xml_elem *elem;
- char *rtp_ip = NULL;
- char *rtp_ext_ip = NULL;
- mpf_termination_factory_t *rtp_factory;
- mpf_rtp_config_t *rtp_config;
-
- rtp_config = mpf_rtp_config_alloc(loader->pool);
- rtp_config->rtp_port_min = DEFAULT_RTP_PORT_MIN;
- rtp_config->rtp_port_max = DEFAULT_RTP_PORT_MAX;
-
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading RTP Factory <%s>",id);
- for(elem = root->first_child; elem; elem = elem->next) {
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Element <%s>",elem->name);
- if(strcasecmp(elem->name,"rtp-ip") == 0) {
- rtp_ip = unimrcp_client_ip_address_get(loader,elem,loader->ip);
- }
- else if(strcasecmp(elem->name,"rtp-ext-ip") == 0) {
- rtp_ext_ip = unimrcp_client_ip_address_get(loader,elem,loader->ext_ip);
- }
- else if(strcasecmp(elem->name,"rtp-port-min") == 0) {
- if(is_cdata_valid(elem) == TRUE) {
- rtp_config->rtp_port_min = (apr_port_t)atol(cdata_text_get(elem));
- }
- }
- else if(strcasecmp(elem->name,"rtp-port-max") == 0) {
- if(is_cdata_valid(elem) == TRUE) {
- rtp_config->rtp_port_max = (apr_port_t)atol(cdata_text_get(elem));
- }
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name);
- }
- }
-
- if(rtp_ip) {
- apt_string_set(&rtp_config->ip,rtp_ip);
- }
- else {
- apt_string_set(&rtp_config->ip,loader->ip);
- }
- if(rtp_ext_ip) {
- apt_string_set(&rtp_config->ext_ip,rtp_ext_ip);
- }
- else if(loader->ext_ip){
- apt_string_set(&rtp_config->ext_ip,loader->ext_ip);
- }
-
- rtp_factory = mpf_rtp_termination_factory_create(rtp_config,loader->pool);
- return mrcp_client_rtp_factory_register(loader->client,rtp_factory,id);
-}
-
-
-/** Load SIP settings */
-static apt_bool_t unimrcp_client_sip_settings_load(unimrcp_client_loader_t *loader, const apr_xml_elem *root, const char *id)
-{
- const apr_xml_elem *elem;
- mrcp_sig_settings_t *settings = mrcp_signaling_settings_alloc(loader->pool);
-
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading SIP Settings <%s>",id);
- for(elem = root->first_child; elem; elem = elem->next) {
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Element <%s>",elem->name);
- if(strcasecmp(elem->name,"server-ip") == 0) {
- settings->server_ip = unimrcp_client_ip_address_get(loader,elem,loader->server_ip);
- }
- else if(strcasecmp(elem->name,"server-port") == 0) {
- if(is_cdata_valid(elem) == TRUE) {
- settings->server_port = (apr_port_t)atol(cdata_text_get(elem));
- }
- }
- else if(strcasecmp(elem->name,"server-username") == 0) {
- if(is_cdata_valid(elem) == TRUE) {
- settings->user_name = cdata_copy(elem,loader->pool);
- }
- }
- else if(strcasecmp(elem->name,"force-destination") == 0) {
- if(is_cdata_valid(elem) == TRUE) {
- settings->force_destination = cdata_bool_get(elem);
- }
- }
- else if(strcasecmp(elem->name,"feature-tags") == 0) {
- if(is_cdata_valid(elem) == TRUE) {
- settings->feature_tags = cdata_copy(elem,loader->pool);
- }
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name);
- }
- }
-
- if(!settings->server_ip) {
- settings->server_ip = apr_pstrdup(loader->pool,loader->server_ip);
- }
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Create SIP Settings %s:%hu",settings->server_ip,settings->server_port);
- return mrcp_client_signaling_settings_register(loader->client,settings,id);
-}
-
-/** Load RTSP settings */
-static apt_bool_t unimrcp_client_rtsp_settings_load(unimrcp_client_loader_t *loader, const apr_xml_elem *root, const char *id)
-{
- const apr_xml_elem *elem;
- mrcp_sig_settings_t *settings = mrcp_signaling_settings_alloc(loader->pool);
- settings->resource_location = DEFAULT_RESOURCE_LOCATION;
-
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading RTSP Settings <%s>",id);
- for(elem = root->first_child; elem; elem = elem->next) {
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Element <%s>",elem->name);
- if(strcasecmp(elem->name,"server-ip") == 0) {
- settings->server_ip = unimrcp_client_ip_address_get(loader,elem,loader->server_ip);
- }
- else if(strcasecmp(elem->name,"server-port") == 0) {
- if(is_cdata_valid(elem) == TRUE) {
- settings->server_port = (apr_port_t)atol(cdata_text_get(elem));
- }
- }
- else if(strcasecmp(elem->name,"force-destination") == 0) {
- if(is_cdata_valid(elem) == TRUE) {
- settings->force_destination = cdata_bool_get(elem);
- }
- }
- else if(strcasecmp(elem->name,"resource-location") == 0) {
- if(is_cdata_valid(elem) == TRUE) {
- settings->resource_location = cdata_copy(elem,loader->pool);
- }
- else {
- settings->resource_location = "";
- }
- }
- else if(strcasecmp(elem->name,"resource-map") == 0) {
- const apr_xml_attr *name_attr;
- const apr_xml_attr *value_attr;
- const apr_xml_elem *child_elem;
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Resource Map");
- for(child_elem = elem->first_child; child_elem; child_elem = child_elem->next) {
- if(name_value_attribs_get(child_elem,&name_attr,&value_attr) == TRUE) {
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Param %s:%s",name_attr->value,value_attr->value);
- apr_table_set(settings->resource_map,name_attr->value,value_attr->value);
- }
- }
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name);
- }
- }
-
- if(!settings->server_ip) {
- settings->server_ip = apr_pstrdup(loader->pool,loader->server_ip);
- }
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Create RTSP Settings %s:%hu",settings->server_ip,settings->server_port);
- return mrcp_client_signaling_settings_register(loader->client,settings,id);
-}
-
-/** Load jitter buffer settings */
-static apt_bool_t unimrcp_client_jb_settings_load(unimrcp_client_loader_t *loader, mpf_jb_config_t *jb, const apr_xml_elem *root)
-{
- const apr_xml_elem *elem;
-
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Jitter Buffer Settings");
- for(elem = root->first_child; elem; elem = elem->next) {
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Element <%s>",elem->name);
- if(strcasecmp(elem->name,"playout-delay") == 0) {
- if(is_cdata_valid(elem) == TRUE) {
- jb->initial_playout_delay = atol(cdata_text_get(elem));
- }
- }
- else if(strcasecmp(elem->name,"min-playout-delay") == 0) {
- if(is_cdata_valid(elem) == TRUE) {
- jb->min_playout_delay = atol(cdata_text_get(elem));
- }
- }
- else if(strcasecmp(elem->name,"max-playout-delay") == 0) {
- if(is_cdata_valid(elem) == TRUE) {
- jb->max_playout_delay = atol(cdata_text_get(elem));
- }
- }
- else if(strcasecmp(elem->name,"adaptive") == 0) {
- if(is_cdata_valid(elem) == TRUE) {
- jb->adaptive = (apr_byte_t) atol(cdata_text_get(elem));
- }
- }
- else if(strcasecmp(elem->name,"time-skew-detection") == 0) {
- if(is_cdata_valid(elem) == TRUE) {
- jb->time_skew_detection = (apr_byte_t) atol(cdata_text_get(elem));
- }
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name);
- }
- }
- return TRUE;
-}
-
-/** Load RTCP settings */
-static apt_bool_t unimrcp_client_rtcp_settings_load(unimrcp_client_loader_t *loader, mpf_rtp_settings_t *rtcp_settings, const apr_xml_elem *root)
-{
- const apr_xml_elem *elem;
- const apr_xml_attr *attr = NULL;
- for(attr = root->attr; attr; attr = attr->next) {
- if(strcasecmp(attr->name,"enable") == 0) {
- break;
- }
- }
-
- if(is_attr_enabled(attr) == FALSE) {
- /* RTCP is disabled, skip the rest */
- return TRUE;
- }
-
- rtcp_settings->rtcp = TRUE;
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading RTCP Settings");
- for(elem = root->first_child; elem; elem = elem->next) {
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Element <%s>",elem->name);
- if(strcasecmp(elem->name,"rtcp-bye") == 0) {
- if(is_cdata_valid(elem) == TRUE) {
- rtcp_settings->rtcp_bye_policy = atoi(cdata_text_get(elem));
- }
- }
- else if(strcasecmp(elem->name,"tx-interval") == 0) {
- if(is_cdata_valid(elem) == TRUE) {
- rtcp_settings->rtcp_tx_interval = (apr_uint16_t)atoi(cdata_text_get(elem));
- }
- }
- else if(strcasecmp(elem->name,"rx-resolution") == 0) {
- if(is_cdata_valid(elem) == TRUE) {
- rtcp_settings->rtcp_rx_resolution = (apr_uint16_t)atol(cdata_text_get(elem));
- }
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name);
- }
- }
- return TRUE;
-}
-
-/** Load RTP settings */
-static apt_bool_t unimrcp_client_rtp_settings_load(unimrcp_client_loader_t *loader, const apr_xml_elem *root, const char *id)
-{
- const apr_xml_elem *elem;
- mpf_rtp_settings_t *rtp_settings = mpf_rtp_settings_alloc(loader->pool);
-
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading RTP Settings <%s>",id);
- for(elem = root->first_child; elem; elem = elem->next) {
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Element <%s>",elem->name);
- if(strcasecmp(elem->name,"jitter-buffer") == 0) {
- unimrcp_client_jb_settings_load(loader,&rtp_settings->jb_config,elem);
- }
- else if(strcasecmp(elem->name,"ptime") == 0) {
- if(is_cdata_valid(elem) == TRUE) {
- rtp_settings->ptime = (apr_uint16_t)atol(cdata_text_get(elem));
- }
- }
- else if(strcasecmp(elem->name,"codecs") == 0) {
- const mpf_codec_manager_t *codec_manager = mrcp_client_codec_manager_get(loader->client);
- if(is_cdata_valid(elem) == TRUE && codec_manager) {
- mpf_codec_manager_codec_list_load(
- codec_manager,
- &rtp_settings->codec_list,
- cdata_text_get(elem),
- loader->pool);
- }
- }
- else if(strcasecmp(elem->name,"rtcp") == 0) {
- unimrcp_client_rtcp_settings_load(loader,rtp_settings,elem);
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name);
- }
- }
-
- return mrcp_client_rtp_settings_register(loader->client,rtp_settings,id);
-}
-
-/** Create factory of signaling agents */
-static mrcp_sa_factory_t* unimrcp_client_sa_factory_create(unimrcp_client_loader_t *loader, const apr_xml_elem *elem)
-{
- mrcp_sa_factory_t *sa_factory = NULL;
- mrcp_sig_agent_t *sig_agent;
- char *uac_name;
- char *state;
- char *uac_list_str = apr_pstrdup(loader->pool,cdata_text_get(elem));
- do {
- uac_name = apr_strtok(uac_list_str, ",", &state);
- if(uac_name) {
- sig_agent = mrcp_client_signaling_agent_get(loader->client,uac_name);
- if(sig_agent) {
- if(!sa_factory)
- sa_factory = mrcp_sa_factory_create(loader->pool);
-
- mrcp_sa_factory_agent_add(sa_factory,sig_agent);
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown UAC Name <%s>",uac_name);
- }
- }
- uac_list_str = NULL; /* make sure we pass NULL on subsequent calls of apr_strtok() */
- }
- while(uac_name);
- return sa_factory;
-}
-
-/** Create factory of MRCPv2 connection agents */
-static mrcp_ca_factory_t* unimrcp_client_ca_factory_create(unimrcp_client_loader_t *loader, const apr_xml_elem *elem)
-{
- mrcp_ca_factory_t *ca_factory = NULL;
- mrcp_connection_agent_t *agent;
- char *name;
- char *state;
- char *list_str = apr_pstrdup(loader->pool,cdata_text_get(elem));
- do {
- name = apr_strtok(list_str, ",", &state);
- if(name) {
- agent = mrcp_client_connection_agent_get(loader->client,name);
- if(agent) {
- if(!ca_factory)
- ca_factory = mrcp_ca_factory_create(loader->pool);
-
- mrcp_ca_factory_agent_add(ca_factory,agent);
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown MRCPv2-UAC Name <%s>",name);
- }
- }
- list_str = NULL; /* make sure we pass NULL on subsequent calls of apr_strtok() */
- }
- while(name);
- return ca_factory;
-}
-
-/** Create factory of media engines */
-static mpf_engine_factory_t* unimrcp_client_mpf_factory_create(unimrcp_client_loader_t *loader, const apr_xml_elem *elem)
-{
- mpf_engine_factory_t *mpf_factory = NULL;
- mpf_engine_t *media_engine;
-
- char *name;
- char *state;
- char *list_str = apr_pstrdup(loader->pool,cdata_text_get(elem));
- do {
- name = apr_strtok(list_str, ",", &state);
- if(name) {
- media_engine = mrcp_client_media_engine_get(loader->client,name);
- if(media_engine) {
- if(!mpf_factory)
- mpf_factory = mpf_engine_factory_create(loader->pool);
-
- mpf_engine_factory_engine_add(mpf_factory,media_engine);
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Media Engine Name <%s>",name);
- }
- }
- list_str = NULL; /* make sure we pass NULL on subsequent calls of apr_strtok() */
- }
- while(name);
-
- return mpf_factory;
-}
-
-/** Load MRCPv2 profile */
-static apt_bool_t unimrcp_client_mrcpv2_profile_load(unimrcp_client_loader_t *loader, const apr_xml_elem *root, const char *id, const char *tag)
-{
- const apr_xml_elem *elem;
- mrcp_client_profile_t *profile;
- mrcp_sa_factory_t *sa_factory = NULL;
- mrcp_ca_factory_t *ca_factory = NULL;
- mpf_engine_factory_t *mpf_factory = NULL;
- mpf_termination_factory_t *rtp_factory = NULL;
- mpf_rtp_settings_t *rtp_settings = NULL;
- mrcp_sig_settings_t *sip_settings = NULL;
-
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading MRCPv2 Profile <%s>",id);
- for(elem = root->first_child; elem; elem = elem->next) {
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Element <%s>",elem->name);
-
- if(is_cdata_valid(elem) == FALSE) {
- continue;
- }
-
- if(strcasecmp(elem->name,"sip-uac") == 0) {
- sa_factory = unimrcp_client_sa_factory_create(loader,elem);
- }
- else if(strcasecmp(elem->name,"mrcpv2-uac") == 0) {
- ca_factory = unimrcp_client_ca_factory_create(loader,elem);
- }
- else if(strcasecmp(elem->name,"media-engine") == 0) {
- mpf_factory = unimrcp_client_mpf_factory_create(loader,elem);
- }
- else if(strcasecmp(elem->name,"rtp-factory") == 0) {
- rtp_factory = mrcp_client_rtp_factory_get(loader->client,cdata_text_get(elem));
- }
- else if(strcasecmp(elem->name,"sip-settings") == 0) {
- sip_settings = mrcp_client_signaling_settings_get(loader->client,cdata_text_get(elem));
- }
- else if(strcasecmp(elem->name,"rtp-settings") == 0) {
- rtp_settings = mrcp_client_rtp_settings_get(loader->client,cdata_text_get(elem));
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name);
- }
- }
-
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create MRCPv2 Profile [%s]",id);
- profile = mrcp_client_profile_create_ex(
- MRCP_VERSION_2,NULL,
- sa_factory,ca_factory,
- mpf_factory,rtp_factory,
- rtp_settings,sip_settings,
- loader->pool);
- if(tag) {
- mrcp_client_profile_tag_set(profile,tag);
- }
- return mrcp_client_profile_register(loader->client,profile,id);
-}
-
-/** Load MRCPv1 profile */
-static apt_bool_t unimrcp_client_mrcpv1_profile_load(unimrcp_client_loader_t *loader, const apr_xml_elem *root, const char *id, const char *tag)
-{
- const apr_xml_elem *elem;
- mrcp_client_profile_t *profile;
- mrcp_sa_factory_t *sa_factory = NULL;
- mpf_engine_factory_t *mpf_factory = NULL;
- mpf_termination_factory_t *rtp_factory = NULL;
- mpf_rtp_settings_t *rtp_settings = NULL;
- mrcp_sig_settings_t *rtsp_settings = NULL;
-
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading MRCPv1 Profile <%s>",id);
- for(elem = root->first_child; elem; elem = elem->next) {
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Element <%s>",elem->name);
-
- if(is_cdata_valid(elem) == FALSE) {
- continue;
- }
-
- if(strcasecmp(elem->name,"rtsp-uac") == 0) {
- sa_factory = unimrcp_client_sa_factory_create(loader,elem);
- }
- else if(strcasecmp(elem->name,"media-engine") == 0) {
- mpf_factory = unimrcp_client_mpf_factory_create(loader,elem);
- }
- else if(strcasecmp(elem->name,"rtp-factory") == 0) {
- rtp_factory = mrcp_client_rtp_factory_get(loader->client,cdata_text_get(elem));
- }
- else if(strcasecmp(elem->name,"rtsp-settings") == 0) {
- rtsp_settings = mrcp_client_signaling_settings_get(loader->client,cdata_text_get(elem));
- }
- else if(strcasecmp(elem->name,"rtp-settings") == 0) {
- rtp_settings = mrcp_client_rtp_settings_get(loader->client,cdata_text_get(elem));
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name);
- }
- }
-
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create MRCPv1 Profile [%s]",id);
- profile = mrcp_client_profile_create_ex(
- MRCP_VERSION_1,
- NULL,sa_factory,NULL,
- mpf_factory,rtp_factory,
- rtp_settings,rtsp_settings,
- loader->pool);
- if(tag) {
- mrcp_client_profile_tag_set(profile,tag);
- }
- return mrcp_client_profile_register(loader->client,profile,id);
-}
-
-
-/** Load properties */
-static apt_bool_t unimrcp_client_properties_load(unimrcp_client_loader_t *loader, const apr_xml_elem *root)
-{
- const apr_xml_elem *elem;
-
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Properties");
- for(elem = root->first_child; elem; elem = elem->next) {
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Element <%s>",elem->name);
- if(strcasecmp(elem->name,"ip") == 0) {
- loader->ip = unimrcp_client_ip_address_get(loader,elem,DEFAULT_IP_ADDRESS);
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set Property ip:%s",loader->ip);
- }
- else if(strcasecmp(elem->name,"ext-ip") == 0) {
- loader->ext_ip = unimrcp_client_ip_address_get(loader,elem,DEFAULT_IP_ADDRESS);
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set Property ext-ip:%s",loader->ext_ip);
- }
- else if(strcasecmp(elem->name,"server-ip") == 0) {
- loader->server_ip = unimrcp_client_ip_address_get(loader,elem,DEFAULT_IP_ADDRESS);
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set Property server-ip:%s",loader->server_ip);
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name);
- }
- }
-
- if(!loader->ip) {
- loader->ip = DEFAULT_IP_ADDRESS;
- }
- if(!loader->server_ip) {
- loader->server_ip = loader->ip;
- }
- return TRUE;
-}
-
-/** Load components */
-static apt_bool_t unimrcp_client_components_load(unimrcp_client_loader_t *loader, const apr_xml_elem *root)
-{
- const apr_xml_elem *elem;
- const apr_xml_attr *id_attr;
- const apr_xml_attr *enable_attr;
- const char *id;
-
- /* Create codec manager first (probably it should be loaded from config either) */
- mpf_codec_manager_t *codec_manager = mpf_engine_codec_manager_create(loader->pool);
- if(codec_manager) {
- mrcp_client_codec_manager_register(loader->client,codec_manager);
- }
-
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Components");
- for(elem = root->first_child; elem; elem = elem->next) {
- if(strcasecmp(elem->name,"resource-factory") == 0) {
- unimrcp_client_resource_factory_load(loader,elem);
- continue;
- }
-
- /* get common "id" and "enable" attributes */
- if(header_attribs_get(elem,&id_attr,&enable_attr) == FALSE) {
- /* invalid id */
- continue;
- }
- if(is_attr_enabled(enable_attr) == FALSE) {
- /* disabled element, just skip it */
- continue;
- }
- id = apr_pstrdup(loader->pool,id_attr->value);
-
- if(strcasecmp(elem->name,"sip-uac") == 0) {
- unimrcp_client_sip_uac_load(loader,elem,id);
- }
- else if(strcasecmp(elem->name,"rtsp-uac") == 0) {
- unimrcp_client_rtsp_uac_load(loader,elem,id);
- }
- else if(strcasecmp(elem->name,"mrcpv2-uac") == 0) {
- unimrcp_client_mrcpv2_uac_load(loader,elem,id);
- }
- else if(strcasecmp(elem->name,"media-engine") == 0) {
- unimrcp_client_media_engine_load(loader,elem,id);
- }
- else if(strcasecmp(elem->name,"rtp-factory") == 0) {
- unimrcp_client_rtp_factory_load(loader,elem,id);
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name);
- }
- }
- return TRUE;
-}
-
-/** Load settings */
-static apt_bool_t unimrcp_client_settings_load(unimrcp_client_loader_t *loader, const apr_xml_elem *root)
-{
- const apr_xml_elem *elem;
- const apr_xml_attr *id_attr;
- const apr_xml_attr *enable_attr;
- const char *id;
-
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Settings");
- for(elem = root->first_child; elem; elem = elem->next) {
- /* get common "id" and "enable" attributes */
- if(header_attribs_get(elem,&id_attr,&enable_attr) == FALSE) {
- /* invalid id */
- continue;
- }
- if(is_attr_enabled(enable_attr) == FALSE) {
- /* disabled element, just skip it */
- continue;
- }
- id = apr_pstrdup(loader->pool,id_attr->value);
-
- if(strcasecmp(elem->name,"sip-settings") == 0) {
- unimrcp_client_sip_settings_load(loader,elem,id);
- }
- else if(strcasecmp(elem->name,"rtsp-settings") == 0) {
- unimrcp_client_rtsp_settings_load(loader,elem,id);
- }
- else if(strcasecmp(elem->name,"rtp-settings") == 0) {
- unimrcp_client_rtp_settings_load(loader,elem,id);
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name);
- }
- }
- return TRUE;
-}
-
-/** Load profiles */
-static apt_bool_t unimrcp_client_profiles_load(unimrcp_client_loader_t *loader, const apr_xml_elem *root)
-{
- const apr_xml_elem *elem;
- const apr_xml_attr *id_attr;
- const apr_xml_attr *enable_attr;
- const apr_xml_attr *tag_attr;
- const char *id;
- const char *tag;
-
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Profiles");
- for(elem = root->first_child; elem; elem = elem->next) {
- /* get common "id" and "enable" attributes */
- if(profile_attribs_get(elem,&id_attr,&enable_attr,&tag_attr) == FALSE) {
- /* invalid id */
- continue;
- }
- if(is_attr_enabled(enable_attr) == FALSE) {
- /* disabled element, just skip it */
- continue;
- }
- id = apr_pstrdup(loader->pool,id_attr->value);
- tag = tag_attr ? apr_pstrdup(loader->pool,tag_attr->value) : NULL;
-
- if(strcasecmp(elem->name,"mrcpv2-profile") == 0) {
- unimrcp_client_mrcpv2_profile_load(loader,elem,id,tag);
- }
- else if(strcasecmp(elem->name,"mrcpv1-profile") == 0) {
- unimrcp_client_mrcpv1_profile_load(loader,elem,id,tag);
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name);
- }
- }
- return TRUE;
-}
-
-/** Load misc parameters */
-static apt_bool_t unimrcp_client_misc_load(unimrcp_client_loader_t *loader, const apr_xml_elem *root)
-{
- const apr_xml_elem *elem;
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Misc Parameters");
- for(elem = root->first_child; elem; elem = elem->next) {
- if(strcasecmp(elem->name,"sofiasip-logger") == 0) {
- char *logger_list_str;
- char *logger_name;
- char *state;
- apr_xml_attr *attr;
- apt_bool_t redirect = FALSE;
- const char *loglevel_str = NULL;
- for(attr = elem->attr; attr; attr = attr->next) {
- if(strcasecmp(attr->name,"redirect") == 0) {
- if(attr->value && strcasecmp(attr->value,"true") == 0)
- redirect = TRUE;
- }
- else if(strcasecmp(attr->name,"loglevel") == 0) {
- loglevel_str = attr->value;
- }
- }
-
- logger_list_str = apr_pstrdup(loader->pool,cdata_text_get(elem));
- do {
- logger_name = apr_strtok(logger_list_str, ",", &state);
- if(logger_name) {
- mrcp_sofiasip_client_logger_init(logger_name,loglevel_str,redirect);
- }
- logger_list_str = NULL; /* make sure we pass NULL on subsequent calls of apr_strtok() */
- }
- while(logger_name);
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name);
- }
- }
- return TRUE;
-}
-
-/** Parse XML document */
-static apr_xml_doc* unimrcp_client_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;
-
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Open Config File [%s]",file_path);
- rv = apr_file_open(&fd,file_path,APR_READ|APR_BINARY,0,pool);
- if(rv != APR_SUCCESS) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Open Config File [%s]",file_path);
- return NULL;
- }
-
- rv = apr_xml_parse_file(pool,&parser,&xml_doc,fd,XML_FILE_BUFFER_LENGTH);
- if(rv != APR_SUCCESS) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Parse Config File [%s]",file_path);
- xml_doc = NULL;
- }
-
- apr_file_close(fd);
- return xml_doc;
-}
-
-/** Process parsed XML document */
-static apt_bool_t unimrcp_client_doc_process(unimrcp_client_loader_t *loader, const char *dir_path, apr_xml_doc *doc, apr_pool_t *pool)
-{
- const apr_xml_elem *elem;
- const apr_xml_elem *root;
- const apr_xml_attr *attr;
- const char *version = NULL;
- const char *subfolder = NULL;
-
- if(!doc) {
- return FALSE;
- }
-
- root = doc->root;
-
- /* Match document name */
- if(!root || strcasecmp(root->name,"unimrcpclient") != 0) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Document <%s>",root ? root->name : "null");
- return FALSE;
- }
-
- /* Read attributes */
- for(attr = root->attr; attr; attr = attr->next) {
- if(strcasecmp(attr->name,"version") == 0) {
- version = attr->value;
- }
- else if(strcasecmp(attr->name,"subfolder") == 0) {
- subfolder = attr->value;
- }
- }
-
- /* Check version number first */
- if(!version) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Version");
- return FALSE;
- }
-
- loader->doc = doc;
-
- /* Navigate through document */
- for(elem = root->first_child; elem; elem = elem->next) {
- if(strcasecmp(elem->name,"properties") == 0) {
- unimrcp_client_properties_load(loader,elem);
- }
- else if(strcasecmp(elem->name,"components") == 0) {
- unimrcp_client_components_load(loader,elem);
- }
- else if(strcasecmp(elem->name,"settings") == 0) {
- unimrcp_client_settings_load(loader,elem);
- }
- else if(strcasecmp(elem->name,"profiles") == 0) {
- unimrcp_client_profiles_load(loader,elem);
- }
- else if(strcasecmp(elem->name,"misc") == 0) {
- unimrcp_client_misc_load(loader,elem);
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name);
- }
- }
-
- if(subfolder && *subfolder != '\0') {
- apr_dir_t *dir;
- apr_finfo_t finfo;
- apr_status_t rv;
- char *subdir_path;
-
- if (!dir_path) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Attempt to Process Subdirectory when "
- "Creating from Config String");
- return TRUE;
- }
-
- if(apr_filepath_merge(&subdir_path,dir_path,subfolder,APR_FILEPATH_NATIVE,pool) == APR_SUCCESS) {
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Enter Directory [%s]",subdir_path);
- rv = apr_dir_open(&dir,subdir_path,pool);
- if(rv == APR_SUCCESS) {
- while(apr_dir_read(&finfo, APR_FINFO_NAME, dir) == APR_SUCCESS) {
- if(apr_fnmatch("*.xml", finfo.name, 0) == APR_SUCCESS) {
- unimrcp_client_load(loader,subdir_path,finfo.name);
- }
- }
- apr_dir_close(dir);
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Leave Directory [%s]",dir_path);
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"No Such Directory %s",dir_path);
- }
- }
- }
- return TRUE;
-}
-
-/** Load UniMRCP client from file */
-static apt_bool_t unimrcp_client_load(unimrcp_client_loader_t *loader, const char *dir_path, const char *file_name)
-{
- apr_pool_t *pool = loader->pool;
- apr_xml_doc *doc;
- char *file_path;
-
- if(!dir_path || !file_name) {
- return FALSE;
- }
-
- if(apr_filepath_merge(&file_path,dir_path,file_name,APR_FILEPATH_NATIVE,pool) != APR_SUCCESS) {
- return FALSE;
- }
-
- /* Parse XML document */
- doc = unimrcp_client_doc_parse(file_path,pool);
- return unimrcp_client_doc_process(loader, dir_path, doc, pool);
-}
-
-/** Read configuration from string */
-static apt_bool_t unimrcp_client_load2(unimrcp_client_loader_t *loader, const char *xmlconfig)
-{
- apr_pool_t *pool = loader->pool;
- apr_xml_parser *parser;
- apr_xml_doc *xml_doc;
- char errbuf[4096];
- apr_status_t rv;
-
- parser = apr_xml_parser_create(pool);
- if (!parser) return FALSE;
- rv = apr_xml_parser_feed(parser, xmlconfig, strlen(xmlconfig));
- if (rv != APR_SUCCESS) {
- apr_xml_parser_geterror(parser, errbuf, sizeof(errbuf));
- apt_log(APT_LOG_MARK, APT_PRIO_ERROR, "Error parsing XML configuration: %d %pm: %s",
- rv, &rv, errbuf);
- return FALSE;
- }
- rv = apr_xml_parser_done(parser, &xml_doc);
- if (rv != APR_SUCCESS) {
- apr_xml_parser_geterror(parser, errbuf, sizeof(errbuf));
- apt_log(APT_LOG_MARK, APT_PRIO_ERROR, "Error parsing XML configuration: %d %pm: %s",
- rv, &rv, errbuf);
- return FALSE;
- }
- return unimrcp_client_doc_process(loader, NULL, xml_doc, pool);
-}
+++ /dev/null
-AM_CPPFLAGS = -I$(top_srcdir)/platforms/libunimrcp-server/include \
- $(UNIMRCP_SERVERLIB_INCLUDES)
-
-lib_LTLIBRARIES = libunimrcpserver.la
-
-include_HEADERS = include/unimrcp_server.h
-libunimrcpserver_la_SOURCES = src/unimrcp_server.c
-libunimrcpserver_la_LIBADD = $(UNIMRCP_SERVERLIB_LIBS)
-libunimrcpserver_la_LDFLAGS = $(UNIMRCP_SERVERLIB_OPTS)
-
-include $(top_srcdir)/build/rules/uniserverlib.am
+++ /dev/null
-/*
- * 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_server.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef UNIMRCP_SERVER_H
-#define UNIMRCP_SERVER_H
-
-/**
- * @file unimrcp_server.h
- * @brief UniMRCP Server
- */
-
-#include "mrcp_server.h"
-
-APT_BEGIN_EXTERN_C
-
-/**
- * Start UniMRCP server.
- * @param dir_layout the dir layout structure
- */
-MRCP_DECLARE(mrcp_server_t*) unimrcp_server_start(apt_dir_layout_t *dir_layout);
-
-/**
- * Shutdown UniMRCP server.
- * @param server the MRCP server to shutdown
- */
-MRCP_DECLARE(apt_bool_t) unimrcp_server_shutdown(mrcp_server_t *server);
-
-APT_END_EXTERN_C
-
-#endif /* UNIMRCP_SERVER_H */
+++ /dev/null
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="libunimrcpserver"
- ProjectGUID="{C98AF157-352E-4737-BD30-A24E2647F5AE}"
- RootNamespace="libunimrcpserver"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- <Platform
- Name="x64"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- ConfigurationType="4"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unilib.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpserver.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(ProjectRootDir)modules\mrcp-sofiasip\include";"$(ProjectRootDir)modules\mrcp-unirtsp\include""
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- ConfigurationType="4"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unilib.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpserver.vsprops"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(ProjectRootDir)modules\mrcp-sofiasip\include";"$(ProjectRootDir)modules\mrcp-unirtsp\include""
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|x64"
- ConfigurationType="4"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unilib-x64.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpserver.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(ProjectRootDir)modules\mrcp-sofiasip\include";"$(ProjectRootDir)modules\mrcp-unirtsp\include""
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|x64"
- ConfigurationType="4"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unilib-x64.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpserver.vsprops"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(ProjectRootDir)modules\mrcp-sofiasip\include";"$(ProjectRootDir)modules\mrcp-unirtsp\include""
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLibrarianTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="include"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- <File
- RelativePath="..\..\build\uni_revision.h"
- >
- </File>
- <File
- RelativePath="..\..\build\uni_version.h"
- >
- </File>
- <File
- RelativePath=".\include\unimrcp_server.h"
- >
- </File>
- </Filter>
- <Filter
- Name="src"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- >
- <File
- RelativePath=".\src\unimrcp_server.c"
- >
- </File>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{C98AF157-352E-4737-BD30-A24E2647F5AE}</ProjectGuid>
- <RootNamespace>libunimrcpserver</RootNamespace>
- <Keyword>Win32Proj</Keyword>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unilib.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unimrcpserver.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" />
- <Import Project="$(ProjectDir)..\..\build\props\unilib.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unimrcpserver.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unilib-x64.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unimrcpserver.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" />
- <Import Project="$(ProjectDir)..\..\build\props\unilib-x64.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unimrcpserver.props" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <AdditionalIncludeDirectories>$(ProjectRootDir)modules\mrcp-sofiasip\include;$(ProjectRootDir)modules\mrcp-unirtsp\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <AdditionalIncludeDirectories>$(ProjectRootDir)modules\mrcp-sofiasip\include;$(ProjectRootDir)modules\mrcp-unirtsp\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <AdditionalIncludeDirectories>$(ProjectRootDir)modules\mrcp-sofiasip\include;$(ProjectRootDir)modules\mrcp-unirtsp\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <AdditionalIncludeDirectories>$(ProjectRootDir)modules\mrcp-sofiasip\include;$(ProjectRootDir)modules\mrcp-unirtsp\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClInclude Include="..\..\build\uni_revision.h" />
- <ClInclude Include="..\..\build\uni_version.h" />
- <ClInclude Include="include\unimrcp_server.h" />
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="src\unimrcp_server.c" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\libs\mrcp-server\mrcpserver.vcxproj">
- <Project>{18b1f35a-10f8-4287-9b37-2d10501b0b38}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- <ProjectReference Include="..\..\modules\mrcp-sofiasip\mrcpsofiasip.vcxproj">
- <Project>{746f3632-5bb2-4570-9453-31d6d58a7d8e}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- <ProjectReference Include="..\..\modules\mrcp-unirtsp\mrcpunirtsp.vcxproj">
- <Project>{deb01acb-d65f-4a62-aed9-58c1054499e9}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="include">
- <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
- </Filter>
- <Filter Include="src">
- <UniqueIdentifier>{c164436d-b3de-474f-99bc-6b2ca1a4c879}</UniqueIdentifier>
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="..\..\build\uni_revision.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="..\..\build\uni_version.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\unimrcp_server.h">
- <Filter>include</Filter>
- </ClInclude>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="src\unimrcp_server.c">
- <Filter>src</Filter>
- </ClCompile>
- </ItemGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-/*
- * 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_server.c 2252 2014-11-21 02:45:15Z achaloyan@gmail.com $
- */
-
-#include <stdlib.h>
-#include <apr_xml.h>
-#include <apr_version.h>
-#include "uni_version.h"
-#include "uni_revision.h"
-#include "unimrcp_server.h"
-#include "mrcp_resource_loader.h"
-#include "mpf_engine.h"
-#include "mpf_codec_manager.h"
-#include "mpf_rtp_termination_factory.h"
-#include "mrcp_sofiasip_server_agent.h"
-#include "mrcp_unirtsp_server_agent.h"
-#include "mrcp_server_connection.h"
-#include "apt_net.h"
-#include "apt_log.h"
-
-#define CONF_FILE_NAME "unimrcpserver.xml"
-#ifdef WIN32
-#define DEFAULT_PLUGIN_EXT "dll"
-#else
-#define DEFAULT_PLUGIN_EXT "so"
-#endif
-
-#define DEFAULT_IP_ADDRESS "127.0.0.1"
-#define DEFAULT_SIP_PORT 8060
-#define DEFAULT_RTSP_PORT 1554
-#define DEFAULT_MRCP_PORT 1544
-#define DEFAULT_RTP_PORT_MIN 5000
-#define DEFAULT_RTP_PORT_MAX 6000
-
-#define DEFAULT_SOFIASIP_UA_NAME "UniMRCP SofiaSIP"
-#define DEFAULT_SDP_ORIGIN "UniMRCPServer"
-
-#define XML_FILE_BUFFER_LENGTH 16000
-
-/** UniMRCP server loader */
-typedef struct unimrcp_server_loader_t unimrcp_server_loader_t;
-
-/** UniMRCP server loader */
-struct unimrcp_server_loader_t {
- /** MRCP server */
- mrcp_server_t *server;
- /** Directory layout */
- apt_dir_layout_t *dir_layout;
- /** XML document */
- apr_xml_doc *doc;
- /** Pool to allocate memory from */
- apr_pool_t *pool;
-
- /** Default IP address (named property) */
- const char *ip;
- /** Default external (NAT) IP address (named property) */
- const char *ext_ip;
-
- /** Implicitly detected, cached IP address */
- const char *auto_ip;
-};
-
-static apt_bool_t unimrcp_server_load(mrcp_server_t *mrcp_server, apt_dir_layout_t *dir_layout, apr_pool_t *pool);
-
-/** Start UniMRCP server */
-MRCP_DECLARE(mrcp_server_t*) unimrcp_server_start(apt_dir_layout_t *dir_layout)
-{
- apr_pool_t *pool;
- mrcp_server_t *server;
-
- if(!dir_layout) {
- return NULL;
- }
-
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"UniMRCP Server ["UNI_VERSION_STRING"] [r"UNI_REVISION_STRING"]");
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"APR ["APR_VERSION_STRING"]");
- server = mrcp_server_create(dir_layout);
- if(!server) {
- return NULL;
- }
- pool = mrcp_server_memory_pool_get(server);
- if(!pool) {
- return NULL;
- }
-
- if(unimrcp_server_load(server,dir_layout,pool) == FALSE) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Load UniMRCP Server Document");
- }
-
- mrcp_server_start(server);
- return server;
-}
-
-/** Shutdown UniMRCP server */
-MRCP_DECLARE(apt_bool_t) unimrcp_server_shutdown(mrcp_server_t *server)
-{
- if(mrcp_server_shutdown(server) == FALSE) {
- return FALSE;
- }
- return mrcp_server_destroy(server);
-}
-
-
-/** Check whether specified attribute is valid */
-static APR_INLINE apt_bool_t is_attr_valid(const apr_xml_attr *attr)
-{
- return (attr && attr->value && *attr->value != '\0');
-}
-
-/** Check whether specified attribute is enabled (true) */
-static APR_INLINE apt_bool_t is_attr_enabled(const apr_xml_attr *attr)
-{
- if(attr && strcasecmp(attr->value,"false") == 0) {
- return FALSE;
- }
- return TRUE;
-}
-
-/** Check whether cdata is valid */
-static APR_INLINE apt_bool_t is_cdata_valid(const apr_xml_elem *elem)
-{
- return (elem->first_cdata.first && elem->first_cdata.first->text);
-}
-
-/** Get text cdata */
-static APR_INLINE const char* cdata_text_get(const apr_xml_elem *elem)
-{
- return elem->first_cdata.first->text;
-}
-
-/** Get boolean cdata */
-static APR_INLINE apt_bool_t cdata_bool_get(const apr_xml_elem *elem)
-{
- return (strcasecmp(elem->first_cdata.first->text,"true") == 0) ? TRUE : FALSE;
-}
-
-/** Copy cdata */
-static APR_INLINE char* cdata_copy(const apr_xml_elem *elem, apr_pool_t *pool)
-{
- return apr_pstrdup(pool,elem->first_cdata.first->text);
-}
-
-/** Get generic "id" and "enable" attributes */
-static apt_bool_t header_attribs_get(const apr_xml_elem *elem, const apr_xml_attr **id, const apr_xml_attr **enable)
-{
- const apr_xml_attr *attr;
- if(!id || !enable) {
- return FALSE;
- }
-
- *id = NULL;
- *enable = NULL;
- for(attr = elem->attr; attr; attr = attr->next) {
- if(strcasecmp(attr->name,"id") == 0) {
- *id = attr;
- }
- else if(strcasecmp(attr->name,"enable") == 0) {
- *enable = attr;
- }
- }
-
- if(is_attr_valid(*id) == FALSE) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Missing Required Attribute <id> in Element <%s>",elem->name);
- return FALSE;
- }
- return TRUE;
-}
-
-/** Get generic "name" and "value" attributes */
-static apt_bool_t name_value_attribs_get(const apr_xml_elem *elem, const apr_xml_attr **name, const apr_xml_attr **value)
-{
- const apr_xml_attr *attr;
- if(!name || !value) {
- return FALSE;
- }
-
- *name = NULL;
- *value = NULL;
- for(attr = elem->attr; attr; attr = attr->next) {
- if(strcasecmp(attr->name,"name") == 0) {
- *name = attr;
- }
- else if(strcasecmp(attr->name,"value") == 0) {
- *value = attr;
- }
- }
- return (*name && *value) ? TRUE : FALSE;
-}
-
-static char* unimrcp_server_ip_address_get(unimrcp_server_loader_t *loader, const apr_xml_elem *elem)
-{
- const apr_xml_attr *attr = NULL;
- for(attr = elem->attr; attr; attr = attr->next) {
- if(strcasecmp(attr->name,"type") == 0) {
- break;
- }
- }
-
- if(attr && strcasecmp(attr->value,"auto") == 0) {
- /* implicitly detect IP address, if not already detected */
- if(!loader->auto_ip) {
- char *auto_addr = DEFAULT_IP_ADDRESS;
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Detecting IP Address");
- apt_ip_get(&auto_addr,loader->pool);
- loader->auto_ip = auto_addr;
- }
- return apr_pstrdup(loader->pool,loader->auto_ip);
- }
- else if(attr && strcasecmp(attr->value,"iface") == 0) {
- /* get IP address by network interface name */
- char *ip_addr = DEFAULT_IP_ADDRESS;
- if(is_cdata_valid(elem) == TRUE) {
- const char *iface_name = cdata_text_get(elem);
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Get IP Address by Interface [%s]", iface_name);
- apt_ip_get_by_iface(iface_name,&ip_addr,loader->pool);
- }
- return ip_addr;
- }
-
- if(is_cdata_valid(elem)) {
- /* use provided IP address */
- return cdata_copy(elem,loader->pool);
- }
-
- /* use default IP address */
- return apr_pstrdup(loader->pool,loader->ip);
-}
-
-/** Load resource */
-static apt_bool_t unimrcp_server_resource_load(mrcp_resource_loader_t *resource_loader, const apr_xml_elem *root, apr_pool_t *pool)
-{
- apt_str_t resource_class;
- const apr_xml_attr *id_attr;
- const apr_xml_attr *enable_attr;
- apt_string_reset(&resource_class);
-
- if(header_attribs_get(root,&id_attr,&enable_attr) == FALSE) {
- return FALSE;
- }
-
- if(is_attr_enabled(enable_attr) == FALSE) {
- return TRUE;
- }
-
- apt_string_set(&resource_class,id_attr->value);
- return mrcp_resource_load(resource_loader,&resource_class);
-}
-
-/** Load resource factory */
-static apt_bool_t unimrcp_server_resource_factory_load(unimrcp_server_loader_t *loader, const apr_xml_elem *root)
-{
- const apr_xml_elem *elem;
- mrcp_resource_factory_t *resource_factory;
- mrcp_resource_loader_t *resource_loader = mrcp_resource_loader_create(FALSE,loader->pool);
- if(!resource_loader) {
- return FALSE;
- }
-
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Resources");
- for(elem = root->first_child; elem; elem = elem->next) {
- if(strcasecmp(elem->name,"resource") == 0) {
- unimrcp_server_resource_load(resource_loader,elem,loader->pool);
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name);
- }
- }
-
- resource_factory = mrcp_resource_factory_get(resource_loader);
- return mrcp_server_resource_factory_register(loader->server,resource_factory);
-}
-
-/** Load SofiaSIP signaling agent */
-static apt_bool_t unimrcp_server_sip_uas_load(unimrcp_server_loader_t *loader, const apr_xml_elem *root, const char *id)
-{
- const apr_xml_elem *elem;
- mrcp_sig_agent_t *agent;
- mrcp_sofia_server_config_t *config;
-
- config = mrcp_sofiasip_server_config_alloc(loader->pool);
- config->local_port = DEFAULT_SIP_PORT;
- config->user_agent_name = DEFAULT_SOFIASIP_UA_NAME;
- config->origin = DEFAULT_SDP_ORIGIN;
-
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading SofiaSIP Agent <%s>",id);
- for(elem = root->first_child; elem; elem = elem->next) {
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Element <%s>",elem->name);
- if(strcasecmp(elem->name,"sip-ip") == 0) {
- config->local_ip = unimrcp_server_ip_address_get(loader,elem);
- }
- else if(strcasecmp(elem->name,"sip-ext-ip") == 0) {
- config->ext_ip = unimrcp_server_ip_address_get(loader,elem);
- }
- else if(strcasecmp(elem->name,"sip-port") == 0) {
- if(is_cdata_valid(elem) == TRUE) {
- config->local_port = (apr_port_t)atol(cdata_text_get(elem));
- }
- }
- else if(strcasecmp(elem->name,"sip-transport") == 0) {
- if(is_cdata_valid(elem) == TRUE) {
- config->transport = cdata_copy(elem,loader->pool);
- }
- }
- else if(strcasecmp(elem->name,"ua-name") == 0) {
- if(is_cdata_valid(elem) == TRUE) {
- const apr_xml_attr *attr = NULL;
- for(attr = elem->attr; attr; attr = attr->next) {
- if(strcasecmp(attr->name,"appendversion") == 0) {
- break;
- }
- }
- if(is_attr_enabled(attr)) {
- config->user_agent_name = apr_psprintf(loader->pool,"%s "UNI_VERSION_STRING,cdata_text_get(elem));
- }
- else {
- config->user_agent_name = cdata_copy(elem,loader->pool);
- }
- }
- }
- else if(strcasecmp(elem->name,"sdp-origin") == 0) {
- if(is_cdata_valid(elem) == TRUE) {
- config->origin = cdata_copy(elem,loader->pool);
- }
- }
- else if(strcasecmp(elem->name,"force-destination") == 0) {
- if(is_cdata_valid(elem) == TRUE) {
- config->force_destination = cdata_bool_get(elem);
- }
- }
- else if(strcasecmp(elem->name,"sip-t1") == 0) {
- if(is_cdata_valid(elem) == TRUE) {
- config->sip_t1 = atol(cdata_text_get(elem));
- }
- }
- else if(strcasecmp(elem->name,"sip-t2") == 0) {
- if(is_cdata_valid(elem) == TRUE) {
- config->sip_t2 = atol(cdata_text_get(elem));
- }
- }
- else if(strcasecmp(elem->name,"sip-t4") == 0) {
- if(is_cdata_valid(elem) == TRUE) {
- config->sip_t4 = atol(cdata_text_get(elem));
- }
- }
- else if(strcasecmp(elem->name,"sip-t1x64") == 0) {
- if(is_cdata_valid(elem) == TRUE) {
- config->sip_t1x64 = atol(cdata_text_get(elem));
- }
- }
- else if(strcasecmp(elem->name,"sip-message-output") == 0) {
- if(is_cdata_valid(elem) == TRUE) {
- config->tport_log = cdata_bool_get(elem);
- }
- }
- else if(strcasecmp(elem->name,"sip-message-dump") == 0) {
- if(is_cdata_valid(elem) == TRUE) {
- const char *root_path;
- const char *path = cdata_text_get(elem);
- if(loader->dir_layout && apr_filepath_root(&root_path,&path,0,loader->pool) == APR_ERELATIVE)
- config->tport_dump_file = apt_dir_layout_path_compose(
- loader->dir_layout,
- APT_LAYOUT_LOG_DIR,
- path,
- loader->pool);
- else
- config->tport_dump_file = cdata_copy(elem,loader->pool);
- }
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name);
- }
- }
-
- if(!config->local_ip) {
- /* use default IP address if not specified */
- config->local_ip = apr_pstrdup(loader->pool,loader->ip);
- }
- if(!config->ext_ip && loader->ext_ip) {
- /* use default ext IP address if not specified */
- config->ext_ip = apr_pstrdup(loader->pool,loader->ext_ip);
- }
-
- agent = mrcp_sofiasip_server_agent_create(id,config,loader->pool);
- return mrcp_server_signaling_agent_register(loader->server,agent);
-}
-
-/** Load UniRTSP signaling agent */
-static apt_bool_t unimrcp_server_rtsp_uas_load(unimrcp_server_loader_t *loader, const apr_xml_elem *root, const char *id)
-{
- const apr_xml_elem *elem;
- mrcp_sig_agent_t *agent;
- rtsp_server_config_t *config;
-
- config = mrcp_unirtsp_server_config_alloc(loader->pool);
- config->origin = DEFAULT_SDP_ORIGIN;
-
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading UniRTSP Agent <%s>",id);
- for(elem = root->first_child; elem; elem = elem->next) {
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Element <%s>",elem->name);
- if(strcasecmp(elem->name,"rtsp-ip") == 0) {
- config->local_ip = unimrcp_server_ip_address_get(loader,elem);
- }
- else if(strcasecmp(elem->name,"rtsp-port") == 0) {
- if(is_cdata_valid(elem) == TRUE) {
- config->local_port = (apr_port_t)atol(cdata_text_get(elem));
- }
- }
- else if(strcasecmp(elem->name,"sdp-origin") == 0) {
- if(is_cdata_valid(elem) == TRUE) {
- config->origin = cdata_copy(elem,loader->pool);
- }
- }
- else if(strcasecmp(elem->name,"max-connection-count") == 0) {
- if(is_cdata_valid(elem) == TRUE) {
- config->max_connection_count = atol(cdata_text_get(elem));
- }
- }
- else if(strcasecmp(elem->name,"force-destination") == 0) {
- if(is_cdata_valid(elem) == TRUE) {
- config->force_destination = cdata_bool_get(elem);
- }
- }
- else if(strcasecmp(elem->name,"resource-map") == 0) {
- const apr_xml_attr *name_attr;
- const apr_xml_attr *value_attr;
- const apr_xml_elem *child_elem;
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Resource Map");
- for(child_elem = elem->first_child; child_elem; child_elem = child_elem->next) {
- if(name_value_attribs_get(child_elem,&name_attr,&value_attr) == TRUE) {
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Param %s:%s",name_attr->value,value_attr->value);
- apr_table_set(config->resource_map,name_attr->value,value_attr->value);
- }
- }
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name);
- }
- }
-
- if(!config->local_ip) {
- /* use default IP address if not specified */
- config->local_ip = apr_pstrdup(loader->pool,loader->ip);
- }
-
- agent = mrcp_unirtsp_server_agent_create(id,config,loader->pool);
- return mrcp_server_signaling_agent_register(loader->server,agent);
-}
-
-/** Load MRCPv2 connection agent */
-static apt_bool_t unimrcp_server_mrcpv2_uas_load(unimrcp_server_loader_t *loader, const apr_xml_elem *root, const char *id)
-{
- const apr_xml_elem *elem;
- mrcp_connection_agent_t *agent;
- char *mrcp_ip = NULL;
- apr_port_t mrcp_port = DEFAULT_MRCP_PORT;
- apr_size_t max_connection_count = 100;
- apt_bool_t force_new_connection = FALSE;
- apr_size_t rx_buffer_size = 0;
- apr_size_t tx_buffer_size = 0;
-
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading MRCPv2 Agent <%s>",id);
- for(elem = root->first_child; elem; elem = elem->next) {
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Element <%s>",elem->name);
- if(strcasecmp(elem->name,"mrcp-ip") == 0) {
- mrcp_ip = unimrcp_server_ip_address_get(loader,elem);
- }
- else if(strcasecmp(elem->name,"mrcp-port") == 0) {
- if(is_cdata_valid(elem) == TRUE) {
- mrcp_port = (apr_port_t)atol(cdata_text_get(elem));
- }
- }
- else if(strcasecmp(elem->name,"max-connection-count") == 0) {
- if(is_cdata_valid(elem) == TRUE) {
- max_connection_count = atol(cdata_text_get(elem));
- }
- }
- else if(strcasecmp(elem->name,"force-new-connection") == 0) {
- if(is_cdata_valid(elem) == TRUE) {
- force_new_connection = cdata_bool_get(elem);
- }
- }
- else if(strcasecmp(elem->name,"rx-buffer-size") == 0) {
- if(is_cdata_valid(elem) == TRUE) {
- rx_buffer_size = atol(cdata_text_get(elem));
- }
- }
- else if(strcasecmp(elem->name,"tx-buffer-size") == 0) {
- if(is_cdata_valid(elem) == TRUE) {
- tx_buffer_size = atol(cdata_text_get(elem));
- }
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name);
- }
- }
-
- if(!mrcp_ip) {
- /* use default IP address if not specified */
- mrcp_ip = apr_pstrdup(loader->pool,loader->ip);
- }
-
- agent = mrcp_server_connection_agent_create(id,mrcp_ip,mrcp_port,max_connection_count,force_new_connection,loader->pool);
- if(agent) {
- if(rx_buffer_size) {
- mrcp_server_connection_rx_size_set(agent,rx_buffer_size);
- }
- if(tx_buffer_size) {
- mrcp_server_connection_tx_size_set(agent,tx_buffer_size);
- }
- }
- return mrcp_server_connection_agent_register(loader->server,agent);
-}
-
-/** Load media engine */
-static apt_bool_t unimrcp_server_media_engine_load(unimrcp_server_loader_t *loader, const apr_xml_elem *root, const char *id)
-{
- const apr_xml_elem *elem;
- mpf_engine_t *media_engine;
- unsigned long realtime_rate = 1;
-
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Media Engine <%s>",id);
- for(elem = root->first_child; elem; elem = elem->next) {
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Element <%s>",elem->name);
- if(strcasecmp(elem->name,"realtime-rate") == 0) {
- if(is_cdata_valid(elem) == TRUE) {
- realtime_rate = atol(cdata_text_get(elem));
- }
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name);
- }
- }
-
- media_engine = mpf_engine_create(id,loader->pool);
- if(media_engine) {
- mpf_engine_scheduler_rate_set(media_engine,realtime_rate);
- }
- return mrcp_server_media_engine_register(loader->server,media_engine);
-}
-
-/** Load RTP factory */
-static apt_bool_t unimrcp_server_rtp_factory_load(unimrcp_server_loader_t *loader, const apr_xml_elem *root, const char *id)
-{
- const apr_xml_elem *elem;
- char *rtp_ip = NULL;
- char *rtp_ext_ip = NULL;
- mpf_termination_factory_t *rtp_factory;
- mpf_rtp_config_t *rtp_config;
-
- rtp_config = mpf_rtp_config_alloc(loader->pool);
- rtp_config->rtp_port_min = DEFAULT_RTP_PORT_MIN;
- rtp_config->rtp_port_max = DEFAULT_RTP_PORT_MAX;
-
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading RTP Factory <%s>",id);
- for(elem = root->first_child; elem; elem = elem->next) {
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Element <%s>",elem->name);
- if(strcasecmp(elem->name,"rtp-ip") == 0) {
- rtp_ip = unimrcp_server_ip_address_get(loader,elem);
- }
- else if(strcasecmp(elem->name,"rtp-ext-ip") == 0) {
- rtp_ext_ip = unimrcp_server_ip_address_get(loader,elem);
- }
- else if(strcasecmp(elem->name,"rtp-port-min") == 0) {
- if(is_cdata_valid(elem) == TRUE) {
- rtp_config->rtp_port_min = (apr_port_t)atol(cdata_text_get(elem));
- }
- }
- else if(strcasecmp(elem->name,"rtp-port-max") == 0) {
- if(is_cdata_valid(elem) == TRUE) {
- rtp_config->rtp_port_max = (apr_port_t)atol(cdata_text_get(elem));
- }
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name);
- }
- }
-
- if(rtp_ip) {
- apt_string_set(&rtp_config->ip,rtp_ip);
- }
- else {
- apt_string_set(&rtp_config->ip,loader->ip);
- }
- if(rtp_ext_ip) {
- apt_string_set(&rtp_config->ext_ip,rtp_ext_ip);
- }
- else if(loader->ext_ip){
- apt_string_set(&rtp_config->ext_ip,loader->ext_ip);
- }
-
- rtp_factory = mpf_rtp_termination_factory_create(rtp_config,loader->pool);
- return mrcp_server_rtp_factory_register(loader->server,rtp_factory,id);
-}
-
-/** Load plugin */
-static apt_bool_t unimrcp_server_plugin_load(unimrcp_server_loader_t *loader, const apr_xml_elem *root)
-{
- mrcp_engine_t *engine;
- mrcp_engine_config_t *config;
- char *plugin_file_name;
- char *plugin_path;
- const char *plugin_id = NULL;
- const char *plugin_name = NULL;
- const char *plugin_ext = NULL;
- apt_bool_t plugin_enabled = TRUE;
- const apr_xml_attr *attr;
- for(attr = root->attr; attr; attr = attr->next) {
- if(strcasecmp(attr->name,"id") == 0) {
- plugin_id = apr_pstrdup(loader->pool,attr->value);
- }
- else if(strcasecmp(attr->name,"name") == 0) {
- plugin_name = attr->value;
- }
- else if(strcasecmp(attr->name,"ext") == 0) {
- plugin_ext = attr->value;
- }
- else if(strcasecmp(attr->name,"enable") == 0) {
- plugin_enabled = is_attr_enabled(attr);
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Attribute <%s>",attr->name);
- }
- }
-
- if(!plugin_id || !plugin_name) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Missing plugin id or name");
- return FALSE;
- }
-
- if(!plugin_enabled) {
- /* disabled plugin, just skip it */
- return TRUE;
- }
-
- if(!plugin_ext) {
- plugin_ext = DEFAULT_PLUGIN_EXT;
- }
-
- plugin_file_name = apr_psprintf(loader->pool,"%s.%s",plugin_name,plugin_ext);
- plugin_path = apt_dir_layout_path_compose(loader->dir_layout,APT_LAYOUT_PLUGIN_DIR,plugin_file_name,loader->pool);
- if(!plugin_path) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to compose plugin path %s",plugin_file_name);
- return FALSE;
- }
-
- config = mrcp_engine_config_alloc(loader->pool);
-
- /* load optional named and generic name/value params */
- if(root->first_child){
- const apr_xml_attr *attr_name;
- const apr_xml_attr *attr_value;
- const apr_xml_elem *elem;
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Engine Params");
- config->params = apr_table_make(loader->pool,1);
- for(elem = root->first_child; elem; elem = elem->next) {
- if(strcasecmp(elem->name,"max-channel-count") == 0) {
- if(is_cdata_valid(elem) == TRUE) {
- config->max_channel_count = atol(cdata_text_get(elem));
- }
- }
- else if(strcasecmp(elem->name,"param") == 0) {
- if(name_value_attribs_get(elem,&attr_name,&attr_value) == TRUE) {
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Param %s:%s",attr_name->value,attr_value->value);
- apr_table_set(config->params,attr_name->value,attr_value->value);
- }
- }
- }
- }
-
- engine = mrcp_server_engine_load(loader->server,plugin_id,plugin_path,config);
- return mrcp_server_engine_register(loader->server,engine);
-}
-
-/** Load plugin (engine) factory */
-static apt_bool_t unimrcp_server_plugin_factory_load(unimrcp_server_loader_t *loader, const apr_xml_elem *root)
-{
- const apr_xml_elem *elem;
-
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Plugin Factory");
- for(elem = root->first_child; elem; elem = elem->next) {
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Element <%s>",elem->name);
- if(strcasecmp(elem->name,"engine") == 0) {
- unimrcp_server_plugin_load(loader,elem);
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name);
- }
- }
- return TRUE;
-}
-
-/** Load jitter buffer settings */
-static apt_bool_t unimrcp_server_jb_settings_load(unimrcp_server_loader_t *loader, mpf_jb_config_t *jb, const apr_xml_elem *root)
-{
- const apr_xml_elem *elem;
-
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Jitter Buffer Settings");
- for(elem = root->first_child; elem; elem = elem->next) {
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Element <%s>",elem->name);
- if(strcasecmp(elem->name,"playout-delay") == 0) {
- if(is_cdata_valid(elem) == TRUE) {
- jb->initial_playout_delay = atol(cdata_text_get(elem));
- }
- }
- else if(strcasecmp(elem->name,"min-playout-delay") == 0) {
- if(is_cdata_valid(elem) == TRUE) {
- jb->min_playout_delay = atol(cdata_text_get(elem));
- }
- }
- else if(strcasecmp(elem->name,"max-playout-delay") == 0) {
- if(is_cdata_valid(elem) == TRUE) {
- jb->max_playout_delay = atol(cdata_text_get(elem));
- }
- }
- else if(strcasecmp(elem->name,"adaptive") == 0) {
- if(is_cdata_valid(elem) == TRUE) {
- jb->adaptive = (apr_byte_t) atol(cdata_text_get(elem));
- }
- }
- else if(strcasecmp(elem->name,"time-skew-detection") == 0) {
- if(is_cdata_valid(elem) == TRUE) {
- jb->time_skew_detection = (apr_byte_t) atol(cdata_text_get(elem));
- }
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name);
- }
- }
- return TRUE;
-}
-
-/** Load RTCP settings */
-static apt_bool_t unimrcp_server_rtcp_settings_load(unimrcp_server_loader_t *loader, mpf_rtp_settings_t *rtcp_settings, const apr_xml_elem *root)
-{
- const apr_xml_elem *elem;
- const apr_xml_attr *attr = NULL;
- for(attr = root->attr; attr; attr = attr->next) {
- if(strcasecmp(attr->name,"enable") == 0) {
- break;
- }
- }
-
- if(is_attr_enabled(attr) == FALSE) {
- /* RTCP is disabled, skip the rest */
- return TRUE;
- }
-
- rtcp_settings->rtcp = TRUE;
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading RTCP Settings");
- for(elem = root->first_child; elem; elem = elem->next) {
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Element <%s>",elem->name);
- if(strcasecmp(elem->name,"rtcp-bye") == 0) {
- if(is_cdata_valid(elem) == TRUE) {
- rtcp_settings->rtcp_bye_policy = atoi(cdata_text_get(elem));
- }
- }
- else if(strcasecmp(elem->name,"tx-interval") == 0) {
- if(is_cdata_valid(elem) == TRUE) {
- rtcp_settings->rtcp_tx_interval = (apr_uint16_t)atoi(cdata_text_get(elem));
- }
- }
- else if(strcasecmp(elem->name,"rx-resolution") == 0) {
- if(is_cdata_valid(elem) == TRUE) {
- rtcp_settings->rtcp_rx_resolution = (apr_uint16_t)atol(cdata_text_get(elem));
- }
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name);
- }
- }
- return TRUE;
-}
-
-/** Load RTP settings */
-static apt_bool_t unimrcp_server_rtp_settings_load(unimrcp_server_loader_t *loader, const apr_xml_elem *root, const char *id)
-{
- const apr_xml_elem *elem;
- mpf_rtp_settings_t *rtp_settings = mpf_rtp_settings_alloc(loader->pool);
-
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading RTP Settings <%s>",id);
- for(elem = root->first_child; elem; elem = elem->next) {
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Element <%s>",elem->name);
- if(strcasecmp(elem->name,"jitter-buffer") == 0) {
- unimrcp_server_jb_settings_load(loader,&rtp_settings->jb_config,elem);
- }
- else if(strcasecmp(elem->name,"ptime") == 0) {
- if(is_cdata_valid(elem) == TRUE) {
- rtp_settings->ptime = (apr_uint16_t)atol(cdata_text_get(elem));
- }
- }
- else if(strcasecmp(elem->name,"codecs") == 0) {
- const apr_xml_attr *attr;
- const mpf_codec_manager_t *codec_manager = mrcp_server_codec_manager_get(loader->server);
- if(is_cdata_valid(elem) == TRUE && codec_manager) {
- mpf_codec_manager_codec_list_load(
- codec_manager,
- &rtp_settings->codec_list,
- cdata_text_get(elem),
- loader->pool);
- }
- for(attr = elem->attr; attr; attr = attr->next) {
- if(strcasecmp(attr->name,"own-preference") == 0) {
- rtp_settings->own_preferrence = is_attr_enabled(attr);
- break;
- }
- }
- }
- else if(strcasecmp(elem->name,"rtcp") == 0) {
- unimrcp_server_rtcp_settings_load(loader,rtp_settings,elem);
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name);
- }
- }
-
- return mrcp_server_rtp_settings_register(loader->server,rtp_settings,id);
-}
-
-/** Load map of resources and engines */
-static apr_table_t* resource_engine_map_load(const apr_xml_elem *root, apr_pool_t *pool)
-{
- const apr_xml_attr *attr_name;
- const apr_xml_attr *attr_value;
- const apr_xml_elem *elem;
- apr_table_t *plugin_map = apr_table_make(pool,2);
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Plugin Map");
- for(elem = root->first_child; elem; elem = elem->next) {
- if(strcasecmp(elem->name,"param") == 0) {
- if(name_value_attribs_get(elem,&attr_name,&attr_value) == TRUE) {
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Param %s:%s",attr_name->value,attr_value->value);
- apr_table_set(plugin_map,attr_name->value,attr_value->value);
- }
- }
- }
- return plugin_map;
-}
-
-/** Load MRCPv2 profile */
-static apt_bool_t unimrcp_server_mrcpv2_profile_load(unimrcp_server_loader_t *loader, const apr_xml_elem *root, const char *id)
-{
- const apr_xml_elem *elem;
- mrcp_server_profile_t *profile;
- mrcp_sig_agent_t *sip_agent = NULL;
- mrcp_connection_agent_t *mrcpv2_agent = NULL;
- mpf_engine_t *media_engine = NULL;
- mpf_termination_factory_t *rtp_factory = NULL;
- mpf_rtp_settings_t *rtp_settings = NULL;
- apr_table_t *resource_engine_map = NULL;
-
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading MRCPv2 Profile <%s>",id);
- for(elem = root->first_child; elem; elem = elem->next) {
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Element <%s>",elem->name);
-
- if(is_cdata_valid(elem) == FALSE) {
- continue;
- }
-
- if(strcasecmp(elem->name,"sip-uas") == 0) {
- sip_agent = mrcp_server_signaling_agent_get(loader->server,cdata_text_get(elem));
- }
- else if(strcasecmp(elem->name,"mrcpv2-uas") == 0) {
- mrcpv2_agent = mrcp_server_connection_agent_get(loader->server,cdata_text_get(elem));
- }
- else if(strcasecmp(elem->name,"media-engine") == 0) {
- media_engine = mrcp_server_media_engine_get(loader->server,cdata_text_get(elem));
- }
- else if(strcasecmp(elem->name,"rtp-factory") == 0) {
- rtp_factory = mrcp_server_rtp_factory_get(loader->server,cdata_text_get(elem));
- }
- else if(strcasecmp(elem->name,"rtp-settings") == 0) {
- rtp_settings = mrcp_server_rtp_settings_get(loader->server,cdata_text_get(elem));
- }
- else if(strcasecmp(elem->name,"resource-engine-map") == 0) {
- resource_engine_map = resource_engine_map_load(elem,loader->pool);
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name);
- }
- }
-
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create MRCPv2 Profile [%s]",id);
- profile = mrcp_server_profile_create(
- id,
- MRCP_VERSION_2,
- NULL,
- sip_agent,
- mrcpv2_agent,
- media_engine,
- rtp_factory,
- rtp_settings,
- loader->pool);
- return mrcp_server_profile_register(loader->server,profile,resource_engine_map);
-}
-
-/** Load MRCPv1 profile */
-static apt_bool_t unimrcp_server_mrcpv1_profile_load(unimrcp_server_loader_t *loader, const apr_xml_elem *root, const char *id)
-{
- const apr_xml_elem *elem;
- mrcp_server_profile_t *profile;
- mrcp_sig_agent_t *rtsp_agent = NULL;
- mpf_engine_t *media_engine = NULL;
- mpf_termination_factory_t *rtp_factory = NULL;
- mpf_rtp_settings_t *rtp_settings = NULL;
- apr_table_t *resource_engine_map = NULL;
-
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading MRCPv1 Profile <%s>",id);
- for(elem = root->first_child; elem; elem = elem->next) {
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Element <%s>",elem->name);
-
- if(is_cdata_valid(elem) == FALSE) {
- continue;
- }
-
- if(strcasecmp(elem->name,"rtsp-uas") == 0) {
- rtsp_agent = mrcp_server_signaling_agent_get(loader->server,cdata_text_get(elem));
- }
- else if(strcasecmp(elem->name,"media-engine") == 0) {
- media_engine = mrcp_server_media_engine_get(loader->server,cdata_text_get(elem));
- }
- else if(strcasecmp(elem->name,"rtp-factory") == 0) {
- rtp_factory = mrcp_server_rtp_factory_get(loader->server,cdata_text_get(elem));
- }
- else if(strcasecmp(elem->name,"rtp-settings") == 0) {
- rtp_settings = mrcp_server_rtp_settings_get(loader->server,cdata_text_get(elem));
- }
- else if(strcasecmp(elem->name,"resource-engine-map") == 0) {
- resource_engine_map = resource_engine_map_load(elem,loader->pool);
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name);
- }
- }
-
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create MRCPv1 Profile [%s]",id);
- profile = mrcp_server_profile_create(
- id,
- MRCP_VERSION_1,
- NULL,
- rtsp_agent,
- NULL,
- media_engine,
- rtp_factory,
- rtp_settings,
- loader->pool);
- return mrcp_server_profile_register(loader->server,profile,resource_engine_map);
-}
-
-
-/** Load properties */
-static apt_bool_t unimrcp_server_properties_load(unimrcp_server_loader_t *loader, const apr_xml_elem *root)
-{
- const apr_xml_elem *elem;
-
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Properties");
- for(elem = root->first_child; elem; elem = elem->next) {
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Element <%s>",elem->name);
- if(strcasecmp(elem->name,"ip") == 0) {
- loader->ip = unimrcp_server_ip_address_get(loader,elem);
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set Property ip:%s",loader->ip);
- }
- else if(strcasecmp(elem->name,"ext-ip") == 0) {
- loader->ext_ip = unimrcp_server_ip_address_get(loader,elem);
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set Property ext-ip:%s",loader->ext_ip);
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name);
- }
- }
- return TRUE;
-}
-
-/** Load components */
-static apt_bool_t unimrcp_server_components_load(unimrcp_server_loader_t *loader, const apr_xml_elem *root)
-{
- const apr_xml_elem *elem;
- const apr_xml_attr *id_attr;
- const apr_xml_attr *enable_attr;
- const char *id;
-
- /* Create codec manager first (probably it should be loaded from config either) */
- mpf_codec_manager_t *codec_manager = mpf_engine_codec_manager_create(loader->pool);
- if(codec_manager) {
- mrcp_server_codec_manager_register(loader->server,codec_manager);
- }
-
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Components");
- for(elem = root->first_child; elem; elem = elem->next) {
- if(strcasecmp(elem->name,"resource-factory") == 0) {
- unimrcp_server_resource_factory_load(loader,elem);
- continue;
- }
- if(strcasecmp(elem->name,"plugin-factory") == 0) {
- unimrcp_server_plugin_factory_load(loader,elem);
- continue;
- }
-
- /* get common "id" and "enable" attributes */
- if(header_attribs_get(elem,&id_attr,&enable_attr) == FALSE) {
- /* invalid id */
- continue;
- }
- if(is_attr_enabled(enable_attr) == FALSE) {
- /* disabled element, just skip it */
- continue;
- }
- id = apr_pstrdup(loader->pool,id_attr->value);
-
- if(strcasecmp(elem->name,"sip-uas") == 0) {
- unimrcp_server_sip_uas_load(loader,elem,id);
- }
- else if(strcasecmp(elem->name,"rtsp-uas") == 0) {
- unimrcp_server_rtsp_uas_load(loader,elem,id);
- }
- else if(strcasecmp(elem->name,"mrcpv2-uas") == 0) {
- unimrcp_server_mrcpv2_uas_load(loader,elem,id);
- }
- else if(strcasecmp(elem->name,"media-engine") == 0) {
- unimrcp_server_media_engine_load(loader,elem,id);
- }
- else if(strcasecmp(elem->name,"rtp-factory") == 0) {
- unimrcp_server_rtp_factory_load(loader,elem,id);
- }
- else if(strcasecmp(elem->name,"plugin-factory") == 0) {
- unimrcp_server_plugin_factory_load(loader,elem);
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name);
- }
- }
- return TRUE;
-}
-
-/** Load settings */
-static apt_bool_t unimrcp_server_settings_load(unimrcp_server_loader_t *loader, const apr_xml_elem *root)
-{
- const apr_xml_elem *elem;
- const apr_xml_attr *id_attr;
- const apr_xml_attr *enable_attr;
- const char *id;
-
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Settings");
- for(elem = root->first_child; elem; elem = elem->next) {
- /* get common "id" and "enable" attributes */
- if(header_attribs_get(elem,&id_attr,&enable_attr) == FALSE) {
- /* invalid id */
- continue;
- }
- if(is_attr_enabled(enable_attr) == FALSE) {
- /* disabled element, just skip it */
- continue;
- }
- id = apr_pstrdup(loader->pool,id_attr->value);
-
- if(strcasecmp(elem->name,"rtp-settings") == 0) {
- unimrcp_server_rtp_settings_load(loader,elem,id);
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name);
- }
- }
- return TRUE;
-}
-
-/** Load profiles */
-static apt_bool_t unimrcp_server_profiles_load(unimrcp_server_loader_t *loader, const apr_xml_elem *root)
-{
- const apr_xml_elem *elem;
- const apr_xml_attr *id_attr;
- const apr_xml_attr *enable_attr;
- const char *id;
-
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Profiles");
- for(elem = root->first_child; elem; elem = elem->next) {
- /* get common "id" and "enable" attributes */
- if(header_attribs_get(elem,&id_attr,&enable_attr) == FALSE) {
- /* invalid id */
- continue;
- }
- if(is_attr_enabled(enable_attr) == FALSE) {
- /* disabled element, just skip it */
- continue;
- }
- id = apr_pstrdup(loader->pool,id_attr->value);
-
- if(strcasecmp(elem->name,"mrcpv2-profile") == 0) {
- unimrcp_server_mrcpv2_profile_load(loader,elem,id);
- }
- else if(strcasecmp(elem->name,"mrcpv1-profile") == 0) {
- unimrcp_server_mrcpv1_profile_load(loader,elem,id);
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name);
- }
- }
- return TRUE;
-}
-
-/** Load misc parameters */
-static apt_bool_t unimrcp_server_misc_load(unimrcp_server_loader_t *loader, const apr_xml_elem *root)
-{
- const apr_xml_elem *elem;
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Misc Parameters");
- for(elem = root->first_child; elem; elem = elem->next) {
- if(strcasecmp(elem->name,"sofiasip-logger") == 0) {
- char *logger_list_str;
- char *logger_name;
- char *state;
- apr_xml_attr *attr;
- apt_bool_t redirect = FALSE;
- const char *loglevel_str = NULL;
- for(attr = elem->attr; attr; attr = attr->next) {
- if(strcasecmp(attr->name,"redirect") == 0) {
- if(attr->value && strcasecmp(attr->value,"true") == 0)
- redirect = TRUE;
- }
- else if(strcasecmp(attr->name,"loglevel") == 0) {
- loglevel_str = attr->value;
- }
- }
-
- logger_list_str = apr_pstrdup(loader->pool,cdata_text_get(elem));
- do {
- logger_name = apr_strtok(logger_list_str, ",", &state);
- if(logger_name) {
- mrcp_sofiasip_server_logger_init(logger_name,loglevel_str,redirect);
- }
- logger_list_str = NULL; /* make sure we pass NULL on subsequent calls of apr_strtok() */
- }
- while(logger_name);
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name);
- }
- }
- return TRUE;
-}
-
-/** Parse XML document */
-static apr_xml_doc* unimrcp_server_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;
-
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Open Config File [%s]",file_path);
- rv = apr_file_open(&fd,file_path,APR_READ|APR_BINARY,0,pool);
- if(rv != APR_SUCCESS) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Open Config File [%s]",file_path);
- return NULL;
- }
-
- rv = apr_xml_parse_file(pool,&parser,&xml_doc,fd,XML_FILE_BUFFER_LENGTH);
- if(rv != APR_SUCCESS) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Parse Config File [%s]",file_path);
- xml_doc = NULL;
- }
-
- apr_file_close(fd);
- return xml_doc;
-}
-
-static apt_bool_t unimrcp_server_load(mrcp_server_t *mrcp_server, apt_dir_layout_t *dir_layout, apr_pool_t *pool)
-{
- const char *file_path;
- apr_xml_doc *doc;
- const apr_xml_elem *elem;
- const apr_xml_elem *root;
- const apr_xml_attr *attr;
- unimrcp_server_loader_t *loader;
- const char *version = NULL;
-
- file_path = apt_confdir_filepath_get(dir_layout,CONF_FILE_NAME,pool);
- if(!file_path) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Get Path to Conf File [%s]",CONF_FILE_NAME);
- return FALSE;
- }
-
- /* Parse XML document */
- doc = unimrcp_server_doc_parse(file_path,pool);
- if(!doc) {
- return FALSE;
- }
-
- root = doc->root;
-
- /* Match document name */
- if(!root || strcasecmp(root->name,"unimrcpserver") != 0) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Document <%s>",root ? root->name : "null");
- return FALSE;
- }
-
- /* Read attributes */
- for(attr = root->attr; attr; attr = attr->next) {
- if(strcasecmp(attr->name,"version") == 0) {
- version = attr->value;
- }
- }
-
- /* Check version number first */
- if(!version) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Version");
- return FALSE;
- }
-
- loader = apr_palloc(pool,sizeof(unimrcp_server_loader_t));
- loader->doc = doc;
- loader->server = mrcp_server;
- loader->dir_layout = dir_layout;
- loader->pool = pool;
- loader->ip = DEFAULT_IP_ADDRESS;
- loader->ext_ip = NULL;
- loader->auto_ip = NULL;
-
- /* Navigate through document */
- for(elem = root->first_child; elem; elem = elem->next) {
- if(strcasecmp(elem->name,"properties") == 0) {
- unimrcp_server_properties_load(loader,elem);
- }
- else if(strcasecmp(elem->name,"components") == 0) {
- unimrcp_server_components_load(loader,elem);
- }
- else if(strcasecmp(elem->name,"settings") == 0) {
- unimrcp_server_settings_load(loader,elem);
- }
- else if(strcasecmp(elem->name,"profiles") == 0) {
- unimrcp_server_profiles_load(loader,elem);
- }
- else if(strcasecmp(elem->name,"misc") == 0) {
- unimrcp_server_misc_load(loader,elem);
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name);
- }
- }
- return TRUE;
-}
+++ /dev/null
-AM_CPPFLAGS = -I$(top_srcdir)/platforms/umc/include \
- $(UNIMRCP_CLIENTAPP_INCLUDES)
-
-bin_PROGRAMS = umc
-
-umc_SOURCES = src/main.cpp \
- src/umcconsole.cpp \
- src/umcframework.cpp \
- src/umcscenario.cpp \
- src/umcsession.cpp \
- src/synthscenario.cpp \
- src/synthsession.cpp \
- src/recogscenario.cpp \
- src/recogsession.cpp \
- src/recorderscenario.cpp \
- src/recordersession.cpp \
- src/dtmfscenario.cpp \
- src/dtmfsession.cpp \
- src/setparamscenario.cpp \
- src/setparamsession.cpp \
- src/verifierscenario.cpp \
- src/verifiersession.cpp
-umc_LDADD = $(UNIMRCP_CLIENTAPP_LIBS)
-umc_LDFLAGS = $(UNIMRCP_CLIENTAPP_OPTS)
-
-include $(top_srcdir)/build/rules/uniclientapp.am
+++ /dev/null
-/*
- * 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: dtmfscenario.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef DTMF_SCENARIO_H
-#define DTMF_SCENARIO_H
-
-/**
- * @file dtmfscenario.h
- * @brief DTMF Recognition Scenario
- */
-
-#include "umcscenario.h"
-
-class DtmfScenario : public UmcScenario
-{
-public:
-/* ============================ CREATORS =================================== */
- DtmfScenario();
- virtual ~DtmfScenario();
-
-/* ============================ MANIPULATORS =============================== */
- virtual void Destroy();
-
- virtual UmcSession* CreateSession();
-
-/* ============================ ACCESSORS ================================== */
- const char* GetContentType() const;
- const char* GetGrammar() const;
- const char* GetDigits() const;
-
-/* ============================ INQUIRIES ================================== */
-
-protected:
-/* ============================ MANIPULATORS =============================== */
- virtual bool LoadElement(const apr_xml_elem* pElem, apr_pool_t* pool);
-
- bool LoadRecognize(const apr_xml_elem* pElem, apr_pool_t* pool);
-
-/* ============================ DATA ======================================= */
- const char* m_ContentType;
- const char* m_Grammar;
- const char* m_Digits;
-};
-
-/* ============================ INLINE METHODS ============================= */
-inline const char* DtmfScenario::GetContentType() const
-{
- return m_ContentType;
-}
-
-inline const char* DtmfScenario::GetGrammar() const
-{
- return m_Grammar;
-}
-
-inline const char* DtmfScenario::GetDigits() const
-{
- return m_Digits;
-}
-
-
-#endif /* DTMF_SCENARIO_H */
+++ /dev/null
-/*
- * 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: dtmfsession.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef DTMF_SESSION_H
-#define DTMF_SESSION_H
-
-/**
- * @file dtmfsession.h
- * @brief DTMF Recognition Session
- */
-
-#include "umcsession.h"
-
-class DtmfScenario;
-struct RecogChannel;
-
-class DtmfSession : public UmcSession
-{
-public:
-/* ============================ CREATORS =================================== */
- DtmfSession(const DtmfScenario* pScenario);
- virtual ~DtmfSession();
-
-protected:
-/* ============================ MANIPULATORS =============================== */
- virtual bool Start();
-
- RecogChannel* CreateRecogChannel();
- bool StartRecognition(mrcp_channel_t* pMrcpChannel);
-
- mrcp_message_t* CreateRecognizeRequest(mrcp_channel_t* pMrcpChannel);
-
- static bool ParseNLSMLResult(mrcp_message_t* pMrcpMessage);
-
-/* ============================ HANDLERS =================================== */
- virtual bool OnSessionTerminate(mrcp_sig_status_code_e status);
- virtual bool OnChannelAdd(mrcp_channel_t* channel, mrcp_sig_status_code_e status);
- virtual bool OnMessageReceive(mrcp_channel_t* channel, mrcp_message_t* message);
-
-/* ============================ ACCESSORS ================================== */
- const DtmfScenario* GetScenario() const;
-
-private:
-/* ============================ DATA ======================================= */
- RecogChannel* m_pRecogChannel;
-};
-
-
-/* ============================ INLINE METHODS ============================= */
-inline const DtmfScenario* DtmfSession::GetScenario() const
-{
- return (DtmfScenario*)m_pScenario;
-}
-
-#endif /* DTMF_SESSION_H */
+++ /dev/null
-/*
- * 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: recogscenario.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef RECOG_SCENARIO_H
-#define RECOG_SCENARIO_H
-
-/**
- * @file recogscenario.h
- * @brief Recognizer Scenario
- */
-
-#include "umcscenario.h"
-
-class RecogScenario : public UmcScenario
-{
-public:
-/* ============================ CREATORS =================================== */
- RecogScenario();
- virtual ~RecogScenario();
-
-/* ============================ MANIPULATORS =============================== */
- virtual void Destroy();
-
- virtual UmcSession* CreateSession();
-
-/* ============================ ACCESSORS ================================== */
- const char* GetContentType() const;
- const char* GetContent() const;
- apr_size_t GetContentLength() const;
- const char* GetAudioSource() const;
-
-/* ============================ INQUIRIES ================================== */
- bool IsDefineGrammarEnabled() const;
- bool IsRecognizeEnabled() const;
-protected:
-/* ============================ MANIPULATORS =============================== */
- virtual bool LoadElement(const apr_xml_elem* pElem, apr_pool_t* pool);
-
- bool LoadRecognize(const apr_xml_elem* pElem, apr_pool_t* pool);
- bool LoadDefineGrammar(const apr_xml_elem* pElem, apr_pool_t* pool);
-
-/* ============================ DATA ======================================= */
- bool m_DefineGrammar;
- bool m_Recognize;
- const char* m_ContentType;
- const char* m_Content;
- apr_size_t m_ContentLength;
- const char* m_AudioSource;
-};
-
-/* ============================ INLINE METHODS ============================= */
-inline const char* RecogScenario::GetContentType() const
-{
- return m_ContentType;
-}
-
-inline const char* RecogScenario::GetContent() const
-{
- return m_Content;
-}
-
-inline apr_size_t RecogScenario::GetContentLength() const
-{
- return m_ContentLength;
-}
-
-inline const char* RecogScenario::GetAudioSource() const
-{
- return m_AudioSource;
-}
-
-inline bool RecogScenario::IsDefineGrammarEnabled() const
-{
- return m_DefineGrammar;
-}
-
-inline bool RecogScenario::IsRecognizeEnabled() const
-{
- return m_Recognize;
-}
-
-#endif /* RECOG_SCENARIO_H */
+++ /dev/null
-/*
- * 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: recogsession.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef RECOG_SESSION_H
-#define RECOG_SESSION_H
-
-/**
- * @file recogsession.h
- * @brief Recognizer Session
- */
-
-#include "umcsession.h"
-
-class RecogScenario;
-struct RecogChannel;
-
-class RecogSession : public UmcSession
-{
-public:
-/* ============================ CREATORS =================================== */
- RecogSession(const RecogScenario* pScenario);
- virtual ~RecogSession();
-
-protected:
-/* ============================ MANIPULATORS =============================== */
- virtual bool Start();
- virtual bool Stop();
-
- RecogChannel* CreateRecogChannel();
- bool StartRecognition(mrcp_channel_t* pMrcpChannel);
- bool OnDefineGrammar(mrcp_channel_t* pMrcpChannel);
-
- mrcp_message_t* CreateDefineGrammarRequest(mrcp_channel_t* pMrcpChannel);
- mrcp_message_t* CreateRecognizeRequest(mrcp_channel_t* pMrcpChannel);
-
- static bool ParseNLSMLResult(mrcp_message_t* pMrcpMessage);
- FILE* GetAudioIn(const mpf_codec_descriptor_t* pDescriptor, apr_pool_t* pool) const;
-
-/* ============================ HANDLERS =================================== */
- virtual bool OnSessionTerminate(mrcp_sig_status_code_e status);
- virtual bool OnChannelAdd(mrcp_channel_t* channel, mrcp_sig_status_code_e status);
- virtual bool OnMessageReceive(mrcp_channel_t* channel, mrcp_message_t* message);
-
-/* ============================ ACCESSORS ================================== */
- const RecogScenario* GetScenario() const;
-
-private:
-/* ============================ DATA ======================================= */
- RecogChannel* m_pRecogChannel;
- const char* m_ContentId;
-};
-
-
-/* ============================ INLINE METHODS ============================= */
-inline const RecogScenario* RecogSession::GetScenario() const
-{
- return (RecogScenario*)m_pScenario;
-}
-
-#endif /* RECOG_SESSION_H */
+++ /dev/null
-/*
- * 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: recorderscenario.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef RECORDER_SCENARIO_H
-#define RECORDER_SCENARIO_H
-
-/**
- * @file recorderscenario.h
- * @brief Recorder Scenario
- */
-
-#include "umcscenario.h"
-
-class RecorderScenario : public UmcScenario
-{
-public:
-/* ============================ CREATORS =================================== */
- RecorderScenario();
- virtual ~RecorderScenario();
-
-/* ============================ MANIPULATORS =============================== */
- virtual void Destroy();
-
- virtual UmcSession* CreateSession();
-
-/* ============================ ACCESSORS ================================== */
- const char* GetAudioSource() const;
-
-/* ============================ INQUIRIES ================================== */
- bool IsRecordEnabled() const;
-protected:
-/* ============================ MANIPULATORS =============================== */
- virtual bool LoadElement(const apr_xml_elem* pElem, apr_pool_t* pool);
-
- bool LoadRecord(const apr_xml_elem* pElem, apr_pool_t* pool);
-
-/* ============================ DATA ======================================= */
- bool m_Record;
- const char* m_AudioSource;
-};
-
-/* ============================ INLINE METHODS ============================= */
-inline const char* RecorderScenario::GetAudioSource() const
-{
- return m_AudioSource;
-}
-
-inline bool RecorderScenario::IsRecordEnabled() const
-{
- return m_Record;
-}
-
-#endif /* RECORDER_SCENARIO_H */
+++ /dev/null
-/*
- * 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: recordersession.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef RECORDER_SESSION_H
-#define RECORDER_SESSION_H
-
-/**
- * @file recordersession.h
- * @brief Recorder Session
- */
-
-#include "umcsession.h"
-
-class RecorderScenario;
-struct RecorderChannel;
-
-class RecorderSession : public UmcSession
-{
-public:
-/* ============================ CREATORS =================================== */
- RecorderSession(const RecorderScenario* pScenario);
- virtual ~RecorderSession();
-
-protected:
-/* ============================ MANIPULATORS =============================== */
- virtual bool Start();
-
- RecorderChannel* CreateRecorderChannel();
- bool StartRecorder(mrcp_channel_t* pMrcpChannel);
-
- mrcp_message_t* CreateRecordRequest(mrcp_channel_t* pMrcpChannel);
-
- FILE* GetAudioIn(const mpf_codec_descriptor_t* pDescriptor, apr_pool_t* pool) const;
-
-/* ============================ HANDLERS =================================== */
- virtual bool OnSessionTerminate(mrcp_sig_status_code_e status);
- virtual bool OnChannelAdd(mrcp_channel_t* channel, mrcp_sig_status_code_e status);
- virtual bool OnMessageReceive(mrcp_channel_t* channel, mrcp_message_t* message);
-
-/* ============================ ACCESSORS ================================== */
- const RecorderScenario* GetScenario() const;
-
-private:
-/* ============================ DATA ======================================= */
- RecorderChannel* m_pRecorderChannel;
-};
-
-
-/* ============================ INLINE METHODS ============================= */
-inline const RecorderScenario* RecorderSession::GetScenario() const
-{
- return (RecorderScenario*)m_pScenario;
-}
-
-#endif /* RECORDER_SESSION_H */
+++ /dev/null
-/*
- * 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: setparamscenario.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef SETPARAM_SCENARIO_H
-#define SETPARAM_SCENARIO_H
-
-/**
- * @file setaparamscenario.h
- * @brief Set Params Scenario
- */
-
-#include "umcscenario.h"
-
-class SetParamScenario : public UmcScenario
-{
-public:
-/* ============================ CREATORS =================================== */
-
-/* ============================ MANIPULATORS =============================== */
-
- virtual UmcSession* CreateSession();
-
-/* ============================ ACCESSORS ================================== */
-
-/* ============================ INQUIRIES ================================== */
-protected:
-/* ============================ MANIPULATORS =============================== */
-
-/* ============================ DATA ======================================= */
-};
-
-/* ============================ INLINE METHODS ============================= */
-
-#endif /* SETPARAM_SCENARIO_H */
+++ /dev/null
-/*
- * 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: setparamsession.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef SETPARAM_SESSION_H
-#define SETPARAM_SESSION_H
-
-/**
- * @file setparamsession.h
- * @brief Set Recognizer Params
- */
-
-#include <apr_tables.h>
-#include "umcsession.h"
-
-class SetParamScenario;
-struct RecogChannel;
-
-class SetParamSession : public UmcSession
-{
-public:
-/* ============================ CREATORS =================================== */
- SetParamSession(const SetParamScenario* pScenario);
- virtual ~SetParamSession();
-
-protected:
-/* ============================ MANIPULATORS =============================== */
- virtual bool Start();
-
- RecogChannel* CreateRecogChannel();
-
- bool CreateRequestQueue(mrcp_channel_t* pMrcpChannel);
- mrcp_message_t* CreateSetParams1(mrcp_channel_t* pMrcpChannel);
- mrcp_message_t* CreateGetParams1(mrcp_channel_t* pMrcpChannel);
- mrcp_message_t* CreateSetParams2(mrcp_channel_t* pMrcpChannel);
- mrcp_message_t* CreateGetParams2(mrcp_channel_t* pMrcpChannel);
- mrcp_message_t* CreateSetParams3(mrcp_channel_t* pMrcpChannel);
- mrcp_message_t* CreateGetParams3(mrcp_channel_t* pMrcpChannel);
-
- bool ProcessNextRequest(mrcp_channel_t* pMrcpChannel);
-
-/* ============================ HANDLERS =================================== */
- virtual bool OnSessionTerminate(mrcp_sig_status_code_e status);
- virtual bool OnChannelAdd(mrcp_channel_t* channel, mrcp_sig_status_code_e status);
- virtual bool OnMessageReceive(mrcp_channel_t* channel, mrcp_message_t* message);
-
-/* ============================ ACCESSORS ================================== */
- const SetParamScenario* GetScenario() const;
-
-private:
-/* ============================ DATA ======================================= */
- RecogChannel* m_pRecogChannel;
- apr_array_header_t* m_RequestQueue;
- int m_CurrentRequest;
-};
-
-
-/* ============================ INLINE METHODS ============================= */
-inline const SetParamScenario* SetParamSession::GetScenario() const
-{
- return (SetParamScenario*)m_pScenario;
-}
-
-#endif /* SETPARAM_SESSION_H */
+++ /dev/null
-/*
- * 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: synthscenario.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef SYNTH_SCENARIO_H
-#define SYNTH_SCENARIO_H
-
-/**
- * @file synthscenario.h
- * @brief Synthesizer Scenario
- */
-
-#include "umcscenario.h"
-
-class SynthScenario : public UmcScenario
-{
-public:
-/* ============================ CREATORS =================================== */
- SynthScenario();
- virtual ~SynthScenario();
-
-/* ============================ MANIPULATORS =============================== */
- virtual void Destroy();
-
- virtual UmcSession* CreateSession();
-
-/* ============================ ACCESSORS ================================== */
- const char* GetContentType() const;
- const char* GetContent() const;
-
-/* ============================ INQUIRIES ================================== */
- bool IsSpeakEnabled() const;
-
-protected:
-/* ============================ MANIPULATORS =============================== */
- virtual bool LoadElement(const apr_xml_elem* pElem, apr_pool_t* pool);
-
- bool LoadSpeak(const apr_xml_elem* pElem, apr_pool_t* pool);
-
-/* ============================ DATA ======================================= */
- bool m_Speak;
- const char* m_ContentType;
- const char* m_Content;
-};
-
-/* ============================ INLINE METHODS ============================= */
-inline const char* SynthScenario::GetContentType() const
-{
- return m_ContentType;
-}
-
-inline const char* SynthScenario::GetContent() const
-{
- return m_Content;
-}
-
-inline bool SynthScenario::IsSpeakEnabled() const
-{
- return m_Speak;
-}
-
-#endif /* SYNTH_SCENARIO_H */
+++ /dev/null
-/*
- * 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: synthsession.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef SYNTH_SESSION_H
-#define SYNTH_SESSION_H
-
-/**
- * @file synthsession.h
- * @brief Synthesizer Session
- */
-
-#include "umcsession.h"
-
-class SynthScenario;
-struct SynthChannel;
-
-class SynthSession : public UmcSession
-{
-public:
-/* ============================ CREATORS =================================== */
- SynthSession(const SynthScenario* pScenario);
- virtual ~SynthSession();
-
-protected:
-/* ============================ MANIPULATORS =============================== */
- virtual bool Start();
- virtual bool Stop();
-
- SynthChannel* CreateSynthChannel();
-
- mrcp_message_t* CreateSpeakRequest(mrcp_channel_t* pMrcpChannel);
- FILE* GetAudioOut(const mpf_codec_descriptor_t* pDescriptor, apr_pool_t* pool) const;
-
-/* ============================ HANDLERS =================================== */
- virtual bool OnSessionTerminate(mrcp_sig_status_code_e status);
- virtual bool OnChannelAdd(mrcp_channel_t* channel, mrcp_sig_status_code_e status);
- virtual bool OnMessageReceive(mrcp_channel_t* channel, mrcp_message_t* message);
-
-/* ============================ ACCESSORS ================================== */
- const SynthScenario* GetScenario() const;
-
-private:
-/* ============================ DATA ======================================= */
- SynthChannel* m_pSynthChannel;
-};
-
-
-/* ============================ INLINE METHODS ============================= */
-inline const SynthScenario* SynthSession::GetScenario() const
-{
- return (SynthScenario*)m_pScenario;
-}
-
-#endif /* SYNTH_SESSION_H */
+++ /dev/null
-/*
- * 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: umcconsole.h 2197 2014-10-16 01:34:19Z achaloyan@gmail.com $
- */
-
-#ifndef UMC_CONSOLE_H
-#define UMC_CONSOLE_H
-
-/**
- * @file umcconsole.h
- * @brief UMC Application Console
- */
-
-#include "apt_log.h"
-
-class UmcFramework;
-
-class UmcConsole
-{
-public:
-/* ============================ CREATORS =================================== */
- UmcConsole();
- ~UmcConsole();
-
-/* ============================ MANIPULATORS =============================== */
- bool Run(int argc, const char * const *argv);
-
-protected:
- bool LoadOptions(int argc, const char * const *argv, apr_pool_t *pool);
- bool RunCmdLine();
- bool ProcessCmdLine(char* pCmdLine);
- static void Usage();
-
-private:
-/* ============================ DATA ======================================= */
- struct UmcOptions
- {
- const char* m_RootDirPath;
- const char* m_DirLayoutConf;
- const char* m_LogPriority;
- const char* m_LogOutput;
-
- UmcOptions() :
- m_RootDirPath(NULL), m_DirLayoutConf(NULL),
- m_LogPriority(NULL), m_LogOutput(NULL) {}
- };
-
- UmcOptions m_Options;
- UmcFramework* m_pFramework;
-};
-
-#endif /* UMC_CONSOLE_H */
+++ /dev/null
-/*
- * 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: umcframework.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef UMC_FRAMEWORK_H
-#define UMC_FRAMEWORK_H
-
-/**
- * @file umcframework.h
- * @brief UMC Application Framework
- */
-
-#include <apr_xml.h>
-#include <apr_hash.h>
-#include "mrcp_application.h"
-#include "apt_consumer_task.h"
-
-class UmcSession;
-class UmcScenario;
-
-class UmcFramework
-{
-public:
-/* ============================ CREATORS =================================== */
- UmcFramework();
- ~UmcFramework();
-
-/* ============================ MANIPULATORS =============================== */
- bool Create(apt_dir_layout_t* pDirLayout, apr_pool_t* pool);
- void Destroy();
-
- void RunSession(const char* pScenarioName, const char* pProfileName);
- void StopSession(const char* id);
- void KillSession(const char* id);
-
- void ShowScenarios();
- void ShowSessions();
-
-protected:
- bool CreateMrcpClient();
- void DestroyMrcpClient();
-
- bool CreateTask();
- void DestroyTask();
-
- UmcScenario* CreateScenario(const char* pType);
- apr_xml_doc* LoadDocument();
-
- bool LoadScenarios();
- void DestroyScenarios();
-
- bool ProcessRunRequest(const char* pScenarioName, const char* pProfileName);
- void ProcessStopRequest(const char* id);
- void ProcessKillRequest(const char* id);
- void ProcessShowScenarios();
- void ProcessShowSessions();
-
- bool AddSession(UmcSession* pSession);
- bool RemoveSession(UmcSession* pSession);
-
-/* ============================ HANDLERS =================================== */
- friend apt_bool_t UmcProcessMsg(apt_task_t* pTask, apt_task_msg_t* pMsg);
- friend void UmcOnStartComplete(apt_task_t* pTask);
- friend void UmcOnTerminateComplete(apt_task_t* pTask);
-
- friend apt_bool_t AppMessageHandler(const mrcp_app_message_t* pAppMessage);
- friend apt_bool_t AppOnSessionTerminate(mrcp_application_t *application, mrcp_session_t *session, mrcp_sig_status_code_e status);
-
-private:
-/* ============================ DATA ======================================= */
- apr_pool_t* m_pPool;
- apt_dir_layout_t* m_pDirLayout;
- apt_consumer_task_t* m_pTask;
-
- mrcp_client_t* m_pMrcpClient;
- mrcp_application_t* m_pMrcpApplication;
-
- apr_hash_t* m_pScenarioTable;
- apr_hash_t* m_pSessionTable;
-};
-
-#endif /* UMC_FRAMEWORK_H */
+++ /dev/null
-/*
- * 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: umcscenario.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef UMC_SCENARIO_H
-#define UMC_SCENARIO_H
-
-/**
- * @file umcscenario.h
- * @brief UMC Scenario
- */
-
-#include <apr_xml.h>
-#include "mrcp_application.h"
-
-class UmcSession;
-
-class UmcScenario
-{
-public:
-/* ============================ CREATORS =================================== */
- UmcScenario();
- virtual ~UmcScenario();
-
-/* ============================ MANIPULATORS =============================== */
- virtual bool Load(const apr_xml_elem* pElem, apr_pool_t* pool);
- virtual void Destroy();
-
- virtual UmcSession* CreateSession() = 0;
-
- void SetDirLayout(apt_dir_layout_t* pDirLayout);
- void SetName(const char* pName);
- void SetMrcpProfile(const char* pMrcpProfile);
-
- bool InitCapabilities(mpf_stream_capabilities_t* pCapabilities) const;
-
-/* ============================ ACCESSORS ================================== */
- apt_dir_layout_t* GetDirLayout() const;
- const char* GetName() const;
- const char* GetMrcpProfile() const;
-
-/* ============================ INQUIRIES ================================== */
- bool IsDiscoveryEnabled() const;
-
-protected:
-/* ============================ MANIPULATORS =============================== */
- virtual bool LoadElement(const apr_xml_elem* pElem, apr_pool_t* pool);
-
- bool LoadDiscovery(const apr_xml_elem* pElem, apr_pool_t* pool);
- bool LoadTermination(const apr_xml_elem* pElem, apr_pool_t* pool);
- bool LoadCapabilities(const apr_xml_elem* pElem, apr_pool_t* pool);
- bool LoadRtpTermination(const apr_xml_elem* pElem, apr_pool_t* pool);
-
- const char* LoadFileContent(const char* pFileName, apr_size_t& size, apr_pool_t* pool) const;
- const char* LoadFileContent(const char* pFileName, apr_pool_t* pool) const;
- static int ParseRates(const char* pStr, apr_pool_t* pool);
-
-/* ============================ INQUIRIES ================================== */
- static bool IsElementEnabled(const apr_xml_elem* pElem);
-
-/* ============================ DATA ======================================= */
- const char* m_pName;
- const char* m_pMrcpProfile;
- apt_dir_layout_t* m_pDirLayout;
-
- bool m_ResourceDiscovery;
- mpf_codec_capabilities_t* m_pCapabilities;
- mpf_rtp_termination_descriptor_t* m_pRtpDescriptor;
-};
-
-
-/* ============================ INLINE METHODS ============================= */
-inline void UmcScenario::SetDirLayout(apt_dir_layout_t* pDirLayout)
-{
- m_pDirLayout = pDirLayout;
-}
-
-inline apt_dir_layout_t* UmcScenario::GetDirLayout() const
-{
- return m_pDirLayout;
-}
-
-inline void UmcScenario::SetName(const char* pName)
-{
- m_pName = pName;
-}
-
-inline const char* UmcScenario::GetName() const
-{
- return m_pName;
-}
-
-inline void UmcScenario::SetMrcpProfile(const char* pMrcpProfile)
-{
- m_pMrcpProfile = pMrcpProfile;
-}
-
-inline const char* UmcScenario::GetMrcpProfile() const
-{
- return m_pMrcpProfile;
-}
-
-inline bool UmcScenario::IsDiscoveryEnabled() const
-{
- return m_ResourceDiscovery;
-}
-
-
-inline const char* UmcScenario::LoadFileContent(const char* pFileName, apr_pool_t* pool) const
-{
- apr_size_t dummy;
- return LoadFileContent(pFileName, dummy, pool);
-}
-
-#endif /* UMC_SCENARIO_H */
+++ /dev/null
-/*
- * 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: umcsession.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef UMC_SESSION_H
-#define UMC_SESSION_H
-
-/**
- * @file umcsession.h
- * @brief UMC Session
- */
-
-#include "mrcp_application.h"
-
-class UmcScenario;
-
-class UmcSession
-{
-public:
-/* ============================ CREATORS =================================== */
- UmcSession(const UmcScenario* pScenario);
- virtual ~UmcSession();
-
-/* ============================ MANIPULATORS =============================== */
- virtual bool Run();
- virtual bool Stop();
- virtual bool Terminate();
-
- void SetMrcpProfile(const char* pMrcpProfile);
- void SetMrcpApplication(mrcp_application_t* pMrcpApplication);
-
-/* ============================ HANDLERS =================================== */
- virtual bool OnSessionTerminate(mrcp_sig_status_code_e status);
- virtual bool OnSessionUpdate(mrcp_sig_status_code_e status);
- virtual bool OnChannelAdd(mrcp_channel_t *channel, mrcp_sig_status_code_e status);
- virtual bool OnChannelRemove(mrcp_channel_t *channel, mrcp_sig_status_code_e status);
- virtual bool OnMessageReceive(mrcp_channel_t *channel, mrcp_message_t *message);
- virtual bool OnTerminateEvent(mrcp_channel_t *channel);
- virtual bool OnResourceDiscover(mrcp_session_descriptor_t* descriptor, mrcp_sig_status_code_e status);
-
-/* ============================ ACCESSORS ================================== */
- const UmcScenario* GetScenario() const;
-
- const char* GetId() const;
-
-protected:
-/* ============================ MANIPULATORS =============================== */
- virtual bool Start() = 0;
-
- bool CreateMrcpSession(const char* pProfileName);
- bool DestroyMrcpSession();
-
- bool AddMrcpChannel(mrcp_channel_t* pMrcpChannel);
- bool RemoveMrcpChannel(mrcp_channel_t* pMrcpChannel);
- bool SendMrcpRequest(mrcp_channel_t* pMrcpChannel, mrcp_message_t* pMrcpMessage);
- bool ResourceDiscover();
-
- mrcp_channel_t* CreateMrcpChannel(
- mrcp_resource_id resource_id,
- mpf_termination_t* pTermination,
- mpf_rtp_termination_descriptor_t* pRtpDescriptor,
- void* pObj);
- mpf_termination_t* CreateAudioTermination(
- const mpf_audio_stream_vtable_t* pStreamVtable,
- mpf_stream_capabilities_t* pCapabilities,
- void* pObj);
- mrcp_message_t* CreateMrcpMessage(
- mrcp_channel_t* pMrcpChannel,
- mrcp_method_id method_id);
-
-/* ============================ ACCESSORS ================================== */
- apr_pool_t* GetSessionPool() const;
- const char* GetMrcpSessionId() const;
- mrcp_message_t* GetMrcpMessage() const;
-
-/* ============================ DATA ======================================= */
- const UmcScenario* m_pScenario;
- const char* m_pMrcpProfile;
- char m_Id[10];
-
-private:
-/* ============================ DATA ======================================= */
- mrcp_application_t* m_pMrcpApplication;
- mrcp_session_t* m_pMrcpSession;
- mrcp_message_t* m_pMrcpMessage; /* last message sent */
- bool m_Running;
- bool m_Terminating;
-};
-
-
-/* ============================ INLINE METHODS ============================= */
-inline const UmcScenario* UmcSession::GetScenario() const
-{
- return m_pScenario;
-}
-
-inline const char* UmcSession::GetId() const
-{
- return m_Id;
-}
-
-inline void UmcSession::SetMrcpApplication(mrcp_application_t* pMrcpApplication)
-{
- m_pMrcpApplication = pMrcpApplication;
-}
-
-inline void UmcSession::SetMrcpProfile(const char* pMrcpProfile)
-{
- m_pMrcpProfile = pMrcpProfile;
-}
-
-inline mrcp_message_t* UmcSession::GetMrcpMessage() const
-{
- return m_pMrcpMessage;
-}
-
-#endif /* UMC_SESSION_H */
+++ /dev/null
-/*
- * 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: verifierscenario.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef VERIFIER_SCENARIO_H
-#define VERIFIER_SCENARIO_H
-
-/**
- * @file verifierscenario.h
- * @brief Verifier Scenario
- */
-
-#include "umcscenario.h"
-
-class VerifierScenario : public UmcScenario
-{
-public:
-/* ============================ CREATORS =================================== */
- VerifierScenario();
- virtual ~VerifierScenario();
-
-/* ============================ MANIPULATORS =============================== */
- virtual void Destroy();
-
- virtual UmcSession* CreateSession();
-
-/* ============================ ACCESSORS ================================== */
- const char* GetRepositoryURI() const;
- const char* GetVerificationMode() const;
- const char* GetVoiceprintIdentifier() const;
-
-/* ============================ INQUIRIES ================================== */
-protected:
-/* ============================ MANIPULATORS =============================== */
- virtual bool LoadElement(const apr_xml_elem* pElem, apr_pool_t* pool);
-
- bool LoadVerify(const apr_xml_elem* pElem, apr_pool_t* pool);
-
-/* ============================ DATA ======================================= */
- const char* m_RepositoryURI;
- const char* m_VerificationMode;
- const char* m_VoiceprintIdentifier;
-};
-
-/* ============================ INLINE METHODS ============================= */
-inline const char* VerifierScenario::GetRepositoryURI() const
-{
- return m_RepositoryURI;
-}
-
-inline const char* VerifierScenario::GetVerificationMode() const
-{
- return m_VerificationMode;
-}
-
-inline const char* VerifierScenario::GetVoiceprintIdentifier() const
-{
- return m_VoiceprintIdentifier;
-}
-
-#endif /* VERIFIER_SCENARIO_H */
+++ /dev/null
-/*
- * 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: verifiersession.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef VERIFIER_SESSION_H
-#define VERIFIER_SESSION_H
-
-/**
- * @file verifiersession.h
- * @brief Verifier Session
- */
-
-#include "umcsession.h"
-
-class VerifierScenario;
-struct VerifierChannel;
-
-class VerifierSession : public UmcSession
-{
-public:
-/* ============================ CREATORS =================================== */
- VerifierSession(const VerifierScenario* pScenario);
- virtual ~VerifierSession();
-
-protected:
-/* ============================ MANIPULATORS =============================== */
- virtual bool Start();
- virtual bool Stop();
-
- VerifierChannel* CreateVerifierChannel();
- bool StartVerification(mrcp_channel_t* pMrcpChannel);
-
- mrcp_message_t* CreateStartSessionRequest(mrcp_channel_t* pMrcpChannel);
- mrcp_message_t* CreateEndSessionRequest(mrcp_channel_t* pMrcpChannel);
- mrcp_message_t* CreateVerificationRequest(mrcp_channel_t* pMrcpChannel);
-
- FILE* GetAudioIn(const mpf_codec_descriptor_t* pDescriptor, apr_pool_t* pool) const;
-
-/* ============================ HANDLERS =================================== */
- virtual bool OnSessionTerminate(mrcp_sig_status_code_e status);
- virtual bool OnChannelAdd(mrcp_channel_t* channel, mrcp_sig_status_code_e status);
- virtual bool OnMessageReceive(mrcp_channel_t* channel, mrcp_message_t* message);
-
-/* ============================ ACCESSORS ================================== */
- const VerifierScenario* GetScenario() const;
-
-private:
-/* ============================ DATA ======================================= */
- VerifierChannel* m_pVerifierChannel;
- const char* m_ContentId;
-};
-
-
-/* ============================ INLINE METHODS ============================= */
-inline const VerifierScenario* VerifierSession::GetScenario() const
-{
- return (VerifierScenario*)m_pScenario;
-}
-
-#endif /* VERIFIER_SESSION_H */
+++ /dev/null
-/*
- * 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: dtmfscenario.cpp 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include <stdlib.h>
-#include "dtmfscenario.h"
-#include "dtmfsession.h"
-#include "apt_log.h"
-
-DtmfScenario::DtmfScenario() :
- m_ContentType(NULL),
- m_Grammar(NULL),
- m_Digits(NULL)
-{
-}
-
-DtmfScenario::~DtmfScenario()
-{
-}
-
-void DtmfScenario::Destroy()
-{
-}
-
-bool DtmfScenario::LoadElement(const apr_xml_elem* pElem, apr_pool_t* pool)
-{
- if(UmcScenario::LoadElement(pElem,pool))
- return true;
-
- if(strcasecmp(pElem->name,"recognize") == 0)
- {
- LoadRecognize(pElem,pool);
- return true;
- }
-
- return false;
-}
-
-bool DtmfScenario::LoadRecognize(const apr_xml_elem* pElem, apr_pool_t* pool)
-{
- const apr_xml_attr* pAttr;
- for(pAttr = pElem->attr; pAttr; pAttr = pAttr->next)
- {
- if(strcasecmp(pAttr->name,"content-type") == 0)
- {
- m_ContentType = pAttr->value;
- }
- else if(strcasecmp(pAttr->name,"grammar") == 0)
- {
- m_Grammar = pAttr->value;
- }
- else if(strcasecmp(pAttr->name,"digits") == 0)
- {
- m_Digits = pAttr->value;
- }
- }
-
- return true;
-}
-
-
-UmcSession* DtmfScenario::CreateSession()
-{
- return new DtmfSession(this);
-}
+++ /dev/null
-/*
- * 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: dtmfsession.cpp 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include "dtmfsession.h"
-#include "dtmfscenario.h"
-#include "mrcp_message.h"
-#include "mrcp_generic_header.h"
-#include "mrcp_recog_header.h"
-#include "mrcp_recog_resource.h"
-#include "mpf_dtmf_generator.h"
-#include "apt_nlsml_doc.h"
-#include "apt_log.h"
-
-struct RecogChannel
-{
- /** MRCP control channel */
- mrcp_channel_t* m_pMrcpChannel;
- /** DTMF generator */
- mpf_dtmf_generator_t* m_pDtmfGenerator;
- /** Streaming is in-progress */
- bool m_Streaming;
-};
-
-DtmfSession::DtmfSession(const DtmfScenario* pScenario) :
- UmcSession(pScenario),
- m_pRecogChannel(NULL)
-{
-}
-
-DtmfSession::~DtmfSession()
-{
-}
-
-bool DtmfSession::Start()
-{
- /* create channel and associate all the required data */
- m_pRecogChannel = CreateRecogChannel();
- if(!m_pRecogChannel)
- return false;
-
- /* add channel to session (send asynchronous request) */
- if(!AddMrcpChannel(m_pRecogChannel->m_pMrcpChannel))
- {
- delete m_pRecogChannel;
- m_pRecogChannel = NULL;
- return false;
- }
- return true;
-}
-
-bool DtmfSession::OnSessionTerminate(mrcp_sig_status_code_e status)
-{
- if(m_pRecogChannel)
- {
- if(m_pRecogChannel->m_pDtmfGenerator)
- {
- mpf_dtmf_generator_destroy(m_pRecogChannel->m_pDtmfGenerator);
- m_pRecogChannel->m_pDtmfGenerator = NULL;
- }
-
- delete m_pRecogChannel;
- m_pRecogChannel = NULL;
- }
- return UmcSession::OnSessionTerminate(status);
-}
-
-static apt_bool_t ReadStream(mpf_audio_stream_t* pStream, mpf_frame_t* pFrame)
-{
- RecogChannel* pRecogChannel = (RecogChannel*) pStream->obj;
- if(pRecogChannel && pRecogChannel->m_Streaming)
- {
- if(pRecogChannel->m_pDtmfGenerator)
- {
- mpf_dtmf_generator_put_frame(pRecogChannel->m_pDtmfGenerator,pFrame);
- }
- }
- return TRUE;
-}
-
-RecogChannel* DtmfSession::CreateRecogChannel()
-{
- mrcp_channel_t* pChannel;
- mpf_termination_t* pTermination;
- mpf_stream_capabilities_t* pCapabilities;
- apr_pool_t* pool = GetSessionPool();
-
- /* create channel */
- RecogChannel *pRecogChannel = new RecogChannel;
- pRecogChannel->m_pMrcpChannel = NULL;
- pRecogChannel->m_pDtmfGenerator = NULL;
- pRecogChannel->m_Streaming = false;
-
- /* create source stream capabilities */
- pCapabilities = mpf_source_stream_capabilities_create(pool);
- GetScenario()->InitCapabilities(pCapabilities);
-
- static const mpf_audio_stream_vtable_t audio_stream_vtable =
- {
- NULL,
- NULL,
- NULL,
- ReadStream,
- NULL,
- NULL,
- NULL,
- NULL
- };
-
- pTermination = CreateAudioTermination(
- &audio_stream_vtable, /* virtual methods table of audio stream */
- pCapabilities, /* capabilities of audio stream */
- pRecogChannel); /* object to associate */
-
- pChannel = CreateMrcpChannel(
- MRCP_RECOGNIZER_RESOURCE, /* MRCP resource identifier */
- pTermination, /* media termination, used to terminate audio stream */
- NULL, /* RTP descriptor, used to create RTP termination (NULL by default) */
- pRecogChannel); /* object to associate */
- if(!pChannel)
- {
- delete pRecogChannel;
- return NULL;
- }
-
- pRecogChannel->m_pMrcpChannel = pChannel;
- return pRecogChannel;
-}
-
-bool DtmfSession::OnChannelAdd(mrcp_channel_t* pMrcpChannel, mrcp_sig_status_code_e status)
-{
- if(!UmcSession::OnChannelAdd(pMrcpChannel,status))
- return false;
-
- if(status != MRCP_SIG_STATUS_CODE_SUCCESS)
- {
- /* error case, just terminate the demo */
- return Terminate();
- }
-
- RecogChannel* pRecogChannel = (RecogChannel*) mrcp_application_channel_object_get(pMrcpChannel);
- if(pRecogChannel)
- {
- const mpf_audio_stream_t* pStream = mrcp_application_audio_stream_get(pMrcpChannel);
- if(pStream)
- {
- pRecogChannel->m_pDtmfGenerator = mpf_dtmf_generator_create(pStream,GetSessionPool());
- }
- }
-
- return StartRecognition(pMrcpChannel);
-}
-
-bool DtmfSession::OnMessageReceive(mrcp_channel_t* pMrcpChannel, mrcp_message_t* pMrcpMessage)
-{
- if(!UmcSession::OnMessageReceive(pMrcpChannel,pMrcpMessage))
- return false;
-
- const DtmfScenario* pScenario = GetScenario();
- RecogChannel* pRecogChannel = (RecogChannel*) mrcp_application_channel_object_get(pMrcpChannel);
- if(pMrcpMessage->start_line.message_type == MRCP_MESSAGE_TYPE_RESPONSE)
- {
- if(pMrcpMessage->start_line.method_id == RECOGNIZER_RECOGNIZE)
- {
- /* received the response to RECOGNIZE request */
- if(pMrcpMessage->start_line.request_state == MRCP_REQUEST_STATE_INPROGRESS)
- {
- /* start to stream the DTMFs to recognize */
- if(pRecogChannel && pRecogChannel->m_pDtmfGenerator)
- {
- const char* digits = pScenario->GetDigits();
- if(digits)
- {
- mpf_dtmf_generator_enqueue(pRecogChannel->m_pDtmfGenerator,digits);
- pRecogChannel->m_Streaming = true;
- }
- }
- }
- else
- {
- /* received unexpected response, terminate the session */
- Terminate();
- }
- }
- else
- {
- /* received unexpected response */
- }
- }
- else if(pMrcpMessage->start_line.message_type == MRCP_MESSAGE_TYPE_EVENT)
- {
- if(pMrcpMessage->start_line.method_id == RECOGNIZER_RECOGNITION_COMPLETE)
- {
- ParseNLSMLResult(pMrcpMessage);
- if(pRecogChannel)
- {
- pRecogChannel->m_Streaming = false;
- }
- Terminate();
- }
- else if(pMrcpMessage->start_line.method_id == RECOGNIZER_START_OF_INPUT)
- {
- /* received start-of-input, do whatever you need here */
- }
- }
- return true;
-}
-
-bool DtmfSession::StartRecognition(mrcp_channel_t* pMrcpChannel)
-{
- RecogChannel* pRecogChannel = (RecogChannel*) mrcp_application_channel_object_get(pMrcpChannel);
- /* create and send RECOGNIZE request */
- mrcp_message_t* pMrcpMessage = CreateRecognizeRequest(pMrcpChannel);
- if(pMrcpMessage)
- {
- SendMrcpRequest(pRecogChannel->m_pMrcpChannel,pMrcpMessage);
- }
-
- return true;
-}
-
-mrcp_message_t* DtmfSession::CreateRecognizeRequest(mrcp_channel_t* pMrcpChannel)
-{
- mrcp_message_t* pMrcpMessage = CreateMrcpMessage(pMrcpChannel,RECOGNIZER_RECOGNIZE);
- if(!pMrcpMessage)
- return NULL;
-
- const DtmfScenario* pScenario = GetScenario();
-
- mrcp_generic_header_t* pGenericHeader;
- mrcp_recog_header_t* pRecogHeader;
-
- /* get/allocate generic header */
- pGenericHeader = (mrcp_generic_header_t*) mrcp_generic_header_prepare(pMrcpMessage);
- if(pGenericHeader)
- {
- apt_string_assign(&pGenericHeader->content_type,pScenario->GetContentType(),pMrcpMessage->pool);
- mrcp_generic_header_property_add(pMrcpMessage,GENERIC_HEADER_CONTENT_TYPE);
- /* set message body */
- if(pScenario->GetGrammar())
- apt_string_assign(&pMrcpMessage->body,pScenario->GetGrammar(),pMrcpMessage->pool);
- }
- /* get/allocate recognizer header */
- pRecogHeader = (mrcp_recog_header_t*) mrcp_resource_header_prepare(pMrcpMessage);
- if(pRecogHeader)
- {
- /* set recognizer header fields */
- if(pMrcpMessage->start_line.version == MRCP_VERSION_2)
- {
- pRecogHeader->cancel_if_queue = FALSE;
- mrcp_resource_header_property_add(pMrcpMessage,RECOGNIZER_HEADER_CANCEL_IF_QUEUE);
- }
- }
- return pMrcpMessage;
-}
-
-bool DtmfSession::ParseNLSMLResult(mrcp_message_t* pMrcpMessage)
-{
- nlsml_result_t *pResult = nlsml_result_parse(pMrcpMessage->body.buf, pMrcpMessage->body.length, pMrcpMessage->pool);
- if(!pResult)
- return false;
-
- nlsml_result_trace(pResult, pMrcpMessage->pool);
- return true;
-}
+++ /dev/null
-/*
- * 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: main.cpp 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include "umcconsole.h"
-
-int main(int argc, const char * const *argv)
-{
- UmcConsole console;
- console.Run(argc,argv);
- return 0;
-}
+++ /dev/null
-/*
- * 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: recogscenario.cpp 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include <stdlib.h>
-#include "recogscenario.h"
-#include "recogsession.h"
-#include "mrcp_message.h"
-#include "mrcp_generic_header.h"
-#include "mrcp_recog_header.h"
-#include "mrcp_recog_resource.h"
-#include "apt_log.h"
-
-RecogScenario::RecogScenario() :
- m_DefineGrammar(true),
- m_Recognize(true),
- m_ContentType("application/srgs+xml"),
- m_Content(NULL),
- m_ContentLength(0),
- m_AudioSource(NULL)
-{
-}
-
-RecogScenario::~RecogScenario()
-{
-}
-
-void RecogScenario::Destroy()
-{
-}
-
-bool RecogScenario::LoadElement(const apr_xml_elem* pElem, apr_pool_t* pool)
-{
- if(UmcScenario::LoadElement(pElem,pool))
- return true;
-
- if(strcasecmp(pElem->name,"define-grammar") == 0)
- {
- LoadDefineGrammar(pElem,pool);
- return true;
- }
- else if(strcasecmp(pElem->name,"recognize") == 0)
- {
- LoadRecognize(pElem,pool);
- return true;
- }
-
- return false;
-}
-
-bool RecogScenario::LoadRecognize(const apr_xml_elem* pElem, apr_pool_t* pool)
-{
- const apr_xml_attr* pAttr;
- for(pAttr = pElem->attr; pAttr; pAttr = pAttr->next)
- {
- if(strcasecmp(pAttr->name,"enable") == 0)
- {
- m_Recognize = atoi(pAttr->value) > 0;
- }
- else if(strcasecmp(pAttr->name,"content-type") == 0)
- {
- m_ContentType = pAttr->value;
- }
- else if(strcasecmp(pAttr->name,"content-location") == 0)
- {
- m_Content = LoadFileContent(pAttr->value,pool);
- }
- else if(strcasecmp(pAttr->name,"audio-source") == 0)
- {
- m_AudioSource = pAttr->value;
- }
- }
-
- return true;
-}
-
-bool RecogScenario::LoadDefineGrammar(const apr_xml_elem* pElem, apr_pool_t* pool)
-{
- const apr_xml_attr* pAttr;
- for(pAttr = pElem->attr; pAttr; pAttr = pAttr->next)
- {
- if(strcasecmp(pAttr->name,"enable") == 0)
- {
- m_DefineGrammar = atoi(pAttr->value) > 0;
- }
- else if(strcasecmp(pAttr->name,"content-type") == 0)
- {
- m_ContentType = pAttr->value;
- }
- else if(strcasecmp(pAttr->name,"content-location") == 0)
- {
- m_Content = LoadFileContent(pAttr->value,m_ContentLength,pool);
- }
- }
- return true;
-}
-
-
-UmcSession* RecogScenario::CreateSession()
-{
- return new RecogSession(this);
-}
+++ /dev/null
-/*
- * 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: recogsession.cpp 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include "recogsession.h"
-#include "recogscenario.h"
-#include "mrcp_message.h"
-#include "mrcp_generic_header.h"
-#include "mrcp_recog_header.h"
-#include "mrcp_recog_resource.h"
-#include "apt_nlsml_doc.h"
-#include "apt_log.h"
-
-struct RecogChannel
-{
- /** MRCP control channel */
- mrcp_channel_t* m_pMrcpChannel;
- /** IN-PROGRESS RECOGNIZE request */
- mrcp_message_t* m_pRecogRequest;
- /** Streaming is in-progress */
- bool m_Streaming;
- /** File to read audio stream from */
- FILE* m_pAudioIn;
- /** Estimated time to complete (used if no audio_in available) */
- apr_size_t m_TimeToComplete;
-
- RecogChannel() :
- m_pMrcpChannel(NULL),
- m_pRecogRequest(NULL),
- m_Streaming(false),
- m_pAudioIn(NULL),
- m_TimeToComplete(0) {}
-};
-
-RecogSession::RecogSession(const RecogScenario* pScenario) :
- UmcSession(pScenario),
- m_pRecogChannel(NULL),
- m_ContentId("request1@form-level")
-{
-}
-
-RecogSession::~RecogSession()
-{
-}
-
-bool RecogSession::Start()
-{
- const RecogScenario* pScenario = GetScenario();
- if(!pScenario->IsDefineGrammarEnabled() && !pScenario->IsRecognizeEnabled())
- return false;
-
- /* create channel and associate all the required data */
- m_pRecogChannel = CreateRecogChannel();
- if(!m_pRecogChannel)
- return false;
-
- /* add channel to session (send asynchronous request) */
- if(!AddMrcpChannel(m_pRecogChannel->m_pMrcpChannel))
- {
- delete m_pRecogChannel;
- m_pRecogChannel = NULL;
- return false;
- }
- return true;
-}
-
-bool RecogSession::Stop()
-{
- if(!UmcSession::Stop())
- return false;
-
- if(!m_pRecogChannel)
- return false;
-
- mrcp_message_t* pStopMessage = CreateMrcpMessage(m_pRecogChannel->m_pMrcpChannel,RECOGNIZER_STOP);
- if(!pStopMessage)
- return false;
-
- if(m_pRecogChannel->m_pRecogRequest)
- {
- mrcp_generic_header_t* pGenericHeader;
- /* get/allocate generic header */
- pGenericHeader = (mrcp_generic_header_t*) mrcp_generic_header_prepare(pStopMessage);
- if(pGenericHeader)
- {
- pGenericHeader->active_request_id_list.count = 1;
- pGenericHeader->active_request_id_list.ids[0] =
- m_pRecogChannel->m_pRecogRequest->start_line.request_id;
- mrcp_generic_header_property_add(pStopMessage,GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST);
- }
-
- m_pRecogChannel->m_pRecogRequest = NULL;
- }
-
- return SendMrcpRequest(m_pRecogChannel->m_pMrcpChannel,pStopMessage);
-}
-
-bool RecogSession::OnSessionTerminate(mrcp_sig_status_code_e status)
-{
- if(m_pRecogChannel)
- {
- FILE* pAudioIn = m_pRecogChannel->m_pAudioIn;
- if(pAudioIn)
- {
- m_pRecogChannel->m_pAudioIn = NULL;
- fclose(pAudioIn);
- }
-
- delete m_pRecogChannel;
- m_pRecogChannel = NULL;
- }
- return UmcSession::OnSessionTerminate(status);
-}
-
-static apt_bool_t ReadStream(mpf_audio_stream_t* pStream, mpf_frame_t* pFrame)
-{
- RecogChannel* pRecogChannel = (RecogChannel*) pStream->obj;
- if(pRecogChannel && pRecogChannel->m_Streaming)
- {
- if(pRecogChannel->m_pAudioIn)
- {
- if(fread(pFrame->codec_frame.buffer,1,pFrame->codec_frame.size,pRecogChannel->m_pAudioIn) == pFrame->codec_frame.size)
- {
- /* normal read */
- pFrame->type |= MEDIA_FRAME_TYPE_AUDIO;
- }
- else
- {
- /* file is over */
- pRecogChannel->m_Streaming = false;
- }
- }
- else
- {
- /* fill with silence in case no file available */
- if(pRecogChannel->m_TimeToComplete >= CODEC_FRAME_TIME_BASE)
- {
- pFrame->type |= MEDIA_FRAME_TYPE_AUDIO;
- memset(pFrame->codec_frame.buffer,0,pFrame->codec_frame.size);
- pRecogChannel->m_TimeToComplete -= CODEC_FRAME_TIME_BASE;
- }
- else
- {
- pRecogChannel->m_Streaming = false;
- }
- }
- }
- return TRUE;
-}
-
-RecogChannel* RecogSession::CreateRecogChannel()
-{
- mrcp_channel_t* pChannel;
- mpf_termination_t* pTermination;
- mpf_stream_capabilities_t* pCapabilities;
- apr_pool_t* pool = GetSessionPool();
-
- /* create channel */
- RecogChannel* pRecogChannel = new RecogChannel;
-
- /* create source stream capabilities */
- pCapabilities = mpf_source_stream_capabilities_create(pool);
- GetScenario()->InitCapabilities(pCapabilities);
-
- static const mpf_audio_stream_vtable_t audio_stream_vtable =
- {
- NULL,
- NULL,
- NULL,
- ReadStream,
- NULL,
- NULL,
- NULL,
- NULL
- };
-
- pTermination = CreateAudioTermination(
- &audio_stream_vtable, /* virtual methods table of audio stream */
- pCapabilities, /* capabilities of audio stream */
- pRecogChannel); /* object to associate */
-
- pChannel = CreateMrcpChannel(
- MRCP_RECOGNIZER_RESOURCE, /* MRCP resource identifier */
- pTermination, /* media termination, used to terminate audio stream */
- NULL, /* RTP descriptor, used to create RTP termination (NULL by default) */
- pRecogChannel); /* object to associate */
- if(!pChannel)
- {
- delete pRecogChannel;
- return NULL;
- }
-
- pRecogChannel->m_pMrcpChannel = pChannel;
- return pRecogChannel;
-}
-
-bool RecogSession::OnChannelAdd(mrcp_channel_t* pMrcpChannel, mrcp_sig_status_code_e status)
-{
- if(!UmcSession::OnChannelAdd(pMrcpChannel,status))
- return false;
-
- if(status != MRCP_SIG_STATUS_CODE_SUCCESS)
- {
- /* error case, just terminate the demo */
- return Terminate();
- }
-
- if(GetScenario()->IsDefineGrammarEnabled())
- {
- mrcp_message_t* pMrcpMessage = CreateDefineGrammarRequest(pMrcpChannel);
- if(pMrcpMessage)
- SendMrcpRequest(pMrcpChannel,pMrcpMessage);
- return true;
- }
-
- return StartRecognition(pMrcpChannel);
-}
-
-bool RecogSession::OnMessageReceive(mrcp_channel_t* pMrcpChannel, mrcp_message_t* pMrcpMessage)
-{
- if(!UmcSession::OnMessageReceive(pMrcpChannel,pMrcpMessage))
- return false;
-
- RecogChannel* pRecogChannel = (RecogChannel*) mrcp_application_channel_object_get(pMrcpChannel);
- if(pMrcpMessage->start_line.message_type == MRCP_MESSAGE_TYPE_RESPONSE)
- {
- /* received MRCP response */
- if(pMrcpMessage->start_line.method_id == RECOGNIZER_DEFINE_GRAMMAR)
- {
- /* received the response to DEFINE-GRAMMAR request */
- if(pMrcpMessage->start_line.request_state == MRCP_REQUEST_STATE_COMPLETE)
- {
- OnDefineGrammar(pMrcpChannel);
- }
- else
- {
- /* received unexpected response, terminate the session */
- Terminate();
- }
- }
- else if(pMrcpMessage->start_line.method_id == RECOGNIZER_RECOGNIZE)
- {
- /* received the response to RECOGNIZE request */
- if(pMrcpMessage->start_line.request_state == MRCP_REQUEST_STATE_INPROGRESS)
- {
- RecogChannel* pRecogChannel = (RecogChannel*) mrcp_application_channel_object_get(pMrcpChannel);
- if(pRecogChannel)
- pRecogChannel->m_pRecogRequest = GetMrcpMessage();
-
- /* start to stream the speech to recognize */
- if(pRecogChannel)
- pRecogChannel->m_Streaming = true;
- }
- else
- {
- /* received unexpected response, terminate the session */
- Terminate();
- }
- }
- else
- {
- /* received unexpected response */
- }
- }
- else if(pMrcpMessage->start_line.message_type == MRCP_MESSAGE_TYPE_EVENT)
- {
- if(pMrcpMessage->start_line.method_id == RECOGNIZER_RECOGNITION_COMPLETE)
- {
- ParseNLSMLResult(pMrcpMessage);
- if(pRecogChannel)
- pRecogChannel->m_Streaming = false;
-
- RecogChannel* pRecogChannel = (RecogChannel*) mrcp_application_channel_object_get(pMrcpChannel);
- if(pRecogChannel)
- pRecogChannel->m_pRecogRequest = NULL;
-
- Terminate();
- }
- else if(pMrcpMessage->start_line.method_id == RECOGNIZER_START_OF_INPUT)
- {
- /* received start-of-input, do whatever you need here */
- }
- }
- return true;
-}
-
-bool RecogSession::OnDefineGrammar(mrcp_channel_t* pMrcpChannel)
-{
- if(GetScenario()->IsRecognizeEnabled())
- {
- return StartRecognition(pMrcpChannel);
- }
-
- return Terminate();
-}
-
-bool RecogSession::StartRecognition(mrcp_channel_t* pMrcpChannel)
-{
- const mpf_codec_descriptor_t* pDescriptor = mrcp_application_source_descriptor_get(pMrcpChannel);
- if(!pDescriptor)
- {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Get Media Source Descriptor");
- return Terminate();
- }
-
- RecogChannel* pRecogChannel = (RecogChannel*) mrcp_application_channel_object_get(pMrcpChannel);
- /* create and send RECOGNIZE request */
- mrcp_message_t* pMrcpMessage = CreateRecognizeRequest(pMrcpChannel);
- if(pMrcpMessage)
- {
- SendMrcpRequest(pRecogChannel->m_pMrcpChannel,pMrcpMessage);
- }
-
- pRecogChannel->m_pAudioIn = GetAudioIn(pDescriptor,GetSessionPool());
- if(!pRecogChannel->m_pAudioIn)
- {
- /* no audio input availble, set some estimated time to complete instead */
- pRecogChannel->m_TimeToComplete = 5000; // 5 sec
- }
- return true;
-}
-
-mrcp_message_t* RecogSession::CreateDefineGrammarRequest(mrcp_channel_t* pMrcpChannel)
-{
- mrcp_message_t* pMrcpMessage = CreateMrcpMessage(pMrcpChannel,RECOGNIZER_DEFINE_GRAMMAR);
- if(!pMrcpMessage)
- return NULL;
-
- const RecogScenario* pScenario = GetScenario();
-
- mrcp_generic_header_t* pGenericHeader;
- /* get/allocate generic header */
- pGenericHeader = (mrcp_generic_header_t*) mrcp_generic_header_prepare(pMrcpMessage);
- if(pGenericHeader)
- {
- /* set generic header fields */
- if(pScenario->GetContentType())
- {
- apt_string_assign(&pGenericHeader->content_type,pScenario->GetContentType(),pMrcpMessage->pool);
- mrcp_generic_header_property_add(pMrcpMessage,GENERIC_HEADER_CONTENT_TYPE);
- }
- apt_string_assign(&pGenericHeader->content_id,m_ContentId,pMrcpMessage->pool);
- mrcp_generic_header_property_add(pMrcpMessage,GENERIC_HEADER_CONTENT_ID);
- }
-
- /* set message body */
- if(pScenario->GetContent())
- apt_string_assign_n(&pMrcpMessage->body,pScenario->GetContent(),pScenario->GetContentLength(),pMrcpMessage->pool);
- return pMrcpMessage;
-}
-
-mrcp_message_t* RecogSession::CreateRecognizeRequest(mrcp_channel_t* pMrcpChannel)
-{
- mrcp_message_t* pMrcpMessage = CreateMrcpMessage(pMrcpChannel,RECOGNIZER_RECOGNIZE);
- if(!pMrcpMessage)
- return NULL;
-
- const RecogScenario* pScenario = GetScenario();
-
- mrcp_generic_header_t* pGenericHeader;
- mrcp_recog_header_t* pRecogHeader;
-
- /* get/allocate generic header */
- pGenericHeader = (mrcp_generic_header_t*) mrcp_generic_header_prepare(pMrcpMessage);
- if(pGenericHeader)
- {
- /* set generic header fields */
- if(pScenario->IsDefineGrammarEnabled())
- {
- apt_string_assign(&pGenericHeader->content_type,"text/uri-list",pMrcpMessage->pool);
- /* set message body */
- const char* pContent = apr_pstrcat(pMrcpMessage->pool,"session:",m_ContentId,NULL);
- apt_string_set(&pMrcpMessage->body,pContent);
- }
- else
- {
- apt_string_assign(&pGenericHeader->content_type,pScenario->GetContentType(),pMrcpMessage->pool);
- /* set content-id */
- apt_string_assign(&pGenericHeader->content_id,m_ContentId,pMrcpMessage->pool);
- mrcp_generic_header_property_add(pMrcpMessage,GENERIC_HEADER_CONTENT_ID);
- /* set message body */
- if(pScenario->GetContent())
- apt_string_assign(&pMrcpMessage->body,pScenario->GetContent(),pMrcpMessage->pool);
- }
- mrcp_generic_header_property_add(pMrcpMessage,GENERIC_HEADER_CONTENT_TYPE);
- }
- /* get/allocate recognizer header */
- pRecogHeader = (mrcp_recog_header_t*) mrcp_resource_header_prepare(pMrcpMessage);
- if(pRecogHeader)
- {
- /* set recognizer header fields */
- if(pMrcpMessage->start_line.version == MRCP_VERSION_2)
- {
- pRecogHeader->cancel_if_queue = FALSE;
- mrcp_resource_header_property_add(pMrcpMessage,RECOGNIZER_HEADER_CANCEL_IF_QUEUE);
- }
- pRecogHeader->no_input_timeout = 5000;
- mrcp_resource_header_property_add(pMrcpMessage,RECOGNIZER_HEADER_NO_INPUT_TIMEOUT);
- pRecogHeader->recognition_timeout = 10000;
- mrcp_resource_header_property_add(pMrcpMessage,RECOGNIZER_HEADER_RECOGNITION_TIMEOUT);
- pRecogHeader->start_input_timers = TRUE;
- mrcp_resource_header_property_add(pMrcpMessage,RECOGNIZER_HEADER_START_INPUT_TIMERS);
- pRecogHeader->confidence_threshold = 0.87f;
- mrcp_resource_header_property_add(pMrcpMessage,RECOGNIZER_HEADER_CONFIDENCE_THRESHOLD);
- pRecogHeader->save_waveform = TRUE;
- mrcp_resource_header_property_add(pMrcpMessage,RECOGNIZER_HEADER_SAVE_WAVEFORM);
- }
- return pMrcpMessage;
-}
-
-bool RecogSession::ParseNLSMLResult(mrcp_message_t* pMrcpMessage)
-{
- nlsml_result_t *pResult = nlsml_result_parse(pMrcpMessage->body.buf, pMrcpMessage->body.length, pMrcpMessage->pool);
- if(!pResult)
- return false;
-
- nlsml_result_trace(pResult, pMrcpMessage->pool);
- return true;
-}
-
-FILE* RecogSession::GetAudioIn(const mpf_codec_descriptor_t* pDescriptor, apr_pool_t* pool) const
-{
- const char* pFileName = GetScenario()->GetAudioSource();
- if(!pFileName)
- {
- pFileName = apr_psprintf(pool,"one-%dkHz.pcm",pDescriptor->sampling_rate/1000);
- }
- apt_dir_layout_t* pDirLayout = GetScenario()->GetDirLayout();
- const char* pFilePath = apt_datadir_filepath_get(pDirLayout,pFileName,pool);
- if(!pFilePath)
- return NULL;
-
- FILE* pFile = fopen(pFilePath,"rb");
- if(!pFile)
- {
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Cannot Find [%s]",pFilePath);
- return NULL;
- }
-
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set [%s] as Speech Source",pFilePath);
- return pFile;
-}
+++ /dev/null
-/*
- * 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: recorderscenario.cpp 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include <stdlib.h>
-#include "recorderscenario.h"
-#include "recordersession.h"
-
-RecorderScenario::RecorderScenario() :
- m_Record(true),
- m_AudioSource(NULL)
-{
-}
-
-RecorderScenario::~RecorderScenario()
-{
-}
-
-void RecorderScenario::Destroy()
-{
-}
-
-bool RecorderScenario::LoadElement(const apr_xml_elem* pElem, apr_pool_t* pool)
-{
- if(UmcScenario::LoadElement(pElem,pool))
- return true;
-
- if(strcasecmp(pElem->name,"record") == 0)
- {
- LoadRecord(pElem,pool);
- return true;
- }
-
- return false;
-}
-
-bool RecorderScenario::LoadRecord(const apr_xml_elem* pElem, apr_pool_t* pool)
-{
- const apr_xml_attr* pAttr;
- for(pAttr = pElem->attr; pAttr; pAttr = pAttr->next)
- {
- if(strcasecmp(pAttr->name,"enable") == 0)
- {
- m_Record = atoi(pAttr->value) > 0;
- }
- else if(strcasecmp(pAttr->name,"audio-source") == 0)
- {
- m_AudioSource = pAttr->value;
- }
- }
-
- return true;
-}
-
-UmcSession* RecorderScenario::CreateSession()
-{
- return new RecorderSession(this);
-}
+++ /dev/null
-/*
- * 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: recordersession.cpp 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include "recordersession.h"
-#include "recorderscenario.h"
-#include "mrcp_message.h"
-#include "mrcp_generic_header.h"
-#include "mrcp_recorder_header.h"
-#include "mrcp_recorder_resource.h"
-#include "apt_log.h"
-
-struct RecorderChannel
-{
- /** MRCP control channel */
- mrcp_channel_t* m_pMrcpChannel;
- /** Streaming is in-progress */
- bool m_Streaming;
- /** File to read audio stream from */
- FILE* m_pAudioIn;
-};
-
-RecorderSession::RecorderSession(const RecorderScenario* pScenario) :
- UmcSession(pScenario),
- m_pRecorderChannel(NULL)
-{
-}
-
-RecorderSession::~RecorderSession()
-{
-}
-
-bool RecorderSession::Start()
-{
- const RecorderScenario* pScenario = GetScenario();
- if(!pScenario->IsRecordEnabled())
- return false;
-
- /* create channel and associate all the required data */
- m_pRecorderChannel = CreateRecorderChannel();
- if(!m_pRecorderChannel)
- return false;
-
- /* add channel to session (send asynchronous request) */
- if(!AddMrcpChannel(m_pRecorderChannel->m_pMrcpChannel))
- {
- delete m_pRecorderChannel;
- m_pRecorderChannel = NULL;
- return false;
- }
- return true;
-}
-
-bool RecorderSession::OnSessionTerminate(mrcp_sig_status_code_e status)
-{
- if(m_pRecorderChannel)
- {
- FILE* pAudioIn = m_pRecorderChannel->m_pAudioIn;
- if(pAudioIn)
- {
- m_pRecorderChannel->m_pAudioIn = NULL;
- fclose(pAudioIn);
- }
-
- delete m_pRecorderChannel;
- m_pRecorderChannel = NULL;
- }
- return UmcSession::OnSessionTerminate(status);
-}
-
-static apt_bool_t ReadStream(mpf_audio_stream_t* pStream, mpf_frame_t* pFrame)
-{
- RecorderChannel* pRecorderChannel = (RecorderChannel*) pStream->obj;
- if(pRecorderChannel && pRecorderChannel->m_Streaming)
- {
- if(pRecorderChannel->m_pAudioIn)
- {
- if(fread(pFrame->codec_frame.buffer,1,pFrame->codec_frame.size,pRecorderChannel->m_pAudioIn) == pFrame->codec_frame.size)
- {
- /* normal read */
- pFrame->type |= MEDIA_FRAME_TYPE_AUDIO;
- }
- else
- {
- /* file is over */
- pRecorderChannel->m_Streaming = false;
- }
- }
- }
- return TRUE;
-}
-
-RecorderChannel* RecorderSession::CreateRecorderChannel()
-{
- mrcp_channel_t* pChannel;
- mpf_termination_t* pTermination;
- mpf_stream_capabilities_t* pCapabilities;
- apr_pool_t* pool = GetSessionPool();
-
- /* create channel */
- RecorderChannel *pRecorderChannel = new RecorderChannel;
- pRecorderChannel->m_pMrcpChannel = NULL;
- pRecorderChannel->m_Streaming = false;
- pRecorderChannel->m_pAudioIn = NULL;
-
- /* create source stream capabilities */
- pCapabilities = mpf_source_stream_capabilities_create(pool);
- GetScenario()->InitCapabilities(pCapabilities);
-
- static const mpf_audio_stream_vtable_t audio_stream_vtable =
- {
- NULL,
- NULL,
- NULL,
- ReadStream,
- NULL,
- NULL,
- NULL,
- NULL
- };
-
- pTermination = CreateAudioTermination(
- &audio_stream_vtable, /* virtual methods table of audio stream */
- pCapabilities, /* capabilities of audio stream */
- pRecorderChannel); /* object to associate */
-
- pChannel = CreateMrcpChannel(
- MRCP_RECORDER_RESOURCE, /* MRCP resource identifier */
- pTermination, /* media termination, used to terminate audio stream */
- NULL, /* RTP descriptor, used to create RTP termination (NULL by default) */
- pRecorderChannel); /* object to associate */
- if(!pChannel)
- {
- delete pRecorderChannel;
- return NULL;
- }
-
- pRecorderChannel->m_pMrcpChannel = pChannel;
- return pRecorderChannel;
-}
-
-bool RecorderSession::OnChannelAdd(mrcp_channel_t* pMrcpChannel, mrcp_sig_status_code_e status)
-{
- if(!UmcSession::OnChannelAdd(pMrcpChannel,status))
- return false;
-
- if(status != MRCP_SIG_STATUS_CODE_SUCCESS)
- {
- /* error case, just terminate the demo */
- return Terminate();
- }
-
- return StartRecorder(pMrcpChannel);
-}
-
-bool RecorderSession::OnMessageReceive(mrcp_channel_t* pMrcpChannel, mrcp_message_t* pMrcpMessage)
-{
- if(!UmcSession::OnMessageReceive(pMrcpChannel,pMrcpMessage))
- return false;
-
- RecorderChannel* pRecorderChannel = (RecorderChannel*) mrcp_application_channel_object_get(pMrcpChannel);
- if(pMrcpMessage->start_line.message_type == MRCP_MESSAGE_TYPE_RESPONSE)
- {
- /* received MRCP response */
- if(pMrcpMessage->start_line.method_id == RECORDER_RECORD)
- {
- /* received the response to RECORD request */
- if(pMrcpMessage->start_line.request_state == MRCP_REQUEST_STATE_INPROGRESS)
- {
- /* start to stream the speech to record */
- if(pRecorderChannel)
- {
- pRecorderChannel->m_Streaming = true;
- }
- }
- else
- {
- /* received unexpected response, terminate the session */
- Terminate();
- }
- }
- else
- {
- /* received unexpected response */
- }
- }
- else if(pMrcpMessage->start_line.message_type == MRCP_MESSAGE_TYPE_EVENT)
- {
- if(pMrcpMessage->start_line.method_id == RECORDER_RECORD_COMPLETE)
- {
- if(pRecorderChannel)
- {
- pRecorderChannel->m_Streaming = false;
- }
- Terminate();
- }
- else if(pMrcpMessage->start_line.method_id == RECORDER_START_OF_INPUT)
- {
- /* received start-of-input, do whatever you need here */
- }
- }
- return true;
-}
-
-bool RecorderSession::StartRecorder(mrcp_channel_t* pMrcpChannel)
-{
- const mpf_codec_descriptor_t* pDescriptor = mrcp_application_source_descriptor_get(pMrcpChannel);
- if(!pDescriptor)
- {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Get Media Source Descriptor");
- return Terminate();
- }
-
- RecorderChannel* pRecorderChannel = (RecorderChannel*) mrcp_application_channel_object_get(pMrcpChannel);
- /* create and send RECORD request */
- mrcp_message_t* pMrcpMessage = CreateRecordRequest(pMrcpChannel);
- if(pMrcpMessage)
- {
- SendMrcpRequest(pRecorderChannel->m_pMrcpChannel,pMrcpMessage);
- }
-
- pRecorderChannel->m_pAudioIn = GetAudioIn(pDescriptor,GetSessionPool());
- return true;
-}
-
-mrcp_message_t* RecorderSession::CreateRecordRequest(mrcp_channel_t* pMrcpChannel)
-{
- mrcp_message_t* pMrcpMessage = CreateMrcpMessage(pMrcpChannel,RECORDER_RECORD);
- if(!pMrcpMessage)
- return NULL;
-
- mrcp_recorder_header_t* pRecorderHeader;
-
- /* get/allocate recorder header */
- pRecorderHeader = (mrcp_recorder_header_t*) mrcp_resource_header_prepare(pMrcpMessage);
- if(pRecorderHeader)
- {
- /* set recorder header fields */
- pRecorderHeader->no_input_timeout = 5000;
- mrcp_resource_header_property_add(pMrcpMessage,RECORDER_HEADER_NO_INPUT_TIMEOUT);
-
- pRecorderHeader->final_silence = 300;
- mrcp_resource_header_property_add(pMrcpMessage,RECORDER_HEADER_FINAL_SILENCE);
-
- pRecorderHeader->max_time = 10000;
- mrcp_resource_header_property_add(pMrcpMessage,RECORDER_HEADER_MAX_TIME);
- }
- return pMrcpMessage;
-}
-
-FILE* RecorderSession::GetAudioIn(const mpf_codec_descriptor_t* pDescriptor, apr_pool_t* pool) const
-{
- const char* pFileName = GetScenario()->GetAudioSource();
- if(!pFileName)
- {
- pFileName = apr_psprintf(pool,"demo-%dkHz.pcm",pDescriptor->sampling_rate/1000);
- }
- apt_dir_layout_t* pDirLayout = GetScenario()->GetDirLayout();
- const char* pFilePath = apt_datadir_filepath_get(pDirLayout,pFileName,pool);
- if(!pFilePath)
- return NULL;
-
- FILE* pFile = fopen(pFilePath,"rb");
- if(!pFile)
- {
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Cannot Find [%s]",pFilePath);
- return NULL;
- }
-
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set [%s] as Speech Source",pFilePath);
- return pFile;
-}
+++ /dev/null
-/*
- * 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: setparamscenario.cpp 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include "setparamscenario.h"
-#include "setparamsession.h"
-
-UmcSession* SetParamScenario::CreateSession()
-{
- return new SetParamSession(this);
-}
+++ /dev/null
-/*
- * 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: setparamsession.cpp 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include "setparamsession.h"
-#include "setparamscenario.h"
-#include "mrcp_message.h"
-#include "mrcp_generic_header.h"
-#include "mrcp_recog_header.h"
-#include "mrcp_recog_resource.h"
-#include "apt_log.h"
-
-struct RecogChannel
-{
- /** MRCP control channel */
- mrcp_channel_t* m_pMrcpChannel;
-};
-
-SetParamSession::SetParamSession(const SetParamScenario* pScenario) :
- UmcSession(pScenario),
- m_pRecogChannel(NULL),
- m_RequestQueue(NULL),
- m_CurrentRequest(0)
-{
-}
-
-SetParamSession::~SetParamSession()
-{
-}
-
-bool SetParamSession::Start()
-{
- /* create channel and associate all the required data */
- m_pRecogChannel = CreateRecogChannel();
- if(!m_pRecogChannel)
- return false;
-
- /* add channel to session (send asynchronous request) */
- if(!AddMrcpChannel(m_pRecogChannel->m_pMrcpChannel))
- {
- delete m_pRecogChannel;
- m_pRecogChannel = NULL;
- return false;
- }
- return true;
-}
-
-bool SetParamSession::OnSessionTerminate(mrcp_sig_status_code_e status)
-{
- if(m_pRecogChannel)
- {
- delete m_pRecogChannel;
- m_pRecogChannel = NULL;
- }
- return UmcSession::OnSessionTerminate(status);
-}
-
-static apt_bool_t ReadStream(mpf_audio_stream_t* pStream, mpf_frame_t* pFrame)
-{
- return TRUE;
-}
-
-RecogChannel* SetParamSession::CreateRecogChannel()
-{
- mrcp_channel_t* pChannel;
- mpf_termination_t* pTermination;
- mpf_stream_capabilities_t* pCapabilities;
- apr_pool_t* pool = GetSessionPool();
-
- /* create channel */
- RecogChannel *pRecogChannel = new RecogChannel;
- pRecogChannel->m_pMrcpChannel = NULL;
-
- /* create source stream capabilities */
- pCapabilities = mpf_source_stream_capabilities_create(pool);
- GetScenario()->InitCapabilities(pCapabilities);
-
- static const mpf_audio_stream_vtable_t audio_stream_vtable =
- {
- NULL,
- NULL,
- NULL,
- ReadStream,
- NULL,
- NULL,
- NULL,
- NULL
- };
-
- pTermination = CreateAudioTermination(
- &audio_stream_vtable, /* virtual methods table of audio stream */
- pCapabilities, /* capabilities of audio stream */
- pRecogChannel); /* object to associate */
-
- pChannel = CreateMrcpChannel(
- MRCP_RECOGNIZER_RESOURCE, /* MRCP resource identifier */
- pTermination, /* media termination, used to terminate audio stream */
- NULL, /* RTP descriptor, used to create RTP termination (NULL by default) */
- pRecogChannel); /* object to associate */
- if(!pChannel)
- {
- delete pRecogChannel;
- return NULL;
- }
-
- pRecogChannel->m_pMrcpChannel = pChannel;
- return pRecogChannel;
-}
-
-bool SetParamSession::OnChannelAdd(mrcp_channel_t* pMrcpChannel, mrcp_sig_status_code_e status)
-{
- if(!UmcSession::OnChannelAdd(pMrcpChannel,status))
- return false;
-
- if(status != MRCP_SIG_STATUS_CODE_SUCCESS)
- {
- /* error case, just terminate the demo */
- return Terminate();
- }
-
- if(!CreateRequestQueue(pMrcpChannel))
- {
- return Terminate();
- }
-
- return ProcessNextRequest(pMrcpChannel);
-}
-
-bool SetParamSession::OnMessageReceive(mrcp_channel_t* pMrcpChannel, mrcp_message_t* pMrcpMessage)
-{
- if(!UmcSession::OnMessageReceive(pMrcpChannel,pMrcpMessage))
- return false;
-
- if(pMrcpMessage->start_line.message_type == MRCP_MESSAGE_TYPE_RESPONSE)
- {
- /* received MRCP response */
- if(pMrcpMessage->start_line.method_id == RECOGNIZER_SET_PARAMS || pMrcpMessage->start_line.method_id == RECOGNIZER_GET_PARAMS)
- {
- /* received the response */
- if(pMrcpMessage->start_line.request_state == MRCP_REQUEST_STATE_COMPLETE)
- {
- m_CurrentRequest++;
- ProcessNextRequest(pMrcpChannel);
- }
- else
- {
- /* received unexpected response, terminate the session */
- Terminate();
- }
- }
- else
- {
- /* received unexpected response */
- Terminate();
- }
- }
- return true;
-}
-
-bool SetParamSession::ProcessNextRequest(mrcp_channel_t* pMrcpChannel)
-{
- if(m_CurrentRequest >= m_RequestQueue->nelts)
- {
- return Terminate();
- }
-
- mrcp_message_t* pMrcpMessage = APR_ARRAY_IDX(m_RequestQueue,m_CurrentRequest,mrcp_message_t*);
- if(!pMrcpMessage)
- {
- return Terminate();
- }
-
- return SendMrcpRequest(pMrcpChannel,pMrcpMessage);
-}
-
-bool SetParamSession::CreateRequestQueue(mrcp_channel_t* pMrcpChannel)
-{
- m_CurrentRequest = 0;
- m_RequestQueue = apr_array_make(GetSessionPool(),5,sizeof(mrcp_message_t*));
- mrcp_message_t* pMrcpMessage;
-
- pMrcpMessage = CreateSetParams1(pMrcpChannel);
- if(pMrcpMessage)
- *(mrcp_message_t**)apr_array_push(m_RequestQueue) = pMrcpMessage;
-
- pMrcpMessage = CreateGetParams1(pMrcpChannel);
- if(pMrcpMessage)
- *(mrcp_message_t**)apr_array_push(m_RequestQueue) = pMrcpMessage;
-
- pMrcpMessage = CreateSetParams2(pMrcpChannel);
- if(pMrcpMessage)
- *(mrcp_message_t**)apr_array_push(m_RequestQueue) = pMrcpMessage;
-
- pMrcpMessage = CreateGetParams2(pMrcpChannel);
- if(pMrcpMessage)
- *(mrcp_message_t**)apr_array_push(m_RequestQueue) = pMrcpMessage;
-
- pMrcpMessage = CreateSetParams3(pMrcpChannel);
- if(pMrcpMessage)
- *(mrcp_message_t**)apr_array_push(m_RequestQueue) = pMrcpMessage;
-
- pMrcpMessage = CreateGetParams3(pMrcpChannel);
- if(pMrcpMessage)
- *(mrcp_message_t**)apr_array_push(m_RequestQueue) = pMrcpMessage;
-
- return true;
-}
-
-mrcp_message_t* SetParamSession::CreateSetParams1(mrcp_channel_t* pMrcpChannel)
-{
- mrcp_message_t* pMrcpMessage = CreateMrcpMessage(pMrcpChannel,RECOGNIZER_SET_PARAMS);
- if(!pMrcpMessage)
- return NULL;
-
- mrcp_recog_header_t* pRecogHeader;
- /* get/allocate recog header */
- pRecogHeader = (mrcp_recog_header_t*) mrcp_resource_header_prepare(pMrcpMessage);
- if(pRecogHeader)
- {
- /* set recog header fields */
- pRecogHeader->confidence_threshold = 0.4f;
- mrcp_resource_header_property_add(pMrcpMessage,RECOGNIZER_HEADER_CONFIDENCE_THRESHOLD);
- pRecogHeader->sensitivity_level = 0.531f;
- mrcp_resource_header_property_add(pMrcpMessage,RECOGNIZER_HEADER_SENSITIVITY_LEVEL);
- pRecogHeader->speed_vs_accuracy = 0.5f;
- mrcp_resource_header_property_add(pMrcpMessage,RECOGNIZER_HEADER_SPEED_VS_ACCURACY);
- pRecogHeader->n_best_list_length = 5;
- mrcp_resource_header_property_add(pMrcpMessage,RECOGNIZER_HEADER_N_BEST_LIST_LENGTH);
- pRecogHeader->no_input_timeout = 5000;
- mrcp_resource_header_property_add(pMrcpMessage,RECOGNIZER_HEADER_NO_INPUT_TIMEOUT);
- }
-
- return pMrcpMessage;
-}
-
-mrcp_message_t* SetParamSession::CreateGetParams1(mrcp_channel_t* pMrcpChannel)
-{
- mrcp_message_t* pMrcpMessage = CreateMrcpMessage(pMrcpChannel,RECOGNIZER_GET_PARAMS);
- if(!pMrcpMessage)
- return NULL;
-
- mrcp_recog_header_t* pRecogHeader;
- /* get/allocate recog header */
- pRecogHeader = (mrcp_recog_header_t*) mrcp_resource_header_prepare(pMrcpMessage);
- if(pRecogHeader)
- {
- /* set recog header fields */
- mrcp_resource_header_name_property_add(pMrcpMessage,RECOGNIZER_HEADER_CONFIDENCE_THRESHOLD);
- mrcp_resource_header_name_property_add(pMrcpMessage,RECOGNIZER_HEADER_SENSITIVITY_LEVEL);
- mrcp_resource_header_name_property_add(pMrcpMessage,RECOGNIZER_HEADER_SPEED_VS_ACCURACY);
- mrcp_resource_header_name_property_add(pMrcpMessage,RECOGNIZER_HEADER_N_BEST_LIST_LENGTH);
- mrcp_resource_header_name_property_add(pMrcpMessage,RECOGNIZER_HEADER_NO_INPUT_TIMEOUT);
- }
-
- return pMrcpMessage;
-}
-
-mrcp_message_t* SetParamSession::CreateSetParams2(mrcp_channel_t* pMrcpChannel)
-{
- mrcp_message_t* pMrcpMessage = CreateMrcpMessage(pMrcpChannel,RECOGNIZER_SET_PARAMS);
- if(!pMrcpMessage)
- return NULL;
-
- mrcp_recog_header_t* pRecogHeader;
- /* get/allocate recog header */
- pRecogHeader = (mrcp_recog_header_t*) mrcp_resource_header_prepare(pMrcpMessage);
- if(pRecogHeader)
- {
- /* set recog header fields */
- pRecogHeader->recognition_timeout = 5000;
- mrcp_resource_header_property_add(pMrcpMessage,RECOGNIZER_HEADER_RECOGNITION_TIMEOUT);
- pRecogHeader->speech_complete_timeout = 1000;
- mrcp_resource_header_property_add(pMrcpMessage,RECOGNIZER_HEADER_SPEECH_COMPLETE_TIMEOUT);
- pRecogHeader->speech_incomplete_timeout = 2000;
- mrcp_resource_header_property_add(pMrcpMessage,RECOGNIZER_HEADER_SPEECH_INCOMPLETE_TIMEOUT);
- pRecogHeader->dtmf_interdigit_timeout = 3000;
- mrcp_resource_header_property_add(pMrcpMessage,RECOGNIZER_HEADER_DTMF_INTERDIGIT_TIMEOUT);
- }
-
- return pMrcpMessage;
-}
-
-mrcp_message_t* SetParamSession::CreateGetParams2(mrcp_channel_t* pMrcpChannel)
-{
- mrcp_message_t* pMrcpMessage = CreateMrcpMessage(pMrcpChannel,RECOGNIZER_GET_PARAMS);
- if(!pMrcpMessage)
- return NULL;
-
- mrcp_recog_header_t* pRecogHeader;
- /* get/allocate recog header */
- pRecogHeader = (mrcp_recog_header_t*) mrcp_resource_header_prepare(pMrcpMessage);
- if(pRecogHeader)
- {
- /* set recog header fields */
- mrcp_resource_header_name_property_add(pMrcpMessage,RECOGNIZER_HEADER_RECOGNITION_TIMEOUT);
- mrcp_resource_header_name_property_add(pMrcpMessage,RECOGNIZER_HEADER_SPEECH_COMPLETE_TIMEOUT);
- mrcp_resource_header_name_property_add(pMrcpMessage,RECOGNIZER_HEADER_SPEECH_INCOMPLETE_TIMEOUT);
- mrcp_resource_header_name_property_add(pMrcpMessage,RECOGNIZER_HEADER_DTMF_INTERDIGIT_TIMEOUT);
- }
-
- return pMrcpMessage;
-}
-
-mrcp_message_t* SetParamSession::CreateSetParams3(mrcp_channel_t* pMrcpChannel)
-{
- mrcp_message_t* pMrcpMessage = CreateMrcpMessage(pMrcpChannel,RECOGNIZER_SET_PARAMS);
- if(!pMrcpMessage)
- return NULL;
-
- mrcp_generic_header_t* pGenericHeader;
- /* get/allocate generic header */
- pGenericHeader = (mrcp_generic_header_t*) mrcp_generic_header_prepare(pMrcpMessage);
- if(pGenericHeader)
- {
- apr_pool_t* pool = GetSessionPool();
- /* set generic header fields */
- apt_pair_arr_t* pVSP = apt_pair_array_create(3,pool);
- if(pVSP)
- {
- apt_str_t name;
- apt_str_t value;
-
- apt_string_set(&name,"confidencelevel");
- apt_string_set(&value,"500");
- apt_pair_array_append(pVSP,&name,&value,pool);
-
- apt_string_set(&name,"sensitivity");
- apt_string_set(&value,"0.500");
- apt_pair_array_append(pVSP,&name,&value,pool);
-
- apt_string_set(&name,"speedvsaccuracy");
- apt_string_set(&value,"0.789");
- apt_pair_array_append(pVSP,&name,&value,pool);
-
- apt_string_set(&name,"timeout");
- apt_string_set(&value,"1000");
- apt_pair_array_append(pVSP,&name,&value,pool);
-
- apt_string_set(&name,"swirec_application_name");
- apt_string_set(&value,"UniMRCP");
- apt_pair_array_append(pVSP,&name,&value,pool);
-
- apt_string_set(&name,"swirec_phoneme_lookahead_beam");
- apt_string_set(&value,"-50");
- apt_pair_array_append(pVSP,&name,&value,pool);
-
- pGenericHeader->vendor_specific_params = pVSP;
- mrcp_generic_header_property_add(pMrcpMessage,GENERIC_HEADER_VENDOR_SPECIFIC_PARAMS);
- }
- }
-
- return pMrcpMessage;
-}
-
-mrcp_message_t* SetParamSession::CreateGetParams3(mrcp_channel_t* pMrcpChannel)
-{
- mrcp_message_t* pMrcpMessage = CreateMrcpMessage(pMrcpChannel,RECOGNIZER_GET_PARAMS);
- if(!pMrcpMessage)
- return NULL;
-
- mrcp_generic_header_t* pGenericHeader;
- /* get/allocate generic header */
- pGenericHeader = (mrcp_generic_header_t*) mrcp_generic_header_prepare(pMrcpMessage);
- if(pGenericHeader)
- {
- mrcp_generic_header_name_property_add(pMrcpMessage,GENERIC_HEADER_ACCEPT_CHARSET);
- mrcp_generic_header_name_property_add(pMrcpMessage,GENERIC_HEADER_CACHE_CONTROL);
- mrcp_generic_header_name_property_add(pMrcpMessage,GENERIC_HEADER_LOGGING_TAG);
- mrcp_generic_header_name_property_add(pMrcpMessage,GENERIC_HEADER_VENDOR_SPECIFIC_PARAMS);
- mrcp_generic_header_name_property_add(pMrcpMessage,GENERIC_HEADER_FETCH_TIMEOUT);
- mrcp_generic_header_name_property_add(pMrcpMessage,GENERIC_HEADER_SET_COOKIE);
- mrcp_generic_header_name_property_add(pMrcpMessage,GENERIC_HEADER_SET_COOKIE2);
- }
-
- return pMrcpMessage;
-}
+++ /dev/null
-/*
- * 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: synthscenario.cpp 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include <stdlib.h>
-#include "synthscenario.h"
-#include "synthsession.h"
-#include "mrcp_message.h"
-#include "mrcp_generic_header.h"
-#include "mrcp_synth_header.h"
-#include "mrcp_synth_resource.h"
-
-
-SynthScenario::SynthScenario() :
- m_Speak(true),
- m_ContentType("application/synthesis+ssml"),
- m_Content(NULL)
-{
-}
-
-SynthScenario::~SynthScenario()
-{
-}
-
-void SynthScenario::Destroy()
-{
-}
-
-bool SynthScenario::LoadElement(const apr_xml_elem* pElem, apr_pool_t* pool)
-{
- if(UmcScenario::LoadElement(pElem,pool))
- return true;
-
- if(strcasecmp(pElem->name,"speak") == 0)
- {
- LoadSpeak(pElem,pool);
- return true;
- }
-
- return false;
-}
-
-bool SynthScenario::LoadSpeak(const apr_xml_elem* pElem, apr_pool_t* pool)
-{
- const apr_xml_attr* pAttr;
- for(pAttr = pElem->attr; pAttr; pAttr = pAttr->next)
- {
- if(strcasecmp(pAttr->name,"enable") == 0)
- {
- m_Speak = atoi(pAttr->value) > 0;
- }
- else if(strcasecmp(pAttr->name,"content-type") == 0)
- {
- m_ContentType = pAttr->value;
- }
- else if(strcasecmp(pAttr->name,"content-location") == 0)
- {
- m_Content = LoadFileContent(pAttr->value,pool);
- }
- }
-
- return true;
-}
-
-UmcSession* SynthScenario::CreateSession()
-{
- return new SynthSession(this);
-}
+++ /dev/null
-/*
- * 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: synthsession.cpp 2193 2014-10-08 03:44:33Z achaloyan@gmail.com $
- */
-
-#include "synthsession.h"
-#include "synthscenario.h"
-#include "mrcp_message.h"
-#include "mrcp_generic_header.h"
-#include "mrcp_synth_header.h"
-#include "mrcp_synth_resource.h"
-#include "apt_log.h"
-
-struct SynthChannel
-{
- /** MRCP channel */
- mrcp_channel_t* m_pMrcpChannel;
- /** IN-PROGRESS SPEAK request */
- mrcp_message_t* m_pSpeakRequest;
- /** File to write audio stream to */
- FILE* m_pAudioOut;
-
- SynthChannel() : m_pMrcpChannel(NULL), m_pSpeakRequest(NULL), m_pAudioOut(NULL) {}
-};
-
-SynthSession::SynthSession(const SynthScenario* pScenario) :
- UmcSession(pScenario),
- m_pSynthChannel(NULL)
-{
-}
-
-SynthSession::~SynthSession()
-{
-}
-
-bool SynthSession::Start()
-{
- if(!GetScenario()->IsSpeakEnabled())
- return false;
-
- /* create channel and associate all the required data */
- m_pSynthChannel = CreateSynthChannel();
- if(!m_pSynthChannel)
- return false;
-
- /* add channel to session (send asynchronous request) */
- if(!AddMrcpChannel(m_pSynthChannel->m_pMrcpChannel))
- {
- delete m_pSynthChannel;
- m_pSynthChannel = NULL;
- return false;
- }
- return true;
-}
-
-bool SynthSession::Stop()
-{
- if(!UmcSession::Stop())
- return false;
-
- if(!m_pSynthChannel)
- return false;
-
- mrcp_message_t* pStopMessage = CreateMrcpMessage(m_pSynthChannel->m_pMrcpChannel,SYNTHESIZER_STOP);
- if(!pStopMessage)
- return false;
-
- if(m_pSynthChannel->m_pSpeakRequest)
- {
- mrcp_generic_header_t* pGenericHeader;
- /* get/allocate generic header */
- pGenericHeader = (mrcp_generic_header_t*) mrcp_generic_header_prepare(pStopMessage);
- if(pGenericHeader)
- {
- pGenericHeader->active_request_id_list.count = 1;
- pGenericHeader->active_request_id_list.ids[0] =
- m_pSynthChannel->m_pSpeakRequest->start_line.request_id;
- mrcp_generic_header_property_add(pStopMessage,GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST);
- }
-
- m_pSynthChannel->m_pSpeakRequest = NULL;
- }
-
- return SendMrcpRequest(m_pSynthChannel->m_pMrcpChannel,pStopMessage);
-}
-
-bool SynthSession::OnSessionTerminate(mrcp_sig_status_code_e status)
-{
- if(m_pSynthChannel)
- {
- FILE* pAudioOut = m_pSynthChannel->m_pAudioOut;
- if(pAudioOut)
- {
- m_pSynthChannel->m_pAudioOut = NULL;
- fclose(pAudioOut);
- }
-
- delete m_pSynthChannel;
- m_pSynthChannel = NULL;
- }
- return UmcSession::OnSessionTerminate(status);
-}
-
-static apt_bool_t WriteStream(mpf_audio_stream_t* pStream, const mpf_frame_t* pFrame)
-{
- SynthChannel* pSynthChannel = (SynthChannel*) pStream->obj;
- if(pSynthChannel && pSynthChannel->m_pAudioOut)
- {
- fwrite(pFrame->codec_frame.buffer,1,pFrame->codec_frame.size,pSynthChannel->m_pAudioOut);
- }
- return TRUE;
-}
-
-SynthChannel* SynthSession::CreateSynthChannel()
-{
- mrcp_channel_t* pChannel;
- mpf_termination_t* pTermination;
- mpf_stream_capabilities_t* pCapabilities;
- apr_pool_t* pool = GetSessionPool();
-
- /* create channel */
- SynthChannel* pSynthChannel = new SynthChannel;
-
- /* create sink stream capabilities */
- pCapabilities = mpf_sink_stream_capabilities_create(pool);
- GetScenario()->InitCapabilities(pCapabilities);
-
- static const mpf_audio_stream_vtable_t audio_stream_vtable =
- {
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- WriteStream,
- NULL
- };
-
- pTermination = CreateAudioTermination(
- &audio_stream_vtable, /* virtual methods table of audio stream */
- pCapabilities, /* capabilities of audio stream */
- pSynthChannel); /* object to associate */
-
- pChannel = CreateMrcpChannel(
- MRCP_SYNTHESIZER_RESOURCE, /* MRCP resource identifier */
- pTermination, /* media termination, used to terminate audio stream */
- NULL, /* RTP descriptor, used to create RTP termination (NULL by default) */
- pSynthChannel); /* object to associate */
- if(!pChannel)
- {
- delete pSynthChannel;
- return NULL;
- }
-
- pSynthChannel->m_pMrcpChannel = pChannel;
- return pSynthChannel;
-}
-
-bool SynthSession::OnChannelAdd(mrcp_channel_t* pMrcpChannel, mrcp_sig_status_code_e status)
-{
- if(!UmcSession::OnChannelAdd(pMrcpChannel,status))
- return false;
-
- const mpf_codec_descriptor_t* pDescriptor = mrcp_application_sink_descriptor_get(pMrcpChannel);
- if(!pDescriptor)
- {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Get Media Sink Descriptor");
- return Terminate();
- }
-
- SynthChannel* pSynthChannel = (SynthChannel*) mrcp_application_channel_object_get(pMrcpChannel);
- if(status != MRCP_SIG_STATUS_CODE_SUCCESS)
- {
- /* error case, just terminate the demo */
- return Terminate();
- }
-
- /* create MRCP message */
- mrcp_message_t* pMrcpMessage = CreateSpeakRequest(pMrcpChannel);
- if(pMrcpMessage)
- {
- SendMrcpRequest(pSynthChannel->m_pMrcpChannel,pMrcpMessage);
- }
-
- pSynthChannel->m_pAudioOut = GetAudioOut(pDescriptor,GetSessionPool());
- return true;
-}
-
-bool SynthSession::OnMessageReceive(mrcp_channel_t* pMrcpChannel, mrcp_message_t* pMrcpMessage)
-{
- if(!UmcSession::OnMessageReceive(pMrcpChannel,pMrcpMessage))
- return false;
-
- if(pMrcpMessage->start_line.message_type == MRCP_MESSAGE_TYPE_RESPONSE)
- {
- /* received MRCP response */
- if(pMrcpMessage->start_line.method_id == SYNTHESIZER_SPEAK)
- {
- /* received the response to SPEAK request */
- if(pMrcpMessage->start_line.request_state == MRCP_REQUEST_STATE_INPROGRESS)
- {
- SynthChannel* pSynthChannel = (SynthChannel*) mrcp_application_channel_object_get(pMrcpChannel);
- if(pSynthChannel)
- pSynthChannel->m_pSpeakRequest = GetMrcpMessage();
-
- /* waiting for SPEAK-COMPLETE event */
- }
- else
- {
- /* received unexpected response, terminate the session */
- Terminate();
- }
- }
- else
- {
- /* received unexpected response */
- }
- }
- else if(pMrcpMessage->start_line.message_type == MRCP_MESSAGE_TYPE_EVENT)
- {
- /* received MRCP event */
- if(pMrcpMessage->start_line.method_id == SYNTHESIZER_SPEAK_COMPLETE)
- {
- SynthChannel* pSynthChannel = (SynthChannel*) mrcp_application_channel_object_get(pMrcpChannel);
- if(pSynthChannel)
- pSynthChannel->m_pSpeakRequest = NULL;
- /* received SPEAK-COMPLETE event, terminate the session */
- Terminate();
- }
- }
- return true;
-}
-
-mrcp_message_t* SynthSession::CreateSpeakRequest(mrcp_channel_t* pMrcpChannel)
-{
- mrcp_message_t* pMrcpMessage = CreateMrcpMessage(pMrcpChannel,SYNTHESIZER_SPEAK);
- if(!pMrcpMessage)
- return NULL;
-
- const SynthScenario* pScenario = GetScenario();
-
- mrcp_generic_header_t* pGenericHeader;
- mrcp_synth_header_t* pSynthHeader;
- /* get/allocate generic header */
- pGenericHeader = (mrcp_generic_header_t*) mrcp_generic_header_prepare(pMrcpMessage);
- if(pGenericHeader)
- {
- /* set generic header fields */
- apt_string_assign(&pGenericHeader->content_type,pScenario->GetContentType(),pMrcpMessage->pool);
- mrcp_generic_header_property_add(pMrcpMessage,GENERIC_HEADER_CONTENT_TYPE);
-
- /* set message body */
- if(pScenario->GetContent())
- apt_string_assign(&pMrcpMessage->body,pScenario->GetContent(),pMrcpMessage->pool);
- }
- /* get/allocate synthesizer header */
- pSynthHeader = (mrcp_synth_header_t*) mrcp_resource_header_prepare(pMrcpMessage);
- if(pSynthHeader)
- {
- /* set synthesizer header fields */
- pSynthHeader->voice_param.age = 28;
- mrcp_resource_header_property_add(pMrcpMessage,SYNTHESIZER_HEADER_VOICE_AGE);
- }
-
- return pMrcpMessage;
-}
-
-FILE* SynthSession::GetAudioOut(const mpf_codec_descriptor_t* pDescriptor, apr_pool_t* pool) const
-{
- FILE* file;
- char* pFileName = apr_psprintf(pool,"synth-%dkHz-%s.pcm",pDescriptor->sampling_rate/1000, GetMrcpSessionId());
- apt_dir_layout_t* pDirLayout = GetScenario()->GetDirLayout();
- char* pFilePath = apt_vardir_filepath_get(pDirLayout,pFileName,pool);
- if(!pFilePath)
- return NULL;
-
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Open Speech Output File [%s] for Writing",pFilePath);
- file = fopen(pFilePath,"wb");
- if(!file)
- {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Open Speech Output File [%s] for Writing",pFilePath);
- return NULL;
- }
- return file;
-}
+++ /dev/null
-/*
- * 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: umcconsole.cpp 2204 2014-10-31 01:01:42Z achaloyan@gmail.com $
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <apr_getopt.h>
-#include "umcconsole.h"
-#include "umcframework.h"
-#include "apt_pool.h"
-#include "uni_version.h"
-
-
-UmcConsole::UmcConsole() :
- m_pFramework(NULL)
-{
- m_pFramework = new UmcFramework;
-}
-
-UmcConsole::~UmcConsole()
-{
- delete m_pFramework;
-}
-
-bool UmcConsole::Run(int argc, const char * const *argv)
-{
- apr_pool_t* pool = NULL;
- apt_dir_layout_t* pDirLayout = NULL;
- const char *logConfPath;
-
- /* APR global initialization */
- if(apr_initialize() != APR_SUCCESS)
- {
- apr_terminate();
- return false;
- }
-
- /* create APR pool */
- pool = apt_pool_create();
- if(!pool)
- {
- apr_terminate();
- return false;
- }
-
- /* load options */
- if(!LoadOptions(argc,argv,pool))
- {
- apr_pool_destroy(pool);
- apr_terminate();
- return false;
- }
-
- if(m_Options.m_DirLayoutConf)
- {
- /* create and load directories layout from the configuration file */
- pDirLayout = apt_dir_layout_create(pool);
- if(pDirLayout)
- apt_dir_layout_load(pDirLayout,m_Options.m_DirLayoutConf,pool);
- }
- else
- {
- /* create default directories layout */
- pDirLayout = apt_default_dir_layout_create(m_Options.m_RootDirPath,pool);
- }
-
- if(!pDirLayout)
- {
- printf("Failed to Create Directories Layout\n");
- apr_pool_destroy(pool);
- apr_terminate();
- return false;
- }
-
- /* get path to logger configuration file */
- logConfPath = apt_confdir_filepath_get(pDirLayout,"logger.xml",pool);
- /* create and load singleton logger */
- apt_log_instance_load(logConfPath,pool);
-
- if(m_Options.m_LogPriority)
- {
- /* override the log priority, if specified in command line */
- apt_log_priority_set((apt_log_priority_e)atoi(m_Options.m_LogPriority));
- }
- if(m_Options.m_LogOutput)
- {
- /* override the log output mode, if specified in command line */
- apt_log_output_mode_set((apt_log_output_e)atoi(m_Options.m_LogOutput));
- }
-
- if(apt_log_output_mode_check(APT_LOG_OUTPUT_FILE) == TRUE)
- {
- /* open the log file */
- const char *logDirPath = apt_dir_layout_path_get(pDirLayout,APT_LAYOUT_LOG_DIR);
- apt_log_file_open(logDirPath,"unimrcpclient",MAX_LOG_FILE_SIZE,MAX_LOG_FILE_COUNT,FALSE,pool);
- }
-
- /* create demo framework */
- if(m_pFramework->Create(pDirLayout,pool))
- {
- /* run command line */
- RunCmdLine();
- /* destroy demo framework */
- m_pFramework->Destroy();
- }
-
- /* destroy singleton logger */
- apt_log_instance_destroy();
- /* destroy APR pool */
- apr_pool_destroy(pool);
- /* APR global termination */
- apr_terminate();
- return true;
-}
-
-bool UmcConsole::ProcessCmdLine(char* pCmdLine)
-{
- bool running = true;
- char *name;
- char *last;
- name = apr_strtok(pCmdLine, " ", &last);
-
- if(strcasecmp(name,"run") == 0)
- {
- char* pScenarioName = apr_strtok(NULL, " ", &last);
- if(pScenarioName)
- {
- const char* pProfileName = apr_strtok(NULL, " ", &last);
- if(!pProfileName)
- {
- pProfileName = "uni2";
- }
- m_pFramework->RunSession(pScenarioName,pProfileName);
- }
- }
- else if(strcasecmp(name,"kill") == 0)
- {
- char* pID = apr_strtok(NULL, " ", &last);
- if(pID)
- {
- m_pFramework->KillSession(pID);
- }
- }
- else if(strcasecmp(name,"stop") == 0)
- {
- char* pID = apr_strtok(NULL, " ", &last);
- if(pID)
- {
- m_pFramework->StopSession(pID);
- }
- }
- else if(strcasecmp(name,"show") == 0)
- {
- char* pWhat = apr_strtok(NULL, " ", &last);
- if(pWhat)
- {
- if(strcasecmp(pWhat,"sessions") == 0)
- m_pFramework->ShowSessions();
- else if(strcasecmp(pWhat,"scenarios") == 0)
- m_pFramework->ShowScenarios();
- }
- }
- else if(strcasecmp(name,"loglevel") == 0)
- {
- char* pPriority = apr_strtok(NULL, " ", &last);
- if(pPriority)
- {
- apt_log_priority_set((apt_log_priority_e)atol(pPriority));
- }
- }
- else if(strcasecmp(name,"exit") == 0 || strcmp(name,"quit") == 0)
- {
- running = false;
- }
- else if(strcasecmp(name,"help") == 0)
- {
- printf("usage:\n"
- "\n- run [scenario] [profile] (run new session)\n"
- " scenario is one of 'synth', 'recog', ... (use 'show scenarios')\n"
- " profile is one of 'uni2', 'uni1', ... (see unimrcpclient.xml)\n"
- "\n examples: \n"
- " run synth\n"
- " run recog\n"
- " run synth uni1\n"
- " run recog uni1\n"
- "\n- kill [id] (kill session)\n"
- " id is a session identifier: 1, 2, ... (use 'show sessions')\n"
- "\n example: \n"
- " kill 1\n"
- "\n- show [what] (show either available scenarios or in-progress sessions)\n"
- "\n examples: \n"
- " show scenarios\n"
- " show sessions\n"
- "\n- loglevel [level] (set loglevel, one of 0,1...7)\n"
- "\n- quit, exit\n");
- }
- else
- {
- printf("unknown command: %s (input help for usage)\n",name);
- }
- return running;
-}
-
-bool UmcConsole::RunCmdLine()
-{
- apt_bool_t running = true;
- char cmdline[1024];
- apr_size_t i;
- do
- {
- printf(">");
- memset(&cmdline, 0, sizeof(cmdline));
- for(i = 0; i < sizeof(cmdline); i++)
- {
- cmdline[i] = (char) getchar();
- if(cmdline[i] == '\n')
- {
- cmdline[i] = '\0';
- break;
- }
- }
- if(*cmdline)
- {
- running = ProcessCmdLine(cmdline);
- }
- }
- while(running != 0);
- return true;
-}
-
-void UmcConsole::Usage()
-{
- printf(
- "\n"
- " * " UNI_COPYRIGHT"\n"
- " *\n"
- UNI_LICENSE"\n"
- "\n"
- "Usage:\n"
- "\n"
- " umc [options]\n"
- "\n"
- " Available options:\n"
- "\n"
- " -r [--root-dir] path : Set the path to the project root directory.\n"
- "\n"
- " -c [--dir-layout] path : Set the path to the dir layout config file.\n"
- " (takes the precedence over --root-dir option)\n"
- "\n"
- " -l [--log-prio] priority : Set the log priority.\n"
- " (0-emergency, ..., 7-debug)\n"
- "\n"
- " -o [--log-output] mode : Set the log output mode.\n"
- " (0-none, 1-console only, 2-file only, 3-both)\n"
- "\n"
- " -v [--version] : Show the version.\n"
- "\n"
- " -h [--help] : Show the help.\n"
- "\n");
-}
-
-bool UmcConsole::LoadOptions(int argc, const char * const *argv, apr_pool_t *pool)
-{
- apr_status_t rv;
- apr_getopt_t* opt = NULL;
- int optch;
- const char* optarg;
-
- const apr_getopt_option_t opt_option[] =
- {
- /* long-option, short-option, has-arg flag, description */
- { "root-dir", 'r', TRUE, "path to root dir" }, /* -r arg or --root-dir arg */
- { "dir-layout", 'c', TRUE, "path to dir layout conf" }, /* -c arg or --dir-layout arg */
- { "log-prio", 'l', TRUE, "log priority" }, /* -l arg or --log-prio arg */
- { "log-output", 'o', TRUE, "log output mode" }, /* -o arg or --log-output arg */
- { "version", 'v', FALSE, "show version" }, /* -v or --version */
- { "help", 'h', FALSE, "show help" }, /* -h or --help */
- { NULL, 0, 0, NULL }, /* end */
- };
-
- rv = apr_getopt_init(&opt, pool , argc, argv);
- if(rv != APR_SUCCESS)
- return false;
-
- while((rv = apr_getopt_long(opt, opt_option, &optch, &optarg)) == APR_SUCCESS)
- {
- switch(optch)
- {
- case 'r':
- m_Options.m_RootDirPath = optarg;
- break;
- case 'c':
- m_Options.m_DirLayoutConf = optarg;
- break;
- case 'l':
- if(optarg)
- m_Options.m_LogPriority = optarg;
- break;
- case 'o':
- if(optarg)
- m_Options.m_LogOutput = optarg;
- break;
- case 'v':
- printf(UNI_VERSION_STRING);
- return FALSE;
- case 'h':
- Usage();
- return FALSE;
- }
- }
-
- if(rv != APR_EOF)
- {
- Usage();
- return false;
- }
-
- return true;
-}
+++ /dev/null
-/*
- * 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: umcframework.cpp 2204 2014-10-31 01:01:42Z achaloyan@gmail.com $
- */
-
-#include "umcframework.h"
-#include "umcsession.h"
-#include "synthscenario.h"
-#include "recogscenario.h"
-#include "recorderscenario.h"
-#include "dtmfscenario.h"
-#include "setparamscenario.h"
-#include "verifierscenario.h"
-#include "unimrcp_client.h"
-#include "apt_log.h"
-
-typedef struct
-{
- char m_SessionId[10];
- char m_ScenarioName[128];
- char m_ProfileName[128];
- const mrcp_app_message_t* m_pAppMessage;
-} UmcTaskMsg;
-
-enum UmcTaskMsgType
-{
- UMC_TASK_CLIENT_MSG,
- UMC_TASK_RUN_SESSION_MSG,
- UMC_TASK_STOP_SESSION_MSG,
- UMC_TASK_KILL_SESSION_MSG,
- UMC_TASK_SHOW_SCENARIOS_MSG,
- UMC_TASK_SHOW_SESSIONS_MSG
-};
-
-apt_bool_t UmcProcessMsg(apt_task_t* pTask, apt_task_msg_t* pMsg);
-void UmcOnStartComplete(apt_task_t* pTask);
-void UmcOnTerminateComplete(apt_task_t* pTask);
-apt_bool_t AppMessageHandler(const mrcp_app_message_t* pAppMessage);
-
-
-UmcFramework::UmcFramework() :
- m_pPool(NULL),
- m_pDirLayout(NULL),
- m_pTask(NULL),
- m_pMrcpClient(NULL),
- m_pMrcpApplication(NULL),
- m_pScenarioTable(NULL),
- m_pSessionTable(NULL)
-{
-}
-
-UmcFramework::~UmcFramework()
-{
-}
-
-bool UmcFramework::Create(apt_dir_layout_t* pDirLayout, apr_pool_t* pool)
-{
- m_pDirLayout = pDirLayout;
- m_pPool = pool;
-
- m_pSessionTable = apr_hash_make(m_pPool);
- m_pScenarioTable = apr_hash_make(m_pPool);
- return CreateTask();
-}
-
-void UmcFramework::Destroy()
-{
- DestroyTask();
-
- m_pScenarioTable = NULL;
- m_pSessionTable = NULL;
-}
-
-bool UmcFramework::CreateMrcpClient()
-{
- /* create MRCP client stack first */
- m_pMrcpClient = unimrcp_client_create(m_pDirLayout);
- if(!m_pMrcpClient)
- return false;
-
- /* create MRCP application to send/get requests to/from MRCP client stack */
- m_pMrcpApplication = mrcp_application_create(AppMessageHandler,this,m_pPool);
- if(!m_pMrcpApplication)
- {
- mrcp_client_destroy(m_pMrcpClient);
- m_pMrcpClient = NULL;
- return false;
- }
-
- /* register MRCP application to MRCP client */
- mrcp_client_application_register(m_pMrcpClient,m_pMrcpApplication,"UMC");
- /* start MRCP client stack processing */
- if(mrcp_client_start(m_pMrcpClient) == FALSE)
- {
- mrcp_client_destroy(m_pMrcpClient);
- m_pMrcpClient = NULL;
- m_pMrcpApplication = NULL;
- return false;
- }
- return true;
-}
-
-void UmcFramework::DestroyMrcpClient()
-{
- if(m_pMrcpClient)
- {
- /* shutdown MRCP client stack processing first (blocking call) */
- mrcp_client_shutdown(m_pMrcpClient);
- /* destroy MRCP client stack */
- mrcp_client_destroy(m_pMrcpClient);
- m_pMrcpClient = NULL;
- m_pMrcpApplication = NULL;
- }
-}
-
-bool UmcFramework::CreateTask()
-{
- apt_task_t* pTask;
- apt_task_vtable_t* pVtable;
- apt_task_msg_pool_t* pMsgPool;
-
- pMsgPool = apt_task_msg_pool_create_dynamic(sizeof(UmcTaskMsg),m_pPool);
- m_pTask = apt_consumer_task_create(this,pMsgPool,m_pPool);
- if(!m_pTask)
- return false;
-
- pTask = apt_consumer_task_base_get(m_pTask);
- apt_task_name_set(pTask,"Framework Agent");
- pVtable = apt_consumer_task_vtable_get(m_pTask);
- if(pVtable)
- {
- pVtable->process_msg = UmcProcessMsg;
- pVtable->on_start_complete = UmcOnStartComplete;
- pVtable->on_terminate_complete = UmcOnTerminateComplete;
- }
-
- apt_task_start(pTask);
- return true;
-}
-
-void UmcFramework::DestroyTask()
-{
- if(m_pTask)
- {
- apt_task_t* pTask = apt_consumer_task_base_get(m_pTask);
- if(pTask)
- {
- apt_task_terminate(pTask,TRUE);
- apt_task_destroy(pTask);
- }
- m_pTask = NULL;
- }
-}
-
-UmcScenario* UmcFramework::CreateScenario(const char* pType)
-{
- if(pType)
- {
- if(strcasecmp(pType,"Synthesizer") == 0)
- return new SynthScenario();
- else if(strcasecmp(pType,"Recognizer") == 0)
- return new RecogScenario();
- else if(strcasecmp(pType,"Recorder") == 0)
- return new RecorderScenario();
- else if(strcasecmp(pType,"DtmfRecognizer") == 0)
- return new DtmfScenario();
- else if(strcasecmp(pType,"Params") == 0)
- return new SetParamScenario();
- else if(strcasecmp(pType,"Verifier") == 0)
- return new VerifierScenario();
- }
- return NULL;
-}
-
-apr_xml_doc* UmcFramework::LoadDocument()
-{
- apr_xml_parser* pParser = NULL;
- apr_xml_doc* pDoc = NULL;
- apr_file_t* pFD = NULL;
- apr_status_t rv;
- const char* pFilePath;
-
- pFilePath = apt_dir_layout_path_compose(m_pDirLayout,APT_LAYOUT_CONF_DIR,"umcscenarios.xml",m_pPool);
- if(!pFilePath)
- {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Compose Config File Path");
- return NULL;
- }
-
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Open Config File [%s]",pFilePath);
- rv = apr_file_open(&pFD,pFilePath,APR_READ|APR_BINARY,0,m_pPool);
- if(rv != APR_SUCCESS)
- {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Open Config File [%s]",pFilePath);
- return NULL;
- }
-
- rv = apr_xml_parse_file(m_pPool,&pParser,&pDoc,pFD,2000);
- if(rv != APR_SUCCESS)
- {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Parse Config File [%s]",pFilePath);
- pDoc = NULL;
- }
-
- apr_file_close(pFD);
- return pDoc;
-}
-
-bool UmcFramework::LoadScenarios()
-{
- apr_xml_doc* pDoc = LoadDocument();
- if(!pDoc)
- return false;
-
- const apr_xml_attr* pAttr;
- const apr_xml_elem* pElem;
- const apr_xml_elem* pRoot = pDoc->root;
- if(!pRoot || strcasecmp(pRoot->name,"umcscenarios") != 0)
- {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Document");
- return FALSE;
- }
- for(pElem = pRoot->first_child; pElem; pElem = pElem->next)
- {
- if(strcasecmp(pElem->name,"scenario") != 0)
- {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",pElem->name);
- continue;
- }
-
- const char* pName = NULL;
- const char* pClass = NULL;
- const char* pMrcpProfile = NULL;
- for(pAttr = pElem->attr; pAttr; pAttr = pAttr->next)
- {
- if(strcasecmp(pAttr->name,"name") == 0)
- {
- pName = pAttr->value;
- }
- else if(strcasecmp(pAttr->name,"class") == 0)
- {
- pClass = pAttr->value;
- }
- else if(strcasecmp(pAttr->name,"profile") == 0)
- {
- pMrcpProfile = pAttr->value;
- }
- }
-
- if(pName && pClass)
- {
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Load Scenario name [%s] class [%s]",pName,pClass);
- UmcScenario* pScenario = CreateScenario(pClass);
- if(pScenario)
- {
- pScenario->SetDirLayout(m_pDirLayout);
- pScenario->SetName(pName);
- pScenario->SetMrcpProfile(pMrcpProfile);
- if(pScenario->Load(pElem,m_pPool))
- apr_hash_set(m_pScenarioTable,pScenario->GetName(),APR_HASH_KEY_STRING,pScenario);
- else
- delete pScenario;
- }
- else
- {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"No such scenario <%s>",pClass);
- }
- }
- else
- {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Missing either name or class of the scenario");
- }
- }
- return true;
-}
-
-void UmcFramework::DestroyScenarios()
-{
- UmcScenario* pScenario;
- void* pVal;
- apr_hash_index_t* it = apr_hash_first(m_pPool,m_pScenarioTable);
- for(; it; it = apr_hash_next(it))
- {
- apr_hash_this(it,NULL,NULL,&pVal);
- pScenario = (UmcScenario*) pVal;
- if(pScenario)
- {
- pScenario->Destroy();
- delete pScenario;
- }
- }
- apr_hash_clear(m_pScenarioTable);
-}
-
-bool UmcFramework::AddSession(UmcSession* pSession)
-{
- if(!pSession)
- return false;
-
- apr_hash_set(m_pSessionTable,pSession->GetId(),APR_HASH_KEY_STRING,pSession);
- return true;
-}
-
-bool UmcFramework::RemoveSession(UmcSession* pSession)
-{
- if(!pSession)
- return false;
-
- apr_hash_set(m_pSessionTable,pSession->GetId(),APR_HASH_KEY_STRING,NULL);
- return true;
-}
-
-bool UmcFramework::ProcessRunRequest(const char* pScenarioName, const char* pProfileName)
-{
- UmcScenario* pScenario = (UmcScenario*) apr_hash_get(m_pScenarioTable,pScenarioName,APR_HASH_KEY_STRING);
- if(!pScenario)
- return false;
-
- UmcSession* pSession = pScenario->CreateSession();
- if(!pSession)
- return false;
-
- printf("[%s]\n",pSession->GetId());
- pSession->SetMrcpProfile(pProfileName);
- pSession->SetMrcpApplication(m_pMrcpApplication);
- if(!pSession->Run())
- {
- delete pSession;
- return false;
- }
-
- AddSession(pSession);
- return true;
-}
-
-void UmcFramework::ProcessStopRequest(const char* id)
-{
- UmcSession* pSession;
- void* pVal;
- apr_hash_index_t* it = apr_hash_first(m_pPool,m_pSessionTable);
- for(; it; it = apr_hash_next(it))
- {
- apr_hash_this(it,NULL,NULL,&pVal);
- pSession = (UmcSession*) pVal;
- if(pSession && strcasecmp(pSession->GetId(),id) == 0)
- {
- /* stop in-progress request */
- pSession->Stop();
- return;
- }
- }
-}
-
-void UmcFramework::ProcessKillRequest(const char* id)
-{
- UmcSession* pSession;
- void* pVal;
- apr_hash_index_t* it = apr_hash_first(m_pPool,m_pSessionTable);
- for(; it; it = apr_hash_next(it))
- {
- apr_hash_this(it,NULL,NULL,&pVal);
- pSession = (UmcSession*) pVal;
- if(pSession && strcasecmp(pSession->GetId(),id) == 0)
- {
- /* terminate session */
- pSession->Terminate();
- return;
- }
- }
-}
-
-void UmcFramework::ProcessShowScenarios()
-{
- UmcScenario* pScenario;
- void* pVal;
- printf("%d Scenario(s)\n", apr_hash_count(m_pScenarioTable));
- apr_hash_index_t* it = apr_hash_first(m_pPool,m_pScenarioTable);
- for(; it; it = apr_hash_next(it))
- {
- apr_hash_this(it,NULL,NULL,&pVal);
- pScenario = (UmcScenario*) pVal;
- if(pScenario)
- {
- printf("[%s]\n", pScenario->GetName());
- }
- }
-}
-
-void UmcFramework::ProcessShowSessions()
-{
- UmcSession* pSession;
- void* pVal;
- printf("%d Session(s)\n", apr_hash_count(m_pSessionTable));
- apr_hash_index_t* it = apr_hash_first(m_pPool,m_pSessionTable);
- for(; it; it = apr_hash_next(it))
- {
- apr_hash_this(it,NULL,NULL,&pVal);
- pSession = (UmcSession*) pVal;
- if(pSession)
- {
- printf("[%s] - %s\n", pSession->GetId(), pSession->GetScenario()->GetName());
- }
- }
-}
-
-void UmcFramework::RunSession(const char* pScenarioName, const char* pProfileName)
-{
- apt_task_t* pTask = apt_consumer_task_base_get(m_pTask);
- apt_task_msg_t* pTaskMsg = apt_task_msg_get(pTask);
- if(!pTaskMsg)
- return;
-
- pTaskMsg->type = TASK_MSG_USER;
- pTaskMsg->sub_type = UMC_TASK_RUN_SESSION_MSG;
- UmcTaskMsg* pUmcMsg = (UmcTaskMsg*) pTaskMsg->data;
- strncpy(pUmcMsg->m_ScenarioName,pScenarioName,sizeof(pUmcMsg->m_ScenarioName)-1);
- strncpy(pUmcMsg->m_ProfileName,pProfileName,sizeof(pUmcMsg->m_ProfileName)-1);
- pUmcMsg->m_pAppMessage = NULL;
- apt_task_msg_signal(pTask,pTaskMsg);
-}
-
-void UmcFramework::StopSession(const char* id)
-{
- apt_task_t* pTask = apt_consumer_task_base_get(m_pTask);
- apt_task_msg_t* pTaskMsg = apt_task_msg_get(pTask);
- if(!pTaskMsg)
- return;
-
- pTaskMsg->type = TASK_MSG_USER;
- pTaskMsg->sub_type = UMC_TASK_STOP_SESSION_MSG;
-
- UmcTaskMsg* pUmcMsg = (UmcTaskMsg*) pTaskMsg->data;
- strncpy(pUmcMsg->m_SessionId,id,sizeof(pUmcMsg->m_SessionId)-1);
- pUmcMsg->m_pAppMessage = NULL;
- apt_task_msg_signal(pTask,pTaskMsg);
-}
-
-void UmcFramework::KillSession(const char* id)
-{
- apt_task_t* pTask = apt_consumer_task_base_get(m_pTask);
- apt_task_msg_t* pTaskMsg = apt_task_msg_get(pTask);
- if(!pTaskMsg)
- return;
-
- pTaskMsg->type = TASK_MSG_USER;
- pTaskMsg->sub_type = UMC_TASK_KILL_SESSION_MSG;
-
- UmcTaskMsg* pUmcMsg = (UmcTaskMsg*) pTaskMsg->data;
- strncpy(pUmcMsg->m_SessionId,id,sizeof(pUmcMsg->m_SessionId)-1);
- pUmcMsg->m_pAppMessage = NULL;
- apt_task_msg_signal(pTask,pTaskMsg);
-}
-
-void UmcFramework::ShowScenarios()
-{
- apt_task_t* pTask = apt_consumer_task_base_get(m_pTask);
- apt_task_msg_t* pTaskMsg = apt_task_msg_get(pTask);
- if(!pTaskMsg)
- return;
-
- pTaskMsg->type = TASK_MSG_USER;
- pTaskMsg->sub_type = UMC_TASK_SHOW_SCENARIOS_MSG;
- apt_task_msg_signal(pTask,pTaskMsg);
-}
-
-void UmcFramework::ShowSessions()
-{
- apt_task_t* pTask = apt_consumer_task_base_get(m_pTask);
- apt_task_msg_t* pTaskMsg = apt_task_msg_get(pTask);
- if(!pTaskMsg)
- return;
-
- pTaskMsg->type = TASK_MSG_USER;
- pTaskMsg->sub_type = UMC_TASK_SHOW_SESSIONS_MSG;
- apt_task_msg_signal(pTask,pTaskMsg);
-}
-
-apt_bool_t AppMessageHandler(const mrcp_app_message_t* pMessage)
-{
- UmcFramework* pFramework = (UmcFramework*) mrcp_application_object_get(pMessage->application);
- if(!pFramework)
- return FALSE;
-
- apt_task_t* pTask = apt_consumer_task_base_get(pFramework->m_pTask);
- apt_task_msg_t* pTaskMsg = apt_task_msg_get(pTask);
- if(pTaskMsg)
- {
- pTaskMsg->type = TASK_MSG_USER;
- pTaskMsg->sub_type = UMC_TASK_CLIENT_MSG;
-
- UmcTaskMsg* pUmcMsg = (UmcTaskMsg*) pTaskMsg->data;
- pUmcMsg->m_pAppMessage = pMessage;
- apt_task_msg_signal(pTask,pTaskMsg);
- }
-
- return TRUE;
-}
-
-
-apt_bool_t AppOnSessionUpdate(mrcp_application_t *application, mrcp_session_t *session, mrcp_sig_status_code_e status)
-{
- UmcSession* pSession = (UmcSession*) mrcp_application_session_object_get(session);
- return pSession->OnSessionUpdate(status);
-}
-
-apt_bool_t AppOnSessionTerminate(mrcp_application_t *application, mrcp_session_t *session, mrcp_sig_status_code_e status)
-{
- UmcSession* pSession = (UmcSession*) mrcp_application_session_object_get(session);
- if(!pSession->OnSessionTerminate(status))
- return false;
-
- UmcFramework* pFramework = (UmcFramework*) mrcp_application_object_get(application);
- pFramework->RemoveSession(pSession);
- delete pSession;
- return true;
-}
-
-apt_bool_t AppOnChannelAdd(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_sig_status_code_e status)
-{
- UmcSession* pSession = (UmcSession*) mrcp_application_session_object_get(session);
- return pSession->OnChannelAdd(channel,status);
-}
-
-apt_bool_t AppOnChannelRemove(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_sig_status_code_e status)
-{
- UmcSession* pSession = (UmcSession*) mrcp_application_session_object_get(session);
- return pSession->OnChannelRemove(channel,status);
-}
-
-apt_bool_t AppOnMessageReceive(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_message_t *message)
-{
- UmcSession* pSession = (UmcSession*) mrcp_application_session_object_get(session);
- return pSession->OnMessageReceive(channel,message);
-}
-
-apt_bool_t AppOnTerminateEvent(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel)
-{
- UmcSession* pSession = (UmcSession*) mrcp_application_session_object_get(session);
- return pSession->OnTerminateEvent(channel);
-}
-
-apt_bool_t AppOnResourceDiscover(mrcp_application_t *application, mrcp_session_t *session, mrcp_session_descriptor_t *descriptor, mrcp_sig_status_code_e status)
-{
- UmcSession* pSession = (UmcSession*) mrcp_application_session_object_get(session);
- return pSession->OnResourceDiscover(descriptor,status);
-}
-
-void UmcOnStartComplete(apt_task_t* pTask)
-{
- apt_consumer_task_t* pConsumerTask = (apt_consumer_task_t*) apt_task_object_get(pTask);
- UmcFramework* pFramework = (UmcFramework*) apt_consumer_task_object_get(pConsumerTask);
-
- pFramework->CreateMrcpClient();
- pFramework->LoadScenarios();
-}
-
-void UmcOnTerminateComplete(apt_task_t* pTask)
-{
- apt_consumer_task_t* pConsumerTask = (apt_consumer_task_t*) apt_task_object_get(pTask);
- UmcFramework* pFramework = (UmcFramework*) apt_consumer_task_object_get(pConsumerTask);
-
- pFramework->DestroyMrcpClient();
- pFramework->DestroyScenarios();
-}
-
-apt_bool_t UmcProcessMsg(apt_task_t *pTask, apt_task_msg_t *pMsg)
-{
- if(pMsg->type != TASK_MSG_USER)
- return FALSE;
-
- apt_consumer_task_t* pConsumerTask = (apt_consumer_task_t*) apt_task_object_get(pTask);
- UmcFramework* pFramework = (UmcFramework*) apt_consumer_task_object_get(pConsumerTask);
- UmcTaskMsg* pUmcMsg = (UmcTaskMsg*) pMsg->data;
- switch(pMsg->sub_type)
- {
- case UMC_TASK_CLIENT_MSG:
- {
- static const mrcp_app_message_dispatcher_t applicationDispatcher =
- {
- AppOnSessionUpdate,
- AppOnSessionTerminate,
- AppOnChannelAdd,
- AppOnChannelRemove,
- AppOnMessageReceive,
- AppOnTerminateEvent,
- AppOnResourceDiscover
- };
-
- mrcp_application_message_dispatch(&applicationDispatcher,pUmcMsg->m_pAppMessage);
- break;
- }
- case UMC_TASK_RUN_SESSION_MSG:
- {
- pFramework->ProcessRunRequest(pUmcMsg->m_ScenarioName,pUmcMsg->m_ProfileName);
- break;
- }
- case UMC_TASK_STOP_SESSION_MSG:
- {
- pFramework->ProcessStopRequest(pUmcMsg->m_SessionId);
- break;
- }
- case UMC_TASK_KILL_SESSION_MSG:
- {
- pFramework->ProcessKillRequest(pUmcMsg->m_SessionId);
- break;
- }
- case UMC_TASK_SHOW_SCENARIOS_MSG:
- {
- pFramework->ProcessShowScenarios();
- break;
- }
- case UMC_TASK_SHOW_SESSIONS_MSG:
- {
- pFramework->ProcessShowSessions();
- break;
- }
- }
- return TRUE;
-}
+++ /dev/null
-/*
- * 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: umcscenario.cpp 2232 2014-11-12 01:33:37Z achaloyan@gmail.com $
- */
-
-#include <stdlib.h>
-#include "umcscenario.h"
-#include "apt_log.h"
-
-UmcScenario::UmcScenario() :
- m_pName(NULL),
- m_pMrcpProfile("uni2"),
- m_pDirLayout(NULL),
- m_ResourceDiscovery(false),
- m_pCapabilities(NULL),
- m_pRtpDescriptor(NULL)
-{
-}
-
-UmcScenario::~UmcScenario()
-{
-}
-
-bool UmcScenario::Load(const apr_xml_elem* pElem, apr_pool_t* pool)
-{
- const apr_xml_elem* pChildElem;
- /* Load Child Elements */
- for(pChildElem = pElem->first_child; pChildElem; pChildElem = pChildElem->next)
- {
- if(!LoadElement(pChildElem,pool))
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Load Child Element %s",pChildElem->name);
- }
- return true;
-}
-
-void UmcScenario::Destroy()
-{
-}
-
-bool UmcScenario::LoadElement(const apr_xml_elem* pElem, apr_pool_t* pool)
-{
- if(strcasecmp(pElem->name,"resource-discovery") == 0)
- {
- LoadDiscovery(pElem,pool);
- return true;
- }
- else if(strcasecmp(pElem->name,"termination") == 0)
- {
- LoadTermination(pElem,pool);
- return true;
- }
- else if(strcasecmp(pElem->name,"rtp-termination") == 0)
- {
- LoadRtpTermination(pElem,pool);
- return true;
- }
-
- return false;
-}
-
-bool UmcScenario::LoadDiscovery(const apr_xml_elem* pElem, apr_pool_t* pool)
-{
- m_ResourceDiscovery = IsElementEnabled(pElem);
- return true;
-}
-
-bool UmcScenario::LoadTermination(const apr_xml_elem* pElem, apr_pool_t* pool)
-{
- if(!IsElementEnabled(pElem))
- return true;
-
- const apr_xml_elem* pChildElem;
- /* Load Child Elements */
- for(pChildElem = pElem->first_child; pChildElem; pChildElem = pChildElem->next)
- {
- if(strcasecmp(pChildElem->name,"capabilities") == 0)
- return LoadCapabilities(pChildElem,pool);
- }
- return true;
-}
-
-bool UmcScenario::LoadCapabilities(const apr_xml_elem* pElem, apr_pool_t* pool)
-{
- const apr_xml_elem* pChildElem;
- /* Load Child Elements */
- m_pCapabilities = (mpf_codec_capabilities_t*) apr_palloc(pool,sizeof(mpf_codec_capabilities_t));
- mpf_codec_capabilities_init(m_pCapabilities,1,pool);
- for(pChildElem = pElem->first_child; pChildElem; pChildElem = pChildElem->next)
- {
- if(strcasecmp(pChildElem->name,"codec") != 0)
- continue;
-
- const char* pName = NULL;
- const char* pRates = NULL;
- const apr_xml_attr* pAttr;
- for(pAttr = pChildElem->attr; pAttr; pAttr = pAttr->next)
- {
- if(strcasecmp(pAttr->name,"name") == 0)
- {
- pName = pAttr->value;
- }
- else if(strcasecmp(pAttr->name,"rates") == 0)
- {
- pRates = pAttr->value;
- }
- }
-
- if(pName)
- {
- int rates = ParseRates(pRates,pool);
- mpf_codec_capabilities_add(m_pCapabilities,rates,pName);
- }
- }
- return true;
-}
-
-int UmcScenario::ParseRates(const char* pStr, apr_pool_t* pool)
-{
- int rates = 0;
- if(pStr)
- {
- char* pRateStr;
- char* pState;
- char* pRateListStr = apr_pstrdup(pool,pStr);
- do
- {
- pRateStr = apr_strtok(pRateListStr, " ", &pState);
- if(pRateStr)
- {
- apr_uint16_t rate = (apr_uint16_t)atoi(pRateStr);
- rates |= mpf_sample_rate_mask_get(rate);
- }
- pRateListStr = NULL; /* make sure we pass NULL on subsequent calls of apr_strtok() */
- }
- while(pRateStr);
- }
- return rates;
-}
-
-bool UmcScenario::LoadRtpTermination(const apr_xml_elem* pElem, apr_pool_t* pool)
-{
- return true;
-}
-
-bool UmcScenario::InitCapabilities(mpf_stream_capabilities_t* pCapabilities) const
-{
- if(m_pCapabilities)
- {
- int i;
- mpf_codec_attribs_t *pAttribs;
- for(i=0; i<m_pCapabilities->attrib_arr->nelts; i++)
- {
- pAttribs = &APR_ARRAY_IDX(m_pCapabilities->attrib_arr,i,mpf_codec_attribs_t);
- mpf_codec_capabilities_add(
- &pCapabilities->codecs,
- pAttribs->sample_rates,
- pAttribs->name.buf);
- }
- }
- else
- {
- /* add default codec capabilities (Linear PCM) */
- mpf_codec_capabilities_add(
- &pCapabilities->codecs,
- MPF_SAMPLE_RATE_8000 | MPF_SAMPLE_RATE_16000,
- "LPCM");
- }
-
- return true;
-}
-
-bool UmcScenario::IsElementEnabled(const apr_xml_elem* pElem)
-{
- const apr_xml_attr* pAttr;
- for(pAttr = pElem->attr; pAttr; pAttr = pAttr->next)
- {
- if(strcasecmp(pAttr->name,"enable") == 0)
- {
- return atoi(pAttr->value) > 0;
- }
- }
- return true;
-}
-
-const char* UmcScenario::LoadFileContent(const char* pFileName, apr_size_t& size, apr_pool_t* pool) const
-{
- if(!m_pDirLayout || !pFileName)
- return NULL;
-
- char* pFilePath = apt_datadir_filepath_get(m_pDirLayout,pFileName,pool);
- if(!pFilePath)
- return NULL;
-
- apr_file_t *pFile;
- if(apr_file_open(&pFile,pFilePath,APR_FOPEN_READ|APR_FOPEN_BINARY,0,pool) != APR_SUCCESS)
- {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Open File %s",pFilePath);
- return NULL;
- }
-
- apr_finfo_t finfo;
- if(apr_file_info_get(&finfo,APR_FINFO_SIZE,pFile) != APR_SUCCESS)
- {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Get File Info %s",pFilePath);
- apr_file_close(pFile);
- return NULL;
- }
-
- size = (apr_size_t)finfo.size;
- char* pContent = (char*) apr_palloc(pool,size+1);
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Load File Content size [%" APR_SIZE_T_FMT" bytes] %s",size,pFilePath);
- if(apr_file_read(pFile,pContent,&size) != APR_SUCCESS)
- {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Read Content %s",pFilePath);
- apr_file_close(pFile);
- return NULL;
- }
- pContent[size] = '\0';
- apr_file_close(pFile);
- return pContent;
-}
+++ /dev/null
-/*
- * 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: umcsession.cpp 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include "umcsession.h"
-#include "umcscenario.h"
-#include "mrcp_message.h"
-
-UmcSession::UmcSession(const UmcScenario* pScenario) :
- m_pScenario(pScenario),
- m_pMrcpProfile(NULL),
- m_pMrcpApplication(NULL),
- m_pMrcpSession(NULL),
- m_pMrcpMessage(NULL),
- m_Running(false),
- m_Terminating(false)
-{
- static int id = 0;
- if(id == INT_MAX)
- id = 0;
- id++;
-
- int size = apr_snprintf(m_Id,sizeof(m_Id)-1,"%d",id);
- m_Id[size] = '\0';
-}
-
-UmcSession::~UmcSession()
-{
-}
-
-bool UmcSession::Run()
-{
- if(m_Running)
- return false;
-
- if(!m_pMrcpProfile)
- m_pMrcpProfile = m_pScenario->GetMrcpProfile();
-
- if(!m_pMrcpProfile || !m_pMrcpApplication)
- return false;
-
- /* create session */
- if(!CreateMrcpSession(m_pMrcpProfile))
- return false;
-
- m_Running = true;
-
- bool ret = false;
- if(m_pScenario->IsDiscoveryEnabled())
- ret = ResourceDiscover();
- else
- ret = Start();
-
- if(!ret)
- {
- m_Running = false;
- DestroyMrcpSession();
- }
- return ret;
-}
-
-bool UmcSession::Stop()
-{
- if(m_Terminating)
- return false;
-
- return true;
-}
-
-bool UmcSession::Terminate()
-{
- if(m_Terminating)
- return false;
-
- m_Running = false;
- m_Terminating = true;
- return (mrcp_application_session_terminate(m_pMrcpSession) == TRUE);
-}
-
-bool UmcSession::OnSessionTerminate(mrcp_sig_status_code_e status)
-{
- if(!m_Terminating)
- return false;
-
- m_Terminating = false;
- return DestroyMrcpSession();
-}
-
-bool UmcSession::OnSessionUpdate(mrcp_sig_status_code_e status)
-{
- return m_Running;
-}
-
-bool UmcSession::OnChannelAdd(mrcp_channel_t *channel, mrcp_sig_status_code_e status)
-{
- return m_Running;
-}
-
-bool UmcSession::OnChannelRemove(mrcp_channel_t *channel, mrcp_sig_status_code_e status)
-{
- return m_Running;
-}
-
-bool UmcSession::OnMessageReceive(mrcp_channel_t *channel, mrcp_message_t *message)
-{
- if(!m_Running)
- return false;
-
- if(!m_pMrcpMessage)
- return false;
-
- /* match request identifiers */
- if(m_pMrcpMessage->start_line.request_id != message->start_line.request_id)
- return false;
-
- return true;
-}
-
-bool UmcSession::OnTerminateEvent(mrcp_channel_t *channel)
-{
- if(!m_Running)
- return false;
-
- return Terminate();
-}
-
-bool UmcSession::OnResourceDiscover(mrcp_session_descriptor_t* descriptor, mrcp_sig_status_code_e status)
-{
- if(!m_Running)
- return false;
-
- if(!Start())
- Terminate();
- return true;
-}
-
-bool UmcSession::CreateMrcpSession(const char* pProfileName)
-{
- m_pMrcpSession = mrcp_application_session_create(m_pMrcpApplication,pProfileName,this);
- char name[32];
- apr_snprintf(name,sizeof(name),"umc-%s",m_Id);
- mrcp_application_session_name_set(m_pMrcpSession,name);
- return (m_pMrcpSession != NULL);
-}
-
-bool UmcSession::DestroyMrcpSession()
-{
- if(!m_pMrcpSession)
- return false;
-
- mrcp_application_session_destroy(m_pMrcpSession);
- m_pMrcpSession = NULL;
- return true;
-}
-
-bool UmcSession::AddMrcpChannel(mrcp_channel_t* pMrcpChannel)
-{
- if(!m_Running)
- return false;
-
- return (mrcp_application_channel_add(m_pMrcpSession,pMrcpChannel) == TRUE);
-}
-
-bool UmcSession::RemoveMrcpChannel(mrcp_channel_t* pMrcpChannel)
-{
- if(!m_Running)
- return false;
-
- return (mrcp_application_channel_remove(m_pMrcpSession,pMrcpChannel) == TRUE);
-}
-
-bool UmcSession::SendMrcpRequest(mrcp_channel_t* pMrcpChannel, mrcp_message_t* pMrcpMessage)
-{
- if(!m_Running)
- return false;
-
- m_pMrcpMessage = pMrcpMessage;
- return (mrcp_application_message_send(m_pMrcpSession,pMrcpChannel,pMrcpMessage) == TRUE);
-}
-
-bool UmcSession::ResourceDiscover()
-{
- if(!m_Running)
- return false;
-
- return (mrcp_application_resource_discover(m_pMrcpSession) == TRUE);
-}
-
-mrcp_channel_t* UmcSession::CreateMrcpChannel(
- mrcp_resource_id resource_id,
- mpf_termination_t* pTermination,
- mpf_rtp_termination_descriptor_t* pRtpDescriptor,
- void* pObj)
-{
- return mrcp_application_channel_create(
- m_pMrcpSession, /* session, channel belongs to */
- resource_id, /* MRCP resource identifier */
- pTermination, /* media termination, used to terminate audio stream */
- NULL, /* RTP descriptor, used to create RTP termination (NULL by default) */
- pObj); /* object to associate */
-}
-
-mpf_termination_t* UmcSession::CreateAudioTermination(
- const mpf_audio_stream_vtable_t* pStreamVtable,
- mpf_stream_capabilities_t* pCapabilities,
- void* pObj)
-{
- return mrcp_application_audio_termination_create(
- m_pMrcpSession, /* session, termination belongs to */
- pStreamVtable, /* virtual methods table of audio stream */
- pCapabilities, /* capabilities of audio stream */
- pObj); /* object to associate */
-}
-
-mrcp_message_t* UmcSession::CreateMrcpMessage(
- mrcp_channel_t* pMrcpChannel,
- mrcp_method_id method_id)
-{
- return mrcp_application_message_create(m_pMrcpSession,pMrcpChannel,method_id);
-}
-
-
-
-apr_pool_t* UmcSession::GetSessionPool() const
-{
- if(!m_pMrcpSession)
- return NULL;
- return mrcp_application_session_pool_get(m_pMrcpSession);
-}
-
-const char* UmcSession::GetMrcpSessionId() const
-{
- if(!m_pMrcpSession)
- return NULL;
-
- const apt_str_t *pId = mrcp_application_session_id_get(m_pMrcpSession);
- return pId->buf;
-}
+++ /dev/null
-/*
- * 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: verifierscenario.cpp 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include <stdlib.h>
-#include "verifierscenario.h"
-#include "verifiersession.h"
-#include "mrcp_message.h"
-#include "mrcp_generic_header.h"
-#include "mrcp_recog_header.h"
-#include "mrcp_recog_resource.h"
-#include "apt_log.h"
-
-VerifierScenario::VerifierScenario() :
- m_RepositoryURI(NULL),
- m_VerificationMode(NULL),
- m_VoiceprintIdentifier(NULL)
-{
-}
-
-VerifierScenario::~VerifierScenario()
-{
-}
-
-void VerifierScenario::Destroy()
-{
-}
-
-bool VerifierScenario::LoadElement(const apr_xml_elem* pElem, apr_pool_t* pool)
-{
- if(UmcScenario::LoadElement(pElem,pool))
- return true;
-
- if(strcasecmp(pElem->name,"verify") == 0)
- {
- LoadVerify(pElem,pool);
- return true;
- }
- return false;
-}
-
-bool VerifierScenario::LoadVerify(const apr_xml_elem* pElem, apr_pool_t* pool)
-{
- const apr_xml_attr* pAttr;
- for(pAttr = pElem->attr; pAttr; pAttr = pAttr->next)
- {
- if(strcasecmp(pAttr->name,"repository-uri") == 0)
- {
- m_RepositoryURI = pAttr->value;
- }
- else if(strcasecmp(pAttr->name,"verification-mode") == 0)
- {
- m_VerificationMode = pAttr->value;
- }
- else if(strcasecmp(pAttr->name,"voiceprint-identifier") == 0)
- {
- m_VoiceprintIdentifier = pAttr->value;
- }
- }
-
- return true;
-}
-
-
-UmcSession* VerifierScenario::CreateSession()
-{
- return new VerifierSession(this);
-}
+++ /dev/null
-/*
- * 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: verifiersession.cpp 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include "verifiersession.h"
-#include "verifierscenario.h"
-#include "mrcp_message.h"
-#include "mrcp_generic_header.h"
-#include "mrcp_verifier_header.h"
-#include "mrcp_verifier_resource.h"
-#include "apt_nlsml_doc.h"
-#include "apt_log.h"
-
-struct VerifierChannel
-{
- /** MRCP control channel */
- mrcp_channel_t* m_pMrcpChannel;
- /** IN-PROGRESS VERIFY request */
- mrcp_message_t* m_pVerificationRequest;
- /** Streaming is in-progress */
- bool m_Streaming;
- /** File to read audio stream from */
- FILE* m_pAudioIn;
- /** Estimated time to complete (used if no audio_in available) */
- apr_size_t m_TimeToComplete;
-
- VerifierChannel() :
- m_pMrcpChannel(NULL),
- m_pVerificationRequest(NULL),
- m_Streaming(false),
- m_pAudioIn(NULL),
- m_TimeToComplete(0) {}
-};
-
-VerifierSession::VerifierSession(const VerifierScenario* pScenario) :
- UmcSession(pScenario),
- m_pVerifierChannel(NULL),
- m_ContentId("request1@form-level")
-{
-}
-
-VerifierSession::~VerifierSession()
-{
-}
-
-bool VerifierSession::Start()
-{
- /* create channel and associate all the required data */
- m_pVerifierChannel = CreateVerifierChannel();
- if(!m_pVerifierChannel)
- return false;
-
- /* add channel to session (send asynchronous request) */
- if(!AddMrcpChannel(m_pVerifierChannel->m_pMrcpChannel))
- {
- delete m_pVerifierChannel;
- m_pVerifierChannel = NULL;
- return false;
- }
- return true;
-}
-
-bool VerifierSession::Stop()
-{
- if(!UmcSession::Stop())
- return false;
-
- if(!m_pVerifierChannel)
- return false;
-
- mrcp_message_t* pStopMessage = CreateMrcpMessage(m_pVerifierChannel->m_pMrcpChannel,VERIFIER_STOP);
- if(!pStopMessage)
- return false;
-
- return SendMrcpRequest(m_pVerifierChannel->m_pMrcpChannel,pStopMessage);
-}
-
-bool VerifierSession::OnSessionTerminate(mrcp_sig_status_code_e status)
-{
- if(m_pVerifierChannel)
- {
- FILE* pAudioIn = m_pVerifierChannel->m_pAudioIn;
- if(pAudioIn)
- {
- m_pVerifierChannel->m_pAudioIn = NULL;
- fclose(pAudioIn);
- }
-
- delete m_pVerifierChannel;
- m_pVerifierChannel = NULL;
- }
- return UmcSession::OnSessionTerminate(status);
-}
-
-static apt_bool_t ReadStream(mpf_audio_stream_t* pStream, mpf_frame_t* pFrame)
-{
- VerifierChannel* pVerifierChannel = (VerifierChannel*) pStream->obj;
- if(pVerifierChannel && pVerifierChannel->m_Streaming)
- {
- if(pVerifierChannel->m_pAudioIn)
- {
- if(fread(pFrame->codec_frame.buffer,1,pFrame->codec_frame.size,pVerifierChannel->m_pAudioIn) == pFrame->codec_frame.size)
- {
- /* normal read */
- pFrame->type |= MEDIA_FRAME_TYPE_AUDIO;
- }
- else
- {
- /* file is over */
- pVerifierChannel->m_Streaming = false;
- }
- }
- else
- {
- /* fill with silence in case no file available */
- if(pVerifierChannel->m_TimeToComplete >= CODEC_FRAME_TIME_BASE)
- {
- pFrame->type |= MEDIA_FRAME_TYPE_AUDIO;
- memset(pFrame->codec_frame.buffer,0,pFrame->codec_frame.size);
- pVerifierChannel->m_TimeToComplete -= CODEC_FRAME_TIME_BASE;
- }
- else
- {
- pVerifierChannel->m_Streaming = false;
- }
- }
- }
- return TRUE;
-}
-
-VerifierChannel* VerifierSession::CreateVerifierChannel()
-{
- mrcp_channel_t* pChannel;
- mpf_termination_t* pTermination;
- mpf_stream_capabilities_t* pCapabilities;
- apr_pool_t* pool = GetSessionPool();
-
- /* create channel */
- VerifierChannel* pVerifierChannel = new VerifierChannel;
-
- /* create source stream capabilities */
- pCapabilities = mpf_source_stream_capabilities_create(pool);
- GetScenario()->InitCapabilities(pCapabilities);
-
- static const mpf_audio_stream_vtable_t audio_stream_vtable =
- {
- NULL,
- NULL,
- NULL,
- ReadStream,
- NULL,
- NULL,
- NULL,
- NULL
- };
-
- pTermination = CreateAudioTermination(
- &audio_stream_vtable, /* virtual methods table of audio stream */
- pCapabilities, /* capabilities of audio stream */
- pVerifierChannel); /* object to associate */
-
- pChannel = CreateMrcpChannel(
- MRCP_VERIFIER_RESOURCE, /* MRCP resource identifier */
- pTermination, /* media termination, used to terminate audio stream */
- NULL, /* RTP descriptor, used to create RTP termination (NULL by default) */
- pVerifierChannel); /* object to associate */
- if(!pChannel)
- {
- delete pVerifierChannel;
- return NULL;
- }
-
- pVerifierChannel->m_pMrcpChannel = pChannel;
- return pVerifierChannel;
-}
-
-bool VerifierSession::OnChannelAdd(mrcp_channel_t* pMrcpChannel, mrcp_sig_status_code_e status)
-{
- if(!UmcSession::OnChannelAdd(pMrcpChannel,status))
- return false;
-
- if(status != MRCP_SIG_STATUS_CODE_SUCCESS)
- {
- /* error case, just terminate the demo */
- return Terminate();
- }
-
- return StartVerification(pMrcpChannel);
-}
-
-bool VerifierSession::OnMessageReceive(mrcp_channel_t* pMrcpChannel, mrcp_message_t* pMrcpMessage)
-{
- if(!UmcSession::OnMessageReceive(pMrcpChannel,pMrcpMessage))
- return false;
-
- VerifierChannel* pVerifierChannel = (VerifierChannel*) mrcp_application_channel_object_get(pMrcpChannel);
- if(pMrcpMessage->start_line.message_type == MRCP_MESSAGE_TYPE_RESPONSE)
- {
- /* received MRCP response */
- if(pMrcpMessage->start_line.method_id == VERIFIER_START_SESSION)
- {
- /* received the response to START-SESSION request */
- /* create and send VERIFY request */
- mrcp_message_t* pMrcpMessage = CreateVerificationRequest(pMrcpChannel);
- if(pMrcpMessage)
- {
- SendMrcpRequest(pVerifierChannel->m_pMrcpChannel,pMrcpMessage);
- }
- }
- else if(pMrcpMessage->start_line.method_id == VERIFIER_END_SESSION)
- {
- /* received the response to END-SESSION request */
- Terminate();
- }
- else if(pMrcpMessage->start_line.method_id == VERIFIER_VERIFY)
- {
- /* received the response to VERIFY request */
- if(pMrcpMessage->start_line.request_state == MRCP_REQUEST_STATE_INPROGRESS)
- {
- VerifierChannel* pVerifierChannel = (VerifierChannel*) mrcp_application_channel_object_get(pMrcpChannel);
- if(pVerifierChannel)
- pVerifierChannel->m_pVerificationRequest = GetMrcpMessage();
-
- /* start to stream the speech to Verify */
- if(pVerifierChannel)
- pVerifierChannel->m_Streaming = true;
- }
- else
- {
- /* create and send END-SESSION request */
- mrcp_message_t* pMrcpMessage = CreateEndSessionRequest(pMrcpChannel);
- if(pMrcpMessage)
- {
- SendMrcpRequest(pVerifierChannel->m_pMrcpChannel,pMrcpMessage);
- }
- }
- }
- else
- {
- /* received unexpected response */
- }
- }
- else if(pMrcpMessage->start_line.message_type == MRCP_MESSAGE_TYPE_EVENT)
- {
- if(pMrcpMessage->start_line.method_id == VERIFIER_VERIFICATION_COMPLETE)
- {
- if(pVerifierChannel)
- pVerifierChannel->m_Streaming = false;
-
- VerifierChannel* pVerifierChannel = (VerifierChannel*) mrcp_application_channel_object_get(pMrcpChannel);
- if(pVerifierChannel)
- pVerifierChannel->m_pVerificationRequest = NULL;
-
- /* create and send END-SESSION request */
- mrcp_message_t* pMrcpMessage = CreateEndSessionRequest(pMrcpChannel);
- if(pVerifierChannel && pMrcpMessage)
- {
- SendMrcpRequest(pVerifierChannel->m_pMrcpChannel,pMrcpMessage);
- }
- }
- else if(pMrcpMessage->start_line.method_id == VERIFIER_START_OF_INPUT)
- {
- /* received start-of-input, do whatever you need here */
- }
- }
- return true;
-}
-
-bool VerifierSession::StartVerification(mrcp_channel_t* pMrcpChannel)
-{
- const mpf_codec_descriptor_t* pDescriptor = mrcp_application_source_descriptor_get(pMrcpChannel);
- if(!pDescriptor)
- {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Get Media Source Descriptor");
- return Terminate();
- }
-
- VerifierChannel* pVerifierChannel = (VerifierChannel*) mrcp_application_channel_object_get(pMrcpChannel);
- /* create and send Verification request */
- mrcp_message_t* pMrcpMessage = CreateStartSessionRequest(pMrcpChannel);
- if(pMrcpMessage)
- {
- SendMrcpRequest(pVerifierChannel->m_pMrcpChannel,pMrcpMessage);
- }
-
- pVerifierChannel->m_pAudioIn = GetAudioIn(pDescriptor,GetSessionPool());
- if(!pVerifierChannel->m_pAudioIn)
- {
- /* no audio input availble, set some estimated time to complete instead */
- pVerifierChannel->m_TimeToComplete = 5000; // 5 sec
- }
- return true;
-}
-
-mrcp_message_t* VerifierSession::CreateStartSessionRequest(mrcp_channel_t* pMrcpChannel)
-{
- mrcp_message_t* pMrcpMessage = CreateMrcpMessage(pMrcpChannel,VERIFIER_START_SESSION);
- if(!pMrcpMessage)
- return NULL;
-
- mrcp_verifier_header_t* pVerifierHeader;
-
- /* get/allocate verifier header */
- pVerifierHeader = (mrcp_verifier_header_t*) mrcp_resource_header_prepare(pMrcpMessage);
- if(pVerifierHeader)
- {
- const VerifierScenario* pScenario = GetScenario();
- const char* pRepositoryURI = pScenario->GetRepositoryURI();
- if(pRepositoryURI)
- {
- apt_string_set(&pVerifierHeader->repository_uri,pRepositoryURI);
- mrcp_resource_header_property_add(pMrcpMessage,VERIFIER_HEADER_REPOSITORY_URI);
- }
- const char* pVoiceprintIdentifier = pScenario->GetVoiceprintIdentifier();
- if(pVoiceprintIdentifier)
- {
- apt_string_set(&pVerifierHeader->voiceprint_identifier,pVoiceprintIdentifier);
- mrcp_resource_header_property_add(pMrcpMessage,VERIFIER_HEADER_VOICEPRINT_IDENTIFIER);
- }
- const char* pVerificationMode = pScenario->GetVerificationMode();
- if(pVerificationMode)
- {
- apt_string_set(&pVerifierHeader->verification_mode,pVerificationMode);
- mrcp_resource_header_property_add(pMrcpMessage,VERIFIER_HEADER_VERIFICATION_MODE);
- }
- }
- return pMrcpMessage;
-}
-
-mrcp_message_t* VerifierSession::CreateEndSessionRequest(mrcp_channel_t* pMrcpChannel)
-{
- return CreateMrcpMessage(pMrcpChannel,VERIFIER_END_SESSION);
-}
-
-mrcp_message_t* VerifierSession::CreateVerificationRequest(mrcp_channel_t* pMrcpChannel)
-{
- mrcp_message_t* pMrcpMessage = CreateMrcpMessage(pMrcpChannel,VERIFIER_VERIFY);
- if(!pMrcpMessage)
- return NULL;
-
- mrcp_verifier_header_t* pVerifierHeader;
-
- /* get/allocate verifier header */
- pVerifierHeader = (mrcp_verifier_header_t*) mrcp_resource_header_prepare(pMrcpMessage);
- if(pVerifierHeader)
- {
- pVerifierHeader->no_input_timeout = 5000;
- mrcp_resource_header_property_add(pMrcpMessage,VERIFIER_HEADER_NO_INPUT_TIMEOUT);
- pVerifierHeader->start_input_timers = TRUE;
- mrcp_resource_header_property_add(pMrcpMessage,VERIFIER_HEADER_START_INPUT_TIMERS);
- }
- return pMrcpMessage;
-}
-
-FILE* VerifierSession::GetAudioIn(const mpf_codec_descriptor_t* pDescriptor, apr_pool_t* pool) const
-{
- const VerifierScenario* pScenario = GetScenario();
- const char* pVoiceprintIdentifier = pScenario->GetVoiceprintIdentifier();
- if(!pVoiceprintIdentifier)
- {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"No Voiceprint Specified");
- return NULL;
- }
-
- const char* pFileName = apr_psprintf(pool,"%s-%dkHz.pcm",
- pVoiceprintIdentifier,
- pDescriptor->sampling_rate/1000);
- apt_dir_layout_t* pDirLayout = pScenario->GetDirLayout();
- const char* pFilePath = apt_datadir_filepath_get(pDirLayout,pFileName,pool);
- if(!pFilePath)
- return NULL;
-
- FILE* pFile = fopen(pFilePath,"rb");
- if(!pFile)
- {
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Cannot Find [%s]",pFilePath);
- return NULL;
- }
-
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set [%s] as Speech Source",pFilePath);
- return pFile;
-}
+++ /dev/null
-#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 Client Application\0"
- VALUE "FileVersion", UNI_VERSION_STRING "\0"
- VALUE "InternalName", "umc" "\0"
- VALUE "LegalCopyright", UNI_COPYRIGHT "\0"
- VALUE "OriginalFilename", "umc.exe" "\0"
- VALUE "ProductName", "UniMRCP Project\0"
- VALUE "ProductVersion", UNI_VERSION_STRING "\0"
- END
- END
- BLOCK "VarFileInfo"
- BEGIN
- VALUE "Translation", 0x409, 1200
- END
-END
+++ /dev/null
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="umc"
- ProjectGUID="{CD1C52C1-D8E1-4654-AE65-6CCAB38DE894}"
- RootNamespace="umc"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- <Platform
- Name="x64"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- ConfigurationType="1"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unibin.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpclient.vsprops"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="include"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="$(UniMRCPClientLibs)"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- ConfigurationType="1"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unibin.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpclient.vsprops"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="include"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="$(UniMRCPClientLibs)"
- LinkTimeCodeGeneration="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|x64"
- ConfigurationType="1"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unibin-x64.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpclient.vsprops"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="include"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="$(UniMRCPClientLibs)"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|x64"
- ConfigurationType="1"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unibin-x64.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpclient.vsprops"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="include"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="$(UniMRCPClientLibs)"
- LinkTimeCodeGeneration="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="src"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath=".\src\dtmfscenario.cpp"
- >
- </File>
- <File
- RelativePath=".\src\dtmfsession.cpp"
- >
- </File>
- <File
- RelativePath=".\src\main.cpp"
- >
- </File>
- <File
- RelativePath=".\src\recogscenario.cpp"
- >
- </File>
- <File
- RelativePath=".\src\recogsession.cpp"
- >
- </File>
- <File
- RelativePath=".\src\recorderscenario.cpp"
- >
- </File>
- <File
- RelativePath=".\src\recordersession.cpp"
- >
- </File>
- <File
- RelativePath=".\src\setparamscenario.cpp"
- >
- </File>
- <File
- RelativePath=".\src\setparamsession.cpp"
- >
- </File>
- <File
- RelativePath=".\src\synthscenario.cpp"
- >
- </File>
- <File
- RelativePath=".\src\synthsession.cpp"
- >
- </File>
- <File
- RelativePath=".\src\umcconsole.cpp"
- >
- </File>
- <File
- RelativePath=".\src\umcframework.cpp"
- >
- </File>
- <File
- RelativePath=".\src\umcscenario.cpp"
- >
- </File>
- <File
- RelativePath=".\src\umcsession.cpp"
- >
- </File>
- <File
- RelativePath=".\src\verifierscenario.cpp"
- >
- </File>
- <File
- RelativePath=".\src\verifiersession.cpp"
- >
- </File>
- </Filter>
- <Filter
- Name="include"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- <File
- RelativePath=".\include\dtmfscenario.h"
- >
- </File>
- <File
- RelativePath=".\include\dtmfsession.h"
- >
- </File>
- <File
- RelativePath=".\include\recogscenario.h"
- >
- </File>
- <File
- RelativePath=".\include\recogsession.h"
- >
- </File>
- <File
- RelativePath=".\include\recorderscenario.h"
- >
- </File>
- <File
- RelativePath=".\include\recordersession.h"
- >
- </File>
- <File
- RelativePath=".\include\setparamscenario.h"
- >
- </File>
- <File
- RelativePath=".\include\setparamsession.h"
- >
- </File>
- <File
- RelativePath=".\include\synthscenario.h"
- >
- </File>
- <File
- RelativePath=".\include\synthsession.h"
- >
- </File>
- <File
- RelativePath=".\include\umcconsole.h"
- >
- </File>
- <File
- RelativePath=".\include\umcframework.h"
- >
- </File>
- <File
- RelativePath=".\include\umcscenario.h"
- >
- </File>
- <File
- RelativePath=".\include\umcsession.h"
- >
- </File>
- <File
- RelativePath=".\include\verifierscenario.h"
- >
- </File>
- <File
- RelativePath=".\include\verifiersession.h"
- >
- </File>
- </Filter>
- <File
- RelativePath=".\umc.rc"
- >
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCResourceCompilerTool"
- AdditionalIncludeDirectories="..\..\build"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCResourceCompilerTool"
- AdditionalIncludeDirectories="..\..\build"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug|x64"
- >
- <Tool
- Name="VCResourceCompilerTool"
- AdditionalIncludeDirectories="..\..\build"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|x64"
- >
- <Tool
- Name="VCResourceCompilerTool"
- AdditionalIncludeDirectories="..\..\build"
- />
- </FileConfiguration>
- </File>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{CD1C52C1-D8E1-4654-AE65-6CCAB38DE894}</ProjectGuid>
- <RootNamespace>umc</RootNamespace>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unibin.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unimrcpclient.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" />
- <Import Project="$(ProjectDir)..\..\build\props\unibin.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unimrcpclient.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unibin-x64.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unimrcpclient.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" />
- <Import Project="$(ProjectDir)..\..\build\props\unibin-x64.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unimrcpclient.props" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- </ClCompile>
- <Link>
- <AdditionalDependencies>$(UniMRCPClientLibs);%(AdditionalDependencies)</AdditionalDependencies>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- </ClCompile>
- <Link>
- <AdditionalDependencies>$(UniMRCPClientLibs);%(AdditionalDependencies)</AdditionalDependencies>
- <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- <Link>
- <AdditionalDependencies>$(UniMRCPClientLibs);%(AdditionalDependencies)</AdditionalDependencies>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- </ClCompile>
- <Link>
- <AdditionalDependencies>$(UniMRCPClientLibs);%(AdditionalDependencies)</AdditionalDependencies>
- <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
- </Link>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="src\dtmfscenario.cpp" />
- <ClCompile Include="src\dtmfsession.cpp" />
- <ClCompile Include="src\main.cpp" />
- <ClCompile Include="src\recogscenario.cpp" />
- <ClCompile Include="src\recogsession.cpp" />
- <ClCompile Include="src\recorderscenario.cpp" />
- <ClCompile Include="src\recordersession.cpp" />
- <ClCompile Include="src\setparamscenario.cpp" />
- <ClCompile Include="src\setparamsession.cpp" />
- <ClCompile Include="src\synthscenario.cpp" />
- <ClCompile Include="src\synthsession.cpp" />
- <ClCompile Include="src\umcconsole.cpp" />
- <ClCompile Include="src\umcframework.cpp" />
- <ClCompile Include="src\umcscenario.cpp" />
- <ClCompile Include="src\umcsession.cpp" />
- <ClCompile Include="src\verifierscenario.cpp" />
- <ClCompile Include="src\verifiersession.cpp" />
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="include\dtmfscenario.h" />
- <ClInclude Include="include\dtmfsession.h" />
- <ClInclude Include="include\recogscenario.h" />
- <ClInclude Include="include\recogsession.h" />
- <ClInclude Include="include\recorderscenario.h" />
- <ClInclude Include="include\recordersession.h" />
- <ClInclude Include="include\setparamscenario.h" />
- <ClInclude Include="include\setparamsession.h" />
- <ClInclude Include="include\synthscenario.h" />
- <ClInclude Include="include\synthsession.h" />
- <ClInclude Include="include\umcconsole.h" />
- <ClInclude Include="include\umcframework.h" />
- <ClInclude Include="include\umcscenario.h" />
- <ClInclude Include="include\umcsession.h" />
- <ClInclude Include="include\verifierscenario.h" />
- <ClInclude Include="include\verifiersession.h" />
- </ItemGroup>
- <ItemGroup>
- <ResourceCompile Include="umc.rc">
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\build;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\build;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\build;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\build;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- </ResourceCompile>
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\libunimrcp-client\libunimrcpclient.vcxproj">
- <Project>{ee157390-1e85-416c-946e-620e32c9ad33}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="src">
- <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
- </Filter>
- <Filter Include="include">
- <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="src\dtmfscenario.cpp">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\dtmfsession.cpp">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\main.cpp">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\recogscenario.cpp">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\recogsession.cpp">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\recorderscenario.cpp">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\recordersession.cpp">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\setparamscenario.cpp">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\setparamsession.cpp">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\synthscenario.cpp">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\synthsession.cpp">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\umcconsole.cpp">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\umcframework.cpp">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\umcscenario.cpp">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\umcsession.cpp">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\verifierscenario.cpp">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\verifiersession.cpp">
- <Filter>src</Filter>
- </ClCompile>
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="include\dtmfscenario.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\dtmfsession.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\recogscenario.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\recogsession.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\recorderscenario.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\recordersession.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\setparamscenario.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\setparamsession.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\synthscenario.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\synthsession.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\umcconsole.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\umcframework.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\umcscenario.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\umcsession.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\verifierscenario.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\verifiersession.h">
- <Filter>include</Filter>
- </ClInclude>
- </ItemGroup>
- <ItemGroup>
- <ResourceCompile Include="umc.rc" />
- </ItemGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-AM_CPPFLAGS = -I$(top_srcdir)/platforms/unimrcp-client/include \
- $(UNIMRCP_CLIENTAPP_INCLUDES)
-
-bin_PROGRAMS = unimrcpclient
-
-unimrcpclient_SOURCES = src/main.c \
- src/demo_framework.c \
- src/demo_synth_application.c \
- src/demo_recog_application.c \
- src/demo_bypass_application.c \
- src/demo_discover_application.c \
- src/demo_util.c
-unimrcpclient_LDADD = $(UNIMRCP_CLIENTAPP_LIBS)
-unimrcpclient_LDFLAGS = $(UNIMRCP_CLIENTAPP_OPTS)
-
-include $(top_srcdir)/build/rules/uniclientapp.am
+++ /dev/null
-/*
- * 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: demo_application.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef DEMO_APPLICATION_H
-#define DEMO_APPLICATION_H
-
-/**
- * @file demo_application.h
- * @brief Demo MRCP Application
- */
-
-#include "mrcp_application.h"
-
-APT_BEGIN_EXTERN_C
-
-/** Demo application declaration */
-typedef struct demo_application_t demo_application_t;
-
-/** Demo application */
-struct demo_application_t {
- /** MRCP application */
- mrcp_application_t *application;
- /** Demo framework */
- void *framework;
-
- /** Virtual run method */
- apt_bool_t (*run)(demo_application_t *application, const char *profile);
- /** Virtual app_message handler */
- apt_bool_t (*handler)(demo_application_t *application, const mrcp_app_message_t *app_message);
-};
-
-
-/** Create demo synthesizer application */
-demo_application_t* demo_synth_application_create(apr_pool_t *pool);
-
-/** Create demo recognizer application */
-demo_application_t* demo_recog_application_create(apr_pool_t *pool);
-
-/** Create demo bypass media application */
-demo_application_t* demo_bypass_application_create(apr_pool_t *pool);
-
-/** Create demo resource discover application */
-demo_application_t* demo_discover_application_create(apr_pool_t *pool);
-
-
-APT_END_EXTERN_C
-
-#endif /* DEMO_APPLICATION_H */
+++ /dev/null
-/*
- * 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: demo_framework.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef DEMO_FRAMEWORK_H
-#define DEMO_FRAMEWORK_H
-
-/**
- * @file demo_framework.h
- * @brief Demo MRCP Application Framework
- */
-
-#include "mrcp_types.h"
-
-APT_BEGIN_EXTERN_C
-
-/** Opaque demo framework declaration */
-typedef struct demo_framework_t demo_framework_t;
-
-/**
- * Create demo framework.
- */
-demo_framework_t* demo_framework_create(apt_dir_layout_t *dir_layout);
-
-/**
- * Run demo application.
- * @param framework the framework to run application for
- * @param app_name the name of the application to run
- * @param profile_name the name of the profile to use
- */
-apt_bool_t demo_framework_app_run(demo_framework_t *framework, const char *app_name, const char *profile_name);
-
-/**
- * Destroy demo framework.
- * @param framework the framework to destroy
- */
-apt_bool_t demo_framework_destroy(demo_framework_t *framework);
-
-APT_END_EXTERN_C
-
-#endif /* DEMO_FRAMEWORK_H */
+++ /dev/null
-/*
- * 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: demo_util.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#ifndef DEMO_UTIL_H
-#define DEMO_UTIL_H
-
-/**
- * @file demo_util.h
- * @brief Demo MRCP Utilities
- */
-
-#include "mrcp_application.h"
-
-APT_BEGIN_EXTERN_C
-
-/** Create demo MRCP message (SPEAK request) */
-mrcp_message_t* demo_speak_message_create(mrcp_session_t *session, mrcp_channel_t *channel, const apt_dir_layout_t *dir_layout);
-
-/** Create demo MRCP message (DEFINE-GRAMMAR request) */
-mrcp_message_t* demo_define_grammar_message_create(mrcp_session_t *session, mrcp_channel_t *channel, const apt_dir_layout_t *dir_layout);
-/** Create demo MRCP message (RECOGNIZE request) */
-mrcp_message_t* demo_recognize_message_create(mrcp_session_t *session, mrcp_channel_t *channel, const apt_dir_layout_t *dir_layout);
-
-/** Create demo RTP termination descriptor */
-mpf_rtp_termination_descriptor_t* demo_rtp_descriptor_create(apr_pool_t *pool);
-
-APT_END_EXTERN_C
-
-#endif /* DEMO_UTIL_H */
+++ /dev/null
-/*
- * 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: demo_bypass_application.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-/*
- * Demo synthesizer scenario (client stack stays out of media path).
- * C -> S: SIP INVITE or RTPS SETUP (add synthesizer channel)
- * S -> C: SIP OK or RTPS OK
- * C -> S: MRCP SPEAK
- * S -> C: MRCP IN-PROGRESS
- * S -> X: RTP Start Transmission (RTP stream is sent directly to external endpoint bypassing client stack)
- * S -> C: MRCP SPEAK-COMPLETE
- * S -> X: RTP Stop Transmission
- * C -> S: SIP INVITE or RTPS SETUP (optionally remove synthesizer channel)
- * S -> C: SIP OK or RTPS OK
- * C -> S: SIP BYE or RTPS TEARDOWN
- * S -> C: SIP OK or RTPS OK
- */
-
-#include "demo_application.h"
-#include "demo_util.h"
-#include "mrcp_message.h"
-#include "mrcp_generic_header.h"
-#include "mrcp_synth_header.h"
-#include "mrcp_synth_resource.h"
-#include "apt_log.h"
-
-typedef struct demo_app_channel_t demo_app_channel_t;
-
-/** Declaration of synthesizer application channel */
-struct demo_app_channel_t {
- /** MRCP control channel */
- mrcp_channel_t *channel;
-};
-
-/** Declaration of demo application methods */
-static apt_bool_t demo_application_run(demo_application_t *demo_application, const char *profile);
-static apt_bool_t demo_application_handler(demo_application_t *application, const mrcp_app_message_t *app_message);
-
-static apt_bool_t demo_application_on_session_update(mrcp_application_t *application, mrcp_session_t *session, mrcp_sig_status_code_e status);
-static apt_bool_t demo_application_on_session_terminate(mrcp_application_t *application, mrcp_session_t *session, mrcp_sig_status_code_e status);
-static apt_bool_t demo_application_on_channel_add(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_sig_status_code_e status);
-static apt_bool_t demo_application_on_channel_remove(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_sig_status_code_e status);
-static apt_bool_t demo_application_on_message_receive(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_message_t *message);
-
-static const mrcp_app_message_dispatcher_t demo_application_dispatcher = {
- demo_application_on_session_update,
- demo_application_on_session_terminate,
- demo_application_on_channel_add,
- demo_application_on_channel_remove,
- demo_application_on_message_receive,
- NULL /* demo_application_on_terminate_event */,
- NULL /* demo_application_on_resource_discover */
-};
-
-
-/** Create demo bypass media application */
-demo_application_t* demo_bypass_application_create(apr_pool_t *pool)
-{
- demo_application_t *demo_application = apr_palloc(pool,sizeof(demo_application_t));
- demo_application->application = NULL;
- demo_application->framework = NULL;
- demo_application->handler = demo_application_handler;
- demo_application->run = demo_application_run;
- return demo_application;
-}
-
-/** Create demo channel */
-static mrcp_channel_t* demo_application_channel_create(mrcp_session_t *session)
-{
- mrcp_channel_t *channel;
- apr_pool_t *pool = mrcp_application_session_pool_get(session);
- /* create channel */
- demo_app_channel_t *demo_channel = apr_palloc(pool,sizeof(demo_app_channel_t));
- mpf_rtp_termination_descriptor_t *rtp_descriptor = demo_rtp_descriptor_create(pool);
- channel = mrcp_application_channel_create(
- session, /* session, channel belongs to */
- MRCP_SYNTHESIZER_RESOURCE, /* MRCP resource identifier */
- NULL, /* no termination (not to use internal media processing) */
- rtp_descriptor, /* RTP descriptor, used to create RTP termination */
- demo_channel); /* object to associate */
- return channel;
-}
-
-
-/** Run demo scenario */
-static apt_bool_t demo_application_run(demo_application_t *demo_application, const char *profile)
-{
- mrcp_channel_t *channel;
- /* create session */
- mrcp_session_t *session = mrcp_application_session_create(demo_application->application,profile,NULL);
- if(!session) {
- return FALSE;
- }
-
- /* create channel and associate all the required data */
- channel = demo_application_channel_create(session);
- if(!channel) {
- mrcp_application_session_destroy(session);
- return FALSE;
- }
-
- /* add channel to session (send asynchronous request) */
- if(mrcp_application_channel_add(session,channel) != TRUE) {
- /* session and channel are still not referenced
- and both are allocated from session pool and will
- be freed with session destroy call */
- mrcp_application_session_destroy(session);
- return FALSE;
- }
-
- return TRUE;
-}
-
-/** Handle the messages sent from the MRCP client stack */
-static apt_bool_t demo_application_handler(demo_application_t *application, const mrcp_app_message_t *app_message)
-{
- /* app_message should be dispatched now,
- * the default dispatcher is used in demo. */
- return mrcp_application_message_dispatch(&demo_application_dispatcher,app_message);
-}
-
-/** Handle the responses sent to session update requests */
-static apt_bool_t demo_application_on_session_update(mrcp_application_t *application, mrcp_session_t *session, mrcp_sig_status_code_e status)
-{
- return TRUE;
-}
-
-/** Handle the responses sent to session terminate requests */
-static apt_bool_t demo_application_on_session_terminate(mrcp_application_t *application, mrcp_session_t *session, mrcp_sig_status_code_e status)
-{
- /* received response to session termination request,
- now it's safe to destroy no more referenced session */
- mrcp_application_session_destroy(session);
- return TRUE;
-}
-
-/** Handle the responses sent to channel add requests */
-static apt_bool_t demo_application_on_channel_add(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_sig_status_code_e status)
-{
- if(status == MRCP_SIG_STATUS_CODE_SUCCESS) {
- mpf_rtp_termination_descriptor_t *rtp_descriptor;
- mrcp_message_t *mrcp_message;
- const apt_dir_layout_t *dir_layout = mrcp_application_dir_layout_get(application);
- /* create and send SPEAK request */
- mrcp_message = demo_speak_message_create(session,channel,dir_layout);
- if(mrcp_message) {
- mrcp_application_message_send(session,channel,mrcp_message);
- }
- rtp_descriptor = mrcp_application_rtp_descriptor_get(channel);
- if(rtp_descriptor) {
- mpf_rtp_media_descriptor_t *local_media = rtp_descriptor->audio.local;
- mpf_rtp_media_descriptor_t *remote_media = rtp_descriptor->audio.remote;
- if(local_media && remote_media) {
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Media Attributes: L[%s/%d] R[%s/%d]",
- local_media->ip.buf,
- local_media->port,
- remote_media->ip.buf,
- remote_media->port);
- }
- }
- }
- else {
- /* error case, just terminate the demo */
- mrcp_application_session_terminate(session);
- }
- return TRUE;
-}
-
-/** Handle the responses sent to channel remove requests */
-static apt_bool_t demo_application_on_channel_remove(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_sig_status_code_e status)
-{
- /* terminate the demo */
- mrcp_application_session_terminate(session);
- return TRUE;
-}
-
-/** Handle the MRCP responses/events */
-static apt_bool_t demo_application_on_message_receive(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_message_t *message)
-{
- if(message->start_line.message_type == MRCP_MESSAGE_TYPE_RESPONSE) {
- /* received MRCP response */
- if(message->start_line.method_id == SYNTHESIZER_SPEAK) {
- /* received the response to SPEAK request,
- waiting for SPEAK-COMPLETE event */
- }
- else {
- /* received unexpected response */
- }
- }
- else if(message->start_line.message_type == MRCP_MESSAGE_TYPE_EVENT) {
- /* received MRCP event */
- if(message->start_line.method_id == SYNTHESIZER_SPEAK_COMPLETE) {
- /* received SPEAK-COMPLETE event, remove channel */
- mrcp_application_channel_remove(session,channel);
- }
- }
- return TRUE;
-}
+++ /dev/null
-/*
- * 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: demo_discover_application.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-/*
- * Demo resource discovery.
- * C -> S: SIP OPTIONS or RTPS DESCRIBE
- * S -> C: SIP OK or RTPS OK
- */
-
-#include "demo_application.h"
-#include "mrcp_session_descriptor.h"
-#include "mrcp_control_descriptor.h"
-#include "apt_log.h"
-
-
-/** Declaration of synthesizer application methods */
-static apt_bool_t discover_application_run(demo_application_t *demo_application, const char *profile);
-static apt_bool_t discover_application_handler(demo_application_t *application, const mrcp_app_message_t *app_message);
-
-/** Declaration of application message handlers */
-static apt_bool_t discover_application_on_session_terminate(mrcp_application_t *application, mrcp_session_t *session, mrcp_sig_status_code_e status);
-static apt_bool_t discover_application_on_resource_discover(mrcp_application_t *application, mrcp_session_t *session, mrcp_session_descriptor_t *descriptor, mrcp_sig_status_code_e status);
-
-static const mrcp_app_message_dispatcher_t discover_application_dispatcher = {
- NULL,
- discover_application_on_session_terminate,
- NULL,
- NULL,
- NULL,
- NULL,
- discover_application_on_resource_discover
-};
-
-/** Create demo resource discover application */
-demo_application_t* demo_discover_application_create(apr_pool_t *pool)
-{
- demo_application_t *discover_application = apr_palloc(pool,sizeof(demo_application_t));
- discover_application->application = NULL;
- discover_application->framework = NULL;
- discover_application->handler = discover_application_handler;
- discover_application->run = discover_application_run;
- return discover_application;
-}
-
-/** Run demo resource discover scenario */
-static apt_bool_t discover_application_run(demo_application_t *demo_application, const char *profile)
-{
- /* create session */
- mrcp_session_t *session = mrcp_application_session_create(demo_application->application,profile,NULL);
- if(!session) {
- return FALSE;
- }
-
- /* send resource discover request */
- if(mrcp_application_resource_discover(session) != TRUE) {
- mrcp_application_session_destroy(session);
- return FALSE;
- }
-
- return TRUE;
-}
-
-/** Handle the messages sent from the MRCP client stack */
-static apt_bool_t discover_application_handler(demo_application_t *application, const mrcp_app_message_t *app_message)
-{
- /* app_message should be dispatched now,
- * the default dispatcher is used in demo. */
- return mrcp_application_message_dispatch(&discover_application_dispatcher,app_message);
-}
-
-/** Handle the responses sent to session terminate requests */
-static apt_bool_t discover_application_on_session_terminate(mrcp_application_t *application, mrcp_session_t *session, mrcp_sig_status_code_e status)
-{
- /* received response to session termination request,
- now it's safe to destroy no more referenced session */
- mrcp_application_session_destroy(session);
- return TRUE;
-}
-
-/** Handle the responses sent to resource discover requests */
-static apt_bool_t discover_application_on_resource_discover(mrcp_application_t *application, mrcp_session_t *session, mrcp_session_descriptor_t *descriptor, mrcp_sig_status_code_e status)
-{
- if(descriptor && status == MRCP_SIG_STATUS_CODE_SUCCESS) {
- int i;
- int count = descriptor->control_media_arr->nelts;
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"On Resource Discover [%d]", count);
-
- for(i = 0; i < count; i++) {
- mrcp_control_descriptor_t *control_media = mrcp_session_control_media_get(descriptor,i);
- if(control_media) {
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"[%d] - %s", i,control_media->resource_name.buf);
- }
- }
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Failed to Discover Resources");
- }
-
- mrcp_application_session_terminate(session);
- return TRUE;
-}
+++ /dev/null
-/*
- * 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: demo_framework.c 2233 2014-11-12 01:34:59Z achaloyan@gmail.com $
- */
-
-#include <apr_hash.h>
-#include "demo_framework.h"
-#include "demo_application.h"
-#include "unimrcp_client.h"
-#include "apt_consumer_task.h"
-#include "apt_log.h"
-
-#define FRAMEWORK_TASK_NAME "Framework Agent"
-
-#define MAX_APP_NAME_LENGTH 16
-#define MAX_PROFILE_NAME_LENGTH 16
-
-/** Demo framework */
-struct demo_framework_t {
- /** MRCP client stack instance */
- mrcp_client_t *client;
- /** Message processing task */
- apt_consumer_task_t *task;
- /** Table of demo applications */
- apr_hash_t *application_table;
- /** Memory to allocate memory from */
- apr_pool_t *pool;
-};
-
-typedef struct framework_task_data_t framework_task_data_t;
-struct framework_task_data_t {
- char app_name[MAX_APP_NAME_LENGTH];
- char profile_name[MAX_PROFILE_NAME_LENGTH];
- demo_application_t *demo_application;
- const mrcp_app_message_t *app_message;
-};
-
-typedef enum {
- DEMO_APPLICATION_MSG_ID,
- DEMO_CONSOLE_MSG_ID
-} framework_msg_type_e;
-
-static apt_bool_t demo_framework_message_handler(const mrcp_app_message_t *app_message);
-static apt_bool_t demo_framework_consumer_task_create(demo_framework_t *framework);
-static apt_bool_t demo_framework_app_register(demo_framework_t *framework, demo_application_t *demo_application, const char *name);
-
-/** Create demo framework */
-demo_framework_t* demo_framework_create(apt_dir_layout_t *dir_layout)
-{
- demo_framework_t *framework = NULL;
- mrcp_client_t *client = unimrcp_client_create(dir_layout);
- if(client) {
- demo_application_t *demo_application;
- apr_pool_t *pool = mrcp_client_memory_pool_get(client);
- /* create demo framework */
- framework = apr_palloc(pool,sizeof(demo_framework_t));
- framework->pool = pool;
- framework->client = client;
- framework->application_table = apr_hash_make(pool);
-
- /* create demo synthesizer application */
- demo_application = demo_synth_application_create(framework->pool);
- if(demo_application) {
- demo_framework_app_register(framework,demo_application,"synth");
- }
-
- /* create demo recognizer application */
- demo_application = demo_recog_application_create(framework->pool);
- if(demo_application) {
- demo_framework_app_register(framework,demo_application,"recog");
- }
-
- /* create demo bypass media application */
- demo_application = demo_bypass_application_create(framework->pool);
- if(demo_application) {
- demo_framework_app_register(framework,demo_application,"bypass");
- }
-
- /* create demo resource discover application */
- demo_application = demo_discover_application_create(framework->pool);
- if(demo_application) {
- demo_framework_app_register(framework,demo_application,"discover");
- }
-
- demo_framework_consumer_task_create(framework);
-
- if(framework->task) {
- apt_task_t *task = apt_consumer_task_base_get(framework->task);
- apt_task_start(task);
- }
-
- /* start client stack */
- mrcp_client_start(client);
- }
-
- return framework;
-}
-
-/** Run demo application */
-apt_bool_t demo_framework_app_run(demo_framework_t *framework, const char *app_name, const char *profile_name)
-{
- apt_task_t *task = apt_consumer_task_base_get(framework->task);
- apt_task_msg_t *task_msg = apt_task_msg_get(task);
- if(task_msg) {
- framework_task_data_t *framework_task_data = (framework_task_data_t*)task_msg->data;
- task_msg->type = TASK_MSG_USER;
- task_msg->sub_type = DEMO_CONSOLE_MSG_ID;
- strncpy(framework_task_data->app_name,app_name,sizeof(framework_task_data->app_name)-1);
- strncpy(framework_task_data->profile_name,profile_name,sizeof(framework_task_data->profile_name)-1);
- framework_task_data->app_message = NULL;
- framework_task_data->demo_application = NULL;
- apt_task_msg_signal(task,task_msg);
- }
- return TRUE;
-}
-
-/** Destroy demo framework */
-apt_bool_t demo_framework_destroy(demo_framework_t *framework)
-{
- if(!framework) {
- return FALSE;
- }
-
- if(framework->task) {
- apt_task_t *task = apt_consumer_task_base_get(framework->task);
- apt_task_terminate(task,TRUE);
- apt_task_destroy(task);
- framework->task = NULL;
- }
-
- mrcp_client_shutdown(framework->client);
- return mrcp_client_destroy(framework->client);
-}
-
-static apt_bool_t demo_framework_app_register(demo_framework_t *framework, demo_application_t *demo_application, const char *name)
-{
- apr_hash_set(framework->application_table,name,APR_HASH_KEY_STRING,demo_application);
- demo_application->framework = framework;
- demo_application->application = mrcp_application_create(
- demo_framework_message_handler,
- demo_application,
- framework->pool);
- return mrcp_client_application_register(framework->client,demo_application->application,name);
-}
-
-static void demo_framework_on_start_complete(apt_task_t *task)
-{
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Run Demo Framework");
-}
-
-static apt_bool_t demo_framework_console_msg_process(demo_framework_t *framework, const char *app_name, const char *profile_name)
-{
- demo_application_t *demo_application = apr_hash_get(framework->application_table,app_name,APR_HASH_KEY_STRING);
- if(!demo_application) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"No Such Demo Application [%s]",app_name);
- return FALSE;
- }
-
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Run Demo Application Scenario [%s]",app_name);
- return demo_application->run(demo_application,profile_name);
-}
-
-static apt_bool_t demo_framework_msg_process(apt_task_t *task, apt_task_msg_t *msg)
-{
- if(msg->type == TASK_MSG_USER) {
- framework_task_data_t *data = (framework_task_data_t*)msg->data;
- switch(msg->sub_type) {
- case DEMO_APPLICATION_MSG_ID:
- {
- data->demo_application->handler(data->demo_application,data->app_message);
- break;
- }
- case DEMO_CONSOLE_MSG_ID:
- {
- apt_consumer_task_t *consumer_task = apt_task_object_get(task);
- demo_framework_t *framework = apt_consumer_task_object_get(consumer_task);
- demo_framework_console_msg_process(framework,data->app_name,data->profile_name);
- break;
- }
- }
- }
- return TRUE;
-}
-
-static apt_bool_t demo_framework_consumer_task_create(demo_framework_t *framework)
-{
- apt_task_t *task;
- apt_task_vtable_t *vtable;
- apt_task_msg_pool_t *msg_pool;
-
- msg_pool = apt_task_msg_pool_create_dynamic(sizeof(framework_task_data_t),framework->pool);
- framework->task = apt_consumer_task_create(framework,msg_pool,framework->pool);
- if(!framework->task) {
- return FALSE;
- }
- task = apt_consumer_task_base_get(framework->task);
- apt_task_name_set(task,FRAMEWORK_TASK_NAME);
- vtable = apt_consumer_task_vtable_get(framework->task);
- if(vtable) {
- vtable->process_msg = demo_framework_msg_process;
- vtable->on_start_complete = demo_framework_on_start_complete;
- }
-
- return TRUE;
-}
-
-/** Callback is called from MRCP client stack (task) context.
- * Signal app_message to the main consumer task of the demo framework
- * for further processing (see demo_framework_msg_process).
- */
-static apt_bool_t demo_framework_message_handler(const mrcp_app_message_t *app_message)
-{
- demo_application_t *demo_application;
- if(!app_message->application) {
- return FALSE;
- }
- demo_application = mrcp_application_object_get(app_message->application);
- if(demo_application && demo_application->framework) {
- demo_framework_t *framework = demo_application->framework;
- apt_task_t *task = apt_consumer_task_base_get(framework->task);
- apt_task_msg_t *task_msg = apt_task_msg_get(task);
- if(task_msg) {
- framework_task_data_t *framework_task_data = (framework_task_data_t*)task_msg->data;
- task_msg->type = TASK_MSG_USER;
- task_msg->sub_type = DEMO_APPLICATION_MSG_ID;
- framework_task_data->app_message = app_message;
- framework_task_data->demo_application = demo_application;
- apt_task_msg_signal(task,task_msg);
- }
- }
- return TRUE;
-}
+++ /dev/null
-/*
- * 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: demo_recog_application.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-/*
- * Demo recognizer scenario.
- * C -> S: SIP INVITE or RTPS SETUP (add recognizer channel)
- * S -> C: SIP OK or RTPS OK
- * C -> S: MRCP RECOGNIZE
- * S -> C: MRCP IN-PROGRESS
- * C -> S: RTP Start Transmission
- * S -> C: MRCP START-OF-INPUT
- * S -> C: MRCP RECOGNITION-COMPLETE
- * C -> S: RTP Stop Transmission
- * C -> S: SIP INVITE or RTPS SETUP (optionally remove recognizer channel)
- * S -> C: SIP OK or RTPS OK
- * C -> S: SIP BYE or RTPS TEARDOWN
- * S -> C: SIP OK or RTPS OK
- */
-
-#include "demo_application.h"
-#include "demo_util.h"
-#include "mrcp_message.h"
-#include "mrcp_generic_header.h"
-#include "mrcp_recog_header.h"
-#include "mrcp_recog_resource.h"
-#include "apt_nlsml_doc.h"
-#include "apt_log.h"
-
-typedef struct recog_app_channel_t recog_app_channel_t;
-
-/** Declaration of recognizer application channel */
-struct recog_app_channel_t {
- /** MRCP control channel */
- mrcp_channel_t *channel;
-
- /** Streaming is in-progress */
- apt_bool_t streaming;
- /** File to read audio stream from */
- FILE *audio_in;
- /** Estimated time to complete (used if no audio_in available) */
- apr_size_t time_to_complete;
-};
-
-/** Declaration of recognizer application methods */
-static apt_bool_t recog_application_run(demo_application_t *demo_application, const char *profile);
-static apt_bool_t recog_application_handler(demo_application_t *application, const mrcp_app_message_t *app_message);
-
-/** Declaration of application message handlers */
-static apt_bool_t recog_application_on_session_update(mrcp_application_t *application, mrcp_session_t *session, mrcp_sig_status_code_e status);
-static apt_bool_t recog_application_on_session_terminate(mrcp_application_t *application, mrcp_session_t *session, mrcp_sig_status_code_e status);
-static apt_bool_t recog_application_on_channel_add(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_sig_status_code_e status);
-static apt_bool_t recog_application_on_channel_remove(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_sig_status_code_e status);
-static apt_bool_t recog_application_on_message_receive(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_message_t *message);
-
-static const mrcp_app_message_dispatcher_t recog_application_dispatcher = {
- recog_application_on_session_update,
- recog_application_on_session_terminate,
- recog_application_on_channel_add,
- recog_application_on_channel_remove,
- recog_application_on_message_receive,
- NULL /* recog_application_on_terminate_event */,
- NULL /* recog_application_on_resource_discover */
-};
-
-/** Declaration of recognizer audio stream methods */
-static apt_bool_t recog_app_stream_destroy(mpf_audio_stream_t *stream);
-static apt_bool_t recog_app_stream_open(mpf_audio_stream_t *stream, mpf_codec_t *codec);
-static apt_bool_t recog_app_stream_close(mpf_audio_stream_t *stream);
-static apt_bool_t recog_app_stream_read(mpf_audio_stream_t *stream, mpf_frame_t *frame);
-
-static const mpf_audio_stream_vtable_t audio_stream_vtable = {
- recog_app_stream_destroy,
- recog_app_stream_open,
- recog_app_stream_close,
- recog_app_stream_read,
- NULL,
- NULL,
- NULL,
- NULL
-};
-
-
-/** Create demo recognizer application */
-demo_application_t* demo_recog_application_create(apr_pool_t *pool)
-{
- demo_application_t *recog_application = apr_palloc(pool,sizeof(demo_application_t));
- recog_application->application = NULL;
- recog_application->framework = NULL;
- recog_application->handler = recog_application_handler;
- recog_application->run = recog_application_run;
- return recog_application;
-}
-
-/** Create demo recognizer channel */
-static mrcp_channel_t* recog_application_channel_create(mrcp_session_t *session)
-{
- mrcp_channel_t *channel;
- mpf_termination_t *termination;
- mpf_stream_capabilities_t *capabilities;
- apr_pool_t *pool = mrcp_application_session_pool_get(session);
-
- /* create channel */
- recog_app_channel_t *recog_channel = apr_palloc(pool,sizeof(recog_app_channel_t));
- recog_channel->streaming = FALSE;
- recog_channel->audio_in = NULL;
- recog_channel->time_to_complete = 0;
-
- /* create source stream capabilities */
- capabilities = mpf_source_stream_capabilities_create(pool);
-
- /* add codec capabilities (Linear PCM) */
- mpf_codec_capabilities_add(
- &capabilities->codecs,
- MPF_SAMPLE_RATE_8000 | MPF_SAMPLE_RATE_16000,
- "LPCM");
-
-#if 0
- /* more capabilities can be added or replaced */
- mpf_codec_capabilities_add(
- &capabilities->codecs,
- MPF_SAMPLE_RATE_8000 | MPF_SAMPLE_RATE_16000,
- "PCMU");
-#endif
-
- termination = mrcp_application_audio_termination_create(
- session, /* session, termination belongs to */
- &audio_stream_vtable, /* virtual methods table of audio stream */
- capabilities, /* capabilities of audio stream */
- recog_channel); /* object to associate */
-
- channel = mrcp_application_channel_create(
- session, /* session, channel belongs to */
- MRCP_RECOGNIZER_RESOURCE, /* MRCP resource identifier */
- termination, /* media termination, used to terminate audio stream */
- NULL, /* RTP descriptor, used to create RTP termination (NULL by default) */
- recog_channel); /* object to associate */
- return channel;
-}
-
-/** Run demo recognizer scenario */
-static apt_bool_t recog_application_run(demo_application_t *demo_application, const char *profile)
-{
- mrcp_channel_t *channel;
- /* create session */
- mrcp_session_t *session = mrcp_application_session_create(demo_application->application,profile,NULL);
- if(!session) {
- return FALSE;
- }
-
- /* create channel and associate all the required data */
- channel = recog_application_channel_create(session);
- if(!channel) {
- mrcp_application_session_destroy(session);
- return FALSE;
- }
-
- /* add channel to session (send asynchronous request) */
- if(mrcp_application_channel_add(session,channel) != TRUE) {
- /* session and channel are still not referenced
- and both are allocated from session pool and will
- be freed with session destroy call */
- mrcp_application_session_destroy(session);
- return FALSE;
- }
-
- return TRUE;
-}
-
-/** Handle the messages sent from the MRCP client stack */
-static apt_bool_t recog_application_handler(demo_application_t *application, const mrcp_app_message_t *app_message)
-{
- /* app_message should be dispatched now,
- * the default dispatcher is used in demo. */
- return mrcp_application_message_dispatch(&recog_application_dispatcher,app_message);
-}
-
-/** Handle the responses sent to session update requests */
-static apt_bool_t recog_application_on_session_update(mrcp_application_t *application, mrcp_session_t *session, mrcp_sig_status_code_e status)
-{
- /* not used in demo */
- return TRUE;
-}
-
-/** Handle the responses sent to session terminate requests */
-static apt_bool_t recog_application_on_session_terminate(mrcp_application_t *application, mrcp_session_t *session, mrcp_sig_status_code_e status)
-{
- /* received response to session termination request,
- now it's safe to destroy no more referenced session */
- mrcp_application_session_destroy(session);
- return TRUE;
-}
-
-/** Handle the responses sent to channel add requests */
-static apt_bool_t recog_application_on_channel_add(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_sig_status_code_e status)
-{
- if(status == MRCP_SIG_STATUS_CODE_SUCCESS) {
- mrcp_message_t *mrcp_message;
- const apt_dir_layout_t *dir_layout = mrcp_application_dir_layout_get(application);
- /* create and send DEFINE-GRAMMAR request */
- mrcp_message = demo_define_grammar_message_create(session,channel,dir_layout);
- if(mrcp_message) {
- mrcp_application_message_send(session,channel,mrcp_message);
- }
- }
- else {
- /* error case, just terminate the demo */
- mrcp_application_session_terminate(session);
- }
- return TRUE;
-}
-
-static apt_bool_t recog_application_on_channel_remove(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_sig_status_code_e status)
-{
- recog_app_channel_t *recog_channel = mrcp_application_channel_object_get(channel);
-
- /* terminate the demo */
- mrcp_application_session_terminate(session);
-
- if(recog_channel) {
- FILE *audio_in = recog_channel->audio_in;
- if(audio_in) {
- recog_channel->audio_in = NULL;
- fclose(audio_in);
- }
- }
- return TRUE;
-}
-
-/** Handle the DEFINE-GRAMMAR responses */
-static apt_bool_t recog_application_on_define_grammar(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel)
-{
- mrcp_message_t *mrcp_message;
- recog_app_channel_t *recog_channel = mrcp_application_channel_object_get(channel);
- const apt_dir_layout_t *dir_layout = mrcp_application_dir_layout_get(application);
-
- const mpf_codec_descriptor_t *descriptor = mrcp_application_source_descriptor_get(channel);
- if(!descriptor) {
- /* terminate the demo */
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Get Media Source Descriptor");
- return mrcp_application_session_terminate(session);
- }
-
- /* create and send RECOGNIZE request */
- mrcp_message = demo_recognize_message_create(session,channel,dir_layout);
- if(mrcp_message) {
- mrcp_application_message_send(session,channel,mrcp_message);
- }
-
- if(recog_channel) {
- apr_pool_t *pool = mrcp_application_session_pool_get(session);
- char *file_name = apr_psprintf(pool,"one-%dkHz.pcm",descriptor->sampling_rate/1000);
- char *file_path = apt_datadir_filepath_get(dir_layout,file_name,pool);
- if(file_path) {
- recog_channel->audio_in = fopen(file_path,"rb");
- if(recog_channel->audio_in) {
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set [%s] as Speech Source",file_path);
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Cannot Find [%s]",file_path);
- /* set some estimated time to complete */
- recog_channel->time_to_complete = 5000; // 5 sec
- }
- }
- }
- return TRUE;
-}
-
-static apt_bool_t recog_application_on_message_receive(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_message_t *message)
-{
- recog_app_channel_t *recog_channel = mrcp_application_channel_object_get(channel);
- if(message->start_line.message_type == MRCP_MESSAGE_TYPE_RESPONSE) {
- /* received MRCP response */
- if(message->start_line.method_id == RECOGNIZER_DEFINE_GRAMMAR) {
- /* received the response to DEFINE-GRAMMAR request */
- if(message->start_line.request_state == MRCP_REQUEST_STATE_COMPLETE) {
- recog_application_on_define_grammar(application,session,channel);
- }
- else {
- /* received unexpected response, remove channel */
- mrcp_application_channel_remove(session,channel);
- }
- }
- else if(message->start_line.method_id == RECOGNIZER_RECOGNIZE) {
- /* received the response to RECOGNIZE request */
- if(message->start_line.request_state == MRCP_REQUEST_STATE_INPROGRESS) {
- /* start to stream the speech to recognize */
- if(recog_channel) {
- recog_channel->streaming = TRUE;
- }
- }
- else {
- /* received unexpected response, remove channel */
- mrcp_application_channel_remove(session,channel);
- }
- }
- else {
- /* received unexpected response */
- }
- }
- else if(message->start_line.message_type == MRCP_MESSAGE_TYPE_EVENT) {
- if(message->start_line.method_id == RECOGNIZER_RECOGNITION_COMPLETE) {
- nlsml_result_t *result = nlsml_result_parse(message->body.buf, message->body.length, message->pool);
- if(result) {
- nlsml_result_trace(result, message->pool);
- }
-
- if(recog_channel) {
- recog_channel->streaming = FALSE;
- }
- mrcp_application_channel_remove(session,channel);
- }
- else if(message->start_line.method_id == RECOGNIZER_START_OF_INPUT) {
- /* received start-of-input, do whatever you need here */
- }
- }
- return TRUE;
-}
-
-/** Callback is called from MPF engine context to destroy any additional data associated with audio stream */
-static apt_bool_t recog_app_stream_destroy(mpf_audio_stream_t *stream)
-{
- return TRUE;
-}
-
-/** Callback is called from MPF engine context to perform application stream specific action before open */
-static apt_bool_t recog_app_stream_open(mpf_audio_stream_t *stream, mpf_codec_t *codec)
-{
- return TRUE;
-}
-
-/** Callback is called from MPF engine context to perform application stream specific action after close */
-static apt_bool_t recog_app_stream_close(mpf_audio_stream_t *stream)
-{
- return TRUE;
-}
-
-/** Callback is called from MPF engine context to read new frame */
-static apt_bool_t recog_app_stream_read(mpf_audio_stream_t *stream, mpf_frame_t *frame)
-{
- recog_app_channel_t *recog_channel = stream->obj;
- if(recog_channel && recog_channel->streaming == TRUE) {
- if(recog_channel->audio_in) {
- if(fread(frame->codec_frame.buffer,1,frame->codec_frame.size,recog_channel->audio_in) == frame->codec_frame.size) {
- /* normal read */
- frame->type |= MEDIA_FRAME_TYPE_AUDIO;
- }
- else {
- /* file is over */
- recog_channel->streaming = FALSE;
- }
- }
- else {
- /* fill with silence in case no file available */
- if(recog_channel->time_to_complete >= CODEC_FRAME_TIME_BASE) {
- frame->type |= MEDIA_FRAME_TYPE_AUDIO;
- memset(frame->codec_frame.buffer,0,frame->codec_frame.size);
- recog_channel->time_to_complete -= CODEC_FRAME_TIME_BASE;
- }
- else {
- recog_channel->streaming = FALSE;
- }
- }
- }
- return TRUE;
-}
+++ /dev/null
-/*
- * 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: demo_synth_application.c 2193 2014-10-08 03:44:33Z achaloyan@gmail.com $
- */
-
-/*
- * Demo synthesizer scenario.
- * C -> S: SIP INVITE or RTPS SETUP (add synthesizer channel)
- * S -> C: SIP OK or RTPS OK
- * C -> S: MRCP SPEAK
- * S -> C: MRCP IN-PROGRESS
- * S -> C: RTP Start Transmission
- * S -> C: MRCP SPEAK-COMPLETE
- * S -> C: RTP Stop Transmission
- * C -> S: SIP INVITE or RTPS SETUP (optionally remove synthesizer channel)
- * S -> C: SIP OK or RTPS OK
- * C -> S: SIP BYE or RTPS TEARDOWN
- * S -> C: SIP OK or RTPS OK
- */
-
-#include "demo_application.h"
-#include "demo_util.h"
-#include "mrcp_message.h"
-#include "mrcp_generic_header.h"
-#include "mrcp_synth_header.h"
-#include "mrcp_synth_resource.h"
-#include "apt_log.h"
-
-typedef struct synth_app_channel_t synth_app_channel_t;
-
-/** Declaration of synthesizer application channel */
-struct synth_app_channel_t {
- /** MRCP control channel */
- mrcp_channel_t *channel;
- /** File to write audio stream to */
- FILE *audio_out;
-};
-
-/** Declaration of synthesizer application methods */
-static apt_bool_t synth_application_run(demo_application_t *demo_application, const char *profile);
-static apt_bool_t synth_application_handler(demo_application_t *application, const mrcp_app_message_t *app_message);
-
-/** Declaration of application message handlers */
-static apt_bool_t synth_application_on_session_update(mrcp_application_t *application, mrcp_session_t *session, mrcp_sig_status_code_e status);
-static apt_bool_t synth_application_on_session_terminate(mrcp_application_t *application, mrcp_session_t *session, mrcp_sig_status_code_e status);
-static apt_bool_t synth_application_on_channel_add(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_sig_status_code_e status);
-static apt_bool_t synth_application_on_channel_remove(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_sig_status_code_e status);
-static apt_bool_t synth_application_on_message_receive(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_message_t *message);
-
-static const mrcp_app_message_dispatcher_t synth_application_dispatcher = {
- synth_application_on_session_update,
- synth_application_on_session_terminate,
- synth_application_on_channel_add,
- synth_application_on_channel_remove,
- synth_application_on_message_receive,
- NULL /* synth_application_on_terminate_event */,
- NULL /* synth_application_on_resource_discover */
-};
-
-/** Declaration of synthesizer audio stream methods */
-static apt_bool_t synth_app_stream_destroy(mpf_audio_stream_t *stream);
-static apt_bool_t synth_app_stream_open(mpf_audio_stream_t *stream, mpf_codec_t *codec);
-static apt_bool_t synth_app_stream_close(mpf_audio_stream_t *stream);
-static apt_bool_t synth_app_stream_write(mpf_audio_stream_t *stream, const mpf_frame_t *frame);
-
-static const mpf_audio_stream_vtable_t audio_stream_vtable = {
- synth_app_stream_destroy,
- NULL,
- NULL,
- NULL,
- synth_app_stream_open,
- synth_app_stream_close,
- synth_app_stream_write,
- NULL
-};
-
-
-/** Create demo synthesizer application */
-demo_application_t* demo_synth_application_create(apr_pool_t *pool)
-{
- demo_application_t *synth_application = apr_palloc(pool,sizeof(demo_application_t));
- synth_application->application = NULL;
- synth_application->framework = NULL;
- synth_application->handler = synth_application_handler;
- synth_application->run = synth_application_run;
- return synth_application;
-}
-
-/** Create demo synthesizer channel */
-static mrcp_channel_t* synth_application_channel_create(mrcp_session_t *session)
-{
- mrcp_channel_t *channel;
- mpf_termination_t *termination;
- mpf_stream_capabilities_t *capabilities;
- apr_pool_t *pool = mrcp_application_session_pool_get(session);
-
- /* create channel */
- synth_app_channel_t *synth_channel = apr_palloc(pool,sizeof(synth_app_channel_t));
- synth_channel->audio_out = NULL;
-
- /* create sink stream capabilities */
- capabilities = mpf_sink_stream_capabilities_create(pool);
-
- /* add codec capabilities (Linear PCM) */
- mpf_codec_capabilities_add(
- &capabilities->codecs,
- MPF_SAMPLE_RATE_8000 | MPF_SAMPLE_RATE_16000,
- "LPCM");
-
-#if 0
- /* more capabilities can be added or replaced */
- mpf_codec_capabilities_add(
- &capabilities->codecs,
- MPF_SAMPLE_RATE_8000 | MPF_SAMPLE_RATE_16000,
- "PCMU");
-#endif
-
- termination = mrcp_application_audio_termination_create(
- session, /* session, termination belongs to */
- &audio_stream_vtable, /* virtual methods table of audio stream */
- capabilities, /* capabilities of audio stream */
- synth_channel); /* object to associate */
-
- channel = mrcp_application_channel_create(
- session, /* session, channel belongs to */
- MRCP_SYNTHESIZER_RESOURCE, /* MRCP resource identifier */
- termination, /* media termination, used to terminate audio stream */
- NULL, /* RTP descriptor, used to create RTP termination (NULL by default) */
- synth_channel); /* object to associate */
- return channel;
-}
-
-
-/** Run demo synthesizer scenario */
-static apt_bool_t synth_application_run(demo_application_t *demo_application, const char *profile)
-{
- mrcp_channel_t *channel;
- /* create session */
- mrcp_session_t *session = mrcp_application_session_create(demo_application->application,profile,NULL);
- if(!session) {
- return FALSE;
- }
-
- /* create channel and associate all the required data */
- channel = synth_application_channel_create(session);
- if(!channel) {
- mrcp_application_session_destroy(session);
- return FALSE;
- }
-
- /* add channel to session (send asynchronous request) */
- if(mrcp_application_channel_add(session,channel) != TRUE) {
- /* session and channel are still not referenced
- and both are allocated from session pool and will
- be freed with session destroy call */
- mrcp_application_session_destroy(session);
- return FALSE;
- }
-
- return TRUE;
-}
-
-/** Handle the messages sent from the MRCP client stack */
-static apt_bool_t synth_application_handler(demo_application_t *application, const mrcp_app_message_t *app_message)
-{
- /* app_message should be dispatched now,
- * the default dispatcher is used in demo. */
- return mrcp_application_message_dispatch(&synth_application_dispatcher,app_message);
-}
-
-/** Handle the responses sent to session update requests */
-static apt_bool_t synth_application_on_session_update(mrcp_application_t *application, mrcp_session_t *session, mrcp_sig_status_code_e status)
-{
- /* not used in demo */
- return TRUE;
-}
-
-/** Handle the responses sent to session terminate requests */
-static apt_bool_t synth_application_on_session_terminate(mrcp_application_t *application, mrcp_session_t *session, mrcp_sig_status_code_e status)
-{
- /* received response to session termination request,
- now it's safe to destroy no more referenced session */
- mrcp_application_session_destroy(session);
- return TRUE;
-}
-
-/** Handle the responses sent to channel add requests */
-static apt_bool_t synth_application_on_channel_add(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_sig_status_code_e status)
-{
- if(status == MRCP_SIG_STATUS_CODE_SUCCESS) {
- mrcp_message_t *mrcp_message;
- synth_app_channel_t *synth_channel = mrcp_application_channel_object_get(channel);
- apr_pool_t *pool = mrcp_application_session_pool_get(session);
- const apt_dir_layout_t *dir_layout = mrcp_application_dir_layout_get(application);
- const mpf_codec_descriptor_t *descriptor = mrcp_application_sink_descriptor_get(channel);
- if(!descriptor) {
- /* terminate the demo */
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Get Media Sink Descriptor");
- return mrcp_application_session_terminate(session);
- }
-
- /* create and send SPEAK request */
- mrcp_message = demo_speak_message_create(session,channel,dir_layout);
- if(mrcp_message) {
- mrcp_application_message_send(session,channel,mrcp_message);
- }
-
- if(synth_channel) {
- const apt_str_t *id = mrcp_application_session_id_get(session);
- char *file_name = apr_psprintf(pool,"synth-%dkHz-%s.pcm",
- descriptor->sampling_rate/1000,
- id->buf);
- char *file_path = apt_vardir_filepath_get(dir_layout,file_name,pool);
- if(file_path) {
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Open Speech Output File [%s] for Writing",file_path);
- synth_channel->audio_out = fopen(file_path,"wb");
- if(!synth_channel->audio_out) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Open Utterance Output File [%s] for Writing",file_path);
- }
- }
- }
- }
- else {
- /* error case, just terminate the demo */
- mrcp_application_session_terminate(session);
- }
- return TRUE;
-}
-
-/** Handle the responses sent to channel remove requests */
-static apt_bool_t synth_application_on_channel_remove(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_sig_status_code_e status)
-{
- synth_app_channel_t *synth_channel = mrcp_application_channel_object_get(channel);
-
- /* terminate the demo */
- mrcp_application_session_terminate(session);
-
- if(synth_channel) {
- FILE *audio_out = synth_channel->audio_out;
- if(audio_out) {
- synth_channel->audio_out = NULL;
- fclose(audio_out);
- }
- }
- return TRUE;
-}
-
-/** Handle the MRCP responses/events */
-static apt_bool_t synth_application_on_message_receive(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_message_t *message)
-{
- if(message->start_line.message_type == MRCP_MESSAGE_TYPE_RESPONSE) {
- /* received MRCP response */
- if(message->start_line.method_id == SYNTHESIZER_SPEAK) {
- /* received the response to SPEAK request */
- if(message->start_line.request_state == MRCP_REQUEST_STATE_INPROGRESS) {
- /* waiting for SPEAK-COMPLETE event */
- }
- else {
- /* received unexpected response, remove channel */
- mrcp_application_channel_remove(session,channel);
- }
- }
- else {
- /* received unexpected response */
- }
- }
- else if(message->start_line.message_type == MRCP_MESSAGE_TYPE_EVENT) {
- /* received MRCP event */
- if(message->start_line.method_id == SYNTHESIZER_SPEAK_COMPLETE) {
- /* received SPEAK-COMPLETE event, remove channel */
- mrcp_application_channel_remove(session,channel);
- }
- }
- return TRUE;
-}
-
-/** Callback is called from MPF engine context to destroy any additional data associated with audio stream */
-static apt_bool_t synth_app_stream_destroy(mpf_audio_stream_t *stream)
-{
- /* nothing to destroy in demo */
- return TRUE;
-}
-
-/** Callback is called from MPF engine context to perform application stream specific action before open */
-static apt_bool_t synth_app_stream_open(mpf_audio_stream_t *stream, mpf_codec_t *codec)
-{
- return TRUE;
-}
-
-/** Callback is called from MPF engine context to perform application stream specific action after close */
-static apt_bool_t synth_app_stream_close(mpf_audio_stream_t *stream)
-{
- return TRUE;
-}
-
-/** Callback is called from MPF engine context to make new frame available to write/send */
-static apt_bool_t synth_app_stream_write(mpf_audio_stream_t *stream, const mpf_frame_t *frame)
-{
- synth_app_channel_t *synth_channel = stream->obj;
- if(synth_channel && synth_channel->audio_out) {
- fwrite(frame->codec_frame.buffer,1,frame->codec_frame.size,synth_channel->audio_out);
- }
- return TRUE;
-}
+++ /dev/null
-/*
- * 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: demo_util.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include "demo_util.h"
-/* common includes */
-#include "mrcp_message.h"
-#include "mrcp_generic_header.h"
-/* synthesizer includes */
-#include "mrcp_synth_header.h"
-#include "mrcp_synth_resource.h"
-/* recognizer includes */
-#include "mrcp_recog_header.h"
-#include "mrcp_recog_resource.h"
-/* logger include */
-#include "apt_log.h"
-
-static void demo_message_body_set(mrcp_message_t *mrcp_message, const apt_dir_layout_t *dir_layout, const char *file_name)
-{
- char *file_path = apt_datadir_filepath_get(dir_layout,file_name,mrcp_message->pool);
- if(file_path) {
- FILE *file = fopen(file_path,"r");
- if(file) {
- char text[1024];
- apr_size_t size;
- size = fread(text,1,sizeof(text),file);
- apt_string_assign_n(&mrcp_message->body,text,size,mrcp_message->pool);
- fclose(file);
- }
- }
-}
-
-/** Create demo MRCP message (SPEAK request) */
-mrcp_message_t* demo_speak_message_create(mrcp_session_t *session, mrcp_channel_t *channel, const apt_dir_layout_t *dir_layout)
-{
- /* create MRCP message */
- mrcp_message_t *mrcp_message = mrcp_application_message_create(session,channel,SYNTHESIZER_SPEAK);
- if(mrcp_message) {
- mrcp_generic_header_t *generic_header;
- mrcp_synth_header_t *synth_header;
- /* get/allocate generic header */
- generic_header = mrcp_generic_header_prepare(mrcp_message);
- if(generic_header) {
- /* set generic header fields */
- apt_string_assign(&generic_header->content_type,"application/synthesis+ssml",mrcp_message->pool);
- mrcp_generic_header_property_add(mrcp_message,GENERIC_HEADER_CONTENT_TYPE);
- }
- /* get/allocate synthesizer header */
- synth_header = mrcp_resource_header_prepare(mrcp_message);
- if(synth_header) {
- /* set synthesizer header fields */
- synth_header->voice_param.age = 28;
- mrcp_resource_header_property_add(mrcp_message,SYNTHESIZER_HEADER_VOICE_AGE);
- }
- /* set message body */
- demo_message_body_set(mrcp_message,dir_layout,"speak.xml");
- }
- return mrcp_message;
-}
-
-/** Create demo MRCP message (DEFINE-GRAMMAR request) */
-mrcp_message_t* demo_define_grammar_message_create(mrcp_session_t *session, mrcp_channel_t *channel, const apt_dir_layout_t *dir_layout)
-{
- /* create MRCP message */
- mrcp_message_t *mrcp_message = mrcp_application_message_create(session,channel,RECOGNIZER_DEFINE_GRAMMAR);
- if(mrcp_message) {
- mrcp_generic_header_t *generic_header;
- /* get/allocate generic header */
- generic_header = mrcp_generic_header_prepare(mrcp_message);
- if(generic_header) {
- /* set generic header fields */
- if(mrcp_message->start_line.version == MRCP_VERSION_2) {
- apt_string_assign(&generic_header->content_type,"application/srgs+xml",mrcp_message->pool);
- }
- else {
- apt_string_assign(&generic_header->content_type,"application/grammar+xml",mrcp_message->pool);
- }
- mrcp_generic_header_property_add(mrcp_message,GENERIC_HEADER_CONTENT_TYPE);
- apt_string_assign(&generic_header->content_id,"request1@form-level.store",mrcp_message->pool);
- mrcp_generic_header_property_add(mrcp_message,GENERIC_HEADER_CONTENT_ID);
- }
- /* set message body */
- demo_message_body_set(mrcp_message,dir_layout,"grammar.xml");
- }
- return mrcp_message;
-}
-
-/** Create demo MRCP message (RECOGNIZE request) */
-mrcp_message_t* demo_recognize_message_create(mrcp_session_t *session, mrcp_channel_t *channel, const apt_dir_layout_t *dir_layout)
-{
- const char text[] = "session:request1@form-level.store";
-
- /* create MRCP message */
- mrcp_message_t *mrcp_message = mrcp_application_message_create(session,channel,RECOGNIZER_RECOGNIZE);
- if(mrcp_message) {
- mrcp_recog_header_t *recog_header;
- mrcp_generic_header_t *generic_header;
- /* get/allocate generic header */
- generic_header = mrcp_generic_header_prepare(mrcp_message);
- if(generic_header) {
- /* set generic header fields */
- apt_string_assign(&generic_header->content_type,"text/uri-list",mrcp_message->pool);
- mrcp_generic_header_property_add(mrcp_message,GENERIC_HEADER_CONTENT_TYPE);
- }
- /* get/allocate recognizer header */
- recog_header = mrcp_resource_header_prepare(mrcp_message);
- if(recog_header) {
- if(mrcp_message->start_line.version == MRCP_VERSION_2) {
- /* set recognizer header fields */
- recog_header->cancel_if_queue = FALSE;
- mrcp_resource_header_property_add(mrcp_message,RECOGNIZER_HEADER_CANCEL_IF_QUEUE);
- }
- recog_header->no_input_timeout = 5000;
- mrcp_resource_header_property_add(mrcp_message,RECOGNIZER_HEADER_NO_INPUT_TIMEOUT);
- recog_header->recognition_timeout = 10000;
- mrcp_resource_header_property_add(mrcp_message,RECOGNIZER_HEADER_RECOGNITION_TIMEOUT);
- recog_header->start_input_timers = TRUE;
- mrcp_resource_header_property_add(mrcp_message,RECOGNIZER_HEADER_START_INPUT_TIMERS);
- recog_header->confidence_threshold = 0.87f;
- mrcp_resource_header_property_add(mrcp_message,RECOGNIZER_HEADER_CONFIDENCE_THRESHOLD);
- }
- /* set message body */
- apt_string_assign(&mrcp_message->body,text,mrcp_message->pool);
- }
- return mrcp_message;
-}
-
-/** Create demo RTP termination descriptor */
-mpf_rtp_termination_descriptor_t* demo_rtp_descriptor_create(apr_pool_t *pool)
-{
- mpf_codec_descriptor_t *codec_descriptor;
- mpf_rtp_media_descriptor_t *media;
- /* create rtp descriptor */
- mpf_rtp_termination_descriptor_t *rtp_descriptor = apr_palloc(pool,sizeof(mpf_rtp_termination_descriptor_t));
- mpf_rtp_termination_descriptor_init(rtp_descriptor);
- /* create rtp local media */
- media = apr_palloc(pool,sizeof(mpf_rtp_media_descriptor_t));
- mpf_rtp_media_descriptor_init(media);
- apt_string_assign(&media->ip,"127.0.0.1",pool);
- media->port = 6000;
- media->state = MPF_MEDIA_ENABLED;
- media->direction = STREAM_DIRECTION_RECEIVE;
-
- /* initialize codec list */
- mpf_codec_list_init(&media->codec_list,2,pool);
- /* set codec descriptor */
- codec_descriptor = mpf_codec_list_add(&media->codec_list);
- if(codec_descriptor) {
- codec_descriptor->payload_type = 0;
- }
- /* set another codec descriptor */
- codec_descriptor = mpf_codec_list_add(&media->codec_list);
- if(codec_descriptor) {
- codec_descriptor->payload_type = 96;
- apt_string_set(&codec_descriptor->name,"PCMU");
- codec_descriptor->sampling_rate = 16000;
- codec_descriptor->channel_count = 1;
- }
-
- rtp_descriptor->audio.local = media;
- return rtp_descriptor;
-}
+++ /dev/null
-/*
- * 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: main.c 2204 2014-10-31 01:01:42Z achaloyan@gmail.com $
- */
-
-#include <stdlib.h>
-#include <apr_getopt.h>
-#include <apr_file_info.h>
-#include "demo_framework.h"
-#include "apt_pool.h"
-#include "apt_log.h"
-#include "uni_version.h"
-
-typedef struct {
- const char *root_dir_path;
- const char *dir_layout_conf;
- const char *log_priority;
- const char *log_output;
-} client_options_t;
-
-static apt_bool_t demo_framework_cmdline_process(demo_framework_t *framework, char *cmdline)
-{
- apt_bool_t running = TRUE;
- char *name;
- char *last;
- name = apr_strtok(cmdline, " ", &last);
-
- if(strcasecmp(name,"run") == 0) {
- char *app_name = apr_strtok(NULL, " ", &last);
- if(app_name) {
- char *profile_name = apr_strtok(NULL, " ", &last);
- if(!profile_name) {
- profile_name = "uni2";
- }
- demo_framework_app_run(framework,app_name,profile_name);
- }
- }
- else if(strcasecmp(name,"loglevel") == 0) {
- char *priority = apr_strtok(NULL, " ", &last);
- if(priority) {
- apt_log_priority_set(atol(priority));
- }
- }
- else if(strcasecmp(name,"exit") == 0 || strcmp(name,"quit") == 0) {
- running = FALSE;
- }
- else if(strcasecmp(name,"help") == 0) {
- printf("usage:\n"
- "\n- run [app_name] [profile_name] (run demo application)\n"
- " app_name is one of 'synth', 'recog', 'bypass', 'discover'\n"
- " profile_name is one of 'uni2', 'uni1', ...\n"
- "\n examples: \n"
- " run synth\n"
- " run recog\n"
- " run synth uni1\n"
- " run recog uni1\n"
- "\n- loglevel [level] (set loglevel, one of 0,1...7)\n"
- "\n- quit, exit\n");
- }
- else {
- printf("unknown command: %s (input help for usage)\n",name);
- }
- return running;
-}
-
-static apt_bool_t demo_framework_cmdline_run(demo_framework_t *framework)
-{
- apt_bool_t running = TRUE;
- char cmdline[1024];
- apr_size_t i;
- do {
- printf(">");
- memset(&cmdline, 0, sizeof(cmdline));
- for(i = 0; i < sizeof(cmdline); i++) {
- cmdline[i] = (char) getchar();
- if(cmdline[i] == '\n') {
- cmdline[i] = '\0';
- break;
- }
- }
- if(*cmdline) {
- running = demo_framework_cmdline_process(framework,cmdline);
- }
- }
- while(running != 0);
- return TRUE;
-}
-
-static void usage(void)
-{
- printf(
- "\n"
- " * "UNI_COPYRIGHT"\n"
- " *\n"
- UNI_LICENSE"\n"
- "\n"
- "Usage:\n"
- "\n"
- " unimrcpclient [options]\n"
- "\n"
- " Available options:\n"
- "\n"
- " -r [--root-dir] path : Set the path to the project root directory.\n"
- "\n"
- " -c [--dir-layout] path : Set the path to the dir layout config file.\n"
- " (takes the precedence over --root-dir option)\n"
- "\n"
- " -l [--log-prio] priority : Set the log priority.\n"
- " (0-emergency, ..., 7-debug)\n"
- "\n"
- " -o [--log-output] mode : Set the log output mode.\n"
- " (0-none, 1-console only, 2-file only, 3-both)\n"
- "\n"
- " -v [--version] : Show the version.\n"
- "\n"
- " -h [--help] : Show the help.\n"
- "\n");
-}
-
-static apt_bool_t demo_framework_options_load(client_options_t *options, int argc, const char * const *argv, apr_pool_t *pool)
-{
- apr_status_t rv;
- apr_getopt_t *opt = NULL;
- int optch;
- const char *optarg;
-
- const apr_getopt_option_t opt_option[] = {
- /* long-option, short-option, has-arg flag, description */
- { "root-dir", 'r', TRUE, "path to root dir" }, /* -r arg or --root-dir arg */
- { "dir-layout", 'c', TRUE, "path to dir layout conf" }, /* -c arg or --dir-layout arg */
- { "log-prio", 'l', TRUE, "log priority" }, /* -l arg or --log-prio arg */
- { "log-output", 'o', TRUE, "log output mode" }, /* -o arg or --log-output arg */
- { "version", 'v', FALSE, "show version" }, /* -v or --version */
- { "help", 'h', FALSE, "show help" }, /* -h or --help */
- { NULL, 0, 0, NULL }, /* end */
- };
-
- rv = apr_getopt_init(&opt, pool , argc, argv);
- if(rv != APR_SUCCESS) {
- return FALSE;
- }
-
- /* reset the options */
- options->root_dir_path = NULL;
- options->dir_layout_conf = NULL;
- options->log_priority = NULL;
- options->log_output = NULL;
-
- while((rv = apr_getopt_long(opt, opt_option, &optch, &optarg)) == APR_SUCCESS) {
- switch(optch) {
- case 'r':
- options->root_dir_path = optarg;
- break;
- case 'c':
- options->dir_layout_conf = optarg;
- break;
- case 'l':
- options->log_priority = optarg;
- break;
- case 'o':
- options->log_output = optarg;
- break;
- case 'v':
- printf(UNI_VERSION_STRING);
- return FALSE;
- case 'h':
- usage();
- return FALSE;
- }
- }
-
- if(rv != APR_EOF) {
- usage();
- return FALSE;
- }
-
- return TRUE;
-}
-
-int main(int argc, const char * const *argv)
-{
- apr_pool_t *pool;
- client_options_t options;
- const char *log_conf_path;
- demo_framework_t *framework;
- apt_dir_layout_t *dir_layout = NULL;
-
- /* APR global initialization */
- if(apr_initialize() != APR_SUCCESS) {
- apr_terminate();
- return 0;
- }
-
- /* create APR pool */
- pool = apt_pool_create();
- if(!pool) {
- apr_terminate();
- return 0;
- }
-
- /* load options */
- if(demo_framework_options_load(&options,argc,argv,pool) != TRUE) {
- apr_pool_destroy(pool);
- apr_terminate();
- return 0;
- }
-
- if(options.dir_layout_conf) {
- /* create and load directories layout from the configuration file */
- dir_layout = apt_dir_layout_create(pool);
- if(dir_layout)
- apt_dir_layout_load(dir_layout,options.dir_layout_conf,pool);
- }
- else {
- /* create default directories layout */
- dir_layout = apt_default_dir_layout_create(options.root_dir_path,pool);
- }
-
- if(!dir_layout) {
- printf("Failed to Create Directories Layout\n");
- apr_pool_destroy(pool);
- apr_terminate();
- return 0;
- }
-
- /* get path to logger configuration file */
- log_conf_path = apt_confdir_filepath_get(dir_layout,"logger.xml",pool);
- /* create and load singleton logger */
- apt_log_instance_load(log_conf_path,pool);
-
- if(options.log_priority) {
- /* override the log priority, if specified in command line */
- apt_log_priority_set(atoi(options.log_priority));
- }
- if(options.log_output) {
- /* override the log output mode, if specified in command line */
- apt_log_output_mode_set(atoi(options.log_output));
- }
-
- if(apt_log_output_mode_check(APT_LOG_OUTPUT_FILE) == TRUE) {
- /* open the log file */
- const char *log_dir_path = apt_dir_layout_path_get(dir_layout,APT_LAYOUT_LOG_DIR);
- apt_log_file_open(log_dir_path,"unimrcpclient",MAX_LOG_FILE_SIZE,MAX_LOG_FILE_COUNT,FALSE,pool);
- }
-
- /* create demo framework */
- framework = demo_framework_create(dir_layout);
- if(framework) {
- /* run command line */
- demo_framework_cmdline_run(framework);
- /* destroy demo framework */
- demo_framework_destroy(framework);
- }
-
- /* destroy singleton logger */
- apt_log_instance_destroy();
- /* destroy APR pool */
- apr_pool_destroy(pool);
- /* APR global termination */
- apr_terminate();
- return 0;
-}
+++ /dev/null
-#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 Client Application\0"
- VALUE "FileVersion", UNI_VERSION_STRING "\0"
- VALUE "InternalName", "unimrcpclient" "\0"
- VALUE "LegalCopyright", UNI_COPYRIGHT "\0"
- VALUE "OriginalFilename", "unimrcpclient.exe" "\0"
- VALUE "ProductName", "UniMRCP Project\0"
- VALUE "ProductVersion", UNI_VERSION_STRING "\0"
- END
- END
- BLOCK "VarFileInfo"
- BEGIN
- VALUE "Translation", 0x409, 1200
- END
-END
+++ /dev/null
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="unimrcpclient"
- ProjectGUID="{57FAF32E-49FD-491F-895D-132D0D5EFE0A}"
- RootNamespace="unimrcpclient"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- <Platform
- Name="x64"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- ConfigurationType="1"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unibin.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpclient.vsprops"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="include"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="$(UniMRCPClientLibs)"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- ConfigurationType="1"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unibin.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpclient.vsprops"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="include"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="$(UniMRCPClientLibs)"
- LinkTimeCodeGeneration="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|x64"
- ConfigurationType="1"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unibin-x64.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpclient.vsprops"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="include"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="$(UniMRCPClientLibs)"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|x64"
- ConfigurationType="1"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unibin-x64.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpclient.vsprops"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="include"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="$(UniMRCPClientLibs)"
- LinkTimeCodeGeneration="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="src"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath=".\src\demo_bypass_application.c"
- >
- </File>
- <File
- RelativePath=".\src\demo_discover_application.c"
- >
- </File>
- <File
- RelativePath=".\src\demo_framework.c"
- >
- </File>
- <File
- RelativePath=".\src\demo_recog_application.c"
- >
- </File>
- <File
- RelativePath=".\src\demo_synth_application.c"
- >
- </File>
- <File
- RelativePath=".\src\demo_util.c"
- >
- </File>
- <File
- RelativePath=".\src\main.c"
- >
- </File>
- </Filter>
- <Filter
- Name="include"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- <File
- RelativePath=".\include\demo_application.h"
- >
- </File>
- <File
- RelativePath=".\include\demo_framework.h"
- >
- </File>
- <File
- RelativePath=".\include\demo_util.h"
- >
- </File>
- </Filter>
- <File
- RelativePath=".\unimrcpclient.rc"
- >
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCResourceCompilerTool"
- AdditionalIncludeDirectories="..\..\build"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCResourceCompilerTool"
- AdditionalIncludeDirectories="..\..\build"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug|x64"
- >
- <Tool
- Name="VCResourceCompilerTool"
- AdditionalIncludeDirectories="..\..\build"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|x64"
- >
- <Tool
- Name="VCResourceCompilerTool"
- AdditionalIncludeDirectories="..\..\build"
- />
- </FileConfiguration>
- </File>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{57FAF32E-49FD-491F-895D-132D0D5EFE0A}</ProjectGuid>
- <RootNamespace>unimrcpclient</RootNamespace>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unibin.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unimrcpclient.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" />
- <Import Project="$(ProjectDir)..\..\build\props\unibin.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unimrcpclient.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unibin-x64.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unimrcpclient.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" />
- <Import Project="$(ProjectDir)..\..\build\props\unibin-x64.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unimrcpclient.props" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- </ClCompile>
- <Link>
- <AdditionalDependencies>$(UniMRCPClientLibs);%(AdditionalDependencies)</AdditionalDependencies>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- </ClCompile>
- <Link>
- <AdditionalDependencies>$(UniMRCPClientLibs);%(AdditionalDependencies)</AdditionalDependencies>
- <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- <Link>
- <AdditionalDependencies>$(UniMRCPClientLibs);%(AdditionalDependencies)</AdditionalDependencies>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- </ClCompile>
- <Link>
- <AdditionalDependencies>$(UniMRCPClientLibs);%(AdditionalDependencies)</AdditionalDependencies>
- <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
- </Link>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="src\demo_bypass_application.c" />
- <ClCompile Include="src\demo_discover_application.c" />
- <ClCompile Include="src\demo_framework.c" />
- <ClCompile Include="src\demo_recog_application.c" />
- <ClCompile Include="src\demo_synth_application.c" />
- <ClCompile Include="src\demo_util.c" />
- <ClCompile Include="src\main.c" />
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="include\demo_application.h" />
- <ClInclude Include="include\demo_framework.h" />
- <ClInclude Include="include\demo_util.h" />
- </ItemGroup>
- <ItemGroup>
- <ResourceCompile Include="unimrcpclient.rc">
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\build;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\build;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\build;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\build;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- </ResourceCompile>
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\libunimrcp-client\libunimrcpclient.vcxproj">
- <Project>{ee157390-1e85-416c-946e-620e32c9ad33}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="src">
- <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
- </Filter>
- <Filter Include="include">
- <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="src\demo_bypass_application.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\demo_discover_application.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\demo_framework.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\demo_recog_application.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\demo_synth_application.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\demo_util.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\main.c">
- <Filter>src</Filter>
- </ClCompile>
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="include\demo_application.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\demo_framework.h">
- <Filter>include</Filter>
- </ClInclude>
- <ClInclude Include="include\demo_util.h">
- <Filter>include</Filter>
- </ClInclude>
- </ItemGroup>
- <ItemGroup>
- <ResourceCompile Include="unimrcpclient.rc" />
- </ItemGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-AM_CPPFLAGS = -I$(top_srcdir)/platforms/unimrcp-server/include \
- $(UNIMRCP_SERVERAPP_INCLUDES)
-
-bin_PROGRAMS = unimrcpserver
-unimrcpserver_SOURCES = src/main.c src/uni_cmdline.c src/uni_daemon.c
-unimrcpserver_LDADD = $(UNIMRCP_SERVERAPP_LIBS)
-unimrcpserver_LDFLAGS = $(UNIMRCP_SERVERAPP_OPTS)
-
-include $(top_srcdir)/build/rules/uniserverapp.am
+++ /dev/null
-/*
- * 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: main.c 2204 2014-10-31 01:01:42Z achaloyan@gmail.com $
- */
-
-#include <stdlib.h>
-#include <apr_getopt.h>
-#include <apr_file_info.h>
-#include "apt_pool.h"
-#include "apt_dir_layout.h"
-#include "apt_log.h"
-#include "uni_version.h"
-
-typedef struct {
- const char *root_dir_path;
- const char *dir_layout_conf;
- apt_bool_t foreground;
- const char *log_priority;
- const char *log_output;
-#ifdef WIN32
- const char *svcname;
-#endif
-} server_options_t;
-
-#ifdef WIN32
-apt_bool_t uni_service_run(const char *name, apt_dir_layout_t *dir_layout, apr_pool_t *pool);
-#else
-apt_bool_t uni_daemon_run(apt_dir_layout_t *dir_layout, apr_pool_t *pool);
-#endif
-
-apt_bool_t uni_cmdline_run(apt_dir_layout_t *dir_layout, apr_pool_t *pool);
-
-
-static void usage()
-{
- printf(
- "\n"
- " * "UNI_COPYRIGHT"\n"
- " *\n"
- UNI_LICENSE"\n"
- "\n"
- "Usage:\n"
- "\n"
- " unimrcpserver [options]\n"
- "\n"
- " Available options:\n"
- "\n"
- " -r [--root-dir] path : Set the path to the project root directory.\n"
- "\n"
- " -c [--dir-layout] path : Set the path to the dir layout config file.\n"
- " (takes the precedence over --root-dir option)\n"
- "\n"
- " -l [--log-prio] priority : Set the log priority.\n"
- " (0-emergency, ..., 7-debug)\n"
- "\n"
- " -o [--log-output] mode : Set the log output mode.\n"
- " (0-none, 1-console only, 2-file only, 3-both)\n"
- "\n"
-#ifdef WIN32
- " -s [--service] : Run as a Windows service.\n"
- "\n"
- " -n [--name] svcname : Set the service name (default: unimrcp)\n"
- "\n"
-#else
- " -d [--daemon] : Run as a daemon.\n"
- "\n"
-#endif
- " -v [--version] : Show the version.\n"
- "\n"
- " -h [--help] : Show the help.\n"
- "\n");
-}
-
-static apt_bool_t options_load(server_options_t *options, int argc, const char * const *argv, apr_pool_t *pool)
-{
- apr_status_t rv;
- apr_getopt_t *opt = NULL;
- int optch;
- const char *optarg;
-
- const apr_getopt_option_t opt_option[] = {
- /* long-option, short-option, has-arg flag, description */
- { "root-dir", 'r', TRUE, "path to root dir" }, /* -r arg or --root-dir arg */
- { "dir-layout", 'c', TRUE, "path to dir layout conf" }, /* -c arg or --dir-layout arg */
- { "log-prio", 'l', TRUE, "log priority" }, /* -l arg or --log-prio arg */
- { "log-output", 'o', TRUE, "log output mode" }, /* -o arg or --log-output arg */
-#ifdef WIN32
- { "service", 's', FALSE, "run as service" }, /* -s or --service */
- { "name", 'n', TRUE, "service name" }, /* -n or --name arg */
-#else
- { "daemon", 'd', FALSE, "start as daemon" }, /* -d or --daemon */
-#endif
- { "version", 'v', FALSE, "show version" }, /* -v or --version */
- { "help", 'h', FALSE, "show help" }, /* -h or --help */
- { NULL, 0, 0, NULL }, /* end */
- };
-
- rv = apr_getopt_init(&opt, pool , argc, argv);
- if(rv != APR_SUCCESS) {
- return FALSE;
- }
-
- /* reset the options */
- options->root_dir_path = NULL;
- options->dir_layout_conf = NULL;
- options->foreground = TRUE;
- options->log_priority = NULL;
- options->log_output = NULL;
-#ifdef WIN32
- options->svcname = NULL;
-#endif
-
- while((rv = apr_getopt_long(opt, opt_option, &optch, &optarg)) == APR_SUCCESS) {
- switch(optch) {
- case 'r':
- options->root_dir_path = optarg;
- break;
- case 'c':
- options->dir_layout_conf = optarg;
- break;
- case 'l':
- options->log_priority = optarg;
- break;
- case 'o':
- options->log_output = optarg;
- break;
-#ifdef WIN32
- case 's':
- options->foreground = FALSE;
- break;
- case 'n':
- options->svcname = optarg;
- break;
-#else
- case 'd':
- options->foreground = FALSE;
- break;
-#endif
- case 'v':
- printf(UNI_VERSION_STRING);
- return FALSE;
- case 'h':
- usage();
- return FALSE;
- }
- }
-
- if(rv != APR_EOF) {
- usage();
- return FALSE;
- }
-
- return TRUE;
-}
-
-int main(int argc, const char * const *argv)
-{
- apr_pool_t *pool;
- server_options_t options;
- const char *log_conf_path;
- apt_dir_layout_t *dir_layout = NULL;
-
- /* APR global initialization */
- if(apr_initialize() != APR_SUCCESS) {
- apr_terminate();
- return 0;
- }
-
- /* create APR pool */
- pool = apt_pool_create();
- if(!pool) {
- apr_terminate();
- return 0;
- }
-
- /* load options */
- if(options_load(&options,argc,argv,pool) != TRUE) {
- apr_pool_destroy(pool);
- apr_terminate();
- return 0;
- }
-
- if(options.dir_layout_conf) {
- /* create and load directories layout from the configuration file */
- dir_layout = apt_dir_layout_create(pool);
- if(dir_layout)
- apt_dir_layout_load(dir_layout,options.dir_layout_conf,pool);
- }
- else {
- /* create default directories layout */
- dir_layout = apt_default_dir_layout_create(options.root_dir_path,pool);
- }
-
- if(!dir_layout) {
- printf("Failed to Create Directories Layout\n");
- apr_pool_destroy(pool);
- apr_terminate();
- return 0;
- }
-
- /* get path to logger configuration file */
- log_conf_path = apt_confdir_filepath_get(dir_layout,"logger.xml",pool);
- /* create and load singleton logger */
- apt_log_instance_load(log_conf_path,pool);
-
- if(options.log_priority) {
- /* override the log priority, if specified in command line */
- apt_log_priority_set(atoi(options.log_priority));
- }
- if(options.log_output) {
- /* override the log output mode, if specified in command line */
- apt_log_output_mode_set(atoi(options.log_output));
- }
-
- if(apt_log_output_mode_check(APT_LOG_OUTPUT_FILE) == TRUE) {
- /* open the log file */
- const char *log_dir_path = apt_dir_layout_path_get(dir_layout,APT_LAYOUT_LOG_DIR);
- apt_log_file_open(log_dir_path,"unimrcpserver",MAX_LOG_FILE_SIZE,MAX_LOG_FILE_COUNT,TRUE,pool);
- }
-
- if(options.foreground == TRUE) {
- /* run command line */
- uni_cmdline_run(dir_layout,pool);
- }
-#ifdef WIN32
- else {
- /* run as windows service */
- uni_service_run(options.svcname,dir_layout,pool);
- }
-#else
- else {
- /* run as daemon */
- uni_daemon_run(dir_layout,pool);
- }
-#endif
-
- /* destroy singleton logger */
- apt_log_instance_destroy();
- /* destroy APR pool */
- apr_pool_destroy(pool);
- /* APR global termination */
- apr_terminate();
- return 0;
-}
+++ /dev/null
-/*
- * 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_cmdline.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include "unimrcp_server.h"
-#include "apt_log.h"
-
-static apt_bool_t cmdline_process(char *cmdline)
-{
- apt_bool_t running = TRUE;
- char *name;
- char *last;
- name = apr_strtok(cmdline, " ", &last);
-
- if(strcasecmp(name,"loglevel") == 0) {
- char *priority = apr_strtok(NULL, " ", &last);
- if(priority) {
- apt_log_priority_set(atol(priority));
- }
- }
- else if(strcasecmp(name,"exit") == 0 || strcmp(name,"quit") == 0) {
- running = FALSE;
- }
- else if(strcasecmp(name,"help") == 0) {
- printf("usage:\n");
- printf("- loglevel [level] (set loglevel, one of 0,1...7)\n");
- printf("- quit, exit\n");
- }
- else {
- printf("unknown command: %s (input help for usage)\n",name);
- }
- return running;
-}
-
-apt_bool_t uni_cmdline_run(apt_dir_layout_t *dir_layout, apr_pool_t *pool)
-{
- apt_bool_t running = TRUE;
- char cmdline[1024];
- apr_size_t i;
- mrcp_server_t *server;
-
- /* start server */
- server = unimrcp_server_start(dir_layout);
- if(!server) {
- return FALSE;
- }
-
- do {
- printf(">");
- memset(&cmdline, 0, sizeof(cmdline));
- for(i = 0; i < sizeof(cmdline); i++) {
- cmdline[i] = (char) getchar();
- if(cmdline[i] == '\n') {
- cmdline[i] = '\0';
- break;
- }
- }
- if(*cmdline) {
- running = cmdline_process(cmdline);
- }
- }
- while(running != 0);
-
- /* shutdown server */
- unimrcp_server_shutdown(server);
- return TRUE;
-}
+++ /dev/null
-/*
- * 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_daemon.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include <apr_signal.h>
-#include <apr_thread_proc.h>
-#include "unimrcp_server.h"
-#include "apt_log.h"
-
-static apt_bool_t daemon_running;
-
-static void sigterm_handler(int signo)
-{
- daemon_running = FALSE;
-}
-
-apt_bool_t uni_daemon_run(apt_dir_layout_t *dir_layout, apr_pool_t *pool)
-{
- mrcp_server_t *server;
-
- daemon_running = TRUE;
- apr_signal(SIGTERM,sigterm_handler);
-
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Run as Daemon");
- apr_proc_detach(APR_PROC_DETACH_DAEMONIZE);
-
- /* start server */
- server = unimrcp_server_start(dir_layout);
- if(!server) {
- return FALSE;
- }
-
- while(daemon_running) apr_sleep(1000000);
-
- /* shutdown server */
- unimrcp_server_shutdown(server);
- return TRUE;
-}
+++ /dev/null
-/*
- * 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_service.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include <windows.h>
-#include <apr_lib.h>
-#include "unimrcp_server.h"
-#include "apt_log.h"
-
-#define WIN_SERVICE_NAME "unimrcp"
-
-static SERVICE_STATUS_HANDLE win_service_status_handle = NULL;
-static SERVICE_STATUS win_service_status;
-
-static mrcp_server_t *server = NULL;
-static apt_dir_layout_t *service_dir_layout = NULL;
-static const char *svcname = NULL;
-
-/** Display error message with Windows error code and description */
-static void winerror(const char *file, int line, 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);
- apt_log(file, line, APT_PRIO_WARNING, "%s: %lu %.*s\n", msg, err, ret, buf);
-}
-
-/** SCM state change handler */
-static void WINAPI win_service_handler(DWORD control)
-{
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Service Handler 0x%02lx",control);
- switch (control)
- {
- case SERVICE_CONTROL_INTERROGATE:
- break;
- case SERVICE_CONTROL_SHUTDOWN:
- case SERVICE_CONTROL_STOP:
- if(server) {
- win_service_status.dwCurrentState = SERVICE_STOP_PENDING;
- if(!SetServiceStatus(win_service_status_handle, &win_service_status)) {
- winerror(APT_LOG_MARK, "Failed to Set Service Status");
- }
-
- /* shutdown server */
- unimrcp_server_shutdown(server);
- }
- win_service_status.dwCurrentState = SERVICE_STOPPED;
- win_service_status.dwCheckPoint = 0;
- win_service_status.dwWaitHint = 0;
- break;
- }
-
- if(!SetServiceStatus(win_service_status_handle, &win_service_status)) {
- winerror(APT_LOG_MARK, "Failed to Set Service Status");
- }
-}
-
-static void WINAPI win_service_main(DWORD argc, LPTSTR *argv)
-{
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Service Main");
- win_service_status.dwServiceType = SERVICE_WIN32;
- win_service_status.dwControlsAccepted = SERVICE_ACCEPT_STOP;
- win_service_status.dwWin32ExitCode = 0;
- win_service_status.dwServiceSpecificExitCode = 0;
- win_service_status.dwCheckPoint = 0;
- win_service_status.dwWaitHint = 0;
-
- win_service_status_handle = RegisterServiceCtrlHandler(svcname, win_service_handler);
- if(win_service_status_handle == (SERVICE_STATUS_HANDLE)0) {
- winerror(APT_LOG_MARK, "Failed to Register Service Control Handler");
- return;
- }
-
- win_service_status.dwCurrentState = SERVICE_START_PENDING;
- if(!SetServiceStatus(win_service_status_handle, &win_service_status)) {
- winerror(APT_LOG_MARK, "Failed to Set Service Status");
- }
-
- /* start server */
- server = unimrcp_server_start(service_dir_layout);
-
- win_service_status.dwCurrentState = server ? SERVICE_RUNNING : SERVICE_STOPPED;
- if(!SetServiceStatus(win_service_status_handle, &win_service_status)) {
- winerror(APT_LOG_MARK, "Failed to Set Service Status");
- }
-}
-
-/** Run SCM service */
-apt_bool_t uni_service_run(const char *name, apt_dir_layout_t *dir_layout, apr_pool_t *pool)
-{
- SERVICE_TABLE_ENTRY win_service_table[2];
- svcname = name ? name : WIN_SERVICE_NAME;
- memset(&win_service_table, 0, sizeof(win_service_table));
- win_service_table->lpServiceName = (char *) svcname;
- win_service_table->lpServiceProc = win_service_main;
-
- service_dir_layout = dir_layout;
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Run as Service %s",svcname);
- if(!StartServiceCtrlDispatcher(win_service_table)) {
- winerror(APT_LOG_MARK, "Failed to Connect to SCM");
- }
- return TRUE;
-}
+++ /dev/null
-#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 Server Application\0"
- VALUE "FileVersion", UNI_VERSION_STRING "\0"
- VALUE "InternalName", "unimrcpserver" "\0"
- VALUE "LegalCopyright", UNI_COPYRIGHT "\0"
- VALUE "OriginalFilename", "unimrcpserver.exe" "\0"
- VALUE "ProductName", "UniMRCP Project\0"
- VALUE "ProductVersion", UNI_VERSION_STRING "\0"
- END
- END
- BLOCK "VarFileInfo"
- BEGIN
- VALUE "Translation", 0x409, 1200
- END
-END
+++ /dev/null
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="unimrcpserver"
- ProjectGUID="{592CF22D-3F8F-4A77-A174-130D77B7623B}"
- RootNamespace="unimrcpserver"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- <Platform
- Name="x64"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- ConfigurationType="1"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unibin.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpserver.vsprops"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="$(UniMRCPServerLibs)"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- ConfigurationType="1"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unibin.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpserver.vsprops"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="$(UniMRCPServerLibs)"
- LinkTimeCodeGeneration="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|x64"
- ConfigurationType="1"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unibin-x64.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpserver.vsprops"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="$(UniMRCPServerLibs)"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|x64"
- ConfigurationType="1"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unibin-x64.vsprops;$(ProjectDir)..\..\build\vsprops\unimrcpserver.vsprops"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="$(UniMRCPServerLibs)"
- LinkTimeCodeGeneration="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="src"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath=".\src\main.c"
- >
- </File>
- <File
- RelativePath=".\src\uni_cmdline.c"
- >
- </File>
- <File
- RelativePath=".\src\uni_daemon.c"
- >
- </File>
- <File
- RelativePath=".\src\uni_service.c"
- >
- </File>
- </Filter>
- <Filter
- Name="include"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- </Filter>
- <File
- RelativePath=".\unimrcpserver.rc"
- >
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCResourceCompilerTool"
- AdditionalIncludeDirectories="..\..\build"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCResourceCompilerTool"
- AdditionalIncludeDirectories="..\..\build"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Debug|x64"
- >
- <Tool
- Name="VCResourceCompilerTool"
- AdditionalIncludeDirectories="..\..\build"
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|x64"
- >
- <Tool
- Name="VCResourceCompilerTool"
- AdditionalIncludeDirectories="..\..\build"
- />
- </FileConfiguration>
- </File>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{592CF22D-3F8F-4A77-A174-130D77B7623B}</ProjectGuid>
- <RootNamespace>unimrcpserver</RootNamespace>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unibin.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unimrcpserver.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" />
- <Import Project="$(ProjectDir)..\..\build\props\unibin.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unimrcpserver.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unibin-x64.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unimrcpserver.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" />
- <Import Project="$(ProjectDir)..\..\build\props\unibin-x64.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unimrcpserver.props" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <Link>
- <AdditionalDependencies>$(UniMRCPServerLibs);%(AdditionalDependencies)</AdditionalDependencies>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <Link>
- <AdditionalDependencies>$(UniMRCPServerLibs);%(AdditionalDependencies)</AdditionalDependencies>
- <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- <Link>
- <AdditionalDependencies>$(UniMRCPServerLibs);%(AdditionalDependencies)</AdditionalDependencies>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <Link>
- <AdditionalDependencies>$(UniMRCPServerLibs);%(AdditionalDependencies)</AdditionalDependencies>
- <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
- </Link>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="src\main.c" />
- <ClCompile Include="src\uni_cmdline.c" />
- <ClCompile Include="src\uni_daemon.c" />
- <ClCompile Include="src\uni_service.c" />
- </ItemGroup>
- <ItemGroup>
- <ResourceCompile Include="unimrcpserver.rc">
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\build;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\build;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\build;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\build;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- </ResourceCompile>
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\libunimrcp-server\libunimrcpserver.vcxproj">
- <Project>{c98af157-352e-4737-bd30-a24e2647f5ae}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="src">
- <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
- </Filter>
- <Filter Include="include">
- <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="src\main.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\uni_cmdline.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\uni_daemon.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\uni_service.c">
- <Filter>src</Filter>
- </ClCompile>
- </ItemGroup>
- <ItemGroup>
- <ResourceCompile Include="unimrcpserver.rc" />
- </ItemGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-MAINTAINERCLEANFILES = Makefile.in
-
-SUBDIRS =
-
-if DEMOSYNTH_PLUGIN
-SUBDIRS += demo-synth
-endif
-
-if DEMORECOG_PLUGIN
-SUBDIRS += demo-recog
-endif
-
-if DEMOVERIFIER_PLUGIN
-SUBDIRS += demo-verifier
-endif
-
-if RECORDER_PLUGIN
-SUBDIRS += mrcp-recorder
-endif
+++ /dev/null
-AM_CPPFLAGS = $(UNIMRCP_PLUGIN_INCLUDES)
-
-plugin_LTLIBRARIES = demorecog.la
-
-demorecog_la_SOURCES = src/demo_recog_engine.c
-demorecog_la_LDFLAGS = $(UNIMRCP_PLUGIN_OPTS)
-
-include $(top_srcdir)/build/rules/uniplugin.am
+++ /dev/null
-<?xml version="1.0" encoding="Windows-1252"?>\r
-<VisualStudioProject\r
- ProjectType="Visual C++"\r
- Version="8.00"\r
- Name="demorecog"\r
- ProjectGUID="{B495B6D9-AF84-479D-B30A-313C16EF8BFD}"\r
- RootNamespace="demorecog"\r
- Keyword="Win32Proj"\r
- >\r
- <Platforms>\r
- <Platform\r
- Name="Win32"\r
- />\r
- <Platform\r
- Name="x64"\r
- />\r
- </Platforms>\r
- <ToolFiles>\r
- </ToolFiles>\r
- <Configurations>\r
- <Configuration\r
- Name="Debug|Win32"\r
- ConfigurationType="2"\r
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\uniplugin.vsprops"\r
- CharacterSet="1"\r
- >\r
- <Tool\r
- Name="VCPreBuildEventTool"\r
- />\r
- <Tool\r
- Name="VCCustomBuildTool"\r
- />\r
- <Tool\r
- Name="VCXMLDataGeneratorTool"\r
- />\r
- <Tool\r
- Name="VCWebServiceProxyGeneratorTool"\r
- />\r
- <Tool\r
- Name="VCMIDLTool"\r
- />\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories="include"\r
- />\r
- <Tool\r
- Name="VCManagedResourceCompilerTool"\r
- />\r
- <Tool\r
- Name="VCResourceCompilerTool"\r
- />\r
- <Tool\r
- Name="VCPreLinkEventTool"\r
- />\r
- <Tool\r
- Name="VCLinkerTool"\r
- />\r
- <Tool\r
- Name="VCALinkTool"\r
- />\r
- <Tool\r
- Name="VCManifestTool"\r
- />\r
- <Tool\r
- Name="VCXDCMakeTool"\r
- />\r
- <Tool\r
- Name="VCBscMakeTool"\r
- />\r
- <Tool\r
- Name="VCFxCopTool"\r
- />\r
- <Tool\r
- Name="VCAppVerifierTool"\r
- />\r
- <Tool\r
- Name="VCWebDeploymentTool"\r
- />\r
- <Tool\r
- Name="VCPostBuildEventTool"\r
- />\r
- </Configuration>\r
- <Configuration\r
- Name="Release|Win32"\r
- ConfigurationType="2"\r
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\uniplugin.vsprops"\r
- CharacterSet="1"\r
- WholeProgramOptimization="1"\r
- >\r
- <Tool\r
- Name="VCPreBuildEventTool"\r
- />\r
- <Tool\r
- Name="VCCustomBuildTool"\r
- />\r
- <Tool\r
- Name="VCXMLDataGeneratorTool"\r
- />\r
- <Tool\r
- Name="VCWebServiceProxyGeneratorTool"\r
- />\r
- <Tool\r
- Name="VCMIDLTool"\r
- />\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories="include"\r
- />\r
- <Tool\r
- Name="VCManagedResourceCompilerTool"\r
- />\r
- <Tool\r
- Name="VCResourceCompilerTool"\r
- />\r
- <Tool\r
- Name="VCPreLinkEventTool"\r
- />\r
- <Tool\r
- Name="VCLinkerTool"\r
- />\r
- <Tool\r
- Name="VCALinkTool"\r
- />\r
- <Tool\r
- Name="VCManifestTool"\r
- />\r
- <Tool\r
- Name="VCXDCMakeTool"\r
- />\r
- <Tool\r
- Name="VCBscMakeTool"\r
- />\r
- <Tool\r
- Name="VCFxCopTool"\r
- />\r
- <Tool\r
- Name="VCAppVerifierTool"\r
- />\r
- <Tool\r
- Name="VCWebDeploymentTool"\r
- />\r
- <Tool\r
- Name="VCPostBuildEventTool"\r
- />\r
- </Configuration>\r
- <Configuration\r
- Name="Debug|x64"\r
- ConfigurationType="2"\r
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\uniplugin-x64.vsprops"\r
- CharacterSet="1"\r
- >\r
- <Tool\r
- Name="VCPreBuildEventTool"\r
- />\r
- <Tool\r
- Name="VCCustomBuildTool"\r
- />\r
- <Tool\r
- Name="VCXMLDataGeneratorTool"\r
- />\r
- <Tool\r
- Name="VCWebServiceProxyGeneratorTool"\r
- />\r
- <Tool\r
- Name="VCMIDLTool"\r
- TargetEnvironment="3"\r
- />\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories="include"\r
- DebugInformationFormat="3"\r
- />\r
- <Tool\r
- Name="VCManagedResourceCompilerTool"\r
- />\r
- <Tool\r
- Name="VCResourceCompilerTool"\r
- />\r
- <Tool\r
- Name="VCPreLinkEventTool"\r
- />\r
- <Tool\r
- Name="VCLinkerTool"\r
- />\r
- <Tool\r
- Name="VCALinkTool"\r
- />\r
- <Tool\r
- Name="VCManifestTool"\r
- />\r
- <Tool\r
- Name="VCXDCMakeTool"\r
- />\r
- <Tool\r
- Name="VCBscMakeTool"\r
- />\r
- <Tool\r
- Name="VCFxCopTool"\r
- />\r
- <Tool\r
- Name="VCAppVerifierTool"\r
- />\r
- <Tool\r
- Name="VCWebDeploymentTool"\r
- />\r
- <Tool\r
- Name="VCPostBuildEventTool"\r
- />\r
- </Configuration>\r
- <Configuration\r
- Name="Release|x64"\r
- ConfigurationType="2"\r
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\uniplugin-x64.vsprops"\r
- CharacterSet="1"\r
- WholeProgramOptimization="1"\r
- >\r
- <Tool\r
- Name="VCPreBuildEventTool"\r
- />\r
- <Tool\r
- Name="VCCustomBuildTool"\r
- />\r
- <Tool\r
- Name="VCXMLDataGeneratorTool"\r
- />\r
- <Tool\r
- Name="VCWebServiceProxyGeneratorTool"\r
- />\r
- <Tool\r
- Name="VCMIDLTool"\r
- TargetEnvironment="3"\r
- />\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories="include"\r
- />\r
- <Tool\r
- Name="VCManagedResourceCompilerTool"\r
- />\r
- <Tool\r
- Name="VCResourceCompilerTool"\r
- />\r
- <Tool\r
- Name="VCPreLinkEventTool"\r
- />\r
- <Tool\r
- Name="VCLinkerTool"\r
- />\r
- <Tool\r
- Name="VCALinkTool"\r
- />\r
- <Tool\r
- Name="VCManifestTool"\r
- />\r
- <Tool\r
- Name="VCXDCMakeTool"\r
- />\r
- <Tool\r
- Name="VCBscMakeTool"\r
- />\r
- <Tool\r
- Name="VCFxCopTool"\r
- />\r
- <Tool\r
- Name="VCAppVerifierTool"\r
- />\r
- <Tool\r
- Name="VCWebDeploymentTool"\r
- />\r
- <Tool\r
- Name="VCPostBuildEventTool"\r
- />\r
- </Configuration>\r
- </Configurations>\r
- <References>\r
- </References>\r
- <Files>\r
- <Filter\r
- Name="include"\r
- Filter="h;hpp;hxx;hm;inl;inc;xsd"\r
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"\r
- >\r
- </Filter>\r
- <Filter\r
- Name="src"\r
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"\r
- >\r
- <File\r
- RelativePath=".\src\demo_recog_engine.c"\r
- >\r
- </File>\r
- </Filter>\r
- </Files>\r
- <Globals>\r
- </Globals>\r
-</VisualStudioProject>\r
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{B495B6D9-AF84-479D-B30A-313C16EF8BFD}</ProjectGuid>
- <RootNamespace>demorecog</RootNamespace>
- <Keyword>Win32Proj</Keyword>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />
- <Import Project="$(ProjectDir)..\..\build\props\uniplugin.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" />
- <Import Project="$(ProjectDir)..\..\build\props\uniplugin.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />
- <Import Project="$(ProjectDir)..\..\build\props\uniplugin-x64.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" />
- <Import Project="$(ProjectDir)..\..\build\props\uniplugin-x64.props" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="src\demo_recog_engine.c" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\libs\mrcp-engine\mrcpengine.vcxproj">
- <Project>{843425be-9a9a-44f4-a4e3-4b57d6abd53c}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="include">
- <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
- </Filter>
- <Filter Include="src">
- <UniqueIdentifier>{4c5e54ad-7563-43a7-8b11-5067a45289e9}</UniqueIdentifier>
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="src\demo_recog_engine.c">
- <Filter>src</Filter>
- </ClCompile>
- </ItemGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-/*
- * 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: demo_recog_engine.c 2193 2014-10-08 03:44:33Z achaloyan@gmail.com $
- */
-
-/*
- * Mandatory rules concerning plugin implementation.
- * 1. Each plugin MUST implement a plugin/engine creator function
- * with the exact signature and name (the main entry point)
- * MRCP_PLUGIN_DECLARE(mrcp_engine_t*) mrcp_plugin_create(apr_pool_t *pool)
- * 2. Each plugin MUST declare its version number
- * MRCP_PLUGIN_VERSION_DECLARE
- * 3. One and only one response MUST be sent back to the received request.
- * 4. Methods (callbacks) of the MRCP engine channel MUST not block.
- * (asynchronous response can be sent from the context of other thread)
- * 5. Methods (callbacks) of the MPF engine stream MUST not block.
- */
-
-#include "mrcp_recog_engine.h"
-#include "mpf_activity_detector.h"
-#include "apt_consumer_task.h"
-#include "apt_log.h"
-
-#define RECOG_ENGINE_TASK_NAME "Demo Recog Engine"
-
-typedef struct demo_recog_engine_t demo_recog_engine_t;
-typedef struct demo_recog_channel_t demo_recog_channel_t;
-typedef struct demo_recog_msg_t demo_recog_msg_t;
-
-/** Declaration of recognizer engine methods */
-static apt_bool_t demo_recog_engine_destroy(mrcp_engine_t *engine);
-static apt_bool_t demo_recog_engine_open(mrcp_engine_t *engine);
-static apt_bool_t demo_recog_engine_close(mrcp_engine_t *engine);
-static mrcp_engine_channel_t* demo_recog_engine_channel_create(mrcp_engine_t *engine, apr_pool_t *pool);
-
-static const struct mrcp_engine_method_vtable_t engine_vtable = {
- demo_recog_engine_destroy,
- demo_recog_engine_open,
- demo_recog_engine_close,
- demo_recog_engine_channel_create
-};
-
-
-/** Declaration of recognizer channel methods */
-static apt_bool_t demo_recog_channel_destroy(mrcp_engine_channel_t *channel);
-static apt_bool_t demo_recog_channel_open(mrcp_engine_channel_t *channel);
-static apt_bool_t demo_recog_channel_close(mrcp_engine_channel_t *channel);
-static apt_bool_t demo_recog_channel_request_process(mrcp_engine_channel_t *channel, mrcp_message_t *request);
-
-static const struct mrcp_engine_channel_method_vtable_t channel_vtable = {
- demo_recog_channel_destroy,
- demo_recog_channel_open,
- demo_recog_channel_close,
- demo_recog_channel_request_process
-};
-
-/** Declaration of recognizer audio stream methods */
-static apt_bool_t demo_recog_stream_destroy(mpf_audio_stream_t *stream);
-static apt_bool_t demo_recog_stream_open(mpf_audio_stream_t *stream, mpf_codec_t *codec);
-static apt_bool_t demo_recog_stream_close(mpf_audio_stream_t *stream);
-static apt_bool_t demo_recog_stream_write(mpf_audio_stream_t *stream, const mpf_frame_t *frame);
-
-static const mpf_audio_stream_vtable_t audio_stream_vtable = {
- demo_recog_stream_destroy,
- NULL,
- NULL,
- NULL,
- demo_recog_stream_open,
- demo_recog_stream_close,
- demo_recog_stream_write,
- NULL
-};
-
-/** Declaration of demo recognizer engine */
-struct demo_recog_engine_t {
- apt_consumer_task_t *task;
-};
-
-/** Declaration of demo recognizer channel */
-struct demo_recog_channel_t {
- /** Back pointer to engine */
- demo_recog_engine_t *demo_engine;
- /** Engine channel base */
- mrcp_engine_channel_t *channel;
-
- /** Active (in-progress) recognition request */
- mrcp_message_t *recog_request;
- /** Pending stop response */
- mrcp_message_t *stop_response;
- /** Indicates whether input timers are started */
- apt_bool_t timers_started;
- /** Voice activity detector */
- mpf_activity_detector_t *detector;
- /** File to write utterance to */
- FILE *audio_out;
-};
-
-typedef enum {
- DEMO_RECOG_MSG_OPEN_CHANNEL,
- DEMO_RECOG_MSG_CLOSE_CHANNEL,
- DEMO_RECOG_MSG_REQUEST_PROCESS
-} demo_recog_msg_type_e;
-
-/** Declaration of demo recognizer task message */
-struct demo_recog_msg_t {
- demo_recog_msg_type_e type;
- mrcp_engine_channel_t *channel;
- mrcp_message_t *request;
-};
-
-static apt_bool_t demo_recog_msg_signal(demo_recog_msg_type_e type, mrcp_engine_channel_t *channel, mrcp_message_t *request);
-static apt_bool_t demo_recog_msg_process(apt_task_t *task, apt_task_msg_t *msg);
-
-/** Declare this macro to set plugin version */
-MRCP_PLUGIN_VERSION_DECLARE
-
-/** Declare this macro to use log routine of the server, plugin is loaded from */
-MRCP_PLUGIN_LOGGER_IMPLEMENT
-
-/** Create demo recognizer engine */
-MRCP_PLUGIN_DECLARE(mrcp_engine_t*) mrcp_plugin_create(apr_pool_t *pool)
-{
- demo_recog_engine_t *demo_engine = apr_palloc(pool,sizeof(demo_recog_engine_t));
- apt_task_t *task;
- apt_task_vtable_t *vtable;
- apt_task_msg_pool_t *msg_pool;
-
- msg_pool = apt_task_msg_pool_create_dynamic(sizeof(demo_recog_msg_t),pool);
- demo_engine->task = apt_consumer_task_create(demo_engine,msg_pool,pool);
- if(!demo_engine->task) {
- return NULL;
- }
- task = apt_consumer_task_base_get(demo_engine->task);
- apt_task_name_set(task,RECOG_ENGINE_TASK_NAME);
- vtable = apt_task_vtable_get(task);
- if(vtable) {
- vtable->process_msg = demo_recog_msg_process;
- }
-
- /* create engine base */
- return mrcp_engine_create(
- MRCP_RECOGNIZER_RESOURCE, /* MRCP resource identifier */
- demo_engine, /* object to associate */
- &engine_vtable, /* virtual methods table of engine */
- pool); /* pool to allocate memory from */
-}
-
-/** Destroy recognizer engine */
-static apt_bool_t demo_recog_engine_destroy(mrcp_engine_t *engine)
-{
- demo_recog_engine_t *demo_engine = engine->obj;
- if(demo_engine->task) {
- apt_task_t *task = apt_consumer_task_base_get(demo_engine->task);
- apt_task_destroy(task);
- demo_engine->task = NULL;
- }
- return TRUE;
-}
-
-/** Open recognizer engine */
-static apt_bool_t demo_recog_engine_open(mrcp_engine_t *engine)
-{
- demo_recog_engine_t *demo_engine = engine->obj;
- if(demo_engine->task) {
- apt_task_t *task = apt_consumer_task_base_get(demo_engine->task);
- apt_task_start(task);
- }
- return mrcp_engine_open_respond(engine,TRUE);
-}
-
-/** Close recognizer engine */
-static apt_bool_t demo_recog_engine_close(mrcp_engine_t *engine)
-{
- demo_recog_engine_t *demo_engine = engine->obj;
- if(demo_engine->task) {
- apt_task_t *task = apt_consumer_task_base_get(demo_engine->task);
- apt_task_terminate(task,TRUE);
- }
- return mrcp_engine_close_respond(engine);
-}
-
-static mrcp_engine_channel_t* demo_recog_engine_channel_create(mrcp_engine_t *engine, apr_pool_t *pool)
-{
- mpf_stream_capabilities_t *capabilities;
- mpf_termination_t *termination;
-
- /* create demo recog channel */
- demo_recog_channel_t *recog_channel = apr_palloc(pool,sizeof(demo_recog_channel_t));
- recog_channel->demo_engine = engine->obj;
- recog_channel->recog_request = NULL;
- recog_channel->stop_response = NULL;
- recog_channel->detector = mpf_activity_detector_create(pool);
- recog_channel->audio_out = NULL;
-
- capabilities = mpf_sink_stream_capabilities_create(pool);
- mpf_codec_capabilities_add(
- &capabilities->codecs,
- MPF_SAMPLE_RATE_8000 | MPF_SAMPLE_RATE_16000,
- "LPCM");
-
- /* create media termination */
- termination = mrcp_engine_audio_termination_create(
- recog_channel, /* object to associate */
- &audio_stream_vtable, /* virtual methods table of audio stream */
- capabilities, /* stream capabilities */
- pool); /* pool to allocate memory from */
-
- /* create engine channel base */
- recog_channel->channel = mrcp_engine_channel_create(
- engine, /* engine */
- &channel_vtable, /* virtual methods table of engine channel */
- recog_channel, /* object to associate */
- termination, /* associated media termination */
- pool); /* pool to allocate memory from */
-
- return recog_channel->channel;
-}
-
-/** Destroy engine channel */
-static apt_bool_t demo_recog_channel_destroy(mrcp_engine_channel_t *channel)
-{
- /* nothing to destrtoy */
- return TRUE;
-}
-
-/** Open engine channel (asynchronous response MUST be sent)*/
-static apt_bool_t demo_recog_channel_open(mrcp_engine_channel_t *channel)
-{
- return demo_recog_msg_signal(DEMO_RECOG_MSG_OPEN_CHANNEL,channel,NULL);
-}
-
-/** Close engine channel (asynchronous response MUST be sent)*/
-static apt_bool_t demo_recog_channel_close(mrcp_engine_channel_t *channel)
-{
- return demo_recog_msg_signal(DEMO_RECOG_MSG_CLOSE_CHANNEL,channel,NULL);
-}
-
-/** Process MRCP channel request (asynchronous response MUST be sent)*/
-static apt_bool_t demo_recog_channel_request_process(mrcp_engine_channel_t *channel, mrcp_message_t *request)
-{
- return demo_recog_msg_signal(DEMO_RECOG_MSG_REQUEST_PROCESS,channel,request);
-}
-
-/** Process RECOGNIZE request */
-static apt_bool_t demo_recog_channel_recognize(mrcp_engine_channel_t *channel, mrcp_message_t *request, mrcp_message_t *response)
-{
- /* process RECOGNIZE request */
- mrcp_recog_header_t *recog_header;
- demo_recog_channel_t *recog_channel = channel->method_obj;
- const mpf_codec_descriptor_t *descriptor = mrcp_engine_sink_stream_codec_get(channel);
-
- if(!descriptor) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Get Codec Descriptor "APT_SIDRES_FMT, MRCP_MESSAGE_SIDRES(request));
- response->start_line.status_code = MRCP_STATUS_CODE_METHOD_FAILED;
- return FALSE;
- }
-
- recog_channel->timers_started = TRUE;
-
- /* get recognizer header */
- recog_header = mrcp_resource_header_get(request);
- if(recog_header) {
- if(mrcp_resource_header_property_check(request,RECOGNIZER_HEADER_START_INPUT_TIMERS) == TRUE) {
- recog_channel->timers_started = recog_header->start_input_timers;
- }
- if(mrcp_resource_header_property_check(request,RECOGNIZER_HEADER_NO_INPUT_TIMEOUT) == TRUE) {
- mpf_activity_detector_noinput_timeout_set(recog_channel->detector,recog_header->no_input_timeout);
- }
- if(mrcp_resource_header_property_check(request,RECOGNIZER_HEADER_SPEECH_COMPLETE_TIMEOUT) == TRUE) {
- mpf_activity_detector_silence_timeout_set(recog_channel->detector,recog_header->speech_complete_timeout);
- }
- }
-
- if(!recog_channel->audio_out) {
- const apt_dir_layout_t *dir_layout = channel->engine->dir_layout;
- char *file_name = apr_psprintf(channel->pool,"utter-%dkHz-%s.pcm",
- descriptor->sampling_rate/1000,
- request->channel_id.session_id.buf);
- char *file_path = apt_vardir_filepath_get(dir_layout,file_name,channel->pool);
- if(file_path) {
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Open Utterance Output File [%s] for Writing",file_path);
- recog_channel->audio_out = fopen(file_path,"wb");
- if(!recog_channel->audio_out) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Open Utterance Output File [%s] for Writing",file_path);
- }
- }
- }
-
- response->start_line.request_state = MRCP_REQUEST_STATE_INPROGRESS;
- /* send asynchronous response */
- mrcp_engine_channel_message_send(channel,response);
- recog_channel->recog_request = request;
- return TRUE;
-}
-
-/** Process STOP request */
-static apt_bool_t demo_recog_channel_stop(mrcp_engine_channel_t *channel, mrcp_message_t *request, mrcp_message_t *response)
-{
- /* process STOP request */
- demo_recog_channel_t *recog_channel = channel->method_obj;
- /* store STOP request, make sure there is no more activity and only then send the response */
- recog_channel->stop_response = response;
- return TRUE;
-}
-
-/** Process START-INPUT-TIMERS request */
-static apt_bool_t demo_recog_channel_timers_start(mrcp_engine_channel_t *channel, mrcp_message_t *request, mrcp_message_t *response)
-{
- demo_recog_channel_t *recog_channel = channel->method_obj;
- recog_channel->timers_started = TRUE;
- return mrcp_engine_channel_message_send(channel,response);
-}
-
-/** Dispatch MRCP request */
-static apt_bool_t demo_recog_channel_request_dispatch(mrcp_engine_channel_t *channel, mrcp_message_t *request)
-{
- apt_bool_t processed = FALSE;
- mrcp_message_t *response = mrcp_response_create(request,request->pool);
- switch(request->start_line.method_id) {
- case RECOGNIZER_SET_PARAMS:
- break;
- case RECOGNIZER_GET_PARAMS:
- break;
- case RECOGNIZER_DEFINE_GRAMMAR:
- break;
- case RECOGNIZER_RECOGNIZE:
- processed = demo_recog_channel_recognize(channel,request,response);
- break;
- case RECOGNIZER_GET_RESULT:
- break;
- case RECOGNIZER_START_INPUT_TIMERS:
- processed = demo_recog_channel_timers_start(channel,request,response);
- break;
- case RECOGNIZER_STOP:
- processed = demo_recog_channel_stop(channel,request,response);
- break;
- default:
- break;
- }
- if(processed == FALSE) {
- /* send asynchronous response for not handled request */
- mrcp_engine_channel_message_send(channel,response);
- }
- return TRUE;
-}
-
-/** Callback is called from MPF engine context to destroy any additional data associated with audio stream */
-static apt_bool_t demo_recog_stream_destroy(mpf_audio_stream_t *stream)
-{
- return TRUE;
-}
-
-/** Callback is called from MPF engine context to perform any action before open */
-static apt_bool_t demo_recog_stream_open(mpf_audio_stream_t *stream, mpf_codec_t *codec)
-{
- return TRUE;
-}
-
-/** Callback is called from MPF engine context to perform any action after close */
-static apt_bool_t demo_recog_stream_close(mpf_audio_stream_t *stream)
-{
- return TRUE;
-}
-
-/* Raise demo START-OF-INPUT event */
-static apt_bool_t demo_recog_start_of_input(demo_recog_channel_t *recog_channel)
-{
- /* create START-OF-INPUT event */
- mrcp_message_t *message = mrcp_event_create(
- recog_channel->recog_request,
- RECOGNIZER_START_OF_INPUT,
- recog_channel->recog_request->pool);
- if(!message) {
- return FALSE;
- }
-
- /* set request state */
- message->start_line.request_state = MRCP_REQUEST_STATE_INPROGRESS;
- /* send asynch event */
- return mrcp_engine_channel_message_send(recog_channel->channel,message);
-}
-
-/* Load demo recognition result */
-static apt_bool_t demo_recog_result_load(demo_recog_channel_t *recog_channel, mrcp_message_t *message)
-{
- FILE *file;
- mrcp_engine_channel_t *channel = recog_channel->channel;
- const apt_dir_layout_t *dir_layout = channel->engine->dir_layout;
- char *file_path = apt_datadir_filepath_get(dir_layout,"result.xml",message->pool);
- if(!file_path) {
- return FALSE;
- }
-
- /* read the demo result from file */
- file = fopen(file_path,"r");
- if(file) {
- mrcp_generic_header_t *generic_header;
- char text[1024];
- apr_size_t size;
- size = fread(text,1,sizeof(text),file);
- apt_string_assign_n(&message->body,text,size,message->pool);
- fclose(file);
-
- /* get/allocate generic header */
- generic_header = mrcp_generic_header_prepare(message);
- if(generic_header) {
- /* set content types */
- apt_string_assign(&generic_header->content_type,"application/x-nlsml",message->pool);
- mrcp_generic_header_property_add(message,GENERIC_HEADER_CONTENT_TYPE);
- }
- }
- return TRUE;
-}
-
-/* Raise demo RECOGNITION-COMPLETE event */
-static apt_bool_t demo_recog_recognition_complete(demo_recog_channel_t *recog_channel, mrcp_recog_completion_cause_e cause)
-{
- mrcp_recog_header_t *recog_header;
- /* create RECOGNITION-COMPLETE event */
- mrcp_message_t *message = mrcp_event_create(
- recog_channel->recog_request,
- RECOGNIZER_RECOGNITION_COMPLETE,
- recog_channel->recog_request->pool);
- if(!message) {
- return FALSE;
- }
-
- /* get/allocate recognizer header */
- recog_header = mrcp_resource_header_prepare(message);
- if(recog_header) {
- /* set completion cause */
- recog_header->completion_cause = cause;
- mrcp_resource_header_property_add(message,RECOGNIZER_HEADER_COMPLETION_CAUSE);
- }
- /* set request state */
- message->start_line.request_state = MRCP_REQUEST_STATE_COMPLETE;
-
- if(cause == RECOGNIZER_COMPLETION_CAUSE_SUCCESS) {
- demo_recog_result_load(recog_channel,message);
- }
-
- recog_channel->recog_request = NULL;
- /* send asynch event */
- return mrcp_engine_channel_message_send(recog_channel->channel,message);
-}
-
-/** Callback is called from MPF engine context to write/send new frame */
-static apt_bool_t demo_recog_stream_write(mpf_audio_stream_t *stream, const mpf_frame_t *frame)
-{
- demo_recog_channel_t *recog_channel = stream->obj;
- if(recog_channel->stop_response) {
- /* send asynchronous response to STOP request */
- mrcp_engine_channel_message_send(recog_channel->channel,recog_channel->stop_response);
- recog_channel->stop_response = NULL;
- recog_channel->recog_request = NULL;
- return TRUE;
- }
-
- if(recog_channel->recog_request) {
- mpf_detector_event_e det_event = mpf_activity_detector_process(recog_channel->detector,frame);
- switch(det_event) {
- case MPF_DETECTOR_EVENT_ACTIVITY:
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Detected Voice Activity "APT_SIDRES_FMT,
- MRCP_MESSAGE_SIDRES(recog_channel->recog_request));
- demo_recog_start_of_input(recog_channel);
- break;
- case MPF_DETECTOR_EVENT_INACTIVITY:
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Detected Voice Inactivity "APT_SIDRES_FMT,
- MRCP_MESSAGE_SIDRES(recog_channel->recog_request));
- demo_recog_recognition_complete(recog_channel,RECOGNIZER_COMPLETION_CAUSE_SUCCESS);
- break;
- case MPF_DETECTOR_EVENT_NOINPUT:
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Detected Noinput "APT_SIDRES_FMT,
- MRCP_MESSAGE_SIDRES(recog_channel->recog_request));
- if(recog_channel->timers_started == TRUE) {
- demo_recog_recognition_complete(recog_channel,RECOGNIZER_COMPLETION_CAUSE_NO_INPUT_TIMEOUT);
- }
- break;
- default:
- break;
- }
-
- if((frame->type & MEDIA_FRAME_TYPE_EVENT) == MEDIA_FRAME_TYPE_EVENT) {
- if(frame->marker == MPF_MARKER_START_OF_EVENT) {
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Detected Start of Event "APT_SIDRES_FMT" id:%d",
- MRCP_MESSAGE_SIDRES(recog_channel->recog_request),
- frame->event_frame.event_id);
- }
- else if(frame->marker == MPF_MARKER_END_OF_EVENT) {
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Detected End of Event "APT_SIDRES_FMT" id:%d duration:%d ts",
- MRCP_MESSAGE_SIDRES(recog_channel->recog_request),
- frame->event_frame.event_id,
- frame->event_frame.duration);
- }
- }
-
- if(recog_channel->audio_out) {
- fwrite(frame->codec_frame.buffer,1,frame->codec_frame.size,recog_channel->audio_out);
- }
- }
- return TRUE;
-}
-
-static apt_bool_t demo_recog_msg_signal(demo_recog_msg_type_e type, mrcp_engine_channel_t *channel, mrcp_message_t *request)
-{
- apt_bool_t status = FALSE;
- demo_recog_channel_t *demo_channel = channel->method_obj;
- demo_recog_engine_t *demo_engine = demo_channel->demo_engine;
- apt_task_t *task = apt_consumer_task_base_get(demo_engine->task);
- apt_task_msg_t *msg = apt_task_msg_get(task);
- if(msg) {
- demo_recog_msg_t *demo_msg;
- msg->type = TASK_MSG_USER;
- demo_msg = (demo_recog_msg_t*) msg->data;
-
- demo_msg->type = type;
- demo_msg->channel = channel;
- demo_msg->request = request;
- status = apt_task_msg_signal(task,msg);
- }
- return status;
-}
-
-static apt_bool_t demo_recog_msg_process(apt_task_t *task, apt_task_msg_t *msg)
-{
- demo_recog_msg_t *demo_msg = (demo_recog_msg_t*)msg->data;
- switch(demo_msg->type) {
- case DEMO_RECOG_MSG_OPEN_CHANNEL:
- /* open channel and send asynch response */
- mrcp_engine_channel_open_respond(demo_msg->channel,TRUE);
- break;
- case DEMO_RECOG_MSG_CLOSE_CHANNEL:
- {
- /* close channel, make sure there is no activity and send asynch response */
- demo_recog_channel_t *recog_channel = demo_msg->channel->method_obj;
- if(recog_channel->audio_out) {
- fclose(recog_channel->audio_out);
- recog_channel->audio_out = NULL;
- }
-
- mrcp_engine_channel_close_respond(demo_msg->channel);
- break;
- }
- case DEMO_RECOG_MSG_REQUEST_PROCESS:
- demo_recog_channel_request_dispatch(demo_msg->channel,demo_msg->request);
- break;
- default:
- break;
- }
- return TRUE;
-}
+++ /dev/null
-AM_CPPFLAGS = $(UNIMRCP_PLUGIN_INCLUDES)
-
-plugin_LTLIBRARIES = demosynth.la
-
-demosynth_la_SOURCES = src/demo_synth_engine.c
-demosynth_la_LDFLAGS = $(UNIMRCP_PLUGIN_OPTS)
-
-include $(top_srcdir)/build/rules/uniplugin.am
+++ /dev/null
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="demosynth"
- ProjectGUID="{92BFA534-C419-4EB2-AAA3-510653F38F08}"
- RootNamespace="demosynth"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- <Platform
- Name="x64"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- ConfigurationType="2"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\uniplugin.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="include"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- ConfigurationType="2"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\uniplugin.vsprops"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="include"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|x64"
- ConfigurationType="2"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\uniplugin-x64.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="include"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|x64"
- ConfigurationType="2"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\uniplugin-x64.vsprops"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="include"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="include"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- </Filter>
- <Filter
- Name="src"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- >
- <File
- RelativePath=".\src\demo_synth_engine.c"
- >
- </File>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{92BFA534-C419-4EB2-AAA3-510653F38F08}</ProjectGuid>
- <RootNamespace>demosynth</RootNamespace>
- <Keyword>Win32Proj</Keyword>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />
- <Import Project="$(ProjectDir)..\..\build\props\uniplugin.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" />
- <Import Project="$(ProjectDir)..\..\build\props\uniplugin.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />
- <Import Project="$(ProjectDir)..\..\build\props\uniplugin-x64.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" />
- <Import Project="$(ProjectDir)..\..\build\props\uniplugin-x64.props" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="src\demo_synth_engine.c" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\libs\mrcp-engine\mrcpengine.vcxproj">
- <Project>{843425be-9a9a-44f4-a4e3-4b57d6abd53c}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="include">
- <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
- </Filter>
- <Filter Include="src">
- <UniqueIdentifier>{c816d2c0-8f04-4474-ad43-cfac130a1a84}</UniqueIdentifier>
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="src\demo_synth_engine.c">
- <Filter>src</Filter>
- </ClCompile>
- </ItemGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-/*
- * 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: demo_synth_engine.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-/*
- * Mandatory rules concerning plugin implementation.
- * 1. Each plugin MUST implement a plugin/engine creator function
- * with the exact signature and name (the main entry point)
- * MRCP_PLUGIN_DECLARE(mrcp_engine_t*) mrcp_plugin_create(apr_pool_t *pool)
- * 2. Each plugin MUST declare its version number
- * MRCP_PLUGIN_VERSION_DECLARE
- * 3. One and only one response MUST be sent back to the received request.
- * 4. Methods (callbacks) of the MRCP engine channel MUST not block.
- * (asynchronous response can be sent from the context of other thread)
- * 5. Methods (callbacks) of the MPF engine stream MUST not block.
- */
-
-#include "mrcp_synth_engine.h"
-#include "apt_consumer_task.h"
-#include "apt_log.h"
-
-#define SYNTH_ENGINE_TASK_NAME "Demo Synth Engine"
-
-typedef struct demo_synth_engine_t demo_synth_engine_t;
-typedef struct demo_synth_channel_t demo_synth_channel_t;
-typedef struct demo_synth_msg_t demo_synth_msg_t;
-
-/** Declaration of synthesizer engine methods */
-static apt_bool_t demo_synth_engine_destroy(mrcp_engine_t *engine);
-static apt_bool_t demo_synth_engine_open(mrcp_engine_t *engine);
-static apt_bool_t demo_synth_engine_close(mrcp_engine_t *engine);
-static mrcp_engine_channel_t* demo_synth_engine_channel_create(mrcp_engine_t *engine, apr_pool_t *pool);
-
-static const struct mrcp_engine_method_vtable_t engine_vtable = {
- demo_synth_engine_destroy,
- demo_synth_engine_open,
- demo_synth_engine_close,
- demo_synth_engine_channel_create
-};
-
-
-/** Declaration of synthesizer channel methods */
-static apt_bool_t demo_synth_channel_destroy(mrcp_engine_channel_t *channel);
-static apt_bool_t demo_synth_channel_open(mrcp_engine_channel_t *channel);
-static apt_bool_t demo_synth_channel_close(mrcp_engine_channel_t *channel);
-static apt_bool_t demo_synth_channel_request_process(mrcp_engine_channel_t *channel, mrcp_message_t *request);
-
-static const struct mrcp_engine_channel_method_vtable_t channel_vtable = {
- demo_synth_channel_destroy,
- demo_synth_channel_open,
- demo_synth_channel_close,
- demo_synth_channel_request_process
-};
-
-/** Declaration of synthesizer audio stream methods */
-static apt_bool_t demo_synth_stream_destroy(mpf_audio_stream_t *stream);
-static apt_bool_t demo_synth_stream_open(mpf_audio_stream_t *stream, mpf_codec_t *codec);
-static apt_bool_t demo_synth_stream_close(mpf_audio_stream_t *stream);
-static apt_bool_t demo_synth_stream_read(mpf_audio_stream_t *stream, mpf_frame_t *frame);
-
-static const mpf_audio_stream_vtable_t audio_stream_vtable = {
- demo_synth_stream_destroy,
- demo_synth_stream_open,
- demo_synth_stream_close,
- demo_synth_stream_read,
- NULL,
- NULL,
- NULL,
- NULL
-};
-
-/** Declaration of demo synthesizer engine */
-struct demo_synth_engine_t {
- apt_consumer_task_t *task;
-};
-
-/** Declaration of demo synthesizer channel */
-struct demo_synth_channel_t {
- /** Back pointer to engine */
- demo_synth_engine_t *demo_engine;
- /** Engine channel base */
- mrcp_engine_channel_t *channel;
-
- /** Active (in-progress) speak request */
- mrcp_message_t *speak_request;
- /** Pending stop response */
- mrcp_message_t *stop_response;
- /** Estimated time to complete */
- apr_size_t time_to_complete;
- /** Is paused */
- apt_bool_t paused;
- /** Speech source (used instead of actual synthesis) */
- FILE *audio_file;
-};
-
-typedef enum {
- DEMO_SYNTH_MSG_OPEN_CHANNEL,
- DEMO_SYNTH_MSG_CLOSE_CHANNEL,
- DEMO_SYNTH_MSG_REQUEST_PROCESS
-} demo_synth_msg_type_e;
-
-/** Declaration of demo synthesizer task message */
-struct demo_synth_msg_t {
- demo_synth_msg_type_e type;
- mrcp_engine_channel_t *channel;
- mrcp_message_t *request;
-};
-
-
-static apt_bool_t demo_synth_msg_signal(demo_synth_msg_type_e type, mrcp_engine_channel_t *channel, mrcp_message_t *request);
-static apt_bool_t demo_synth_msg_process(apt_task_t *task, apt_task_msg_t *msg);
-
-/** Declare this macro to set plugin version */
-MRCP_PLUGIN_VERSION_DECLARE
-
-/** Declare this macro to use log routine of the server, plugin is loaded from */
-MRCP_PLUGIN_LOGGER_IMPLEMENT
-
-/** Create demo synthesizer engine */
-MRCP_PLUGIN_DECLARE(mrcp_engine_t*) mrcp_plugin_create(apr_pool_t *pool)
-{
- /* create demo engine */
- demo_synth_engine_t *demo_engine = apr_palloc(pool,sizeof(demo_synth_engine_t));
- apt_task_t *task;
- apt_task_vtable_t *vtable;
- apt_task_msg_pool_t *msg_pool;
-
- /* create task/thread to run demo engine in the context of this task */
- msg_pool = apt_task_msg_pool_create_dynamic(sizeof(demo_synth_msg_t),pool);
- demo_engine->task = apt_consumer_task_create(demo_engine,msg_pool,pool);
- if(!demo_engine->task) {
- return NULL;
- }
- task = apt_consumer_task_base_get(demo_engine->task);
- apt_task_name_set(task,SYNTH_ENGINE_TASK_NAME);
- vtable = apt_task_vtable_get(task);
- if(vtable) {
- vtable->process_msg = demo_synth_msg_process;
- }
-
- /* create engine base */
- return mrcp_engine_create(
- MRCP_SYNTHESIZER_RESOURCE, /* MRCP resource identifier */
- demo_engine, /* object to associate */
- &engine_vtable, /* virtual methods table of engine */
- pool); /* pool to allocate memory from */
-}
-
-/** Destroy synthesizer engine */
-static apt_bool_t demo_synth_engine_destroy(mrcp_engine_t *engine)
-{
- demo_synth_engine_t *demo_engine = engine->obj;
- if(demo_engine->task) {
- apt_task_t *task = apt_consumer_task_base_get(demo_engine->task);
- apt_task_destroy(task);
- demo_engine->task = NULL;
- }
- return TRUE;
-}
-
-/** Open synthesizer engine */
-static apt_bool_t demo_synth_engine_open(mrcp_engine_t *engine)
-{
- demo_synth_engine_t *demo_engine = engine->obj;
- if(demo_engine->task) {
- apt_task_t *task = apt_consumer_task_base_get(demo_engine->task);
- apt_task_start(task);
- }
- return mrcp_engine_open_respond(engine,TRUE);
-}
-
-/** Close synthesizer engine */
-static apt_bool_t demo_synth_engine_close(mrcp_engine_t *engine)
-{
- demo_synth_engine_t *demo_engine = engine->obj;
- if(demo_engine->task) {
- apt_task_t *task = apt_consumer_task_base_get(demo_engine->task);
- apt_task_terminate(task,TRUE);
- }
- return mrcp_engine_close_respond(engine);
-}
-
-/** Create demo synthesizer channel derived from engine channel base */
-static mrcp_engine_channel_t* demo_synth_engine_channel_create(mrcp_engine_t *engine, apr_pool_t *pool)
-{
- mpf_stream_capabilities_t *capabilities;
- mpf_termination_t *termination;
-
- /* create demo synth channel */
- demo_synth_channel_t *synth_channel = apr_palloc(pool,sizeof(demo_synth_channel_t));
- synth_channel->demo_engine = engine->obj;
- synth_channel->speak_request = NULL;
- synth_channel->stop_response = NULL;
- synth_channel->time_to_complete = 0;
- synth_channel->paused = FALSE;
- synth_channel->audio_file = NULL;
-
- capabilities = mpf_source_stream_capabilities_create(pool);
- mpf_codec_capabilities_add(
- &capabilities->codecs,
- MPF_SAMPLE_RATE_8000 | MPF_SAMPLE_RATE_16000,
- "LPCM");
-
- /* create media termination */
- termination = mrcp_engine_audio_termination_create(
- synth_channel, /* object to associate */
- &audio_stream_vtable, /* virtual methods table of audio stream */
- capabilities, /* stream capabilities */
- pool); /* pool to allocate memory from */
-
- /* create engine channel base */
- synth_channel->channel = mrcp_engine_channel_create(
- engine, /* engine */
- &channel_vtable, /* virtual methods table of engine channel */
- synth_channel, /* object to associate */
- termination, /* associated media termination */
- pool); /* pool to allocate memory from */
-
- return synth_channel->channel;
-}
-
-/** Destroy engine channel */
-static apt_bool_t demo_synth_channel_destroy(mrcp_engine_channel_t *channel)
-{
- /* nothing to destroy */
- return TRUE;
-}
-
-/** Open engine channel (asynchronous response MUST be sent)*/
-static apt_bool_t demo_synth_channel_open(mrcp_engine_channel_t *channel)
-{
- return demo_synth_msg_signal(DEMO_SYNTH_MSG_OPEN_CHANNEL,channel,NULL);
-}
-
-/** Close engine channel (asynchronous response MUST be sent)*/
-static apt_bool_t demo_synth_channel_close(mrcp_engine_channel_t *channel)
-{
- return demo_synth_msg_signal(DEMO_SYNTH_MSG_CLOSE_CHANNEL,channel,NULL);
-}
-
-/** Process MRCP channel request (asynchronous response MUST be sent)*/
-static apt_bool_t demo_synth_channel_request_process(mrcp_engine_channel_t *channel, mrcp_message_t *request)
-{
- return demo_synth_msg_signal(DEMO_SYNTH_MSG_REQUEST_PROCESS,channel,request);
-}
-
-/** Process SPEAK request */
-static apt_bool_t demo_synth_channel_speak(mrcp_engine_channel_t *channel, mrcp_message_t *request, mrcp_message_t *response)
-{
- char *file_path = NULL;
- demo_synth_channel_t *synth_channel = channel->method_obj;
- const mpf_codec_descriptor_t *descriptor = mrcp_engine_source_stream_codec_get(channel);
-
- if(!descriptor) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Get Codec Descriptor "APT_SIDRES_FMT, MRCP_MESSAGE_SIDRES(request));
- response->start_line.status_code = MRCP_STATUS_CODE_METHOD_FAILED;
- return FALSE;
- }
-
- synth_channel->time_to_complete = 0;
- if(channel->engine) {
- char *file_name = apr_psprintf(channel->pool,"demo-%dkHz.pcm",descriptor->sampling_rate/1000);
- file_path = apt_datadir_filepath_get(channel->engine->dir_layout,file_name,channel->pool);
- }
- if(file_path) {
- synth_channel->audio_file = fopen(file_path,"rb");
- if(synth_channel->audio_file) {
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set [%s] as Speech Source "APT_SIDRES_FMT,
- file_path,
- MRCP_MESSAGE_SIDRES(request));
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"No Speech Source [%s] Found "APT_SIDRES_FMT,
- file_path,
- MRCP_MESSAGE_SIDRES(request));
- /* calculate estimated time to complete */
- if(mrcp_generic_header_property_check(request,GENERIC_HEADER_CONTENT_LENGTH) == TRUE) {
- mrcp_generic_header_t *generic_header = mrcp_generic_header_get(request);
- if(generic_header) {
- synth_channel->time_to_complete = generic_header->content_length * 10; /* 10 msec per character */
- }
- }
- }
- }
-
- response->start_line.request_state = MRCP_REQUEST_STATE_INPROGRESS;
- /* send asynchronous response */
- mrcp_engine_channel_message_send(channel,response);
- synth_channel->speak_request = request;
- return TRUE;
-}
-
-/** Process STOP request */
-static apt_bool_t demo_synth_channel_stop(mrcp_engine_channel_t *channel, mrcp_message_t *request, mrcp_message_t *response)
-{
- demo_synth_channel_t *synth_channel = channel->method_obj;
- /* store the request, make sure there is no more activity and only then send the response */
- synth_channel->stop_response = response;
- return TRUE;
-}
-
-/** Process PAUSE request */
-static apt_bool_t demo_synth_channel_pause(mrcp_engine_channel_t *channel, mrcp_message_t *request, mrcp_message_t *response)
-{
- demo_synth_channel_t *synth_channel = channel->method_obj;
- synth_channel->paused = TRUE;
- /* send asynchronous response */
- mrcp_engine_channel_message_send(channel,response);
- return TRUE;
-}
-
-/** Process RESUME request */
-static apt_bool_t demo_synth_channel_resume(mrcp_engine_channel_t *channel, mrcp_message_t *request, mrcp_message_t *response)
-{
- demo_synth_channel_t *synth_channel = channel->method_obj;
- synth_channel->paused = FALSE;
- /* send asynchronous response */
- mrcp_engine_channel_message_send(channel,response);
- return TRUE;
-}
-
-/** Process SET-PARAMS request */
-static apt_bool_t demo_synth_channel_set_params(mrcp_engine_channel_t *channel, mrcp_message_t *request, mrcp_message_t *response)
-{
- mrcp_synth_header_t *req_synth_header;
- /* get synthesizer header */
- req_synth_header = mrcp_resource_header_get(request);
- if(req_synth_header) {
- /* check voice age header */
- if(mrcp_resource_header_property_check(request,SYNTHESIZER_HEADER_VOICE_AGE) == TRUE) {
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set Voice Age [%"APR_SIZE_T_FMT"]",
- req_synth_header->voice_param.age);
- }
- /* check voice name header */
- if(mrcp_resource_header_property_check(request,SYNTHESIZER_HEADER_VOICE_NAME) == TRUE) {
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set Voice Name [%s]",
- req_synth_header->voice_param.name.buf);
- }
- }
-
- /* send asynchronous response */
- mrcp_engine_channel_message_send(channel,response);
- return TRUE;
-}
-
-/** Process GET-PARAMS request */
-static apt_bool_t demo_synth_channel_get_params(mrcp_engine_channel_t *channel, mrcp_message_t *request, mrcp_message_t *response)
-{
- mrcp_synth_header_t *req_synth_header;
- /* get synthesizer header */
- req_synth_header = mrcp_resource_header_get(request);
- if(req_synth_header) {
- mrcp_synth_header_t *res_synth_header = mrcp_resource_header_prepare(response);
- /* check voice age header */
- if(mrcp_resource_header_property_check(request,SYNTHESIZER_HEADER_VOICE_AGE) == TRUE) {
- res_synth_header->voice_param.age = 25;
- mrcp_resource_header_property_add(response,SYNTHESIZER_HEADER_VOICE_AGE);
- }
- /* check voice name header */
- if(mrcp_resource_header_property_check(request,SYNTHESIZER_HEADER_VOICE_NAME) == TRUE) {
- apt_string_set(&res_synth_header->voice_param.name,"David");
- mrcp_resource_header_property_add(response,SYNTHESIZER_HEADER_VOICE_NAME);
- }
- }
-
- /* send asynchronous response */
- mrcp_engine_channel_message_send(channel,response);
- return TRUE;
-}
-
-/** Dispatch MRCP request */
-static apt_bool_t demo_synth_channel_request_dispatch(mrcp_engine_channel_t *channel, mrcp_message_t *request)
-{
- apt_bool_t processed = FALSE;
- mrcp_message_t *response = mrcp_response_create(request,request->pool);
- switch(request->start_line.method_id) {
- case SYNTHESIZER_SET_PARAMS:
- processed = demo_synth_channel_set_params(channel,request,response);
- break;
- case SYNTHESIZER_GET_PARAMS:
- processed = demo_synth_channel_get_params(channel,request,response);
- break;
- case SYNTHESIZER_SPEAK:
- processed = demo_synth_channel_speak(channel,request,response);
- break;
- case SYNTHESIZER_STOP:
- processed = demo_synth_channel_stop(channel,request,response);
- break;
- case SYNTHESIZER_PAUSE:
- processed = demo_synth_channel_pause(channel,request,response);
- break;
- case SYNTHESIZER_RESUME:
- processed = demo_synth_channel_resume(channel,request,response);
- break;
- case SYNTHESIZER_BARGE_IN_OCCURRED:
- processed = demo_synth_channel_stop(channel,request,response);
- break;
- case SYNTHESIZER_CONTROL:
- break;
- case SYNTHESIZER_DEFINE_LEXICON:
- break;
- default:
- break;
- }
- if(processed == FALSE) {
- /* send asynchronous response for not handled request */
- mrcp_engine_channel_message_send(channel,response);
- }
- return TRUE;
-}
-
-/** Callback is called from MPF engine context to destroy any additional data associated with audio stream */
-static apt_bool_t demo_synth_stream_destroy(mpf_audio_stream_t *stream)
-{
- return TRUE;
-}
-
-/** Callback is called from MPF engine context to perform any action before open */
-static apt_bool_t demo_synth_stream_open(mpf_audio_stream_t *stream, mpf_codec_t *codec)
-{
- return TRUE;
-}
-
-/** Callback is called from MPF engine context to perform any action after close */
-static apt_bool_t demo_synth_stream_close(mpf_audio_stream_t *stream)
-{
- return TRUE;
-}
-
-/** Callback is called from MPF engine context to read/get new frame */
-static apt_bool_t demo_synth_stream_read(mpf_audio_stream_t *stream, mpf_frame_t *frame)
-{
- demo_synth_channel_t *synth_channel = stream->obj;
- /* check if STOP was requested */
- if(synth_channel->stop_response) {
- /* send asynchronous response to STOP request */
- mrcp_engine_channel_message_send(synth_channel->channel,synth_channel->stop_response);
- synth_channel->stop_response = NULL;
- synth_channel->speak_request = NULL;
- synth_channel->paused = FALSE;
- if(synth_channel->audio_file) {
- fclose(synth_channel->audio_file);
- synth_channel->audio_file = NULL;
- }
- return TRUE;
- }
-
- /* check if there is active SPEAK request and it isn't in paused state */
- if(synth_channel->speak_request && synth_channel->paused == FALSE) {
- /* normal processing */
- apt_bool_t completed = FALSE;
- if(synth_channel->audio_file) {
- /* read speech from file */
- apr_size_t size = frame->codec_frame.size;
- if(fread(frame->codec_frame.buffer,1,size,synth_channel->audio_file) == size) {
- frame->type |= MEDIA_FRAME_TYPE_AUDIO;
- }
- else {
- completed = TRUE;
- }
- }
- else {
- /* fill with silence in case no file available */
- if(synth_channel->time_to_complete >= CODEC_FRAME_TIME_BASE) {
- memset(frame->codec_frame.buffer,0,frame->codec_frame.size);
- frame->type |= MEDIA_FRAME_TYPE_AUDIO;
- synth_channel->time_to_complete -= CODEC_FRAME_TIME_BASE;
- }
- else {
- completed = TRUE;
- }
- }
-
- if(completed) {
- /* raise SPEAK-COMPLETE event */
- mrcp_message_t *message = mrcp_event_create(
- synth_channel->speak_request,
- SYNTHESIZER_SPEAK_COMPLETE,
- synth_channel->speak_request->pool);
- if(message) {
- /* get/allocate synthesizer header */
- mrcp_synth_header_t *synth_header = mrcp_resource_header_prepare(message);
- if(synth_header) {
- /* set completion cause */
- synth_header->completion_cause = SYNTHESIZER_COMPLETION_CAUSE_NORMAL;
- mrcp_resource_header_property_add(message,SYNTHESIZER_HEADER_COMPLETION_CAUSE);
- }
- /* set request state */
- message->start_line.request_state = MRCP_REQUEST_STATE_COMPLETE;
-
- synth_channel->speak_request = NULL;
- if(synth_channel->audio_file) {
- fclose(synth_channel->audio_file);
- synth_channel->audio_file = NULL;
- }
- /* send asynch event */
- mrcp_engine_channel_message_send(synth_channel->channel,message);
- }
- }
- }
- return TRUE;
-}
-
-static apt_bool_t demo_synth_msg_signal(demo_synth_msg_type_e type, mrcp_engine_channel_t *channel, mrcp_message_t *request)
-{
- apt_bool_t status = FALSE;
- demo_synth_channel_t *demo_channel = channel->method_obj;
- demo_synth_engine_t *demo_engine = demo_channel->demo_engine;
- apt_task_t *task = apt_consumer_task_base_get(demo_engine->task);
- apt_task_msg_t *msg = apt_task_msg_get(task);
- if(msg) {
- demo_synth_msg_t *demo_msg;
- msg->type = TASK_MSG_USER;
- demo_msg = (demo_synth_msg_t*) msg->data;
-
- demo_msg->type = type;
- demo_msg->channel = channel;
- demo_msg->request = request;
- status = apt_task_msg_signal(task,msg);
- }
- return status;
-}
-
-static apt_bool_t demo_synth_msg_process(apt_task_t *task, apt_task_msg_t *msg)
-{
- demo_synth_msg_t *demo_msg = (demo_synth_msg_t*)msg->data;
- switch(demo_msg->type) {
- case DEMO_SYNTH_MSG_OPEN_CHANNEL:
- /* open channel and send asynch response */
- mrcp_engine_channel_open_respond(demo_msg->channel,TRUE);
- break;
- case DEMO_SYNTH_MSG_CLOSE_CHANNEL:
- /* close channel, make sure there is no activity and send asynch response */
- mrcp_engine_channel_close_respond(demo_msg->channel);
- break;
- case DEMO_SYNTH_MSG_REQUEST_PROCESS:
- demo_synth_channel_request_dispatch(demo_msg->channel,demo_msg->request);
- break;
- default:
- break;
- }
- return TRUE;
-}
+++ /dev/null
-AM_CPPFLAGS = $(UNIMRCP_PLUGIN_INCLUDES)
-
-plugin_LTLIBRARIES = demoverifier.la
-
-demoverifier_la_SOURCES = src/demo_verifier_engine.c
-demoverifier_la_LDFLAGS = $(UNIMRCP_PLUGIN_OPTS)
-
-include $(top_srcdir)/build/rules/uniplugin.am
+++ /dev/null
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="demoverifier"
- ProjectGUID="{F7563CAD-5C95-46E5-89B7-0953C6C6E746}"
- RootNamespace="demoverifier"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- <Platform
- Name="x64"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- ConfigurationType="2"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\uniplugin.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="include"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- ConfigurationType="2"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\uniplugin.vsprops"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="include"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|x64"
- ConfigurationType="2"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\uniplugin-x64.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="include"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|x64"
- ConfigurationType="2"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\uniplugin-x64.vsprops"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="include"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="include"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- </Filter>
- <Filter
- Name="src"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- >
- <File
- RelativePath=".\src\demo_verifier_engine.c"
- >
- </File>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{F7563CAD-5C95-46E5-89B7-0953C6C6E746}</ProjectGuid>
- <RootNamespace>demoverifier</RootNamespace>
- <Keyword>Win32Proj</Keyword>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />
- <Import Project="$(ProjectDir)..\..\build\props\uniplugin.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" />
- <Import Project="$(ProjectDir)..\..\build\props\uniplugin.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />
- <Import Project="$(ProjectDir)..\..\build\props\uniplugin-x64.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" />
- <Import Project="$(ProjectDir)..\..\build\props\uniplugin-x64.props" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="src\demo_verifier_engine.c" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\libs\mrcp-engine\mrcpengine.vcxproj">
- <Project>{843425be-9a9a-44f4-a4e3-4b57d6abd53c}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="include">
- <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
- </Filter>
- <Filter Include="src">
- <UniqueIdentifier>{42255732-d637-4aef-ab75-104eb723ff72}</UniqueIdentifier>
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="src\demo_verifier_engine.c">
- <Filter>src</Filter>
- </ClCompile>
- </ItemGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-/*
- * 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: demo_verifier_engine.c 2193 2014-10-08 03:44:33Z achaloyan@gmail.com $
- */
-
-/*
- * Mandatory rules concerning plugin implementation.
- * 1. Each plugin MUST implement a plugin/engine creator function
- * with the exact signature and name (the main entry point)
- * MRCP_PLUGIN_DECLARE(mrcp_engine_t*) mrcp_plugin_create(apr_pool_t *pool)
- * 2. Each plugin MUST declare its version number
- * MRCP_PLUGIN_VERSION_DECLARE
- * 3. One and only one response MUST be sent back to the received request.
- * 4. Methods (callbacks) of the MRCP engine channel MUST not block.
- * (asynchronous response can be sent from the context of other thread)
- * 5. Methods (callbacks) of the MPF engine stream MUST not block.
- */
-
-#include "mrcp_verifier_engine.h"
-#include "mpf_activity_detector.h"
-#include "apt_consumer_task.h"
-#include "apt_log.h"
-
-#define VERIFIER_ENGINE_TASK_NAME "Demo Verifier Engine"
-
-typedef struct demo_verifier_engine_t demo_verifier_engine_t;
-typedef struct demo_verifier_channel_t demo_verifier_channel_t;
-typedef struct demo_verifier_msg_t demo_verifier_msg_t;
-
-/** Declaration of verification engine methods */
-static apt_bool_t demo_verifier_engine_destroy(mrcp_engine_t *engine);
-static apt_bool_t demo_verifier_engine_open(mrcp_engine_t *engine);
-static apt_bool_t demo_verifier_engine_close(mrcp_engine_t *engine);
-static mrcp_engine_channel_t* demo_verifier_engine_channel_create(mrcp_engine_t *engine, apr_pool_t *pool);
-
-static const struct mrcp_engine_method_vtable_t engine_vtable = {
- demo_verifier_engine_destroy,
- demo_verifier_engine_open,
- demo_verifier_engine_close,
- demo_verifier_engine_channel_create
-};
-
-
-/** Declaration of verification channel methods */
-static apt_bool_t demo_verifier_channel_destroy(mrcp_engine_channel_t *channel);
-static apt_bool_t demo_verifier_channel_open(mrcp_engine_channel_t *channel);
-static apt_bool_t demo_verifier_channel_close(mrcp_engine_channel_t *channel);
-static apt_bool_t demo_verifier_channel_request_process(mrcp_engine_channel_t *channel, mrcp_message_t *request);
-
-static const struct mrcp_engine_channel_method_vtable_t channel_vtable = {
- demo_verifier_channel_destroy,
- demo_verifier_channel_open,
- demo_verifier_channel_close,
- demo_verifier_channel_request_process
-};
-
-/** Declaration of verification audio stream methods */
-static apt_bool_t demo_verifier_stream_destroy(mpf_audio_stream_t *stream);
-static apt_bool_t demo_verifier_stream_open(mpf_audio_stream_t *stream, mpf_codec_t *codec);
-static apt_bool_t demo_verifier_stream_close(mpf_audio_stream_t *stream);
-static apt_bool_t demo_verifier_stream_write(mpf_audio_stream_t *stream, const mpf_frame_t *frame);
-
-static const mpf_audio_stream_vtable_t audio_stream_vtable = {
- demo_verifier_stream_destroy,
- NULL,
- NULL,
- NULL,
- demo_verifier_stream_open,
- demo_verifier_stream_close,
- demo_verifier_stream_write,
- NULL
-};
-
-/** Declaration of demo verification engine */
-struct demo_verifier_engine_t {
- apt_consumer_task_t *task;
-};
-
-/** Declaration of demo verification channel */
-struct demo_verifier_channel_t {
- /** Back pointer to engine */
- demo_verifier_engine_t *demo_engine;
- /** Engine channel base */
- mrcp_engine_channel_t *channel;
-
- /** Active (in-progress) verification request */
- mrcp_message_t *verifier_request;
- /** Pending stop response */
- mrcp_message_t *stop_response;
- /** Indicates whether input timers are started */
- apt_bool_t timers_started;
- /** Voice activity detector */
- mpf_activity_detector_t *detector;
- /** File to write voiceprint to */
- FILE *audio_out;
-};
-
-typedef enum {
- DEMO_VERIF_MSG_OPEN_CHANNEL,
- DEMO_VERIF_MSG_CLOSE_CHANNEL,
- DEMO_VERIF_MSG_REQUEST_PROCESS
-} demo_verifier_msg_type_e;
-
-/** Declaration of demo verification task message */
-struct demo_verifier_msg_t {
- demo_verifier_msg_type_e type;
- mrcp_engine_channel_t *channel;
- mrcp_message_t *request;
-};
-
-static apt_bool_t demo_verifier_msg_signal(demo_verifier_msg_type_e type, mrcp_engine_channel_t *channel, mrcp_message_t *request);
-static apt_bool_t demo_verifier_msg_process(apt_task_t *task, apt_task_msg_t *msg);
-
-static apt_bool_t demo_verifier_result_load(demo_verifier_channel_t *verifier_channel, mrcp_message_t *message);
-
-/** Declare this macro to set plugin version */
-MRCP_PLUGIN_VERSION_DECLARE
-
-/** Declare this macro to use log routine of the server, plugin is loaded from */
-MRCP_PLUGIN_LOGGER_IMPLEMENT
-
-/** Create demo verification engine */
-MRCP_PLUGIN_DECLARE(mrcp_engine_t*) mrcp_plugin_create(apr_pool_t *pool)
-{
- demo_verifier_engine_t *demo_engine = apr_palloc(pool,sizeof(demo_verifier_engine_t));
- apt_task_t *task;
- apt_task_vtable_t *vtable;
- apt_task_msg_pool_t *msg_pool;
-
- msg_pool = apt_task_msg_pool_create_dynamic(sizeof(demo_verifier_msg_t),pool);
- demo_engine->task = apt_consumer_task_create(demo_engine,msg_pool,pool);
- if(!demo_engine->task) {
- return NULL;
- }
- task = apt_consumer_task_base_get(demo_engine->task);
- apt_task_name_set(task,VERIFIER_ENGINE_TASK_NAME);
- vtable = apt_task_vtable_get(task);
- if(vtable) {
- vtable->process_msg = demo_verifier_msg_process;
- }
-
- /* create engine base */
- return mrcp_engine_create(
- MRCP_VERIFIER_RESOURCE, /* MRCP resource identifier */
- demo_engine, /* object to associate */
- &engine_vtable, /* virtual methods table of engine */
- pool); /* pool to allocate memory from */
-}
-
-/** Destroy verification engine */
-static apt_bool_t demo_verifier_engine_destroy(mrcp_engine_t *engine)
-{
- demo_verifier_engine_t *demo_engine = engine->obj;
- if(demo_engine->task) {
- apt_task_t *task = apt_consumer_task_base_get(demo_engine->task);
- apt_task_destroy(task);
- demo_engine->task = NULL;
- }
- return TRUE;
-}
-
-/** Open verification engine */
-static apt_bool_t demo_verifier_engine_open(mrcp_engine_t *engine)
-{
- demo_verifier_engine_t *demo_engine = engine->obj;
- if(demo_engine->task) {
- apt_task_t *task = apt_consumer_task_base_get(demo_engine->task);
- apt_task_start(task);
- }
- return mrcp_engine_open_respond(engine,TRUE);
-}
-
-/** Close verification engine */
-static apt_bool_t demo_verifier_engine_close(mrcp_engine_t *engine)
-{
- demo_verifier_engine_t *demo_engine = engine->obj;
- if(demo_engine->task) {
- apt_task_t *task = apt_consumer_task_base_get(demo_engine->task);
- apt_task_terminate(task,TRUE);
- }
- return mrcp_engine_close_respond(engine);
-}
-
-static mrcp_engine_channel_t* demo_verifier_engine_channel_create(mrcp_engine_t *engine, apr_pool_t *pool)
-{
- mpf_stream_capabilities_t *capabilities;
- mpf_termination_t *termination;
-
- /* create demo verification channel */
- demo_verifier_channel_t *verifier_channel = apr_palloc(pool,sizeof(demo_verifier_channel_t));
- verifier_channel->demo_engine = engine->obj;
- verifier_channel->verifier_request = NULL;
- verifier_channel->stop_response = NULL;
- verifier_channel->detector = mpf_activity_detector_create(pool);
- verifier_channel->audio_out = NULL;
-
- capabilities = mpf_sink_stream_capabilities_create(pool);
- mpf_codec_capabilities_add(
- &capabilities->codecs,
- MPF_SAMPLE_RATE_8000 | MPF_SAMPLE_RATE_16000,
- "LPCM");
-
- /* create media termination */
- termination = mrcp_engine_audio_termination_create(
- verifier_channel, /* object to associate */
- &audio_stream_vtable, /* virtual methods table of audio stream */
- capabilities, /* stream capabilities */
- pool); /* pool to allocate memory from */
-
- /* create engine channel base */
- verifier_channel->channel = mrcp_engine_channel_create(
- engine, /* engine */
- &channel_vtable, /* virtual methods table of engine channel */
- verifier_channel, /* object to associate */
- termination, /* associated media termination */
- pool); /* pool to allocate memory from */
-
- return verifier_channel->channel;
-}
-
-/** Destroy engine channel */
-static apt_bool_t demo_verifier_channel_destroy(mrcp_engine_channel_t *channel)
-{
- /* nothing to destrtoy */
- return TRUE;
-}
-
-/** Open engine channel (asynchronous response MUST be sent)*/
-static apt_bool_t demo_verifier_channel_open(mrcp_engine_channel_t *channel)
-{
- return demo_verifier_msg_signal(DEMO_VERIF_MSG_OPEN_CHANNEL,channel,NULL);
-}
-
-/** Close engine channel (asynchronous response MUST be sent)*/
-static apt_bool_t demo_verifier_channel_close(mrcp_engine_channel_t *channel)
-{
- return demo_verifier_msg_signal(DEMO_VERIF_MSG_CLOSE_CHANNEL,channel,NULL);
-}
-
-/** Process MRCP channel request (asynchronous response MUST be sent)*/
-static apt_bool_t demo_verifier_channel_request_process(mrcp_engine_channel_t *channel, mrcp_message_t *request)
-{
- return demo_verifier_msg_signal(DEMO_VERIF_MSG_REQUEST_PROCESS,channel,request);
-}
-
-/** Process VERIFY request */
-static apt_bool_t demo_verifier_channel_verify(mrcp_engine_channel_t *channel, mrcp_message_t *request, mrcp_message_t *response)
-{
- /* process verify request */
- mrcp_verifier_header_t *verifier_header;
- demo_verifier_channel_t *verifier_channel = channel->method_obj;
- const mpf_codec_descriptor_t *descriptor = mrcp_engine_sink_stream_codec_get(channel);
-
- if(!descriptor) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Get Codec Descriptor "APT_SIDRES_FMT, MRCP_MESSAGE_SIDRES(request));
- response->start_line.status_code = MRCP_STATUS_CODE_METHOD_FAILED;
- return FALSE;
- }
-
- verifier_channel->timers_started = TRUE;
-
- /* get verifier header */
- verifier_header = mrcp_resource_header_get(request);
- if(verifier_header) {
- if(mrcp_resource_header_property_check(request,VERIFIER_HEADER_START_INPUT_TIMERS) == TRUE) {
- verifier_channel->timers_started = verifier_header->start_input_timers;
- }
- if(mrcp_resource_header_property_check(request,VERIFIER_HEADER_NO_INPUT_TIMEOUT) == TRUE) {
- mpf_activity_detector_noinput_timeout_set(verifier_channel->detector,verifier_header->no_input_timeout);
- }
- if(mrcp_resource_header_property_check(request,VERIFIER_HEADER_SPEECH_COMPLETE_TIMEOUT) == TRUE) {
- mpf_activity_detector_silence_timeout_set(verifier_channel->detector,verifier_header->speech_complete_timeout);
- }
- }
-
- if(!verifier_channel->audio_out) {
- const apt_dir_layout_t *dir_layout = channel->engine->dir_layout;
- char *file_name = apr_psprintf(channel->pool,"voiceprint-%dkHz-%s.pcm",
- descriptor->sampling_rate/1000,
- request->channel_id.session_id.buf);
- char *file_path = apt_vardir_filepath_get(dir_layout,file_name,channel->pool);
- if(file_path) {
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Open Utterance Output File [%s] for Writing",file_path);
- verifier_channel->audio_out = fopen(file_path,"wb");
- if(!verifier_channel->audio_out) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Open Utterance Output File [%s] for Writing",file_path);
- }
- }
- }
-
- response->start_line.request_state = MRCP_REQUEST_STATE_INPROGRESS;
- /* send asynchronous response */
- mrcp_engine_channel_message_send(channel,response);
- verifier_channel->verifier_request = request;
- return TRUE;
-}
-
-/** Process STOP request */
-static apt_bool_t demo_verifier_channel_stop(mrcp_engine_channel_t *channel, mrcp_message_t *request, mrcp_message_t *response)
-{
- /* process STOP request */
- demo_verifier_channel_t *verifier_channel = channel->method_obj;
- /* store STOP request, make sure there is no more activity and only then send the response */
- verifier_channel->stop_response = response;
- return TRUE;
-}
-
-/** Process START-INPUT-TIMERS request */
-static apt_bool_t demo_verifier_channel_timers_start(mrcp_engine_channel_t *channel, mrcp_message_t *request, mrcp_message_t *response)
-{
- demo_verifier_channel_t *verifier_channel = channel->method_obj;
- verifier_channel->timers_started = TRUE;
- return mrcp_engine_channel_message_send(channel,response);
-}
-
-/** Process GET-INTERMEDIATE-RESULT request */
-static apt_bool_t demo_verifier_channel_get_result(mrcp_engine_channel_t *channel, mrcp_message_t *request, mrcp_message_t *response)
-{
- demo_verifier_channel_t *verifier_channel = channel->method_obj;
- demo_verifier_result_load(verifier_channel,response);
- return mrcp_engine_channel_message_send(channel,response);
-}
-
-
-/** Dispatch MRCP request */
-static apt_bool_t demo_verifier_channel_request_dispatch(mrcp_engine_channel_t *channel, mrcp_message_t *request)
-{
- apt_bool_t processed = FALSE;
- mrcp_message_t *response = mrcp_response_create(request,request->pool);
- switch(request->start_line.method_id) {
- case VERIFIER_SET_PARAMS:
- break;
- case VERIFIER_GET_PARAMS:
- break;
- case VERIFIER_START_SESSION:
- break;
- case VERIFIER_END_SESSION:
- break;
- case VERIFIER_QUERY_VOICEPRINT:
- break;
- case VERIFIER_DELETE_VOICEPRINT:
- break;
- case VERIFIER_VERIFY:
- processed = demo_verifier_channel_verify(channel,request,response);
- break;
- case VERIFIER_VERIFY_FROM_BUFFER:
- break;
- case VERIFIER_VERIFY_ROLLBACK:
- break;
- case VERIFIER_STOP:
- processed = demo_verifier_channel_stop(channel,request,response);
- break;
- case VERIFIER_CLEAR_BUFFER:
- break;
- case VERIFIER_START_INPUT_TIMERS:
- processed = demo_verifier_channel_timers_start(channel,request,response);
- break;
- case VERIFIER_GET_INTERMIDIATE_RESULT:
- processed = demo_verifier_channel_get_result(channel,request,response);
- break;
-
- default:
- break;
- }
- if(processed == FALSE) {
- /* send asynchronous response for not handled request */
- mrcp_engine_channel_message_send(channel,response);
- }
- return TRUE;
-}
-
-/** Callback is called from MPF engine context to destroy any additional data associated with audio stream */
-static apt_bool_t demo_verifier_stream_destroy(mpf_audio_stream_t *stream)
-{
- return TRUE;
-}
-
-/** Callback is called from MPF engine context to perform any action before open */
-static apt_bool_t demo_verifier_stream_open(mpf_audio_stream_t *stream, mpf_codec_t *codec)
-{
- return TRUE;
-}
-
-/** Callback is called from MPF engine context to perform any action after close */
-static apt_bool_t demo_verifier_stream_close(mpf_audio_stream_t *stream)
-{
- return TRUE;
-}
-
-/* Raise demo START-OF-INPUT event */
-static apt_bool_t demo_verifier_start_of_input(demo_verifier_channel_t *verifier_channel)
-{
- /* create START-OF-INPUT event */
- mrcp_message_t *message = mrcp_event_create(
- verifier_channel->verifier_request,
- VERIFIER_START_OF_INPUT,
- verifier_channel->verifier_request->pool);
- if(!message) {
- return FALSE;
- }
-
- /* set request state */
- message->start_line.request_state = MRCP_REQUEST_STATE_INPROGRESS;
- /* send asynch event */
- return mrcp_engine_channel_message_send(verifier_channel->channel,message);
-}
-
-/* Load demo verification result */
-static apt_bool_t demo_verifier_result_load(demo_verifier_channel_t *verifier_channel, mrcp_message_t *message)
-{
- FILE *file;
- mrcp_engine_channel_t *channel = verifier_channel->channel;
- const apt_dir_layout_t *dir_layout = channel->engine->dir_layout;
- char *file_path = apt_datadir_filepath_get(dir_layout,"result-verification.xml",message->pool);
- if(!file_path) {
- return FALSE;
- }
-
- /* read the demo result from file */
- file = fopen(file_path,"r");
- if(file) {
- mrcp_generic_header_t *generic_header;
- char text[1024];
- apr_size_t size;
- size = fread(text,1,sizeof(text),file);
- apt_string_assign_n(&message->body,text,size,message->pool);
- fclose(file);
-
- /* get/allocate generic header */
- generic_header = mrcp_generic_header_prepare(message);
- if(generic_header) {
- /* set content types */
- apt_string_assign(&generic_header->content_type,"application/nlsml+xml",message->pool);
- mrcp_generic_header_property_add(message,GENERIC_HEADER_CONTENT_TYPE);
- }
- }
- return TRUE;
-}
-
-/* Raise demo VERIFICATION-COMPLETE event */
-static apt_bool_t demo_verifier_verification_complete(demo_verifier_channel_t *verifier_channel, mrcp_verifier_completion_cause_e cause)
-{
- mrcp_verifier_header_t *verifier_header;
- /* create VERIFICATION-COMPLETE event */
- mrcp_message_t *message = mrcp_event_create(
- verifier_channel->verifier_request,
- VERIFIER_VERIFICATION_COMPLETE,
- verifier_channel->verifier_request->pool);
- if(!message) {
- return FALSE;
- }
-
- /* get/allocate verifier header */
- verifier_header = mrcp_resource_header_prepare(message);
- if(verifier_header) {
- /* set completion cause */
- verifier_header->completion_cause = cause;
- mrcp_resource_header_property_add(message,VERIFIER_HEADER_COMPLETION_CAUSE);
- }
- /* set request state */
- message->start_line.request_state = MRCP_REQUEST_STATE_COMPLETE;
-
- if(cause == VERIFIER_COMPLETION_CAUSE_SUCCESS) {
- demo_verifier_result_load(verifier_channel,message);
- }
-
- verifier_channel->verifier_request = NULL;
- /* send asynch event */
- return mrcp_engine_channel_message_send(verifier_channel->channel,message);
-}
-
-/** Callback is called from MPF engine context to write/send new frame */
-static apt_bool_t demo_verifier_stream_write(mpf_audio_stream_t *stream, const mpf_frame_t *frame)
-{
- demo_verifier_channel_t *verifier_channel = stream->obj;
- if(verifier_channel->stop_response) {
- /* send asynchronous response to STOP request */
- mrcp_engine_channel_message_send(verifier_channel->channel,verifier_channel->stop_response);
- verifier_channel->stop_response = NULL;
- verifier_channel->verifier_request = NULL;
- return TRUE;
- }
-
- if(verifier_channel->verifier_request) {
- mpf_detector_event_e det_event = mpf_activity_detector_process(verifier_channel->detector,frame);
- switch(det_event) {
- case MPF_DETECTOR_EVENT_ACTIVITY:
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Detected Voice Activity "APT_SIDRES_FMT,
- MRCP_MESSAGE_SIDRES(verifier_channel->verifier_request));
- demo_verifier_start_of_input(verifier_channel);
- break;
- case MPF_DETECTOR_EVENT_INACTIVITY:
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Detected Voice Inactivity "APT_SIDRES_FMT,
- MRCP_MESSAGE_SIDRES(verifier_channel->verifier_request));
- demo_verifier_verification_complete(verifier_channel,VERIFIER_COMPLETION_CAUSE_SUCCESS);
- break;
- case MPF_DETECTOR_EVENT_NOINPUT:
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Detected Noinput "APT_SIDRES_FMT,
- MRCP_MESSAGE_SIDRES(verifier_channel->verifier_request));
- if(verifier_channel->timers_started == TRUE) {
- demo_verifier_verification_complete(verifier_channel,VERIFIER_COMPLETION_CAUSE_NO_INPUT_TIMEOUT);
- }
- break;
- default:
- break;
- }
-
- if((frame->type & MEDIA_FRAME_TYPE_EVENT) == MEDIA_FRAME_TYPE_EVENT) {
- if(frame->marker == MPF_MARKER_START_OF_EVENT) {
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Detected Start of Event "APT_SIDRES_FMT" id:%d",
- MRCP_MESSAGE_SIDRES(verifier_channel->verifier_request),
- frame->event_frame.event_id);
- }
- else if(frame->marker == MPF_MARKER_END_OF_EVENT) {
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Detected End of Event "APT_SIDRES_FMT" id:%d duration:%d ts",
- MRCP_MESSAGE_SIDRES(verifier_channel->verifier_request),
- frame->event_frame.event_id,
- frame->event_frame.duration);
- }
- }
-
- if(verifier_channel->audio_out) {
- fwrite(frame->codec_frame.buffer,1,frame->codec_frame.size,verifier_channel->audio_out);
- }
- }
- return TRUE;
-}
-
-static apt_bool_t demo_verifier_msg_signal(demo_verifier_msg_type_e type, mrcp_engine_channel_t *channel, mrcp_message_t *request)
-{
- apt_bool_t status = FALSE;
- demo_verifier_channel_t *demo_channel = channel->method_obj;
- demo_verifier_engine_t *demo_engine = demo_channel->demo_engine;
- apt_task_t *task = apt_consumer_task_base_get(demo_engine->task);
- apt_task_msg_t *msg = apt_task_msg_get(task);
- if(msg) {
- demo_verifier_msg_t *demo_msg;
- msg->type = TASK_MSG_USER;
- demo_msg = (demo_verifier_msg_t*) msg->data;
-
- demo_msg->type = type;
- demo_msg->channel = channel;
- demo_msg->request = request;
- status = apt_task_msg_signal(task,msg);
- }
- return status;
-}
-
-static apt_bool_t demo_verifier_msg_process(apt_task_t *task, apt_task_msg_t *msg)
-{
- demo_verifier_msg_t *demo_msg = (demo_verifier_msg_t*)msg->data;
- switch(demo_msg->type) {
- case DEMO_VERIF_MSG_OPEN_CHANNEL:
- /* open channel and send asynch response */
- mrcp_engine_channel_open_respond(demo_msg->channel,TRUE);
- break;
- case DEMO_VERIF_MSG_CLOSE_CHANNEL:
- {
- /* close channel, make sure there is no activity and send asynch response */
- demo_verifier_channel_t *verifier_channel = demo_msg->channel->method_obj;
- if(verifier_channel->audio_out) {
- fclose(verifier_channel->audio_out);
- verifier_channel->audio_out = NULL;
- }
-
- mrcp_engine_channel_close_respond(demo_msg->channel);
- break;
- }
- case DEMO_VERIF_MSG_REQUEST_PROCESS:
- demo_verifier_channel_request_dispatch(demo_msg->channel,demo_msg->request);
- break;
- default:
- break;
- }
- return TRUE;
-}
+++ /dev/null
-AM_CPPFLAGS = $(UNIMRCP_PLUGIN_INCLUDES)
-
-plugin_LTLIBRARIES = mrcprecorder.la
-
-mrcprecorder_la_SOURCES = src/mrcp_recorder_engine.c
-mrcprecorder_la_LDFLAGS = $(UNIMRCP_PLUGIN_OPTS)
-
-include $(top_srcdir)/build/rules/uniplugin.am
+++ /dev/null
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="mrcprecorder"
- ProjectGUID="{5AFB8B04-AEB9-408C-B53E-AFBC44B5F3F2}"
- RootNamespace="mrcprecorder"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- <Platform
- Name="x64"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- ConfigurationType="2"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\uniplugin.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="include"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- ConfigurationType="2"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\uniplugin.vsprops"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="include"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|x64"
- ConfigurationType="2"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\uniplugin-x64.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="include"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|x64"
- ConfigurationType="2"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\uniplugin-x64.vsprops"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="include"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="include"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- </Filter>
- <Filter
- Name="src"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- >
- <File
- RelativePath=".\src\mrcp_recorder_engine.c"
- >
- </File>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{5AFB8B04-AEB9-408C-B53E-AFBC44B5F3F2}</ProjectGuid>
- <RootNamespace>mrcprecorder</RootNamespace>
- <Keyword>Win32Proj</Keyword>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />
- <Import Project="$(ProjectDir)..\..\build\props\uniplugin.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" />
- <Import Project="$(ProjectDir)..\..\build\props\uniplugin.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />
- <Import Project="$(ProjectDir)..\..\build\props\uniplugin-x64.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" />
- <Import Project="$(ProjectDir)..\..\build\props\uniplugin-x64.props" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <AdditionalIncludeDirectories>include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- </ClCompile>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="src\mrcp_recorder_engine.c" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\libs\mrcp-engine\mrcpengine.vcxproj">
- <Project>{843425be-9a9a-44f4-a4e3-4b57d6abd53c}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="include">
- <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
- </Filter>
- <Filter Include="src">
- <UniqueIdentifier>{b1d2c804-b3bb-4413-8d11-7ff67d4e874c}</UniqueIdentifier>
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="src\mrcp_recorder_engine.c">
- <Filter>src</Filter>
- </ClCompile>
- </ItemGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-/*
- * 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.c 2193 2014-10-08 03:44:33Z achaloyan@gmail.com $
- */
-
-/*
- * Mandatory rules concerning plugin implementation.
- * 1. Each plugin MUST implement a plugin/engine creator function
- * with the exact signature and name (the main entry point)
- * MRCP_PLUGIN_DECLARE(mrcp_engine_t*) mrcp_plugin_create(apr_pool_t *pool)
- * 2. Each plugin MUST declare its version number
- * MRCP_PLUGIN_VERSION_DECLARE
- * 3. One and only one response MUST be sent back to the received request.
- * 4. Methods (callbacks) of the MRCP engine channel MUST not block.
- * (asynchronous response can be sent from the context of other thread)
- * 5. Methods (callbacks) of the MPF engine stream MUST not block.
- */
-
-#include "mrcp_recorder_engine.h"
-#include "mpf_activity_detector.h"
-#include "apt_log.h"
-
-#define RECORDER_ENGINE_TASK_NAME "Recorder Engine"
-
-typedef struct recorder_channel_t recorder_channel_t;
-
-/** Declaration of recorder engine methods */
-static apt_bool_t recorder_engine_destroy(mrcp_engine_t *engine);
-static apt_bool_t recorder_engine_open(mrcp_engine_t *engine);
-static apt_bool_t recorder_engine_close(mrcp_engine_t *engine);
-static mrcp_engine_channel_t* recorder_engine_channel_create(mrcp_engine_t *engine, apr_pool_t *pool);
-
-static const struct mrcp_engine_method_vtable_t engine_vtable = {
- recorder_engine_destroy,
- recorder_engine_open,
- recorder_engine_close,
- recorder_engine_channel_create
-};
-
-
-/** Declaration of recorder channel methods */
-static apt_bool_t recorder_channel_destroy(mrcp_engine_channel_t *channel);
-static apt_bool_t recorder_channel_open(mrcp_engine_channel_t *channel);
-static apt_bool_t recorder_channel_close(mrcp_engine_channel_t *channel);
-static apt_bool_t recorder_channel_request_process(mrcp_engine_channel_t *channel, mrcp_message_t *request);
-
-static const struct mrcp_engine_channel_method_vtable_t channel_vtable = {
- recorder_channel_destroy,
- recorder_channel_open,
- recorder_channel_close,
- recorder_channel_request_process
-};
-
-/** Declaration of recorder audio stream methods */
-static apt_bool_t recorder_stream_destroy(mpf_audio_stream_t *stream);
-static apt_bool_t recorder_stream_open(mpf_audio_stream_t *stream, mpf_codec_t *codec);
-static apt_bool_t recorder_stream_close(mpf_audio_stream_t *stream);
-static apt_bool_t recorder_stream_write(mpf_audio_stream_t *stream, const mpf_frame_t *frame);
-
-static const mpf_audio_stream_vtable_t audio_stream_vtable = {
- recorder_stream_destroy,
- NULL,
- NULL,
- NULL,
- recorder_stream_open,
- recorder_stream_close,
- recorder_stream_write,
- NULL
-};
-
-/** Declaration of recorder channel */
-struct recorder_channel_t {
- /** Engine channel base */
- mrcp_engine_channel_t *channel;
-
- /** Active (in-progress) record request */
- mrcp_message_t *record_request;
- /** Pending stop response */
- mrcp_message_t *stop_response;
- /** Indicates whether input timers are started */
- apt_bool_t timers_started;
- /** Voice activity detector */
- mpf_activity_detector_t *detector;
- /** Max length of the recording in msec */
- apr_size_t max_time;
- /** Elapsed time of the recording in msec */
- apr_size_t cur_time;
- /** Written size of the recording in bytes */
- apr_size_t cur_size;
- /** File name of the recording */
- const char *file_name;
- /** File to write to */
- FILE *audio_out;
-};
-
-
-/** Declare this macro to set plugin version */
-MRCP_PLUGIN_VERSION_DECLARE
-
-/** Declare this macro to use log routine of the server, plugin is loaded from */
-MRCP_PLUGIN_LOGGER_IMPLEMENT
-
-/** Create recorder engine */
-MRCP_PLUGIN_DECLARE(mrcp_engine_t*) mrcp_plugin_create(apr_pool_t *pool)
-{
- /* create engine base */
- return mrcp_engine_create(
- MRCP_RECORDER_RESOURCE, /* MRCP resource identifier */
- NULL, /* object to associate */
- &engine_vtable, /* virtual methods table of engine */
- pool); /* pool to allocate memory from */
-}
-
-/** Destroy recorder engine */
-static apt_bool_t recorder_engine_destroy(mrcp_engine_t *engine)
-{
- return TRUE;
-}
-
-/** Open recorder engine */
-static apt_bool_t recorder_engine_open(mrcp_engine_t *engine)
-{
- return mrcp_engine_open_respond(engine,TRUE);
-}
-
-/** Close recorder engine */
-static apt_bool_t recorder_engine_close(mrcp_engine_t *engine)
-{
- return mrcp_engine_close_respond(engine);
-}
-
-static mrcp_engine_channel_t* recorder_engine_channel_create(mrcp_engine_t *engine, apr_pool_t *pool)
-{
- mpf_stream_capabilities_t *capabilities;
- mpf_termination_t *termination;
-
- /* create recorder channel */
- recorder_channel_t *recorder_channel = apr_palloc(pool,sizeof(recorder_channel_t));
- recorder_channel->record_request = NULL;
- recorder_channel->stop_response = NULL;
- recorder_channel->detector = mpf_activity_detector_create(pool);
- recorder_channel->max_time = 0;
- recorder_channel->cur_time = 0;
- recorder_channel->cur_size = 0;
- recorder_channel->file_name = NULL;
- recorder_channel->audio_out = NULL;
-
- capabilities = mpf_sink_stream_capabilities_create(pool);
- mpf_codec_capabilities_add(
- &capabilities->codecs,
- MPF_SAMPLE_RATE_8000 | MPF_SAMPLE_RATE_16000,
- "LPCM");
-
- /* create media termination */
- termination = mrcp_engine_audio_termination_create(
- recorder_channel, /* object to associate */
- &audio_stream_vtable, /* virtual methods table of audio stream */
- capabilities, /* stream capabilities */
- pool); /* pool to allocate memory from */
-
- /* create engine channel base */
- recorder_channel->channel = mrcp_engine_channel_create(
- engine, /* engine */
- &channel_vtable, /* virtual methods table of engine channel */
- recorder_channel, /* object to associate */
- termination, /* associated media termination */
- pool); /* pool to allocate memory from */
-
- return recorder_channel->channel;
-}
-
-/** Destroy engine channel */
-static apt_bool_t recorder_channel_destroy(mrcp_engine_channel_t *channel)
-{
- /* nothing to destrtoy */
- return TRUE;
-}
-
-/** Open engine channel (asynchronous response MUST be sent)*/
-static apt_bool_t recorder_channel_open(mrcp_engine_channel_t *channel)
-{
- /* open channel and send asynch response */
- return mrcp_engine_channel_open_respond(channel,TRUE);
-}
-
-/** Close engine channel (asynchronous response MUST be sent)*/
-static apt_bool_t recorder_channel_close(mrcp_engine_channel_t *channel)
-{
- /* close channel, make sure there is no activity and send asynch response */
- return mrcp_engine_channel_close_respond(channel);
-}
-
-/** Open file to record */
-static apt_bool_t recorder_file_open(recorder_channel_t *recorder_channel, mrcp_message_t *request)
-{
- char *file_path;
- char *file_name;
- mrcp_engine_channel_t *channel = recorder_channel->channel;
- const apt_dir_layout_t *dir_layout = channel->engine->dir_layout;
- const mpf_codec_descriptor_t *descriptor = mrcp_engine_sink_stream_codec_get(channel);
-
- if(!descriptor) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Get Codec Descriptor "APT_SIDRES_FMT, MRCP_MESSAGE_SIDRES(request));
- return FALSE;
- }
-
- file_name = apr_psprintf(channel->pool,"rec-%dkHz-%s-%"MRCP_REQUEST_ID_FMT".pcm",
- descriptor->sampling_rate/1000,
- request->channel_id.session_id.buf,
- request->start_line.request_id);
- file_path = apt_vardir_filepath_get(dir_layout,file_name,channel->pool);
- if(!file_path) {
- return FALSE;
- }
-
- if(recorder_channel->audio_out) {
- fclose(recorder_channel->audio_out);
- recorder_channel->audio_out = NULL;
- }
-
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Open Utterance Output File [%s] for Writing",file_path);
- recorder_channel->audio_out = fopen(file_path,"wb");
- if(!recorder_channel->audio_out) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Open Utterance Output File [%s] for Writing",file_path);
- return FALSE;
- }
-
- recorder_channel->file_name = file_name;
- return TRUE;
-}
-
-/** Set Record-URI header field */
-static apt_bool_t recorder_channel_uri_set(recorder_channel_t *recorder_channel, mrcp_message_t *message)
-{
- char *record_uri;
- /* get/allocate recorder header */
- mrcp_recorder_header_t *recorder_header = mrcp_resource_header_prepare(message);
- if(!recorder_header) {
- return FALSE;
- }
-
- record_uri = apr_psprintf(
- message->pool,
- "<file://mediaserver/data/%s>;size=%"APR_SIZE_T_FMT";duration=%"APR_SIZE_T_FMT,
- recorder_channel->file_name,
- recorder_channel->cur_size,
- recorder_channel->cur_time);
-
- apt_string_set(&recorder_header->record_uri,record_uri);
- mrcp_resource_header_property_add(message,RECORDER_HEADER_RECORD_URI);
- return TRUE;
-}
-
-/** Process RECORD request */
-static apt_bool_t recorder_channel_record(recorder_channel_t *recorder_channel, mrcp_message_t *request, mrcp_message_t *response)
-{
- /* process RECORD request */
- mrcp_recorder_header_t *recorder_header;
- recorder_channel->timers_started = TRUE;
-
- /* get recorder header */
- recorder_header = mrcp_resource_header_get(request);
- if(recorder_header) {
- if(mrcp_resource_header_property_check(request,RECORDER_HEADER_START_INPUT_TIMERS) == TRUE) {
- recorder_channel->timers_started = recorder_header->start_input_timers;
- }
- if(mrcp_resource_header_property_check(request,RECORDER_HEADER_NO_INPUT_TIMEOUT) == TRUE) {
- mpf_activity_detector_noinput_timeout_set(recorder_channel->detector,recorder_header->no_input_timeout);
- }
- if(mrcp_resource_header_property_check(request,RECORDER_HEADER_FINAL_SILENCE) == TRUE) {
- mpf_activity_detector_silence_timeout_set(recorder_channel->detector,recorder_header->final_silence);
- }
- if(mrcp_resource_header_property_check(request,RECORDER_HEADER_MAX_TIME) == TRUE) {
- recorder_channel->max_time = recorder_header->max_time;
- }
- }
-
- /* open file to record */
- if(recorder_file_open(recorder_channel,request) == FALSE) {
- response->start_line.request_state = MRCP_REQUEST_STATE_COMPLETE;
- response->start_line.status_code = MRCP_STATUS_CODE_METHOD_FAILED;
- /* send asynchronous response */
- mrcp_engine_channel_message_send(recorder_channel->channel,response);
- return TRUE;
- }
-
- recorder_channel->cur_time = 0;
- recorder_channel->cur_size = 0;
- response->start_line.request_state = MRCP_REQUEST_STATE_INPROGRESS;
- /* send asynchronous response */
- mrcp_engine_channel_message_send(recorder_channel->channel,response);
- recorder_channel->record_request = request;
- return TRUE;
-}
-
-/** Process STOP request */
-static apt_bool_t recorder_channel_stop(recorder_channel_t *recorder_channel, mrcp_message_t *request, mrcp_message_t *response)
-{
- /* store STOP request, make sure there is no more activity and only then send the response */
- recorder_channel->stop_response = response;
- return TRUE;
-}
-
-/** Process START-INPUT-TIMERS request */
-static apt_bool_t recorder_channel_timers_start(recorder_channel_t *recorder_channel, mrcp_message_t *request, mrcp_message_t *response)
-{
- recorder_channel->timers_started = TRUE;
- return mrcp_engine_channel_message_send(recorder_channel->channel,response);
-}
-
-/** Process MRCP channel request (asynchronous response MUST be sent)*/
-static apt_bool_t recorder_channel_request_process(mrcp_engine_channel_t *channel, mrcp_message_t *request)
-{
- apt_bool_t processed = FALSE;
- recorder_channel_t *recorder_channel = channel->method_obj;
- mrcp_message_t *response = mrcp_response_create(request,request->pool);
- switch(request->start_line.method_id) {
- case RECORDER_SET_PARAMS:
- break;
- case RECORDER_GET_PARAMS:
- break;
- case RECORDER_RECORD:
- processed = recorder_channel_record(recorder_channel,request,response);
- break;
- case RECORDER_STOP:
- processed = recorder_channel_stop(recorder_channel,request,response);
- break;
- case RECORDER_START_INPUT_TIMERS:
- processed = recorder_channel_timers_start(recorder_channel,request,response);
- break;
- default:
- break;
- }
- if(processed == FALSE) {
- /* send asynchronous response for not handled request */
- mrcp_engine_channel_message_send(channel,response);
- }
- return TRUE;
-}
-
-/* Raise START-OF-INPUT event */
-static apt_bool_t recorder_start_of_input(recorder_channel_t *recorder_channel)
-{
- /* create START-OF-INPUT event */
- mrcp_message_t *message = mrcp_event_create(
- recorder_channel->record_request,
- RECORDER_START_OF_INPUT,
- recorder_channel->record_request->pool);
- if(!message) {
- return FALSE;
- }
-
- /* set request state */
- message->start_line.request_state = MRCP_REQUEST_STATE_INPROGRESS;
- /* send asynch event */
- return mrcp_engine_channel_message_send(recorder_channel->channel,message);
-}
-
-/* Raise RECORD-COMPLETE event */
-static apt_bool_t recorder_record_complete(recorder_channel_t *recorder_channel, mrcp_recorder_completion_cause_e cause)
-{
- mrcp_recorder_header_t *recorder_header;
- /* create RECORD-COMPLETE event */
- mrcp_message_t *message = mrcp_event_create(
- recorder_channel->record_request,
- RECORDER_RECORD_COMPLETE,
- recorder_channel->record_request->pool);
- if(!message) {
- return FALSE;
- }
-
- if(recorder_channel->audio_out) {
- fclose(recorder_channel->audio_out);
- recorder_channel->audio_out = NULL;
- }
-
- /* get/allocate recorder header */
- recorder_header = mrcp_resource_header_prepare(message);
- if(recorder_header) {
- /* set completion cause */
- recorder_header->completion_cause = cause;
- mrcp_resource_header_property_add(message,RECORDER_HEADER_COMPLETION_CAUSE);
- }
- /* set record-uri */
- recorder_channel_uri_set(recorder_channel,message);
- /* set request state */
- message->start_line.request_state = MRCP_REQUEST_STATE_COMPLETE;
-
- recorder_channel->record_request = NULL;
- /* send asynch event */
- return mrcp_engine_channel_message_send(recorder_channel->channel,message);
-}
-
-/** Callback is called from MPF engine context to destroy any additional data associated with audio stream */
-static apt_bool_t recorder_stream_destroy(mpf_audio_stream_t *stream)
-{
- return TRUE;
-}
-
-/** Callback is called from MPF engine context to perform any action before open */
-static apt_bool_t recorder_stream_open(mpf_audio_stream_t *stream, mpf_codec_t *codec)
-{
- return TRUE;
-}
-
-/** Callback is called from MPF engine context to perform any action after close */
-static apt_bool_t recorder_stream_close(mpf_audio_stream_t *stream)
-{
- return TRUE;
-}
-
-/** Callback is called from MPF engine context to write/send new frame */
-static apt_bool_t recorder_stream_write(mpf_audio_stream_t *stream, const mpf_frame_t *frame)
-{
- recorder_channel_t *recorder_channel = stream->obj;
- if(recorder_channel->stop_response) {
- if(recorder_channel->audio_out) {
- fclose(recorder_channel->audio_out);
- recorder_channel->audio_out = NULL;
- }
-
- if(recorder_channel->record_request){
- /* set record-uri */
- recorder_channel_uri_set(recorder_channel,recorder_channel->stop_response);
- }
- /* send asynchronous response to STOP request */
- mrcp_engine_channel_message_send(recorder_channel->channel,recorder_channel->stop_response);
- recorder_channel->stop_response = NULL;
- recorder_channel->record_request = NULL;
- return TRUE;
- }
-
- if(recorder_channel->record_request) {
- mpf_detector_event_e det_event = mpf_activity_detector_process(recorder_channel->detector,frame);
- switch(det_event) {
- case MPF_DETECTOR_EVENT_ACTIVITY:
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Detected Voice Activity "APT_SIDRES_FMT,
- MRCP_MESSAGE_SIDRES(recorder_channel->record_request));
- recorder_start_of_input(recorder_channel);
- break;
- case MPF_DETECTOR_EVENT_INACTIVITY:
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Detected Voice Inactivity "APT_SIDRES_FMT,
- MRCP_MESSAGE_SIDRES(recorder_channel->record_request));
- recorder_record_complete(recorder_channel,RECORDER_COMPLETION_CAUSE_SUCCESS_SILENCE);
- break;
- case MPF_DETECTOR_EVENT_NOINPUT:
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Detected Noinput "APT_SIDRES_FMT,
- MRCP_MESSAGE_SIDRES(recorder_channel->record_request));
- if(recorder_channel->timers_started == TRUE) {
- recorder_record_complete(recorder_channel,RECORDER_COMPLETION_CAUSE_NO_INPUT_TIMEOUT);
- }
- break;
- default:
- break;
- }
-
- if(recorder_channel->audio_out) {
- fwrite(frame->codec_frame.buffer,1,frame->codec_frame.size,recorder_channel->audio_out);
-
- recorder_channel->cur_size += frame->codec_frame.size;
- recorder_channel->cur_time += CODEC_FRAME_TIME_BASE;
- if(recorder_channel->max_time && recorder_channel->cur_time >= recorder_channel->max_time) {
- recorder_record_complete(recorder_channel,RECORDER_COMPLETION_CAUSE_SUCCESS_MAXTIME);
- }
- }
- }
- return TRUE;
-}
+++ /dev/null
-MAINTAINERCLEANFILES = Makefile.in
-
-SUBDIRS = apttest mpftest mrcptest rtsptest strtablegen
+++ /dev/null
-MAINTAINERCLEANFILES = Makefile.in
-
-AM_CPPFLAGS = -I$(top_srcdir)/libs/apr-toolkit/include \
- $(UNIMRCP_APR_INCLUDES)
-
-noinst_PROGRAMS = apttest
-apttest_LDADD = $(top_builddir)/libs/apr-toolkit/libaprtoolkit.la \
- $(UNIMRCP_APR_LIBS)
-apttest_SOURCES = src/main.c \
- src/task_suite.c \
- src/consumer_task_suite.c \
- src/multipart_suite.c
+++ /dev/null
-<?xml version="1.0" encoding="windows-1251"?>\r
-<VisualStudioProject\r
- ProjectType="Visual C++"\r
- Version="8.00"\r
- Name="apttest"\r
- ProjectGUID="{429C907B-97D1-4B2D-9B0E-A14A5BFDAD15}"\r
- RootNamespace="apttest"\r
- >\r
- <Platforms>\r
- <Platform\r
- Name="Win32"\r
- />\r
- <Platform\r
- Name="x64"\r
- />\r
- </Platforms>\r
- <ToolFiles>\r
- </ToolFiles>\r
- <Configurations>\r
- <Configuration\r
- Name="Debug|Win32"\r
- ConfigurationType="1"\r
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unibin.vsprops;$(ProjectDir)..\..\build\vsprops\apt.vsprops"\r
- >\r
- <Tool\r
- Name="VCPreBuildEventTool"\r
- />\r
- <Tool\r
- Name="VCCustomBuildTool"\r
- />\r
- <Tool\r
- Name="VCXMLDataGeneratorTool"\r
- />\r
- <Tool\r
- Name="VCWebServiceProxyGeneratorTool"\r
- />\r
- <Tool\r
- Name="VCMIDLTool"\r
- />\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- />\r
- <Tool\r
- Name="VCManagedResourceCompilerTool"\r
- />\r
- <Tool\r
- Name="VCResourceCompilerTool"\r
- />\r
- <Tool\r
- Name="VCPreLinkEventTool"\r
- />\r
- <Tool\r
- Name="VCLinkerTool"\r
- AdditionalDependencies="aprtoolkit.lib libaprutil-1.lib libapr-1.lib"\r
- />\r
- <Tool\r
- Name="VCALinkTool"\r
- />\r
- <Tool\r
- Name="VCManifestTool"\r
- />\r
- <Tool\r
- Name="VCXDCMakeTool"\r
- />\r
- <Tool\r
- Name="VCBscMakeTool"\r
- />\r
- <Tool\r
- Name="VCFxCopTool"\r
- />\r
- <Tool\r
- Name="VCAppVerifierTool"\r
- />\r
- <Tool\r
- Name="VCWebDeploymentTool"\r
- />\r
- <Tool\r
- Name="VCPostBuildEventTool"\r
- />\r
- </Configuration>\r
- <Configuration\r
- Name="Release|Win32"\r
- ConfigurationType="1"\r
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unibin.vsprops;$(ProjectDir)..\..\build\vsprops\apt.vsprops"\r
- >\r
- <Tool\r
- Name="VCPreBuildEventTool"\r
- />\r
- <Tool\r
- Name="VCCustomBuildTool"\r
- />\r
- <Tool\r
- Name="VCXMLDataGeneratorTool"\r
- />\r
- <Tool\r
- Name="VCWebServiceProxyGeneratorTool"\r
- />\r
- <Tool\r
- Name="VCMIDLTool"\r
- />\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- />\r
- <Tool\r
- Name="VCManagedResourceCompilerTool"\r
- />\r
- <Tool\r
- Name="VCResourceCompilerTool"\r
- />\r
- <Tool\r
- Name="VCPreLinkEventTool"\r
- />\r
- <Tool\r
- Name="VCLinkerTool"\r
- AdditionalDependencies="aprtoolkit.lib libaprutil-1.lib libapr-1.lib"\r
- LinkTimeCodeGeneration="1"\r
- />\r
- <Tool\r
- Name="VCALinkTool"\r
- />\r
- <Tool\r
- Name="VCManifestTool"\r
- />\r
- <Tool\r
- Name="VCXDCMakeTool"\r
- />\r
- <Tool\r
- Name="VCBscMakeTool"\r
- />\r
- <Tool\r
- Name="VCFxCopTool"\r
- />\r
- <Tool\r
- Name="VCAppVerifierTool"\r
- />\r
- <Tool\r
- Name="VCWebDeploymentTool"\r
- />\r
- <Tool\r
- Name="VCPostBuildEventTool"\r
- />\r
- </Configuration>\r
- <Configuration\r
- Name="Debug|x64"\r
- ConfigurationType="1"\r
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unibin-x64.vsprops;$(ProjectDir)..\..\build\vsprops\apt.vsprops"\r
- >\r
- <Tool\r
- Name="VCPreBuildEventTool"\r
- />\r
- <Tool\r
- Name="VCCustomBuildTool"\r
- />\r
- <Tool\r
- Name="VCXMLDataGeneratorTool"\r
- />\r
- <Tool\r
- Name="VCWebServiceProxyGeneratorTool"\r
- />\r
- <Tool\r
- Name="VCMIDLTool"\r
- TargetEnvironment="3"\r
- />\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- DebugInformationFormat="3"\r
- />\r
- <Tool\r
- Name="VCManagedResourceCompilerTool"\r
- />\r
- <Tool\r
- Name="VCResourceCompilerTool"\r
- />\r
- <Tool\r
- Name="VCPreLinkEventTool"\r
- />\r
- <Tool\r
- Name="VCLinkerTool"\r
- AdditionalDependencies="aprtoolkit.lib libaprutil-1.lib libapr-1.lib"\r
- />\r
- <Tool\r
- Name="VCALinkTool"\r
- />\r
- <Tool\r
- Name="VCManifestTool"\r
- />\r
- <Tool\r
- Name="VCXDCMakeTool"\r
- />\r
- <Tool\r
- Name="VCBscMakeTool"\r
- />\r
- <Tool\r
- Name="VCFxCopTool"\r
- />\r
- <Tool\r
- Name="VCAppVerifierTool"\r
- />\r
- <Tool\r
- Name="VCWebDeploymentTool"\r
- />\r
- <Tool\r
- Name="VCPostBuildEventTool"\r
- />\r
- </Configuration>\r
- <Configuration\r
- Name="Release|x64"\r
- ConfigurationType="1"\r
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unibin-x64.vsprops;$(ProjectDir)..\..\build\vsprops\apt.vsprops"\r
- >\r
- <Tool\r
- Name="VCPreBuildEventTool"\r
- />\r
- <Tool\r
- Name="VCCustomBuildTool"\r
- />\r
- <Tool\r
- Name="VCXMLDataGeneratorTool"\r
- />\r
- <Tool\r
- Name="VCWebServiceProxyGeneratorTool"\r
- />\r
- <Tool\r
- Name="VCMIDLTool"\r
- TargetEnvironment="3"\r
- />\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- />\r
- <Tool\r
- Name="VCManagedResourceCompilerTool"\r
- />\r
- <Tool\r
- Name="VCResourceCompilerTool"\r
- />\r
- <Tool\r
- Name="VCPreLinkEventTool"\r
- />\r
- <Tool\r
- Name="VCLinkerTool"\r
- AdditionalDependencies="aprtoolkit.lib libaprutil-1.lib libapr-1.lib"\r
- LinkTimeCodeGeneration="1"\r
- />\r
- <Tool\r
- Name="VCALinkTool"\r
- />\r
- <Tool\r
- Name="VCManifestTool"\r
- />\r
- <Tool\r
- Name="VCXDCMakeTool"\r
- />\r
- <Tool\r
- Name="VCBscMakeTool"\r
- />\r
- <Tool\r
- Name="VCFxCopTool"\r
- />\r
- <Tool\r
- Name="VCAppVerifierTool"\r
- />\r
- <Tool\r
- Name="VCWebDeploymentTool"\r
- />\r
- <Tool\r
- Name="VCPostBuildEventTool"\r
- />\r
- </Configuration>\r
- </Configurations>\r
- <References>\r
- </References>\r
- <Files>\r
- <Filter\r
- Name="src"\r
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"\r
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"\r
- >\r
- <File\r
- RelativePath=".\src\consumer_task_suite.c"\r
- >\r
- </File>\r
- <File\r
- RelativePath=".\src\main.c"\r
- >\r
- </File>\r
- <File\r
- RelativePath=".\src\multipart_suite.c"\r
- >\r
- </File>\r
- <File\r
- RelativePath=".\src\task_suite.c"\r
- >\r
- </File>\r
- </Filter>\r
- <Filter\r
- Name="include"\r
- Filter="h;hpp;hxx;hm;inl;inc;xsd"\r
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"\r
- >\r
- </Filter>\r
- </Files>\r
- <Globals>\r
- </Globals>\r
-</VisualStudioProject>\r
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{429C907B-97D1-4B2D-9B0E-A14A5BFDAD15}</ProjectGuid>
- <RootNamespace>apttest</RootNamespace>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unibin.props" />
- <Import Project="$(ProjectDir)..\..\build\props\apt.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" />
- <Import Project="$(ProjectDir)..\..\build\props\unibin.props" />
- <Import Project="$(ProjectDir)..\..\build\props\apt.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unibin-x64.props" />
- <Import Project="$(ProjectDir)..\..\build\props\apt.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" />
- <Import Project="$(ProjectDir)..\..\build\props\unibin-x64.props" />
- <Import Project="$(ProjectDir)..\..\build\props\apt.props" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <Link>
- <AdditionalDependencies>aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies)</AdditionalDependencies>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <Link>
- <AdditionalDependencies>aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- <Link>
- <AdditionalDependencies>aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies)</AdditionalDependencies>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <Link>
- <AdditionalDependencies>aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
- </Link>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="src\consumer_task_suite.c" />
- <ClCompile Include="src\main.c" />
- <ClCompile Include="src\multipart_suite.c" />
- <ClCompile Include="src\task_suite.c" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\libs\apr-toolkit\aprtoolkit.vcxproj">
- <Project>{13deeca0-bdd4-4744-a1a2-8eb0a44df3d2}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="src">
- <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
- </Filter>
- <Filter Include="include">
- <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="src\consumer_task_suite.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\main.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\multipart_suite.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\task_suite.c">
- <Filter>src</Filter>
- </ClCompile>
- </ItemGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-/*
- * 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: consumer_task_suite.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include <apr_time.h>
-#include "apt_test_suite.h"
-#include "apt_consumer_task.h"
-#include "apt_log.h"
-
-typedef struct {
- apr_time_t timestamp;
- int number;
-} sample_msg_data_t;
-
-static void task_on_start_complete(apt_task_t *task)
-{
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"On Task Start");
-}
-
-static void task_on_terminate_complete(apt_task_t *task)
-{
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"On Task Terminate");
-}
-
-static apt_bool_t task_msg_process(apt_task_t *task, apt_task_msg_t *msg)
-{
- sample_msg_data_t *data = (sample_msg_data_t*)msg->data;
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Process Message [%d]",data->number);
- return TRUE;
-}
-
-
-static apt_bool_t consumer_task_test_run(apt_test_suite_t *suite, int argc, const char * const *argv)
-{
- apt_consumer_task_t *consumer_task;
- apt_task_t *task;
- apt_task_vtable_t *vtable;
- apt_task_msg_pool_t *msg_pool;
- apt_task_msg_t *msg;
- sample_msg_data_t *data;
- int i;
-
- msg_pool = apt_task_msg_pool_create_dynamic(sizeof(sample_msg_data_t),suite->pool);
-
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create Consumer Task");
- consumer_task = apt_consumer_task_create(NULL,msg_pool,suite->pool);
- if(!consumer_task) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Consumer Task");
- return FALSE;
- }
- task = apt_consumer_task_base_get(consumer_task);
- vtable = apt_task_vtable_get(task);
- if(vtable) {
- vtable->process_msg = task_msg_process;
- vtable->on_start_complete = task_on_start_complete;
- vtable->on_terminate_complete = task_on_terminate_complete;
- }
-
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Start Task");
- if(apt_task_start(task) == FALSE) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Start Task");
- apt_task_destroy(task);
- return FALSE;
- }
-
- for(i=0; i<10; i++) {
- msg = apt_task_msg_acquire(msg_pool);
- msg->type = TASK_MSG_USER;
- data = (sample_msg_data_t*) msg->data;
-
- data->number = i;
- data->timestamp = apr_time_now();
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Signal Message [%d]",data->number);
- apt_task_msg_signal(task,msg);
- }
-
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Terminate Task [wait till complete]");
- apt_task_terminate(task,TRUE);
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Destroy Task");
- apt_task_destroy(task);
- return TRUE;
-}
-
-apt_test_suite_t* consumer_task_test_suite_create(apr_pool_t *pool)
-{
- apt_test_suite_t *suite = apt_test_suite_create(pool,"consumer",NULL,consumer_task_test_run);
- return suite;
-}
+++ /dev/null
-/*
- * 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: main.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include "apt_test_suite.h"
-#include "apt_log.h"
-
-apt_test_suite_t* task_test_suite_create(apr_pool_t *pool);
-apt_test_suite_t* consumer_task_test_suite_create(apr_pool_t *pool);
-apt_test_suite_t* multipart_test_suite_create(apr_pool_t *pool);
-
-int main(int argc, const char * const *argv)
-{
- apt_test_framework_t *test_framework;
- apt_test_suite_t *test_suite;
- apr_pool_t *pool;
-
- /* one time apr global initialization */
- if(apr_initialize() != APR_SUCCESS) {
- return 0;
- }
-
- /* create test framework */
- test_framework = apt_test_framework_create();
- pool = apt_test_framework_pool_get(test_framework);
-
- /* create test suites and add them to test framework */
- test_suite = task_test_suite_create(pool);
- apt_test_framework_suite_add(test_framework,test_suite);
-
- test_suite = consumer_task_test_suite_create(pool);
- apt_test_framework_suite_add(test_framework,test_suite);
-
- test_suite = multipart_test_suite_create(pool);
- apt_test_framework_suite_add(test_framework,test_suite);
-
- /* run tests */
- apt_test_framework_run(test_framework,argc,argv);
-
- /* destroy test framework */
- apt_test_framework_destroy(test_framework);
-
- /* final apr global termination */
- apr_terminate();
- return 0;
-}
+++ /dev/null
-/*
- * 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: multipart_suite.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include "apt_test_suite.h"
-#include "apt_multipart_content.h"
-#include "apt_log.h"
-
-static apt_str_t* multipart_content_generate(apt_test_suite_t *suite)
-{
- apt_multipart_content_t *multipart = apt_multipart_content_create(1500,NULL,suite->pool);
- apt_str_t content_type;
- apt_str_t content;
- apt_str_t *body;
-
- apt_string_set(&content_type,"text/plain");
- apt_string_set(&content,"This is the content of the first part");
- apt_multipart_content_add2(multipart,&content_type,NULL,&content);
-
- apt_string_set(&content_type,"application/ssml+xml");
- apt_string_set(&content,
- "<?xml version=\"1.0\"?>\r\n"
- "<speak version=\"1.0\"\r\n"
- "<p> <s>You have 4 new messages.</s> </p>\r\n"
- "</speak>");
- apt_multipart_content_add2(multipart,&content_type,NULL,&content);
-
- body = apt_multipart_content_finalize(multipart);
- if(body) {
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Genereted Multipart Content [%lu bytes]\n%s",
- body->length,
- body->buf);
- }
- return body;
-}
-
-static apt_bool_t multipart_content_parse(apt_test_suite_t *suite, apt_str_t *body)
-{
- apt_multipart_content_t *multipart = apt_multipart_content_assign(body,NULL,suite->pool);
- if(multipart) {
- apt_bool_t is_final;
- apt_content_part_t content_part;
- while(apt_multipart_content_get(multipart,&content_part,&is_final) == TRUE) {
- if(is_final == TRUE) {
- break;
- }
- if(content_part.type && apt_string_is_empty(content_part.type) == FALSE) {
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Content Part Type: %.*s",
- content_part.type->length,
- content_part.type->buf);
- }
- if(content_part.id && apt_string_is_empty(content_part.id) == FALSE) {
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Content Part Id: %.*s",
- content_part.id->length,
- content_part.id->buf);
- }
- if(content_part.length && apt_string_is_empty(content_part.length) == FALSE) {
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Content Part Length: %.*s\n%.*s",
- content_part.length->length,
- content_part.length->buf,
- content_part.body.length,
- content_part.body.buf);
- }
- }
- }
- return TRUE;
-}
-
-
-static apt_bool_t multipart_test_run(apt_test_suite_t *suite, int argc, const char * const *argv)
-{
- apt_bool_t status = FALSE;
- apt_str_t *body = multipart_content_generate(suite);
- if(body) {
- status = multipart_content_parse(suite,body);
- }
- return status;
-}
-
-apt_test_suite_t* multipart_test_suite_create(apr_pool_t *pool)
-{
- apt_test_suite_t *suite = apt_test_suite_create(pool,"multipart",NULL,multipart_test_run);
- return suite;
-}
+++ /dev/null
-/*
- * 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: task_suite.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include "apt_test_suite.h"
-#include "apt_task.h"
-#include "apt_log.h"
-
-static apt_bool_t task_main(apt_task_t *task)
-{
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Do the Job");
- apt_task_delay(3000);
- return TRUE;
-}
-
-static apt_bool_t task_test_run(apt_test_suite_t *suite, int argc, const char * const *argv)
-{
- apt_task_t *task;
- apt_task_vtable_t *vtable;
-
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create Task");
- task = apt_task_create(NULL,NULL,suite->pool);
- if(!task) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Task");
- return FALSE;
- }
- vtable = apt_task_vtable_get(task);
- if(vtable) {
- vtable->run = task_main;
- }
-
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Start Task");
- if(apt_task_start(task) == FALSE) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Start Task");
- apt_task_destroy(task);
- return FALSE;
- }
-
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Wait for Task to Complete");
- apt_task_wait_till_complete(task);
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Destroy Task");
- apt_task_destroy(task);
- return TRUE;
-}
-
-apt_test_suite_t* task_test_suite_create(apr_pool_t *pool)
-{
- apt_test_suite_t *suite = apt_test_suite_create(pool,"task",NULL,task_test_run);
- return suite;
-}
+++ /dev/null
-MAINTAINERCLEANFILES = Makefile.in
-
-AM_CPPFLAGS = -I$(top_srcdir)/libs/mpf/include \
- -I$(top_srcdir)/libs/apr-toolkit/include \
- $(UNIMRCP_APR_INCLUDES)
-
-noinst_PROGRAMS = mpftest
-mpftest_LDADD = $(top_builddir)/libs/mpf/libmpf.la \
- $(top_builddir)/libs/apr-toolkit/libaprtoolkit.la \
- $(UNIMRCP_APR_LIBS)
-mpftest_SOURCES = src/main.c \
- src/mpf_suite.c
+++ /dev/null
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="mpftest"
- ProjectGUID="{DCF01B1C-5268-44F3-9130-D647FABFB663}"
- RootNamespace="mpftest"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- <Platform
- Name="x64"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- ConfigurationType="1"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unibin.vsprops;$(ProjectDir)..\..\build\vsprops\mpf.vsprops"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="mpf.lib aprtoolkit.lib libaprutil-1.lib libapr-1.lib ws2_32.lib winmm.lib"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- ConfigurationType="1"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unibin.vsprops;$(ProjectDir)..\..\build\vsprops\mpf.vsprops"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="mpf.lib aprtoolkit.lib libaprutil-1.lib libapr-1.lib ws2_32.lib winmm.lib "
- LinkTimeCodeGeneration="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|x64"
- ConfigurationType="1"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unibin-x64.vsprops;$(ProjectDir)..\..\build\vsprops\mpf.vsprops"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="mpf.lib aprtoolkit.lib libaprutil-1.lib libapr-1.lib ws2_32.lib winmm.lib"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|x64"
- ConfigurationType="1"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unibin-x64.vsprops;$(ProjectDir)..\..\build\vsprops\mpf.vsprops"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="mpf.lib aprtoolkit.lib libaprutil-1.lib libapr-1.lib ws2_32.lib winmm.lib "
- LinkTimeCodeGeneration="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="src"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath=".\src\main.c"
- >
- </File>
- <File
- RelativePath=".\src\mpf_suite.c"
- >
- </File>
- </Filter>
- <Filter
- Name="include"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{DCF01B1C-5268-44F3-9130-D647FABFB663}</ProjectGuid>
- <RootNamespace>mpftest</RootNamespace>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unibin.props" />
- <Import Project="$(ProjectDir)..\..\build\props\mpf.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" />
- <Import Project="$(ProjectDir)..\..\build\props\unibin.props" />
- <Import Project="$(ProjectDir)..\..\build\props\mpf.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unibin-x64.props" />
- <Import Project="$(ProjectDir)..\..\build\props\mpf.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" />
- <Import Project="$(ProjectDir)..\..\build\props\unibin-x64.props" />
- <Import Project="$(ProjectDir)..\..\build\props\mpf.props" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <Link>
- <AdditionalDependencies>mpf.lib;aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;ws2_32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <Link>
- <AdditionalDependencies>mpf.lib;aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;ws2_32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- <Link>
- <AdditionalDependencies>mpf.lib;aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;ws2_32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <Link>
- <AdditionalDependencies>mpf.lib;aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;ws2_32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
- </Link>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="src\main.c" />
- <ClCompile Include="src\mpf_suite.c" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\libs\mpf\mpf.vcxproj">
- <Project>{b5a00bfa-6083-4fae-a097-71642d6473b5}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="src">
- <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
- </Filter>
- <Filter Include="include">
- <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="src\main.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\mpf_suite.c">
- <Filter>src</Filter>
- </ClCompile>
- </ItemGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-/*
- * 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: main.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include "apt_test_suite.h"
-#include "apt_log.h"
-
-apt_test_suite_t* mpf_suite_create(apr_pool_t *pool);
-
-int main(int argc, const char * const *argv)
-{
- apt_test_framework_t *test_framework;
- apt_test_suite_t *test_suite;
- apr_pool_t *pool;
-
- /* one time apr global initialization */
- if(apr_initialize() != APR_SUCCESS) {
- return 0;
- }
-
- /* create test framework */
- test_framework = apt_test_framework_create();
- pool = apt_test_framework_pool_get(test_framework);
-
- /* create test suites and add them to test framework */
- test_suite = mpf_suite_create(pool);
- apt_test_framework_suite_add(test_framework,test_suite);
-
- /* run tests */
- apt_test_framework_run(test_framework,argc,argv);
-
- /* destroy test framework */
- apt_test_framework_destroy(test_framework);
-
- /* final apr global termination */
- apr_terminate();
- return 0;
-}
+++ /dev/null
-/*
- * 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_suite.c 2214 2014-11-06 03:05:51Z achaloyan@gmail.com $
- */
-
-#include <apr_thread_cond.h>
-#include "apt_test_suite.h"
-#include "apt_pool.h"
-#include "apt_consumer_task.h"
-#include "apt_dir_layout.h"
-#include "apt_log.h"
-#include "mpf_engine.h"
-#include "mpf_rtp_termination_factory.h"
-#include "mpf_file_termination_factory.h"
-#include "mpf_audio_file_descriptor.h"
-#include "mpf_rtp_descriptor.h"
-#include "mpf_codec_manager.h"
-
-typedef struct mpf_suite_session_t mpf_suite_session_t;
-typedef struct mpf_suite_agent_t mpf_suite_agent_t;
-
-/** Test suite session */
-struct mpf_suite_session_t {
- /** Pool to allocate memory from */
- apr_pool_t *pool;
-
- /** Media context associated with the session */
- mpf_context_t *context;
- /** The first termination in the context */
- mpf_termination_t *file_termination;
- /** The second termination in the context */
- mpf_termination_t *rtp_termination;
-};
-
-/** Test suite agent */
-struct mpf_suite_agent_t {
- /** Directory layout */
- apt_dir_layout_t *dir_layout;
- /** The main task of the test agent, which sends messages to MPF engine and
- * processes responses and events sent back from MPF engine */
- apt_consumer_task_t *consumer_task;
- /** MPF engine */
- mpf_engine_t *engine;
- /** RTP termination factory */
- mpf_termination_factory_t *rtp_termination_factory;
- /** File termination factory */
- mpf_termination_factory_t *file_termination_factory;
- /* Configuration of RTP termination factory */
- mpf_rtp_config_t *rtp_config;
- /* RTP stream settings */
- mpf_rtp_settings_t *rtp_settings;
-
- /** RTP receiver -> File */
- mpf_suite_session_t *rx_session;
- /** File -> RTP transmitter */
- mpf_suite_session_t *tx_session;
-
- /** Wait object, which is signalled to indicate shutdown */
- apr_thread_cond_t *wait_object;
- /** Mutex of the wait object */
- apr_thread_mutex_t *wait_object_mutex;
-};
-
-static apt_bool_t mpf_test_run(apt_test_suite_t *suite, int argc, const char * const *argv);
-
-static void mpf_suite_on_start_complete(apt_task_t *task);
-static void mpf_suite_on_terminate_complete(apt_task_t *task);
-static apt_bool_t mpf_suite_task_msg_process(apt_task_t *task, apt_task_msg_t *msg);
-
-static mpf_audio_file_descriptor_t* mpf_file_reader_descriptor_create(const mpf_suite_agent_t *agent, const mpf_suite_session_t *session);
-static mpf_audio_file_descriptor_t* mpf_file_writer_descriptor_create(const mpf_suite_agent_t *agent, const mpf_suite_session_t *session);
-static mpf_rtp_stream_descriptor_t* mpf_rtp_rx_local_descriptor_create(const mpf_suite_agent_t *agent, const mpf_suite_session_t *session);
-static mpf_rtp_stream_descriptor_t* mpf_rtp_rx_remote_descriptor_create(const mpf_suite_agent_t *agent, const mpf_suite_session_t *session);
-static mpf_rtp_stream_descriptor_t* mpf_rtp_tx_local_descriptor_create(const mpf_suite_agent_t *agent, const mpf_suite_session_t *session);
-static mpf_rtp_stream_descriptor_t* mpf_rtp_tx_remote_descriptor_create(const mpf_suite_agent_t *agent, const mpf_suite_session_t *session);
-
-
-/** Create MPF test suite */
-apt_test_suite_t* mpf_suite_create(apr_pool_t *pool)
-{
- apt_test_suite_t *suite = apt_test_suite_create(pool,"mpf",NULL,mpf_test_run);
- return suite;
-}
-
-/** Run MPF test suite */
-static apt_bool_t mpf_test_run(apt_test_suite_t *suite, int argc, const char * const *argv)
-{
- mpf_suite_agent_t *agent;
- mpf_codec_manager_t *codec_manager;
- mpf_rtp_config_t *rtp_config;
- mpf_rtp_settings_t *rtp_settings;
- mpf_engine_t *engine;
-
- apt_task_t *task;
- apt_task_vtable_t *vtable;
- apt_task_msg_pool_t *msg_pool;
-
- agent = apr_palloc(suite->pool,sizeof(mpf_suite_agent_t));
-
- agent->dir_layout = apt_default_dir_layout_create(NULL,suite->pool);
- engine = mpf_engine_create("MPF-Engine",suite->pool);
- if(!engine) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create MPF Engine");
- return FALSE;
- }
-
- codec_manager = mpf_engine_codec_manager_create(suite->pool);
- if(!codec_manager) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Codec Manager");
- return FALSE;
- }
-
- mpf_engine_codec_manager_register(engine,codec_manager);
- agent->engine = engine;
-
- rtp_config = mpf_rtp_config_alloc(suite->pool);
- apt_string_set(&rtp_config->ip,"127.0.0.1");
- rtp_config->rtp_port_min = 5000;
- rtp_config->rtp_port_max = 6000;
-
- agent->rtp_config = rtp_config;
-
- rtp_settings = mpf_rtp_settings_alloc(suite->pool);
- rtp_settings->ptime = 20;
- rtp_settings->jb_config.adaptive = 1;
- rtp_settings->jb_config.time_skew_detection = 1;
- rtp_settings->jb_config.min_playout_delay = 0;
- rtp_settings->jb_config.initial_playout_delay = 50;
- rtp_settings->jb_config.max_playout_delay = 800;
- mpf_codec_manager_codec_list_load(codec_manager,&rtp_settings->codec_list,"PCMU",suite->pool);
-
- agent->rtp_settings = rtp_settings;
-
- agent->rtp_termination_factory = mpf_rtp_termination_factory_create(rtp_config,suite->pool);
- agent->file_termination_factory = mpf_file_termination_factory_create(suite->pool);
-
- agent->rx_session = NULL;
- agent->tx_session = NULL;
-
- msg_pool = apt_task_msg_pool_create_dynamic(sizeof(mpf_message_t),suite->pool);
-
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create Consumer Task");
- agent->consumer_task = apt_consumer_task_create(agent,msg_pool,suite->pool);
- if(!agent->consumer_task) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Consumer Task");
- return FALSE;
- }
- task = apt_consumer_task_base_get(agent->consumer_task);
- apt_task_name_set(task,"MPF-Tester");
- vtable = apt_task_vtable_get(task);
- if(vtable) {
- vtable->process_msg = mpf_suite_task_msg_process;
- vtable->on_start_complete = mpf_suite_on_start_complete;
- vtable->on_terminate_complete = mpf_suite_on_terminate_complete;
- }
-
- apt_task_add(task,mpf_task_get(engine));
-
- apr_thread_mutex_create(&agent->wait_object_mutex,APR_THREAD_MUTEX_UNNESTED,suite->pool);
- apr_thread_cond_create(&agent->wait_object,suite->pool);
-
- if(apt_task_start(task) == FALSE) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Start Task");
- apt_task_destroy(task);
- return FALSE;
- }
-
- apr_thread_mutex_lock(agent->wait_object_mutex);
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Wait for Task to Complete");
- apr_thread_cond_wait(agent->wait_object,agent->wait_object_mutex);
- apr_thread_mutex_unlock(agent->wait_object_mutex);
-
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Terminate Task [wait till complete]");
- apt_task_terminate(task,TRUE);
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Destroy Task");
- apt_task_destroy(task);
-
- apr_thread_cond_destroy(agent->wait_object);
- apr_thread_mutex_destroy(agent->wait_object_mutex);
- return TRUE;
-}
-
-static mpf_suite_session_t* mpf_suite_rx_session_create(const mpf_suite_agent_t *agent)
-{
- mpf_task_msg_t *task_msg = NULL;
- void *descriptor;
- apr_pool_t *pool;
- mpf_suite_session_t *session;
-
- pool = apt_pool_create();
- session = apr_palloc(pool,sizeof(mpf_suite_session_t));
- session->pool = pool;
- session->context = NULL;
- session->file_termination = NULL;
- session->rtp_termination = NULL;
-
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Create MPF Context [Rx]");
- session->context = mpf_engine_context_create(agent->engine,NULL,session,2,pool);
-
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Create Termination [RTP Rx]");
- session->rtp_termination = mpf_termination_create(agent->rtp_termination_factory,session,session->pool);
-
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Add Termination [RTP Rx]");
- descriptor = mpf_rtp_rx_local_descriptor_create(agent,session);
- mpf_engine_termination_message_add(
- agent->engine,
- MPF_ADD_TERMINATION,session->context,session->rtp_termination,descriptor,
- &task_msg);
-
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Create Termination [File Writer]");
- session->file_termination = mpf_termination_create(agent->file_termination_factory,session,session->pool);
-
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Add Termination [File Writer]");
- descriptor = mpf_file_writer_descriptor_create(agent,session);
- mpf_engine_termination_message_add(
- agent->engine,
- MPF_ADD_TERMINATION,session->context,session->file_termination,descriptor,
- &task_msg);
-
- mpf_engine_message_send(agent->engine,&task_msg);
- return session;
-}
-
-static mpf_suite_session_t* mpf_suite_tx_session_create(const mpf_suite_agent_t *agent)
-{
- mpf_task_msg_t *task_msg = NULL;
- void *descriptor;
- apr_pool_t *pool;
- mpf_suite_session_t *session;
-
- pool = apt_pool_create();
- session = apr_palloc(pool,sizeof(mpf_suite_session_t));
- session->pool = pool;
- session->context = NULL;
- session->file_termination = NULL;
- session->rtp_termination = NULL;
-
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Create MPF Context [Tx]");
- session->context = mpf_engine_context_create(agent->engine,NULL,session,2,pool);
-
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Create Termination [File Reader]");
- session->file_termination = mpf_termination_create(agent->file_termination_factory,session,session->pool);
-
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Add Termination [File Reader]");
- descriptor = mpf_file_reader_descriptor_create(agent,session);
- mpf_engine_termination_message_add(
- agent->engine,
- MPF_ADD_TERMINATION,session->context,session->file_termination,descriptor,
- &task_msg);
-
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Create Termination [RTP Tx]");
- session->rtp_termination = mpf_termination_create(agent->rtp_termination_factory,session,session->pool);
-
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Add Termination [RTP Tx]");
- descriptor = mpf_rtp_tx_local_descriptor_create(agent,session);
- mpf_engine_termination_message_add(
- agent->engine,
- MPF_ADD_TERMINATION,session->context,session->rtp_termination,descriptor,
- &task_msg);
-
- mpf_engine_message_send(agent->engine,&task_msg);
- return session;
-}
-
-static void mpf_suite_session_destroy(mpf_suite_agent_t *agent, mpf_suite_session_t* session)
-{
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Destroy MPF Context");
- mpf_engine_context_destroy(session->context);
- session->context = NULL;
-
- if(agent->rx_session == session) {
- agent->rx_session = NULL;
- }
- else if(agent->tx_session == session) {
- agent->tx_session = NULL;
- }
-
- apr_pool_destroy(session->pool);
-
- if(!agent->tx_session && !agent->rx_session) {
- apr_thread_mutex_lock(agent->wait_object_mutex);
- apr_thread_cond_signal(agent->wait_object);
- apr_thread_mutex_unlock(agent->wait_object_mutex);
- }
-}
-
-/** Start execution of MPF test suite scenario */
-static void mpf_suite_on_start_complete(apt_task_t *task)
-{
- apt_consumer_task_t *consumer_task;
- mpf_suite_agent_t *agent;
-
- consumer_task = apt_task_object_get(task);
- agent = apt_consumer_task_object_get(consumer_task);
-
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"On MPF Suite Start");
-
- agent->rx_session = mpf_suite_rx_session_create(agent);
- agent->tx_session = mpf_suite_tx_session_create(agent);
-}
-
-/** Execution of MPF test suite scenario is terminated */
-static void mpf_suite_on_terminate_complete(apt_task_t *task)
-{
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"On MPF Suite Terminate");
-}
-
-/** Process MPF response */
-static apt_bool_t mpf_suite_response_process(mpf_suite_agent_t *agent, const mpf_message_t *mpf_message)
-{
- mpf_task_msg_t *task_msg = NULL;
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Process MPF Response");
- if(mpf_message->command_id == MPF_ADD_TERMINATION) {
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"On Add Termination");
- if(mpf_message->termination) {
- mpf_suite_session_t *session;
- session = mpf_termination_object_get(mpf_message->termination);
- if(session->rtp_termination == mpf_message->termination) {
- mpf_rtp_stream_descriptor_t *descriptor = NULL;
- if(session == agent->rx_session) {
- descriptor = mpf_rtp_rx_remote_descriptor_create(agent,session);
- }
- if(session == agent->tx_session) {
- descriptor = mpf_rtp_tx_remote_descriptor_create(agent,session);
- }
-
- if(descriptor) {
- mpf_engine_termination_message_add(
- agent->engine,
- MPF_MODIFY_TERMINATION,session->context,session->rtp_termination,descriptor,
- &task_msg);
- }
-
- mpf_engine_assoc_message_add(
- agent->engine,
- MPF_ADD_ASSOCIATION,session->context,session->file_termination,session->rtp_termination,
- &task_msg);
-
- mpf_engine_topology_message_add(
- agent->engine,
- MPF_APPLY_TOPOLOGY,session->context,
- &task_msg);
- }
- }
- }
- else if(mpf_message->command_id == MPF_SUBTRACT_TERMINATION) {
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"On Subtract Termination");
- if(mpf_message->termination) {
- mpf_suite_session_t *session;
- session = mpf_termination_object_get(mpf_message->termination);
- if(session->file_termination == mpf_message->termination) {
- session->file_termination = NULL;
- }
- else if(session->rtp_termination == mpf_message->termination) {
- session->rtp_termination = NULL;
- }
- mpf_termination_destroy(mpf_message->termination);
-
- if(!session->file_termination && !session->rtp_termination) {
- mpf_suite_session_destroy(agent,session);
- }
- }
- }
- return mpf_engine_message_send(agent->engine,&task_msg);
-}
-
-/** Process MPF event */
-static apt_bool_t mpf_suite_event_process(mpf_suite_agent_t *agent, const mpf_message_t *mpf_message)
-{
- mpf_task_msg_t *task_msg = NULL;
- mpf_suite_session_t *session;
- apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Process MPF Event");
- if(mpf_message->termination) {
- session = mpf_termination_object_get(mpf_message->termination);
- /* first destroy existing topology */
- mpf_engine_topology_message_add(
- agent->engine,
- MPF_DESTROY_TOPOLOGY,session->context,
- &task_msg);
-
- if(session->file_termination) {
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Subtract Termination [File]");
- mpf_engine_termination_message_add(
- agent->engine,
- MPF_SUBTRACT_TERMINATION,session->context,session->file_termination,NULL,
- &task_msg);
- }
- if(session->rtp_termination) {
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Subtract Termination [RTP]");
- mpf_engine_termination_message_add(
- agent->engine,
- MPF_SUBTRACT_TERMINATION,session->context,session->rtp_termination,NULL,
- &task_msg);
- }
- }
- return mpf_engine_message_send(agent->engine,&task_msg);
-}
-
-/** Process task messages */
-static apt_bool_t mpf_suite_task_msg_process(apt_task_t *task, apt_task_msg_t *msg)
-{
- apr_size_t i;
- const mpf_message_t *mpf_message;
- apt_consumer_task_t *consumer_task = apt_task_object_get(task);
- mpf_suite_agent_t *agent = apt_consumer_task_object_get(consumer_task);
- const mpf_message_container_t *container = (const mpf_message_container_t*) msg->data;
- for(i=0; i<container->count; i++) {
- mpf_message = &container->messages[i];
- if(mpf_message->message_type == MPF_MESSAGE_TYPE_RESPONSE) {
- mpf_suite_response_process(agent,mpf_message);
- }
- else {
- mpf_suite_event_process(agent,mpf_message);
- }
- }
- return TRUE;
-}
-
-/** Create file reader descriptor */
-static mpf_audio_file_descriptor_t* mpf_file_reader_descriptor_create(const mpf_suite_agent_t *agent, const mpf_suite_session_t *session)
-{
- const char *file_path = apt_datadir_filepath_get(agent->dir_layout,"demo-8kHz.pcm",session->pool);
- mpf_audio_file_descriptor_t *descriptor = apr_palloc(session->pool,sizeof(mpf_audio_file_descriptor_t));
- descriptor->mask = FILE_READER;
- descriptor->read_handle = NULL;
- descriptor->write_handle = NULL;
- descriptor->codec_descriptor = mpf_codec_lpcm_descriptor_create(8000,1,session->pool);
- if(file_path) {
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Open File [%s] for Reading",file_path);
- descriptor->read_handle = fopen(file_path,"rb");
- if(!descriptor->read_handle) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Open File [%s]",file_path);
- }
- }
- return descriptor;
-}
-
-/** Create file writer descriptor */
-static mpf_audio_file_descriptor_t* mpf_file_writer_descriptor_create(const mpf_suite_agent_t *agent, const mpf_suite_session_t *session)
-{
- const char *file_path = apt_vardir_filepath_get(agent->dir_layout,"output-8kHz.pcm",session->pool);
- mpf_audio_file_descriptor_t *descriptor = apr_palloc(session->pool,sizeof(mpf_audio_file_descriptor_t));
- descriptor->mask = FILE_WRITER;
- descriptor->max_write_size = 500000; /* ~500Kb */
- descriptor->write_handle = NULL;
- descriptor->read_handle = NULL;
- descriptor->codec_descriptor = mpf_codec_lpcm_descriptor_create(8000,1,session->pool);
- if(file_path) {
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Open File [%s] for Writing",file_path);
- descriptor->write_handle = fopen(file_path,"wb");
- if(!descriptor->write_handle) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Open File [%s] for Writing",file_path);
- }
- }
- return descriptor;
-}
-
-/** Create RTP rx local descriptor */
-static mpf_rtp_stream_descriptor_t* mpf_rtp_rx_local_descriptor_create(const mpf_suite_agent_t *agent, const mpf_suite_session_t *session)
-{
- mpf_rtp_media_descriptor_t *media_descriptor;
- mpf_rtp_stream_descriptor_t *stream_descriptor;
-
- media_descriptor = apr_palloc(session->pool,sizeof(mpf_rtp_media_descriptor_t));
- mpf_rtp_media_descriptor_init(media_descriptor);
- media_descriptor->state = MPF_MEDIA_ENABLED;
- media_descriptor->direction = STREAM_DIRECTION_RECEIVE;
- apt_string_set(&media_descriptor->ip,"127.0.0.1");
- media_descriptor->port = 5000;
-
- stream_descriptor = apr_palloc(session->pool,sizeof(mpf_rtp_stream_descriptor_t));
- mpf_rtp_stream_descriptor_init(stream_descriptor);
- stream_descriptor->local = media_descriptor;
- stream_descriptor->settings = agent->rtp_settings;
- return stream_descriptor;
-}
-
-/** Create RTP rx remote descriptor */
-static mpf_rtp_stream_descriptor_t* mpf_rtp_rx_remote_descriptor_create(const mpf_suite_agent_t *agent, const mpf_suite_session_t *session)
-{
- mpf_codec_list_t *codec_list;
- mpf_codec_descriptor_t *codec_descriptor;
- mpf_rtp_media_descriptor_t *media_descriptor;
- mpf_rtp_stream_descriptor_t *stream_descriptor;
-
- media_descriptor = apr_palloc(session->pool,sizeof(mpf_rtp_media_descriptor_t));
- mpf_rtp_media_descriptor_init(media_descriptor);
- media_descriptor->state = MPF_MEDIA_ENABLED;
- media_descriptor->direction = STREAM_DIRECTION_SEND;
- apt_string_set(&media_descriptor->ip,"127.0.0.1");
- media_descriptor->port = 5002;
- codec_list = &media_descriptor->codec_list;
- mpf_codec_list_init(codec_list,1,session->pool);
- codec_descriptor = mpf_codec_list_add(codec_list);
- if(codec_descriptor) {
- codec_descriptor->payload_type = 0;
- apt_string_set(&codec_descriptor->name,"PCMU");
- codec_descriptor->sampling_rate = 8000;
- codec_descriptor->channel_count = 1;
- }
-
- stream_descriptor = apr_palloc(session->pool,sizeof(mpf_rtp_stream_descriptor_t));
- mpf_rtp_stream_descriptor_init(stream_descriptor);
- stream_descriptor->remote = media_descriptor;
- stream_descriptor->settings = agent->rtp_settings;
- return stream_descriptor;
-}
-
-/** Create RTP tx local descriptor */
-static mpf_rtp_stream_descriptor_t* mpf_rtp_tx_local_descriptor_create(const mpf_suite_agent_t *agent, const mpf_suite_session_t *session)
-{
- mpf_rtp_media_descriptor_t *media_descriptor;
- mpf_rtp_stream_descriptor_t *stream_descriptor;
-
- media_descriptor = apr_palloc(session->pool,sizeof(mpf_rtp_media_descriptor_t));
- mpf_rtp_media_descriptor_init(media_descriptor);
- media_descriptor->state = MPF_MEDIA_ENABLED;
- media_descriptor->direction = STREAM_DIRECTION_SEND;
- apt_string_set(&media_descriptor->ip,"127.0.0.1");
- media_descriptor->port = 5002;
-
- stream_descriptor = apr_palloc(session->pool,sizeof(mpf_rtp_stream_descriptor_t));
- mpf_rtp_stream_descriptor_init(stream_descriptor);
- stream_descriptor->local = media_descriptor;
- stream_descriptor->settings = agent->rtp_settings;
- return stream_descriptor;
-}
-
-/** Create RTP tx remote descriptor */
-static mpf_rtp_stream_descriptor_t* mpf_rtp_tx_remote_descriptor_create(const mpf_suite_agent_t *agent, const mpf_suite_session_t *session)
-{
- mpf_codec_list_t *codec_list;
- mpf_codec_descriptor_t *codec_descriptor;
- mpf_rtp_media_descriptor_t *media_descriptor;
- mpf_rtp_stream_descriptor_t *stream_descriptor;
-
- media_descriptor = apr_palloc(session->pool,sizeof(mpf_rtp_media_descriptor_t));
- mpf_rtp_media_descriptor_init(media_descriptor);
- media_descriptor->state = MPF_MEDIA_ENABLED;
- media_descriptor->direction = STREAM_DIRECTION_RECEIVE;
- apt_string_set(&media_descriptor->ip,"127.0.0.1");
- media_descriptor->port = 5000;
- codec_list = &media_descriptor->codec_list;
- mpf_codec_list_init(codec_list,1,session->pool);
- codec_descriptor = mpf_codec_list_add(codec_list);
- if(codec_descriptor) {
- codec_descriptor->payload_type = 0;
- apt_string_set(&codec_descriptor->name,"PCMU");
- codec_descriptor->sampling_rate = 8000;
- codec_descriptor->channel_count = 1;
- }
-
- stream_descriptor = apr_palloc(session->pool,sizeof(mpf_rtp_stream_descriptor_t));
- mpf_rtp_stream_descriptor_init(stream_descriptor);
- stream_descriptor->remote = media_descriptor;
- stream_descriptor->settings = agent->rtp_settings;
- return stream_descriptor;
-}
+++ /dev/null
-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_PROGRAMS = mrcptest
-mrcptest_LDADD = $(top_builddir)/libs/mrcp/libmrcp.la \
- $(top_builddir)/libs/apr-toolkit/libaprtoolkit.la \
- $(UNIMRCP_APR_LIBS)
-mrcptest_SOURCES = src/main.c \
- src/parse_gen_suite.c \
- src/set_get_suite.c \
- src/transparent_set_get_suite.c
+++ /dev/null
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="mrcptest"
- ProjectGUID="{3CA97077-6210-4362-998A-D15A35EEAA08}"
- RootNamespace="mrcptest"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- <Platform
- Name="x64"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- ConfigurationType="1"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unibin.vsprops;$(ProjectDir)..\..\build\vsprops\mrcp.vsprops"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="mrcp.lib aprtoolkit.lib libaprutil-1.lib libapr-1.lib"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- ConfigurationType="1"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unibin.vsprops;$(ProjectDir)..\..\build\vsprops\mrcp.vsprops"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="mrcp.lib aprtoolkit.lib libaprutil-1.lib libapr-1.lib"
- LinkTimeCodeGeneration="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|x64"
- ConfigurationType="1"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unibin-x64.vsprops;$(ProjectDir)..\..\build\vsprops\mrcp.vsprops"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="mrcp.lib aprtoolkit.lib libaprutil-1.lib libapr-1.lib"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|x64"
- ConfigurationType="1"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unibin-x64.vsprops;$(ProjectDir)..\..\build\vsprops\mrcp.vsprops"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="mrcp.lib aprtoolkit.lib libaprutil-1.lib libapr-1.lib"
- LinkTimeCodeGeneration="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="src"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath=".\src\main.c"
- >
- </File>
- <File
- RelativePath=".\src\parse_gen_suite.c"
- >
- </File>
- <File
- RelativePath=".\src\set_get_suite.c"
- >
- </File>
- <File
- RelativePath=".\src\transparent_set_get_suite.c"
- >
- </File>
- </Filter>
- <Filter
- Name="include"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{3CA97077-6210-4362-998A-D15A35EEAA08}</ProjectGuid>
- <RootNamespace>mrcptest</RootNamespace>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unibin.props" />
- <Import Project="$(ProjectDir)..\..\build\props\mrcp.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" />
- <Import Project="$(ProjectDir)..\..\build\props\unibin.props" />
- <Import Project="$(ProjectDir)..\..\build\props\mrcp.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unibin-x64.props" />
- <Import Project="$(ProjectDir)..\..\build\props\mrcp.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" />
- <Import Project="$(ProjectDir)..\..\build\props\unibin-x64.props" />
- <Import Project="$(ProjectDir)..\..\build\props\mrcp.props" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <Link>
- <AdditionalDependencies>mrcp.lib;aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies)</AdditionalDependencies>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <Link>
- <AdditionalDependencies>mrcp.lib;aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- <Link>
- <AdditionalDependencies>mrcp.lib;aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies)</AdditionalDependencies>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <Link>
- <AdditionalDependencies>mrcp.lib;aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
- </Link>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="src\main.c" />
- <ClCompile Include="src\parse_gen_suite.c" />
- <ClCompile Include="src\set_get_suite.c" />
- <ClCompile Include="src\transparent_set_get_suite.c" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\libs\mrcp\mrcp.vcxproj">
- <Project>{1c320193-46a6-4b34-9c56-8ab584fc1b56}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="src">
- <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
- </Filter>
- <Filter Include="include">
- <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="src\main.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\parse_gen_suite.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\set_get_suite.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\transparent_set_get_suite.c">
- <Filter>src</Filter>
- </ClCompile>
- </ItemGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-/*
- * 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: main.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include "apt_test_suite.h"
-#include "apt_log.h"
-
-apt_test_suite_t* parse_gen_test_suite_create(apr_pool_t *pool);
-apt_test_suite_t* set_get_test_suite_create(apr_pool_t *pool);
-apt_test_suite_t* transparent_set_get_test_suite_create(apr_pool_t *pool);
-
-int main(int argc, const char * const *argv)
-{
- apt_test_framework_t *test_framework;
- apt_test_suite_t *test_suite;
- apr_pool_t *pool;
-
- /* one time apr global initialization */
- if(apr_initialize() != APR_SUCCESS) {
- return 0;
- }
-
- /* create test framework */
- test_framework = apt_test_framework_create();
- pool = apt_test_framework_pool_get(test_framework);
-
- /* create test suites and add them to test framework */
- test_suite = set_get_test_suite_create(pool);
- apt_test_framework_suite_add(test_framework,test_suite);
- test_suite = transparent_set_get_test_suite_create(pool);
- apt_test_framework_suite_add(test_framework,test_suite);
- test_suite = parse_gen_test_suite_create(pool);
- apt_test_framework_suite_add(test_framework,test_suite);
-
- /* run tests */
- apt_test_framework_run(test_framework,argc,argv);
-
- /* destroy test framework */
- apt_test_framework_destroy(test_framework);
-
- /* final apr global termination */
- apr_terminate();
- return 0;
-}
+++ /dev/null
-/*
- * 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: parse_gen_suite.c 2249 2014-11-19 05:26:24Z achaloyan@gmail.com $
- */
-
-#include <apr_file_info.h>
-#include <apr_file_io.h>
-#include "apt_test_suite.h"
-#include "apt_log.h"
-#include "mrcp_resource_loader.h"
-#include "mrcp_resource_factory.h"
-#include "mrcp_message.h"
-#include "mrcp_stream.h"
-
-static apt_bool_t test_stream_generate(mrcp_generator_t *generator, mrcp_message_t *message)
-{
- char buffer[500];
- apt_text_stream_t stream;
- apt_message_status_e status;
- apt_bool_t continuation;
-
- do {
- apt_text_stream_init(&stream,buffer,sizeof(buffer)-1);
- continuation = FALSE;
- status = mrcp_generator_run(generator,message,&stream);
- if(status == APT_MESSAGE_STATUS_COMPLETE) {
- stream.text.length = stream.pos - stream.text.buf;
- *stream.pos = '\0';
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Generated MRCPv2 Data [%"APR_SIZE_T_FMT" bytes]\n%s",stream.text.length,stream.text.buf);
- }
- else if(status == APT_MESSAGE_STATUS_INCOMPLETE) {
- *stream.pos = '\0';
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Generated MRCPv2 Data [%"APR_SIZE_T_FMT" bytes] continuation awaited\n%s",stream.text.length,stream.text.buf);
- continuation = TRUE;
- }
- else if(status == APT_MESSAGE_STATUS_INVALID) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Generate MRCPv2 Data");
- }
- }
- while(continuation == TRUE);
- return TRUE;
-}
-
-static apt_bool_t mrcp_message_handler(mrcp_generator_t *generator, mrcp_message_t *message, apt_message_status_e status)
-{
- if(status == APT_MESSAGE_STATUS_COMPLETE) {
- /* message is completely parsed */
- test_stream_generate(generator,message);
- }
- return TRUE;
-}
-
-static apt_bool_t resource_name_read(apr_file_t *file, mrcp_parser_t *parser)
-{
- char buffer[100];
- apt_text_stream_t stream;
- apt_bool_t status = FALSE;
- apt_text_stream_init(&stream,buffer,sizeof(buffer)-1);
- if(apr_file_read(file,stream.pos,&stream.text.length) != APR_SUCCESS) {
- return FALSE;
- }
-
- /* skip the first line in a test file, which indicates resource name */
- if(*stream.pos =='/' && *(stream.pos+1)=='/') {
- apt_str_t line;
- stream.pos += 2;
- if(apt_text_line_read(&stream,&line) == TRUE) {
- apr_off_t offset = stream.pos - stream.text.buf;
- apr_file_seek(file,APR_SET,&offset);
- mrcp_parser_resource_set(parser,&line);
- status = TRUE;
- }
- }
- return status;
-}
-
-static apt_bool_t test_file_process(apt_test_suite_t *suite, mrcp_resource_factory_t *factory, mrcp_version_e version, const char *file_path)
-{
- apr_file_t *file;
- char buffer[500];
- apt_text_stream_t stream;
- mrcp_parser_t *parser;
- mrcp_generator_t *generator;
- apr_size_t length;
- apr_size_t offset;
- apt_str_t resource_name;
- mrcp_message_t *message;
- apt_message_status_e msg_status;
-
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Open File [%s]",file_path);
- if(apr_file_open(&file,file_path,APR_FOPEN_READ | APR_FOPEN_BINARY,APR_OS_DEFAULT,suite->pool) != APR_SUCCESS) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Open File");
- return FALSE;
- }
-
- parser = mrcp_parser_create(factory,suite->pool);
- generator = mrcp_generator_create(factory,suite->pool);
-
- apt_string_reset(&resource_name);
- if(version == MRCP_VERSION_1) {
- resource_name_read(file,parser);
- }
-
- apt_text_stream_init(&stream,buffer,sizeof(buffer)-1);
-
- do {
- /* calculate offset remaining from the previous receive / if any */
- offset = stream.pos - stream.text.buf;
- /* calculate available length */
- length = sizeof(buffer) - 1 - offset;
-
- if(apr_file_read(file,stream.pos,&length) != APR_SUCCESS) {
- break;
- }
- /* calculate actual length of the stream */
- stream.text.length = offset + length;
- stream.pos[length] = '\0';
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Parse MRCPv2 Data [%"APR_SIZE_T_FMT" bytes]\n%s",length,stream.pos);
-
- /* reset pos */
- apt_text_stream_reset(&stream);
-
- do {
- msg_status = mrcp_parser_run(parser,&stream,&message);
- mrcp_message_handler(generator,message,msg_status);
- }
- while(apt_text_is_eos(&stream) == FALSE);
-
- /* scroll remaining stream */
- apt_text_stream_scroll(&stream);
- }
- while(apr_file_eof(file) != APR_EOF);
-
- apr_file_close(file);
- return TRUE;
-}
-
-static apt_bool_t test_dir_process(apt_test_suite_t *suite, mrcp_resource_factory_t *factory, mrcp_version_e version)
-{
- apr_status_t rv;
- apr_dir_t *dir;
-
- const char *dir_name = "v2";
- if(version == MRCP_VERSION_1) {
- dir_name = "v1";
- }
- if(apr_dir_open(&dir,dir_name,suite->pool) != APR_SUCCESS) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot Open Directory [%s]",dir_name);
- return FALSE;
- }
-
- do {
- apr_finfo_t finfo;
- rv = apr_dir_read(&finfo,APR_FINFO_DIRENT,dir);
- if(rv == APR_SUCCESS) {
- if(finfo.filetype == APR_REG && finfo.name) {
- int ch;
- char *file_path;
- apr_filepath_merge(&file_path,dir_name,finfo.name,APR_FILEPATH_NATIVE,suite->pool);
- test_file_process(suite,factory,version,file_path);
- printf("\nPress ENTER to continue\n");
- do {ch = getchar(); } while ((ch != '\n') && (ch != EOF));
- }
- }
- }
- while(rv == APR_SUCCESS);
-
- apr_dir_close(dir);
- return TRUE;
-}
-
-static apt_bool_t parse_gen_test_run(apt_test_suite_t *suite, int argc, const char * const *argv)
-{
- mrcp_resource_factory_t *factory;
- mrcp_resource_loader_t *resource_loader;
- resource_loader = mrcp_resource_loader_create(TRUE,suite->pool);
- if(!resource_loader) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Resource Loader");
- return FALSE;
- }
-
- factory = mrcp_resource_factory_get(resource_loader);
- if(!factory) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Resource Factory");
- return FALSE;
- }
-
- test_dir_process(suite,factory,MRCP_VERSION_2);
- test_dir_process(suite,factory,MRCP_VERSION_1);
-
- mrcp_resource_factory_destroy(factory);
- return TRUE;
-}
-
-apt_test_suite_t* parse_gen_test_suite_create(apr_pool_t *pool)
-{
- apt_test_suite_t *suite = apt_test_suite_create(pool,"parse-gen",NULL,parse_gen_test_run);
- return suite;
-}
+++ /dev/null
-/*
- * 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: set_get_suite.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include "apt_test_suite.h"
-#include "apt_log.h"
-/* common includes */
-#include "mrcp_resource_loader.h"
-#include "mrcp_resource_factory.h"
-#include "mrcp_message.h"
-#include "mrcp_generic_header.h"
-/* synthesizer includes */
-#include "mrcp_synth_header.h"
-#include "mrcp_synth_resource.h"
-/* recognizer includes */
-#include "mrcp_recog_header.h"
-#include "mrcp_recog_resource.h"
-
-#define SAMPLE_VOICE_AGE 28
-#define SAMPLE_CONTENT_TYPE "application/synthesis+ssml"
-#define SAMPLE_CONTENT_ID "123456"
-#define SAMPLE_CONTENT "SSML content goes here"
-#define SAMPLE_PARAM_NAME "SampleParamName"
-#define SAMPLE_PARAM_VALUE "SampleParamValue"
-
-/* Create SPEAK request */
-static mrcp_message_t* speak_request_create(mrcp_resource_factory_t *factory, apr_pool_t *pool)
-{
- mrcp_message_t *message;
- mrcp_resource_t *resource = mrcp_resource_get(factory,MRCP_SYNTHESIZER_RESOURCE);
- if(!resource) {
- return NULL;
- }
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create SPEAK Request");
- message = mrcp_request_create(resource,MRCP_VERSION_2,SYNTHESIZER_SPEAK,pool);
- if(message) {
- mrcp_generic_header_t *generic_header;
- mrcp_synth_header_t *synth_header;
- /* get/allocate generic header */
- generic_header = mrcp_generic_header_prepare(message);
- if(generic_header) {
- /* set generic header fields */
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set Content-Type: %s",SAMPLE_CONTENT_TYPE);
- apt_string_assign(&generic_header->content_type,SAMPLE_CONTENT_TYPE,message->pool);
- mrcp_generic_header_property_add(message,GENERIC_HEADER_CONTENT_TYPE);
- }
- /* get/allocate synthesizer header */
- synth_header = mrcp_resource_header_prepare(message);
- if(synth_header) {
- /* set synthesizer header fields */
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set Voice-Age: %d",SAMPLE_VOICE_AGE);
- synth_header->voice_param.age = SAMPLE_VOICE_AGE;
- mrcp_resource_header_property_add(message,SYNTHESIZER_HEADER_VOICE_AGE);
- }
- /* set message body */
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set Body: %s",SAMPLE_CONTENT);
- apt_string_assign(&message->body,SAMPLE_CONTENT,message->pool);
- }
- return message;
-}
-
-/* Test SPEAK request */
-static apt_bool_t speak_request_test(mrcp_resource_factory_t *factory, mrcp_message_t *message)
-{
- apt_bool_t res;
- mrcp_generic_header_t *generic_header;
- mrcp_synth_header_t *synth_header;
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Test SPEAK Request");
- res = FALSE;
- /* get generic header */
- generic_header = mrcp_generic_header_get(message);
- if(generic_header) {
- /* test content type header */
- if(mrcp_generic_header_property_check(message,GENERIC_HEADER_CONTENT_TYPE) == TRUE) {
- if(strncasecmp(generic_header->content_type.buf,SAMPLE_CONTENT_TYPE,generic_header->content_type.length) == 0) {
- /* OK */
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Get Content-Type: %s",generic_header->content_type.buf);
- res = TRUE;
- }
- }
- }
- if(res == FALSE) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Test Generic Header");
- return FALSE;
- }
-
- res = FALSE;
- /* get synthesizer header */
- synth_header = mrcp_resource_header_get(message);
- if(synth_header) {
- /* test voice age header */
- if(mrcp_resource_header_property_check(message,SYNTHESIZER_HEADER_VOICE_AGE) == TRUE) {
- if(synth_header->voice_param.age == SAMPLE_VOICE_AGE) {
- /* OK */
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Get Voice-Age: %"APR_SIZE_T_FMT,synth_header->voice_param.age);
- res = TRUE;
- }
- }
- }
- if(res == FALSE) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Test Synthesizer Header");
- return FALSE;
- }
-
- if(strncasecmp(message->body.buf,SAMPLE_CONTENT,message->body.length) != 0) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Test Message Body");
- return FALSE;
- }
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Get Body: %s",message->body.buf);
- return TRUE;
-}
-
-/* Create SPEAK response */
-static mrcp_message_t* speak_response_create(mrcp_resource_factory_t *factory, const mrcp_message_t *request)
-{
- mrcp_message_t *response;
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create SPEAK Response");
- response = mrcp_response_create(request,request->pool);
- if(response) {
- /* set IN-PROGRESS state */
- response->start_line.request_state = MRCP_REQUEST_STATE_INPROGRESS;
- }
- return response;
-}
-
-/* Create SPEAK-COMPLETE event */
-static mrcp_message_t* speak_event_create(mrcp_resource_factory_t *factory, const mrcp_message_t *request)
-{
- mrcp_message_t *event_message;
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create SPEAK-COMPLETE Event");
- event_message = mrcp_event_create(request,SYNTHESIZER_SPEAK_COMPLETE,request->pool);
- if(event_message) {
- /* get/allocate synthesizer header */
- mrcp_synth_header_t *synth_header = mrcp_resource_header_prepare(event_message);
- if(synth_header) {
- /* set completion cause */
- synth_header->completion_cause = SYNTHESIZER_COMPLETION_CAUSE_NORMAL;
- mrcp_resource_header_property_add(event_message,SYNTHESIZER_HEADER_COMPLETION_CAUSE);
- }
- /* set request state */
- event_message->start_line.request_state = MRCP_REQUEST_STATE_COMPLETE;
- }
- return event_message;
-}
-
-
-/* Create GET-PARAMS request */
-static mrcp_message_t* get_params_request_create(mrcp_resource_factory_t *factory, apr_pool_t *pool)
-{
- mrcp_message_t *message;
- mrcp_resource_t *resource = mrcp_resource_get(factory,MRCP_SYNTHESIZER_RESOURCE);
- if(!resource) {
- return NULL;
- }
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create GET-PARAMS Request");
- message = mrcp_request_create(resource,MRCP_VERSION_2,SYNTHESIZER_GET_PARAMS,pool);
- if(message) {
- apt_str_t param_name;
- apt_str_t param_value;
- mrcp_generic_header_t *generic_header;
- mrcp_synth_header_t *synth_header;
- /* get/allocate generic header */
- generic_header = mrcp_generic_header_prepare(message);
- if(generic_header) {
- /* set content id empty header */
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set Content-ID: <empty>");
- mrcp_generic_header_name_property_add(message,GENERIC_HEADER_CONTENT_ID);
-
- /* set vendor specific params header */
- generic_header->vendor_specific_params = apt_pair_array_create(1,pool);
- apt_string_set(¶m_name,SAMPLE_PARAM_NAME);
- apt_string_reset(¶m_value);
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set Vendor-Specific-Params: %s",param_name.buf);
- apt_pair_array_append(generic_header->vendor_specific_params,¶m_name,¶m_value,pool);
- mrcp_generic_header_property_add(message,GENERIC_HEADER_VENDOR_SPECIFIC_PARAMS);
- }
- /* get/allocate synthesizer header */
- synth_header = mrcp_resource_header_prepare(message);
- if(synth_header) {
- /* set voice age empty header */
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set Voice-Age: <empty>");
- mrcp_resource_header_name_property_add(message,SYNTHESIZER_HEADER_VOICE_AGE);
- }
- }
- return message;
-}
-
-/* Create GET-PARAMS response */
-static mrcp_message_t* get_params_response_create(mrcp_resource_factory_t *factory, mrcp_message_t *request)
-{
- apt_bool_t res;
- mrcp_message_t *response;
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create GET-PARAMS Response");
- response = mrcp_response_create(request,request->pool);
- if(response) {
- mrcp_generic_header_t *generic_header;
- mrcp_synth_header_t *synth_header;
- res = FALSE;
- /* get generic header */
- generic_header = mrcp_generic_header_get(request);
- if(generic_header) {
- mrcp_generic_header_t *res_generic_header = mrcp_generic_header_prepare(response);
- /* test content id header */
- if(mrcp_generic_header_property_check(request,GENERIC_HEADER_CONTENT_ID) == TRUE) {
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set Content-ID: %s",SAMPLE_CONTENT_ID);
- apt_string_assign(&res_generic_header->content_id,SAMPLE_CONTENT_ID,response->pool);
- mrcp_generic_header_property_add(response,GENERIC_HEADER_CONTENT_ID);
- res = TRUE;
- }
- /* test vendor specific header */
- if(mrcp_generic_header_property_check(request,GENERIC_HEADER_VENDOR_SPECIFIC_PARAMS) == TRUE) {
- apt_str_t name;
- const apt_pair_t *pair;
- res_generic_header->vendor_specific_params = apt_pair_array_create(1,response->pool);
- apt_string_set(&name,SAMPLE_PARAM_NAME);
- pair = apt_pair_array_find(generic_header->vendor_specific_params,&name);
- if(pair) {
- apt_str_t value;
- apt_string_set(&value,SAMPLE_PARAM_VALUE);
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set Vendor-Specific-Params: %s=%s",name.buf,value.buf);
- apt_pair_array_append(res_generic_header->vendor_specific_params,&name,&value,response->pool);
- }
- mrcp_generic_header_property_add(response,GENERIC_HEADER_VENDOR_SPECIFIC_PARAMS);
- res = TRUE;
- }
- }
-
- if(res == FALSE) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Test Generic Header");
- return NULL;
- }
-
- res = FALSE;
- /* get synthesizer header */
- synth_header = mrcp_resource_header_get(request);
- if(synth_header) {
- mrcp_synth_header_t *res_synth_header = mrcp_resource_header_prepare(response);
- /* test voice age header */
- if(mrcp_resource_header_property_check(request,SYNTHESIZER_HEADER_VOICE_AGE) == TRUE) {
- res_synth_header->voice_param.age = SAMPLE_VOICE_AGE;
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set Voice-Age: %"APR_SIZE_T_FMT,res_synth_header->voice_param.age);
- mrcp_resource_header_property_add(response,SYNTHESIZER_HEADER_VOICE_AGE);
- res = TRUE;
- }
- }
- if(res == FALSE) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Test Synthesizer Header");
- return NULL;
- }
-
- }
- return response;
-}
-
-
-
-
-static apt_bool_t speak_test_run(apt_test_suite_t *suite, mrcp_resource_factory_t *factory)
-{
- mrcp_message_t *message = speak_request_create(factory,suite->pool);
- if(!message) {
- return FALSE;
- }
-
- if(speak_request_test(factory,message) != TRUE) {
- return FALSE;
- }
-
- speak_response_create(factory,message);
- speak_event_create(factory,message);
- return TRUE;
-}
-
-static apt_bool_t get_params_test_run(apt_test_suite_t *suite, mrcp_resource_factory_t *factory)
-{
- mrcp_message_t *message = get_params_request_create(factory,suite->pool);
- if(!message) {
- return FALSE;
- }
-
- get_params_response_create(factory,message);
- return TRUE;
-}
-
-static apt_bool_t set_get_test_run(apt_test_suite_t *suite, int argc, const char * const *argv)
-{
- mrcp_resource_factory_t *factory;
- mrcp_resource_loader_t *resource_loader;
- resource_loader = mrcp_resource_loader_create(TRUE,suite->pool);
- if(!resource_loader) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Resource Loader");
- return FALSE;
- }
-
- factory = mrcp_resource_factory_get(resource_loader);
- if(!factory) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Resource Factory");
- return FALSE;
- }
-
- speak_test_run(suite,factory);
- get_params_test_run(suite,factory);
-
- mrcp_resource_factory_destroy(factory);
- return TRUE;
-}
-
-apt_test_suite_t* set_get_test_suite_create(apr_pool_t *pool)
-{
- apt_test_suite_t *suite = apt_test_suite_create(pool,"set-get",NULL,set_get_test_run);
- return suite;
-}
+++ /dev/null
-/*
- * 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: transparent_set_get_suite.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include "apt_test_suite.h"
-#include "apt_log.h"
-/* common includes */
-#include "mrcp_resource_loader.h"
-#include "mrcp_resource_factory.h"
-#include "mrcp_message.h"
-/* synthesizer includes */
-#include "mrcp_synth_resource.h"
-/* recognizer includes */
-#include "mrcp_recog_resource.h"
-
-#define SAMPLE_VOICE_AGE "28"
-#define SAMPLE_CONTENT_TYPE "application/synthesis+ssml"
-#define SAMPLE_CONTENT_ID "123456"
-#define SAMPLE_CONTENT "SSML content goes here"
-#define SAMPLE_PARAM_NAME "SampleParamName"
-#define SAMPLE_PARAM_VALUE "SampleParamValue"
-
-/* Create SPEAK request */
-static mrcp_message_t* speak_request_create(mrcp_resource_factory_t *factory, apr_pool_t *pool)
-{
- mrcp_message_t *message;
- mrcp_resource_t *resource = mrcp_resource_get(factory,MRCP_SYNTHESIZER_RESOURCE);
- if(!resource) {
- return NULL;
- }
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create SPEAK Request");
- message = mrcp_request_create(resource,MRCP_VERSION_2,SYNTHESIZER_SPEAK,pool);
- if(message) {
- /* set transparent header fields */
- apt_header_field_t *header_field;
- header_field = apt_header_field_create_c("Content-Type",SAMPLE_CONTENT_TYPE,message->pool);
- if(header_field) {
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set %s: %s",header_field->name.buf,header_field->value.buf);
- mrcp_message_header_field_add(message,header_field);
- }
-
- header_field = apt_header_field_create_c("Voice-Age",SAMPLE_VOICE_AGE,message->pool);
- if(header_field) {
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set %s: %s",header_field->name.buf,header_field->value.buf);
- mrcp_message_header_field_add(message,header_field);
- }
-
- /* set message body */
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set Body: %s",SAMPLE_CONTENT);
- apt_string_assign(&message->body,SAMPLE_CONTENT,message->pool);
- }
- return message;
-}
-
-/* Test SPEAK request */
-static apt_bool_t speak_request_test(mrcp_resource_factory_t *factory, mrcp_message_t *message)
-{
- apt_bool_t res;
- apt_header_field_t *header_field;
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Test SPEAK Request");
- res = FALSE;
-
- header_field = NULL;
- while( (header_field = mrcp_message_next_header_field_get(message,header_field)) != NULL ) {
- if(strncasecmp(header_field->name.buf,"Content-Type",header_field->name.length) == 0) {
- if(strncasecmp(header_field->value.buf,SAMPLE_CONTENT_TYPE,header_field->value.length) == 0) {
- /* OK */
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Get %s: %s",header_field->name.buf,header_field->value.buf);
- res = TRUE;
- }
- }
- else if(strncasecmp(header_field->name.buf,"Voice-Age",header_field->name.length) == 0) {
- if(strncasecmp(header_field->value.buf,SAMPLE_VOICE_AGE,header_field->value.length) == 0) {
- /* OK */
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Get %s: %s",header_field->name.buf,header_field->value.buf);
- res = TRUE;
- }
- }
- }
- if(res == FALSE) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Test Header Fields");
- return FALSE;
- }
-
- if(strncasecmp(message->body.buf,SAMPLE_CONTENT,message->body.length) != 0) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Test Message Body");
- return FALSE;
- }
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Get Body: %s",message->body.buf);
- return TRUE;
-}
-
-/* Create SPEAK response */
-static mrcp_message_t* speak_response_create(mrcp_resource_factory_t *factory, const mrcp_message_t *request)
-{
- mrcp_message_t *response;
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create SPEAK Response");
- response = mrcp_response_create(request,request->pool);
- if(response) {
- /* set IN-PROGRESS state */
- response->start_line.request_state = MRCP_REQUEST_STATE_INPROGRESS;
- }
- return response;
-}
-
-/* Create SPEAK-COMPLETE event */
-static mrcp_message_t* speak_event_create(mrcp_resource_factory_t *factory, const mrcp_message_t *request)
-{
- mrcp_message_t *event_message;
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create SPEAK-COMPLETE Event");
- event_message = mrcp_event_create(request,SYNTHESIZER_SPEAK_COMPLETE,request->pool);
- if(event_message) {
- apt_header_field_t *header_field;
- header_field = apt_header_field_create_c("Completion-Cause","000 normal",event_message->pool);
- if(header_field) {
- mrcp_message_header_field_add(event_message,header_field);
- }
-
- /* set request state */
- event_message->start_line.request_state = MRCP_REQUEST_STATE_COMPLETE;
- }
- return event_message;
-}
-
-/* Create GET-PARAMS request */
-static mrcp_message_t* get_params_request_create(mrcp_resource_factory_t *factory, apr_pool_t *pool)
-{
- mrcp_message_t *message;
- mrcp_resource_t *resource = mrcp_resource_get(factory,MRCP_SYNTHESIZER_RESOURCE);
- if(!resource) {
- return NULL;
- }
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create GET-PARAMS Request");
- message = mrcp_request_create(resource,MRCP_VERSION_2,SYNTHESIZER_GET_PARAMS,pool);
- if(message) {
- apt_header_field_t *header_field;
- header_field = apt_header_field_create_c("Content-Id","",message->pool);
- if(header_field) {
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set %s:",header_field->name.buf);
- mrcp_message_header_field_add(message,header_field);
- }
- header_field = apt_header_field_create_c("Vendor-Specific-Params",SAMPLE_PARAM_NAME,message->pool);
- if(header_field) {
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set %s:",header_field->name.buf);
- mrcp_message_header_field_add(message,header_field);
- }
- header_field = apt_header_field_create_c("Voice-Age","",message->pool);
- if(header_field) {
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set %s:",header_field->name.buf);
- mrcp_message_header_field_add(message,header_field);
- }
- }
- return message;
-}
-
-/* Create GET-PARAMS response */
-static mrcp_message_t* get_params_response_create(mrcp_resource_factory_t *factory, mrcp_message_t *request)
-{
- mrcp_message_t *response;
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create GET-PARAMS Response");
- response = mrcp_response_create(request,request->pool);
- if(response) {
- apt_header_field_t *header_field;
- header_field = apt_header_field_create_c("Content-Id",SAMPLE_CONTENT_ID,response->pool);
- if(header_field) {
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set %s: %s",header_field->name.buf,header_field->value.buf);
- mrcp_message_header_field_add(response,header_field);
- }
- header_field = apt_header_field_create_c("Vendor-Specific-Params",SAMPLE_PARAM_NAME"="SAMPLE_PARAM_VALUE,response->pool);
- if(header_field) {
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set %s: %s",header_field->name.buf,header_field->value.buf);
- mrcp_message_header_field_add(response,header_field);
- }
- header_field = apt_header_field_create_c("Voice-Age",SAMPLE_VOICE_AGE,response->pool);
- if(header_field) {
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set %s: %s",header_field->name.buf,header_field->value.buf);
- mrcp_message_header_field_add(response,header_field);
- }
- }
- return response;
-}
-
-
-static apt_bool_t speak_test_run(apt_test_suite_t *suite, mrcp_resource_factory_t *factory)
-{
- mrcp_message_t *message = speak_request_create(factory,suite->pool);
- if(!message) {
- return FALSE;
- }
-
- if(speak_request_test(factory,message) != TRUE) {
- return FALSE;
- }
-
- speak_response_create(factory,message);
- speak_event_create(factory,message);
- return TRUE;
-}
-
-static apt_bool_t get_params_test_run(apt_test_suite_t *suite, mrcp_resource_factory_t *factory)
-{
- mrcp_message_t *message = get_params_request_create(factory,suite->pool);
- if(!message) {
- return FALSE;
- }
-
- get_params_response_create(factory,message);
- return TRUE;
-}
-
-static apt_bool_t set_get_test_run(apt_test_suite_t *suite, int argc, const char * const *argv)
-{
- mrcp_resource_factory_t *factory;
- mrcp_resource_loader_t *resource_loader;
- resource_loader = mrcp_resource_loader_create(TRUE,suite->pool);
- if(!resource_loader) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Resource Loader");
- return FALSE;
- }
-
- factory = mrcp_resource_factory_get(resource_loader);
- if(!factory) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Resource Factory");
- return FALSE;
- }
-
- speak_test_run(suite,factory);
- get_params_test_run(suite,factory);
-
- mrcp_resource_factory_destroy(factory);
- return TRUE;
-}
-
-apt_test_suite_t* transparent_set_get_test_suite_create(apr_pool_t *pool)
-{
- apt_test_suite_t *suite = apt_test_suite_create(pool,"trans-set-get",NULL,set_get_test_run);
- return suite;
-}
+++ /dev/null
-//speechrecog\r
-DEFINE-GRAMMAR 543257 MRCP/1.0\r
-Content-Type:application/grammar+xml\r
-Content-Id:request1@form-level.store\r
-Content-Length:309\r
-\r
-<?xml version="1.0"?>\r
-\r
-<!-- the default grammar language is US English -->\r
-<grammar xml:lang="en-US" version="1.0">\r
-\r
-<!-- single language attachment to tokens -->\r
-<rule id="yes">\r
- <one-of>\r
- <item xml:lang="fr-CA">oui</item>\r
- <item xml:lang="en-US">yes</item>\r
- </one-of>\r
-</rule>
\ No newline at end of file
+++ /dev/null
-//speechsynth\r
-GET-PARAMS 543256 MRCP/1.0\r
-Voice-gender:\r
-Voice-variant:\r
-\r
+++ /dev/null
-//speechsynth\r
-GET-PARAMS 543256 MRCP/1.0\r
-Voice-gender:\r
-Voice-variant:\r
-\r
-SET-PARAMS 543256 MRCP/1.0\r
-Voice-gender:female\r
-Voice-variant:3\r
-\r
-SPEAK 543257 MRCP/1.0\r
-Kill-On-Barge-In:false\r
-Voice-gender:neutral\r
-Prosody-volume:medium\r
-Content-Type:application/synthesis+ssml\r
-Content-Length:412\r
-\r
-<?xml version="1.0"?>\r
-<speak>\r
-<paragraph>\r
- <sentence>You have 4 new messages.</sentence>\r
- <sentence>The first is from <say-as type="name">Stephanie Williams</say-as> \r
- <mark name="Stephanie"/> and arrived at <break/>\r
- <say-as type="time">3:45pm</say-as>.</sentence>\r
- \r
- <sentence>The subject is <prosody rate="-20%">ski trip</prosody></sentence>\r
-</paragraph>\r
-</speak>
\ No newline at end of file
+++ /dev/null
-//speechsynth\r
-PAUSE 543258 MRCP/1.0\r
-\r
+++ /dev/null
-//speechrecog\r
-RECOGNITION-COMPLETE 543257 COMPLETE MRCP/1.0\r
-Completion-Cause:000 success\r
-Waveform-URL:http://web.media.com/session123/audio.wav\r
-Content-Type:application/x-nlsml\r
-Content-Length:446\r
-\r
- <?xml version="1.0"?>\r
- <result x-model="http://IdentityModel"\r
- xmlns:xf="http://www.w3.org/2000/xforms"\r
- grammar="session:request1@form-level.store">\r
- <interpretation>\r
- <xf:instance name="Person">\r
- <Person>\r
- <Name> Andre Roy </Name>\r
- </Person>\r
- </xf:instance>\r
- <input> may I speak to Andre Roy </input>\r
- </interpretation>\r
- </result>
\ No newline at end of file
+++ /dev/null
-//speechrecog\r
-RECOGNIZE 543257 MRCP/1.0\r
-Confidence-Threshold:90\r
-Content-Type:application/grammar+xml\r
-Content-Id:request1@form-level.store\r
-Content-Length:608\r
-\r
-<?xml version="1.0"?>\r
-\r
-<!-- the default grammar language is US English -->\r
-<grammar xml:lang="en-US" version="1.0">\r
-\r
-<!-- single language attachment to tokens -->\r
- <rule id="yes">\r
- <one-of>\r
- <item xml:lang="fr-CA">oui</item>\r
- <item xml:lang="en-US">yes</item>\r
- </one-of>\r
- </rule>\r
-\r
-<!-- single language attachment to a rule expansion -->\r
- <rule id="request">\r
- may I speak to\r
- <one-of xml:lang="fr-CA">\r
- <item>Michel Tremblay</item>\r
- <item>Andre Roy</item>\r
- </one-of>\r
- </rule>\r
-\r
-</grammar>
\ No newline at end of file
+++ /dev/null
-//speechsynth\r
-MRCP/1.0 543257 200 IN-PROGRESS\r
-\r
+++ /dev/null
-//speechsynth\r
-RESUME 543260 MRCP/1.0\r
-\r
+++ /dev/null
-//speechsynth\r
-SET-PARAMS 543256 MRCP/1.0\r
-Voice-gender:female\r
-Voice-variant:3\r
-\r
+++ /dev/null
-//speechsynth\r
-SPEAK 543257 MRCP/1.0\r
-Kill-On-Barge-In:false\r
-Voice-gender:neutral\r
-Prosody-volume:medium\r
-Content-Type:application/synthesis+ssml\r
-Content-Length:412\r
-\r
-<?xml version="1.0"?>\r
-<speak>\r
-<paragraph>\r
- <sentence>You have 4 new messages.</sentence>\r
- <sentence>The first is from <say-as type="name">Stephanie Williams</say-as> \r
- <mark name="Stephanie"/> and arrived at <break/>\r
- <say-as type="time">3:45pm</say-as>.</sentence>\r
- \r
- <sentence>The subject is <prosody rate="-20%">ski trip</prosody></sentence>\r
-</paragraph>\r
-</speak>
\ No newline at end of file
+++ /dev/null
-//speechsynth\r
-SPEAK-COMPLETE 543260 COMPLETE MRCP/1.0\r
-Completion-Cause:000 normal\r
-\r
+++ /dev/null
-//speechsynth\r
-STOP 543258 MRCP/1.0\r
-\r
+++ /dev/null
-MRCP/2.0 865 DEFINE-GRAMMAR 543257\r
-Channel-Identifier:32AECB23433801@speechrecog\r
-Content-Type:application/srgs+xml\r
-Content-ID:<request1@form-level.store>\r
-Content-Length:685\r
-\r
-<?xml version="1.0"?>\r
-\r
-<!-- the default grammar language is US English -->\r
-<grammar xmlns="http://www.w3.org/2001/06/grammar"\r
- xml:lang="en-US" version="1.0">\r
-\r
-<!-- single language attachment to tokens -->\r
- <rule id="yes">\r
- <one-of>\r
- <item xml:lang="fr-CA">oui</item>\r
- <item xml:lang="en-US">yes</item>\r
- </one-of>\r
- </rule>\r
-\r
-<!-- single language attachment to a rule expansion -->\r
- <rule id="request">\r
- may I speak to\r
- <one-of xml:lang="fr-CA">\r
- <item>Michel Tremblay</item>\r
- <item>Andre Roy</item>\r
- </one-of>\r
- </rule>\r
-\r
-</grammar>
\ No newline at end of file
+++ /dev/null
-MRCP/2.0 112 GET-PARAMS 543256\r
-Channel-Identifier:32AECB23433802@speechsynth\r
-Voice-gender:\r
-Voice-variant:\r
-\r
+++ /dev/null
-MRCP/2.0 616 RECOGNITION-COMPLETE 543257 COMPLETE\r
-Channel-Identifier:32AECB23433801@speechrecog\r
-Completion-Cause:000 success\r
-Waveform-URI:<http://web.media.com/session123/audio.wav>;size=342456;duration=25435\r
-Content-Type:application/nlsml+xml\r
-Content-Length:430\r
-\r
-<?xml version="1.0"?>\r
-<result xmlns="http://www.ietf.org/xml/ns/mrcpv2"\r
- xmlns:ex="http://www.example.com/example"\r
- grammar="session:request1@form-level.store">\r
- <interpretation>\r
- <instance name="Person">\r
- <ex:Person>\r
- <ex:Name> Andre Roy </ex:Name>\r
- </ex:Person>\r
- </instance>\r
- <input> may I speak to Andre Roy </input>\r
- </interpretation>\r
-</result>
\ No newline at end of file
+++ /dev/null
-MRCP/2.0 903 RECOGNIZE 543257\r
-Channel-Identifier:32AECB23433801@speechrecog\r
-Confidence-Threshold:0.9\r
-Content-Type:application/srgs+xml\r
-Content-ID:<request1@form-level.store>\r
-Content-Length:702\r
-\r
-<?xml version="1.0"?>\r
-\r
-<!-- the default grammar language is US English -->\r
-<grammar xmlns="http://www.w3.org/2001/06/grammar"\r
- xml:lang="en-US" version="1.0" root="request">\r
-\r
-<!-- single language attachment to tokens -->\r
- <rule id="yes">\r
- <one-of>\r
- <item xml:lang="fr-CA">oui</item>\r
- <item xml:lang="en-US">yes</item>\r
- </one-of>\r
- </rule>\r
-\r
-<!-- single language attachment to a rule expansion -->\r
- <rule id="request">\r
- may I speak to\r
- <one-of xml:lang="fr-CA">\r
- <item>Michel Tremblay</item>\r
- <item>Andre Roy</item>\r
- </one-of>\r
- </rule>\r
-</grammar>
\ No newline at end of file
+++ /dev/null
-MRCP/2.0 119 SET-PARAMS 543256\r
-Channel-Identifier:32AECB23433802@speechsynth\r
-Voice-gender:female\r
-Voice-variant:3\r
-\r
+++ /dev/null
-MRCP/2.0 732 SPEAK 543257\r
-Channel-Identifier:32AECB23433802@speechsynth\r
-Voice-gender:neutral\r
-Voice-Age:25\r
-Prosody-volume:medium\r
-Content-Type:application/ssml+xml\r
-Content-Length:542\r
-\r
-<?xml version="1.0"?>\r
-<speak version="1.0"\r
- xmlns="http://www.w3.org/2001/10/synthesis"\r
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
- xsi:schemaLocation="http://www.w3.org/2001/10/synthesis\r
- http://www.w3.org/TR/speech-synthesis/synthesis.xsd"\r
- xml:lang="en-US">\r
- <p>\r
- <s>You have 4 new messages.</s>\r
- <s>The first is from Stephanie Williams and arrived at\r
- <break/>\r
- <say-as interpret-as="vxml:time">0345p</say-as>.\r
- </s>\r
- <s>The subject is\r
- <prosody rate="-20%">ski trip</prosody>\r
- </s>\r
- </p>\r
-</speak>
\ No newline at end of file
+++ /dev/null
-MRCP/2.0 161 SPEAK-COMPLETE 543257 COMPLETE\r
-Channel-Identifier:32AECB23433802@speechsynth\r
-Completion-Cause:000 normal\r
-Speech-Marker:timestamp=857206027059\r
-\r
+++ /dev/null
-MRCP/2.0 74 STOP 543258\r
-Channel-Identifier:32AECB23433802@speechsynth\r
-\r
+++ /dev/null
-MAINTAINERCLEANFILES = Makefile.in
-
-AM_CPPFLAGS = -I$(top_srcdir)/libs/uni-rtsp/include \
- -I$(top_srcdir)/libs/apr-toolkit/include \
- $(UNIMRCP_APR_INCLUDES)
-
-noinst_PROGRAMS = rtsptest
-rtsptest_LDADD = $(top_builddir)/libs/uni-rtsp/libunirtsp.la \
- $(top_builddir)/libs/apr-toolkit/libaprtoolkit.la \
- $(UNIMRCP_APR_LIBS)
-rtsptest_SOURCES = src/main.c \
- src/parse_gen_suite.c
+++ /dev/null
-ANNOUNCE rtsp://media.server.com/media/synthesizer RTSP/1.0\r
-CSeq:4\r
-Session:12345678\r
-Content-Type:application/mrcp\r
-Content-Length:567\r
-\r
-SPEAK 543257 MRCP/1.0\r
-Kill-On-Barge-In:false\r
-Voice-gender:neutral\r
-Prosody-volume:medium\r
-Content-Type:application/synthesis+ssml\r
-Content-Length:412\r
-\r
-<?xml version="1.0"?>\r
-<speak>\r
-<paragraph>\r
- <sentence>You have 4 new messages.</sentence>\r
- <sentence>The first is from <say-as type="name">Stephanie Williams</say-as> \r
- <mark name="Stephanie"/> and arrived at <break/>\r
- <say-as type="time">3:45pm</say-as>.</sentence>\r
- \r
- <sentence>The subject is <prosody rate="-20%">ski trip</prosody></sentence>\r
-</paragraph>\r
-</speak>
\ No newline at end of file
+++ /dev/null
-RTSP/1.0 200 OK\r
-CSeq:2\r
-Transport:RTP/AVP;unicast;client_port=46456-46457;server_port=46460-46461\r
-Session:12345678\r
-Content-Length:188\r
-Content-Type:application/sdp\r
-\r
-v=0\r
-o=- 3211724219 3211724219 IN IP4 10.3.2.88\r
-s=Media Server\r
-c=IN IP4 0.0.0.0\r
-t=0 0\r
-m=audio 46460 RTP/AVP 0 96\r
-a=rtpmap:0 pcmu/8000\r
-a=rtpmap:96 telephone-event/8000\r
-a=fmtp:96 0-15
\ No newline at end of file
+++ /dev/null
-RTSP/1.0 200 OK\r
-CSeq:3\r
-Transport:RTP/AVP;unicast;client_port=46456-46457;\r
- server_port=46460-46461;mode=record;ttl=127\r
-Session:12345678\r
-\r
+++ /dev/null
-SETUP rtsp://media.server.com/media/recognizer RTSP/1.0\r
-CSeq:3\r
-Transport:RTP/AVP;unicast;client_port=46456-46457;\r
- mode=record;ttl=127\r
-Session:12345678;timeout=200\r
-\r
+++ /dev/null
-SETUP rtsp://media.server.com/media/synthesizer RTSP/1.0\r
-CSeq:2\r
-Transport:RTP/AVP;unicast;client_port=46456-46457\r
-Content-Type:application/sdp\r
-Content-Length:188\r
-\r
-v=0\r
-o=- 123 456 IN IP4 10.0.0.1\r
-s=Media Server\r
-p=+1-888-555-1212\r
-c=IN IP4 0.0.0.0\r
-t=0 0\r
-m=audio 0 RTP/AVP 0 96\r
-a=rtpmap:0 pcmu/8000\r
-a=rtpmap:96 telephone-event/8000\r
-a=fmtp:96 0-15
\ No newline at end of file
+++ /dev/null
-TEARDOWN rtsp://media.server.com/media/synthesizer RTSP/1.0\r
-CSeq:12\r
-Session:12345678\r
-\r
+++ /dev/null
-RTSP/1.0 200 OK\r
-CSeq:3\r
-Transport:RTP/AVP;unicast;client_port=46456-46457;\r
- server_port=46460-46461;mode=record;ttl=127\r
-Session:12345678\r
-\r
-SETUP rtsp://media.server.com/media/synthesizer RTSP/1.0\r
-CSeq:2\r
-Transport:RTP/AVP;unicast;client_port=46456-46457\r
-Content-Type:application/sdp\r
-Content-Length:190\r
-\r
-v=0\r
-o=- 123 456 IN IP4 10.0.0.1\r
-s=Media Server\r
-p=+1-888-555-1212\r
-c=IN IP4 0.0.0.0\r
-t=0 0\r
-m=audio 0 RTP/AVP 0 96\r
-a=rtpmap:0 pcmu/8000\r
-a=rtpmap:96 telephone-event/8000\r
-a=fmtp:96 0-15\r
-ANNOUNCE rtsp://media.server.com/media/synthesizer RTSP/1.0\r
-CSeq:4\r
-Session:12345678\r
-Content-Type:application/mrcp\r
-Content-Length:567\r
-\r
-SPEAK 543257 MRCP/1.0\r
-Kill-On-Barge-In:false\r
-Voice-gender:neutral\r
-Prosody-volume:medium\r
-Content-Type:application/synthesis+ssml\r
-Content-Length:412\r
-\r
-<?xml version="1.0"?>\r
-<speak>\r
-<paragraph>\r
- <sentence>You have 4 new messages.</sentence>\r
- <sentence>The first is from <say-as type="name">Stephanie Williams</say-as> \r
- <mark name="Stephanie"/> and arrived at <break/>\r
- <say-as type="time">3:45pm</say-as>.</sentence>\r
- \r
- <sentence>The subject is <prosody rate="-20%">ski trip</prosody></sentence>\r
-</paragraph>\r
-</speak>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="rtsptest"
- ProjectGUID="{17A33F3F-BAF5-403F-8EF4-FECDA7D9A335}"
- RootNamespace="rtsptest"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- <Platform
- Name="x64"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- ConfigurationType="1"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unibin.vsprops;$(ProjectDir)..\..\build\vsprops\unirtsp.vsprops"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="unirtsp.lib aprtoolkit.lib libaprutil-1.lib libapr-1.lib"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- ConfigurationType="1"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unibin.vsprops;$(ProjectDir)..\..\build\vsprops\unirtsp.vsprops"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="unirtsp.lib aprtoolkit.lib libaprutil-1.lib libapr-1.lib"
- LinkTimeCodeGeneration="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|x64"
- ConfigurationType="1"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unibin-x64.vsprops;$(ProjectDir)..\..\build\vsprops\unirtsp.vsprops"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="unirtsp.lib aprtoolkit.lib libaprutil-1.lib libapr-1.lib"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|x64"
- ConfigurationType="1"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unibin-x64.vsprops;$(ProjectDir)..\..\build\vsprops\unirtsp.vsprops"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="unirtsp.lib aprtoolkit.lib libaprutil-1.lib libapr-1.lib"
- LinkTimeCodeGeneration="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="src"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath=".\src\main.c"
- >
- </File>
- <File
- RelativePath=".\src\parse_gen_suite.c"
- >
- </File>
- </Filter>
- <Filter
- Name="include"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{17A33F3F-BAF5-403F-8EF4-FECDA7D9A335}</ProjectGuid>
- <RootNamespace>rtsptest</RootNamespace>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unibin.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unirtsp.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" />
- <Import Project="$(ProjectDir)..\..\build\props\unibin.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unirtsp.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unibin-x64.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unirtsp.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" />
- <Import Project="$(ProjectDir)..\..\build\props\unibin-x64.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unirtsp.props" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <Link>
- <AdditionalDependencies>unirtsp.lib;aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies)</AdditionalDependencies>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <Link>
- <AdditionalDependencies>unirtsp.lib;aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- <Link>
- <AdditionalDependencies>unirtsp.lib;aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies)</AdditionalDependencies>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <Link>
- <AdditionalDependencies>unirtsp.lib;aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
- </Link>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="src\main.c" />
- <ClCompile Include="src\parse_gen_suite.c" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\libs\uni-rtsp\unirtsp.vcxproj">
- <Project>{504b3154-7a4f-459d-9877-b951021c3f1f}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="src">
- <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
- </Filter>
- <Filter Include="include">
- <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="src\main.c">
- <Filter>src</Filter>
- </ClCompile>
- <ClCompile Include="src\parse_gen_suite.c">
- <Filter>src</Filter>
- </ClCompile>
- </ItemGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-/*
- * 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: main.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include "apt_test_suite.h"
-#include "apt_log.h"
-
-apt_test_suite_t* parse_gen_test_suite_create(apr_pool_t *pool);
-
-int main(int argc, const char * const *argv)
-{
- apt_test_framework_t *test_framework;
- apt_test_suite_t *test_suite;
- apr_pool_t *pool;
-
- /* one time apr global initialization */
- if(apr_initialize() != APR_SUCCESS) {
- return 0;
- }
-
- /* create test framework */
- test_framework = apt_test_framework_create();
- pool = apt_test_framework_pool_get(test_framework);
-
- /* create test suites and add them to test framework */
- test_suite = parse_gen_test_suite_create(pool);
- apt_test_framework_suite_add(test_framework,test_suite);
-
- /* run tests */
- apt_test_framework_run(test_framework,argc,argv);
-
- /* destroy test framework */
- apt_test_framework_destroy(test_framework);
-
- /* final apr global termination */
- apr_terminate();
- return 0;
-}
+++ /dev/null
-/*
- * 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: parse_gen_suite.c 2249 2014-11-19 05:26:24Z achaloyan@gmail.com $
- */
-
-#include <apr_file_info.h>
-#include <apr_file_io.h>
-#include "apt_test_suite.h"
-#include "apt_log.h"
-#include "rtsp_stream.h"
-
-static apt_bool_t test_stream_generate(rtsp_generator_t *generator, rtsp_message_t *message)
-{
- char buffer[500];
- apt_text_stream_t stream;
- apt_message_status_e status;
- apt_bool_t continuation;
-
- do {
- apt_text_stream_init(&stream,buffer,sizeof(buffer)-1);
- continuation = FALSE;
- status = rtsp_generator_run(generator,message,&stream);
- if(status == APT_MESSAGE_STATUS_COMPLETE) {
- stream.text.length = stream.pos - stream.text.buf;
- *stream.pos = '\0';
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Generated RTSP Data [%"APR_SIZE_T_FMT" bytes]\n%s",stream.text.length,stream.text.buf);
- }
- else if(status == APT_MESSAGE_STATUS_INCOMPLETE) {
- *stream.pos = '\0';
- apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Generated RTSP Data [%"APR_SIZE_T_FMT" bytes] continuation awaited\n%s",stream.text.length,stream.text.buf);
- continuation = TRUE;
- }
- else {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Generate RTSP Data");
- }
- }
- while(continuation == TRUE);
- return TRUE;
-}
-
-static apt_bool_t rtsp_message_handler(rtsp_generator_t *generator, rtsp_message_t *message, apt_message_status_e status)
-{
- if(status == APT_MESSAGE_STATUS_COMPLETE) {
- /* message is completely parsed */
- test_stream_generate(generator,message);
- }
- return TRUE;
-}
-
-static apt_bool_t test_file_process(apt_test_suite_t *suite, const char *file_path)
-{
- apr_file_t *file;
- char buffer[500];
- apt_text_stream_t stream;
- rtsp_parser_t *parser;
- rtsp_generator_t *generator;
- apr_size_t length;
- apr_size_t offset;
- rtsp_message_t *message;
- apt_message_status_e msg_status;
-
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Open File [%s]",file_path);
- if(apr_file_open(&file,file_path,APR_FOPEN_READ | APR_FOPEN_BINARY,APR_OS_DEFAULT,suite->pool) != APR_SUCCESS) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Open File");
- return FALSE;
- }
-
- parser = rtsp_parser_create(suite->pool);
- generator = rtsp_generator_create(suite->pool);
-
- apt_text_stream_init(&stream,buffer,sizeof(buffer)-1);
-
- do {
- /* calculate offset remaining from the previous receive / if any */
- offset = stream.pos - stream.text.buf;
- /* calculate available length */
- length = sizeof(buffer) - 1 - offset;
-
- if(apr_file_read(file,stream.pos,&length) != APR_SUCCESS) {
- break;
- }
- /* calculate actual length of the stream */
- stream.text.length = offset + length;
- stream.pos[length] = '\0';
- apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Parse RTSP Data [%"APR_SIZE_T_FMT" bytes]\n%s",length,stream.pos);
-
- /* reset pos */
- apt_text_stream_reset(&stream);
-
- do {
- msg_status = rtsp_parser_run(parser,&stream,&message);
- rtsp_message_handler(generator,message,msg_status);
- }
- while(apt_text_is_eos(&stream) == FALSE);
-
- /* scroll remaining stream */
- apt_text_stream_scroll(&stream);
- }
- while(apr_file_eof(file) != APR_EOF);
-
- apr_file_close(file);
- return TRUE;
-}
-
-static apt_bool_t test_dir_process(apt_test_suite_t *suite)
-{
- apr_status_t rv;
- apr_dir_t *dir;
-
- const char *dir_name = "msg";
- if(apr_dir_open(&dir,dir_name,suite->pool) != APR_SUCCESS) {
- apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot Open Directory [%s]",dir_name);
- return FALSE;
- }
-
- do {
- apr_finfo_t finfo;
- rv = apr_dir_read(&finfo,APR_FINFO_DIRENT,dir);
- if(rv == APR_SUCCESS) {
- if(finfo.filetype == APR_REG && finfo.name) {
- int ch;
- char *file_path;
- apr_filepath_merge(&file_path,dir_name,finfo.name,APR_FILEPATH_NATIVE,suite->pool);
- test_file_process(suite,file_path);
- printf("\nPress ENTER to continue\n");
- do {ch = getchar(); } while ((ch != '\n') && (ch != EOF));
- }
- }
- }
- while(rv == APR_SUCCESS);
-
- apr_dir_close(dir);
- return TRUE;
-}
-
-static apt_bool_t parse_gen_test_run(apt_test_suite_t *suite, int argc, const char * const *argv)
-{
- test_dir_process(suite);
- return TRUE;
-}
-
-apt_test_suite_t* parse_gen_test_suite_create(apr_pool_t *pool)
-{
- apt_test_suite_t *suite = apt_test_suite_create(pool,"parse-gen",NULL,parse_gen_test_run);
- return suite;
-}
+++ /dev/null
-<?xml version="1.0" encoding="ISO-8859-1" ?>
-<!DOCTYPE scenario SYSTEM "sipp.dtd">
-
-
-<scenario name="MRCP Multiple Resources UAC">
- <!-- In client mode (sipp placing calls), the Call-ID MUST be -->
- <!-- generated by sipp. To do so, use [call_id] token. -->
- <send retrans="500">
- <![CDATA[
-
- INVITE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
- Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
- From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number]
- To: sut <sip:[service]@[remote_ip]:[remote_port]>
- Call-ID: [call_id]
- CSeq: 1 INVITE
- Contact: sip:sipp@[local_ip]:[local_port]
- Max-Forwards: 70
- Subject: Performance Test
- Content-Type: application/sdp
- Content-Length: [len]
-
- v=0
- o=user1 53655765 2353687637 IN IP4 [local_ip]
- s=-
- c=IN IP4 [media_ip]
- t=0 0
- m=application 9 TCP/MRCPv2 1
- a=setup:active
- a=connection:new
- a=resource:speechsynth
- a=cmid:1
- m=application 9 TCP/MRCPv2 1
- a=setup:active
- a=connection:new
- a=resource:speechrecog
- a=cmid:1
- m=audio [media_port] RTP/AVP 0 8
- a=sendrecv
- a=mid:1
-
- ]]>
- </send>
-
- <recv response="100"
- optional="true">
- </recv>
-
- <recv response="180" optional="true">
- </recv>
-
- <!-- By adding rrs="true" (Record Route Sets), the route sets -->
- <!-- are saved and used for following messages sent. Useful to test -->
- <!-- against stateful SIP proxies/B2BUAs. -->
- <recv response="200" rtd="true">
- </recv>
-
- <!-- Packet lost can be simulated in any send/recv message by -->
- <!-- by adding the 'lost = "10"'. Value can be [1-100] percent. -->
- <send>
- <![CDATA[
-
- ACK sip:[service]@[remote_ip]:[remote_port] SIP/2.0
- Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
- From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number]
- To: sut <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
- Call-ID: [call_id]
- CSeq: 1 ACK
- Contact: sip:sipp@[local_ip]:[local_port]
- Max-Forwards: 70
- Subject: Performance Test
- Content-Length: 0
-
- ]]>
- </send>
-
- <!-- This delay can be customized by the -d command-line option -->
- <!-- or by adding a 'milliseconds = "value"' option here. -->
- <pause/>
-
- <!-- The 'crlf' option inserts a blank line in the statistics report. -->
- <send retrans="500">
- <![CDATA[
-
- BYE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
- Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
- From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number]
- To: sut <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
- Call-ID: [call_id]
- CSeq: 2 BYE
- Contact: sip:sipp@[local_ip]:[local_port]
- Max-Forwards: 70
- Subject: Performance Test
- Content-Length: 0
-
- ]]>
- </send>
-
- <recv response="200" crlf="true">
- </recv>
-
- <!-- definition of the response time repartition table (unit is ms) -->
- <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
-
- <!-- definition of the call length repartition table (unit is ms) -->
- <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
-
-</scenario>
+++ /dev/null
-<?xml version="1.0" encoding="ISO-8859-1" ?>
-<!DOCTYPE scenario SYSTEM "sipp.dtd">
-
-
-<scenario name="MRCP Recognizer Resource UAC">
- <!-- In client mode (sipp placing calls), the Call-ID MUST be -->
- <!-- generated by sipp. To do so, use [call_id] token. -->
- <send retrans="500">
- <![CDATA[
-
- INVITE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
- Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
- From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number]
- To: sut <sip:[service]@[remote_ip]:[remote_port]>
- Call-ID: [call_id]
- CSeq: 1 INVITE
- Contact: sip:sipp@[local_ip]:[local_port]
- Max-Forwards: 70
- Subject: Performance Test
- Content-Type: application/sdp
- Content-Length: [len]
-
- v=0
- o=user1 53655765 2353687637 IN IP4 [local_ip]
- s=-
- c=IN IP4 [media_ip]
- t=0 0
- m=application 9 TCP/MRCPv2 1
- a=setup:active
- a=connection:new
- a=resource:speechrecog
- a=cmid:1
- m=audio [media_port] RTP/AVP 0 8
- a=sendonly
- a=mid:1
-
- ]]>
- </send>
-
- <recv response="100"
- optional="true">
- </recv>
-
- <recv response="180" optional="true">
- </recv>
-
- <!-- By adding rrs="true" (Record Route Sets), the route sets -->
- <!-- are saved and used for following messages sent. Useful to test -->
- <!-- against stateful SIP proxies/B2BUAs. -->
- <recv response="200" rtd="true">
- </recv>
-
- <!-- Packet lost can be simulated in any send/recv message by -->
- <!-- by adding the 'lost = "10"'. Value can be [1-100] percent. -->
- <send>
- <![CDATA[
-
- ACK sip:[service]@[remote_ip]:[remote_port] SIP/2.0
- Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
- From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number]
- To: sut <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
- Call-ID: [call_id]
- CSeq: 1 ACK
- Contact: sip:sipp@[local_ip]:[local_port]
- Max-Forwards: 70
- Subject: Performance Test
- Content-Length: 0
-
- ]]>
- </send>
-
- <!-- This delay can be customized by the -d command-line option -->
- <!-- or by adding a 'milliseconds = "value"' option here. -->
- <pause/>
-
- <!-- The 'crlf' option inserts a blank line in the statistics report. -->
- <send retrans="500">
- <![CDATA[
-
- BYE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
- Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
- From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number]
- To: sut <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
- Call-ID: [call_id]
- CSeq: 2 BYE
- Contact: sip:sipp@[local_ip]:[local_port]
- Max-Forwards: 70
- Subject: Performance Test
- Content-Length: 0
-
- ]]>
- </send>
-
- <recv response="200" crlf="true">
- </recv>
-
- <!-- definition of the response time repartition table (unit is ms) -->
- <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
-
- <!-- definition of the call length repartition table (unit is ms) -->
- <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
-
-</scenario>
+++ /dev/null
-<?xml version="1.0" encoding="ISO-8859-1" ?>
-<!DOCTYPE scenario SYSTEM "sipp.dtd">
-
-
-<scenario name="MRCP Synthesizer Resource UAC">
- <!-- In client mode (sipp placing calls), the Call-ID MUST be -->
- <!-- generated by sipp. To do so, use [call_id] token. -->
- <send retrans="500">
- <![CDATA[
-
- INVITE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
- Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
- From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number]
- To: sut <sip:[service]@[remote_ip]:[remote_port]>
- Call-ID: [call_id]
- CSeq: 1 INVITE
- Contact: sip:sipp@[local_ip]:[local_port]
- Max-Forwards: 70
- Subject: Performance Test
- Content-Type: application/sdp
- Content-Length: [len]
-
- v=0
- o=user1 53655765 2353687637 IN IP4 [local_ip]
- s=-
- c=IN IP4 [media_ip]
- t=0 0
- m=application 9 TCP/MRCPv2 1
- a=setup:active
- a=connection:new
- a=resource:speechsynth
- a=cmid:1
- m=audio [media_port] RTP/AVP 0 8
- a=recvonly
- a=mid:1
-
- ]]>
- </send>
-
- <recv response="100"
- optional="true">
- </recv>
-
- <recv response="180" optional="true">
- </recv>
-
- <!-- By adding rrs="true" (Record Route Sets), the route sets -->
- <!-- are saved and used for following messages sent. Useful to test -->
- <!-- against stateful SIP proxies/B2BUAs. -->
- <recv response="200" rtd="true">
- </recv>
-
- <!-- Packet lost can be simulated in any send/recv message by -->
- <!-- by adding the 'lost = "10"'. Value can be [1-100] percent. -->
- <send>
- <![CDATA[
-
- ACK sip:[service]@[remote_ip]:[remote_port] SIP/2.0
- Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
- From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number]
- To: sut <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
- Call-ID: [call_id]
- CSeq: 1 ACK
- Contact: sip:sipp@[local_ip]:[local_port]
- Max-Forwards: 70
- Subject: Performance Test
- Content-Length: 0
-
- ]]>
- </send>
-
- <!-- This delay can be customized by the -d command-line option -->
- <!-- or by adding a 'milliseconds = "value"' option here. -->
- <pause/>
-
- <!-- The 'crlf' option inserts a blank line in the statistics report. -->
- <send retrans="500">
- <![CDATA[
-
- BYE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
- Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
- From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number]
- To: sut <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
- Call-ID: [call_id]
- CSeq: 2 BYE
- Contact: sip:sipp@[local_ip]:[local_port]
- Max-Forwards: 70
- Subject: Performance Test
- Content-Length: 0
-
- ]]>
- </send>
-
- <recv response="200" crlf="true">
- </recv>
-
- <!-- definition of the response time repartition table (unit is ms) -->
- <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
-
- <!-- definition of the call length repartition table (unit is ms) -->
- <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
-
-</scenario>
+++ /dev/null
-<?xml version="1.0" encoding="ISO-8859-1" ?>
-<!DOCTYPE scenario SYSTEM "sipp.dtd">
-
-
-<scenario name="MRCP Unknown Resource UAC">
- <!-- In client mode (sipp placing calls), the Call-ID MUST be -->
- <!-- generated by sipp. To do so, use [call_id] token. -->
- <send retrans="500">
- <![CDATA[
-
- INVITE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
- Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
- From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number]
- To: sut <sip:[service]@[remote_ip]:[remote_port]>
- Call-ID: [call_id]
- CSeq: 1 INVITE
- Contact: sip:sipp@[local_ip]:[local_port]
- Max-Forwards: 70
- Subject: Performance Test
- Content-Type: application/sdp
- Content-Length: [len]
-
- v=0
- o=user1 53655765 2353687637 IN IP4 [local_ip]
- s=-
- c=IN IP4 [media_ip]
- t=0 0
- m=application 9 TCP/MRCPv2 1
- a=setup:active
- a=connection:new
- a=resource:unknown
- a=cmid:1
- m=audio [media_port] RTP/AVP 0 8
- a=mid:1
-
- ]]>
- </send>
-
- <recv response="100"
- optional="true">
- </recv>
-
- <recv response="180" optional="true">
- </recv>
-
- <!-- By adding rrs="true" (Record Route Sets), the route sets -->
- <!-- are saved and used for following messages sent. Useful to test -->
- <!-- against stateful SIP proxies/B2BUAs. -->
- <recv response="200" rtd="true">
- </recv>
-
- <!-- Packet lost can be simulated in any send/recv message by -->
- <!-- by adding the 'lost = "10"'. Value can be [1-100] percent. -->
- <send>
- <![CDATA[
-
- ACK sip:[service]@[remote_ip]:[remote_port] SIP/2.0
- Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
- From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number]
- To: sut <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
- Call-ID: [call_id]
- CSeq: 1 ACK
- Contact: sip:sipp@[local_ip]:[local_port]
- Max-Forwards: 70
- Subject: Performance Test
- Content-Length: 0
-
- ]]>
- </send>
-
- <!-- This delay can be customized by the -d command-line option -->
- <!-- or by adding a 'milliseconds = "value"' option here. -->
- <pause/>
-
- <!-- The 'crlf' option inserts a blank line in the statistics report. -->
- <send retrans="500">
- <![CDATA[
-
- BYE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
- Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
- From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number]
- To: sut <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
- Call-ID: [call_id]
- CSeq: 2 BYE
- Contact: sip:sipp@[local_ip]:[local_port]
- Max-Forwards: 70
- Subject: Performance Test
- Content-Length: 0
-
- ]]>
- </send>
-
- <recv response="200" crlf="true">
- </recv>
-
- <!-- definition of the response time repartition table (unit is ms) -->
- <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
-
- <!-- definition of the call length repartition table (unit is ms) -->
- <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
-
-</scenario>
+++ /dev/null
-<?xml version="1.0" encoding="ISO-8859-1" ?>
-<!DOCTYPE scenario SYSTEM "sipp.dtd">
-
-
-<scenario name="MRCP Synthesizer/Recognizer Resources UAC">
- <!-- In client mode (sipp placing calls), the Call-ID MUST be -->
- <!-- generated by sipp. To do so, use [call_id] token. -->
- <send retrans="500">
- <![CDATA[
-
- INVITE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
- Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
- From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number]
- To: sut <sip:[service]@[remote_ip]:[remote_port]>
- Call-ID: [call_id]
- CSeq: 1 INVITE
- Contact: sip:sipp@[local_ip]:[local_port]
- Max-Forwards: 70
- Subject: Performance Test
- Content-Type: application/sdp
- Content-Length: [len]
-
- v=0
- o=user1 53655765 2353687637 IN IP4 [local_ip]
- s=-
- c=IN IP4 [media_ip]
- t=0 0
- m=application 9 TCP/MRCPv2 1
- a=setup:active
- a=connection:new
- a=resource:speechsynth
- a=cmid:1
- m=audio [media_port] RTP/AVP 0 8
- a=recvonly
- a=mid:1
-
- ]]>
- </send>
-
- <recv response="100"
- optional="true">
- </recv>
-
- <recv response="180" optional="true">
- </recv>
-
- <!-- By adding rrs="true" (Record Route Sets), the route sets -->
- <!-- are saved and used for following messages sent. Useful to test -->
- <!-- against stateful SIP proxies/B2BUAs. -->
- <recv response="200" rtd="true">
- </recv>
-
- <!-- Packet lost can be simulated in any send/recv message by -->
- <!-- by adding the 'lost = "10"'. Value can be [1-100] percent. -->
- <send>
- <![CDATA[
-
- ACK sip:[service]@[remote_ip]:[remote_port] SIP/2.0
- Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
- From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number]
- To: sut <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
- Call-ID: [call_id]
- CSeq: 1 ACK
- Contact: sip:sipp@[local_ip]:[local_port]
- Max-Forwards: 70
- Subject: Performance Test
- Content-Length: 0
-
- ]]>
- </send>
-
- <!-- This delay can be customized by the -d command-line option -->
- <!-- or by adding a 'milliseconds = "value"' option here. -->
- <pause/>
-
- <!-- In client mode (sipp placing calls), the Call-ID MUST be -->
- <!-- generated by sipp. To do so, use [call_id] token. -->
- <send retrans="500">
- <![CDATA[
-
- INVITE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
- Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
- From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number]
- To: sut <sip:[service]@[remote_ip]:[remote_port]>
- Call-ID: [call_id]
- CSeq: 1 INVITE
- Contact: sip:sipp@[local_ip]:[local_port]
- Max-Forwards: 70
- Subject: Performance Test
- Content-Type: application/sdp
- Content-Length: [len]
-
- v=0
- o=user1 53655765 2353687637 IN IP4 [local_ip]
- s=-
- c=IN IP4 [media_ip]
- t=0 0
- m=application 9 TCP/MRCPv2 1
- a=setup:active
- a=connection:new
- a=resource:speechsynth
- a=cmid:1
- m=audio [media_port] RTP/AVP 0 8
- a=sendrecv
- a=mid:1
- m=application 9 TCP/MRCPv2 1
- a=setup:active
- a=connection:existing
- a=resource:speechrecog
- a=cmid:1
-
- ]]>
- </send>
-
- <recv response="100"
- optional="true">
- </recv>
-
- <recv response="180" optional="true">
- </recv>
-
- <!-- By adding rrs="true" (Record Route Sets), the route sets -->
- <!-- are saved and used for following messages sent. Useful to test -->
- <!-- against stateful SIP proxies/B2BUAs. -->
- <recv response="200" rtd="true">
- </recv>
-
- <!-- Packet lost can be simulated in any send/recv message by -->
- <!-- by adding the 'lost = "10"'. Value can be [1-100] percent. -->
- <send>
- <![CDATA[
-
- ACK sip:[service]@[remote_ip]:[remote_port] SIP/2.0
- Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
- From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number]
- To: sut <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
- Call-ID: [call_id]
- CSeq: 1 ACK
- Contact: sip:sipp@[local_ip]:[local_port]
- Max-Forwards: 70
- Subject: Performance Test
- Content-Length: 0
-
- ]]>
- </send>
-
- <!-- This delay can be customized by the -d command-line option -->
- <!-- or by adding a 'milliseconds = "value"' option here. -->
- <pause/>
-
-
- <!-- The 'crlf' option inserts a blank line in the statistics report. -->
- <send retrans="500">
- <![CDATA[
-
- BYE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
- Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
- From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number]
- To: sut <sip:[service]@[remote_ip]:[remote_port]>[peer_tag_param]
- Call-ID: [call_id]
- CSeq: 2 BYE
- Contact: sip:sipp@[local_ip]:[local_port]
- Max-Forwards: 70
- Subject: Performance Test
- Content-Length: 0
-
- ]]>
- </send>
-
- <recv response="200" crlf="true">
- </recv>
-
- <!-- definition of the response time repartition table (unit is ms) -->
- <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
-
- <!-- definition of the call length repartition table (unit is ms) -->
- <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
-
-</scenario>
+++ /dev/null
-<?xml version="1.0" encoding="ISO-8859-1" ?>
-<!DOCTYPE scenario SYSTEM "sipp.dtd">
-
-
-<scenario name="MRCP Recognizer Resource UAS">
- <!-- By adding rrs="true" (Record Route Sets), the route sets -->
- <!-- are saved and used for following messages sent. Useful to test -->
- <!-- against stateful SIP proxies/B2BUAs. -->
- <recv request="INVITE" crlf="true">
- </recv>
-
- <!-- The '[last_*]' keyword is replaced automatically by the -->
- <!-- specified header if it was present in the last message received -->
- <!-- (except if it was a retransmission). If the header was not -->
- <!-- present or if no message has been received, the '[last_*]' -->
- <!-- keyword is discarded, and all bytes until the end of the line -->
- <!-- are also discarded. -->
- <!-- -->
- <!-- If the specified header was present several times in the -->
- <!-- message, all occurences are concatenated (CRLF seperated) -->
- <!-- to be used in place of the '[last_*]' keyword. -->
-
- <send retrans="500">
- <![CDATA[
-
- SIP/2.0 200 OK
- [last_Via:]
- [last_From:]
- [last_To:];tag=[call_number]
- [last_Call-ID:]
- [last_CSeq:]
- Contact: <sip:[local_ip]:[local_port];transport=[transport]>
- Content-Type: application/sdp
- Content-Length: [len]
-
- v=0
- o=user1 53655765 2353687637 IN IP4 [local_ip]
- s=-
- c=IN IP4 [media_ip]
- t=0 0
- m=application 1050 TCP/MRCPv2 1
- a=setup:passive
- a=connection:new
- a=channel:dca48cf082dd584b@speechrecog
- a=cmid:1
- m=audio [media_port] RTP/AVP 0 8
- a=recvonly
- a=mid:1
-
- ]]>
- </send>
-
- <recv request="ACK"
- optional="true"
- rtd="true"
- crlf="true">
- </recv>
-
- <recv request="INVITE" crlf="true">
- </recv>
-
- <send retrans="500">
- <![CDATA[
-
- SIP/2.0 200 OK
- [last_Via:]
- [last_From:]
- [last_To:];tag=[call_number]
- [last_Call-ID:]
- [last_CSeq:]
- Contact: <sip:[local_ip]:[local_port];transport=[transport]>
- Content-Type: application/sdp
- Content-Length: [len]
-
- v=0
- o=user1 53655765 2353687637 IN IP4 [local_ip]
- s=-
- c=IN IP4 [media_ip]
- t=0 0
- m=application 0 TCP/MRCPv2 1
- a=setup:passive
- a=connection:existing
- a=channel:dca48cf082dd584b@speechrecog
- a=cmid:1
- m=audio 0 RTP/AVP 0 8
- a=recvonly
- a=mid:1
-
- ]]>
- </send>
-
- <recv request="ACK"
- optional="true"
- rtd="true"
- crlf="true">
- </recv>
-
- <recv request="BYE">
- </recv>
-
- <send>
- <![CDATA[
-
- SIP/2.0 200 OK
- [last_Via:]
- [last_From:]
- [last_To:]
- [last_Call-ID:]
- [last_CSeq:]
- Contact: <sip:[local_ip]:[local_port];transport=[transport]>
- Content-Length: 0
-
- ]]>
- </send>
-
- <!-- Keep the call open for a while in case the 200 is lost to be -->
- <!-- able to retransmit it if we receive the BYE again. -->
- <pause milliseconds="4000"/>
-
-
- <!-- definition of the response time repartition table (unit is ms) -->
- <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
-
- <!-- definition of the call length repartition table (unit is ms) -->
- <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
-
-</scenario>
+++ /dev/null
-<?xml version="1.0" encoding="ISO-8859-1" ?>
-<!DOCTYPE scenario SYSTEM "sipp.dtd">
-
-
-<scenario name="MRCP Rejected Offer UAS">
- <!-- By adding rrs="true" (Record Route Sets), the route sets -->
- <!-- are saved and used for following messages sent. Useful to test -->
- <!-- against stateful SIP proxies/B2BUAs. -->
- <recv request="INVITE" crlf="true">
- </recv>
-
- <!-- The '[last_*]' keyword is replaced automatically by the -->
- <!-- specified header if it was present in the last message received -->
- <!-- (except if it was a retransmission). If the header was not -->
- <!-- present or if no message has been received, the '[last_*]' -->
- <!-- keyword is discarded, and all bytes until the end of the line -->
- <!-- are also discarded. -->
- <!-- -->
- <!-- If the specified header was present several times in the -->
- <!-- message, all occurences are concatenated (CRLF seperated) -->
- <!-- to be used in place of the '[last_*]' keyword. -->
-
- <send retrans="500">
- <![CDATA[
-
- SIP/2.0 404 OK
- [last_Via:]
- [last_From:]
- [last_To:];tag=[call_number]
- [last_Call-ID:]
- [last_CSeq:]
- Contact: <sip:[local_ip]:[local_port];transport=[transport]>
- Content-Length: 0
- ]]>
- </send>
-
- <recv request="ACK"
- optional="true"
- rtd="true"
- crlf="true">
- </recv>
-
- <!-- definition of the response time repartition table (unit is ms) -->
- <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
-
- <!-- definition of the call length repartition table (unit is ms) -->
- <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
-
-</scenario>
+++ /dev/null
-<?xml version="1.0" encoding="ISO-8859-1" ?>
-<!DOCTYPE scenario SYSTEM "sipp.dtd">
-
-
-<scenario name="MRCP Synthesizer Resource UAS">
- <!-- By adding rrs="true" (Record Route Sets), the route sets -->
- <!-- are saved and used for following messages sent. Useful to test -->
- <!-- against stateful SIP proxies/B2BUAs. -->
- <recv request="INVITE" crlf="true">
- </recv>
-
- <!-- The '[last_*]' keyword is replaced automatically by the -->
- <!-- specified header if it was present in the last message received -->
- <!-- (except if it was a retransmission). If the header was not -->
- <!-- present or if no message has been received, the '[last_*]' -->
- <!-- keyword is discarded, and all bytes until the end of the line -->
- <!-- are also discarded. -->
- <!-- -->
- <!-- If the specified header was present several times in the -->
- <!-- message, all occurences are concatenated (CRLF seperated) -->
- <!-- to be used in place of the '[last_*]' keyword. -->
-
- <send retrans="500">
- <![CDATA[
-
- SIP/2.0 200 OK
- [last_Via:]
- [last_From:]
- [last_To:];tag=[call_number]
- [last_Call-ID:]
- [last_CSeq:]
- Contact: <sip:[local_ip]:[local_port];transport=[transport]>
- Content-Type: application/sdp
- Content-Length: [len]
-
- v=0
- o=user1 53655765 2353687637 IN IP4 [local_ip]
- s=-
- c=IN IP4 [media_ip]
- t=0 0
- m=application 1050 TCP/MRCPv2 1
- a=setup:passive
- a=connection:new
- a=channel:dca48cf082dd584b@speechsynth
- a=cmid:1
- m=audio [media_port] RTP/AVP 0 8
- a=sendonly
- a=mid:1
-
- ]]>
- </send>
-
- <recv request="ACK"
- optional="true"
- rtd="true"
- crlf="true">
- </recv>
-
- <recv request="INVITE" crlf="true">
- </recv>
-
- <send retrans="500">
- <![CDATA[
-
- SIP/2.0 200 OK
- [last_Via:]
- [last_From:]
- [last_To:];tag=[call_number]
- [last_Call-ID:]
- [last_CSeq:]
- Contact: <sip:[local_ip]:[local_port];transport=[transport]>
- Content-Type: application/sdp
- Content-Length: [len]
-
- v=0
- o=user1 53655765 2353687637 IN IP4 [local_ip]
- s=-
- c=IN IP4 [media_ip]
- t=0 0
- m=application 0 TCP/MRCPv2 1
- a=setup:passive
- a=connection:existing
- a=channel:dca48cf082dd584b@speechsynth
- a=cmid:1
- m=audio 0 RTP/AVP 0 8
- a=sendonly
- a=mid:1
-
- ]]>
- </send>
-
- <recv request="ACK"
- optional="true"
- rtd="true"
- crlf="true">
- </recv>
-
- <recv request="BYE">
- </recv>
-
- <send>
- <![CDATA[
-
- SIP/2.0 200 OK
- [last_Via:]
- [last_From:]
- [last_To:]
- [last_Call-ID:]
- [last_CSeq:]
- Contact: <sip:[local_ip]:[local_port];transport=[transport]>
- Content-Length: 0
-
- ]]>
- </send>
-
- <!-- Keep the call open for a while in case the 200 is lost to be -->
- <!-- able to retransmit it if we receive the BYE again. -->
- <pause milliseconds="4000"/>
-
-
- <!-- definition of the response time repartition table (unit is ms) -->
- <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
-
- <!-- definition of the call length repartition table (unit is ms) -->
- <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
-
-</scenario>
+++ /dev/null
-<?xml version="1.0" encoding="ISO-8859-1" ?>
-<!DOCTYPE scenario SYSTEM "sipp.dtd">
-
-
-<scenario name="MRCP Unknown Resource UAS">
- <!-- By adding rrs="true" (Record Route Sets), the route sets -->
- <!-- are saved and used for following messages sent. Useful to test -->
- <!-- against stateful SIP proxies/B2BUAs. -->
- <recv request="INVITE" crlf="true">
- </recv>
-
- <!-- The '[last_*]' keyword is replaced automatically by the -->
- <!-- specified header if it was present in the last message received -->
- <!-- (except if it was a retransmission). If the header was not -->
- <!-- present or if no message has been received, the '[last_*]' -->
- <!-- keyword is discarded, and all bytes until the end of the line -->
- <!-- are also discarded. -->
- <!-- -->
- <!-- If the specified header was present several times in the -->
- <!-- message, all occurences are concatenated (CRLF seperated) -->
- <!-- to be used in place of the '[last_*]' keyword. -->
-
- <send retrans="500">
- <![CDATA[
-
- SIP/2.0 200 OK
- [last_Via:]
- [last_From:]
- [last_To:];tag=[call_number]
- [last_Call-ID:]
- [last_CSeq:]
- Contact: <sip:[local_ip]:[local_port];transport=[transport]>
- Content-Type: application/sdp
- Content-Length: [len]
-
- v=0
- o=user1 53655765 2353687637 IN IP4 [local_ip]
- s=-
- c=IN IP4 [media_ip]
- t=0 0
- m=application 0 TCP/MRCPv2 1
- a=setup:passive
- a=connection:new
- a=channel:dca48cf082dd584b@unknown
- a=cmid:1
- m=audio 0 RTP/AVP 0 8
- a=sendonly
- a=mid:1
-
- ]]>
- </send>
-
- <recv request="ACK"
- optional="true"
- rtd="true"
- crlf="true">
- </recv>
-
- <recv request="BYE">
- </recv>
-
- <send>
- <![CDATA[
-
- SIP/2.0 200 OK
- [last_Via:]
- [last_From:]
- [last_To:]
- [last_Call-ID:]
- [last_CSeq:]
- Contact: <sip:[local_ip]:[local_port];transport=[transport]>
- Content-Length: 0
-
- ]]>
- </send>
-
- <!-- Keep the call open for a while in case the 200 is lost to be -->
- <!-- able to retransmit it if we receive the BYE again. -->
- <pause milliseconds="4000"/>
-
-
- <!-- definition of the response time repartition table (unit is ms) -->
- <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
-
- <!-- definition of the call length repartition table (unit is ms) -->
- <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
-
-</scenario>
+++ /dev/null
-MAINTAINERCLEANFILES = Makefile.in
-
-AM_CPPFLAGS = -I$(top_srcdir)/libs/apr-toolkit/include \
- $(UNIMRCP_APR_INCLUDES)
-
-noinst_PROGRAMS = strtablegen
-strtablegen_LDADD = $(top_builddir)/libs/apr-toolkit/libaprtoolkit.la \
- $(UNIMRCP_APR_LIBS)
-strtablegen_SOURCES = src/main.c
+++ /dev/null
-/*
- * 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: main.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
- */
-
-#include <stdio.h>
-#include <ctype.h>
-#include "apt_pool.h"
-#include "apt_string_table.h"
-#include "apt_text_stream.h"
-
-static apt_bool_t is_unique(const apt_str_table_item_t table[], apr_size_t count,
- apr_size_t item_index, apr_size_t char_index, char value)
-{
- size_t i;
- const char *buf;
- for(i=0; i<count; i++) {
- buf = table[i].value.buf;
- if(i != item_index && char_index < table[i].value.length &&
- tolower(value) == tolower(buf[char_index])) {
- return FALSE;
- }
- }
- return TRUE;
-}
-
-static apt_bool_t string_table_key_generate(apt_str_table_item_t table[], apr_size_t count)
-{
- size_t i,j;
- size_t length;
- for(i=0; i<count; i++) {
- length = table[i].value.length;
- table[i].key = length;
- for(j=0; j<length; j++) {
- if(is_unique(table,count,i,j,table[i].value.buf[j]) == TRUE) {
- table[i].key = j;
- break;
- }
- }
- }
- return TRUE;
-}
-
-#define TEST_BUFFER_SIZE 2048
-static char parse_buffer[TEST_BUFFER_SIZE];
-
-static size_t string_table_read(apt_str_table_item_t table[], apr_size_t max_count, FILE *file, apr_pool_t *pool)
-{
- apt_str_table_item_t *item;
- size_t count = 0;
- apt_str_t line;
- apt_text_stream_t text_stream;
-
- text_stream.text.length = fread(parse_buffer, 1, sizeof(parse_buffer)-1, file);
- parse_buffer[text_stream.text.length] = '\0';
- text_stream.text.buf = parse_buffer;
- apt_text_stream_reset(&text_stream);
-
- do {
- if(apt_text_line_read(&text_stream,&line) == FALSE || !line.length) {
- break;
- }
- item = &table[count];
- apt_string_copy(&item->value,&line,pool);
- item->key = 0;
- count++;
- }
- while(count < max_count);
-
- return count;
-}
-
-static apt_bool_t string_table_write(const apt_str_table_item_t table[], apr_size_t count, FILE *file)
-{
- size_t i;
- const apt_str_table_item_t *item;
- for(i=0; i<count; i++) {
- item = &table[i];
- fprintf(file,"{{\"%s\",%"APR_SIZE_T_FMT"},%"APR_SIZE_T_FMT"},\r\n",
- item->value.buf, item->value.length, item->key);
- }
- return TRUE;
-}
-
-int main(int argc, char *argv[])
-{
- apr_pool_t *pool = NULL;
- apt_str_table_item_t table[100];
- size_t count;
- FILE *file_in, *file_out;
-
- /* one time apr global initialization */
- if(apr_initialize() != APR_SUCCESS) {
- return 0;
- }
- pool = apt_pool_create();
-
- if(argc < 2) {
- printf("usage: stringtablegen stringtable.in [stringtable.out]\n");
- return 0;
- }
- file_in = fopen(argv[1], "rb");
- if(file_in == NULL) {
- printf("cannot open file %s\n", argv[1]);
- return 0;
- }
-
- if(argc > 2) {
- file_out = fopen(argv[2], "wb");
- }
- else {
- file_out = stdout;
- }
-
- /* read items (strings) from the file */
- count = string_table_read(table,100,file_in,pool);
-
- /* generate string table */
- string_table_key_generate(table,count);
-
- /* dump string table to the file */
- string_table_write(table,count,file_out);
-
- fclose(file_in);
- if(file_out != stdout) {
- fclose(file_out);
- }
-
- apr_pool_destroy(pool);
- /* final apr global termination */
- apr_terminate();
- return 0;
-}
+++ /dev/null
-Channel-Identifier
-Active-Request-Id-List
-Proxy-Sync-Id
-Accept-Charset
-Content-Type
-Content-Id
-Content-Base
-Content-Encoding
-Content-Location
-Content-Length
-Cache-Control
-Logging-Tag
+++ /dev/null
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="strtablegen"
- ProjectGUID="{79EF9F1D-E211-4ED1-91D2-FC935AB3A872}"
- RootNamespace="strtablegen"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- <Platform
- Name="x64"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- ConfigurationType="1"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unibin.vsprops;$(ProjectDir)..\..\build\vsprops\apt.vsprops"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="aprtoolkit.lib libaprutil-1.lib libapr-1.lib"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- ConfigurationType="1"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unibin.vsprops;$(ProjectDir)..\..\build\vsprops\apt.vsprops"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="aprtoolkit.lib libaprutil-1.lib libapr-1.lib"
- LinkTimeCodeGeneration="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Debug|x64"
- ConfigurationType="1"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unidebug.vsprops;$(ProjectDir)..\..\build\vsprops\unibin-x64.vsprops;$(ProjectDir)..\..\build\vsprops\apt.vsprops"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="aprtoolkit.lib libaprutil-1.lib libapr-1.lib"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|x64"
- ConfigurationType="1"
- InheritedPropertySheets="$(ProjectDir)..\..\build\vsprops\unirelease.vsprops;$(ProjectDir)..\..\build\vsprops\unibin-x64.vsprops;$(ProjectDir)..\..\build\vsprops\apt.vsprops"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="aprtoolkit.lib libaprutil-1.lib libapr-1.lib"
- LinkTimeCodeGeneration="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="src"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath=".\src\main.c"
- >
- </File>
- </Filter>
- <Filter
- Name="include"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{79EF9F1D-E211-4ED1-91D2-FC935AB3A872}</ProjectGuid>
- <RootNamespace>strtablegen</RootNamespace>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unibin.props" />
- <Import Project="$(ProjectDir)..\..\build\props\apt.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" />
- <Import Project="$(ProjectDir)..\..\build\props\unibin.props" />
- <Import Project="$(ProjectDir)..\..\build\props\apt.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unirelease.props" />
- <Import Project="$(ProjectDir)..\..\build\props\unibin-x64.props" />
- <Import Project="$(ProjectDir)..\..\build\props\apt.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(ProjectDir)..\..\build\props\unidebug.vsprops" />
- <Import Project="$(ProjectDir)..\..\build\props\unibin-x64.props" />
- <Import Project="$(ProjectDir)..\..\build\props\apt.props" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
- <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
- <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
- <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <Link>
- <AdditionalDependencies>aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies)</AdditionalDependencies>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <Link>
- <AdditionalDependencies>aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- <Link>
- <AdditionalDependencies>aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies)</AdditionalDependencies>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <Link>
- <AdditionalDependencies>aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
- </Link>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="src\main.c" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\libs\apr-toolkit\aprtoolkit.vcxproj">
- <Project>{13deeca0-bdd4-4744-a1a2-8eb0a44df3d2}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="src">
- <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
- </Filter>
- <Filter Include="include">
- <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="src\main.c">
- <Filter>src</Filter>
- </ClCompile>
- </ItemGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-
-Microsoft Visual Studio Solution File, Format Version 11.00
-# Visual Studio 2010
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "libs", "libs", "{5377DC3A-DB96-4819-8AAF-2A75F3A69119}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "modules", "modules", "{493A1DB9-6E7C-48C7-93B5-F75C3C25B9DF}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "platforms", "platforms", "{8E282AE2-038C-49FE-AC67-BC9615AFD800}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "plugins", "plugins", "{09BABD45-8F30-4F99-B8B8-8DD78F6804DB}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{AC4356E8-48A1-4D2D-AFB1-11CF30B974CD}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{62083CC3-13BF-49EA-BFE8-4C9337C0D82C}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "conf", "conf", "{9155EBB8-E7DD-49AE-A86A-7B90B9F09888}"
- ProjectSection(SolutionItems) = preProject
- conf\logger.xml = conf\logger.xml
- conf\unimrcpclient.xml = conf\unimrcpclient.xml
- conf\unimrcpclient.xsd = conf\unimrcpclient.xsd
- conf\unimrcpserver.xml = conf\unimrcpserver.xml
- conf\unimrcpserver.xsd = conf\unimrcpserver.xsd
- EndProjectSection
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "client-profiles", "client-profiles", "{F2D6C1AF-0C05-4695-84AF-15A2F92F9899}"
- ProjectSection(SolutionItems) = preProject
- conf\client-profiles\lumenvox.xml = conf\client-profiles\lumenvox.xml
- conf\client-profiles\nuance.xml = conf\client-profiles\nuance.xml
- conf\client-profiles\unimrcp.xml = conf\client-profiles\unimrcp.xml
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unimrcpserver", "platforms\unimrcp-server\unimrcpserver.vcxproj", "{592CF22D-3F8F-4A77-A174-130D77B7623B}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "aprtoolkit", "libs\apr-toolkit\aprtoolkit.vcxproj", "{13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mpf", "libs\mpf\mpf.vcxproj", "{B5A00BFA-6083-4FAE-A097-71642D6473B5}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mrcp", "libs\mrcp\mrcp.vcxproj", "{1C320193-46A6-4B34-9C56-8AB584FC1B56}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mrcpsignaling", "libs\mrcp-signaling\mrcpsignaling.vcxproj", "{12A49562-BAB9-43A3-A21D-15B60BBB4C31}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mrcpserver", "libs\mrcp-server\mrcpserver.vcxproj", "{18B1F35A-10F8-4287-9B37-2D10501B0B38}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libunimrcpserver", "platforms\libunimrcp-server\libunimrcpserver.vcxproj", "{C98AF157-352E-4737-BD30-A24E2647F5AE}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mrcpsofiasip", "modules\mrcp-sofiasip\mrcpsofiasip.vcxproj", "{746F3632-5BB2-4570-9453-31D6D58A7D8E}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mrcpclient", "libs\mrcp-client\mrcpclient.vcxproj", "{72782932-37CC-46AE-8C7F-9A7B1A6EE108}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libunimrcpclient", "platforms\libunimrcp-client\libunimrcpclient.vcxproj", "{EE157390-1E85-416C-946E-620E32C9AD33}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unimrcpclient", "platforms\unimrcp-client\unimrcpclient.vcxproj", "{57FAF32E-49FD-491F-895D-132D0D5EFE0A}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mrcpv2transport", "libs\mrcpv2-transport\mrcpv2transport.vcxproj", "{A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mrcpengine", "libs\mrcp-engine\mrcpengine.vcxproj", "{843425BE-9A9A-44F4-A4E3-4B57D6ABD53C}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "demosynth", "plugins\demo-synth\demosynth.vcxproj", "{92BFA534-C419-4EB2-AAA3-510653F38F08}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "demorecog", "plugins\demo-recog\demorecog.vcxproj", "{B495B6D9-AF84-479D-B30A-313C16EF8BFD}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "strtablegen", "tests\strtablegen\strtablegen.vcxproj", "{79EF9F1D-E211-4ED1-91D2-FC935AB3A872}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "apttest", "tests\apttest\apttest.vcxproj", "{429C907B-97D1-4B2D-9B0E-A14A5BFDAD15}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mpftest", "tests\mpftest\mpftest.vcxproj", "{DCF01B1C-5268-44F3-9130-D647FABFB663}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mrcptest", "tests\mrcptest\mrcptest.vcxproj", "{3CA97077-6210-4362-998A-D15A35EEAA08}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unirtsp", "libs\uni-rtsp\unirtsp.vcxproj", "{504B3154-7A4F-459D-9877-B951021C3F1F}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rtsptest", "tests\rtsptest\rtsptest.vcxproj", "{17A33F3F-BAF5-403F-8EF4-FECDA7D9A335}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mrcpunirtsp", "modules\mrcp-unirtsp\mrcpunirtsp.vcxproj", "{DEB01ACB-D65F-4A62-AED9-58C1054499E9}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "prepare", "build\tools\prepare.vcxproj", "{01D63BF5-7798-4746-852A-4B45229BB735}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unimrcpservice", "build\tools\unimrcpservice.vcxproj", "{4714EF49-BFD5-4B22-95F7-95A07F1EAC25}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "asrclient", "platforms\asr-client\asrclient.vcxproj", "{6B83AC6D-01CE-4E1C-81CE-02AD8116C684}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libasrclient", "platforms\libasr-client\libasrclient.vcxproj", "{272FAFA8-2B2F-4716-B95F-3B37CF2E0CB3}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "umc", "platforms\umc\umc.vcxproj", "{CD1C52C1-D8E1-4654-AE65-6CCAB38DE894}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mrcprecorder", "plugins\mrcp-recorder\mrcprecorder.vcxproj", "{5AFB8B04-AEB9-408C-B53E-AFBC44B5F3F2}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "demoverifier", "plugins\demo-verifier\demoverifier.vcxproj", "{F7563CAD-5C95-46E5-89B7-0953C6C6E746}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Win32 = Debug|Win32
- Debug|x64 = Debug|x64
- Release|Win32 = Release|Win32
- Release|x64 = Release|x64
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {592CF22D-3F8F-4A77-A174-130D77B7623B}.Debug|Win32.ActiveCfg = Debug|Win32
- {592CF22D-3F8F-4A77-A174-130D77B7623B}.Debug|Win32.Build.0 = Debug|Win32
- {592CF22D-3F8F-4A77-A174-130D77B7623B}.Debug|x64.ActiveCfg = Debug|x64
- {592CF22D-3F8F-4A77-A174-130D77B7623B}.Debug|x64.Build.0 = Debug|x64
- {592CF22D-3F8F-4A77-A174-130D77B7623B}.Release|Win32.ActiveCfg = Release|Win32
- {592CF22D-3F8F-4A77-A174-130D77B7623B}.Release|Win32.Build.0 = Release|Win32
- {592CF22D-3F8F-4A77-A174-130D77B7623B}.Release|x64.ActiveCfg = Release|x64
- {592CF22D-3F8F-4A77-A174-130D77B7623B}.Release|x64.Build.0 = Release|x64
- {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.Debug|Win32.ActiveCfg = Debug|Win32
- {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.Debug|Win32.Build.0 = Debug|Win32
- {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.Debug|x64.ActiveCfg = Debug|x64
- {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.Debug|x64.Build.0 = Debug|x64
- {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.Release|Win32.ActiveCfg = Release|Win32
- {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.Release|Win32.Build.0 = Release|Win32
- {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.Release|x64.ActiveCfg = Release|x64
- {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.Release|x64.Build.0 = Release|x64
- {B5A00BFA-6083-4FAE-A097-71642D6473B5}.Debug|Win32.ActiveCfg = Debug|Win32
- {B5A00BFA-6083-4FAE-A097-71642D6473B5}.Debug|Win32.Build.0 = Debug|Win32
- {B5A00BFA-6083-4FAE-A097-71642D6473B5}.Debug|x64.ActiveCfg = Debug|x64
- {B5A00BFA-6083-4FAE-A097-71642D6473B5}.Debug|x64.Build.0 = Debug|x64
- {B5A00BFA-6083-4FAE-A097-71642D6473B5}.Release|Win32.ActiveCfg = Release|Win32
- {B5A00BFA-6083-4FAE-A097-71642D6473B5}.Release|Win32.Build.0 = Release|Win32
- {B5A00BFA-6083-4FAE-A097-71642D6473B5}.Release|x64.ActiveCfg = Release|x64
- {B5A00BFA-6083-4FAE-A097-71642D6473B5}.Release|x64.Build.0 = Release|x64
- {1C320193-46A6-4B34-9C56-8AB584FC1B56}.Debug|Win32.ActiveCfg = Debug|Win32
- {1C320193-46A6-4B34-9C56-8AB584FC1B56}.Debug|Win32.Build.0 = Debug|Win32
- {1C320193-46A6-4B34-9C56-8AB584FC1B56}.Debug|x64.ActiveCfg = Debug|x64
- {1C320193-46A6-4B34-9C56-8AB584FC1B56}.Debug|x64.Build.0 = Debug|x64
- {1C320193-46A6-4B34-9C56-8AB584FC1B56}.Release|Win32.ActiveCfg = Release|Win32
- {1C320193-46A6-4B34-9C56-8AB584FC1B56}.Release|Win32.Build.0 = Release|Win32
- {1C320193-46A6-4B34-9C56-8AB584FC1B56}.Release|x64.ActiveCfg = Release|x64
- {1C320193-46A6-4B34-9C56-8AB584FC1B56}.Release|x64.Build.0 = Release|x64
- {12A49562-BAB9-43A3-A21D-15B60BBB4C31}.Debug|Win32.ActiveCfg = Debug|Win32
- {12A49562-BAB9-43A3-A21D-15B60BBB4C31}.Debug|Win32.Build.0 = Debug|Win32
- {12A49562-BAB9-43A3-A21D-15B60BBB4C31}.Debug|x64.ActiveCfg = Debug|x64
- {12A49562-BAB9-43A3-A21D-15B60BBB4C31}.Debug|x64.Build.0 = Debug|x64
- {12A49562-BAB9-43A3-A21D-15B60BBB4C31}.Release|Win32.ActiveCfg = Release|Win32
- {12A49562-BAB9-43A3-A21D-15B60BBB4C31}.Release|Win32.Build.0 = Release|Win32
- {12A49562-BAB9-43A3-A21D-15B60BBB4C31}.Release|x64.ActiveCfg = Release|x64
- {12A49562-BAB9-43A3-A21D-15B60BBB4C31}.Release|x64.Build.0 = Release|x64
- {18B1F35A-10F8-4287-9B37-2D10501B0B38}.Debug|Win32.ActiveCfg = Debug|Win32
- {18B1F35A-10F8-4287-9B37-2D10501B0B38}.Debug|Win32.Build.0 = Debug|Win32
- {18B1F35A-10F8-4287-9B37-2D10501B0B38}.Debug|x64.ActiveCfg = Debug|x64
- {18B1F35A-10F8-4287-9B37-2D10501B0B38}.Debug|x64.Build.0 = Debug|x64
- {18B1F35A-10F8-4287-9B37-2D10501B0B38}.Release|Win32.ActiveCfg = Release|Win32
- {18B1F35A-10F8-4287-9B37-2D10501B0B38}.Release|Win32.Build.0 = Release|Win32
- {18B1F35A-10F8-4287-9B37-2D10501B0B38}.Release|x64.ActiveCfg = Release|x64
- {18B1F35A-10F8-4287-9B37-2D10501B0B38}.Release|x64.Build.0 = Release|x64
- {C98AF157-352E-4737-BD30-A24E2647F5AE}.Debug|Win32.ActiveCfg = Debug|Win32
- {C98AF157-352E-4737-BD30-A24E2647F5AE}.Debug|Win32.Build.0 = Debug|Win32
- {C98AF157-352E-4737-BD30-A24E2647F5AE}.Debug|x64.ActiveCfg = Debug|x64
- {C98AF157-352E-4737-BD30-A24E2647F5AE}.Debug|x64.Build.0 = Debug|x64
- {C98AF157-352E-4737-BD30-A24E2647F5AE}.Release|Win32.ActiveCfg = Release|Win32
- {C98AF157-352E-4737-BD30-A24E2647F5AE}.Release|Win32.Build.0 = Release|Win32
- {C98AF157-352E-4737-BD30-A24E2647F5AE}.Release|x64.ActiveCfg = Release|x64
- {C98AF157-352E-4737-BD30-A24E2647F5AE}.Release|x64.Build.0 = Release|x64
- {746F3632-5BB2-4570-9453-31D6D58A7D8E}.Debug|Win32.ActiveCfg = Debug|Win32
- {746F3632-5BB2-4570-9453-31D6D58A7D8E}.Debug|Win32.Build.0 = Debug|Win32
- {746F3632-5BB2-4570-9453-31D6D58A7D8E}.Debug|x64.ActiveCfg = Debug|x64
- {746F3632-5BB2-4570-9453-31D6D58A7D8E}.Debug|x64.Build.0 = Debug|x64
- {746F3632-5BB2-4570-9453-31D6D58A7D8E}.Release|Win32.ActiveCfg = Release|Win32
- {746F3632-5BB2-4570-9453-31D6D58A7D8E}.Release|Win32.Build.0 = Release|Win32
- {746F3632-5BB2-4570-9453-31D6D58A7D8E}.Release|x64.ActiveCfg = Release|x64
- {746F3632-5BB2-4570-9453-31D6D58A7D8E}.Release|x64.Build.0 = Release|x64
- {72782932-37CC-46AE-8C7F-9A7B1A6EE108}.Debug|Win32.ActiveCfg = Debug|Win32
- {72782932-37CC-46AE-8C7F-9A7B1A6EE108}.Debug|Win32.Build.0 = Debug|Win32
- {72782932-37CC-46AE-8C7F-9A7B1A6EE108}.Debug|x64.ActiveCfg = Debug|x64
- {72782932-37CC-46AE-8C7F-9A7B1A6EE108}.Debug|x64.Build.0 = Debug|x64
- {72782932-37CC-46AE-8C7F-9A7B1A6EE108}.Release|Win32.ActiveCfg = Release|Win32
- {72782932-37CC-46AE-8C7F-9A7B1A6EE108}.Release|Win32.Build.0 = Release|Win32
- {72782932-37CC-46AE-8C7F-9A7B1A6EE108}.Release|x64.ActiveCfg = Release|x64
- {72782932-37CC-46AE-8C7F-9A7B1A6EE108}.Release|x64.Build.0 = Release|x64
- {EE157390-1E85-416C-946E-620E32C9AD33}.Debug|Win32.ActiveCfg = Debug|Win32
- {EE157390-1E85-416C-946E-620E32C9AD33}.Debug|Win32.Build.0 = Debug|Win32
- {EE157390-1E85-416C-946E-620E32C9AD33}.Debug|x64.ActiveCfg = Debug|x64
- {EE157390-1E85-416C-946E-620E32C9AD33}.Debug|x64.Build.0 = Debug|x64
- {EE157390-1E85-416C-946E-620E32C9AD33}.Release|Win32.ActiveCfg = Release|Win32
- {EE157390-1E85-416C-946E-620E32C9AD33}.Release|Win32.Build.0 = Release|Win32
- {EE157390-1E85-416C-946E-620E32C9AD33}.Release|x64.ActiveCfg = Release|x64
- {EE157390-1E85-416C-946E-620E32C9AD33}.Release|x64.Build.0 = Release|x64
- {57FAF32E-49FD-491F-895D-132D0D5EFE0A}.Debug|Win32.ActiveCfg = Debug|Win32
- {57FAF32E-49FD-491F-895D-132D0D5EFE0A}.Debug|Win32.Build.0 = Debug|Win32
- {57FAF32E-49FD-491F-895D-132D0D5EFE0A}.Debug|x64.ActiveCfg = Debug|x64
- {57FAF32E-49FD-491F-895D-132D0D5EFE0A}.Debug|x64.Build.0 = Debug|x64
- {57FAF32E-49FD-491F-895D-132D0D5EFE0A}.Release|Win32.ActiveCfg = Release|Win32
- {57FAF32E-49FD-491F-895D-132D0D5EFE0A}.Release|Win32.Build.0 = Release|Win32
- {57FAF32E-49FD-491F-895D-132D0D5EFE0A}.Release|x64.ActiveCfg = Release|x64
- {57FAF32E-49FD-491F-895D-132D0D5EFE0A}.Release|x64.Build.0 = Release|x64
- {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.Debug|Win32.ActiveCfg = Debug|Win32
- {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.Debug|Win32.Build.0 = Debug|Win32
- {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.Debug|x64.ActiveCfg = Debug|x64
- {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.Debug|x64.Build.0 = Debug|x64
- {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.Release|Win32.ActiveCfg = Release|Win32
- {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.Release|Win32.Build.0 = Release|Win32
- {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.Release|x64.ActiveCfg = Release|x64
- {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.Release|x64.Build.0 = Release|x64
- {843425BE-9A9A-44F4-A4E3-4B57D6ABD53C}.Debug|Win32.ActiveCfg = Debug|Win32
- {843425BE-9A9A-44F4-A4E3-4B57D6ABD53C}.Debug|Win32.Build.0 = Debug|Win32
- {843425BE-9A9A-44F4-A4E3-4B57D6ABD53C}.Debug|x64.ActiveCfg = Debug|x64
- {843425BE-9A9A-44F4-A4E3-4B57D6ABD53C}.Debug|x64.Build.0 = Debug|x64
- {843425BE-9A9A-44F4-A4E3-4B57D6ABD53C}.Release|Win32.ActiveCfg = Release|Win32
- {843425BE-9A9A-44F4-A4E3-4B57D6ABD53C}.Release|Win32.Build.0 = Release|Win32
- {843425BE-9A9A-44F4-A4E3-4B57D6ABD53C}.Release|x64.ActiveCfg = Release|x64
- {843425BE-9A9A-44F4-A4E3-4B57D6ABD53C}.Release|x64.Build.0 = Release|x64
- {92BFA534-C419-4EB2-AAA3-510653F38F08}.Debug|Win32.ActiveCfg = Debug|Win32
- {92BFA534-C419-4EB2-AAA3-510653F38F08}.Debug|Win32.Build.0 = Debug|Win32
- {92BFA534-C419-4EB2-AAA3-510653F38F08}.Debug|x64.ActiveCfg = Debug|x64
- {92BFA534-C419-4EB2-AAA3-510653F38F08}.Debug|x64.Build.0 = Debug|x64
- {92BFA534-C419-4EB2-AAA3-510653F38F08}.Release|Win32.ActiveCfg = Release|Win32
- {92BFA534-C419-4EB2-AAA3-510653F38F08}.Release|Win32.Build.0 = Release|Win32
- {92BFA534-C419-4EB2-AAA3-510653F38F08}.Release|x64.ActiveCfg = Release|x64
- {92BFA534-C419-4EB2-AAA3-510653F38F08}.Release|x64.Build.0 = Release|x64
- {B495B6D9-AF84-479D-B30A-313C16EF8BFD}.Debug|Win32.ActiveCfg = Debug|Win32
- {B495B6D9-AF84-479D-B30A-313C16EF8BFD}.Debug|Win32.Build.0 = Debug|Win32
- {B495B6D9-AF84-479D-B30A-313C16EF8BFD}.Debug|x64.ActiveCfg = Debug|x64
- {B495B6D9-AF84-479D-B30A-313C16EF8BFD}.Debug|x64.Build.0 = Debug|x64
- {B495B6D9-AF84-479D-B30A-313C16EF8BFD}.Release|Win32.ActiveCfg = Release|Win32
- {B495B6D9-AF84-479D-B30A-313C16EF8BFD}.Release|Win32.Build.0 = Release|Win32
- {B495B6D9-AF84-479D-B30A-313C16EF8BFD}.Release|x64.ActiveCfg = Release|x64
- {B495B6D9-AF84-479D-B30A-313C16EF8BFD}.Release|x64.Build.0 = Release|x64
- {79EF9F1D-E211-4ED1-91D2-FC935AB3A872}.Debug|Win32.ActiveCfg = Debug|Win32
- {79EF9F1D-E211-4ED1-91D2-FC935AB3A872}.Debug|Win32.Build.0 = Debug|Win32
- {79EF9F1D-E211-4ED1-91D2-FC935AB3A872}.Debug|x64.ActiveCfg = Debug|x64
- {79EF9F1D-E211-4ED1-91D2-FC935AB3A872}.Debug|x64.Build.0 = Debug|x64
- {79EF9F1D-E211-4ED1-91D2-FC935AB3A872}.Release|Win32.ActiveCfg = Release|Win32
- {79EF9F1D-E211-4ED1-91D2-FC935AB3A872}.Release|Win32.Build.0 = Release|Win32
- {79EF9F1D-E211-4ED1-91D2-FC935AB3A872}.Release|x64.ActiveCfg = Release|x64
- {79EF9F1D-E211-4ED1-91D2-FC935AB3A872}.Release|x64.Build.0 = Release|x64
- {429C907B-97D1-4B2D-9B0E-A14A5BFDAD15}.Debug|Win32.ActiveCfg = Debug|Win32
- {429C907B-97D1-4B2D-9B0E-A14A5BFDAD15}.Debug|Win32.Build.0 = Debug|Win32
- {429C907B-97D1-4B2D-9B0E-A14A5BFDAD15}.Debug|x64.ActiveCfg = Debug|x64
- {429C907B-97D1-4B2D-9B0E-A14A5BFDAD15}.Debug|x64.Build.0 = Debug|x64
- {429C907B-97D1-4B2D-9B0E-A14A5BFDAD15}.Release|Win32.ActiveCfg = Release|Win32
- {429C907B-97D1-4B2D-9B0E-A14A5BFDAD15}.Release|Win32.Build.0 = Release|Win32
- {429C907B-97D1-4B2D-9B0E-A14A5BFDAD15}.Release|x64.ActiveCfg = Release|x64
- {429C907B-97D1-4B2D-9B0E-A14A5BFDAD15}.Release|x64.Build.0 = Release|x64
- {DCF01B1C-5268-44F3-9130-D647FABFB663}.Debug|Win32.ActiveCfg = Debug|Win32
- {DCF01B1C-5268-44F3-9130-D647FABFB663}.Debug|Win32.Build.0 = Debug|Win32
- {DCF01B1C-5268-44F3-9130-D647FABFB663}.Debug|x64.ActiveCfg = Debug|x64
- {DCF01B1C-5268-44F3-9130-D647FABFB663}.Debug|x64.Build.0 = Debug|x64
- {DCF01B1C-5268-44F3-9130-D647FABFB663}.Release|Win32.ActiveCfg = Release|Win32
- {DCF01B1C-5268-44F3-9130-D647FABFB663}.Release|Win32.Build.0 = Release|Win32
- {DCF01B1C-5268-44F3-9130-D647FABFB663}.Release|x64.ActiveCfg = Release|x64
- {DCF01B1C-5268-44F3-9130-D647FABFB663}.Release|x64.Build.0 = Release|x64
- {3CA97077-6210-4362-998A-D15A35EEAA08}.Debug|Win32.ActiveCfg = Debug|Win32
- {3CA97077-6210-4362-998A-D15A35EEAA08}.Debug|Win32.Build.0 = Debug|Win32
- {3CA97077-6210-4362-998A-D15A35EEAA08}.Debug|x64.ActiveCfg = Debug|x64
- {3CA97077-6210-4362-998A-D15A35EEAA08}.Debug|x64.Build.0 = Debug|x64
- {3CA97077-6210-4362-998A-D15A35EEAA08}.Release|Win32.ActiveCfg = Release|Win32
- {3CA97077-6210-4362-998A-D15A35EEAA08}.Release|Win32.Build.0 = Release|Win32
- {3CA97077-6210-4362-998A-D15A35EEAA08}.Release|x64.ActiveCfg = Release|x64
- {3CA97077-6210-4362-998A-D15A35EEAA08}.Release|x64.Build.0 = Release|x64
- {504B3154-7A4F-459D-9877-B951021C3F1F}.Debug|Win32.ActiveCfg = Debug|Win32
- {504B3154-7A4F-459D-9877-B951021C3F1F}.Debug|Win32.Build.0 = Debug|Win32
- {504B3154-7A4F-459D-9877-B951021C3F1F}.Debug|x64.ActiveCfg = Debug|x64
- {504B3154-7A4F-459D-9877-B951021C3F1F}.Debug|x64.Build.0 = Debug|x64
- {504B3154-7A4F-459D-9877-B951021C3F1F}.Release|Win32.ActiveCfg = Release|Win32
- {504B3154-7A4F-459D-9877-B951021C3F1F}.Release|Win32.Build.0 = Release|Win32
- {504B3154-7A4F-459D-9877-B951021C3F1F}.Release|x64.ActiveCfg = Release|x64
- {504B3154-7A4F-459D-9877-B951021C3F1F}.Release|x64.Build.0 = Release|x64
- {17A33F3F-BAF5-403F-8EF4-FECDA7D9A335}.Debug|Win32.ActiveCfg = Debug|Win32
- {17A33F3F-BAF5-403F-8EF4-FECDA7D9A335}.Debug|Win32.Build.0 = Debug|Win32
- {17A33F3F-BAF5-403F-8EF4-FECDA7D9A335}.Debug|x64.ActiveCfg = Debug|x64
- {17A33F3F-BAF5-403F-8EF4-FECDA7D9A335}.Debug|x64.Build.0 = Debug|x64
- {17A33F3F-BAF5-403F-8EF4-FECDA7D9A335}.Release|Win32.ActiveCfg = Release|Win32
- {17A33F3F-BAF5-403F-8EF4-FECDA7D9A335}.Release|Win32.Build.0 = Release|Win32
- {17A33F3F-BAF5-403F-8EF4-FECDA7D9A335}.Release|x64.ActiveCfg = Release|x64
- {17A33F3F-BAF5-403F-8EF4-FECDA7D9A335}.Release|x64.Build.0 = Release|x64
- {DEB01ACB-D65F-4A62-AED9-58C1054499E9}.Debug|Win32.ActiveCfg = Debug|Win32
- {DEB01ACB-D65F-4A62-AED9-58C1054499E9}.Debug|Win32.Build.0 = Debug|Win32
- {DEB01ACB-D65F-4A62-AED9-58C1054499E9}.Debug|x64.ActiveCfg = Debug|x64
- {DEB01ACB-D65F-4A62-AED9-58C1054499E9}.Debug|x64.Build.0 = Debug|x64
- {DEB01ACB-D65F-4A62-AED9-58C1054499E9}.Release|Win32.ActiveCfg = Release|Win32
- {DEB01ACB-D65F-4A62-AED9-58C1054499E9}.Release|Win32.Build.0 = Release|Win32
- {DEB01ACB-D65F-4A62-AED9-58C1054499E9}.Release|x64.ActiveCfg = Release|x64
- {DEB01ACB-D65F-4A62-AED9-58C1054499E9}.Release|x64.Build.0 = Release|x64
- {01D63BF5-7798-4746-852A-4B45229BB735}.Debug|Win32.ActiveCfg = Debug|Win32
- {01D63BF5-7798-4746-852A-4B45229BB735}.Debug|x64.ActiveCfg = Debug|x64
- {01D63BF5-7798-4746-852A-4B45229BB735}.Release|Win32.ActiveCfg = Release|Win32
- {01D63BF5-7798-4746-852A-4B45229BB735}.Release|x64.ActiveCfg = Release|x64
- {4714EF49-BFD5-4B22-95F7-95A07F1EAC25}.Debug|Win32.ActiveCfg = Debug|Win32
- {4714EF49-BFD5-4B22-95F7-95A07F1EAC25}.Debug|x64.ActiveCfg = Debug|x64
- {4714EF49-BFD5-4B22-95F7-95A07F1EAC25}.Release|Win32.ActiveCfg = Release|Win32
- {4714EF49-BFD5-4B22-95F7-95A07F1EAC25}.Release|x64.ActiveCfg = Release|x64
- {6B83AC6D-01CE-4E1C-81CE-02AD8116C684}.Debug|Win32.ActiveCfg = Debug|Win32
- {6B83AC6D-01CE-4E1C-81CE-02AD8116C684}.Debug|Win32.Build.0 = Debug|Win32
- {6B83AC6D-01CE-4E1C-81CE-02AD8116C684}.Debug|x64.ActiveCfg = Debug|x64
- {6B83AC6D-01CE-4E1C-81CE-02AD8116C684}.Debug|x64.Build.0 = Debug|x64
- {6B83AC6D-01CE-4E1C-81CE-02AD8116C684}.Release|Win32.ActiveCfg = Release|Win32
- {6B83AC6D-01CE-4E1C-81CE-02AD8116C684}.Release|Win32.Build.0 = Release|Win32
- {6B83AC6D-01CE-4E1C-81CE-02AD8116C684}.Release|x64.ActiveCfg = Release|x64
- {6B83AC6D-01CE-4E1C-81CE-02AD8116C684}.Release|x64.Build.0 = Release|x64
- {272FAFA8-2B2F-4716-B95F-3B37CF2E0CB3}.Debug|Win32.ActiveCfg = Debug|Win32
- {272FAFA8-2B2F-4716-B95F-3B37CF2E0CB3}.Debug|Win32.Build.0 = Debug|Win32
- {272FAFA8-2B2F-4716-B95F-3B37CF2E0CB3}.Debug|x64.ActiveCfg = Debug|x64
- {272FAFA8-2B2F-4716-B95F-3B37CF2E0CB3}.Debug|x64.Build.0 = Debug|x64
- {272FAFA8-2B2F-4716-B95F-3B37CF2E0CB3}.Release|Win32.ActiveCfg = Release|Win32
- {272FAFA8-2B2F-4716-B95F-3B37CF2E0CB3}.Release|Win32.Build.0 = Release|Win32
- {272FAFA8-2B2F-4716-B95F-3B37CF2E0CB3}.Release|x64.ActiveCfg = Release|x64
- {272FAFA8-2B2F-4716-B95F-3B37CF2E0CB3}.Release|x64.Build.0 = Release|x64
- {CD1C52C1-D8E1-4654-AE65-6CCAB38DE894}.Debug|Win32.ActiveCfg = Debug|Win32
- {CD1C52C1-D8E1-4654-AE65-6CCAB38DE894}.Debug|Win32.Build.0 = Debug|Win32
- {CD1C52C1-D8E1-4654-AE65-6CCAB38DE894}.Debug|x64.ActiveCfg = Debug|x64
- {CD1C52C1-D8E1-4654-AE65-6CCAB38DE894}.Debug|x64.Build.0 = Debug|x64
- {CD1C52C1-D8E1-4654-AE65-6CCAB38DE894}.Release|Win32.ActiveCfg = Release|Win32
- {CD1C52C1-D8E1-4654-AE65-6CCAB38DE894}.Release|Win32.Build.0 = Release|Win32
- {CD1C52C1-D8E1-4654-AE65-6CCAB38DE894}.Release|x64.ActiveCfg = Release|x64
- {CD1C52C1-D8E1-4654-AE65-6CCAB38DE894}.Release|x64.Build.0 = Release|x64
- {5AFB8B04-AEB9-408C-B53E-AFBC44B5F3F2}.Debug|Win32.ActiveCfg = Debug|Win32
- {5AFB8B04-AEB9-408C-B53E-AFBC44B5F3F2}.Debug|Win32.Build.0 = Debug|Win32
- {5AFB8B04-AEB9-408C-B53E-AFBC44B5F3F2}.Debug|x64.ActiveCfg = Debug|x64
- {5AFB8B04-AEB9-408C-B53E-AFBC44B5F3F2}.Debug|x64.Build.0 = Debug|x64
- {5AFB8B04-AEB9-408C-B53E-AFBC44B5F3F2}.Release|Win32.ActiveCfg = Release|Win32
- {5AFB8B04-AEB9-408C-B53E-AFBC44B5F3F2}.Release|Win32.Build.0 = Release|Win32
- {5AFB8B04-AEB9-408C-B53E-AFBC44B5F3F2}.Release|x64.ActiveCfg = Release|x64
- {5AFB8B04-AEB9-408C-B53E-AFBC44B5F3F2}.Release|x64.Build.0 = Release|x64
- {F7563CAD-5C95-46E5-89B7-0953C6C6E746}.Debug|Win32.ActiveCfg = Debug|Win32
- {F7563CAD-5C95-46E5-89B7-0953C6C6E746}.Debug|Win32.Build.0 = Debug|Win32
- {F7563CAD-5C95-46E5-89B7-0953C6C6E746}.Debug|x64.ActiveCfg = Debug|x64
- {F7563CAD-5C95-46E5-89B7-0953C6C6E746}.Debug|x64.Build.0 = Debug|x64
- {F7563CAD-5C95-46E5-89B7-0953C6C6E746}.Release|Win32.ActiveCfg = Release|Win32
- {F7563CAD-5C95-46E5-89B7-0953C6C6E746}.Release|Win32.Build.0 = Release|Win32
- {F7563CAD-5C95-46E5-89B7-0953C6C6E746}.Release|x64.ActiveCfg = Release|x64
- {F7563CAD-5C95-46E5-89B7-0953C6C6E746}.Release|x64.Build.0 = Release|x64
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
- GlobalSection(NestedProjects) = preSolution
- {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2} = {5377DC3A-DB96-4819-8AAF-2A75F3A69119}
- {B5A00BFA-6083-4FAE-A097-71642D6473B5} = {5377DC3A-DB96-4819-8AAF-2A75F3A69119}
- {1C320193-46A6-4B34-9C56-8AB584FC1B56} = {5377DC3A-DB96-4819-8AAF-2A75F3A69119}
- {12A49562-BAB9-43A3-A21D-15B60BBB4C31} = {5377DC3A-DB96-4819-8AAF-2A75F3A69119}
- {18B1F35A-10F8-4287-9B37-2D10501B0B38} = {5377DC3A-DB96-4819-8AAF-2A75F3A69119}
- {72782932-37CC-46AE-8C7F-9A7B1A6EE108} = {5377DC3A-DB96-4819-8AAF-2A75F3A69119}
- {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA} = {5377DC3A-DB96-4819-8AAF-2A75F3A69119}
- {843425BE-9A9A-44F4-A4E3-4B57D6ABD53C} = {5377DC3A-DB96-4819-8AAF-2A75F3A69119}
- {504B3154-7A4F-459D-9877-B951021C3F1F} = {5377DC3A-DB96-4819-8AAF-2A75F3A69119}
- {746F3632-5BB2-4570-9453-31D6D58A7D8E} = {493A1DB9-6E7C-48C7-93B5-F75C3C25B9DF}
- {DEB01ACB-D65F-4A62-AED9-58C1054499E9} = {493A1DB9-6E7C-48C7-93B5-F75C3C25B9DF}
- {592CF22D-3F8F-4A77-A174-130D77B7623B} = {8E282AE2-038C-49FE-AC67-BC9615AFD800}
- {C98AF157-352E-4737-BD30-A24E2647F5AE} = {8E282AE2-038C-49FE-AC67-BC9615AFD800}
- {EE157390-1E85-416C-946E-620E32C9AD33} = {8E282AE2-038C-49FE-AC67-BC9615AFD800}
- {57FAF32E-49FD-491F-895D-132D0D5EFE0A} = {8E282AE2-038C-49FE-AC67-BC9615AFD800}
- {6B83AC6D-01CE-4E1C-81CE-02AD8116C684} = {8E282AE2-038C-49FE-AC67-BC9615AFD800}
- {272FAFA8-2B2F-4716-B95F-3B37CF2E0CB3} = {8E282AE2-038C-49FE-AC67-BC9615AFD800}
- {CD1C52C1-D8E1-4654-AE65-6CCAB38DE894} = {8E282AE2-038C-49FE-AC67-BC9615AFD800}
- {92BFA534-C419-4EB2-AAA3-510653F38F08} = {09BABD45-8F30-4F99-B8B8-8DD78F6804DB}
- {B495B6D9-AF84-479D-B30A-313C16EF8BFD} = {09BABD45-8F30-4F99-B8B8-8DD78F6804DB}
- {5AFB8B04-AEB9-408C-B53E-AFBC44B5F3F2} = {09BABD45-8F30-4F99-B8B8-8DD78F6804DB}
- {F7563CAD-5C95-46E5-89B7-0953C6C6E746} = {09BABD45-8F30-4F99-B8B8-8DD78F6804DB}
- {79EF9F1D-E211-4ED1-91D2-FC935AB3A872} = {AC4356E8-48A1-4D2D-AFB1-11CF30B974CD}
- {429C907B-97D1-4B2D-9B0E-A14A5BFDAD15} = {AC4356E8-48A1-4D2D-AFB1-11CF30B974CD}
- {DCF01B1C-5268-44F3-9130-D647FABFB663} = {AC4356E8-48A1-4D2D-AFB1-11CF30B974CD}
- {3CA97077-6210-4362-998A-D15A35EEAA08} = {AC4356E8-48A1-4D2D-AFB1-11CF30B974CD}
- {17A33F3F-BAF5-403F-8EF4-FECDA7D9A335} = {AC4356E8-48A1-4D2D-AFB1-11CF30B974CD}
- {01D63BF5-7798-4746-852A-4B45229BB735} = {62083CC3-13BF-49EA-BFE8-4C9337C0D82C}
- {4714EF49-BFD5-4B22-95F7-95A07F1EAC25} = {62083CC3-13BF-49EA-BFE8-4C9337C0D82C}
- {F2D6C1AF-0C05-4695-84AF-15A2F92F9899} = {9155EBB8-E7DD-49AE-A86A-7B90B9F09888}
- EndGlobalSection
-EndGlobal
+++ /dev/null
-
-Microsoft Visual Studio Solution File, Format Version 9.00
-# Visual Studio 2005
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "libs", "libs", "{5377DC3A-DB96-4819-8AAF-2A75F3A69119}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "modules", "modules", "{493A1DB9-6E7C-48C7-93B5-F75C3C25B9DF}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "platforms", "platforms", "{8E282AE2-038C-49FE-AC67-BC9615AFD800}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "plugins", "plugins", "{09BABD45-8F30-4F99-B8B8-8DD78F6804DB}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{AC4356E8-48A1-4D2D-AFB1-11CF30B974CD}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unimrcpserver", "platforms\unimrcp-server\unimrcpserver.vcproj", "{592CF22D-3F8F-4A77-A174-130D77B7623B}"
- ProjectSection(ProjectDependencies) = postProject
- {C98AF157-352E-4737-BD30-A24E2647F5AE} = {C98AF157-352E-4737-BD30-A24E2647F5AE}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "aprtoolkit", "libs\apr-toolkit\aprtoolkit.vcproj", "{13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mpf", "libs\mpf\mpf.vcproj", "{B5A00BFA-6083-4FAE-A097-71642D6473B5}"
- ProjectSection(ProjectDependencies) = postProject
- {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2} = {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mrcp", "libs\mrcp\mrcp.vcproj", "{1C320193-46A6-4B34-9C56-8AB584FC1B56}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mrcpsignaling", "libs\mrcp-signaling\mrcpsignaling.vcproj", "{12A49562-BAB9-43A3-A21D-15B60BBB4C31}"
- ProjectSection(ProjectDependencies) = postProject
- {B5A00BFA-6083-4FAE-A097-71642D6473B5} = {B5A00BFA-6083-4FAE-A097-71642D6473B5}
- {1C320193-46A6-4B34-9C56-8AB584FC1B56} = {1C320193-46A6-4B34-9C56-8AB584FC1B56}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mrcpserver", "libs\mrcp-server\mrcpserver.vcproj", "{18B1F35A-10F8-4287-9B37-2D10501B0B38}"
- ProjectSection(ProjectDependencies) = postProject
- {12A49562-BAB9-43A3-A21D-15B60BBB4C31} = {12A49562-BAB9-43A3-A21D-15B60BBB4C31}
- {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA} = {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}
- {843425BE-9A9A-44F4-A4E3-4B57D6ABD53C} = {843425BE-9A9A-44F4-A4E3-4B57D6ABD53C}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libunimrcpserver", "platforms\libunimrcp-server\libunimrcpserver.vcproj", "{C98AF157-352E-4737-BD30-A24E2647F5AE}"
- ProjectSection(ProjectDependencies) = postProject
- {DEB01ACB-D65F-4A62-AED9-58C1054499E9} = {DEB01ACB-D65F-4A62-AED9-58C1054499E9}
- {18B1F35A-10F8-4287-9B37-2D10501B0B38} = {18B1F35A-10F8-4287-9B37-2D10501B0B38}
- {746F3632-5BB2-4570-9453-31D6D58A7D8E} = {746F3632-5BB2-4570-9453-31D6D58A7D8E}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mrcpsofiasip", "modules\mrcp-sofiasip\mrcpsofiasip.vcproj", "{746F3632-5BB2-4570-9453-31D6D58A7D8E}"
- ProjectSection(ProjectDependencies) = postProject
- {12A49562-BAB9-43A3-A21D-15B60BBB4C31} = {12A49562-BAB9-43A3-A21D-15B60BBB4C31}
- {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA} = {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mrcpclient", "libs\mrcp-client\mrcpclient.vcproj", "{72782932-37CC-46AE-8C7F-9A7B1A6EE108}"
- ProjectSection(ProjectDependencies) = postProject
- {12A49562-BAB9-43A3-A21D-15B60BBB4C31} = {12A49562-BAB9-43A3-A21D-15B60BBB4C31}
- {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA} = {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libunimrcpclient", "platforms\libunimrcp-client\libunimrcpclient.vcproj", "{EE157390-1E85-416C-946E-620E32C9AD33}"
- ProjectSection(ProjectDependencies) = postProject
- {DEB01ACB-D65F-4A62-AED9-58C1054499E9} = {DEB01ACB-D65F-4A62-AED9-58C1054499E9}
- {746F3632-5BB2-4570-9453-31D6D58A7D8E} = {746F3632-5BB2-4570-9453-31D6D58A7D8E}
- {72782932-37CC-46AE-8C7F-9A7B1A6EE108} = {72782932-37CC-46AE-8C7F-9A7B1A6EE108}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unimrcpclient", "platforms\unimrcp-client\unimrcpclient.vcproj", "{57FAF32E-49FD-491F-895D-132D0D5EFE0A}"
- ProjectSection(ProjectDependencies) = postProject
- {EE157390-1E85-416C-946E-620E32C9AD33} = {EE157390-1E85-416C-946E-620E32C9AD33}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mrcpv2transport", "libs\mrcpv2-transport\mrcpv2transport.vcproj", "{A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}"
- ProjectSection(ProjectDependencies) = postProject
- {1C320193-46A6-4B34-9C56-8AB584FC1B56} = {1C320193-46A6-4B34-9C56-8AB584FC1B56}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mrcpengine", "libs\mrcp-engine\mrcpengine.vcproj", "{843425BE-9A9A-44F4-A4E3-4B57D6ABD53C}"
- ProjectSection(ProjectDependencies) = postProject
- {B5A00BFA-6083-4FAE-A097-71642D6473B5} = {B5A00BFA-6083-4FAE-A097-71642D6473B5}
- {1C320193-46A6-4B34-9C56-8AB584FC1B56} = {1C320193-46A6-4B34-9C56-8AB584FC1B56}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "demosynth", "plugins\demo-synth\demosynth.vcproj", "{92BFA534-C419-4EB2-AAA3-510653F38F08}"
- ProjectSection(ProjectDependencies) = postProject
- {843425BE-9A9A-44F4-A4E3-4B57D6ABD53C} = {843425BE-9A9A-44F4-A4E3-4B57D6ABD53C}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "demorecog", "plugins\demo-recog\demorecog.vcproj", "{B495B6D9-AF84-479D-B30A-313C16EF8BFD}"
- ProjectSection(ProjectDependencies) = postProject
- {843425BE-9A9A-44F4-A4E3-4B57D6ABD53C} = {843425BE-9A9A-44F4-A4E3-4B57D6ABD53C}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "strtablegen", "tests\strtablegen\strtablegen.vcproj", "{79EF9F1D-E211-4ED1-91D2-FC935AB3A872}"
- ProjectSection(ProjectDependencies) = postProject
- {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2} = {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "apttest", "tests\apttest\apttest.vcproj", "{429C907B-97D1-4B2D-9B0E-A14A5BFDAD15}"
- ProjectSection(ProjectDependencies) = postProject
- {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2} = {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mpftest", "tests\mpftest\mpftest.vcproj", "{DCF01B1C-5268-44F3-9130-D647FABFB663}"
- ProjectSection(ProjectDependencies) = postProject
- {B5A00BFA-6083-4FAE-A097-71642D6473B5} = {B5A00BFA-6083-4FAE-A097-71642D6473B5}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mrcptest", "tests\mrcptest\mrcptest.vcproj", "{3CA97077-6210-4362-998A-D15A35EEAA08}"
- ProjectSection(ProjectDependencies) = postProject
- {1C320193-46A6-4B34-9C56-8AB584FC1B56} = {1C320193-46A6-4B34-9C56-8AB584FC1B56}
- EndProjectSection
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{62083CC3-13BF-49EA-BFE8-4C9337C0D82C}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unirtsp", "libs\uni-rtsp\unirtsp.vcproj", "{504B3154-7A4F-459D-9877-B951021C3F1F}"
- ProjectSection(ProjectDependencies) = postProject
- {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2} = {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rtsptest", "tests\rtsptest\rtsptest.vcproj", "{17A33F3F-BAF5-403F-8EF4-FECDA7D9A335}"
- ProjectSection(ProjectDependencies) = postProject
- {504B3154-7A4F-459D-9877-B951021C3F1F} = {504B3154-7A4F-459D-9877-B951021C3F1F}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mrcpunirtsp", "modules\mrcp-unirtsp\mrcpunirtsp.vcproj", "{DEB01ACB-D65F-4A62-AED9-58C1054499E9}"
- ProjectSection(ProjectDependencies) = postProject
- {12A49562-BAB9-43A3-A21D-15B60BBB4C31} = {12A49562-BAB9-43A3-A21D-15B60BBB4C31}
- {504B3154-7A4F-459D-9877-B951021C3F1F} = {504B3154-7A4F-459D-9877-B951021C3F1F}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "prepare", "build\tools\prepare.vcproj", "{01D63BF5-7798-4746-852A-4B45229BB735}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unimrcpservice", "build\tools\unimrcpservice.vcproj", "{4714EF49-BFD5-4B22-95F7-95A07F1EAC25}"
- ProjectSection(ProjectDependencies) = postProject
- {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2} = {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "asrclient", "platforms\asr-client\asrclient.vcproj", "{6B83AC6D-01CE-4E1C-81CE-02AD8116C684}"
- ProjectSection(ProjectDependencies) = postProject
- {272FAFA8-2B2F-4716-B95F-3B37CF2E0CB3} = {272FAFA8-2B2F-4716-B95F-3B37CF2E0CB3}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libasrclient", "platforms\libasr-client\libasrclient.vcproj", "{272FAFA8-2B2F-4716-B95F-3B37CF2E0CB3}"
- ProjectSection(ProjectDependencies) = postProject
- {EE157390-1E85-416C-946E-620E32C9AD33} = {EE157390-1E85-416C-946E-620E32C9AD33}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "umc", "platforms\umc\umc.vcproj", "{CD1C52C1-D8E1-4654-AE65-6CCAB38DE894}"
- ProjectSection(ProjectDependencies) = postProject
- {EE157390-1E85-416C-946E-620E32C9AD33} = {EE157390-1E85-416C-946E-620E32C9AD33}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mrcprecorder", "plugins\mrcp-recorder\mrcprecorder.vcproj", "{5AFB8B04-AEB9-408C-B53E-AFBC44B5F3F2}"
- ProjectSection(ProjectDependencies) = postProject
- {843425BE-9A9A-44F4-A4E3-4B57D6ABD53C} = {843425BE-9A9A-44F4-A4E3-4B57D6ABD53C}
- EndProjectSection
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "conf", "conf", "{9155EBB8-E7DD-49AE-A86A-7B90B9F09888}"
- ProjectSection(SolutionItems) = preProject
- conf\logger.xml = conf\logger.xml
- conf\unimrcpclient.xml = conf\unimrcpclient.xml
- conf\unimrcpclient.xsd = conf\unimrcpclient.xsd
- conf\unimrcpserver.xml = conf\unimrcpserver.xml
- conf\unimrcpserver.xsd = conf\unimrcpserver.xsd
- EndProjectSection
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "client-profiles", "client-profiles", "{F2D6C1AF-0C05-4695-84AF-15A2F92F9899}"
- ProjectSection(SolutionItems) = preProject
- conf\client-profiles\lumenvox.xml = conf\client-profiles\lumenvox.xml
- conf\client-profiles\nuance.xml = conf\client-profiles\nuance.xml
- conf\client-profiles\unimrcp.xml = conf\client-profiles\unimrcp.xml
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "demoverifier", "plugins\demo-verifier\demoverifier.vcproj", "{F7563CAD-5C95-46E5-89B7-0953C6C6E746}"
- ProjectSection(ProjectDependencies) = postProject
- {843425BE-9A9A-44F4-A4E3-4B57D6ABD53C} = {843425BE-9A9A-44F4-A4E3-4B57D6ABD53C}
- EndProjectSection
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Win32 = Debug|Win32
- Debug|x64 = Debug|x64
- Release|Win32 = Release|Win32
- Release|x64 = Release|x64
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {592CF22D-3F8F-4A77-A174-130D77B7623B}.Debug|Win32.ActiveCfg = Debug|Win32
- {592CF22D-3F8F-4A77-A174-130D77B7623B}.Debug|Win32.Build.0 = Debug|Win32
- {592CF22D-3F8F-4A77-A174-130D77B7623B}.Debug|x64.ActiveCfg = Debug|x64
- {592CF22D-3F8F-4A77-A174-130D77B7623B}.Debug|x64.Build.0 = Debug|x64
- {592CF22D-3F8F-4A77-A174-130D77B7623B}.Release|Win32.ActiveCfg = Release|Win32
- {592CF22D-3F8F-4A77-A174-130D77B7623B}.Release|Win32.Build.0 = Release|Win32
- {592CF22D-3F8F-4A77-A174-130D77B7623B}.Release|x64.ActiveCfg = Release|x64
- {592CF22D-3F8F-4A77-A174-130D77B7623B}.Release|x64.Build.0 = Release|x64
- {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.Debug|Win32.ActiveCfg = Debug|Win32
- {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.Debug|Win32.Build.0 = Debug|Win32
- {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.Debug|x64.ActiveCfg = Debug|x64
- {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.Debug|x64.Build.0 = Debug|x64
- {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.Release|Win32.ActiveCfg = Release|Win32
- {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.Release|Win32.Build.0 = Release|Win32
- {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.Release|x64.ActiveCfg = Release|x64
- {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.Release|x64.Build.0 = Release|x64
- {B5A00BFA-6083-4FAE-A097-71642D6473B5}.Debug|Win32.ActiveCfg = Debug|Win32
- {B5A00BFA-6083-4FAE-A097-71642D6473B5}.Debug|Win32.Build.0 = Debug|Win32
- {B5A00BFA-6083-4FAE-A097-71642D6473B5}.Debug|x64.ActiveCfg = Debug|x64
- {B5A00BFA-6083-4FAE-A097-71642D6473B5}.Debug|x64.Build.0 = Debug|x64
- {B5A00BFA-6083-4FAE-A097-71642D6473B5}.Release|Win32.ActiveCfg = Release|Win32
- {B5A00BFA-6083-4FAE-A097-71642D6473B5}.Release|Win32.Build.0 = Release|Win32
- {B5A00BFA-6083-4FAE-A097-71642D6473B5}.Release|x64.ActiveCfg = Release|x64
- {B5A00BFA-6083-4FAE-A097-71642D6473B5}.Release|x64.Build.0 = Release|x64
- {1C320193-46A6-4B34-9C56-8AB584FC1B56}.Debug|Win32.ActiveCfg = Debug|Win32
- {1C320193-46A6-4B34-9C56-8AB584FC1B56}.Debug|Win32.Build.0 = Debug|Win32
- {1C320193-46A6-4B34-9C56-8AB584FC1B56}.Debug|x64.ActiveCfg = Debug|x64
- {1C320193-46A6-4B34-9C56-8AB584FC1B56}.Debug|x64.Build.0 = Debug|x64
- {1C320193-46A6-4B34-9C56-8AB584FC1B56}.Release|Win32.ActiveCfg = Release|Win32
- {1C320193-46A6-4B34-9C56-8AB584FC1B56}.Release|Win32.Build.0 = Release|Win32
- {1C320193-46A6-4B34-9C56-8AB584FC1B56}.Release|x64.ActiveCfg = Release|x64
- {1C320193-46A6-4B34-9C56-8AB584FC1B56}.Release|x64.Build.0 = Release|x64
- {12A49562-BAB9-43A3-A21D-15B60BBB4C31}.Debug|Win32.ActiveCfg = Debug|Win32
- {12A49562-BAB9-43A3-A21D-15B60BBB4C31}.Debug|Win32.Build.0 = Debug|Win32
- {12A49562-BAB9-43A3-A21D-15B60BBB4C31}.Debug|x64.ActiveCfg = Debug|x64
- {12A49562-BAB9-43A3-A21D-15B60BBB4C31}.Debug|x64.Build.0 = Debug|x64
- {12A49562-BAB9-43A3-A21D-15B60BBB4C31}.Release|Win32.ActiveCfg = Release|Win32
- {12A49562-BAB9-43A3-A21D-15B60BBB4C31}.Release|Win32.Build.0 = Release|Win32
- {12A49562-BAB9-43A3-A21D-15B60BBB4C31}.Release|x64.ActiveCfg = Release|x64
- {12A49562-BAB9-43A3-A21D-15B60BBB4C31}.Release|x64.Build.0 = Release|x64
- {18B1F35A-10F8-4287-9B37-2D10501B0B38}.Debug|Win32.ActiveCfg = Debug|Win32
- {18B1F35A-10F8-4287-9B37-2D10501B0B38}.Debug|Win32.Build.0 = Debug|Win32
- {18B1F35A-10F8-4287-9B37-2D10501B0B38}.Debug|x64.ActiveCfg = Debug|x64
- {18B1F35A-10F8-4287-9B37-2D10501B0B38}.Debug|x64.Build.0 = Debug|x64
- {18B1F35A-10F8-4287-9B37-2D10501B0B38}.Release|Win32.ActiveCfg = Release|Win32
- {18B1F35A-10F8-4287-9B37-2D10501B0B38}.Release|Win32.Build.0 = Release|Win32
- {18B1F35A-10F8-4287-9B37-2D10501B0B38}.Release|x64.ActiveCfg = Release|x64
- {18B1F35A-10F8-4287-9B37-2D10501B0B38}.Release|x64.Build.0 = Release|x64
- {C98AF157-352E-4737-BD30-A24E2647F5AE}.Debug|Win32.ActiveCfg = Debug|Win32
- {C98AF157-352E-4737-BD30-A24E2647F5AE}.Debug|Win32.Build.0 = Debug|Win32
- {C98AF157-352E-4737-BD30-A24E2647F5AE}.Debug|x64.ActiveCfg = Debug|x64
- {C98AF157-352E-4737-BD30-A24E2647F5AE}.Debug|x64.Build.0 = Debug|x64
- {C98AF157-352E-4737-BD30-A24E2647F5AE}.Release|Win32.ActiveCfg = Release|Win32
- {C98AF157-352E-4737-BD30-A24E2647F5AE}.Release|Win32.Build.0 = Release|Win32
- {C98AF157-352E-4737-BD30-A24E2647F5AE}.Release|x64.ActiveCfg = Release|x64
- {C98AF157-352E-4737-BD30-A24E2647F5AE}.Release|x64.Build.0 = Release|x64
- {746F3632-5BB2-4570-9453-31D6D58A7D8E}.Debug|Win32.ActiveCfg = Debug|Win32
- {746F3632-5BB2-4570-9453-31D6D58A7D8E}.Debug|Win32.Build.0 = Debug|Win32
- {746F3632-5BB2-4570-9453-31D6D58A7D8E}.Debug|x64.ActiveCfg = Debug|x64
- {746F3632-5BB2-4570-9453-31D6D58A7D8E}.Debug|x64.Build.0 = Debug|x64
- {746F3632-5BB2-4570-9453-31D6D58A7D8E}.Release|Win32.ActiveCfg = Release|Win32
- {746F3632-5BB2-4570-9453-31D6D58A7D8E}.Release|Win32.Build.0 = Release|Win32
- {746F3632-5BB2-4570-9453-31D6D58A7D8E}.Release|x64.ActiveCfg = Release|x64
- {746F3632-5BB2-4570-9453-31D6D58A7D8E}.Release|x64.Build.0 = Release|x64
- {72782932-37CC-46AE-8C7F-9A7B1A6EE108}.Debug|Win32.ActiveCfg = Debug|Win32
- {72782932-37CC-46AE-8C7F-9A7B1A6EE108}.Debug|Win32.Build.0 = Debug|Win32
- {72782932-37CC-46AE-8C7F-9A7B1A6EE108}.Debug|x64.ActiveCfg = Debug|x64
- {72782932-37CC-46AE-8C7F-9A7B1A6EE108}.Debug|x64.Build.0 = Debug|x64
- {72782932-37CC-46AE-8C7F-9A7B1A6EE108}.Release|Win32.ActiveCfg = Release|Win32
- {72782932-37CC-46AE-8C7F-9A7B1A6EE108}.Release|Win32.Build.0 = Release|Win32
- {72782932-37CC-46AE-8C7F-9A7B1A6EE108}.Release|x64.ActiveCfg = Release|x64
- {72782932-37CC-46AE-8C7F-9A7B1A6EE108}.Release|x64.Build.0 = Release|x64
- {EE157390-1E85-416C-946E-620E32C9AD33}.Debug|Win32.ActiveCfg = Debug|Win32
- {EE157390-1E85-416C-946E-620E32C9AD33}.Debug|Win32.Build.0 = Debug|Win32
- {EE157390-1E85-416C-946E-620E32C9AD33}.Debug|x64.ActiveCfg = Debug|x64
- {EE157390-1E85-416C-946E-620E32C9AD33}.Debug|x64.Build.0 = Debug|x64
- {EE157390-1E85-416C-946E-620E32C9AD33}.Release|Win32.ActiveCfg = Release|Win32
- {EE157390-1E85-416C-946E-620E32C9AD33}.Release|Win32.Build.0 = Release|Win32
- {EE157390-1E85-416C-946E-620E32C9AD33}.Release|x64.ActiveCfg = Release|x64
- {EE157390-1E85-416C-946E-620E32C9AD33}.Release|x64.Build.0 = Release|x64
- {57FAF32E-49FD-491F-895D-132D0D5EFE0A}.Debug|Win32.ActiveCfg = Debug|Win32
- {57FAF32E-49FD-491F-895D-132D0D5EFE0A}.Debug|Win32.Build.0 = Debug|Win32
- {57FAF32E-49FD-491F-895D-132D0D5EFE0A}.Debug|x64.ActiveCfg = Debug|x64
- {57FAF32E-49FD-491F-895D-132D0D5EFE0A}.Debug|x64.Build.0 = Debug|x64
- {57FAF32E-49FD-491F-895D-132D0D5EFE0A}.Release|Win32.ActiveCfg = Release|Win32
- {57FAF32E-49FD-491F-895D-132D0D5EFE0A}.Release|Win32.Build.0 = Release|Win32
- {57FAF32E-49FD-491F-895D-132D0D5EFE0A}.Release|x64.ActiveCfg = Release|x64
- {57FAF32E-49FD-491F-895D-132D0D5EFE0A}.Release|x64.Build.0 = Release|x64
- {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.Debug|Win32.ActiveCfg = Debug|Win32
- {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.Debug|Win32.Build.0 = Debug|Win32
- {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.Debug|x64.ActiveCfg = Debug|x64
- {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.Debug|x64.Build.0 = Debug|x64
- {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.Release|Win32.ActiveCfg = Release|Win32
- {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.Release|Win32.Build.0 = Release|Win32
- {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.Release|x64.ActiveCfg = Release|x64
- {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.Release|x64.Build.0 = Release|x64
- {843425BE-9A9A-44F4-A4E3-4B57D6ABD53C}.Debug|Win32.ActiveCfg = Debug|Win32
- {843425BE-9A9A-44F4-A4E3-4B57D6ABD53C}.Debug|Win32.Build.0 = Debug|Win32
- {843425BE-9A9A-44F4-A4E3-4B57D6ABD53C}.Debug|x64.ActiveCfg = Debug|x64
- {843425BE-9A9A-44F4-A4E3-4B57D6ABD53C}.Debug|x64.Build.0 = Debug|x64
- {843425BE-9A9A-44F4-A4E3-4B57D6ABD53C}.Release|Win32.ActiveCfg = Release|Win32
- {843425BE-9A9A-44F4-A4E3-4B57D6ABD53C}.Release|Win32.Build.0 = Release|Win32
- {843425BE-9A9A-44F4-A4E3-4B57D6ABD53C}.Release|x64.ActiveCfg = Release|x64
- {843425BE-9A9A-44F4-A4E3-4B57D6ABD53C}.Release|x64.Build.0 = Release|x64
- {92BFA534-C419-4EB2-AAA3-510653F38F08}.Debug|Win32.ActiveCfg = Debug|Win32
- {92BFA534-C419-4EB2-AAA3-510653F38F08}.Debug|Win32.Build.0 = Debug|Win32
- {92BFA534-C419-4EB2-AAA3-510653F38F08}.Debug|x64.ActiveCfg = Debug|x64
- {92BFA534-C419-4EB2-AAA3-510653F38F08}.Debug|x64.Build.0 = Debug|x64
- {92BFA534-C419-4EB2-AAA3-510653F38F08}.Release|Win32.ActiveCfg = Release|Win32
- {92BFA534-C419-4EB2-AAA3-510653F38F08}.Release|Win32.Build.0 = Release|Win32
- {92BFA534-C419-4EB2-AAA3-510653F38F08}.Release|x64.ActiveCfg = Release|x64
- {92BFA534-C419-4EB2-AAA3-510653F38F08}.Release|x64.Build.0 = Release|x64
- {B495B6D9-AF84-479D-B30A-313C16EF8BFD}.Debug|Win32.ActiveCfg = Debug|Win32
- {B495B6D9-AF84-479D-B30A-313C16EF8BFD}.Debug|Win32.Build.0 = Debug|Win32
- {B495B6D9-AF84-479D-B30A-313C16EF8BFD}.Debug|x64.ActiveCfg = Debug|x64
- {B495B6D9-AF84-479D-B30A-313C16EF8BFD}.Debug|x64.Build.0 = Debug|x64
- {B495B6D9-AF84-479D-B30A-313C16EF8BFD}.Release|Win32.ActiveCfg = Release|Win32
- {B495B6D9-AF84-479D-B30A-313C16EF8BFD}.Release|Win32.Build.0 = Release|Win32
- {B495B6D9-AF84-479D-B30A-313C16EF8BFD}.Release|x64.ActiveCfg = Release|x64
- {B495B6D9-AF84-479D-B30A-313C16EF8BFD}.Release|x64.Build.0 = Release|x64
- {79EF9F1D-E211-4ED1-91D2-FC935AB3A872}.Debug|Win32.ActiveCfg = Debug|Win32
- {79EF9F1D-E211-4ED1-91D2-FC935AB3A872}.Debug|Win32.Build.0 = Debug|Win32
- {79EF9F1D-E211-4ED1-91D2-FC935AB3A872}.Debug|x64.ActiveCfg = Debug|x64
- {79EF9F1D-E211-4ED1-91D2-FC935AB3A872}.Debug|x64.Build.0 = Debug|x64
- {79EF9F1D-E211-4ED1-91D2-FC935AB3A872}.Release|Win32.ActiveCfg = Release|Win32
- {79EF9F1D-E211-4ED1-91D2-FC935AB3A872}.Release|Win32.Build.0 = Release|Win32
- {79EF9F1D-E211-4ED1-91D2-FC935AB3A872}.Release|x64.ActiveCfg = Release|x64
- {79EF9F1D-E211-4ED1-91D2-FC935AB3A872}.Release|x64.Build.0 = Release|x64
- {429C907B-97D1-4B2D-9B0E-A14A5BFDAD15}.Debug|Win32.ActiveCfg = Debug|Win32
- {429C907B-97D1-4B2D-9B0E-A14A5BFDAD15}.Debug|Win32.Build.0 = Debug|Win32
- {429C907B-97D1-4B2D-9B0E-A14A5BFDAD15}.Debug|x64.ActiveCfg = Debug|x64
- {429C907B-97D1-4B2D-9B0E-A14A5BFDAD15}.Debug|x64.Build.0 = Debug|x64
- {429C907B-97D1-4B2D-9B0E-A14A5BFDAD15}.Release|Win32.ActiveCfg = Release|Win32
- {429C907B-97D1-4B2D-9B0E-A14A5BFDAD15}.Release|Win32.Build.0 = Release|Win32
- {429C907B-97D1-4B2D-9B0E-A14A5BFDAD15}.Release|x64.ActiveCfg = Release|x64
- {429C907B-97D1-4B2D-9B0E-A14A5BFDAD15}.Release|x64.Build.0 = Release|x64
- {DCF01B1C-5268-44F3-9130-D647FABFB663}.Debug|Win32.ActiveCfg = Debug|Win32
- {DCF01B1C-5268-44F3-9130-D647FABFB663}.Debug|Win32.Build.0 = Debug|Win32
- {DCF01B1C-5268-44F3-9130-D647FABFB663}.Debug|x64.ActiveCfg = Debug|x64
- {DCF01B1C-5268-44F3-9130-D647FABFB663}.Debug|x64.Build.0 = Debug|x64
- {DCF01B1C-5268-44F3-9130-D647FABFB663}.Release|Win32.ActiveCfg = Release|Win32
- {DCF01B1C-5268-44F3-9130-D647FABFB663}.Release|Win32.Build.0 = Release|Win32
- {DCF01B1C-5268-44F3-9130-D647FABFB663}.Release|x64.ActiveCfg = Release|x64
- {DCF01B1C-5268-44F3-9130-D647FABFB663}.Release|x64.Build.0 = Release|x64
- {3CA97077-6210-4362-998A-D15A35EEAA08}.Debug|Win32.ActiveCfg = Debug|Win32
- {3CA97077-6210-4362-998A-D15A35EEAA08}.Debug|Win32.Build.0 = Debug|Win32
- {3CA97077-6210-4362-998A-D15A35EEAA08}.Debug|x64.ActiveCfg = Debug|x64
- {3CA97077-6210-4362-998A-D15A35EEAA08}.Debug|x64.Build.0 = Debug|x64
- {3CA97077-6210-4362-998A-D15A35EEAA08}.Release|Win32.ActiveCfg = Release|Win32
- {3CA97077-6210-4362-998A-D15A35EEAA08}.Release|Win32.Build.0 = Release|Win32
- {3CA97077-6210-4362-998A-D15A35EEAA08}.Release|x64.ActiveCfg = Release|x64
- {3CA97077-6210-4362-998A-D15A35EEAA08}.Release|x64.Build.0 = Release|x64
- {504B3154-7A4F-459D-9877-B951021C3F1F}.Debug|Win32.ActiveCfg = Debug|Win32
- {504B3154-7A4F-459D-9877-B951021C3F1F}.Debug|Win32.Build.0 = Debug|Win32
- {504B3154-7A4F-459D-9877-B951021C3F1F}.Debug|x64.ActiveCfg = Debug|x64
- {504B3154-7A4F-459D-9877-B951021C3F1F}.Debug|x64.Build.0 = Debug|x64
- {504B3154-7A4F-459D-9877-B951021C3F1F}.Release|Win32.ActiveCfg = Release|Win32
- {504B3154-7A4F-459D-9877-B951021C3F1F}.Release|Win32.Build.0 = Release|Win32
- {504B3154-7A4F-459D-9877-B951021C3F1F}.Release|x64.ActiveCfg = Release|x64
- {504B3154-7A4F-459D-9877-B951021C3F1F}.Release|x64.Build.0 = Release|x64
- {17A33F3F-BAF5-403F-8EF4-FECDA7D9A335}.Debug|Win32.ActiveCfg = Debug|Win32
- {17A33F3F-BAF5-403F-8EF4-FECDA7D9A335}.Debug|Win32.Build.0 = Debug|Win32
- {17A33F3F-BAF5-403F-8EF4-FECDA7D9A335}.Debug|x64.ActiveCfg = Debug|x64
- {17A33F3F-BAF5-403F-8EF4-FECDA7D9A335}.Debug|x64.Build.0 = Debug|x64
- {17A33F3F-BAF5-403F-8EF4-FECDA7D9A335}.Release|Win32.ActiveCfg = Release|Win32
- {17A33F3F-BAF5-403F-8EF4-FECDA7D9A335}.Release|Win32.Build.0 = Release|Win32
- {17A33F3F-BAF5-403F-8EF4-FECDA7D9A335}.Release|x64.ActiveCfg = Release|x64
- {17A33F3F-BAF5-403F-8EF4-FECDA7D9A335}.Release|x64.Build.0 = Release|x64
- {DEB01ACB-D65F-4A62-AED9-58C1054499E9}.Debug|Win32.ActiveCfg = Debug|Win32
- {DEB01ACB-D65F-4A62-AED9-58C1054499E9}.Debug|Win32.Build.0 = Debug|Win32
- {DEB01ACB-D65F-4A62-AED9-58C1054499E9}.Debug|x64.ActiveCfg = Debug|x64
- {DEB01ACB-D65F-4A62-AED9-58C1054499E9}.Debug|x64.Build.0 = Debug|x64
- {DEB01ACB-D65F-4A62-AED9-58C1054499E9}.Release|Win32.ActiveCfg = Release|Win32
- {DEB01ACB-D65F-4A62-AED9-58C1054499E9}.Release|Win32.Build.0 = Release|Win32
- {DEB01ACB-D65F-4A62-AED9-58C1054499E9}.Release|x64.ActiveCfg = Release|x64
- {DEB01ACB-D65F-4A62-AED9-58C1054499E9}.Release|x64.Build.0 = Release|x64
- {01D63BF5-7798-4746-852A-4B45229BB735}.Debug|Win32.ActiveCfg = Debug|Win32
- {01D63BF5-7798-4746-852A-4B45229BB735}.Debug|x64.ActiveCfg = Debug|x64
- {01D63BF5-7798-4746-852A-4B45229BB735}.Release|Win32.ActiveCfg = Release|Win32
- {01D63BF5-7798-4746-852A-4B45229BB735}.Release|x64.ActiveCfg = Release|x64
- {4714EF49-BFD5-4B22-95F7-95A07F1EAC25}.Debug|Win32.ActiveCfg = Debug|Win32
- {4714EF49-BFD5-4B22-95F7-95A07F1EAC25}.Debug|x64.ActiveCfg = Debug|x64
- {4714EF49-BFD5-4B22-95F7-95A07F1EAC25}.Release|Win32.ActiveCfg = Release|Win32
- {4714EF49-BFD5-4B22-95F7-95A07F1EAC25}.Release|x64.ActiveCfg = Release|x64
- {6B83AC6D-01CE-4E1C-81CE-02AD8116C684}.Debug|Win32.ActiveCfg = Debug|Win32
- {6B83AC6D-01CE-4E1C-81CE-02AD8116C684}.Debug|Win32.Build.0 = Debug|Win32
- {6B83AC6D-01CE-4E1C-81CE-02AD8116C684}.Debug|x64.ActiveCfg = Debug|x64
- {6B83AC6D-01CE-4E1C-81CE-02AD8116C684}.Debug|x64.Build.0 = Debug|x64
- {6B83AC6D-01CE-4E1C-81CE-02AD8116C684}.Release|Win32.ActiveCfg = Release|Win32
- {6B83AC6D-01CE-4E1C-81CE-02AD8116C684}.Release|Win32.Build.0 = Release|Win32
- {6B83AC6D-01CE-4E1C-81CE-02AD8116C684}.Release|x64.ActiveCfg = Release|x64
- {6B83AC6D-01CE-4E1C-81CE-02AD8116C684}.Release|x64.Build.0 = Release|x64
- {272FAFA8-2B2F-4716-B95F-3B37CF2E0CB3}.Debug|Win32.ActiveCfg = Debug|Win32
- {272FAFA8-2B2F-4716-B95F-3B37CF2E0CB3}.Debug|Win32.Build.0 = Debug|Win32
- {272FAFA8-2B2F-4716-B95F-3B37CF2E0CB3}.Debug|x64.ActiveCfg = Debug|x64
- {272FAFA8-2B2F-4716-B95F-3B37CF2E0CB3}.Debug|x64.Build.0 = Debug|x64
- {272FAFA8-2B2F-4716-B95F-3B37CF2E0CB3}.Release|Win32.ActiveCfg = Release|Win32
- {272FAFA8-2B2F-4716-B95F-3B37CF2E0CB3}.Release|Win32.Build.0 = Release|Win32
- {272FAFA8-2B2F-4716-B95F-3B37CF2E0CB3}.Release|x64.ActiveCfg = Release|x64
- {272FAFA8-2B2F-4716-B95F-3B37CF2E0CB3}.Release|x64.Build.0 = Release|x64
- {CD1C52C1-D8E1-4654-AE65-6CCAB38DE894}.Debug|Win32.ActiveCfg = Debug|Win32
- {CD1C52C1-D8E1-4654-AE65-6CCAB38DE894}.Debug|Win32.Build.0 = Debug|Win32
- {CD1C52C1-D8E1-4654-AE65-6CCAB38DE894}.Debug|x64.ActiveCfg = Debug|x64
- {CD1C52C1-D8E1-4654-AE65-6CCAB38DE894}.Debug|x64.Build.0 = Debug|x64
- {CD1C52C1-D8E1-4654-AE65-6CCAB38DE894}.Release|Win32.ActiveCfg = Release|Win32
- {CD1C52C1-D8E1-4654-AE65-6CCAB38DE894}.Release|Win32.Build.0 = Release|Win32
- {CD1C52C1-D8E1-4654-AE65-6CCAB38DE894}.Release|x64.ActiveCfg = Release|x64
- {CD1C52C1-D8E1-4654-AE65-6CCAB38DE894}.Release|x64.Build.0 = Release|x64
- {5AFB8B04-AEB9-408C-B53E-AFBC44B5F3F2}.Debug|Win32.ActiveCfg = Debug|Win32
- {5AFB8B04-AEB9-408C-B53E-AFBC44B5F3F2}.Debug|Win32.Build.0 = Debug|Win32
- {5AFB8B04-AEB9-408C-B53E-AFBC44B5F3F2}.Debug|x64.ActiveCfg = Debug|x64
- {5AFB8B04-AEB9-408C-B53E-AFBC44B5F3F2}.Debug|x64.Build.0 = Debug|x64
- {5AFB8B04-AEB9-408C-B53E-AFBC44B5F3F2}.Release|Win32.ActiveCfg = Release|Win32
- {5AFB8B04-AEB9-408C-B53E-AFBC44B5F3F2}.Release|Win32.Build.0 = Release|Win32
- {5AFB8B04-AEB9-408C-B53E-AFBC44B5F3F2}.Release|x64.ActiveCfg = Release|x64
- {5AFB8B04-AEB9-408C-B53E-AFBC44B5F3F2}.Release|x64.Build.0 = Release|x64
- {F7563CAD-5C95-46E5-89B7-0953C6C6E746}.Debug|Win32.ActiveCfg = Debug|Win32
- {F7563CAD-5C95-46E5-89B7-0953C6C6E746}.Debug|Win32.Build.0 = Debug|Win32
- {F7563CAD-5C95-46E5-89B7-0953C6C6E746}.Debug|x64.ActiveCfg = Debug|x64
- {F7563CAD-5C95-46E5-89B7-0953C6C6E746}.Debug|x64.Build.0 = Debug|x64
- {F7563CAD-5C95-46E5-89B7-0953C6C6E746}.Release|Win32.ActiveCfg = Release|Win32
- {F7563CAD-5C95-46E5-89B7-0953C6C6E746}.Release|Win32.Build.0 = Release|Win32
- {F7563CAD-5C95-46E5-89B7-0953C6C6E746}.Release|x64.ActiveCfg = Release|x64
- {F7563CAD-5C95-46E5-89B7-0953C6C6E746}.Release|x64.Build.0 = Release|x64
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
- GlobalSection(NestedProjects) = preSolution
- {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2} = {5377DC3A-DB96-4819-8AAF-2A75F3A69119}
- {B5A00BFA-6083-4FAE-A097-71642D6473B5} = {5377DC3A-DB96-4819-8AAF-2A75F3A69119}
- {1C320193-46A6-4B34-9C56-8AB584FC1B56} = {5377DC3A-DB96-4819-8AAF-2A75F3A69119}
- {12A49562-BAB9-43A3-A21D-15B60BBB4C31} = {5377DC3A-DB96-4819-8AAF-2A75F3A69119}
- {18B1F35A-10F8-4287-9B37-2D10501B0B38} = {5377DC3A-DB96-4819-8AAF-2A75F3A69119}
- {72782932-37CC-46AE-8C7F-9A7B1A6EE108} = {5377DC3A-DB96-4819-8AAF-2A75F3A69119}
- {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA} = {5377DC3A-DB96-4819-8AAF-2A75F3A69119}
- {843425BE-9A9A-44F4-A4E3-4B57D6ABD53C} = {5377DC3A-DB96-4819-8AAF-2A75F3A69119}
- {504B3154-7A4F-459D-9877-B951021C3F1F} = {5377DC3A-DB96-4819-8AAF-2A75F3A69119}
- {746F3632-5BB2-4570-9453-31D6D58A7D8E} = {493A1DB9-6E7C-48C7-93B5-F75C3C25B9DF}
- {DEB01ACB-D65F-4A62-AED9-58C1054499E9} = {493A1DB9-6E7C-48C7-93B5-F75C3C25B9DF}
- {592CF22D-3F8F-4A77-A174-130D77B7623B} = {8E282AE2-038C-49FE-AC67-BC9615AFD800}
- {C98AF157-352E-4737-BD30-A24E2647F5AE} = {8E282AE2-038C-49FE-AC67-BC9615AFD800}
- {EE157390-1E85-416C-946E-620E32C9AD33} = {8E282AE2-038C-49FE-AC67-BC9615AFD800}
- {57FAF32E-49FD-491F-895D-132D0D5EFE0A} = {8E282AE2-038C-49FE-AC67-BC9615AFD800}
- {6B83AC6D-01CE-4E1C-81CE-02AD8116C684} = {8E282AE2-038C-49FE-AC67-BC9615AFD800}
- {272FAFA8-2B2F-4716-B95F-3B37CF2E0CB3} = {8E282AE2-038C-49FE-AC67-BC9615AFD800}
- {CD1C52C1-D8E1-4654-AE65-6CCAB38DE894} = {8E282AE2-038C-49FE-AC67-BC9615AFD800}
- {92BFA534-C419-4EB2-AAA3-510653F38F08} = {09BABD45-8F30-4F99-B8B8-8DD78F6804DB}
- {B495B6D9-AF84-479D-B30A-313C16EF8BFD} = {09BABD45-8F30-4F99-B8B8-8DD78F6804DB}
- {5AFB8B04-AEB9-408C-B53E-AFBC44B5F3F2} = {09BABD45-8F30-4F99-B8B8-8DD78F6804DB}
- {F7563CAD-5C95-46E5-89B7-0953C6C6E746} = {09BABD45-8F30-4F99-B8B8-8DD78F6804DB}
- {79EF9F1D-E211-4ED1-91D2-FC935AB3A872} = {AC4356E8-48A1-4D2D-AFB1-11CF30B974CD}
- {429C907B-97D1-4B2D-9B0E-A14A5BFDAD15} = {AC4356E8-48A1-4D2D-AFB1-11CF30B974CD}
- {DCF01B1C-5268-44F3-9130-D647FABFB663} = {AC4356E8-48A1-4D2D-AFB1-11CF30B974CD}
- {3CA97077-6210-4362-998A-D15A35EEAA08} = {AC4356E8-48A1-4D2D-AFB1-11CF30B974CD}
- {17A33F3F-BAF5-403F-8EF4-FECDA7D9A335} = {AC4356E8-48A1-4D2D-AFB1-11CF30B974CD}
- {01D63BF5-7798-4746-852A-4B45229BB735} = {62083CC3-13BF-49EA-BFE8-4C9337C0D82C}
- {4714EF49-BFD5-4B22-95F7-95A07F1EAC25} = {62083CC3-13BF-49EA-BFE8-4C9337C0D82C}
- {F2D6C1AF-0C05-4695-84AF-15A2F92F9899} = {9155EBB8-E7DD-49AE-A86A-7B90B9F09888}
- EndGlobalSection
-EndGlobal
* mod_pocketsphinx
* - PocketSphinx (http://www.speech.cs.cmu.edu/pocketsphinx/)
*
- * mod_unimrcp
- * - MRCP (http://www.unimrcp.org/)
- *
*
* Codecs
* mod_amr
/applications/mod_translate/Makefile
/applications/mod_valet_parking/Makefile
/applications/mod_voicemail/Makefile
-/asr_tts/mod_unimrcp/Makefile
-/asr_tts/mod_unimrcp/Makefile.in
-/asr_tts/mod_unimrcp/mod_unimrcp.log
/asr_tts/mod_flite/*/*/mod_flite_manifest.rc
/codecs/mod_b64/Makefile
/codecs/mod_skel_codec/Makefile
mod_skypopen-all: mod_gsmopen-all
mod_gsmopen-all: mod_spandsp-all
-mod_unimrcp-all: mod_sofia-all
mod_rayo-all: mod_ssml-all
mod_ssml-all: mod_rayo-all
+++ /dev/null
-include $(top_srcdir)/build/modmake.rulesam
-
-MODNAME=mod_unimrcp
-
-UNIMRCP_DIR=$(switch_srcdir)/libs/unimrcp
-UNIMRCP_BUILDDIR=$(switch_builddir)/libs/unimrcp
-UNIMRCPLA=$(UNIMRCP_BUILDDIR)/platforms/libunimrcp-client/libunimrcpclient.la
-
-mod_LTLIBRARIES = mod_unimrcp.la
-mod_unimrcp_la_SOURCES = mod_unimrcp.c
-mod_unimrcp_la_CFLAGS = $(AM_CFLAGS)
-mod_unimrcp_la_CFLAGS += -I.
-mod_unimrcp_la_CFLAGS += -I$(switch_srcdir)/libs/apr/include
-mod_unimrcp_la_CFLAGS += -I$(switch_srcdir)/libs/apr-util/include
-mod_unimrcp_la_CFLAGS += -I$(switch_builddir)/libs/apr/include
-mod_unimrcp_la_CFLAGS += -I$(switch_builddir)/libs/apr-util/include
-mod_unimrcp_la_CFLAGS += -I$(UNIMRCP_DIR)/build
-mod_unimrcp_la_CFLAGS += -I$(UNIMRCP_DIR)/platforms/libunimrcp-client/include
-mod_unimrcp_la_CFLAGS += -I$(UNIMRCP_DIR)/modules/mrcp-sofiasip/include
-mod_unimrcp_la_CFLAGS += -I$(UNIMRCP_DIR)/modules/mrcp-unirtsp/include
-mod_unimrcp_la_CFLAGS += -I$(UNIMRCP_DIR)/libs/mrcp-client/include
-mod_unimrcp_la_CFLAGS += -I$(UNIMRCP_DIR)/libs/mrcp-signaling/include
-mod_unimrcp_la_CFLAGS += -I$(UNIMRCP_DIR)/libs/mrcpv2-transport/include
-mod_unimrcp_la_CFLAGS += -I$(UNIMRCP_DIR)/libs/mrcp/include
-mod_unimrcp_la_CFLAGS += -I$(UNIMRCP_DIR)/libs/mrcp/message/include
-mod_unimrcp_la_CFLAGS += -I$(UNIMRCP_DIR)/libs/mrcp/control/include
-mod_unimrcp_la_CFLAGS += -I$(UNIMRCP_DIR)/libs/mrcp/resources/include
-mod_unimrcp_la_CFLAGS += -I$(UNIMRCP_DIR)/libs/mpf/include
-mod_unimrcp_la_CFLAGS += -I$(UNIMRCP_DIR)/libs/apr-toolkit/include
-
-mod_unimrcp_la_LIBADD = $(switch_builddir)/libfreeswitch.la $(UNIMRCPLA) $(switch_builddir)/libs/apr/libapr-1.la $(switch_builddir)/libs/apr-util/libaprutil-1.la $(switch_builddir)/libs/apr-util/xml/expat/lib/libexpat.la
-mod_unimrcp_la_LDFLAGS = -avoid-version -module -no-undefined -shared
-
-if ISMAC
-mod_unimrcp_la_LDFLAGS += -framework CoreFoundation -framework SystemConfiguration
-endif
-
-BUILT_SOURCES = $(UNIMRCPLA)
-
-$(UNIMRCPLA): $(UNIMRCP_DIR) $(UNIMRCP_DIR)/.update
- cd $(UNIMRCP_BUILDDIR) && $(MAKE)
- $(TOUCH_TARGET)
-
-$(mod_unimrcp_la_SOURCES) : $(BUILT_SOURCES)
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectName>mod_unimrcp</ProjectName>
- <ProjectGuid>{D07C378A-F5F7-438F-ADF3-4AC4FB1883CD}</ProjectGuid>
- <RootNamespace>mod_unimrcp</RootNamespace>
- <Keyword>Win32Proj</Keyword>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <CharacterSet>MultiByte</CharacterSet>
- <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <CharacterSet>MultiByte</CharacterSet>
- <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <CharacterSet>MultiByte</CharacterSet>
- <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <CharacterSet>MultiByte</CharacterSet>
- <PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <Import Project="..\..\..\..\w32\openssl.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="..\..\..\..\w32\module_release.props" />
- <Import Project="unimrcp.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="..\..\..\..\w32\module_debug.props" />
- <Import Project="unimrcp.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="..\..\..\..\w32\module_release.props" />
- <Import Project="unimrcp.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="..\..\..\..\w32\module_debug.props" />
- <Import Project="unimrcp.props" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
- <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;LIBSOFIA_SIP_UA_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PrecompiledHeader>
- </PrecompiledHeader>
- </ClCompile>
- <Link>
- <AdditionalLibraryDirectories>$(SolutionDir)Debug/bin;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
- <DataExecutionPrevention>
- </DataExecutionPrevention>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;LIBSOFIA_SIP_UA_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PrecompiledHeader>
- </PrecompiledHeader>
- </ClCompile>
- <Link>
- <AdditionalLibraryDirectories>$(SolutionDir)$(PlatformName)\$(Configuration)\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
- <DataExecutionPrevention>
- </DataExecutionPrevention>
- <TargetMachine>MachineX64</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;LIBSOFIA_SIP_UA_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PrecompiledHeader>
- </PrecompiledHeader>
- </ClCompile>
- <Link>
- <AdditionalLibraryDirectories>$(SolutionDir)Release/bin;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
- <DataExecutionPrevention>
- </DataExecutionPrevention>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Midl>
- <TargetEnvironment>X64</TargetEnvironment>
- </Midl>
- <ClCompile>
- <PreprocessorDefinitions>APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;LIBSOFIA_SIP_UA_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PrecompiledHeader>
- </PrecompiledHeader>
- </ClCompile>
- <Link>
- <AdditionalLibraryDirectories>$(SolutionDir)$(PlatformName)\$(Configuration)\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
- <DataExecutionPrevention>
- </DataExecutionPrevention>
- <TargetMachine>MachineX64</TargetMachine>
- </Link>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="mod_unimrcp.c">
- <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">CompileAsC</CompileAs>
- <CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">CompileAsC</CompileAs>
- <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">CompileAsC</CompileAs>
- <CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">CompileAsC</CompileAs>
- </ClCompile>
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\..\..\libs\unimrcp\libs\apr-toolkit\aprtoolkit.2017.vcxproj">
- <Project>{13deeca0-bdd4-4744-a1a2-8eb0a44df3d2}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- <ProjectReference Include="..\..\..\..\libs\unimrcp\libs\mpf\mpf.2017.vcxproj">
- <Project>{b5a00bfa-6083-4fae-a097-71642d6473b5}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- <ProjectReference Include="..\..\..\..\libs\unimrcp\libs\mrcp-client\mrcpclient.2017.vcxproj">
- <Project>{72782932-37cc-46ae-8c7f-9a7b1a6ee108}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- <ProjectReference Include="..\..\..\..\libs\unimrcp\libs\mrcp-signaling\mrcpsignaling.2017.vcxproj">
- <Project>{12a49562-bab9-43a3-a21d-15b60bbb4c31}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- <ProjectReference Include="..\..\..\..\libs\unimrcp\libs\mrcpv2-transport\mrcpv2transport.2017.vcxproj">
- <Project>{a9edac04-6a5f-4ba7-bc0d-cce7b255b6ea}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- <ProjectReference Include="..\..\..\..\libs\unimrcp\libs\mrcp\mrcp.2017.vcxproj">
- <Project>{1c320193-46a6-4b34-9c56-8ab584fc1b56}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- <ProjectReference Include="..\..\..\..\libs\unimrcp\libs\uni-rtsp\unirtsp.2017.vcxproj">
- <Project>{504b3154-7a4f-459d-9877-b951021c3f1f}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- <ProjectReference Include="..\..\..\..\libs\unimrcp\modules\mrcp-sofiasip\mrcpsofiasip.2017.vcxproj">
- <Project>{746f3632-5bb2-4570-9453-31d6d58a7d8e}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- <ProjectReference Include="..\..\..\..\libs\unimrcp\modules\mrcp-unirtsp\mrcpunirtsp.2017.vcxproj">
- <Project>{deb01acb-d65f-4a62-aed9-58c1054499e9}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- <ProjectReference Include="..\..\..\..\libs\win32\apr-util\libaprutil.2017.vcxproj">
- <Project>{f057da7f-79e5-4b00-845c-ef446ef055e3}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- <ProjectReference Include="..\..\..\..\libs\win32\apr\libapr.2017.vcxproj">
- <Project>{f6c55d93-b927-4483-bb69-15aef3dd2dff}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- <ProjectReference Include="..\..\..\..\libs\win32\pthread\pthread.2017.vcxproj">
- <Project>{df018947-0fff-4eb3-bdee-441dc81da7a4}</Project>
- </ProjectReference>
- <ProjectReference Include="..\..\..\..\libs\win32\sofia\libsofia_sip_ua_static.2017.vcxproj">
- <Project>{70a49bc2-7500-41d0-b75d-edcc5be987a0}</Project>
- </ProjectReference>
- <ProjectReference Include="..\..\..\..\w32\Library\FreeSwitchCore.2017.vcxproj">
- <Project>{202d7a4e-760d-4d0e-afa1-d7459ced30ff}</Project>
- <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-/*
- * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2009-2015, Anthony Minessale II <anthm@freeswitch.org>
- *
- * Version: MPL 1.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is FreeSWITCH mod_unimrcp
- *
- * The Initial Developer of the Original Code is
- * Christopher M. Rienzo <chris@rienzo.com>
- *
- * Portions created by the Initial Developer are Copyright (C)
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Brian West <brian@freeswitch.org>
- * Christopher M. Rienzo <chris@rienzo.com>
- * Luke Dashjr <luke@openmethods.com> (OpenMethods, LLC)
- *
- * Maintainer: Christopher M. Rienzo <chris@rienzo.com>
- *
- * mod_unimrcp.c -- UniMRCP module (MRCP client)
- *
- */
-#include <switch.h>
-
-/* UniMRCP includes */
-#include "apt.h"
-#include "apt_log.h"
-#include "unimrcp_client.h"
-#include "mrcp_application.h"
-#include "mrcp_session.h"
-#include "mrcp_message.h"
-#include "mrcp_generic_header.h"
-#include "mrcp_synth_header.h"
-#include "mrcp_synth_resource.h"
-#include "mrcp_recog_header.h"
-#include "mrcp_recog_resource.h"
-#include "uni_version.h"
-#include "mrcp_resource_loader.h"
-#include "mpf_engine.h"
-#include "mpf_codec_manager.h"
-#include "mpf_dtmf_generator.h"
-#include "mpf_rtp_termination_factory.h"
-#include "mrcp_sofiasip_client_agent.h"
-#include "mrcp_unirtsp_client_agent.h"
-#include "mrcp_client_connection.h"
-#include "apt_net.h"
-
-/*********************************************************************************************************************************************
- * mod_unimrcp : module interface to FreeSWITCH
- */
-
-/* module name */
-#define MOD_UNIMRCP "unimrcp"
-/* module config file */
-#define CONFIG_FILE "unimrcp.conf"
-
-
-/**
- * A UniMRCP application.
- */
-struct mod_unimrcp_application {
- /** UniMRCP application */
- mrcp_application_t *app;
- /** MRCP callbacks from UniMRCP to this module's application */
- mrcp_app_message_dispatcher_t dispatcher;
- /** Audio callbacks from UniMRCP to this module's application */
- mpf_audio_stream_vtable_t audio_stream_vtable;
- /** maps FreeSWITCH param to MRCP param name */
- switch_hash_t *fs_param_map;
- /** maps MRCP header to unimrcp header handler function */
- switch_hash_t *param_id_map;
-};
-typedef struct mod_unimrcp_application mod_unimrcp_application_t;
-
-/**
- * module globals - global configuration and variables
- */
-struct mod_unimrcp_globals {
- /** max-connection-count config */
- char *unimrcp_max_connection_count;
- /** request-timeout config */
- char *unimrcp_request_timeout;
- /** rx-buffer-size */
- char *unimrcp_rx_buffer_size;
- /** tx-buffer-size */
- char *unimrcp_tx_buffer_size;
- /** offer-new-connection config */
- char *unimrcp_offer_new_connection;
- /** default-tts-profile config */
- char *unimrcp_default_synth_profile;
- /** default-asr-profile config */
- char *unimrcp_default_recog_profile;
- /** log level for UniMRCP library */
- char *unimrcp_log_level;
- /** profile events configuration param */
- char *enable_profile_events_param;
- /** True if profile events are wanted */
- int enable_profile_events;
- /** the MRCP client stack */
- mrcp_client_t *mrcp_client;
- /** synthesizer application */
- mod_unimrcp_application_t synth;
- /** recognizer application */
- mod_unimrcp_application_t recog;
- /** synchronize access for speech channel numbering */
- switch_mutex_t *mutex;
- /** next available speech channel number */
- int speech_channel_number;
- /** the available profiles */
- switch_hash_t *profiles;
-};
-typedef struct mod_unimrcp_globals mod_unimrcp_globals_t;
-
-/** Module global variables */
-static mod_unimrcp_globals_t globals;
-
-/**
- * Profile-specific configuration. This allows us to handle differing MRCP server behavior
- * on a per-profile basis
- */
-struct profile {
- /** name of the profile */
- char *name;
-
- /** MIME type to use for JSGF grammars */
- const char *jsgf_mime_type;
- /** MIME type to use for GSL grammars */
- const char *gsl_mime_type;
- /** MIME type to use for SRGS XML grammars */
- const char *srgs_xml_mime_type;
- /** MIME type to use for SRGS ABNF grammars */
- const char *srgs_mime_type;
-
- /** MIME type to use for Google Speech module context */
- const char *xml_mime_type;
-
- /** MIME type to use for SSML (TTS) */
- const char *ssml_mime_type;
-
- /** Default params to use for RECOGNIZE requests */
- switch_hash_t *default_recog_params;
- /** Default params to use for SPEAK requests */
- switch_hash_t *default_synth_params;
-};
-typedef struct profile profile_t;
-static switch_status_t profile_create(profile_t ** profile, const char *name, switch_memory_pool_t *pool);
-
-/* Profile events that may be monitored. Useful for tracking MRCP profile utilization */
-#define MY_EVENT_PROFILE_CREATE "unimrcp::profile_create"
-#define MY_EVENT_PROFILE_OPEN "unimrcp::profile_open"
-#define MY_EVENT_PROFILE_CLOSE "unimrcp::profile_close"
-
-/**
- * Defines XML parsing instructions
- */
-static switch_xml_config_item_t instructions[] = {
- SWITCH_CONFIG_ITEM_STRING_STRDUP("max-connection-count", CONFIG_REQUIRED, &globals.unimrcp_max_connection_count, "100", "",
- "The max MRCPv2 connections to manage"),
- SWITCH_CONFIG_ITEM_STRING_STRDUP("offer-new-connection", CONFIG_REQUIRED, &globals.unimrcp_offer_new_connection, "1", "", ""),
- SWITCH_CONFIG_ITEM_STRING_STRDUP("default-tts-profile", CONFIG_REQUIRED, &globals.unimrcp_default_synth_profile, "default", "",
- "The default profile to use for TTS"),
- SWITCH_CONFIG_ITEM_STRING_STRDUP("default-asr-profile", CONFIG_REQUIRED, &globals.unimrcp_default_recog_profile, "default", "",
- "The default profile to use for ASR"),
- SWITCH_CONFIG_ITEM_STRING_STRDUP("log-level", CONFIG_REQUIRED, &globals.unimrcp_log_level, "WARNING",
- "EMERGENCY|ALERT|CRITICAL|ERROR|WARNING|NOTICE|INFO|DEBUG", "Logging level for UniMRCP"),
- SWITCH_CONFIG_ITEM_STRING_STRDUP("enable-profile-events", CONFIG_REQUIRED, &globals.enable_profile_events_param, "false", "",
- "Fire profile events (true|false)"),
- SWITCH_CONFIG_ITEM_STRING_STRDUP("request-timeout", CONFIG_REQUIRED, &globals.unimrcp_request_timeout, "10000", "",
- "Maximum time to wait for server response to a request"),
- SWITCH_CONFIG_ITEM_STRING_STRDUP("connection-rx-buffer-size", 0, &globals.unimrcp_rx_buffer_size, "1024", "",
- "Maximum time to wait for server response to a request"),
- SWITCH_CONFIG_ITEM_STRING_STRDUP("connection-tx-buffer-size", 0, &globals.unimrcp_tx_buffer_size, "1024", "",
- "Maximum time to wait for server response to a request"),
- SWITCH_CONFIG_ITEM_END()
-};
-
-/* mod_unimrcp interface to FreeSWITCH */
-SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_unimrcp_shutdown);
-SWITCH_MODULE_RUNTIME_FUNCTION(mod_unimrcp_runtime);
-SWITCH_MODULE_LOAD_FUNCTION(mod_unimrcp_load);
-SWITCH_MODULE_DEFINITION(mod_unimrcp, mod_unimrcp_load, mod_unimrcp_shutdown, NULL);
-
-static switch_status_t mod_unimrcp_do_config();
-static mrcp_client_t *mod_unimrcp_client_create(switch_memory_pool_t *mod_pool);
-static int process_rtp_config(mrcp_client_t *client, mpf_rtp_config_t *rtp_config, mpf_rtp_settings_t *rtp_settings, const char *param, const char *val, apr_pool_t *pool);
-static int process_mrcpv1_config(rtsp_client_config_t *config, mrcp_sig_settings_t *sig_settings, const char *param, const char *val, apr_pool_t *pool);
-static int process_mrcpv2_config(mrcp_sofia_client_config_t *config, mrcp_sig_settings_t *sig_settings, const char *param, const char *val, apr_pool_t *pool);
-static int process_profile_config(profile_t *profile, const char *param, const char *val, apr_pool_t *pool);
-
-/* UniMRCP <--> FreeSWITCH logging bridge */
-static apt_bool_t unimrcp_log(const char *file, int line, const char *obj, apt_log_priority_e priority, const char *format, va_list arg_ptr);
-static apt_log_priority_e str_to_log_level(const char *level);
-
-static int get_next_speech_channel_number(void);
-
-#define XML_ID "<?xml"
-#define SRGS_ID "<grammar"
-#define SSML_ID "<speak"
-#define GSL_ID ";GSL2.0"
-#define ABNF_ID "#ABNF"
-#define JSGF_ID "#JSGF"
-#define GSR_ID "<speech-context"
-#define BUILTIN_ID "builtin:"
-#define SESSION_ID "session:"
-#define HTTP_ID "http://"
-#define HTTPS_ID "https://"
-#define FILE_ID "file://"
-#define INLINE_ID "inline:"
-static int text_starts_with(const char *text, const char *match);
-static const char *skip_initial_whitespace(const char *text);
-
-/**
- * UniMRCP parameter ID container
- */
-struct unimrcp_param_id {
- /** The parameter ID */
- int id;
-};
-typedef struct unimrcp_param_id unimrcp_param_id_t;
-static unimrcp_param_id_t *unimrcp_param_id_create(int id, switch_memory_pool_t *pool);
-
-
-/********************************************************************************************************************************************
- * AUDIO QUEUE : UniMRCP <--> FreeSWITCH audio buffering
- */
-
-/* size of the buffer */
-#define AUDIO_QUEUE_SIZE (1024 * 32)
-
-/* Define to enable read/write logging and dumping of queue data to file */
-#undef MOD_UNIMRCP_DEBUG_AUDIO_QUEUE
-
-/**
- * Audio queue internals
- */
-struct audio_queue {
-#ifdef MOD_UNIMRCP_DEBUG_AUDIO_QUEUE
- /** debug file for tx operations */
- switch_file_t *file_write;
- /** debug file name */
- char file_write_name[30];
- /** debug file for rx operations */
- switch_file_t *file_read;
- /** debug file name */
- char file_read_name[30];
-#endif
- /** the buffer of audio data */
- switch_buffer_t *buffer;
- /** synchronizes access to queue */
- switch_mutex_t *mutex;
- /** signaling for blocked readers/writers */
- switch_thread_cond_t *cond;
- /** total bytes written */
- switch_size_t write_bytes;
- /** total bytes read */
- switch_size_t read_bytes;
- /** number of bytes reader is waiting for */
- switch_size_t waiting;
- /** name of this queue (for logging) */
- char *name;
- /** optional session uuid associated with this queue (for logging) */
- char *session_uuid;
-};
-typedef struct audio_queue audio_queue_t;
-
-static switch_status_t audio_queue_create(audio_queue_t ** queue, const char *name, const char *session_uuid, switch_memory_pool_t *pool);
-static switch_status_t audio_queue_write(audio_queue_t *queue, void *data, switch_size_t *data_len);
-static switch_status_t audio_queue_read(audio_queue_t *queue, void *data, switch_size_t *data_len, int block);
-static switch_status_t audio_queue_clear(audio_queue_t *queue);
-static switch_status_t audio_queue_signal(audio_queue_t *queue);
-static switch_status_t audio_queue_destroy(audio_queue_t *queue);
-
-/*********************************************************************************************************************************************
- * SPEECH_CHANNEL : speech functions common to recognizer and synthesizer
- */
-
-#define SPEECH_CHANNEL_TIMEOUT_USEC (5000 * 1000)
-#define AUDIO_TIMEOUT_USEC (SWITCH_MAX_INTERVAL * 1000)
-
-/**
- * Type of MRCP channel
- */
-enum speech_channel_type {
- SPEECH_CHANNEL_SYNTHESIZER,
- SPEECH_CHANNEL_RECOGNIZER
-};
-typedef enum speech_channel_type speech_channel_type_t;
-
-/**
- * channel states
- */
-enum speech_channel_state {
- /** closed */
- SPEECH_CHANNEL_CLOSED,
- /** ready for speech request */
- SPEECH_CHANNEL_READY,
- /** processing speech request */
- SPEECH_CHANNEL_PROCESSING,
- /** finished processing speech request */
- SPEECH_CHANNEL_DONE,
- /** error opening channel */
- SPEECH_CHANNEL_ERROR
-};
-typedef enum speech_channel_state speech_channel_state_t;
-
-
-
-/**
- * An MRCP speech channel
- */
-struct speech_channel {
- /** the name of this channel (for logging) */
- char *name;
- /** optional session associated w/ this channel */
- char *session_uuid;
- /** The profile used by this channel */
- profile_t *profile;
- /** type of channel */
- speech_channel_type_t type;
- /** application this channel is running */
- mod_unimrcp_application_t *application;
- /** UniMRCP session */
- mrcp_session_t *unimrcp_session;
- /** UniMRCP channel */
- mrcp_channel_t *unimrcp_channel;
- /** memory pool */
- switch_memory_pool_t *memory_pool;
- /** synchronizes channel state */
- switch_mutex_t *mutex;
- /** wait on channel states */
- switch_thread_cond_t *cond;
- /** channel state */
- speech_channel_state_t state;
- /** UniMRCP <--> FreeSWITCH audio buffer */
- audio_queue_t *audio_queue;
- /** True, if channel was opened successfully */
- int channel_opened;
- /** rate */
- uint16_t rate;
- /** silence sample */
- int silence;
- /** speech channel params */
- switch_hash_t *params;
- /** app specific data */
- void *data;
- void *fsh;
-};
-typedef struct speech_channel speech_channel_t;
-
-/* speech channel interface for UniMRCP */
-static apt_bool_t speech_on_session_terminate(mrcp_application_t *application, mrcp_session_t *session, mrcp_sig_status_code_e status);
-static apt_bool_t speech_on_channel_add(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel,
- mrcp_sig_status_code_e status);
-static apt_bool_t speech_on_channel_remove(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel,
- mrcp_sig_status_code_e status);
-
-/* speech_channel funcs */
-static switch_status_t speech_channel_create(speech_channel_t ** schannel, const char *name, const char *session_uuid, speech_channel_type_t type, mod_unimrcp_application_t *app,
- uint16_t rate, switch_memory_pool_t *pool);
-static mpf_termination_t *speech_channel_create_mpf_termination(speech_channel_t *schannel);
-static switch_status_t speech_channel_open(speech_channel_t *schannel, profile_t *profile);
-static switch_status_t speech_channel_destroy(speech_channel_t *schannel);
-static switch_status_t speech_channel_stop(speech_channel_t *schannel);
-static switch_status_t speech_channel_set_param(speech_channel_t *schannel, const char *name, const char *val);
-static switch_status_t speech_channel_write(speech_channel_t *schannel, void *data, switch_size_t *len);
-static switch_status_t speech_channel_read(speech_channel_t *schannel, void *data, switch_size_t *len, int block);
-static switch_status_t speech_channel_set_state(speech_channel_t *schannel, speech_channel_state_t state);
-static switch_status_t speech_channel_set_state_unlocked(speech_channel_t *schannel, speech_channel_state_t state);
-static const char *speech_channel_state_to_string(speech_channel_state_t state);
-static const char *speech_channel_type_to_string(speech_channel_type_t type);
-
-
-/*********************************************************************************************************************************************
- * SYNTHESIZER : UniMRCP <--> FreeSWITCH tts interface
- */
-
-/* synthesis languages */
-#define MIME_TYPE_PLAIN_TEXT "text/plain"
-
-static switch_status_t synth_load(switch_loadable_module_interface_t *module_interface, switch_memory_pool_t *pool);
-static switch_status_t synth_shutdown();
-
-/* synthesizer's interface for FreeSWITCH */
-static switch_status_t synth_speech_open(switch_speech_handle_t *sh, const char *voice_name, int rate, int channels, switch_speech_flag_t *flags);
-static switch_status_t synth_speech_close(switch_speech_handle_t *sh, switch_speech_flag_t *flags);
-static switch_status_t synth_speech_feed_tts(switch_speech_handle_t *sh, char *text, switch_speech_flag_t *flags);
-static switch_status_t synth_speech_read_tts(switch_speech_handle_t *sh, void *data, switch_size_t *datalen, switch_speech_flag_t *flags);
-static void synth_speech_flush_tts(switch_speech_handle_t *sh);
-static void synth_speech_text_param_tts(switch_speech_handle_t *sh, char *param, const char *val);
-static void synth_speech_numeric_param_tts(switch_speech_handle_t *sh, char *param, int val);
-static void synth_speech_float_param_tts(switch_speech_handle_t *sh, char *param, double val);
-
-/* synthesizer's interface for UniMRCP */
-static apt_bool_t synth_message_handler(const mrcp_app_message_t *app_message);
-static apt_bool_t synth_on_message_receive(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_message_t *message);
-static apt_bool_t synth_stream_write(mpf_audio_stream_t *stream, const mpf_frame_t *frame);
-
-/* synthesizer specific speech_channel funcs */
-static switch_status_t synth_channel_speak(speech_channel_t *schannel, const char *text);
-static switch_status_t synth_channel_set_params(speech_channel_t *schannel, mrcp_message_t *msg, mrcp_generic_header_t *gen_hdr,
- mrcp_synth_header_t *synth_hdr);
-static switch_status_t synth_channel_set_header(speech_channel_t *schannel, int id, char *val, mrcp_message_t *msg, mrcp_synth_header_t *synth_hdr);
-
-/*********************************************************************************************************************************************
- * GRAMMAR : recognizer grammar management
- */
-
-/**
- * type of the grammar
- */
-enum grammar_type {
- GRAMMAR_TYPE_UNKNOWN,
- /* text/uri-list */
- GRAMMAR_TYPE_URI,
- /* application/srgs */
- GRAMMAR_TYPE_SRGS,
- /* application/srgs+xml */
- GRAMMAR_TYPE_SRGS_XML,
- /* application/x-nuance-gsl */
- GRAMMAR_TYPE_NUANCE_GSL,
- /* application/x-jsgf */
- GRAMMAR_TYPE_JSGF,
- /* application/xml */
- GRAMMAR_TYPE_XML
-};
-typedef enum grammar_type grammar_type_t;
-
-/**
- * A grammar for recognition
- */
-struct grammar {
- /** name of this grammar */
- char *name;
- /** grammar MIME type */
- grammar_type_t type;
- /** the grammar or its URI, depending on type */
- char *data;
-};
-typedef struct grammar grammar_t;
-
-static switch_status_t grammar_create(grammar_t ** grammar, const char *name, grammar_type_t type, const char *data, switch_memory_pool_t *pool);
-static const char *grammar_type_to_mime(grammar_type_t type, profile_t *profile);
-
-/*********************************************************************************************************************************************
- * RECOGNIZER : UniMRCP <--> FreeSWITCH asr interface
- */
-
-#define START_OF_INPUT_RECEIVED 1
-#define START_OF_INPUT_REPORTED 2
-
-/**
- * Data specific to the recognizer
- */
-struct recognizer_data {
- /** the available grammars */
- switch_hash_t *grammars;
- /** the enabled grammars */
- switch_hash_t *enabled_grammars;
- /** recognize result */
- char *result;
- /** recognize result headers */
- switch_event_t *result_headers;
- /** true, if voice has started */
- int start_of_input;
- /** true, if input timers have started */
- int timers_started;
- /** UniMRCP mpf stream */
- mpf_audio_stream_t *unimrcp_stream;
- /** DTMF generator */
- mpf_dtmf_generator_t *dtmf_generator;
- /** true, if presently transmitting DTMF */
- char dtmf_generator_active;
-};
-typedef struct recognizer_data recognizer_data_t;
-
-static switch_status_t recog_load(switch_loadable_module_interface_t *module_interface, switch_memory_pool_t *pool);
-static switch_status_t recog_shutdown();
-
-/* recognizer's interface for FreeSWITCH */
-static switch_status_t recog_asr_open(switch_asr_handle_t *ah, const char *codec, int rate, const char *dest, switch_asr_flag_t *flags);
-static switch_status_t recog_asr_load_grammar(switch_asr_handle_t *ah, const char *grammar, const char *name);
-static switch_status_t recog_asr_unload_grammar(switch_asr_handle_t *ah, const char *name);
-static switch_status_t recog_asr_enable_grammar(switch_asr_handle_t *ah, const char *name);
-static switch_status_t recog_asr_disable_grammar(switch_asr_handle_t *ah, const char *name);
-static switch_status_t recog_asr_disable_all_grammars(switch_asr_handle_t *ah);
-static switch_status_t recog_asr_close(switch_asr_handle_t *ah, switch_asr_flag_t *flags);
-static switch_status_t recog_asr_feed(switch_asr_handle_t *ah, void *data, unsigned int len, switch_asr_flag_t *flags);
-static switch_status_t recog_asr_feed_dtmf(switch_asr_handle_t *ah, const switch_dtmf_t *dtmf, switch_asr_flag_t *flags);
-static switch_status_t recog_asr_resume(switch_asr_handle_t *ah);
-static switch_status_t recog_asr_pause(switch_asr_handle_t *ah);
-static switch_status_t recog_asr_check_results(switch_asr_handle_t *ah, switch_asr_flag_t *flags);
-static switch_status_t recog_asr_get_results(switch_asr_handle_t *ah, char **xmlstr, switch_asr_flag_t *flags);
-static switch_status_t recog_asr_get_result_headers(switch_asr_handle_t *ah, switch_event_t **headers, switch_asr_flag_t *flags);
-static switch_status_t recog_asr_start_input_timers(switch_asr_handle_t *ah);
-static void recog_asr_text_param(switch_asr_handle_t *ah, char *param, const char *val);
-static void recog_asr_numeric_param(switch_asr_handle_t *ah, char *param, int val);
-static void recog_asr_float_param(switch_asr_handle_t *ah, char *param, double val);
-
-/* recognizer's interface for UniMRCP */
-static apt_bool_t recog_message_handler(const mrcp_app_message_t *app_message);
-static apt_bool_t recog_on_message_receive(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_message_t *message);
-static apt_bool_t recog_stream_open(mpf_audio_stream_t *stream, mpf_codec_t *codec);
-static apt_bool_t recog_stream_read(mpf_audio_stream_t *stream, mpf_frame_t *frame);
-
-/* recognizer specific speech_channel_funcs */
-static switch_status_t recog_channel_start(speech_channel_t *schannel);
-static switch_status_t recog_channel_load_grammar(speech_channel_t *schannel, const char *name, grammar_type_t type, const char *data);
-static switch_status_t recog_channel_unload_grammar(speech_channel_t *schannel, const char *name);
-static switch_status_t recog_channel_enable_grammar(speech_channel_t *schannel, const char *name);
-static switch_status_t recog_channel_disable_grammar(speech_channel_t *schannel, const char *name);
-static switch_status_t recog_channel_disable_all_grammars(speech_channel_t *schannel);
-static switch_status_t recog_channel_check_results(speech_channel_t *schannel);
-static switch_status_t recog_channel_set_start_of_input(speech_channel_t *schannel);
-static switch_status_t recog_channel_start_input_timers(speech_channel_t *schannel);
-static switch_status_t recog_channel_set_results(speech_channel_t *schannel, const char *results);
-static switch_status_t recog_channel_set_result_headers(speech_channel_t *schannel, mrcp_recog_header_t *recog_hdr);
-static switch_status_t recog_channel_get_results(speech_channel_t *schannel, char **results);
-static switch_status_t recog_channel_get_result_headers(speech_channel_t *schannel, switch_event_t **result_headers);
-static switch_status_t recog_channel_set_params(speech_channel_t *schannel, mrcp_message_t *msg, mrcp_generic_header_t *gen_hdr,
- mrcp_recog_header_t *recog_hdr);
-static switch_status_t recog_channel_set_header(speech_channel_t *schannel, int id, char *val, mrcp_message_t *msg, mrcp_recog_header_t *recog_hdr);
-static switch_status_t recog_channel_set_timers_started(speech_channel_t *schannel);
-
-
-/**
- * Create a mod_unimrcp profile
- * @param profile the created profile
- * @param name the profile name
- * @param pool the memory pool to use
- * @return SWITCH_STATUS_SUCCESS if the profile is created
- */
-static switch_status_t profile_create(profile_t ** profile, const char *name, switch_memory_pool_t *pool)
-{
- switch_status_t status = SWITCH_STATUS_SUCCESS;
- profile_t *lprofile = NULL;
- switch_event_t *event = NULL;
-
- lprofile = (profile_t *) switch_core_alloc(pool, sizeof(profile_t));
- if (lprofile) {
- lprofile->name = switch_core_strdup(pool, name);
- lprofile->srgs_mime_type = "application/srgs";
- lprofile->srgs_xml_mime_type = "application/srgs+xml";
- lprofile->gsl_mime_type = "application/x-nuance-gsl";
- lprofile->jsgf_mime_type = "application/x-jsgf";
- lprofile->ssml_mime_type = "application/ssml+xml";
- lprofile->xml_mime_type = "application/xml";
- switch_core_hash_init(&lprofile->default_synth_params);
- switch_core_hash_init(&lprofile->default_recog_params);
- *profile = lprofile;
-
- if (globals.enable_profile_events && switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, MY_EVENT_PROFILE_CREATE) == SWITCH_STATUS_SUCCESS) {
- switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "MRCP-Profile", lprofile->name);
- switch_event_fire(&event);
- }
- } else {
- *profile = NULL;
- status = SWITCH_STATUS_FALSE;
- }
-
- return status;
-}
-
-/**
- * Inspect text to determine if its first non-whitespace text matches "match"
- * @param text the text to inspect.
- * @param match the text to match
- * @return true if matches
- */
-static int text_starts_with(const char *text, const char *match)
-{
- int result = 0;
-
- text = skip_initial_whitespace(text);
- if (!zstr(text)) {
- size_t textlen, matchlen;
- textlen = strlen(text);
- matchlen = strlen(match);
- /* is there a match? */
- result = textlen > matchlen && !strncmp(match, text, matchlen);
- }
-
- return result;
-}
-
-/**
- * Find the first non-whitespace text character in text
- * @param text the text to scan
- * @return pointer to the first non-whitespace char in text or the empty string if none
- */
-static const char *skip_initial_whitespace(const char *text)
-{
- if (!zstr(text)) {
- while(switch_isspace(*text)) {
- text++;
- }
- }
- return text;
-}
-
-/**
- * Create the audio queue
- *
- * @param audio_queue the created queue
- * @param name the name of this queue (for logging)
- * @param session_uuid optional session associated with this channel
- * @param pool memory pool to allocate queue from
- * @return SWITCH_STATUS_SUCCESS if successful. SWITCH_STATUS_FALSE if unable to allocate queue
- */
-static switch_status_t audio_queue_create(audio_queue_t ** audio_queue, const char *name, const char *session_uuid, switch_memory_pool_t *pool)
-{
- switch_status_t status = SWITCH_STATUS_SUCCESS;
- audio_queue_t *laudio_queue = NULL;
-#ifdef MOD_UNIMRCP_DEBUG_AUDIO_QUEUE
- int flags;
-#endif
- char *lname;
- char *lsession_uuid = NULL;
- *audio_queue = NULL;
-
- lname = zstr(name) ? "" : switch_core_strdup(pool, name);
- lsession_uuid = zstr(session_uuid) ? NULL : switch_core_strdup(pool, session_uuid);
-
- if ((laudio_queue = (audio_queue_t *) switch_core_alloc(pool, sizeof(audio_queue_t))) == NULL) {
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(lsession_uuid), SWITCH_LOG_ERROR, "(%s) unable to create audio queue\n", lname);
- status = SWITCH_STATUS_FALSE;
- goto done;
- }
-
- laudio_queue->name = lname;
- laudio_queue->session_uuid = lsession_uuid;
-
- if (switch_buffer_create(pool, &laudio_queue->buffer, AUDIO_QUEUE_SIZE) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(lsession_uuid), SWITCH_LOG_ERROR, "(%s) unable to create audio queue buffer\n", laudio_queue->name);
- status = SWITCH_STATUS_FALSE;
- goto done;
- }
-
- if (switch_mutex_init(&laudio_queue->mutex, SWITCH_MUTEX_UNNESTED, pool) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(lsession_uuid), SWITCH_LOG_ERROR, "(%s) unable to create audio queue mutex\n", laudio_queue->name);
- status = SWITCH_STATUS_FALSE;
- goto done;
- }
-
- if (switch_thread_cond_create(&laudio_queue->cond, pool) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(lsession_uuid), SWITCH_LOG_ERROR, "(%s) unable to create audio queue condition variable\n", laudio_queue->name);
- status = SWITCH_STATUS_FALSE;
- goto done;
- }
-#ifdef MOD_UNIMRCP_DEBUG_AUDIO_QUEUE
- flags = SWITCH_FOPEN_CREATE | SWITCH_FOPEN_WRITE | SWITCH_FOPEN_TRUNCATE | SWITCH_FOPEN_BINARY;
- strcpy(laudio_queue->file_read_name, "/tmp/mod_unimrcp_rx_XXXXXX");
- if (switch_file_mktemp(&laudio_queue->file_read, laudio_queue->file_read_name, flags, pool) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(laudio_queue->session_uuid), SWITCH_LOG_ERROR, "(%s) unable to create audio queue read file\n", laudio_queue->name);
- laudio_queue->file_read = NULL;
- } else {
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(laudio_queue->session_uuid), SWITCH_LOG_DEBUG, "(%s) queue rx saved to %s\n", laudio_queue->name, laudio_queue->file_read_name);
- }
- strcpy(laudio_queue->file_write_name, "/tmp/mod_unimrcp_tx_XXXXXX");
- if (switch_file_mktemp(&laudio_queue->file_write, laudio_queue->file_write_name, flags, pool) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(laudio_queue->session_uuid), SWITCH_LOG_ERROR, "(%s) unable to create audio queue write file\n", laudio_queue->name);
- laudio_queue->file_write = NULL;
- } else {
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(laudio_queue->session_uuid), SWITCH_LOG_DEBUG, "(%s) queue tx saved to %s\n", laudio_queue->name, laudio_queue->file_write_name);
- }
-#endif
-
- laudio_queue->write_bytes = 0;
- laudio_queue->read_bytes = 0;
- laudio_queue->waiting = 0;
- *audio_queue = laudio_queue;
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(laudio_queue->session_uuid), SWITCH_LOG_DEBUG, "(%s) audio queue created\n", laudio_queue->name);
-
- done:
-
- if (status != SWITCH_STATUS_SUCCESS) {
- audio_queue_destroy(laudio_queue);
- }
- return status;
-}
-
-/**
- * Write to the audio queue
- *
- * @param queue the queue to write to
- * @param data the data to write
- * @param data_len the number of octets to write
- * @return SWITCH_STATUS_SUCCESS if data was written, SWITCH_STATUS_FALSE if data can't be written because queue is full
- */
-static switch_status_t audio_queue_write(audio_queue_t *queue, void *data, switch_size_t *data_len)
-{
- switch_status_t status = SWITCH_STATUS_SUCCESS;
-#ifdef MOD_UNIMRCP_DEBUG_AUDIO_QUEUE
- switch_size_t len = *data_len;
-#endif
- switch_mutex_lock(queue->mutex);
-
-#ifdef MOD_UNIMRCP_DEBUG_AUDIO_QUEUE
- if (queue->file_write) {
- switch_file_write(queue->file_write, data, &len);
- }
-#endif
-
- if (switch_buffer_write(queue->buffer, data, *data_len) > 0) {
- queue->write_bytes = queue->write_bytes + *data_len;
-#ifdef MOD_UNIMRCP_DEBUG_AUDIO_QUEUE
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(queue->session_uuid), SWITCH_LOG_DEBUG, "(%s) audio queue write total = %ld\trequested = %ld\n", queue->name, queue->write_bytes,
- *data_len);
-#endif
- if (queue->waiting <= switch_buffer_inuse(queue->buffer)) {
- switch_thread_cond_signal(queue->cond);
- }
- } else {
- *data_len = 0;
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(queue->session_uuid), SWITCH_LOG_DEBUG, "(%s) audio queue overflow!\n", queue->name);
- status = SWITCH_STATUS_FALSE;
- }
-
- switch_mutex_unlock(queue->mutex);
- return status;
-}
-
-/**
- * Read from the audio queue
- *
- * @param queue the queue to read from
- * @param data the read data
- * @param data_len the amount of data requested / actual amount of data read (returned)
- * @param block 1 if blocking is allowed
- * @return SWITCH_STATUS_SUCCESS if successful. SWITCH_STATUS_FALSE if no data was requested, or there was a timeout while waiting to read
- */
-static switch_status_t audio_queue_read(audio_queue_t *queue, void *data, switch_size_t *data_len, int block)
-{
- switch_size_t requested = *data_len;
- switch_status_t status = SWITCH_STATUS_SUCCESS;
-#ifdef MOD_UNIMRCP_DEBUG_AUDIO_QUEUE
- switch_size_t len = *data_len;
-#endif
- switch_mutex_lock(queue->mutex);
-
- /* allow the initial frame to buffer */
- if (!queue->read_bytes && switch_buffer_inuse(queue->buffer) < requested) {
- *data_len = 0;
- status = SWITCH_STATUS_SUCCESS;
- goto done;
- }
-
- /* wait for data, if allowed */
- if (block) {
- while (switch_buffer_inuse(queue->buffer) < requested) {
- queue->waiting = requested;
- if (switch_thread_cond_timedwait(queue->cond, queue->mutex, AUDIO_TIMEOUT_USEC) == SWITCH_STATUS_TIMEOUT) {
- break;
- }
- }
- queue->waiting = 0;
- }
-
- if (switch_buffer_inuse(queue->buffer) < requested) {
- requested = switch_buffer_inuse(queue->buffer);
- }
- if (requested == 0) {
- *data_len = 0;
- status = SWITCH_STATUS_FALSE;
- goto done;
- }
-
- /* read the data */
- *data_len = switch_buffer_read(queue->buffer, data, requested);
- queue->read_bytes = queue->read_bytes + *data_len;
-#ifdef MOD_UNIMRCP_DEBUG_AUDIO_QUEUE
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(queue->session_uuid), SWITCH_LOG_DEBUG, "(%s) audio queue read total = %ld\tread = %ld\trequested = %ld\n", queue->name,
- queue->read_bytes, *data_len, requested);
- if (queue->file_read) {
- switch_file_write(queue->file_read, data, &len);
- }
-#endif
-
- done:
-
- switch_mutex_unlock(queue->mutex);
- return status;
-}
-
-/**
- * Empty the queue
- *
- * @param queue the queue to empty
- * @return SWITCH_STATUS_SUCCESS
- */
-static switch_status_t audio_queue_clear(audio_queue_t *queue)
-{
- switch_mutex_lock(queue->mutex);
- switch_buffer_zero(queue->buffer);
- switch_thread_cond_signal(queue->cond);
- switch_mutex_unlock(queue->mutex);
- queue->read_bytes = 0;
- queue->write_bytes = 0;
- queue->waiting = 0;
- return SWITCH_STATUS_SUCCESS;
-}
-
-/**
- * Wake any threads waiting on this queue
- *
- * @param queue the queue to empty
- * @return SWITCH_STATUS_SUCCESS
- */
-static switch_status_t audio_queue_signal(audio_queue_t *queue)
-{
- switch_mutex_lock(queue->mutex);
- switch_thread_cond_signal(queue->cond);
- switch_mutex_unlock(queue->mutex);
- return SWITCH_STATUS_SUCCESS;
-}
-
-/**
- * Destroy the audio queue
- *
- * @param queue the queue to clean up
- * @return SWITCH_STATUS_SUCCESS
- */
-static switch_status_t audio_queue_destroy(audio_queue_t *queue)
-{
- if (queue) {
- char *name = queue->name;
- if (zstr(name)) {
- name = "";
- }
-#ifdef MOD_UNIMRCP_DEBUG_AUDIO_QUEUE
- if (queue->file_read) {
- switch_file_close(queue->file_read);
- queue->file_read = NULL;
- }
- if (queue->file_write) {
- switch_file_close(queue->file_write);
- queue->file_write = NULL;
- }
-#endif
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(queue->session_uuid), SWITCH_LOG_DEBUG, "(%s) audio queue destroyed\n", name);
- }
- return SWITCH_STATUS_SUCCESS;
-}
-
-/**
- * Create a speech channel
- *
- * @param schannel the created channel
- * @param name the name of the channel
- * @param session_uuid optional session associated with this channel
- * @param type the type of channel to create
- * @param app the application
- * @param rate the rate to use
- * @param pool the memory pool to use
- * @return SWITCH_STATUS_SUCCESS if successful. SWITCH_STATUS_FALSE if the channel cannot be allocated.
- */
-static switch_status_t speech_channel_create(speech_channel_t ** schannel, const char *name, const char *session_uuid, speech_channel_type_t type, mod_unimrcp_application_t *app,
- uint16_t rate, switch_memory_pool_t *pool)
-{
- switch_status_t status = SWITCH_STATUS_SUCCESS;
- speech_channel_t *schan = NULL;
- *schannel = NULL;
-
- if ((schan = (speech_channel_t *) switch_core_alloc(pool, sizeof(speech_channel_t))) == NULL) {
- status = SWITCH_STATUS_FALSE;
- goto done;
- }
- schan->profile = NULL;
- schan->type = type;
- schan->application = app;
- schan->state = SPEECH_CHANNEL_CLOSED;
- schan->memory_pool = pool;
- schan->params = NULL;
- schan->rate = rate;
- schan->silence = 0; /* L16 silence sample */
- schan->channel_opened = 0;
-
- if (switch_mutex_init(&schan->mutex, SWITCH_MUTEX_UNNESTED, pool) != SWITCH_STATUS_SUCCESS ||
- switch_thread_cond_create(&schan->cond, pool) != SWITCH_STATUS_SUCCESS ||
- audio_queue_create(&schan->audio_queue, name, session_uuid, pool) != SWITCH_STATUS_SUCCESS) {
- status = SWITCH_STATUS_FALSE;
- goto done;
- }
- switch_core_hash_init(&schan->params);
- schan->data = NULL;
- schan->name = zstr(name) ? "" : switch_core_strdup(pool, name);
- schan->session_uuid = zstr(session_uuid) ? NULL : switch_core_strdup(pool, session_uuid);
-
- *schannel = schan;
-
- done:
-
- return status;
-}
-
-/**
- * Destroy the speech channel
- *
- * @param schannel the channel to destroy
- * @return SWITCH_STATUS_SUCCESS
- */
-static switch_status_t speech_channel_destroy(speech_channel_t *schannel)
-{
- if (schannel) {
- /* Terminate the MRCP session if not already done */
- if (schannel->mutex) {
- switch_mutex_lock(schannel->mutex);
- if (schannel->state != SPEECH_CHANNEL_CLOSED) {
- int warned = 0;
- mrcp_application_session_terminate(schannel->unimrcp_session);
- /* wait forever for session to terminate. Log WARNING if this starts taking too long */
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) Waiting for MRCP session to terminate\n", schannel->name);
- while (schannel->state != SPEECH_CHANNEL_CLOSED) {
- if (switch_thread_cond_timedwait(schannel->cond, schannel->mutex, SPEECH_CHANNEL_TIMEOUT_USEC) == SWITCH_STATUS_TIMEOUT && !warned) {
- warned = 1;
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_WARNING, "(%s) MRCP session has not terminated after %d ms\n", schannel->name, SPEECH_CHANNEL_TIMEOUT_USEC / (1000));
- }
- }
- }
- switch_mutex_unlock(schannel->mutex);
- }
-
- /* It is now safe to clean up the speech channel */
- if (schannel->mutex) {
- switch_mutex_lock(schannel->mutex);
- }
- audio_queue_destroy(schannel->audio_queue);
- schannel->audio_queue = NULL;
- if (schannel->params) {
- switch_core_hash_destroy(&schannel->params);
- }
- if (schannel->mutex) {
- switch_mutex_unlock(schannel->mutex);
- }
- }
-
- return SWITCH_STATUS_SUCCESS;
-}
-
-/**
- * Create the audio termination for the speech channel
- * @param schannel the speech channel
- * @return the termination or NULL
- */
-static mpf_termination_t *speech_channel_create_mpf_termination(speech_channel_t *schannel)
-{
- mpf_termination_t *termination = NULL;
- mpf_stream_capabilities_t *capabilities = NULL;
- int sample_rates;
-
- if (schannel->type == SPEECH_CHANNEL_SYNTHESIZER) {
- capabilities = mpf_sink_stream_capabilities_create(schannel->unimrcp_session->pool);
- } else {
- capabilities = mpf_source_stream_capabilities_create(schannel->unimrcp_session->pool);
- }
- /* FreeSWITCH is capable of resampling so pick rates that are are multiples of the desired rate.
- * UniMRCP should transcode whatever the MRCP server wants to use into LPCM (host-byte ordered L16) for us.
- */
- if (schannel->rate == 16000) {
- sample_rates = MPF_SAMPLE_RATE_8000 | MPF_SAMPLE_RATE_16000;
- } else if (schannel->rate == 32000) {
- sample_rates = MPF_SAMPLE_RATE_8000 | MPF_SAMPLE_RATE_16000 | MPF_SAMPLE_RATE_32000;
- } else if (schannel->rate == 48000) {
- sample_rates = MPF_SAMPLE_RATE_8000 | MPF_SAMPLE_RATE_16000 | MPF_SAMPLE_RATE_48000;
- } else {
- sample_rates = MPF_SAMPLE_RATE_8000;
- }
- mpf_codec_capabilities_add(&capabilities->codecs, sample_rates, "LPCM");
- termination =
- mrcp_application_audio_termination_create(schannel->unimrcp_session, &schannel->application->audio_stream_vtable, capabilities, schannel);
-
- return termination;
-}
-
-/**
- * Open the speech channel
- *
- * @param schannel the channel to open
- * @param profile the profile to use
- * @return SWITCH_STATUS_FALSE if failed, SWITCH_STATUS_RESTART if retry can be attempted with another profile, SWITCH_STATUS_SUCCESS if successful
- */
-static switch_status_t speech_channel_open(speech_channel_t *schannel, profile_t *profile)
-{
- switch_status_t status = SWITCH_STATUS_SUCCESS;
- mpf_termination_t *termination = NULL;
- mrcp_resource_type_e resource_type;
- int warned = 0;
-
- switch_mutex_lock(schannel->mutex);
-
- /* make sure we can open channel */
- if (schannel->state != SPEECH_CHANNEL_CLOSED) {
- status = SWITCH_STATUS_FALSE;
- goto done;
- }
-
- schannel->profile = profile;
-
- /* create MRCP session */
- if ((schannel->unimrcp_session = mrcp_application_session_create(schannel->application->app, profile->name, schannel)) == NULL) {
- /* profile doesn't exist? */
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_ERROR, "(%s) Unable to create session with %s\n", schannel->name, profile->name);
- status = SWITCH_STATUS_RESTART;
- goto done;
- }
- mrcp_application_session_name_set(schannel->unimrcp_session, schannel->name);
-
- /* create audio termination and add to channel */
- if ((termination = speech_channel_create_mpf_termination(schannel)) == NULL) {
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_ERROR, "(%s) Unable to create termination with %s\n", schannel->name, profile->name);
- mrcp_application_session_destroy(schannel->unimrcp_session);
- status = SWITCH_STATUS_FALSE;
- goto done;
- }
- if (schannel->type == SPEECH_CHANNEL_SYNTHESIZER) {
- resource_type = MRCP_SYNTHESIZER_RESOURCE;
- } else {
- resource_type = MRCP_RECOGNIZER_RESOURCE;
- }
- if ((schannel->unimrcp_channel = mrcp_application_channel_create(schannel->unimrcp_session, resource_type, termination, NULL, schannel)) == NULL) {
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_ERROR, "(%s) Unable to create channel with %s\n", schannel->name, profile->name);
- mrcp_application_session_destroy(schannel->unimrcp_session);
- status = SWITCH_STATUS_FALSE;
- goto done;
- }
-
- /* add channel to session... this establishes the connection to the MRCP server */
- if (mrcp_application_channel_add(schannel->unimrcp_session, schannel->unimrcp_channel) != TRUE) {
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_ERROR, "(%s) Unable to add channel to session with %s\n", schannel->name, profile->name);
- mrcp_application_session_destroy(schannel->unimrcp_session);
- status = SWITCH_STATUS_FALSE;
- goto done;
- }
-
- /* wait for channel to be ready */
- warned = 0;
- while (schannel->state == SPEECH_CHANNEL_CLOSED) {
- if (switch_thread_cond_timedwait(schannel->cond, schannel->mutex, SPEECH_CHANNEL_TIMEOUT_USEC) == SWITCH_STATUS_TIMEOUT && !warned) {
- warned = 1;
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_WARNING, "(%s) MRCP session has not opened after %d ms\n", schannel->name, SPEECH_CHANNEL_TIMEOUT_USEC / (1000));
- }
- }
- if (schannel->state == SPEECH_CHANNEL_READY) {
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) channel is ready\n", schannel->name);
- } else if (schannel->state == SPEECH_CHANNEL_CLOSED) {
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_ERROR, "(%s) Timed out waiting for channel to be ready\n", schannel->name);
- /* can't retry */
- status = SWITCH_STATUS_FALSE;
- } else if (schannel->state == SPEECH_CHANNEL_ERROR) {
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) Terminating MRCP session\n", schannel->name);
- if (!mrcp_application_session_terminate(schannel->unimrcp_session)) {
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_WARNING, "(%s) Unable to terminate application session\n", schannel->name);
- status = SWITCH_STATUS_FALSE;
- goto done;
- }
-
- /* Wait for session to be cleaned up */
- warned = 0;
- while (schannel->state == SPEECH_CHANNEL_ERROR) {
- if (switch_thread_cond_timedwait(schannel->cond, schannel->mutex, SPEECH_CHANNEL_TIMEOUT_USEC) == SWITCH_STATUS_TIMEOUT && !warned) {
- warned = 1;
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_WARNING, "(%s) MRCP session has not cleaned up after %d ms\n", schannel->name, SPEECH_CHANNEL_TIMEOUT_USEC / (1000));
- }
- }
- if (schannel->state != SPEECH_CHANNEL_CLOSED) {
- /* major issue... can't retry */
- status = SWITCH_STATUS_FALSE;
- } else {
- /* failed to open profile, retry is allowed */
- status = SWITCH_STATUS_RESTART;
- }
- }
-
- done:
-
- switch_mutex_unlock(schannel->mutex);
- return status;
-}
-
-/**
- * Send SPEAK request to synthesizer
- *
- * @param schannel the synthesizer channel
- * @param text The text to speak. This may be plain text or SSML.
- * @return SWITCH_STATUS_SUCCESS if successful
- */
-static switch_status_t synth_channel_speak(speech_channel_t *schannel, const char *text)
-{
- switch_status_t status = SWITCH_STATUS_SUCCESS;
- mrcp_message_t *mrcp_message = NULL;
- mrcp_generic_header_t *generic_header = NULL;
- mrcp_synth_header_t *synth_header = NULL;
- int warned = 0;
-
- switch_mutex_lock(schannel->mutex);
- if (schannel->state != SPEECH_CHANNEL_READY) {
- status = SWITCH_STATUS_FALSE;
- goto done;
- }
-
- mrcp_message = mrcp_application_message_create(schannel->unimrcp_session, schannel->unimrcp_channel, SYNTHESIZER_SPEAK);
- if (mrcp_message == NULL) {
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_ERROR, "(%s) Failed to create SPEAK message\n", schannel->name);
- status = SWITCH_STATUS_FALSE;
- goto done;
- }
-
- /* set generic header fields (content-type) */
- if ((generic_header = (mrcp_generic_header_t *) mrcp_generic_header_prepare(mrcp_message)) == NULL) {
- status = SWITCH_STATUS_FALSE;
- goto done;
- }
-
- /* good enough way of determining SSML or plain text body */
- if (text_starts_with(text, XML_ID) || text_starts_with(text, SSML_ID)) {
- apt_string_assign(&generic_header->content_type, schannel->profile->ssml_mime_type, mrcp_message->pool);
- } else {
- apt_string_assign(&generic_header->content_type, MIME_TYPE_PLAIN_TEXT, mrcp_message->pool);
- }
- mrcp_generic_header_property_add(mrcp_message, GENERIC_HEADER_CONTENT_TYPE);
-
- /* set synthesizer header fields (voice, rate, etc.) */
- if ((synth_header = (mrcp_synth_header_t *) mrcp_resource_header_prepare(mrcp_message)) == NULL) {
- status = SWITCH_STATUS_FALSE;
- goto done;
- }
-
- /* add params to MRCP message */
- synth_channel_set_params(schannel, mrcp_message, generic_header, synth_header);
-
- /* set body (plain text or SSML) */
- apt_string_assign(&mrcp_message->body, text, schannel->memory_pool);
-
- /* Empty audio queue and send SPEAK to MRCP server */
- audio_queue_clear(schannel->audio_queue);
- if (mrcp_application_message_send(schannel->unimrcp_session, schannel->unimrcp_channel, mrcp_message) == FALSE) {
- status = SWITCH_STATUS_FALSE;
- goto done;
- }
- /* wait for IN-PROGRESS */
- while (schannel->state == SPEECH_CHANNEL_READY) {
- if (switch_thread_cond_timedwait(schannel->cond, schannel->mutex, SPEECH_CHANNEL_TIMEOUT_USEC) == SWITCH_STATUS_TIMEOUT && !warned) {
- warned = 1;
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_WARNING, "(%s) SPEAK IN-PROGRESS not received after %d ms\n", schannel->name, SPEECH_CHANNEL_TIMEOUT_USEC / (1000));
- }
- }
- if (schannel->state != SPEECH_CHANNEL_PROCESSING) {
- status = SWITCH_STATUS_FALSE;
- goto done;
- }
-
- done:
-
- switch_mutex_unlock(schannel->mutex);
- return status;
-}
-
-/**
- * Set parameters in a synthesizer MRCP header
- *
- * @param schannel the speech channel containing the params
- * @param msg the MRCP message to set
- * @param gen_hdr the generic headers to set
- * @param synth_hdr the synthesizer headers to set
- * @return SWITCH_STATUS_SUCCESS
- */
-static switch_status_t synth_channel_set_params(speech_channel_t *schannel, mrcp_message_t *msg, mrcp_generic_header_t *gen_hdr,
- mrcp_synth_header_t *synth_hdr)
-{
- /* loop through each param and add to synth header or vendor-specific-params */
- switch_hash_index_t *hi = NULL;
- for (hi = switch_core_hash_first(schannel->params); hi; hi = switch_core_hash_next(&hi)) {
- char *param_name = NULL, *param_val = NULL;
- const void *key;
- void *val;
- switch_core_hash_this(hi, &key, NULL, &val);
- param_name = (char *) key;
- param_val = (char *) val;
- if (!zstr(param_name) && !zstr(param_val)) {
- unimrcp_param_id_t *id = (unimrcp_param_id_t *) switch_core_hash_find(schannel->application->param_id_map, param_name);
- if (id) {
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) %s: %s\n", schannel->name, param_name, param_val);
- synth_channel_set_header(schannel, id->id, param_val, msg, synth_hdr);
- } else {
- apt_str_t apt_param_name = { 0 };
- apt_str_t apt_param_val = { 0 };
-
- /* this is probably a vendor-specific MRCP param */
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) (vendor-specific value) %s: %s\n", schannel->name, param_name, param_val);
- apt_string_set(&apt_param_name, param_name); /* copy isn't necessary since apt_pair_array_append will do it */
- apt_string_set(&apt_param_val, param_val);
- if (!gen_hdr->vendor_specific_params) {
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) creating vendor specific pair array\n", schannel->name);
- gen_hdr->vendor_specific_params = apt_pair_array_create(10, msg->pool);
- }
- apt_pair_array_append(gen_hdr->vendor_specific_params, &apt_param_name, &apt_param_val, msg->pool);
- }
- }
- }
-
- if (gen_hdr->vendor_specific_params) {
- mrcp_generic_header_property_add(msg, GENERIC_HEADER_VENDOR_SPECIFIC_PARAMS);
- }
-
- return SWITCH_STATUS_SUCCESS;
-}
-
-/**
- * Set parameter in a synthesizer MRCP header
- *
- * @param schannel the speech channel containing the param
- * @param id the UniMRCP header enum
- * @param val the value to set
- * @param msg the MRCP message to set
- * @param synth_hdr the synthesizer header to set
- * @return SWITCH_STATUS_SUCCESS
- */
-static switch_status_t synth_channel_set_header(speech_channel_t *schannel, int id, char *val, mrcp_message_t *msg, mrcp_synth_header_t *synth_hdr)
-{
- switch (id) {
- case SYNTHESIZER_HEADER_VOICE_GENDER:
- if (!strcasecmp("male", val)) {
- synth_hdr->voice_param.gender = VOICE_GENDER_MALE;
- } else if (!strcasecmp("female", val)) {
- synth_hdr->voice_param.gender = VOICE_GENDER_FEMALE;
- } else if (!strcasecmp("neutral", val)) {
- synth_hdr->voice_param.gender = VOICE_GENDER_NEUTRAL;
- } else {
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_WARNING, "(%s) ignoring invalid voice gender, %s\n", schannel->name, val);
- break;
- }
- mrcp_resource_header_property_add(msg, SYNTHESIZER_HEADER_VOICE_GENDER);
- break;
-
- case SYNTHESIZER_HEADER_VOICE_AGE:{
- int age = atoi(val);
- if (age > 0 && age < 1000) {
- synth_hdr->voice_param.age = age;
- mrcp_resource_header_property_add(msg, SYNTHESIZER_HEADER_VOICE_AGE);
- } else {
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_WARNING, "(%s) ignoring invalid voice age, %s\n", schannel->name, val);
- }
- break;
- }
-
- case SYNTHESIZER_HEADER_VOICE_VARIANT:{
- int variant = atoi(val);
- if (variant > 0) {
- synth_hdr->voice_param.variant = variant;
- mrcp_resource_header_property_add(msg, SYNTHESIZER_HEADER_VOICE_VARIANT);
- } else {
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_WARNING, "(%s) ignoring invalid voice variant, %s\n", schannel->name, val);
- }
- break;
- }
-
- case SYNTHESIZER_HEADER_VOICE_NAME:
- apt_string_assign(&synth_hdr->voice_param.name, val, msg->pool);
- mrcp_resource_header_property_add(msg, SYNTHESIZER_HEADER_VOICE_NAME);
- break;
-
- case SYNTHESIZER_HEADER_KILL_ON_BARGE_IN:
- synth_hdr->kill_on_barge_in = !strcasecmp("true", val);
- mrcp_resource_header_property_add(msg, SYNTHESIZER_HEADER_KILL_ON_BARGE_IN);
- break;
-
- case SYNTHESIZER_HEADER_PROSODY_VOLUME:
- if (switch_isdigit(*val) || *val == '.') {
- synth_hdr->prosody_param.volume.type = PROSODY_VOLUME_TYPE_NUMERIC;
- synth_hdr->prosody_param.volume.value.numeric = (float) atof(val);
- } else if (*val == '+' || *val == '-') {
- synth_hdr->prosody_param.volume.type = PROSODY_VOLUME_TYPE_RELATIVE_CHANGE;
- synth_hdr->prosody_param.volume.value.relative = (float) atof(val);
- } else if (!strcasecmp("silent", val)) {
- synth_hdr->prosody_param.volume.type = PROSODY_VOLUME_TYPE_LABEL;
- synth_hdr->prosody_param.volume.value.label = PROSODY_VOLUME_SILENT;
- } else if (!strcasecmp("x-soft", val)) {
- synth_hdr->prosody_param.volume.type = PROSODY_VOLUME_TYPE_LABEL;
- synth_hdr->prosody_param.volume.value.label = PROSODY_VOLUME_XSOFT;
- } else if (!strcasecmp("soft", val)) {
- synth_hdr->prosody_param.volume.type = PROSODY_VOLUME_TYPE_LABEL;
- synth_hdr->prosody_param.volume.value.label = PROSODY_VOLUME_SOFT;
- } else if (!strcasecmp("medium", val)) {
- synth_hdr->prosody_param.volume.type = PROSODY_VOLUME_TYPE_LABEL;
- synth_hdr->prosody_param.volume.value.label = PROSODY_VOLUME_MEDIUM;
- } else if (!strcasecmp("loud", val)) {
- synth_hdr->prosody_param.volume.type = PROSODY_VOLUME_TYPE_LABEL;
- synth_hdr->prosody_param.volume.value.label = PROSODY_VOLUME_LOUD;
- } else if (!strcasecmp("x-loud", val)) {
- synth_hdr->prosody_param.volume.type = PROSODY_VOLUME_TYPE_LABEL;
- synth_hdr->prosody_param.volume.value.label = PROSODY_VOLUME_XLOUD;
- } else if (!strcasecmp("default", val)) {
- synth_hdr->prosody_param.volume.type = PROSODY_VOLUME_TYPE_LABEL;
- synth_hdr->prosody_param.volume.value.label = PROSODY_VOLUME_DEFAULT;
- } else {
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_WARNING, "(%s) ignoring invalid prosody volume, %s\n", schannel->name, val);
- break;
- }
- mrcp_resource_header_property_add(msg, SYNTHESIZER_HEADER_PROSODY_VOLUME);
- break;
-
- case SYNTHESIZER_HEADER_PROSODY_RATE:
- if (switch_isdigit(*val) || *val == '.' || *val == '-') {
- synth_hdr->prosody_param.rate.type = PROSODY_RATE_TYPE_RELATIVE_CHANGE;
- synth_hdr->prosody_param.rate.value.relative = (float) atof(val);
- } else if (!strcasecmp("x-slow", val)) {
- synth_hdr->prosody_param.rate.type = PROSODY_RATE_TYPE_LABEL;
- synth_hdr->prosody_param.rate.value.label = PROSODY_RATE_XSLOW;
- } else if (!strcasecmp("slow", val)) {
- synth_hdr->prosody_param.rate.type = PROSODY_RATE_TYPE_LABEL;
- synth_hdr->prosody_param.rate.value.label = PROSODY_RATE_SLOW;
- } else if (!strcasecmp("medium", val)) {
- synth_hdr->prosody_param.rate.type = PROSODY_RATE_TYPE_LABEL;
- synth_hdr->prosody_param.rate.value.label = PROSODY_RATE_MEDIUM;
- } else if (!strcasecmp("fast", val)) {
- synth_hdr->prosody_param.rate.type = PROSODY_RATE_TYPE_LABEL;
- synth_hdr->prosody_param.rate.value.label = PROSODY_RATE_FAST;
- } else if (!strcasecmp("x-fast", val)) {
- synth_hdr->prosody_param.rate.type = PROSODY_RATE_TYPE_LABEL;
- synth_hdr->prosody_param.rate.value.label = PROSODY_RATE_XFAST;
- } else if (!strcasecmp("default", val)) {
- synth_hdr->prosody_param.rate.type = PROSODY_RATE_TYPE_LABEL;
- synth_hdr->prosody_param.rate.value.label = PROSODY_RATE_DEFAULT;
- } else {
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_WARNING, "(%s) ignoring invalid prosody rate, %s\n", schannel->name, val);
- break;
- }
- mrcp_resource_header_property_add(msg, SYNTHESIZER_HEADER_PROSODY_RATE);
- break;
-
- case SYNTHESIZER_HEADER_SPEECH_LANGUAGE:
- apt_string_assign(&synth_hdr->speech_language, val, msg->pool);
- mrcp_resource_header_property_add(msg, SYNTHESIZER_HEADER_SPEECH_LANGUAGE);
- break;
-
- /* unsupported by this module */
- case SYNTHESIZER_HEADER_JUMP_SIZE:
- case SYNTHESIZER_HEADER_SPEAKER_PROFILE:
- case SYNTHESIZER_HEADER_COMPLETION_CAUSE:
- case SYNTHESIZER_HEADER_COMPLETION_REASON:
- case SYNTHESIZER_HEADER_SPEECH_MARKER:
- case SYNTHESIZER_HEADER_FETCH_HINT:
- case SYNTHESIZER_HEADER_AUDIO_FETCH_HINT:
- case SYNTHESIZER_HEADER_FAILED_URI:
- case SYNTHESIZER_HEADER_FAILED_URI_CAUSE:
- case SYNTHESIZER_HEADER_SPEAK_RESTART:
- case SYNTHESIZER_HEADER_SPEAK_LENGTH:
- case SYNTHESIZER_HEADER_LOAD_LEXICON:
- case SYNTHESIZER_HEADER_LEXICON_SEARCH_ORDER:
- default:
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_ERROR, "(%s) unsupported SYNTHESIZER_HEADER type\n", schannel->name);
- }
-
- return SWITCH_STATUS_SUCCESS;
-}
-
-/**
- * Stop SPEAK/RECOGNIZE request on speech channel
- *
- * @param schannel the channel
- * @return SWITCH_STATUS_SUCCESS if successful
- */
-static switch_status_t speech_channel_stop(speech_channel_t *schannel)
-{
- switch_status_t status = SWITCH_STATUS_SUCCESS;
- int warned = 0;
- switch_mutex_lock(schannel->mutex);
-
- if (schannel->state == SPEECH_CHANNEL_PROCESSING) {
- mrcp_method_id method;
- mrcp_message_t *mrcp_message;
- if (schannel->type == SPEECH_CHANNEL_SYNTHESIZER) {
- method = SYNTHESIZER_STOP;
- } else {
- method = RECOGNIZER_STOP;
- }
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) Stopping %s\n", schannel->name, speech_channel_type_to_string(schannel->type));
- /* Send STOP to MRCP server */
- mrcp_message = mrcp_application_message_create(schannel->unimrcp_session, schannel->unimrcp_channel, method);
- if (mrcp_message == NULL) {
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_ERROR, "(%s) Failed to create STOP message\n", schannel->name);
- status = SWITCH_STATUS_FALSE;
- goto done;
- }
- mrcp_application_message_send(schannel->unimrcp_session, schannel->unimrcp_channel, mrcp_message);
- while (schannel->state == SPEECH_CHANNEL_PROCESSING) {
- if (switch_thread_cond_timedwait(schannel->cond, schannel->mutex, SPEECH_CHANNEL_TIMEOUT_USEC) == SWITCH_STATUS_TIMEOUT && !warned) {
- warned = 1;
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_ERROR, "(%s) STOP has not COMPLETED after %d ms.\n", schannel->name, SPEECH_CHANNEL_TIMEOUT_USEC / (1000));
- }
- }
-
- if (schannel->state == SPEECH_CHANNEL_ERROR) {
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_ERROR, "(%s) Channel error\n", schannel->name);
- schannel->state = SPEECH_CHANNEL_ERROR;
- status = SWITCH_STATUS_FALSE;
- goto done;
- }
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) %s stopped\n", schannel->name, speech_channel_type_to_string(schannel->type));
- } else if (schannel->state == SPEECH_CHANNEL_DONE) {
- speech_channel_set_state_unlocked(schannel, SPEECH_CHANNEL_READY);
- }
-
- done:
-
- switch_mutex_unlock(schannel->mutex);
- return status;
-}
-
-/**
- * Convert speech channel type into a string
- *
- * @param type the speech channel type
- * @return the speech channel type as a string
- */
-static const char *speech_channel_type_to_string(speech_channel_type_t type)
-{
- switch (type) {
- case SPEECH_CHANNEL_SYNTHESIZER:
- return "SYNTHESIZER";
- case SPEECH_CHANNEL_RECOGNIZER:
- return "RECOGNIZER";
- }
-
- return "UNKNOWN";
-}
-
-/**
- * Set parameter
- *
- * @param schannel the speech channel
- * @param param the parameter to set
- * @param val the parameter value
- * @return SWITCH_STATUS_SUCCESS if successful
- */
-static switch_status_t speech_channel_set_param(speech_channel_t *schannel, const char *param, const char *val)
-{
- switch_mutex_lock(schannel->mutex);
- if (!zstr(param) && val != NULL) {
- /* check if this is a FreeSWITCH param that needs to be translated to an MRCP param: e.g. voice ==> voice-name */
- const char *v;
- const char *p = switch_core_hash_find(schannel->application->fs_param_map, param);
- if (!p) {
- p = switch_core_strdup(schannel->memory_pool, param);
- }
- v = switch_core_strdup(schannel->memory_pool, val);
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) param = %s, val = %s\n", schannel->name, p, v);
- switch_core_hash_insert(schannel->params, p, v);
- }
- switch_mutex_unlock(schannel->mutex);
- return SWITCH_STATUS_SUCCESS;
-}
-
-/**
- * Write synthesized speech / speech to be recognized
- *
- * @param schannel the speech channel
- * @param data the speech data
- * @param the number of octets to write / actual number written
- * @return SWITCH_STATUS_SUCCESS
- */
-static switch_status_t speech_channel_write(speech_channel_t *schannel, void *data, switch_size_t *len)
-{
- if (!schannel || !schannel->mutex || !schannel->audio_queue) {
- return SWITCH_STATUS_FALSE;
- }
-
- if (schannel->state == SPEECH_CHANNEL_PROCESSING) {
- audio_queue_write(schannel->audio_queue, data, len);
- }
-
- return SWITCH_STATUS_SUCCESS;
-}
-
-/**
- * Read synthesized speech / speech to be recognized
- *
- * @param schannel the speech channel
- * @param data the speech data
- * @param the number of octets to read / actual number read
- * @param block 1 if blocking is allowed
- * @return SWITCH_STATUS_SUCCESS if successful, SWITCH_STATUS_BREAK if channel is no longer processing
- */
-static switch_status_t speech_channel_read(speech_channel_t *schannel, void *data, switch_size_t *len, int block)
-{
- switch_status_t status = SWITCH_STATUS_SUCCESS;
-
- if (!schannel || !schannel->mutex || !schannel->audio_queue) {
- return SWITCH_STATUS_FALSE;
- }
-
- switch (schannel->state) {
- case SPEECH_CHANNEL_DONE:
- /* pull any remaining audio - never blocking */
- if (audio_queue_read(schannel->audio_queue, data, len, 0) == SWITCH_STATUS_FALSE) {
- /* all frames read */
- status = SWITCH_STATUS_BREAK;
- }
- break;
- case SPEECH_CHANNEL_PROCESSING:
- /* IN-PROGRESS */
- audio_queue_read(schannel->audio_queue, data, len, block);
- break;
- default:
- status = SWITCH_STATUS_BREAK;
- }
-
- return status;
-}
-
-/**
- * Convert channel state to string
- *
- * @param state the channel state
- * @return string representation of the state
- */
-static const char *speech_channel_state_to_string(speech_channel_state_t state)
-{
- switch (state) {
- case SPEECH_CHANNEL_CLOSED:
- return "CLOSED";
- case SPEECH_CHANNEL_READY:
- return "READY";
- case SPEECH_CHANNEL_PROCESSING:
- return "PROCESSING";
- case SPEECH_CHANNEL_DONE:
- return "DONE";
- case SPEECH_CHANNEL_ERROR:
- return "ERROR";
- }
-
- return "UNKNOWN";
-}
-
-/**
- * Set the current channel state
- *
- * @param schannel the channel
- * @param state the new channel state
- * @return SWITCH_STATUS_SUCCESS, if successful
- */
-static switch_status_t speech_channel_set_state(speech_channel_t *schannel, speech_channel_state_t state)
-{
- switch_status_t status;
- switch_mutex_lock(schannel->mutex);
- status = speech_channel_set_state_unlocked(schannel, state);
- switch_mutex_unlock(schannel->mutex);
- return status;
-}
-
-/**
- * Use this function to set the current channel state without locking the
- * speech channel. Do this if you already have the speech channel locked.
- *
- * @param schannel the channel
- * @param state the new channel state
- * @return SWITCH_STATUS_SUCCESS
- */
-static switch_status_t speech_channel_set_state_unlocked(speech_channel_t *schannel, speech_channel_state_t state)
-{
- if (schannel->state == SPEECH_CHANNEL_PROCESSING && state != SPEECH_CHANNEL_PROCESSING) {
- /* wake anyone waiting for audio data */
- audio_queue_signal(schannel->audio_queue);
- }
-
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) %s ==> %s\n", schannel->name, speech_channel_state_to_string(schannel->state),
- speech_channel_state_to_string(state));
- schannel->state = state;
- switch_thread_cond_signal(schannel->cond);
- return SWITCH_STATUS_SUCCESS;
-}
-
-/**
- * Process speech_open request from FreeSWITCH. This is expected to be called before every tts request made
- * with synth_speech_feed_tts(), though the FreeSWITCH code has the option to cache the speech handle between
- * TTS requests.
- *
- * @param sh the FreeSWITCH speech handle
- * @param voice_name the voice to use
- * @param rate the sampling rate requested
- * @param channels the number of channels requested
- * @param flags other options
- * @return SWITCH_STATUS_SUCCESS if successful, otherwise SWITCH_STATUS_FALSE
- */
-static switch_status_t synth_speech_open(switch_speech_handle_t *sh, const char *voice_name, int rate, int channels, switch_speech_flag_t *flags)
-{
- switch_status_t status = SWITCH_STATUS_SUCCESS;
- speech_channel_t *schannel = NULL;
- const char *profile_name = sh->param;
- profile_t *profile = NULL;
- int speech_channel_number = get_next_speech_channel_number();
- char *name = NULL;
- char *session_uuid = NULL;
- switch_hash_index_t *hi = NULL;
-
- /* Name the channel */
- if (profile_name && strchr(profile_name, ':')) {
- /* Profile has session name appended to it. Pick it out */
- profile_name = switch_core_strdup(sh->memory_pool, profile_name);
- session_uuid = strchr(profile_name, ':');
- *session_uuid = '\0';
- session_uuid++;
- session_uuid = switch_core_strdup(sh->memory_pool, session_uuid);
- } else {
- /* check if session is associated w/ this memory pool */
- switch_core_session_t *session = switch_core_memory_pool_get_data(sh->memory_pool, "__session");
- if (session) {
- session_uuid = switch_core_session_get_uuid(session);
- }
- }
- name = switch_core_sprintf(sh->memory_pool, "TTS-%d", speech_channel_number);
-
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(session_uuid), SWITCH_LOG_INFO,
- "speech_handle: name = %s, rate = %d, speed = %d, samples = %d, voice = %s, engine = %s, param = %s\n", sh->name, sh->rate,
- sh->speed, sh->samples, sh->voice, sh->engine, sh->param);
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(session_uuid), SWITCH_LOG_INFO, "voice = %s, rate = %d\n", voice_name, rate);
-
- /* Allocate the channel */
- if (speech_channel_create(&schannel, name, session_uuid, SPEECH_CHANNEL_SYNTHESIZER, &globals.synth, (uint16_t) rate, sh->memory_pool) != SWITCH_STATUS_SUCCESS) {
- status = SWITCH_STATUS_FALSE;
- goto done;
- }
- sh->private_info = schannel;
- schannel->fsh = sh;
-
- /* Open the channel */
- if (zstr(profile_name)) {
- profile_name = globals.unimrcp_default_synth_profile;
- }
- profile = (profile_t *) switch_core_hash_find(globals.profiles, profile_name);
- if (!profile) {
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(session_uuid), SWITCH_LOG_ERROR, "(%s) Can't find profile, %s\n", name, profile_name);
- status = SWITCH_STATUS_FALSE;
- goto done;
- }
- if ((status = speech_channel_open(schannel, profile)) != SWITCH_STATUS_SUCCESS) {
- goto done;
- }
-
- /* Set session TTS params */
- if (!zstr(voice_name)) {
- speech_channel_set_param(schannel, "Voice-Name", voice_name);
- }
-
- /* Set default TTS params */
- for (hi = switch_core_hash_first(profile->default_synth_params); hi; hi = switch_core_hash_next(&hi)) {
- char *param_name = NULL, *param_val = NULL;
- const void *key;
- void *val;
- switch_core_hash_this(hi, &key, NULL, &val);
- param_name = (char *) key;
- param_val = (char *) val;
- speech_channel_set_param(schannel, param_name, param_val);
- }
-
- done:
-
- return status;
-}
-
-/**
- * Process speech_close request from FreeSWITCH. This is called after the TTS request has completed
- * and FreeSWITCH does not wish to cache the speech handle for another request.
- *
- * @param sh the FreeSWITCH speech handle
- * @param flags other options
- * @return SWITCH_STATUS_SUCCESS
- */
-static switch_status_t synth_speech_close(switch_speech_handle_t *sh, switch_speech_flag_t *flags)
-{
- speech_channel_t *schannel = (speech_channel_t *) sh->private_info;
- speech_channel_stop(schannel);
- speech_channel_destroy(schannel);
- return SWITCH_STATUS_SUCCESS;
-}
-
-/**
- * Process feed_tts request from FreeSWITCH. This is called by FreeSWITCH after speech_open.
- * Send SPEAK request to MRCP server.
- *
- * @param sh the FreeSWITCH speech handle
- * @param text the text to speak. This could be plain text, ssml, vxml, etc... this function will figure it out.
- * @param flags other options
- * @return SWITCH_STATUS_SUCCESS if TTS started successfully, SWITCH_STATUS_FALSE otherwise.
- */
-static switch_status_t synth_speech_feed_tts(switch_speech_handle_t *sh, char *text, switch_speech_flag_t *flags)
-{
- switch_status_t status = SWITCH_STATUS_SUCCESS;
- speech_channel_t *schannel = (speech_channel_t *) sh->private_info;
-
- if (zstr(text)) {
- status = SWITCH_STATUS_FALSE;
- } else {
- status = synth_channel_speak(schannel, text);
- }
- return status;
-}
-
-/**
- * Process read_tts request from FreeSWITCH. FreeSWITCH is expecting L16 host byte ordered data. We must return
- * exactly what is requested, otherwise FreeSWITCH won't play any audio. Pad the data with silence, if necessary.
- *
- * @param sh the FreeSWITCH speech handle
- * @param data the read data
- * @param datalen the amount of data requested / amount of data read
- * @param flags other options
- * @return SWITCH_STATUS_SUCCESS if data was read, SWITCH_STATUS_BREAK if TTS is done
- */
-static switch_status_t synth_speech_read_tts(switch_speech_handle_t *sh, void *data, switch_size_t *datalen, switch_speech_flag_t *flags)
-{
- switch_status_t status = SWITCH_STATUS_SUCCESS;
- switch_size_t bytes_read;
- speech_channel_t *schannel = (speech_channel_t *) sh->private_info;
- bytes_read = *datalen;
- if (speech_channel_read(schannel, data, &bytes_read, (*flags & SWITCH_SPEECH_FLAG_BLOCKING)) == SWITCH_STATUS_SUCCESS) {
- /* pad data, if not enough read */
- if (bytes_read < *datalen) {
-#ifdef MOD_UNIMRCP_DEBUG_AUDIO_QUEUE
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) adding %ld bytes of padding\n", schannel->name, *datalen - bytes_read);
-#endif
- memset((uint8_t *) data + bytes_read, schannel->silence, *datalen - bytes_read);
- }
- } else {
- /* ready for next speak request */
- speech_channel_set_state(schannel, SPEECH_CHANNEL_READY);
- *datalen = 0;
- status = SWITCH_STATUS_BREAK;
- }
-
- /* report negotiated sample rate back to FreeSWITCH */
- sh->native_rate = schannel->rate;
-
- return status;
-}
-
-/**
- * Process flush_tts request from FreeSWITCH. Interrupt current TTS request with STOP.
- * This method is called by FreeSWITCH after a TTS request has finished, or if a request needs to be interrupted.
- *
- * @param sh the FreeSWITCH speech handle
- */
-static void synth_speech_flush_tts(switch_speech_handle_t *sh)
-{
- speech_channel_t *schannel = (speech_channel_t *) sh->private_info;
- speech_channel_stop(schannel);
-}
-
-/**
- * Process text_param_tts request from FreeSWITCH.
- * Update MRCP session text parameters.
- *
- * @param sh the FreeSWITCH speech handle
- * @param param the parameter to set
- * @param val the value to set the parameter to
- */
-static void synth_speech_text_param_tts(switch_speech_handle_t *sh, char *param, const char *val)
-{
- speech_channel_t *schannel = (speech_channel_t *) sh->private_info;
- speech_channel_set_param(schannel, param, val);
-}
-
-/**
- * Process numeric_param_tts request from FreeSWITCH.
- * Update MRCP session numeric parameters
- *
- * @param sh the FreeSWITCH speech handle
- * @param param the parameter to set
- * @param val the value to set the parameter to
- */
-static void synth_speech_numeric_param_tts(switch_speech_handle_t *sh, char *param, int val)
-{
- speech_channel_t *schannel = (speech_channel_t *) sh->private_info;
- char *val_str = switch_mprintf("%d", val);
- speech_channel_set_param(schannel, param, val_str);
- switch_safe_free(val_str);
-}
-
-/**
- * Process float_param_tts request from FreeSWITCH.
- * Update MRCP session float parameters
- *
- * @param sh the FreeSWITCH speech handle
- * @param param the parameter to set
- * @param val the value to set the parameter to
- */
-static void synth_speech_float_param_tts(switch_speech_handle_t *sh, char *param, double val)
-{
- speech_channel_t *schannel = (speech_channel_t *) sh->private_info;
- char *val_str = switch_mprintf("%f", val);
- speech_channel_set_param(schannel, param, val_str);
- switch_safe_free(val_str);
-}
-
-/**
- * Process UniMRCP messages for the synthesizer application. All MRCP synthesizer callbacks start here first.
- *
- * @param app_message the application message
- */
-static apt_bool_t synth_message_handler(const mrcp_app_message_t *app_message)
-{
- /* call the appropriate callback in the dispatcher function table based on the app_message received */
- return mrcp_application_message_dispatch(&globals.synth.dispatcher, app_message);
-}
-
-/**
- * Handle the UniMRCP responses sent to session terminate requests
- *
- * @param application the MRCP application
- * @param session the MRCP session
- * @param status the result of the session terminate request
- * @return TRUE
- */
-static apt_bool_t speech_on_session_terminate(mrcp_application_t *application, mrcp_session_t *session, mrcp_sig_status_code_e status)
-{
- speech_channel_t *schannel = (speech_channel_t *) mrcp_application_session_object_get(session);
- switch_event_t *event = NULL;
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) Destroying MRCP session\n", schannel->name);
- mrcp_application_session_destroy(session);
-
- /* notify of channel close */
- if (schannel->channel_opened && globals.enable_profile_events) {
- switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, MY_EVENT_PROFILE_CLOSE);
- if (event) {
- switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "MRCP-Profile", schannel->profile->name);
- if (schannel->type == SPEECH_CHANNEL_SYNTHESIZER) {
- switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "MRCP-Resource-Type", "TTS");
- } else {
- switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "MRCP-Resource-Type", "ASR");
- }
- switch_event_fire(&event);
- }
- }
- speech_channel_set_state(schannel, SPEECH_CHANNEL_CLOSED);
-
- return TRUE;
-}
-
-/**
- * Handle the UniMRCP responses sent to channel add requests
- *
- * @param application the MRCP application
- * @param session the MRCP session
- * @param channel the MRCP channel
- * @param status the result of the channel add request
- * @return TRUE
- */
-static apt_bool_t speech_on_channel_add(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel,
- mrcp_sig_status_code_e status)
-{
- switch_event_t *event = NULL;
- speech_channel_t *schannel = (speech_channel_t *) mrcp_application_channel_object_get(channel);
- char codec_name[60] = { 0 };
- const mpf_codec_descriptor_t *descriptor;
-
- /* check status */
- if (!session || !schannel || status != MRCP_SIG_STATUS_CODE_SUCCESS) {
- goto error;
- }
-
- /* what sample rate did we negotiate? */
- if (schannel->type == SPEECH_CHANNEL_SYNTHESIZER) {
- descriptor = mrcp_application_sink_descriptor_get(channel);
- } else {
- descriptor = mrcp_application_source_descriptor_get(channel);
- }
- if (!descriptor) {
- goto error;
- }
-
- schannel->rate = descriptor->sampling_rate;
-
- /* report negotiated sample rate back to FreeSWITCH */
- if (schannel->type == SPEECH_CHANNEL_SYNTHESIZER) {
- ((switch_speech_handle_t*)schannel->fsh)->native_rate = schannel->rate;
- } else {
- ((switch_asr_handle_t*)schannel->fsh)->native_rate = schannel->rate;
- }
-
- if (descriptor->name.length) {
- strncpy(codec_name, descriptor->name.buf, sizeof(codec_name) - 1 );
- }
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) %s channel is ready, codec = %s, sample rate = %d\n", schannel->name,
- speech_channel_type_to_string(schannel->type), codec_name, schannel->rate);
- speech_channel_set_state(schannel, SPEECH_CHANNEL_READY);
-
- /* notify of channel open */
- if (globals.enable_profile_events && switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, MY_EVENT_PROFILE_OPEN) == SWITCH_STATUS_SUCCESS) {
- switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "MRCP-Profile", schannel->profile->name);
- if (schannel->type == SPEECH_CHANNEL_SYNTHESIZER) {
- switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "MRCP-Resource-Type", "TTS");
- } else {
- switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "MRCP-Resource-Type", "ASR");
- }
- switch_event_fire(&event);
- }
- schannel->channel_opened = 1;
-
- return TRUE;
-
-error:
- if (schannel) {
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_ERROR, "(%s) %s channel error!\n", schannel->name,
- speech_channel_type_to_string(schannel->type));
- speech_channel_set_state(schannel, SPEECH_CHANNEL_ERROR);
- } else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "(unknown) channel error!\n");
- }
-
- return TRUE;
-}
-
-
-/**
- * Handle the UniMRCP responses sent to channel remove requests
- *
- * @param application the MRCP application
- * @param session the MRCP session
- * @param channel the MRCP channel
- * @param status the result of the channel remove request
- * @return TRUE
- */
-static apt_bool_t speech_on_channel_remove(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel,
- mrcp_sig_status_code_e status)
-{
- speech_channel_t *schannel = (speech_channel_t *) mrcp_application_channel_object_get(channel);
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_INFO, "(%s) %s channel is removed\n", schannel->name, speech_channel_type_to_string(schannel->type));
- schannel->unimrcp_channel = NULL;
-
- if (session) {
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) Terminating MRCP session\n", schannel->name);
- mrcp_application_session_terminate(session);
- }
-
- return TRUE;
-}
-
-/**
- * Handle the MRCP synthesizer responses/events from UniMRCP
- *
- * @param application the MRCP application
- * @param session the MRCP session
- * @param channel the MRCP channel
- * @param message the MRCP message
- * @return TRUE
- */
-static apt_bool_t synth_on_message_receive(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_message_t *message)
-{
- speech_channel_t *schannel = (speech_channel_t *) mrcp_application_channel_object_get(channel);
- if (message->start_line.message_type == MRCP_MESSAGE_TYPE_RESPONSE) {
- /* received MRCP response */
- if (message->start_line.method_id == SYNTHESIZER_SPEAK) {
- /* received the response to SPEAK request */
- if (message->start_line.request_state == MRCP_REQUEST_STATE_INPROGRESS) {
- /* waiting for SPEAK-COMPLETE event */
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) REQUEST IN PROGRESS\n", schannel->name);
- speech_channel_set_state(schannel, SPEECH_CHANNEL_PROCESSING);
- } else {
- /* received unexpected request_state */
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) unexpected SPEAK response, request_state = %d\n", schannel->name,
- message->start_line.request_state);
- speech_channel_set_state(schannel, SPEECH_CHANNEL_ERROR);
- }
- } else if (message->start_line.method_id == SYNTHESIZER_STOP) {
- /* received response to the STOP request */
- if (message->start_line.request_state == MRCP_REQUEST_STATE_COMPLETE) {
- /* got COMPLETE */
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) COMPLETE\n", schannel->name);
- speech_channel_set_state(schannel, SPEECH_CHANNEL_DONE);
- } else {
- /* received unexpected request state */
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) unexpected STOP response, request_state = %d\n", schannel->name,
- message->start_line.request_state);
- speech_channel_set_state(schannel, SPEECH_CHANNEL_ERROR);
- }
- } else {
- /* received unexpected response */
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) unexpected response, method_id = %d\n", schannel->name,
- (int) message->start_line.method_id);
- speech_channel_set_state(schannel, SPEECH_CHANNEL_ERROR);
- }
- } else if (message->start_line.message_type == MRCP_MESSAGE_TYPE_EVENT) {
- /* received MRCP event */
- if (message->start_line.method_id == SYNTHESIZER_SPEAK_COMPLETE) {
- /* got SPEAK-COMPLETE */
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) SPEAK-COMPLETE\n", schannel->name);
- speech_channel_set_state(schannel, SPEECH_CHANNEL_DONE);
- } else {
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) unexpected event, method_id = %d\n", schannel->name,
- (int) message->start_line.method_id);
- speech_channel_set_state(schannel, SPEECH_CHANNEL_ERROR);
- }
- } else {
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) unexpected message type, message_type = %d\n", schannel->name,
- message->start_line.message_type);
- speech_channel_set_state(schannel, SPEECH_CHANNEL_ERROR);
- }
-
- return TRUE;
-}
-
-/**
- * Incoming TTS data from UniMRCP
- *
- * @param stream the audio stream sending data
- * @param frame the data
- * @return TRUE
- */
-static apt_bool_t synth_stream_write(mpf_audio_stream_t *stream, const mpf_frame_t *frame)
-{
- switch_size_t size = frame->codec_frame.size;
- speech_channel_t *schannel = (speech_channel_t *) stream->obj;
- speech_channel_write(schannel, frame->codec_frame.buffer, &size);
- return TRUE;
-}
-
-/**
- * Link the synthesizer module interface to FreeSWITCH and UniMRCP
- *
- * @param module_interface mod_unimrcp's interface
- * @param pool the memory pool to use for all allocations
- * @return SWITCH_STATUS_SUCCESS if successful, SWITCH_STATUS_FALSE otherwise
- */
-static switch_status_t synth_load(switch_loadable_module_interface_t *module_interface, switch_memory_pool_t *pool)
-{
- /* link to FreeSWITCH ASR / TTS callbacks */
- switch_speech_interface_t *speech_interface = NULL;
- if ((speech_interface = (switch_speech_interface_t *) switch_loadable_module_create_interface(module_interface, SWITCH_SPEECH_INTERFACE)) == NULL) {
- return SWITCH_STATUS_FALSE;
- }
- speech_interface->interface_name = MOD_UNIMRCP;
- speech_interface->speech_open = synth_speech_open;
- speech_interface->speech_close = synth_speech_close;
- speech_interface->speech_feed_tts = synth_speech_feed_tts;
- speech_interface->speech_read_tts = synth_speech_read_tts;
- speech_interface->speech_flush_tts = synth_speech_flush_tts;
- speech_interface->speech_text_param_tts = synth_speech_text_param_tts;
- speech_interface->speech_numeric_param_tts = synth_speech_numeric_param_tts;
- speech_interface->speech_float_param_tts = synth_speech_float_param_tts;
-
- /* Create the synthesizer application and link its callbacks to UniMRCP */
- if ((globals.synth.app = mrcp_application_create(synth_message_handler, (void *) 0, pool)) == NULL) {
- return SWITCH_STATUS_FALSE;
- }
- globals.synth.dispatcher.on_session_update = NULL;
- globals.synth.dispatcher.on_session_terminate = speech_on_session_terminate;
- globals.synth.dispatcher.on_channel_add = speech_on_channel_add;
- globals.synth.dispatcher.on_channel_remove = speech_on_channel_remove;
- globals.synth.dispatcher.on_message_receive = synth_on_message_receive;
- globals.synth.audio_stream_vtable.destroy = NULL;
- globals.synth.audio_stream_vtable.open_rx = NULL;
- globals.synth.audio_stream_vtable.close_rx = NULL;
- globals.synth.audio_stream_vtable.read_frame = NULL;
- globals.synth.audio_stream_vtable.open_tx = NULL;
- globals.synth.audio_stream_vtable.close_tx = NULL;
- globals.synth.audio_stream_vtable.write_frame = synth_stream_write;
- mrcp_client_application_register(globals.mrcp_client, globals.synth.app, "synth");
-
- /* map FreeSWITCH params to MRCP param */
- switch_core_hash_init_nocase(&globals.synth.fs_param_map);
- switch_core_hash_insert(globals.synth.fs_param_map, "voice", "voice-name");
-
- /* map MRCP params to UniMRCP ID */
- switch_core_hash_init_nocase(&globals.synth.param_id_map);
- switch_core_hash_insert(globals.synth.param_id_map, "jump-size", unimrcp_param_id_create(SYNTHESIZER_HEADER_JUMP_SIZE, pool));
- switch_core_hash_insert(globals.synth.param_id_map, "kill-on-barge-in", unimrcp_param_id_create(SYNTHESIZER_HEADER_KILL_ON_BARGE_IN, pool));
- switch_core_hash_insert(globals.synth.param_id_map, "speaker-profile", unimrcp_param_id_create(SYNTHESIZER_HEADER_SPEAKER_PROFILE, pool));
- switch_core_hash_insert(globals.synth.param_id_map, "completion-cause", unimrcp_param_id_create(SYNTHESIZER_HEADER_COMPLETION_CAUSE, pool));
- switch_core_hash_insert(globals.synth.param_id_map, "completion-reason", unimrcp_param_id_create(SYNTHESIZER_HEADER_COMPLETION_REASON, pool));
- switch_core_hash_insert(globals.synth.param_id_map, "voice-gender", unimrcp_param_id_create(SYNTHESIZER_HEADER_VOICE_GENDER, pool));
- switch_core_hash_insert(globals.synth.param_id_map, "voice-age", unimrcp_param_id_create(SYNTHESIZER_HEADER_VOICE_AGE, pool));
- switch_core_hash_insert(globals.synth.param_id_map, "voice-variant", unimrcp_param_id_create(SYNTHESIZER_HEADER_VOICE_VARIANT, pool));
- switch_core_hash_insert(globals.synth.param_id_map, "voice-name", unimrcp_param_id_create(SYNTHESIZER_HEADER_VOICE_NAME, pool));
- switch_core_hash_insert(globals.synth.param_id_map, "prosody-volume", unimrcp_param_id_create(SYNTHESIZER_HEADER_PROSODY_VOLUME, pool));
- switch_core_hash_insert(globals.synth.param_id_map, "prosody-rate", unimrcp_param_id_create(SYNTHESIZER_HEADER_PROSODY_RATE, pool));
- switch_core_hash_insert(globals.synth.param_id_map, "speech-marker", unimrcp_param_id_create(SYNTHESIZER_HEADER_SPEECH_MARKER, pool));
- switch_core_hash_insert(globals.synth.param_id_map, "speech-language", unimrcp_param_id_create(SYNTHESIZER_HEADER_SPEECH_LANGUAGE, pool));
- switch_core_hash_insert(globals.synth.param_id_map, "fetch-hint", unimrcp_param_id_create(SYNTHESIZER_HEADER_FETCH_HINT, pool));
- switch_core_hash_insert(globals.synth.param_id_map, "audio-fetch-hint", unimrcp_param_id_create(SYNTHESIZER_HEADER_AUDIO_FETCH_HINT, pool));
- switch_core_hash_insert(globals.synth.param_id_map, "failed-uri", unimrcp_param_id_create(SYNTHESIZER_HEADER_FAILED_URI, pool));
- switch_core_hash_insert(globals.synth.param_id_map, "failed-uri-cause", unimrcp_param_id_create(SYNTHESIZER_HEADER_FAILED_URI_CAUSE, pool));
- switch_core_hash_insert(globals.synth.param_id_map, "speak-restart", unimrcp_param_id_create(SYNTHESIZER_HEADER_SPEAK_RESTART, pool));
- switch_core_hash_insert(globals.synth.param_id_map, "speak-length", unimrcp_param_id_create(SYNTHESIZER_HEADER_SPEAK_LENGTH, pool));
- switch_core_hash_insert(globals.synth.param_id_map, "load-lexicon", unimrcp_param_id_create(SYNTHESIZER_HEADER_LOAD_LEXICON, pool));
- switch_core_hash_insert(globals.synth.param_id_map, "lexicon-search-order", unimrcp_param_id_create(SYNTHESIZER_HEADER_LEXICON_SEARCH_ORDER, pool));
-
- return SWITCH_STATUS_SUCCESS;
-}
-
-/**
- * Shut down the synthesizer
- *
- * @return SWITCH_STATUS_SUCCESS
- */
-static switch_status_t synth_shutdown()
-{
- if (globals.synth.fs_param_map) {
- switch_core_hash_destroy(&globals.synth.fs_param_map);
- }
- if (globals.synth.param_id_map) {
- switch_core_hash_destroy(&globals.synth.param_id_map);
- }
- return SWITCH_STATUS_SUCCESS;
-}
-
-/**
- * Create a grammar object to reference in recognition requests
- *
- * @param grammar the grammar
- * @param name the name of the grammar
- * @param type the type of the grammar (URI, SRGS, or GSL)
- * @param data the grammar data (or URI)
- * @param pool memory pool to allocate from
- * @return SWITCH_STATUS_SUCCESS if successful
- */
-static switch_status_t grammar_create(grammar_t ** grammar, const char *name, grammar_type_t type, const char *data, switch_memory_pool_t *pool)
-{
- switch_status_t status = SWITCH_STATUS_SUCCESS;
- grammar_t *g = (grammar_t *) switch_core_alloc(pool, sizeof(grammar_t));
- if (g == NULL) {
- status = SWITCH_STATUS_FALSE;
- *grammar = NULL;
- } else {
- g->name = switch_core_strdup(pool, name);
- g->type = type;
- g->data = switch_core_strdup(pool, data);
- *grammar = g;
- }
-
- return status;
-}
-
-/**
- * Get the MIME type for this grammar type
- * @param type the grammar type
- * @param profile the profile requesting the type
- * @return the MIME type
- */
-static const char *grammar_type_to_mime(grammar_type_t type, profile_t *profile)
-{
- switch (type) {
- case GRAMMAR_TYPE_UNKNOWN:
- return "";
- case GRAMMAR_TYPE_URI:
- return "text/uri-list";
- case GRAMMAR_TYPE_SRGS:
- return profile->srgs_mime_type;
- case GRAMMAR_TYPE_SRGS_XML:
- return profile->srgs_xml_mime_type;
- case GRAMMAR_TYPE_NUANCE_GSL:
- return profile->gsl_mime_type;
- case GRAMMAR_TYPE_JSGF:
- return profile->jsgf_mime_type;
- case GRAMMAR_TYPE_XML:
- return profile->xml_mime_type;
- }
- return "";
-}
-
-/**
- * Start RECOGNIZE request
- *
- * @param schannel the channel to start
- * @return SWITCH_STATUS_SUCCESS if successful
- */
-static switch_status_t recog_channel_start(speech_channel_t *schannel)
-{
- switch_status_t status = SWITCH_STATUS_SUCCESS;
- switch_hash_index_t *egk;
- mrcp_message_t *mrcp_message;
- mrcp_recog_header_t *recog_header;
- mrcp_generic_header_t *generic_header;
- recognizer_data_t *r;
- char *start_input_timers;
- const char *mime_type;
- char *key = NULL;
- switch_size_t len;
- grammar_t *grammar = NULL;
- switch_size_t grammar_uri_count = 0;
- switch_size_t grammar_uri_list_len = 0;
- char *grammar_uri_list = NULL;
- int warned = 0;
-
- switch_mutex_lock(schannel->mutex);
- if (schannel->state != SPEECH_CHANNEL_READY) {
- status = SWITCH_STATUS_FALSE;
- goto done;
- }
-
- if (schannel->data == NULL) {
- status = SWITCH_STATUS_FALSE;
- goto done;
- }
- r = (recognizer_data_t *) schannel->data;
- r->result = NULL;
- if (r->result_headers) {
- switch_event_destroy(&r->result_headers);
- }
- r->start_of_input = 0;
-
- /* input timers are started by default unless the start-input-timers=false param is set */
- start_input_timers = (char *) switch_core_hash_find(schannel->params, "start-input-timers");
- r->timers_started = zstr(start_input_timers) || strcasecmp(start_input_timers, "false");
-
- /* count enabled grammars */
- for (egk = switch_core_hash_first(r->enabled_grammars); egk; egk = switch_core_hash_next(&egk)) {
- // NOTE: This postponed type check is necessary to allow a non-URI-list grammar to execute alone
- if (grammar_uri_count == 1 && grammar->type != GRAMMAR_TYPE_URI)
- goto no_grammar_alone;
- ++grammar_uri_count;
- switch_core_hash_this(egk, (void *) &key, NULL, (void *) &grammar);
- if (grammar->type != GRAMMAR_TYPE_URI && grammar_uri_count != 1) {
- no_grammar_alone:
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_ERROR, "(%s) Grammar '%s' can only be used alone (not a URI list)\n", schannel->name, key);
- status = SWITCH_STATUS_FALSE;
- switch_safe_free(egk);
- goto done;
- }
- len = strlen(grammar->data);
- if (!len)
- continue;
- grammar_uri_list_len += len;
- if (grammar->data[len - 1] != '\n')
- grammar_uri_list_len += 2;
- }
-
- switch (grammar_uri_count) {
- case 0:
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_ERROR, "(%s) No grammar specified\n", schannel->name);
- status = SWITCH_STATUS_FALSE;
- goto done;
- case 1:
- /* grammar should already be the unique grammar */
- break;
- default:
- /* get the enabled grammars list */
- grammar_uri_list = switch_core_alloc(schannel->memory_pool, grammar_uri_list_len + 1);
- grammar_uri_list_len = 0;
- for (egk = switch_core_hash_first(r->enabled_grammars); egk; egk = switch_core_hash_next(&egk)) {
- switch_core_hash_this(egk, (void *) &key, NULL, (void *) &grammar);
- len = strlen(grammar->data);
- if (!len)
- continue;
- memcpy(&(grammar_uri_list[grammar_uri_list_len]), grammar->data, len);
- grammar_uri_list_len += len;
- if (grammar_uri_list[grammar_uri_list_len - 1] != '\n')
- {
- grammar_uri_list_len += 2;
- grammar_uri_list[grammar_uri_list_len - 2] = '\r';
- grammar_uri_list[grammar_uri_list_len - 1] = '\n';
- }
- }
- grammar_uri_list[grammar_uri_list_len++] = '\0';
- grammar = NULL;
- }
-
- /* create MRCP message */
- mrcp_message = mrcp_application_message_create(schannel->unimrcp_session, schannel->unimrcp_channel, RECOGNIZER_RECOGNIZE);
- if (mrcp_message == NULL) {
- status = SWITCH_STATUS_FALSE;
- goto done;
- }
-
- /* allocate generic header */
- generic_header = (mrcp_generic_header_t *) mrcp_generic_header_prepare(mrcp_message);
- if (generic_header == NULL) {
- status = SWITCH_STATUS_FALSE;
- goto done;
- }
-
- /* set Content-Type */
- mime_type = grammar_type_to_mime(grammar ? grammar->type : GRAMMAR_TYPE_URI, schannel->profile);
- if (zstr(mime_type)) {
- status = SWITCH_STATUS_FALSE;
- goto done;
- }
- apt_string_assign(&generic_header->content_type, mime_type, mrcp_message->pool);
- mrcp_generic_header_property_add(mrcp_message, GENERIC_HEADER_CONTENT_TYPE);
-
- /* set Content-ID for inline grammars */
- if (grammar && grammar->type != GRAMMAR_TYPE_URI) {
- apt_string_assign(&generic_header->content_id, grammar->name, mrcp_message->pool);
- mrcp_generic_header_property_add(mrcp_message, GENERIC_HEADER_CONTENT_ID);
- }
-
- /* allocate recognizer-specific header */
- recog_header = (mrcp_recog_header_t *) mrcp_resource_header_prepare(mrcp_message);
- if (recog_header == NULL) {
- status = SWITCH_STATUS_FALSE;
- goto done;
- }
-
- /* set Cancel-If-Queue */
- if (mrcp_message->start_line.version == MRCP_VERSION_2) {
- recog_header->cancel_if_queue = FALSE;
- mrcp_resource_header_property_add(mrcp_message, RECOGNIZER_HEADER_CANCEL_IF_QUEUE);
- }
-
- /* set parameters */
- recog_channel_set_params(schannel, mrcp_message, generic_header, recog_header);
-
- /* set message body */
- apt_string_assign(&mrcp_message->body, grammar ? grammar->data : grammar_uri_list, mrcp_message->pool);
-
- /* Empty audio queue and send RECOGNIZE to MRCP server */
- audio_queue_clear(schannel->audio_queue);
- if (mrcp_application_message_send(schannel->unimrcp_session, schannel->unimrcp_channel, mrcp_message) == FALSE) {
- status = SWITCH_STATUS_FALSE;
- goto done;
- }
- /* wait for IN-PROGRESS */
- while (schannel->state == SPEECH_CHANNEL_READY) {
- if (switch_thread_cond_timedwait(schannel->cond, schannel->mutex, SPEECH_CHANNEL_TIMEOUT_USEC) == SWITCH_STATUS_TIMEOUT && !warned) {
- warned = 1;
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_WARNING, "(%s) IN-PROGRESS not received for RECOGNIZE after %d ms.\n", schannel->name, SPEECH_CHANNEL_TIMEOUT_USEC / (1000));
- }
- }
- if (schannel->state != SPEECH_CHANNEL_PROCESSING) {
- status = SWITCH_STATUS_FALSE;
- goto done;
- }
-
- done:
-
- switch_mutex_unlock(schannel->mutex);
- return status;
-}
-
-/**
- * Load speech recognition grammar
- *
- * @param schannel the recognizer channel
- * @param name the name of this grammar
- * @param type the grammar type
- * @param data the grammar data (or URI)
- * @return SWITCH_STATUS_SUCCESS if successful
- */
-static switch_status_t recog_channel_load_grammar(speech_channel_t *schannel, const char *name, grammar_type_t type, const char *data)
-{
- switch_status_t status = SWITCH_STATUS_SUCCESS;
- grammar_t *g = NULL;
- char *ldata = NULL;
-
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) Loading grammar %s, data = %s\n", schannel->name, name, data);
-
- switch_mutex_lock(schannel->mutex);
- if (schannel->state != SPEECH_CHANNEL_READY) {
- status = SWITCH_STATUS_FALSE;
- goto done;
- }
-
- /* if inline or requested via define-grammar param, use DEFINE-GRAMMAR to cache it on the server */
- if (type != GRAMMAR_TYPE_URI || switch_true(switch_core_hash_find(schannel->params, "define-grammar"))) {
- mrcp_message_t *mrcp_message;
- mrcp_generic_header_t *generic_header;
- const char *mime_type;
- int warned = 0;
-
- /* create MRCP message */
- mrcp_message = mrcp_application_message_create(schannel->unimrcp_session, schannel->unimrcp_channel, RECOGNIZER_DEFINE_GRAMMAR);
- if (mrcp_message == NULL) {
- status = SWITCH_STATUS_FALSE;
- goto done;
- }
-
- /* set Content-Type and Content-ID in message */
- generic_header = (mrcp_generic_header_t *) mrcp_generic_header_prepare(mrcp_message);
- if (generic_header == NULL) {
- status = SWITCH_STATUS_FALSE;
- goto done;
- }
- mime_type = grammar_type_to_mime(type, schannel->profile);
- if (zstr(mime_type)) {
- status = SWITCH_STATUS_FALSE;
- goto done;
- }
- apt_string_assign(&generic_header->content_type, mime_type, mrcp_message->pool);
- mrcp_generic_header_property_add(mrcp_message, GENERIC_HEADER_CONTENT_TYPE);
- apt_string_assign(&generic_header->content_id, name, mrcp_message->pool);
- mrcp_generic_header_property_add(mrcp_message, GENERIC_HEADER_CONTENT_ID);
-
- /* put grammar in message body */
- apt_string_assign(&mrcp_message->body, data, mrcp_message->pool);
-
- /* send message and wait for response */
- speech_channel_set_state_unlocked(schannel, SPEECH_CHANNEL_PROCESSING);
- if (mrcp_application_message_send(schannel->unimrcp_session, schannel->unimrcp_channel, mrcp_message) == FALSE) {
- status = SWITCH_STATUS_FALSE;
- goto done;
- }
- while (schannel->state == SPEECH_CHANNEL_PROCESSING) {
- if (switch_thread_cond_timedwait(schannel->cond, schannel->mutex, SPEECH_CHANNEL_TIMEOUT_USEC) == SWITCH_STATUS_TIMEOUT && !warned) {
- warned = 1;
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_WARNING, "(%s) DEFINE-GRAMMAR not COMPLETED after %d ms.\n", schannel->name, SPEECH_CHANNEL_TIMEOUT_USEC / (1000));
- }
- }
- if (schannel->state != SPEECH_CHANNEL_READY) {
- status = SWITCH_STATUS_FALSE;
- goto done;
- }
-
- /* set up name, type for future RECOGNIZE requests. We'll reference this cached grammar by name */
- ldata = switch_mprintf("session:%s", name);
- data = ldata;
- type = GRAMMAR_TYPE_URI;
- }
-
- /* Create the grammar and save it */
- if ((status = grammar_create(&g, name, type, data, schannel->memory_pool)) == SWITCH_STATUS_SUCCESS) {
- recognizer_data_t *r = (recognizer_data_t *) schannel->data;
- switch_core_hash_insert(r->grammars, g->name, g);
- }
-
- done:
-
- switch_mutex_unlock(schannel->mutex);
- switch_safe_free(ldata);
-
- return status;
-}
-
-/**
- * Unload speech recognition grammar
- *
- * @param schannel the recognizer channel
- * @param grammar_name the name of the grammar to unload
- * @return SWITCH_STATUS_SUCCESS if successful
- */
-static switch_status_t recog_channel_unload_grammar(speech_channel_t *schannel, const char *grammar_name)
-{
- switch_status_t status = SWITCH_STATUS_SUCCESS;
-
- if (zstr(grammar_name)) {
- status = SWITCH_STATUS_FALSE;
- } else {
- recognizer_data_t *r = (recognizer_data_t *) schannel->data;
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) Unloading grammar %s\n", schannel->name, grammar_name);
- switch_core_hash_delete(r->enabled_grammars, grammar_name);
- switch_core_hash_delete(r->grammars, grammar_name);
- }
-
- return status;
-}
-
-/**
- * Enable speech recognition grammar
- *
- * @param schannel the recognizer channel
- * @param grammar_name the name of the grammar to enable
- * @return SWITCH_STATUS_SUCCESS if successful
- */
-static switch_status_t recog_channel_enable_grammar(speech_channel_t *schannel, const char *grammar_name)
-{
- switch_status_t status = SWITCH_STATUS_SUCCESS;
-
- if (zstr(grammar_name)) {
- status = SWITCH_STATUS_FALSE;
- } else {
- recognizer_data_t *r = (recognizer_data_t *) schannel->data;
- grammar_t *grammar;
- grammar = (grammar_t *) switch_core_hash_find(r->grammars, grammar_name);
- if (grammar == NULL)
- {
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_ERROR, "(%s) Undefined grammar, %s\n", schannel->name, grammar_name);
- status = SWITCH_STATUS_FALSE;
- }
- else {
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) Enabling grammar %s\n", schannel->name, grammar_name);
- switch_core_hash_insert(r->enabled_grammars, grammar_name, grammar);
- }
- }
-
- return status;
-}
-
-/**
- * Disable speech recognition grammar
- *
- * @param schannel the recognizer channel
- * @param grammar_name the name of the grammar to disable
- * @return SWITCH_STATUS_SUCCESS if successful
- */
-static switch_status_t recog_channel_disable_grammar(speech_channel_t *schannel, const char *grammar_name)
-{
- switch_status_t status = SWITCH_STATUS_SUCCESS;
-
- if (zstr(grammar_name)) {
- status = SWITCH_STATUS_FALSE;
- } else {
- recognizer_data_t *r = (recognizer_data_t *) schannel->data;
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) Disabling grammar %s\n", schannel->name, grammar_name);
- switch_core_hash_delete(r->enabled_grammars, grammar_name);
- }
-
- return status;
-}
-
-/**
- * Disable all speech recognition grammars
- *
- * @param schannel the recognizer channel
- * @return SWITCH_STATUS_SUCCESS if successful
- */
-static switch_status_t recog_channel_disable_all_grammars(speech_channel_t *schannel)
-{
- switch_status_t status = SWITCH_STATUS_SUCCESS;
-
- recognizer_data_t *r = (recognizer_data_t *) schannel->data;
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) Disabling all grammars\n", schannel->name);
- switch_core_hash_destroy(&r->enabled_grammars);
- switch_core_hash_init(&r->enabled_grammars);
-
- return status;
-}
-
-/**
- * Check if recognition is complete
- *
- * @return SWITCH_STATUS_SUCCESS if results available or start of input
- */
-static switch_status_t recog_channel_check_results(speech_channel_t *schannel)
-{
- switch_status_t status = SWITCH_STATUS_SUCCESS;
- recognizer_data_t *r;
- switch_mutex_lock(schannel->mutex);
- r = (recognizer_data_t *) schannel->data;
- if (!zstr(r->result)) {
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) SUCCESS, have result\n", schannel->name);
- } else if (r->start_of_input == START_OF_INPUT_RECEIVED) {
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) SUCCESS, start of input\n", schannel->name);
- } else {
- status = SWITCH_STATUS_FALSE;
- }
-
- switch_mutex_unlock(schannel->mutex);
- return status;
-}
-
-/**
- * Start recognizer's input timers
- *
- * @return SWITCH_STATUS_SUCCESS if timers were started
- */
-static switch_status_t recog_channel_start_input_timers(speech_channel_t *schannel)
-{
- switch_status_t status = SWITCH_STATUS_SUCCESS;
- recognizer_data_t *r = (recognizer_data_t *) schannel->data;
- switch_mutex_lock(schannel->mutex);
-
- if (schannel->state == SPEECH_CHANNEL_PROCESSING && !r->timers_started && !r->start_of_input) {
- mrcp_message_t *mrcp_message;
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) Starting input timers\n", schannel->name);
- /* Send START-INPUT-TIMERS to MRCP server */
- mrcp_message = mrcp_application_message_create(schannel->unimrcp_session, schannel->unimrcp_channel, RECOGNIZER_START_INPUT_TIMERS);
- if (mrcp_message == NULL) {
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_ERROR, "(%s) Failed to create START-INPUT-TIMERS message\n", schannel->name);
- status = SWITCH_STATUS_FALSE;
- goto done;
- }
- /* set it and forget it */
- mrcp_application_message_send(schannel->unimrcp_session, schannel->unimrcp_channel, mrcp_message);
- }
-
- done:
-
- switch_mutex_unlock(schannel->mutex);
- return status;
-}
-
-/**
- * Flag that input has started
- *
- * @param schannel the channel that has heard input
- * @return SWITCH_STATUS_SUCCESS
- */
-static switch_status_t recog_channel_set_start_of_input(speech_channel_t *schannel)
-{
- switch_status_t status = SWITCH_STATUS_SUCCESS;
- recognizer_data_t *r;
- switch_mutex_lock(schannel->mutex);
- r = (recognizer_data_t *) schannel->data;
- r->start_of_input = START_OF_INPUT_RECEIVED;
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) start of input\n", schannel->name);
- switch_mutex_unlock(schannel->mutex);
- return status;
-}
-
-/**
- * Set the recognition results
- *
- * @param schannel the channel whose results are set
- * @param result the results
- * @return SWITCH_STATUS_SUCCESS if successful
- */
-static switch_status_t recog_channel_set_results(speech_channel_t *schannel, const char *result)
-{
- switch_status_t status = SWITCH_STATUS_SUCCESS;
- recognizer_data_t *r;
- switch_mutex_lock(schannel->mutex);
- r = (recognizer_data_t *) schannel->data;
- if (!zstr(r->result)) {
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) result is already set\n", schannel->name);
- status = SWITCH_STATUS_FALSE;
- goto done;
- }
- if (zstr(result)) {
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) result is NULL\n", schannel->name);
- status = SWITCH_STATUS_FALSE;
- goto done;
- }
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) result:\n\n%s\n", schannel->name, result);
- r->result = switch_core_strdup(schannel->memory_pool, result);
-
- done:
-
- switch_mutex_unlock(schannel->mutex);
- return status;
-}
-
-/**
- * Find a parameter from a ;-separated string
- *
- * @param str the input string to find data in
- * @param param the parameter to to look for
- * @return a pointer in the str if successful, or NULL.
- */
-static char *find_parameter(const char *str, const char *param)
-{
- char *ptr = (char *) str;
-
- while (ptr) {
- if (!strncasecmp(ptr, param, strlen(param)))
- return ptr;
-
- if ((ptr = strchr(ptr, ';')))
- ptr++;
-
- while (ptr && *ptr == ' ') {
- ptr++;
- }
- }
-
- return NULL;
-}
-
-/**
- * Get a parameter value from a ;-separated string
- *
- * @param str the input string to parse data from
- * @param param the parameter to to look for
- * @return a malloc'ed char* if successful, or NULL.
- */
-static char *get_parameter_value(const char *str, const char *param)
-{
- const char *param_ptr;
- char *param_value = NULL;
- char *tmp;
- switch_size_t param_len;
- char *param_tmp;
-
- if (zstr(str) || zstr(param)) return NULL;
-
- /* Append "=" to the end of the string */
- param_tmp = switch_mprintf("%s=", param);
- if (!param_tmp) return NULL;
- param = param_tmp;
-
- param_len = strlen(param);
- param_ptr = find_parameter(str, param);
-
- if (zstr(param_ptr)) goto fail;
-
- param_value = strdup(param_ptr + param_len);
-
- if (zstr(param_value)) goto fail;
-
- if ((tmp = strchr(param_value, ';'))) *tmp = '\0';
-
- switch_safe_free(param_tmp);
- return param_value;
-
- fail:
- switch_safe_free(param_tmp);
- switch_safe_free(param_value);
- return NULL;
-}
-
-/**
- * Set the recognition result headers
- *
- * @param schannel the channel whose results are set
- * @param recog_hdr the recognition headers
- * @return SWITCH_STATUS_SUCCESS if successful
- */
-static switch_status_t recog_channel_set_result_headers(speech_channel_t *schannel, mrcp_recog_header_t *recog_hdr)
-{
- switch_status_t status = SWITCH_STATUS_SUCCESS;
- recognizer_data_t *r;
-
- switch_mutex_lock(schannel->mutex);
-
- r = (recognizer_data_t *) schannel->data;
-
- if (r->result_headers) {
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) result headers are already set\n", schannel->name);
- status = SWITCH_STATUS_FALSE;
- goto done;
- }
-
- if (!recog_hdr) {
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) result headers are NULL\n", schannel->name);
- status = SWITCH_STATUS_FALSE;
- goto done;
- }
-
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) ASR adding result headers\n", schannel->name);
-
- if ((status = switch_event_create(&r->result_headers, SWITCH_EVENT_CLONE)) == SWITCH_STATUS_SUCCESS) {
-
- switch_event_add_header(r->result_headers, SWITCH_STACK_BOTTOM, "ASR-Completion-Cause", "%d", recog_hdr->completion_cause);
-
- if (!zstr(recog_hdr->completion_reason.buf)) {
- switch_event_add_header_string(r->result_headers, SWITCH_STACK_BOTTOM, "ASR-Completion-Reason", recog_hdr->completion_reason.buf);
- }
-
- if (!zstr(recog_hdr->waveform_uri.buf)) {
- char *tmp;
-
- if ((tmp = strdup(recog_hdr->waveform_uri.buf))) {
- char *tmp2;
- if ((tmp2 = strchr(tmp, ';'))) *tmp2 = '\0';
- switch_event_add_header_string(r->result_headers, SWITCH_STACK_BOTTOM, "ASR-Waveform-URI", tmp);
- free(tmp);
- }
-
- if ((tmp = get_parameter_value(recog_hdr->waveform_uri.buf, "size"))) {
- switch_event_add_header_string(r->result_headers, SWITCH_STACK_BOTTOM, "ASR-Waveform-Size", tmp);
- free(tmp);
- }
-
- if ((tmp = get_parameter_value(recog_hdr->waveform_uri.buf, "duration"))) {
- switch_event_add_header_string(r->result_headers, SWITCH_STACK_BOTTOM, "ASR-Waveform-Duration", tmp);
- free(tmp);
- }
- }
- }
-
- done:
-
- switch_mutex_unlock(schannel->mutex);
-
- return status;
-}
-
-/**
- * Get the recognition results.
- *
- * @param schannel the channel to get results from
- * @param result the results. free() the results when finished with them.
- * @return SWITCH_STATUS_SUCCESS if there are results, SWITCH_STATUS_BREAK if start of input
- */
-static switch_status_t recog_channel_get_results(speech_channel_t *schannel, char **result)
-{
- switch_status_t status = SWITCH_STATUS_SUCCESS;
- recognizer_data_t *r = (recognizer_data_t *) schannel->data;
- switch_mutex_lock(schannel->mutex);
- if (!zstr(r->result)) {
- *result = strdup(r->result);
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) result:\n\n%s\n", schannel->name, *result ? *result : "");
- r->result = NULL;
- r->start_of_input = START_OF_INPUT_REPORTED;
- } else if (r->start_of_input == START_OF_INPUT_RECEIVED) {
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) start of input\n", schannel->name);
- status = SWITCH_STATUS_BREAK;
- r->start_of_input = START_OF_INPUT_REPORTED;
- } else {
- status = SWITCH_STATUS_FALSE;
- }
-
- switch_mutex_unlock(schannel->mutex);
- return status;
-}
-
-/**
- * Get the recognition result headers.
- *
- * @param schannel the channel to get results from
- * @param result_headers the recognition result headers. switch_event_destroy() the results when finished with them.
- * @return SWITCH_STATUS_SUCCESS will always be returned, since this is just optional data.
- */
-static switch_status_t recog_channel_get_result_headers(speech_channel_t *schannel, switch_event_t **result_headers)
-{
- recognizer_data_t *r = (recognizer_data_t *) schannel->data;
-
- switch_mutex_lock(schannel->mutex);
-
- if (r->result_headers && result_headers) {
- *result_headers = r->result_headers;
- r->result_headers = NULL;
- }
-
- switch_mutex_unlock(schannel->mutex);
-
- return SWITCH_STATUS_SUCCESS;
-}
-
-/**
- * Set parameters in a recognizer MRCP header
- *
- * @param schannel the speech channel containing the params
- * @param msg the MRCP message to set
- * @param gen_hdr the generic headers to set
- * @param recog_hdr the recognizer headers to set
- * @return SWITCH_STATUS_SUCCESS
- */
-static switch_status_t recog_channel_set_params(speech_channel_t *schannel, mrcp_message_t *msg, mrcp_generic_header_t *gen_hdr,
- mrcp_recog_header_t *recog_hdr)
-{
- /* loop through each param and add to recog header or vendor-specific-params */
- switch_hash_index_t *hi = NULL;
- for (hi = switch_core_hash_first(schannel->params); hi; hi = switch_core_hash_next(&hi)) {
- char *param_name = NULL, *param_val = NULL;
- const void *key;
- void *val;
- switch_core_hash_this(hi, &key, NULL, &val);
- param_name = (char *) key;
- param_val = (char *) val;
- if (!zstr(param_name) && !zstr(param_val)) {
- unimrcp_param_id_t *id = (unimrcp_param_id_t *) switch_core_hash_find(schannel->application->param_id_map, param_name);
- if (id) {
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) \"%s\": \"%s\"\n", schannel->name, param_name, param_val);
- recog_channel_set_header(schannel, id->id, param_val, msg, recog_hdr);
- } else if (!strcasecmp(param_name, "define-grammar")) {
- // This parameter is used internally only, not in MRCP headers
- } else if (!strcasecmp(param_name, "name")) {
- // This parameter is used internally only, not in MRCP headers
- } else if (!strcasecmp(param_name, "start-recognize")) {
- // This parameter is used internally only, not in MRCP headers
- } else {
- /* this is probably a vendor-specific MRCP param */
- apt_str_t apt_param_name = { 0 };
- apt_str_t apt_param_val = { 0 };
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) (vendor-specific value) %s: %s\n", schannel->name, param_name, param_val);
- apt_string_set(&apt_param_name, param_name); /* copy isn't necessary since apt_pair_array_append will do it */
- apt_string_set(&apt_param_val, param_val);
- if (!gen_hdr->vendor_specific_params) {
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) creating vendor specific pair array\n", schannel->name);
- gen_hdr->vendor_specific_params = apt_pair_array_create(10, msg->pool);
- }
- apt_pair_array_append(gen_hdr->vendor_specific_params, &apt_param_name, &apt_param_val, msg->pool);
- }
- }
- }
-
- if (gen_hdr->vendor_specific_params) {
- mrcp_generic_header_property_add(msg, GENERIC_HEADER_VENDOR_SPECIFIC_PARAMS);
- }
-
- return SWITCH_STATUS_SUCCESS;
-}
-
-/**
- * Set parameter in a recognizer MRCP header
- *
- * @param schannel the speech channel containing the param
- * @param id the UniMRCP header enum
- * @param val the value to set
- * @param msg the MRCP message to set
- * @param recog_hdr the recognizer header to set
- * @return SWITCH_STATUS_SUCCESS
- */
-static switch_status_t recog_channel_set_header(speech_channel_t *schannel, int id, char *val, mrcp_message_t *msg, mrcp_recog_header_t *recog_hdr)
-{
- switch_status_t status = SWITCH_STATUS_SUCCESS;
-
- switch (id) {
- case RECOGNIZER_HEADER_CONFIDENCE_THRESHOLD:
- recog_hdr->confidence_threshold = (float) atof(val);
- mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_CONFIDENCE_THRESHOLD);
- break;
-
- case RECOGNIZER_HEADER_SENSITIVITY_LEVEL:
- recog_hdr->sensitivity_level = (float) atof(val);
- mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_SENSITIVITY_LEVEL);
- break;
-
- case RECOGNIZER_HEADER_SPEED_VS_ACCURACY:
- recog_hdr->speed_vs_accuracy = (float) atof(val);
- mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_SPEED_VS_ACCURACY);
- break;
-
- case RECOGNIZER_HEADER_N_BEST_LIST_LENGTH:{
- int n_best_list_length = atoi(val);
- if (n_best_list_length > 0) {
- recog_hdr->n_best_list_length = n_best_list_length;
- mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_N_BEST_LIST_LENGTH);
- } else {
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_WARNING, "(%s) Ignoring invalid n best list length, \"%s\"\n", schannel->name, val);
- }
- break;
- }
- case RECOGNIZER_HEADER_NO_INPUT_TIMEOUT:{
- int no_input_timeout = atoi(val);
- if (no_input_timeout >= 0) {
- recog_hdr->no_input_timeout = no_input_timeout;
- mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_NO_INPUT_TIMEOUT);
- } else {
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_WARNING, "(%s) Ignoring invalid no input timeout, \"%s\"\n", schannel->name, val);
- }
- break;
- }
- case RECOGNIZER_HEADER_RECOGNITION_TIMEOUT:{
- int recognition_timeout = atoi(val);
- if (recognition_timeout >= 0) {
- recog_hdr->recognition_timeout = recognition_timeout;
- mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_RECOGNITION_TIMEOUT);
- } else {
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_WARNING, "(%s) Ignoring invalid recognition timeout, \"%s\"\n", schannel->name, val);
- }
- break;
- }
- case RECOGNIZER_HEADER_START_INPUT_TIMERS:
- recog_hdr->start_input_timers = !strcasecmp("true", val);
- mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_START_INPUT_TIMERS);
- break;
- case RECOGNIZER_HEADER_SPEECH_COMPLETE_TIMEOUT:{
- int speech_complete_timeout = atoi(val);
- if (speech_complete_timeout >= 0) {
- recog_hdr->speech_complete_timeout = speech_complete_timeout;
- mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_SPEECH_COMPLETE_TIMEOUT);
- } else {
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_WARNING, "(%s) Ignoring invalid speech complete timeout, \"%s\"\n", schannel->name, val);
- }
- break;
- }
- case RECOGNIZER_HEADER_SPEECH_INCOMPLETE_TIMEOUT:{
- int speech_incomplete_timeout = atoi(val);
- if (speech_incomplete_timeout >= 0) {
- recog_hdr->speech_incomplete_timeout = speech_incomplete_timeout;
- mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_SPEECH_INCOMPLETE_TIMEOUT);
- } else {
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_WARNING, "(%s) Ignoring invalid speech incomplete timeout, \"%s\"\n", schannel->name,
- val);
- }
- break;
- }
- case RECOGNIZER_HEADER_DTMF_INTERDIGIT_TIMEOUT:{
- int dtmf_interdigit_timeout = atoi(val);
- if (dtmf_interdigit_timeout >= 0) {
- recog_hdr->dtmf_interdigit_timeout = dtmf_interdigit_timeout;
- mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_DTMF_INTERDIGIT_TIMEOUT);
- } else {
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_WARNING, "(%s) Ignoring invalid dtmf interdigit timeout, \"%s\"\n", schannel->name, val);
- }
- break;
- }
- case RECOGNIZER_HEADER_DTMF_TERM_TIMEOUT:{
- int dtmf_term_timeout = atoi(val);
- if (dtmf_term_timeout >= 0) {
- recog_hdr->dtmf_term_timeout = dtmf_term_timeout;
- mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_DTMF_TERM_TIMEOUT);
- } else {
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_WARNING, "(%s) Ignoring invalid dtmf term timeout, \"%s\"\n", schannel->name, val);
- }
- break;
- }
- case RECOGNIZER_HEADER_DTMF_TERM_CHAR:
- if (strlen(val) == 1) {
- recog_hdr->dtmf_term_char = *val;
- mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_DTMF_TERM_CHAR);
- } else {
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_WARNING, "(%s) Ignoring invalid dtmf term char, \"%s\"\n", schannel->name, val);
- }
- break;
-
- case RECOGNIZER_HEADER_SAVE_WAVEFORM:
- recog_hdr->save_waveform = !strcasecmp("true", val);
- mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_SAVE_WAVEFORM);
- break;
-
- case RECOGNIZER_HEADER_NEW_AUDIO_CHANNEL:
- recog_hdr->new_audio_channel = !strcasecmp("true", val);
- mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_NEW_AUDIO_CHANNEL);
- break;
-
- case RECOGNIZER_HEADER_SPEECH_LANGUAGE:
- apt_string_assign(&recog_hdr->speech_language, val, msg->pool);
- mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_SPEECH_LANGUAGE);
- break;
-
- case RECOGNIZER_HEADER_RECOGNITION_MODE:
- apt_string_assign(&recog_hdr->recognition_mode, val, msg->pool);
- mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_RECOGNITION_MODE);
- break;
-
- case RECOGNIZER_HEADER_HOTWORD_MAX_DURATION:{
- int hotword_max_duration = atoi(val);
- if (hotword_max_duration >= 0) {
- recog_hdr->hotword_max_duration = hotword_max_duration;
- mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_HOTWORD_MAX_DURATION);
- } else {
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_WARNING, "(%s) Ignoring invalid hotword max duration, \"%s\"\n", schannel->name, val);
- }
- break;
- }
- case RECOGNIZER_HEADER_HOTWORD_MIN_DURATION:{
- int hotword_min_duration = atoi(val);
- if (hotword_min_duration >= 0) {
- recog_hdr->hotword_min_duration = hotword_min_duration;
- mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_HOTWORD_MIN_DURATION);
- } else {
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_WARNING, "(%s) Ignoring invalid hotword min duration, \"%s\"\n", schannel->name, val);
- }
- break;
- }
- case RECOGNIZER_HEADER_CLEAR_DTMF_BUFFER:
- recog_hdr->clear_dtmf_buffer = !strcasecmp("true", val);
- mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_CLEAR_DTMF_BUFFER);
- break;
-
- case RECOGNIZER_HEADER_EARLY_NO_MATCH:
- recog_hdr->early_no_match = !strcasecmp("true", val);
- mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_EARLY_NO_MATCH);
- break;
-
- case RECOGNIZER_HEADER_INPUT_WAVEFORM_URI:
- apt_string_assign(&recog_hdr->input_waveform_uri, val, msg->pool);
- mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_INPUT_WAVEFORM_URI);
- break;
-
- case RECOGNIZER_HEADER_MEDIA_TYPE:
- apt_string_assign(&recog_hdr->media_type, val, msg->pool);
- mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_MEDIA_TYPE);
- break;
-
- /* Unsupported headers */
-
- /* MRCP server headers */
- case RECOGNIZER_HEADER_WAVEFORM_URI:
- case RECOGNIZER_HEADER_COMPLETION_CAUSE:
- case RECOGNIZER_HEADER_FAILED_URI:
- case RECOGNIZER_HEADER_FAILED_URI_CAUSE:
- case RECOGNIZER_HEADER_INPUT_TYPE:
- case RECOGNIZER_HEADER_COMPLETION_REASON:
- /* module handles this automatically */
- case RECOGNIZER_HEADER_CANCEL_IF_QUEUE:
- /* GET-PARAMS method only */
- case RECOGNIZER_HEADER_RECOGNIZER_CONTEXT_BLOCK:
- case RECOGNIZER_HEADER_DTMF_BUFFER_TIME:
-
- /* INTERPRET method only */
- case RECOGNIZER_HEADER_INTERPRET_TEXT:
-
- /* unknown */
- case RECOGNIZER_HEADER_VER_BUFFER_UTTERANCE:
-
- default:
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_WARNING, "(%s) unsupported RECOGNIZER header\n", schannel->name);
- }
-
- return status;
-}
-
-/**
- * Flag that the recognizer channel timers are started
- * @param schannel the recognizer channel to flag
- */
-static switch_status_t recog_channel_set_timers_started(speech_channel_t *schannel)
-{
- recognizer_data_t *r;
- switch_mutex_lock(schannel->mutex);
- r = (recognizer_data_t *) schannel->data;
- r->timers_started = 1;
- switch_mutex_unlock(schannel->mutex);
- return SWITCH_STATUS_SUCCESS;
-}
-
-/**
- * Process asr_open request from FreeSWITCH.
- *
- * @param ah the FreeSWITCH speech rec handle
- * @param codec the codec to use
- * @param rate the sample rate of the codec
- * @param dest the profile to use
- * @param flags other flags
- * @return SWITCH_STATUS_SUCCESS if successful, otherwise SWITCH_STATUS_FALSE
- */
-static switch_status_t recog_asr_open(switch_asr_handle_t *ah, const char *codec, int rate, const char *dest, switch_asr_flag_t *flags)
-{
- switch_status_t status = SWITCH_STATUS_SUCCESS;
- speech_channel_t *schannel = NULL;
- int speech_channel_number = get_next_speech_channel_number();
- char *name = "";
- const char *profile_name = !zstr(dest) ? dest : ah->param;
- profile_t *profile = NULL;
- recognizer_data_t *r = NULL;
- switch_hash_index_t *hi = NULL;
- char *session_uuid = NULL;
-
- /* Name the channel */
- if (profile_name && strchr(profile_name, ':')) {
- /* Profile has session name appended to it. Pick it out */
- profile_name = switch_core_strdup(ah->memory_pool, profile_name);
- session_uuid = strchr(profile_name, ':');
- *session_uuid = '\0';
- session_uuid++;
- session_uuid = switch_core_strdup(ah->memory_pool, session_uuid);
- } else {
- /* check if session is associated w/ this memory pool */
- switch_core_session_t *session = switch_core_memory_pool_get_data(ah->memory_pool, "__session");
- if (session) {
- session_uuid = switch_core_session_get_uuid(session);
- }
- }
- name = switch_core_sprintf(ah->memory_pool, "ASR-%d", speech_channel_number);
-
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(session_uuid), SWITCH_LOG_INFO, "asr_handle: name = %s, codec = %s, rate = %d, grammar = %s, param = %s\n",
- ah->name, ah->codec, ah->rate, ah->grammar, ah->param);
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(session_uuid), SWITCH_LOG_INFO, "codec = %s, rate = %d, dest = %s\n", codec, rate, dest);
-
- /* Allocate the channel */
- if (speech_channel_create(&schannel, name, session_uuid, SPEECH_CHANNEL_RECOGNIZER, &globals.recog, (uint16_t) rate, ah->memory_pool) != SWITCH_STATUS_SUCCESS) {
- status = SWITCH_STATUS_FALSE;
- goto done;
- }
- schannel->fsh = ah;
- ah->private_info = schannel;
- r = (recognizer_data_t *) switch_core_alloc(ah->memory_pool, sizeof(recognizer_data_t));
- schannel->data = r;
- memset(r, 0, sizeof(recognizer_data_t));
- switch_core_hash_init(&r->grammars);
- switch_core_hash_init(&r->enabled_grammars);
-
- /* Open the channel */
- if (zstr(profile_name)) {
- profile_name = globals.unimrcp_default_recog_profile;
- }
- profile = (profile_t *) switch_core_hash_find(globals.profiles, profile_name);
- if (!profile) {
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(session_uuid), SWITCH_LOG_ERROR, "(%s) Can't find profile, %s\n", name, profile_name);
- status = SWITCH_STATUS_FALSE;
- goto done;
- }
- if ((status = speech_channel_open(schannel, profile)) != SWITCH_STATUS_SUCCESS) {
- goto done;
- }
-
- /* Set default ASR params */
- for (hi = switch_core_hash_first(profile->default_recog_params); hi; hi = switch_core_hash_next(&hi)) {
- char *param_name = NULL, *param_val = NULL;
- const void *key;
- void *val;
- switch_core_hash_this(hi, &key, NULL, &val);
- param_name = (char *) key;
- param_val = (char *) val;
- speech_channel_set_param(schannel, param_name, param_val);
- }
-
- done:
-
- return status;
-}
-
-/**
- * Process asr_load_grammar request from FreeSWITCH.
- *
- * FreeSWITCH sends this request to load a grammar
- * @param ah the FreeSWITCH speech recognition handle
- * @param grammar the grammar data. This can be an absolute file path, a URI, or the grammar text.
- * @param name used to reference grammar for unloading or for recognition requests
- */
-static switch_status_t recog_asr_load_grammar(switch_asr_handle_t *ah, const char *grammar, const char *name)
-{
- switch_status_t status = SWITCH_STATUS_SUCCESS;
- speech_channel_t *schannel = (speech_channel_t *) ah->private_info;
- const char *grammar_data = NULL;
- char *grammar_file_data = NULL;
- char *start_recognize;
- switch_file_t *grammar_file = NULL;
- switch_size_t grammar_file_size = 0, to_read = 0;
- grammar_type_t type = GRAMMAR_TYPE_UNKNOWN;
- char *filename = NULL;
-
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) grammar = %s, name = %s\n", schannel->name, grammar, name);
-
- grammar = skip_initial_whitespace(grammar);
- if (zstr(grammar)) {
- status = SWITCH_STATUS_FALSE;
- goto done;
- }
-
- /* stop recognition */
- if (speech_channel_stop(schannel) != SWITCH_STATUS_SUCCESS) {
- status = SWITCH_STATUS_FALSE;
- goto done;
- }
-
- /* figure out what type of grammar this is */
- if (text_starts_with(grammar, HTTP_ID) || text_starts_with(grammar, HTTPS_ID) || text_starts_with(grammar, FILE_ID) || text_starts_with(grammar, SESSION_ID)
- || text_starts_with(grammar, BUILTIN_ID)) {
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) Grammar is URI\n", schannel->name);
- type = GRAMMAR_TYPE_URI;
- grammar_data = grammar;
- } else if (text_starts_with(grammar, INLINE_ID)) {
- grammar_data = grammar + strlen(INLINE_ID);
- } else {
- /* grammar points to file containing the grammar text. We assume the MRCP server can't get to this file
- * so read the data from the file and cache it */
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) Grammar is inside file\n", schannel->name);
- if (switch_is_file_path(grammar)) {
- filename = switch_mprintf("%s.gram", grammar);
- } else {
- filename = switch_mprintf("%s%s%s.gram", SWITCH_GLOBAL_dirs.grammar_dir, SWITCH_PATH_SEPARATOR, grammar);
- }
- grammar_data = NULL;
- if (switch_file_open(&grammar_file, filename, SWITCH_FOPEN_READ, 0, schannel->memory_pool) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_ERROR, "(%s) Could not read grammar file: %s\n", schannel->name, filename);
- status = SWITCH_STATUS_FALSE;
- goto done;
- }
- grammar_file_size = switch_file_get_size(grammar_file);
- if (grammar_file_size == 0) {
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_ERROR, "(%s) Grammar file is empty: %s\n", schannel->name, filename);
- status = SWITCH_STATUS_FALSE;
- goto done;
- }
- grammar_file_data = (char *) switch_core_alloc(schannel->memory_pool, grammar_file_size + 1);
- to_read = grammar_file_size;
- if (switch_file_read(grammar_file, grammar_file_data, &to_read) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_ERROR, "(%s) Grammar file read error: %s\n", schannel->name, filename);
- status = SWITCH_STATUS_FALSE;
- goto done;
- }
- if (to_read != grammar_file_size) {
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_ERROR, "(%s) Could not read entire grammar file: %s\n", schannel->name, filename);
- status = SWITCH_STATUS_FALSE;
- goto done;
- }
- grammar_file_data[to_read] = '\0';
- grammar_data = grammar_file_data;
- }
-
- /* if a name was not given, check if defined in a param */
- if (zstr(name)) {
- name = switch_core_hash_find(schannel->params, "name");
-
- /* if not defined in param, create one */
- if (zstr(name)) {
- char id[SWITCH_UUID_FORMATTED_LENGTH + 1] = { 0 };
- switch_uuid_str(id, sizeof(id));
- name = switch_core_strdup(schannel->memory_pool, id);
- }
- }
-
- /* determine content type of file grammar or inline grammar */
- if (type == GRAMMAR_TYPE_UNKNOWN) {
- if (text_starts_with(grammar_data, XML_ID) || text_starts_with(grammar_data, SRGS_ID)) {
- type = GRAMMAR_TYPE_SRGS_XML;
- } else if (text_starts_with(grammar_data, GSL_ID)) {
- type = GRAMMAR_TYPE_NUANCE_GSL;
- } else if (text_starts_with(grammar_data, ABNF_ID)) {
- type = GRAMMAR_TYPE_SRGS;
- } else if (text_starts_with(grammar_data, JSGF_ID)) {
- type = GRAMMAR_TYPE_JSGF;
- } else if (text_starts_with(grammar_data, GSR_ID)) {
- type = GRAMMAR_TYPE_XML;
- } else {
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_ERROR, "(%s) unable to determine grammar type: %s\n", schannel->name, grammar_data);
- status = SWITCH_STATUS_FALSE;
- goto done;
- }
- }
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) grammar is %s\n", schannel->name, grammar_type_to_mime(type, schannel->profile));
-
- /* load the grammar */
- if (recog_channel_load_grammar(schannel, name, type, grammar_data) != SWITCH_STATUS_SUCCESS) {
- status = SWITCH_STATUS_FALSE;
- goto done;
- }
-
- start_recognize = (char *) switch_core_hash_find(schannel->params, "start-recognize");
- if (zstr(start_recognize) || strcasecmp(start_recognize, "false"))
- {
- if (recog_channel_disable_all_grammars(schannel) != SWITCH_STATUS_SUCCESS) {
- status = SWITCH_STATUS_FALSE;
- goto done;
- }
- if (recog_channel_enable_grammar(schannel, name) != SWITCH_STATUS_SUCCESS) {
- status = SWITCH_STATUS_FALSE;
- goto done;
- }
- status = recog_channel_start(schannel);
- }
-
- done:
-
- switch_safe_free(filename);
- if (grammar_file) {
- switch_file_close(grammar_file);
- }
- return status;
-}
-
-/**
- * Process asr_unload_grammar request from FreeSWITCH.
- *
- * FreeSWITCH sends this request to stop recognition on this grammar.
- * @param ah the FreeSWITCH speech recognition handle
- * @param name the grammar name.
- */
-static switch_status_t recog_asr_unload_grammar(switch_asr_handle_t *ah, const char *name)
-{
- switch_status_t status = SWITCH_STATUS_SUCCESS;
- speech_channel_t *schannel = (speech_channel_t *) ah->private_info;
- if (zstr(name) || speech_channel_stop(schannel) != SWITCH_STATUS_SUCCESS || recog_channel_unload_grammar(schannel, name) != SWITCH_STATUS_SUCCESS) {
- status = SWITCH_STATUS_FALSE;
- }
- return status;
-}
-
-/**
- * Process asr_enable_grammar request from FreeSWITCH.
- *
- * FreeSWITCH sends this request to enable recognition on this grammar.
- * @param ah the FreeSWITCH speech recognition handle
- * @param name the grammar name.
- */
-static switch_status_t recog_asr_enable_grammar(switch_asr_handle_t *ah, const char *name)
-{
- switch_status_t status = SWITCH_STATUS_SUCCESS;
- speech_channel_t *schannel = (speech_channel_t *) ah->private_info;
- if (zstr(name) || speech_channel_stop(schannel) != SWITCH_STATUS_SUCCESS || recog_channel_enable_grammar(schannel, name) != SWITCH_STATUS_SUCCESS) {
- status = SWITCH_STATUS_FALSE;
- }
- return status;
-}
-
-/**
- * Process asr_disable_grammar request from FreeSWITCH.
- *
- * FreeSWITCH sends this request to disable recognition on this grammar.
- * @param ah the FreeSWITCH speech recognition handle
- * @param name the grammar name.
- */
-static switch_status_t recog_asr_disable_grammar(switch_asr_handle_t *ah, const char *name)
-{
- switch_status_t status = SWITCH_STATUS_SUCCESS;
- speech_channel_t *schannel = (speech_channel_t *) ah->private_info;
- if (zstr(name) || speech_channel_stop(schannel) != SWITCH_STATUS_SUCCESS || recog_channel_disable_grammar(schannel, name) != SWITCH_STATUS_SUCCESS) {
- status = SWITCH_STATUS_FALSE;
- }
- return status;
-}
-
-/**
- * Process asr_disable_all_grammars request from FreeSWITCH.
- *
- * FreeSWITCH sends this request to disable recognition of all grammars.
- * @param ah the FreeSWITCH speech recognition handle
- * @param name the grammar name.
- */
-static switch_status_t recog_asr_disable_all_grammars(switch_asr_handle_t *ah)
-{
- switch_status_t status = SWITCH_STATUS_SUCCESS;
- speech_channel_t *schannel = (speech_channel_t *) ah->private_info;
- if (speech_channel_stop(schannel) != SWITCH_STATUS_SUCCESS || recog_channel_disable_all_grammars(schannel) != SWITCH_STATUS_SUCCESS) {
- status = SWITCH_STATUS_FALSE;
- }
- return status;
-}
-
-/**
- * Process asr_close request from FreeSWITCH
- *
- * @param ah the FreeSWITCH speech recognition handle
- * @param flags speech recognition flags (unused)
- * @return SWITCH_STATUS_SUCCESS
- */
-static switch_status_t recog_asr_close(switch_asr_handle_t *ah, switch_asr_flag_t *flags)
-{
- speech_channel_t *schannel = (speech_channel_t *) ah->private_info;
- recognizer_data_t *r = NULL;
-
- /* close if not already closed */
- if (schannel != NULL && !switch_test_flag(ah, SWITCH_ASR_FLAG_CLOSED)) {
- r = (recognizer_data_t *) schannel->data;
- speech_channel_stop(schannel);
- switch_core_hash_destroy(&r->grammars);
- switch_core_hash_destroy(&r->enabled_grammars);
- switch_mutex_lock(schannel->mutex);
- if (r->dtmf_generator) {
- r->dtmf_generator_active = 0;
- mpf_dtmf_generator_destroy(r->dtmf_generator);
- }
- if (r->result_headers) {
- switch_event_destroy(&r->result_headers);
- }
- switch_mutex_unlock(schannel->mutex);
- speech_channel_destroy(schannel);
- }
- /* this lets FreeSWITCH's speech_thread know the handle is closed */
- switch_set_flag(ah, SWITCH_ASR_FLAG_CLOSED);
-
- return SWITCH_STATUS_SUCCESS;
-}
-
-/**
- * Process asr_feed request from FreeSWITCH
- *
- * @param ah the FreeSWITCH speech recognition handle
- * @return SWITCH_STATUS_SUCCESS if successful
- */
-static switch_status_t recog_asr_feed(switch_asr_handle_t *ah, void *data, unsigned int len, switch_asr_flag_t *flags)
-{
- switch_size_t slen = len;
- speech_channel_t *schannel = (speech_channel_t *) ah->private_info;
- return speech_channel_write(schannel, data, &slen);
-}
-
-/**
- * Process asr_feed_dtmf request from FreeSWITCH
- *
- * @param ah the FreeSWITCH speech recognition handle
- * @return SWITCH_STATUS_SUCCESS if successful
- */
-static switch_status_t recog_asr_feed_dtmf(switch_asr_handle_t *ah, const switch_dtmf_t *dtmf, switch_asr_flag_t *flags)
-{
- speech_channel_t *schannel = (speech_channel_t *) ah->private_info;
- recognizer_data_t *r = (recognizer_data_t *) schannel->data;
- char digits[2];
-
- if (!r->dtmf_generator) {
- if (!r->unimrcp_stream) {
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_ERROR, "(%s) Cannot queue DTMF: No UniMRCP stream object open\n", schannel->name);
- return SWITCH_STATUS_FALSE;
- }
- r->dtmf_generator = mpf_dtmf_generator_create(r->unimrcp_stream, schannel->unimrcp_session->pool);
- if (!r->dtmf_generator) {
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_ERROR, "(%s) Cannot queue DTMF: Failed to create DTMF generator\n", schannel->name);
- return SWITCH_STATUS_FALSE;
- }
- }
-
- digits[0] = dtmf->digit;
- digits[1] = '\0';
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) Queued DTMF: %s\n", schannel->name, digits);
- mpf_dtmf_generator_enqueue(r->dtmf_generator, digits);
- r->dtmf_generator_active = 1;
-
- return SWITCH_STATUS_SUCCESS;
-}
-
-/**
- * Process asr_resume request from FreeSWITCH
- *
- * @param ah the FreeSWITCH speech recognition handle
- */
-static switch_status_t recog_asr_resume(switch_asr_handle_t *ah)
-{
- speech_channel_t *schannel = (speech_channel_t *) ah->private_info;
- return recog_channel_start(schannel);
-}
-
-/**
- * Process asr_pause request from FreeSWITCH
- *
- * @param ah the FreeSWITCH speech recognition handle
- */
-static switch_status_t recog_asr_pause(switch_asr_handle_t *ah)
-{
- speech_channel_t *schannel = (speech_channel_t *) ah->private_info;
- return speech_channel_stop(schannel);
-}
-
-/**
- * Process asr_check_results request from FreeSWITCH
- * This method is polled by FreeSWITCH until we return SWITCH_STATUS_SUCCESS. Then
- * the results are fetched.
- *
- * @param ah the FreeSWITCH speech recognition handle
- * @param flags other flags
- */
-static switch_status_t recog_asr_check_results(switch_asr_handle_t *ah, switch_asr_flag_t *flags)
-{
- speech_channel_t *schannel = (speech_channel_t *) ah->private_info;
- return recog_channel_check_results(schannel);
-}
-
-/**
- * Process asr_get_results request from FreeSWITCH. Return the XML string back
- * to FreeSWITCH. FreeSWITCH will free() the xmlstr.
- *
- * @param ah the FreeSWITCH speech recognition handle
- * @param flags other flags
- */
-static switch_status_t recog_asr_get_results(switch_asr_handle_t *ah, char **xmlstr, switch_asr_flag_t *flags)
-{
- speech_channel_t *schannel = (speech_channel_t *) ah->private_info;
- return recog_channel_get_results(schannel, xmlstr);
-}
-
-/**
- * Process asr_get_result_headers request from FreeSWITCH. Return the headers back
- * to FreeSWITCH. FreeSWITCH will switch_event_destroy() the headers.
- *
- * @param ah the FreeSWITCH speech recognition handle
- * @param flags other flags
- */
-static switch_status_t recog_asr_get_result_headers(switch_asr_handle_t *ah, switch_event_t **headers, switch_asr_flag_t *flags)
-{
- speech_channel_t *schannel = (speech_channel_t *) ah->private_info;
- return recog_channel_get_result_headers(schannel, headers);
-}
-
-/**
- * Send START-INPUT-TIMERS to executing recognition request
- * @param ah the handle to start timers on
- * @return SWITCH_STATUS_SUCCESS
- */
-static switch_status_t recog_asr_start_input_timers(switch_asr_handle_t *ah)
-{
- speech_channel_t *schannel = (speech_channel_t *) ah->private_info;
- return recog_channel_start_input_timers(schannel);
-}
-
-/**
- * Process text_param request from FreeSWITCH.
- * Update MRCP session text parameters.
- *
- * @param ah the FreeSWITCH asr handle
- * @param param the parameter to set
- * @param val the value to set the parameter to
- */
-static void recog_asr_text_param(switch_asr_handle_t *ah, char *param, const char *val)
-{
- speech_channel_t *schannel = (speech_channel_t *) ah->private_info;
- speech_channel_set_param(schannel, param, val);
-}
-
-/**
- * Process numeric_param request from FreeSWITCH.
- * Update MRCP session numeric parameters
- *
- * @param ah the FreeSWITCH asr handle
- * @param param the parameter to set
- * @param val the value to set the parameter to
- */
-static void recog_asr_numeric_param(switch_asr_handle_t *ah, char *param, int val)
-{
- speech_channel_t *schannel = (speech_channel_t *) ah->private_info;
- char *val_str = switch_mprintf("%d", val);
- speech_channel_set_param(schannel, param, val_str);
- switch_safe_free(val_str);
-}
-
-/**
- * Process float_param request from FreeSWITCH.
- * Update MRCP session float parameters
- *
- * @param ah the FreeSWITCH asr handle
- * @param param the parameter to set
- * @param val the value to set the parameter to
- */
-static void recog_asr_float_param(switch_asr_handle_t *ah, char *param, double val)
-{
- speech_channel_t *schannel = (speech_channel_t *) ah->private_info;
- char *val_str = switch_mprintf("%f", val);
- speech_channel_set_param(schannel, param, val_str);
- switch_safe_free(val_str);
-}
-
-/**
- * Process messages from UniMRCP for the recognizer application
- */
-static apt_bool_t recog_message_handler(const mrcp_app_message_t *app_message)
-{
- return mrcp_application_message_dispatch(&globals.recog.dispatcher, app_message);
-}
-
-/**
- * Handle the MRCP responses/events
- */
-static apt_bool_t recog_on_message_receive(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_message_t *message)
-{
- speech_channel_t *schannel = (speech_channel_t *) mrcp_application_channel_object_get(channel);
- mrcp_recog_header_t *recog_hdr = (mrcp_recog_header_t *) mrcp_resource_header_get(message);
- if (message->start_line.message_type == MRCP_MESSAGE_TYPE_RESPONSE) {
- /* received MRCP response */
- if (message->start_line.method_id == RECOGNIZER_RECOGNIZE) {
- /* received the response to RECOGNIZE request */
- if (message->start_line.request_state == MRCP_REQUEST_STATE_INPROGRESS) {
- /* RECOGNIZE in progress */
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) RECOGNIZE IN PROGRESS\n", schannel->name);
- speech_channel_set_state(schannel, SPEECH_CHANNEL_PROCESSING);
- } else if (message->start_line.request_state == MRCP_REQUEST_STATE_COMPLETE) {
- /* RECOGNIZE failed to start */
- if (!recog_hdr || recog_hdr->completion_cause == RECOGNIZER_COMPLETION_CAUSE_UNKNOWN) {
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) RECOGNIZE failed: status = %d\n", schannel->name,
- message->start_line.status_code);
- } else {
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) RECOGNIZE failed: status = %d, completion-cause = %03d\n",
- schannel->name, message->start_line.status_code, recog_hdr->completion_cause);
- }
- speech_channel_set_state(schannel, SPEECH_CHANNEL_ERROR);
- } else if (message->start_line.request_state == MRCP_REQUEST_STATE_PENDING) {
- /* RECOGNIZE is queued */
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) RECOGNIZE PENDING\n", schannel->name);
- } else {
- /* received unexpected request_state */
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) unexpected RECOGNIZE request state: %d\n", schannel->name,
- message->start_line.request_state);
- speech_channel_set_state(schannel, SPEECH_CHANNEL_ERROR);
- }
- } else if (message->start_line.method_id == RECOGNIZER_STOP) {
- /* received response to the STOP request */
- if (message->start_line.request_state == MRCP_REQUEST_STATE_COMPLETE) {
- /* got COMPLETE */
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) RECOGNIZE STOPPED\n", schannel->name);
- speech_channel_set_state(schannel, SPEECH_CHANNEL_READY);
- } else {
- /* received unexpected request state */
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) unexpected STOP request state: %d\n", schannel->name,
- message->start_line.request_state);
- speech_channel_set_state(schannel, SPEECH_CHANNEL_ERROR);
- }
- } else if (message->start_line.method_id == RECOGNIZER_START_INPUT_TIMERS) {
- /* received response to START-INPUT-TIMERS request */
- if (message->start_line.request_state == MRCP_REQUEST_STATE_COMPLETE) {
- if (message->start_line.status_code >= 200 && message->start_line.status_code <= 299) {
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) timers started\n", schannel->name);
- recog_channel_set_timers_started(schannel);
- } else {
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) timers failed to start, status code = %d\n", schannel->name,
- message->start_line.status_code);
- }
- }
- } else if (message->start_line.method_id == RECOGNIZER_DEFINE_GRAMMAR) {
- /* received response to DEFINE-GRAMMAR request */
- if (message->start_line.request_state == MRCP_REQUEST_STATE_COMPLETE) {
- if (message->start_line.status_code >= 200 && message->start_line.status_code <= 299) {
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) grammar loaded\n", schannel->name);
- speech_channel_set_state(schannel, SPEECH_CHANNEL_READY);
- } else {
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) grammar failed to load, status code = %d\n", schannel->name,
- message->start_line.status_code);
- speech_channel_set_state(schannel, SPEECH_CHANNEL_ERROR);
- }
- }
- } else {
- /* received unexpected response */
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) unexpected response, method_id = %d\n", schannel->name,
- (int) message->start_line.method_id);
- speech_channel_set_state(schannel, SPEECH_CHANNEL_ERROR);
- }
- } else if (message->start_line.message_type == MRCP_MESSAGE_TYPE_EVENT) {
- /* received MRCP event */
- if (message->start_line.method_id == RECOGNIZER_RECOGNITION_COMPLETE) {
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) RECOGNITION COMPLETE, Completion-Cause: %03d\n", schannel->name,
- recog_hdr->completion_cause);
- if (message->body.length > 0) {
- if (message->body.buf[message->body.length - 1] == '\0') {
- recog_channel_set_result_headers(schannel, recog_hdr);
- recog_channel_set_results(schannel, message->body.buf);
- } else {
- /* string is not null terminated */
- char *result = (char *) switch_core_alloc(schannel->memory_pool, message->body.length + 1);
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
- "(%s) Recognition result is not null-terminated. Appending null terminator.\n", schannel->name);
- strncpy(result, message->body.buf, message->body.length);
- result[message->body.length] = '\0';
- recog_channel_set_result_headers(schannel, recog_hdr);
- recog_channel_set_results(schannel, result);
- }
- } else {
- char *completion_cause = switch_mprintf("Completion-Cause: %03d", recog_hdr->completion_cause);
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) No result\n", schannel->name);
- recog_channel_set_result_headers(schannel, recog_hdr);
- recog_channel_set_results(schannel, completion_cause);
- switch_safe_free(completion_cause);
- }
- speech_channel_set_state(schannel, SPEECH_CHANNEL_READY);
- } else if (message->start_line.method_id == RECOGNIZER_START_OF_INPUT) {
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) START OF INPUT\n", schannel->name);
- recog_channel_set_start_of_input(schannel);
- } else {
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) unexpected event, method_id = %d\n", schannel->name,
- (int) message->start_line.method_id);
- speech_channel_set_state(schannel, SPEECH_CHANNEL_ERROR);
- }
- } else {
- switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) unexpected message type, message_type = %d\n", schannel->name,
- message->start_line.message_type);
- speech_channel_set_state(schannel, SPEECH_CHANNEL_ERROR);
- }
-
- return TRUE;
-}
-
-/**
- * UniMRCP callback requesting open for speech recognition
- *
- * @param stream the UniMRCP stream
- * @param codec the codec
- * @return TRUE
- */
-static apt_bool_t recog_stream_open(mpf_audio_stream_t *stream, mpf_codec_t *codec)
-{
- speech_channel_t *schannel = (speech_channel_t *) stream->obj;
- recognizer_data_t *r = (recognizer_data_t *) schannel->data;
-
- r->unimrcp_stream = stream;
-
- return TRUE;
-}
-
-/**
- * UniMRCP callback requesting next frame for speech recognition
- *
- * @param stream the UniMRCP stream
- * @param frame the frame to fill
- * @return TRUE
- */
-static apt_bool_t recog_stream_read(mpf_audio_stream_t *stream, mpf_frame_t *frame)
-{
- speech_channel_t *schannel = (speech_channel_t *) stream->obj;
- recognizer_data_t *r = (recognizer_data_t *) schannel->data;
- switch_size_t to_read = frame->codec_frame.size;
-
- /* grab the data. pad it if there isn't enough */
- if (speech_channel_read(schannel, frame->codec_frame.buffer, &to_read, 0) == SWITCH_STATUS_SUCCESS) {
- if (to_read < frame->codec_frame.size) {
- memset((uint8_t *) frame->codec_frame.buffer + to_read, schannel->silence, frame->codec_frame.size - to_read);
- }
- frame->type |= MEDIA_FRAME_TYPE_AUDIO;
- }
-
- switch_mutex_lock(schannel->mutex);
- if (r->dtmf_generator_active) {
- if (!mpf_dtmf_generator_put_frame(r->dtmf_generator, frame)) {
- if (!mpf_dtmf_generator_sending(r->dtmf_generator))
- r->dtmf_generator_active = 0;
- }
- }
- switch_mutex_unlock(schannel->mutex);
-
- return TRUE;
-}
-
-/**
- * Link the recognizer module interface to FreeSWITCH and UniMRCP
- */
-static switch_status_t recog_load(switch_loadable_module_interface_t *module_interface, switch_memory_pool_t *pool)
-{
- /* link to FreeSWITCH ASR / TTS callbacks */
- switch_asr_interface_t *asr_interface = NULL;
- if ((asr_interface = (switch_asr_interface_t *) switch_loadable_module_create_interface(module_interface, SWITCH_ASR_INTERFACE)) == NULL) {
- return SWITCH_STATUS_FALSE;
- }
- asr_interface->interface_name = MOD_UNIMRCP;
- asr_interface->asr_open = recog_asr_open;
- asr_interface->asr_load_grammar = recog_asr_load_grammar;
- asr_interface->asr_unload_grammar = recog_asr_unload_grammar;
- asr_interface->asr_enable_grammar = recog_asr_enable_grammar;
- asr_interface->asr_disable_grammar = recog_asr_disable_grammar;
- asr_interface->asr_disable_all_grammars = recog_asr_disable_all_grammars;
- asr_interface->asr_close = recog_asr_close;
- asr_interface->asr_feed = recog_asr_feed;
- asr_interface->asr_feed_dtmf = recog_asr_feed_dtmf;
- asr_interface->asr_resume = recog_asr_resume;
- asr_interface->asr_pause = recog_asr_pause;
- asr_interface->asr_check_results = recog_asr_check_results;
- asr_interface->asr_get_results = recog_asr_get_results;
- asr_interface->asr_get_result_headers = recog_asr_get_result_headers;
- asr_interface->asr_start_input_timers = recog_asr_start_input_timers;
- asr_interface->asr_text_param = recog_asr_text_param;
- asr_interface->asr_numeric_param = recog_asr_numeric_param;
- asr_interface->asr_float_param = recog_asr_float_param;
-
- /* Create the recognizer application and link its callbacks */
- if ((globals.recog.app = mrcp_application_create(recog_message_handler, (void *) 0, pool)) == NULL) {
- return SWITCH_STATUS_FALSE;
- }
- globals.recog.dispatcher.on_session_update = NULL;
- globals.recog.dispatcher.on_session_terminate = speech_on_session_terminate;
- globals.recog.dispatcher.on_channel_add = speech_on_channel_add;
- globals.recog.dispatcher.on_channel_remove = speech_on_channel_remove;
- globals.recog.dispatcher.on_message_receive = recog_on_message_receive;
- globals.recog.audio_stream_vtable.destroy = NULL;
- globals.recog.audio_stream_vtable.open_rx = recog_stream_open;
- globals.recog.audio_stream_vtable.close_rx = NULL;
- globals.recog.audio_stream_vtable.read_frame = recog_stream_read;
- globals.recog.audio_stream_vtable.open_tx = NULL;
- globals.recog.audio_stream_vtable.close_tx = NULL;
- globals.recog.audio_stream_vtable.write_frame = NULL;
- mrcp_client_application_register(globals.mrcp_client, globals.recog.app, "recog");
-
- /* map FreeSWITCH params or old params to MRCPv2 param */
- switch_core_hash_init_nocase(&globals.recog.fs_param_map);
- /* MRCPv1 param */
- switch_core_hash_insert(globals.recog.fs_param_map, "recognizer-start-timers", "start-input-timers");
-
- /* map MRCP params to UniMRCP ID */
- switch_core_hash_init_nocase(&globals.recog.param_id_map);
- switch_core_hash_insert(globals.recog.param_id_map, "Confidence-Threshold", unimrcp_param_id_create(RECOGNIZER_HEADER_CONFIDENCE_THRESHOLD, pool));
- switch_core_hash_insert(globals.recog.param_id_map, "Sensitivity-Level", unimrcp_param_id_create(RECOGNIZER_HEADER_SENSITIVITY_LEVEL, pool));
- switch_core_hash_insert(globals.recog.param_id_map, "Speed-Vs-Accuracy", unimrcp_param_id_create(RECOGNIZER_HEADER_SPEED_VS_ACCURACY, pool));
- switch_core_hash_insert(globals.recog.param_id_map, "N-Best-List-Length", unimrcp_param_id_create(RECOGNIZER_HEADER_N_BEST_LIST_LENGTH, pool));
- switch_core_hash_insert(globals.recog.param_id_map, "No-Input-Timeout", unimrcp_param_id_create(RECOGNIZER_HEADER_NO_INPUT_TIMEOUT, pool));
- switch_core_hash_insert(globals.recog.param_id_map, "Recognition-Timeout", unimrcp_param_id_create(RECOGNIZER_HEADER_RECOGNITION_TIMEOUT, pool));
- switch_core_hash_insert(globals.recog.param_id_map, "Waveform-Uri", unimrcp_param_id_create(RECOGNIZER_HEADER_WAVEFORM_URI, pool));
- switch_core_hash_insert(globals.recog.param_id_map, "Completion-Cause", unimrcp_param_id_create(RECOGNIZER_HEADER_COMPLETION_CAUSE, pool));
- switch_core_hash_insert(globals.recog.param_id_map, "Recognizer-Context-Block",
- unimrcp_param_id_create(RECOGNIZER_HEADER_RECOGNIZER_CONTEXT_BLOCK, pool));
- switch_core_hash_insert(globals.recog.param_id_map, "Start-Input-Timers", unimrcp_param_id_create(RECOGNIZER_HEADER_START_INPUT_TIMERS, pool));
- switch_core_hash_insert(globals.recog.param_id_map, "Speech-Complete-Timeout",
- unimrcp_param_id_create(RECOGNIZER_HEADER_SPEECH_COMPLETE_TIMEOUT, pool));
- switch_core_hash_insert(globals.recog.param_id_map, "Speech-Incomplete-Timeout",
- unimrcp_param_id_create(RECOGNIZER_HEADER_SPEECH_INCOMPLETE_TIMEOUT, pool));
- switch_core_hash_insert(globals.recog.param_id_map, "DTMF-Interdigit-Timeout",
- unimrcp_param_id_create(RECOGNIZER_HEADER_DTMF_INTERDIGIT_TIMEOUT, pool));
- switch_core_hash_insert(globals.recog.param_id_map, "DTMF-Term-Timeout", unimrcp_param_id_create(RECOGNIZER_HEADER_DTMF_TERM_TIMEOUT, pool));
- switch_core_hash_insert(globals.recog.param_id_map, "DTMF-Term-Char", unimrcp_param_id_create(RECOGNIZER_HEADER_DTMF_TERM_CHAR, pool));
- switch_core_hash_insert(globals.recog.param_id_map, "Failed-Uri", unimrcp_param_id_create(RECOGNIZER_HEADER_FAILED_URI, pool));
- switch_core_hash_insert(globals.recog.param_id_map, "Failed-Uri-Cause", unimrcp_param_id_create(RECOGNIZER_HEADER_FAILED_URI_CAUSE, pool));
- switch_core_hash_insert(globals.recog.param_id_map, "Save-Waveform", unimrcp_param_id_create(RECOGNIZER_HEADER_SAVE_WAVEFORM, pool));
- switch_core_hash_insert(globals.recog.param_id_map, "New-Audio-Channel", unimrcp_param_id_create(RECOGNIZER_HEADER_NEW_AUDIO_CHANNEL, pool));
- switch_core_hash_insert(globals.recog.param_id_map, "Speech-Language", unimrcp_param_id_create(RECOGNIZER_HEADER_SPEECH_LANGUAGE, pool));
- switch_core_hash_insert(globals.recog.param_id_map, "Input-Type", unimrcp_param_id_create(RECOGNIZER_HEADER_INPUT_TYPE, pool));
- switch_core_hash_insert(globals.recog.param_id_map, "Input-Waveform-Uri", unimrcp_param_id_create(RECOGNIZER_HEADER_INPUT_WAVEFORM_URI, pool));
- switch_core_hash_insert(globals.recog.param_id_map, "Completion-Reason", unimrcp_param_id_create(RECOGNIZER_HEADER_COMPLETION_REASON, pool));
- switch_core_hash_insert(globals.recog.param_id_map, "Media-Type", unimrcp_param_id_create(RECOGNIZER_HEADER_MEDIA_TYPE, pool));
- switch_core_hash_insert(globals.recog.param_id_map, "Ver-Buffer-Utterance", unimrcp_param_id_create(RECOGNIZER_HEADER_VER_BUFFER_UTTERANCE, pool));
- switch_core_hash_insert(globals.recog.param_id_map, "Recognition-Mode", unimrcp_param_id_create(RECOGNIZER_HEADER_RECOGNITION_MODE, pool));
- switch_core_hash_insert(globals.recog.param_id_map, "Cancel-If-Queue", unimrcp_param_id_create(RECOGNIZER_HEADER_CANCEL_IF_QUEUE, pool));
- switch_core_hash_insert(globals.recog.param_id_map, "Hotword-Max-Duration", unimrcp_param_id_create(RECOGNIZER_HEADER_HOTWORD_MAX_DURATION, pool));
- switch_core_hash_insert(globals.recog.param_id_map, "Hotword-Min-Duration", unimrcp_param_id_create(RECOGNIZER_HEADER_HOTWORD_MIN_DURATION, pool));
- switch_core_hash_insert(globals.recog.param_id_map, "Interpret-Text", unimrcp_param_id_create(RECOGNIZER_HEADER_INTERPRET_TEXT, pool));
- switch_core_hash_insert(globals.recog.param_id_map, "DTMF-Buffer-Time", unimrcp_param_id_create(RECOGNIZER_HEADER_DTMF_BUFFER_TIME, pool));
- switch_core_hash_insert(globals.recog.param_id_map, "Clear-DTMF-Buffer", unimrcp_param_id_create(RECOGNIZER_HEADER_CLEAR_DTMF_BUFFER, pool));
- switch_core_hash_insert(globals.recog.param_id_map, "Early-No-Match", unimrcp_param_id_create(RECOGNIZER_HEADER_EARLY_NO_MATCH, pool));
-
- return SWITCH_STATUS_SUCCESS;
-}
-
-/**
- * Shutdown the recognizer
- */
-static switch_status_t recog_shutdown()
-{
- if (globals.recog.fs_param_map) {
- switch_core_hash_destroy(&globals.recog.fs_param_map);
- }
- if (globals.recog.param_id_map) {
- switch_core_hash_destroy(&globals.recog.param_id_map);
- }
- return SWITCH_STATUS_SUCCESS;
-}
-
-/**
- * Process the XML configuration for this module
- * Uses the instructions[] defined in this module to process the configuration.
- *
- * @return SWITCH_STATUS_SUCCESS if the configuration is OK
- */
-static switch_status_t mod_unimrcp_do_config()
-{
- switch_xml_t cfg, xml, settings;
- switch_status_t status = SWITCH_STATUS_SUCCESS;
-
- if (!(xml = switch_xml_open_cfg(CONFIG_FILE, &cfg, NULL))) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Could not open %s\n", CONFIG_FILE);
- status = SWITCH_STATUS_FALSE;
- goto done;
- }
-
- if ((settings = switch_xml_child(cfg, "settings"))) {
- if (switch_xml_config_parse(switch_xml_child(settings, "param"), SWITCH_FALSE, instructions) == SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Config parsed ok!\n");
- globals.enable_profile_events = !zstr(globals.enable_profile_events_param) && (!strcasecmp(globals.enable_profile_events_param, "true")
- || !strcmp(globals.enable_profile_events_param, "1"));
- }
- }
-
- done:
-
- if (xml) {
- switch_xml_free(xml);
- }
-
- return status;
-}
-
-#define DEFAULT_LOCAL_IP_ADDRESS "127.0.0.1"
-#define DEFAULT_REMOTE_IP_ADDRESS "127.0.0.1"
-#define DEFAULT_SIP_LOCAL_PORT 5090
-#define DEFAULT_SIP_REMOTE_PORT 5060
-#define DEFAULT_RTP_PORT_MIN 4000
-#define DEFAULT_RTP_PORT_MAX 5000
-
-#define DEFAULT_SOFIASIP_UA_NAME "FreeSWITCH"
-#define DEFAULT_SDP_ORIGIN "FreeSWITCH"
-#define DEFAULT_RESOURCE_LOCATION "media"
-
-/**
- * Get IP address from IP address value
- *
- * @param value "auto" or IP address
- * @param pool the memory pool to use
- * @return IP address
- */
-static char *ip_addr_get(const char *value, apr_pool_t *pool)
-{
- if (!value || strcasecmp(value, "auto") == 0) {
- char *addr = DEFAULT_LOCAL_IP_ADDRESS;
- apt_ip_get(&addr, pool);
- return addr;
- }
- return apr_pstrdup(pool, value);
-}
-
-/**
- * set mod_unimrcp-specific profile configuration
- *
- * @param profile the MRCP profile to configure
- * @param param the param name
- * @param val the param value
- * @param pool the memory pool to use
- */
-static int process_profile_config(profile_t *profile, const char *param, const char *val, switch_memory_pool_t *pool)
-{
- int mine = 1;
- if (strcasecmp(param, "jsgf-mime-type") == 0) {
- profile->jsgf_mime_type = switch_core_strdup(pool, val);
- } else if (strcasecmp(param, "gsl-mime-type") == 0) {
- profile->gsl_mime_type = switch_core_strdup(pool, val);
- } else if (strcasecmp(param, "srgs-xml-mime-type") == 0) {
- profile->srgs_xml_mime_type = switch_core_strdup(pool, val);
- } else if (strcasecmp(param, "srgs-mime-type") == 0) {
- profile->srgs_mime_type = switch_core_strdup(pool, val);
- } else if (strcasecmp(param, "ssml-mime-type") == 0) {
- profile->ssml_mime_type = switch_core_strdup(pool, val);
- } else {
- mine = 0;
- }
-
- return mine;
-}
-
-/**
- * set RTP config struct with param, val pair
- * @param client the MRCP client
- * @param rtp_config the config struct to set
- * @param param the param name
- * @param val the param value
- * @param pool memory pool to use
- * @return true if this param belongs to RTP config
- */
-static int process_rtp_config(mrcp_client_t *client, mpf_rtp_config_t *rtp_config, mpf_rtp_settings_t *rtp_settings, const char *param, const char *val, apr_pool_t *pool)
-{
- int mine = 1;
- if (strcasecmp(param, "rtp-ip") == 0) {
- apt_string_set(&rtp_config->ip, ip_addr_get(val, pool));
- } else if (strcasecmp(param, "rtp-ext-ip") == 0) {
- apt_string_set(&rtp_config->ext_ip, ip_addr_get(val, pool));
- } else if (strcasecmp(param, "rtp-port-min") == 0) {
- rtp_config->rtp_port_min = (apr_port_t) atol(val);
- } else if (strcasecmp(param, "rtp-port-max") == 0) {
- rtp_config->rtp_port_max = (apr_port_t) atol(val);
- } else if (strcasecmp(param, "playout-delay") == 0) {
- rtp_settings->jb_config.initial_playout_delay = atol(val);
- } else if (strcasecmp(param, "min-playout-delay") == 0) {
- rtp_settings->jb_config.min_playout_delay = atol(val);
- } else if (strcasecmp(param, "max-playout-delay") == 0) {
- rtp_settings->jb_config.max_playout_delay = atol(val);
- } else if (strcasecmp(param, "codecs") == 0) {
- const mpf_codec_manager_t *codec_manager = mrcp_client_codec_manager_get(client);
- if (codec_manager) {
- mpf_codec_manager_codec_list_load(codec_manager, &rtp_settings->codec_list, val, pool);
- }
- } else if (strcasecmp(param, "ptime") == 0) {
- rtp_settings->ptime = (apr_uint16_t) atol(val);
- } else if (strcasecmp(param, "rtcp") == 0) {
- rtp_settings->rtcp = atoi(val);
- } else if (strcasecmp(param, "rtcp-bye") == 0) {
- rtp_settings->rtcp_bye_policy = atoi(val);
- } else if (strcasecmp(param, "rtcp-tx-interval") == 0) {
- rtp_settings->rtcp_tx_interval = (apr_uint16_t) atoi(val);
- } else if (strcasecmp(param, "rtcp-rx-resolution") == 0) {
- rtp_settings->rtcp_rx_resolution = (apr_uint16_t) atol(val);
- } else {
- mine = 0;
- }
-
- return mine;
-}
-
-/**
- * set RTSP client config struct with param, val pair
- * @param config the config struct to set
- * @param sig_settings the sig settings struct to set
- * @param param the param name
- * @param val the param value
- * @param pool memory pool to use
- * @return true if this param belongs to RTSP config
- */
-static int process_mrcpv1_config(rtsp_client_config_t *config, mrcp_sig_settings_t *sig_settings, const char *param, const char *val, apr_pool_t *pool)
-{
- int mine = 1;
- if (strcasecmp(param, "server-ip") == 0) {
- sig_settings->server_ip = ip_addr_get(val, pool);
- } else if (strcasecmp(param, "server-port") == 0) {
- sig_settings->server_port = (apr_port_t) atol(val);
- } else if (strcasecmp(param, "resource-location") == 0) {
- sig_settings->resource_location = apr_pstrdup(pool, val);
- } else if (strcasecmp(param, "sdp-origin") == 0) {
- config->origin = apr_pstrdup(pool, val);
- } else if (strcasecmp(param, "max-connection-count") == 0) {
- config->max_connection_count = atol(val);
- } else if (strcasecmp(param, "force-destination") == 0) {
- sig_settings->force_destination = atoi(val);
- } else if (strcasecmp(param, "speechsynth") == 0 || strcasecmp(param, "speechrecog") == 0) {
- apr_table_set(sig_settings->resource_map, param, val);
- } else {
- mine = 0;
- }
- return mine;
-}
-
-/**
- * set SofiaSIP client config struct with param, val pair
- * @param config the config struct to set
- * @param sig_settings the sig settings struct to set
- * @param param the param name
- * @param val the param value
- * @param pool memory pool to use
- * @return true if this param belongs to SofiaSIP config
- */
-static int process_mrcpv2_config(mrcp_sofia_client_config_t *config, mrcp_sig_settings_t *sig_settings, const char *param, const char *val, apr_pool_t *pool)
-{
- int mine = 1;
- if (strcasecmp(param, "client-ip") == 0) {
- config->local_ip = ip_addr_get(val, pool);
- } else if (strcasecmp(param, "client-ext-ip") == 0) {
- config->ext_ip = ip_addr_get(val, pool);
- } else if (strcasecmp(param, "client-port") == 0) {
- config->local_port = (apr_port_t) atol(val);
- } else if (strcasecmp(param, "server-ip") == 0) {
- sig_settings->server_ip = ip_addr_get(val, pool);
- } else if (strcasecmp(param, "server-port") == 0) {
- sig_settings->server_port = (apr_port_t) atol(val);
- } else if (strcasecmp(param, "server-username") == 0) {
- sig_settings->user_name = apr_pstrdup(pool, val);
- } else if (strcasecmp(param, "force-destination") == 0) {
- sig_settings->force_destination = atoi(val);
- } else if (strcasecmp(param, "sip-transport") == 0) {
- config->transport = apr_pstrdup(pool, val);
- } else if (strcasecmp(param, "ua-name") == 0) {
- config->user_agent_name = apr_pstrdup(pool, val);
- } else if (strcasecmp(param, "sdp-origin") == 0) {
- config->origin = apr_pstrdup(pool, val);
- } else {
- mine = 0;
- }
- return mine;
-}
-
-/**
- * Create the MRCP client and configure it with profiles defined in FreeSWITCH XML config
- *
- * Some code and ideas borrowed from unimrcp-client.c
- * Please check libs/unimrcp/platforms/libunimrcp-client/src/unimrcp-client.c when upgrading
- * the UniMRCP library to ensure nothing new needs to be set up.
- *
- * @return the MRCP client
- */
-static mrcp_client_t *mod_unimrcp_client_create(switch_memory_pool_t *mod_pool)
-{
- switch_xml_t cfg = NULL, xml = NULL, profiles = NULL, profile = NULL;
- mrcp_client_t *client = NULL;
- apr_pool_t *pool = NULL;
- mrcp_resource_loader_t *resource_loader = NULL;
- mrcp_resource_factory_t *resource_factory = NULL;
- mpf_codec_manager_t *codec_manager = NULL;
- apr_size_t max_connection_count = 0;
- apt_bool_t offer_new_connection = FALSE;
- mrcp_connection_agent_t *connection_agent;
- mpf_engine_t *media_engine;
- apt_dir_layout_t *dir_layout;
-
- /* create the client */
- if ((dir_layout = apt_default_dir_layout_create("../", mod_pool)) == NULL) {
- goto done;
- }
- client = mrcp_client_create(dir_layout);
- if (!client) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Failed to create MRCP client\n");
- goto done;
- }
-
- pool = mrcp_client_memory_pool_get(client);
- if (!pool) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Failed to get MRCP client memory pool\n");
- client = NULL;
- goto done;
- }
-
- /* load the synthesizer and recognizer resources */
- resource_loader = mrcp_resource_loader_create(FALSE, pool);
- if (!resource_loader) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Failed to create MRCP resource loader\n");
- client = NULL;
- goto done;
- } else {
- apt_str_t synth_resource;
- apt_str_t recog_resource;
- apt_string_set(&synth_resource, "speechsynth");
- mrcp_resource_load(resource_loader, &synth_resource);
- apt_string_set(&recog_resource, "speechrecog");
- mrcp_resource_load(resource_loader, &recog_resource);
- resource_factory = mrcp_resource_factory_get(resource_loader);
- mrcp_client_resource_factory_register(client, resource_factory);
- }
-
- codec_manager = mpf_engine_codec_manager_create(pool);
- if (!codec_manager) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Failed to create MPF codec manager\n");
- client = NULL;
- goto done;
- }
- if (!mrcp_client_codec_manager_register(client, codec_manager)) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Failed to create register MRCP client codec manager\n");
- client = NULL;
- goto done;
- }
-
- /* set up MRCP connection agent that will be shared with all profiles */
- if (!zstr(globals.unimrcp_max_connection_count)) {
- max_connection_count = atoi(globals.unimrcp_max_connection_count);
- }
- if (max_connection_count <= 0) {
- max_connection_count = 100;
- }
- if (!zstr(globals.unimrcp_offer_new_connection)) {
- offer_new_connection = strcasecmp("true", globals.unimrcp_offer_new_connection);
- }
- connection_agent = mrcp_client_connection_agent_create("MRCPv2ConnectionAgent", max_connection_count, offer_new_connection, pool);
- if (!connection_agent) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Failed to create MRCP connection agent\n");
- client = NULL;
- goto done;
- }
- if (!zstr(globals.unimrcp_rx_buffer_size)) {
- apr_size_t rx_buffer_size = (apr_size_t)atol(globals.unimrcp_rx_buffer_size);
- if (rx_buffer_size > 0) {
- mrcp_client_connection_rx_size_set(connection_agent, rx_buffer_size);
- }
- }
- if (!zstr(globals.unimrcp_tx_buffer_size)) {
- apr_size_t tx_buffer_size = (apr_size_t)atol(globals.unimrcp_tx_buffer_size);
- if (tx_buffer_size > 0) {
- mrcp_client_connection_tx_size_set(connection_agent, tx_buffer_size);
- }
- }
- if (!zstr(globals.unimrcp_request_timeout)) {
- apr_size_t request_timeout = (apr_size_t)atol(globals.unimrcp_request_timeout);
- if (request_timeout > 0) {
- mrcp_client_connection_timeout_set(connection_agent, request_timeout);
- }
- }
- if (!mrcp_client_connection_agent_register(client, connection_agent)) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Failed to create register MRCP connection agent\n");
- client = NULL;
- goto done;
- }
-
- /* Set up the media engine that will be shared with all profiles */
- media_engine = mpf_engine_create("MediaEngine", pool);
- if (!media_engine) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Failed to create MPF media engine\n");
- client = NULL;
- goto done;
- }
- if (!mpf_engine_scheduler_rate_set(media_engine, 1)) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Failed to set MPF engine scheduler rate\n");
- client = NULL;
- goto done;
- }
- if (!mrcp_client_media_engine_register(client, media_engine)) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Failed to register MPF media engine\n");
- client = NULL;
- goto done;
- }
-
- /* configure the client profiles */
- if (!(xml = switch_xml_open_cfg(CONFIG_FILE, &cfg, NULL))) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Could not open %s\n", CONFIG_FILE);
- client = NULL;
- goto done;
- }
- if ((profiles = switch_xml_child(cfg, "profiles"))) {
- for (profile = switch_xml_child(profiles, "profile"); profile; profile = switch_xml_next(profile)) {
- /* a profile is a signaling agent + termination factory + media engine + connection agent (MRCPv2 only) */
- mrcp_sig_agent_t *agent = NULL;
- mpf_termination_factory_t *termination_factory = NULL;
- mrcp_profile_t *mprofile = NULL;
- mpf_rtp_config_t *rtp_config = NULL;
- mpf_rtp_settings_t *rtp_settings = mpf_rtp_settings_alloc(pool);
- mrcp_sig_settings_t *sig_settings = mrcp_signaling_settings_alloc(pool);
- profile_t *mod_profile = NULL;
- switch_xml_t default_params = NULL;
- mrcp_connection_agent_t *v2_profile_connection_agent = NULL;
-
- /* get profile attributes */
- const char *name = apr_pstrdup(pool, switch_xml_attr(profile, "name"));
- const char *version = switch_xml_attr(profile, "version");
- if (zstr(name) || zstr(version)) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "<profile> missing name or version attribute\n");
- client = NULL;
- goto done;
- }
-
- /* prepare mod_unimrcp's profile for configuration */
- profile_create(&mod_profile, name, mod_pool);
- if (mod_profile) {
- switch_core_hash_insert(globals.profiles, mod_profile->name, mod_profile);
- } else {
- client = NULL;
- goto done;
- }
-
- /* pull in any default SPEAK params */
- default_params = switch_xml_child(profile, "synthparams");
- if (default_params) {
- switch_xml_t param = NULL;
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Loading SPEAK params\n");
- for (param = switch_xml_child(default_params, "param"); param; param = switch_xml_next(param)) {
- const char *param_name = switch_xml_attr(param, "name");
- const char *param_value = switch_xml_attr(param, "value");
- if (zstr(param_name)) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing SPEAK param name\n");
- client = NULL;
- goto done;
- }
- if (zstr(param_value)) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing SPEAK param value\n");
- client = NULL;
- goto done;
- }
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Loading SPEAK Param %s:%s\n", param_name, param_value);
- switch_core_hash_insert(mod_profile->default_synth_params, switch_core_strdup(pool, param_name), switch_core_strdup(pool, param_value));
- }
- }
-
- /* pull in any default RECOGNIZE params */
- default_params = switch_xml_child(profile, "recogparams");
- if (default_params) {
- switch_xml_t param = NULL;
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Loading RECOGNIZE params\n");
- for (param = switch_xml_child(default_params, "param"); param; param = switch_xml_next(param)) {
- const char *param_name = switch_xml_attr(param, "name");
- const char *param_value = switch_xml_attr(param, "value");
- if (zstr(param_name)) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing RECOGNIZE param name\n");
- client = NULL;
- goto done;
- }
- if (zstr(param_value)) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing RECOGNIZE param value\n");
- client = NULL;
- goto done;
- }
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Loading RECOGNIZE Param %s:%s\n", param_name, param_value);
- switch_core_hash_insert(mod_profile->default_recog_params, switch_core_strdup(pool, param_name), switch_core_strdup(pool, param_value));
- }
- }
-
- /* create RTP config, common to MRCPv1 and MRCPv2 */
- rtp_config = mpf_rtp_config_alloc(pool);
- rtp_config->rtp_port_min = DEFAULT_RTP_PORT_MIN;
- rtp_config->rtp_port_max = DEFAULT_RTP_PORT_MAX;
- apt_string_set(&rtp_config->ip, DEFAULT_LOCAL_IP_ADDRESS);
-
- if (strcmp("1", version) == 0) {
- /* MRCPv1 configuration */
- switch_xml_t param = NULL;
- rtsp_client_config_t *config = mrcp_unirtsp_client_config_alloc(pool);
- config->origin = DEFAULT_SDP_ORIGIN;
- sig_settings->resource_location = DEFAULT_RESOURCE_LOCATION;
- v2_profile_connection_agent = NULL;
-
- if (!zstr(globals.unimrcp_request_timeout)) {
- apr_size_t request_timeout = (apr_size_t)atol(globals.unimrcp_request_timeout);
- if (request_timeout > 0) {
- config->request_timeout = request_timeout;
- }
- }
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Loading MRCPv1 profile: %s\n", name);
- for (param = switch_xml_child(profile, "param"); param; param = switch_xml_next(param)) {
- const char *param_name = switch_xml_attr(param, "name");
- const char *param_value = switch_xml_attr(param, "value");
- if (zstr(param_name)) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing param name\n");
- client = NULL;
- goto done;
- }
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Loading Param %s:%s\n", param_name, param_value);
- if (!process_mrcpv1_config(config, sig_settings, param_name, param_value, pool) &&
- !process_rtp_config(client, rtp_config, rtp_settings, param_name, param_value, pool) &&
- !process_profile_config(mod_profile, param_name, param_value, mod_pool)) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Ignoring unknown param %s\n", param_name);
- }
- }
- agent = mrcp_unirtsp_client_agent_create(name, config, pool);
- if (!agent) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to create MRCP RTSP client agent\n");
- client = NULL;
- goto done;
- }
- } else if (strcmp("2", version) == 0) {
- /* MRCPv2 configuration */
- mrcp_sofia_client_config_t *config = mrcp_sofiasip_client_config_alloc(pool);
- switch_xml_t param = NULL;
- config->local_ip = DEFAULT_LOCAL_IP_ADDRESS;
- config->local_port = DEFAULT_SIP_LOCAL_PORT;
- sig_settings->server_ip = DEFAULT_REMOTE_IP_ADDRESS;
- sig_settings->server_port = DEFAULT_SIP_REMOTE_PORT;
- config->ext_ip = NULL;
- config->user_agent_name = DEFAULT_SOFIASIP_UA_NAME;
- config->origin = DEFAULT_SDP_ORIGIN;
- v2_profile_connection_agent = connection_agent;
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Loading MRCPv2 profile: %s\n", name);
- for (param = switch_xml_child(profile, "param"); param; param = switch_xml_next(param)) {
- const char *param_name = switch_xml_attr(param, "name");
- const char *param_value = switch_xml_attr(param, "value");
- if (zstr(param_name)) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing param name\n");
- client = NULL;
- goto done;
- }
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Loading Param %s:%s\n", param_name, param_value);
- if (!process_mrcpv2_config(config, sig_settings, param_name, param_value, pool) &&
- !process_rtp_config(client, rtp_config, rtp_settings, param_name, param_value, pool) &&
- !process_profile_config(mod_profile, param_name, param_value, mod_pool)) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Ignoring unknown param %s\n", param_name);
- }
- }
- agent = mrcp_sofiasip_client_agent_create(name, config, pool);
- if (!agent) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to create MRCP SIP client agent\n");
- client = NULL;
- goto done;
- }
- } else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "version must be either \"1\" or \"2\"\n");
- client = NULL;
- goto done;
- }
-
- termination_factory = mpf_rtp_termination_factory_create(rtp_config, pool);
- if (!termination_factory) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to create RTP termination factory\n");
- client = NULL;
- goto done;
- }
- mrcp_client_rtp_factory_register(client, termination_factory, name);
- mrcp_client_rtp_settings_register(client, rtp_settings, "RTP-Settings");
- mrcp_client_signaling_settings_register(client, sig_settings, "Signaling-Settings");
- mrcp_client_signaling_agent_register(client, agent);
-
- /* create the profile and register it */
- mprofile = mrcp_client_profile_create(NULL, agent, v2_profile_connection_agent, media_engine, termination_factory, rtp_settings, sig_settings, pool);
- if (!mprofile) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to create MRCP client profile\n");
- client = NULL;
- goto done;
- }
- mrcp_client_profile_register(client, mprofile, name);
- }
- }
-
- done:
-
- if (xml) {
- switch_xml_free(xml);
- }
-
- return client;
-}
-
-/**
- * Macro expands to: switch_status_t mod_unimrcp_load(switch_loadable_module_interface_t **module_interface, switch_memory_pool_t *pool)
- */
-SWITCH_MODULE_LOAD_FUNCTION(mod_unimrcp_load)
-{
- if (switch_event_reserve_subclass(MY_EVENT_PROFILE_CREATE) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", MY_EVENT_PROFILE_CREATE);
- return SWITCH_STATUS_TERM;
- }
-
- if (switch_event_reserve_subclass(MY_EVENT_PROFILE_CLOSE) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", MY_EVENT_PROFILE_CLOSE);
- return SWITCH_STATUS_TERM;
- }
-
- if (switch_event_reserve_subclass(MY_EVENT_PROFILE_OPEN) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", MY_EVENT_PROFILE_OPEN);
- return SWITCH_STATUS_TERM;
- }
-
- /* connect my internal structure to the blank pointer passed to me */
- *module_interface = switch_loadable_module_create_module_interface(pool, modname);
-
- memset(&globals, 0, sizeof(globals));
- switch_mutex_init(&globals.mutex, SWITCH_MUTEX_UNNESTED, pool);
- globals.speech_channel_number = 0;
- switch_core_hash_init_nocase(&globals.profiles);
-
- /* get MRCP module configuration */
- mod_unimrcp_do_config();
- if (zstr(globals.unimrcp_default_synth_profile)) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing default-tts-profile\n");
- return SWITCH_STATUS_FALSE;
- }
- if (zstr(globals.unimrcp_default_recog_profile)) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing default-asr-profile\n");
- return SWITCH_STATUS_FALSE;
- }
-
- /* link UniMRCP logs to FreeSWITCH */
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "UniMRCP log level = %s\n", globals.unimrcp_log_level);
- if (apt_log_instance_create(APT_LOG_OUTPUT_NONE, str_to_log_level(globals.unimrcp_log_level), pool) == FALSE) {
- /* already created */
- apt_log_priority_set(str_to_log_level(globals.unimrcp_log_level));
- }
- apt_log_ext_handler_set(unimrcp_log);
-
- /* Create the MRCP client */
- if ((globals.mrcp_client = mod_unimrcp_client_create(pool)) == NULL) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to create mrcp client\n");
- return SWITCH_STATUS_FALSE;
- }
-
- /* Create the synthesizer interface */
- if (synth_load(*module_interface, pool) != SWITCH_STATUS_SUCCESS) {
- return SWITCH_STATUS_FALSE;
- }
-
- /* Create the recognizer interface */
- if (recog_load(*module_interface, pool) != SWITCH_STATUS_SUCCESS) {
- return SWITCH_STATUS_FALSE;
- }
-
- /* Start the client stack */
- mrcp_client_start(globals.mrcp_client);
-
- /* indicate that the module should continue to be loaded */
- return SWITCH_STATUS_SUCCESS;
-}
-
-/**
- * Called when the system shuts down
- * Macro expands to: switch_status_t mod_unimrcp_shutdown()
- */
-SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_unimrcp_shutdown)
-{
-
- switch_event_free_subclass(MY_EVENT_PROFILE_CREATE);
- switch_event_free_subclass(MY_EVENT_PROFILE_CLOSE);
- switch_event_free_subclass(MY_EVENT_PROFILE_OPEN);
-
- synth_shutdown();
- recog_shutdown();
-
- /* Stop the MRCP client stack */
- mrcp_client_shutdown(globals.mrcp_client);
- mrcp_client_destroy(globals.mrcp_client);
- globals.mrcp_client = 0;
-
- switch_core_hash_destroy(&globals.profiles);
-
- return SWITCH_STATUS_SUCCESS;
-}
-
-/**
- * If it exists, this is called in it's own thread when the module-load completes
- * If it returns anything but SWITCH_STATUS_TERM it will be called again automatically
- * Macro expands to: switch_status_t mod_unimrcp_runtime()
- */
-SWITCH_MODULE_RUNTIME_FUNCTION(mod_unimrcp_runtime)
-{
- return SWITCH_STATUS_TERM;
-}
-
-/**
- * Translate log level string to enum
- * @param level log level string
- * @return log level enum
- */
-static apt_log_priority_e str_to_log_level(const char *level)
-{
- if (strcmp(level, "EMERGENCY") == 0) {
- return APT_PRIO_EMERGENCY;
- } else if (strcmp(level, "ALERT") == 0) {
- return APT_PRIO_ALERT;
- } else if (strcmp(level, "CRITICAL") == 0) {
- return APT_PRIO_CRITICAL;
- } else if (strcmp(level, "ERROR") == 0) {
- return APT_PRIO_ERROR;
- } else if (strcmp(level, "WARNING") == 0) {
- return APT_PRIO_WARNING;
- } else if (strcmp(level, "NOTICE") == 0) {
- return APT_PRIO_NOTICE;
- } else if (strcmp(level, "INFO") == 0) {
- return APT_PRIO_INFO;
- } else if (strcmp(level, "DEBUG") == 0) {
- return APT_PRIO_DEBUG;
- }
- return APT_PRIO_DEBUG;
-}
-
-/**
- * Connects UniMRCP logging to FreeSWITCH
- * @return TRUE
- */
-static apt_bool_t unimrcp_log(const char *file, int line, const char *obj, apt_log_priority_e priority, const char *format, va_list arg_ptr)
-{
- switch_log_level_t level;
- char log_message[4096] = { 0 }; /* same size as MAX_LOG_ENTRY_SIZE in UniMRCP apt_log.c */
- size_t msglen;
- const char *id = (obj == NULL) ? "" : ((speech_channel_t *)obj)->name;
-
- if (zstr(format)) {
- return TRUE;
- }
-
- switch (priority) {
- case APT_PRIO_EMERGENCY:
- /* pass through */
- case APT_PRIO_ALERT:
- /* pass through */
- case APT_PRIO_CRITICAL:
- level = SWITCH_LOG_CRIT;
- break;
- case APT_PRIO_ERROR:
- level = SWITCH_LOG_ERROR;
- break;
- case APT_PRIO_WARNING:
- level = SWITCH_LOG_WARNING;
- break;
- case APT_PRIO_NOTICE:
- level = SWITCH_LOG_NOTICE;
- break;
- case APT_PRIO_INFO:
- level = SWITCH_LOG_INFO;
- break;
- case APT_PRIO_DEBUG:
- /* pass through */
- default:
- level = SWITCH_LOG_DEBUG;
- break;
- }
-
- /* apr_vsnprintf supports format extensions required by UniMRCP */
- apr_vsnprintf(log_message, sizeof(log_message), format, arg_ptr);
- msglen = strlen(log_message);
- if (msglen >= 2 && log_message[msglen - 2] == '\\' && log_message[msglen - 1] == 'n') {
- /* log_message already ends in \n */
- switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, "", line, NULL, level, "(%s) %s", id, log_message);
- } else if (msglen > 0) {
- /* log message needs \n appended */
- switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, "", line, NULL, level, "(%s) %s\n", id, log_message);
- }
-
- return TRUE;
-}
-
-/**
- * @return the next number to assign the channel
- */
-static int get_next_speech_channel_number(void)
-{
- int num;
- switch_mutex_lock(globals.mutex);
- num = globals.speech_channel_number;
- if (globals.speech_channel_number == INT_MAX) {
- globals.speech_channel_number = 0;
- } else {
- globals.speech_channel_number++;
- }
- switch_mutex_unlock(globals.mutex);
-
- return num;
-}
-
-/**
- * Create a parameter id
- *
- * @param id the UniMRCP ID
- * @return the pair
- */
-static unimrcp_param_id_t *unimrcp_param_id_create(int id, switch_memory_pool_t *pool)
-{
- unimrcp_param_id_t *param = (unimrcp_param_id_t *) switch_core_alloc(pool, sizeof(unimrcp_param_id_t));
- if (param) {
- param->id = id;
- }
- return param;
-}
-
-
-/* For Emacs:
- * Local Variables:
- * mode:c
- * indent-tabs-mode:t
- * tab-width:4
- * c-basic-offset:4
- * End:
- * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
- */
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>\r
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
- <ImportGroup Label="PropertySheets">\r
- <Import Project="..\..\..\..\w32\apr.props" />\r
- </ImportGroup>\r
- <PropertyGroup>\r
- <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>\r
- </PropertyGroup>\r
- <ItemDefinitionGroup>\r
- <ClCompile>\r
- <AdditionalIncludeDirectories>$(SolutionDir)libs\unimrcp\platforms\libunimrcp-client\include;$(SolutionDir)libs\unimrcp\libs\mrcp-client\include;$(SolutionDir)libs\unimrcp\libs\mrcp-signaling\include;$(SolutionDir)libs\unimrcp\libs\apr-toolkit\include;$(SolutionDir)libs\unimrcp\build;$(SolutionDir)libs\unimrcp\libs\mrcp\include;$(SolutionDir)libs\unimrcp\libs\mrcp\message\include;$(SolutionDir)libs\unimrcp\libs\mrcp\control\include;$(SolutionDir)libs\unimrcp\libs\mrcp\resources\include;$(SolutionDir)libs\unimrcp\libs\mpf\include;$(SolutionDir)libs\unimrcp\libs\mrcpv2-transport\include;$(SolutionDir)libs\unimrcp\modules\mrcp-sofiasip\include;$(SolutionDir)libs\unimrcp\modules\mrcp-unirtsp\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
- <PreprocessorDefinitions>MRCP_STATIC_LIB;MPF_STATIC_LIB;APT_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
- </ClCompile>\r
- </ItemDefinitionGroup>\r
-</Project>
\ No newline at end of file
</input>
]]>
</alias>
- <alias name="input_voice_yesno_unimrcp" target="call">
- <![CDATA[
- <input xmlns="urn:xmpp:rayo:input:1" mode="voice" recognizer="unimrcp">
- <grammar content-type="application/srgs+xml>
- <![CDATA[
- <grammar xmlns="http://www.w3.org/2001/06/grammar"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.w3.org/2001/06/grammar http://www.w3.org/TR/speech-grammar/grammar.xsd"
- xml:lang="en-US" version="1.0">
- <rule id="yesno"><one-of><item>yes</item><item>no</item></one-of></rule></grammar>
- ]]]]><![CDATA[>
- </grammar>
- </input>
- ]]>
- </alias>
- <alias name="input_voice_yesno_unimrcp_timeout" target="call">
- <![CDATA[
- <input xmlns="urn:xmpp:rayo:input:1" mode="voice" recognizer="unimrcp" max-silence="5000" initial-timeout="5000">
- <grammar content-type="application/srgs+xml>
- <![CDATA[
- <grammar xmlns="http://www.w3.org/2001/06/grammar"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.w3.org/2001/06/grammar http://www.w3.org/TR/speech-grammar/grammar.xsd"
- xml:lang="en-US" version="1.0">
- <rule id="yesno"><one-of><item>yes</item><item>no</item></one-of></rule></grammar>
- ]]]]><![CDATA[>
- </grammar>
- </input>
- ]]>
- </alias>
<alias name="input_voice_yesno_pocketsphinx" target="call">
<![CDATA[